Ticker

6/recent/ticker-posts

Cross compile Raspberry Pi kernel from source on Ubuntu

This post show how to build Raspberry Pi kernel on Ubuntu, then copy the kernel.img and other files to Raspbian installed SD Card.

Create our working directory, raspberrypi:
  • $ mkdir raspberrypi
  • cd raspberrypi
Before start our works, install the necessary tools and source code of Raspberry Pi linux:
  • $ git clone https://github.com/raspberrypi/tools.git
  • $ git clone https://github.com/raspberrypi/linux.git
Prepare the .config file from pre-packaged config, bcmrpi_cutdown_defconfig:
  • $ cd linux
  • $ make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- bcmrpi_cutdown_defconfig
Build kernel:
  • $ make ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi-
  • $ mkdir ../modules
  • $ make modules_install ARCH=arm CROSS_COMPILE=/usr/bin/arm-linux-gnueabi- INSTALL_MOD_PATH=../modules/
  • $ cd ../tools/mkimage/
  • $ ./imagetool-uncompressed.py ../../linux/arch/arm/boot/Image
Now insert a Raspbian installed SD Card, and run the command:
  • $ sudo rm /media//kernel.img
  • $ sudo mv kernel.img /media//
  • $ sudo rm -rf /media//lib/modules/
  • $ sudo rm -rf /media//lib/firmware/
  • $ cd ../../modules/
  • $ sudo cp -a lib/modules/ /media//lib/
  • $ sudo cp -a lib/firmware/ /media//lib/
  • $ sync
Now you can remove the SD Card and use it to boot Raspberry Pi with the new kernel.

- The original kernel run 3.10.25+

- The new generated kernel run 3.10.27+

إرسال تعليق

0 تعليقات