Rapsberry Pi - U-Boot and (rpi foundation) kernel


Note: We can't use the linaro toolchain for rpi1, because it's compiled for a newer class of arm processors. We must use either our own toolchain or the toolchain from the raspberry foundation

Firmware tools (bootloader etc):

mkdir -p firmware
cd firmware
wget https://github.com/raspberrypi/firmware/raw/master/boot/bootcode.bin
wget https://github.com/raspberrypi/firmware/raw/master/boot/fixup.dat
wget https://github.com/raspberrypi/firmware/raw/master/boot/start.elf

# insert sdcard, mount...
cp bootcode.bin fixup.dat start.elf /run/media/$USER/boot/


Note: we don't really need u-boot to boot the kernel on raspberry, the bootcode.bin/start.elf bootloader is capable of loading it, but u-boot gives us more flexibility (loading kernels from usb/network, manually booting with different commandlines without having to edit config.txt etc.)

git clone git://git.denx.de/u-boot.git
cd u-boot

# ls configs/*rpi*

export CROSS_COMPILE=arm-linux-gnueabihf-

# rpi_2_defconfig for rpi2
make rpi_defconfig
make menuconfig
time ionice -c3 nice -n10 make  -j5

# insert sdcard, mount...
# we "pretend" u-boot is kernel ;)
cp u-boot.bin  /run/media/$USER/boot/kernel.img



wget https://github.com/raspberrypi/linux/archive/rpi-4.1.y.tar.gz
tar xf rpi-4.1.y.tar.gz
cd linux-rpi-4.1.y/

export ARCH=arm
export CROSS_COMPILE=arm-linux-gnueabihf-

make help | grep omap2
# or
# ls arch/arm/configs/bcm*

#device tree
ls arch/arm/boot/dts/*rpi*

# bcm2709_defconfig for rpi2
make bcmrpi_defconfig

#  for faster build (we don't need modules right now): make -j5  zImage dtbs
time ionice -c3 nice -n10 make -j5

# insert sdcard, mount...
cp arch/arm/boot/zImage /run/media/$USER/boot/
cp arch/arm/boot/dts/*rpi*.dtb /run/media/$USER/boot


#load kernel
load mmc 0:1 0x00200000 zImage

#load device tree
load mmc 0:1 0x00000100 bcm2708-rpi-b?????????.dtb

# run kernel (finally)
setenv bootargs earlyprintk console=ttyAMA0,115200
bootz 0x00200000 - 0x00000100
Vim logo FireFox logo CSS XHTML
Jozef Siska @ KAI FMFI UK YoYo @ KSP KAI (DAI) KSP