projects github about
Raspberry Pi 3 with 64-bit U-Boot

This time let’s try to use U-Boot to load the Linux kernel and boot our Raspberry Pi 3.
We need : U-Boot v.2017.11 file_download

Get The SourceCode

Get the source code by cloning the U-Boot git repository :

1
git clone --depth 1 --branch v2017.11 git://git.denx.de/u-boot.git v2017.11

or download the tar file :

1
wget ftp://ftp.denx.de/pub/u-boot/u-boot-2017.11.tar.bz2

Compile U-Boot

rpi_3_defconfig - arm64 config RPi 3. -C source folder v2017.11
1
2
3
4
5
6
sudo make -C v2017.11/ CROSS_COMPILE=aarch64-linux-gnu- rpi_3_defconfig
sudo make -C v2017.11/ CROSS_COMPILE=aarch64-linux-gnu-

    # For v2017.05 use below
sudo make -C v2017.05/ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- rpi_3_defconfig
sudo make -C v2017.05/ ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-

After it has been built. Locate u-boot.bin in your output_path as this is the file we need.


Create the Bootscript

Create a `rpi3-bootscript.txt` file and copy paste the code below :
1
2
3
4
5
6
7
8
// rpi3-bootscript.txt

setenv kernel_addr_r 0x01000000
setenv ramdisk_addr_r 0x02100000
fatload mmc 0:1 ${kernel_addr_r} boot/Image
fatload mmc 0:1 ${ramdisk_addr_r} boot/initrd.img
setenv initrdsize $filesize
booti ${kernel_addr_r} ${ramdisk_addr_r}:${initrdsize} ${fdt_addr_r}
boot/Image - The Linux kernel we compile from Raspberry Pi 3 64-bit kernel and place under a folder boot.
boot/initrd.img - Ramdisk image we created from Using Ubuntu-base arm64 rootfs for Raspberry Pi 3.
If you dont have a Ramdisk yet, replace ${ramdisk_addr_r}:${initrdsize} with -.
mkimage -T script -n 'Bootscript' -C none -d ~/<input_file> ~/<output_file>.scr - Syntax for creating the bootscript
Now to create a bootscript from the text file above :
1
$   sudo mkimage -A arm64 -O linux -T script -d ~/rpi3-bootscript.txt ~/boot.scr
Copy `boot.scr` to your MicroSD card inside `/boot` folder.
u-boot.bin - Can be renamed to any-name and modify it’s entry in config.txt kernel=boot/u-boot.bin-to-any-name.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// config.txt

# Serial console output!
enable_uart=1

# 64bit-mode
arm_control=0x200

# Use U-Boot
kernel=boot/u-boot.bin

device_tree_address=0x100
device_tree_end=0x8000

dtparam=i2c_arm=on
dtparam=spi=on
Then verify your MicroSD directory structure like below :
1
2
3
4
5
6
7
8
9
10
/boot/Image
/boot/boot.scr
/boot/u-boot.bin
/boot/initrd.img
bcm2710-rpi-3-b.dtb
bootcode.bin
start.elf 
fixup.dat 
config.txt
cmdline.txt
Boot it up to confirm that its working.
For revision... TO-Do Net booting only works via ethernet connection...

Reference :

http://www.denx.de/wiki/U-Boot/WebHome