Raspberry Pi 2 – Debian Jessie and U-Boot

This is a short post how to add u-boot to the debian jessie image created by Sjoerd Simons.

The fastest solution is to copy my u-boot.bin, my boot.scr and my config.txt to /boot/firmware. I’m going to upload the files soon. I uploaded the files to https://gitlab.com/parobalth/u-boot_rpi2


If you want to follow my steps or want to improve them:

You may have already read or may want to read:

https://wiki.debian.org/RaspberryPi

https://wiki.debian.org/RaspberryPi2

First you need Sjoerd Simons Debian image (download it and write it to your micro sd-card):

https://www.collabora.com/about-us/blog/2015/02/03/debian-jessie-on-raspberry-pi-2/

Second you have to build u-boot:

My source for the u-boot part is:

https://blog.night-shade.org.uk/2015/05/booting-a-raspberry-pi2-with-u-boot-and-hyp-enabled/

Basically I used the same commands but without crossbuilding and without the need for a serial console. I built u-boot on the raspberry pi 2 and made the boot.scr file without testing. (It works for me)

1. I installed ‘build-essential’ and some of it’s recommendations on my Rpi2 to build u-boot successfully.

2. execute this commands:

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

cd u-boot

make rpi_2_defconfig

make all

3. copy u-boot.bin to /boot/firmware on your Rpi2

4. add this line to config.txt:

kernel=u-boot.bin

5. save the following lines in a file to configure u-boot:

# Tell Linux that it is booting on a Raspberry Pi2

setenv machid 0x00000c42

# Set the kernel boot command line

setenv bootargs "earlyprintk console=tty0 console=ttyAMA0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait noinitrd"

# Save these changes to u-boot's environment

saveenv

# Load the existing Linux kernel into RAM

fatload mmc 0:1 ${kernel_addr_r} kernel7.img

# Boot the kernel we have just loaded

bootz ${kernel_addr_r}

and run the following code on the file (change the /path/to/script part so it points to your file) to make the boot.src file for u-boot:

mkimage -A arm -O linux -T script -C none -a 0x00000000 -e 0x00000000 -n "RPi2 Boot Script" -d /path/to/script /boot/firmware/boot.scr

You can now reboot your Rpi2 and keep your fingers crossed. If it fails you can mount the card with a cardreader on another computer/laptop and uncomment the added line in config.txt. Then your Rpi2 will boot as before without u-boot.

Advertisements