Raspberry Pi - U-Boot and kernel (vanilla)

Note: Unfortunatelly for now vanilla kernel works only with Raspberry Pi 1, not 2. For RPi2 follow the rpi guide

Toolchain

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

wget -Oraspberrypi-tools.tar.gz  https://github.com/raspberrypi/tools/archive/master.tar.gz
tar xf raspberrypi-tools.tar.gz
# remove the "-x64" for 32bit systems
export PATH=$(pwd)/tools-master/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian-x64/bin/:$PATH

Firmware tools (bootloader etc):

https://github.com/raspberrypi/firmware
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/

U-Boot

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

# ls configs/*rpi*

export CROSS_COMPILE=arm-linux-gnueabihf-

make rpi_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...
# we "pretend" u-boot is kernel ;)
cp u-boot.bin  /run/media/$USER/boot/kernel.img

Booting

U-Boot 2015.10-00236-g677f970-dirty (Oct 27 2015 - 10:50:10 +0100)

DRAM:  128 MiB
RPI Model B rev2
MMC:   bcm2835_sdhci: 0
reading uboot.env

** Unable to read "uboot.env" from mmc0:1 **
Using default environment

In:    serial
Out:   lcd
Err:   lcd
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  0 
U-Boot>

Kernel

wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.2.3.tar.xz
tar xf linux-4.2.3.tar.xz
cd linux-4.2.3/

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

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

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

make bcm2835_defconfig
time ionice -c3 nice -n10 make -j5

# insert sdcard
cp arch/arm/boot/zImage /run/media/$USER/boot
cp arch/arm/boot/dts/bcm2835-rpi-b???????????.dtb /run/media/$USER/boot

Booting:

#load kernel
load mmc 0:1 0x00200000 zImage


#load device tree
load mmc 0:1 0x00000100 bcm2835-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