Difference between revisions of "RPi Upstream Kernel Compilation"

From eLinux.org
Jump to: navigation, search
(Undo revision 351014 by RFreire. Added link to how-to.)
Line 16: Line 16:
 
  make -s ARCH=arm zImage -j8 -s && make -s ARCH=arm dtbs
 
  make -s ARCH=arm zImage -j8 -s && make -s ARCH=arm dtbs
  
Copy to SD card: Copy <tt>arch/arm/boot/zImage</tt> (renamed to <tt>kernel.img</tt>) and <tt>arch/arm/boot/dts/bcm2835-rpi-b.dtb</tt>.
+
Copy to SD card: Copy <tt>arch/arm/boot/zImage</tt> and <tt>arch/arm/boot/dts/bcm2835-rpi-b.dtb</tt>.
  
The file <tt>config.txt</tt> is not needed when using U-Boot. I suggest deleting it, or rather, renaming it to disable it, but still keep it around if you need to go back.
+
You'll likely want to use upstream U-Boot to boot the upstream kernel. See [[RPi_U-Boot]]. U-Boot has known-working support for Device Tree. I'm not sure what state the binary firmware has for DT. If you try booting with the binary firmware, make sure the rename <tt>zImage</tt> to <tt>kernel.img</tt> when copying to the SD card. If booting with U-Boot, keeping the <tt>zImage</tt> name is best; certainly don't rename it to <tt>kernel.img</tt>, since U-Boot will be installed to that file.
 
 
You'll likely want to use upstream U-Boot to boot the upstream kernel. See [[RPi_U-Boot]]. U-Boot has known-working support for Device Tree. I'm not sure what state the binary firmware has for DT.
 
  
 
{{Template:Raspberry Pi}}
 
{{Template:Raspberry Pi}}
 
[[Category:RaspberryPi]]
 
[[Category:RaspberryPi]]
 
[[Category:Linux-kernel]]
 
[[Category:Linux-kernel]]

Revision as of 11:26, 18 September 2014

This page describes how to compile an upstream or mainline kernel for the Raspberry Pi. It is mainly useful for upstream kernel maintainers/developers, or distribution kernel package maintainers.

As of 20140211, all of UART (serial), SD card, HDMI (via simple-framebuffer), and USB should work. Not all SD cards will work (it may depend on the transfer modes the card supports, and timing tolerances). Not all USB devices will work (it may depend on the type of transfer, interrupt/control/bulk, the device uses, etc.)

This page is kept deliberately terse, so as not to duplicate RPi_Kernel_Compilation, which describes how to compile the Raspberry Pi Foundation's downstream kernel. Read that page for some background if this page doesn't make sense to you. For a comprehensive how-to, please refer to RPI_Upstreaming article.

Get the mainline source:

git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
cd linux

Compile:

export CROSS_COMPILE=/path/to/cross_compiler-
make ARCH=arm bcm2835_defconfig
make -s ARCH=arm zImage -j8 -s && make -s ARCH=arm dtbs

Copy to SD card: Copy arch/arm/boot/zImage and arch/arm/boot/dts/bcm2835-rpi-b.dtb.

You'll likely want to use upstream U-Boot to boot the upstream kernel. See RPi_U-Boot. U-Boot has known-working support for Device Tree. I'm not sure what state the binary firmware has for DT. If you try booting with the binary firmware, make sure the rename zImage to kernel.img when copying to the SD card. If booting with U-Boot, keeping the zImage name is best; certainly don't rename it to kernel.img, since U-Boot will be installed to that file.