[BPI-R64] Download and setup separate ATF image for booting directly into kernel or u-boot

[BPI-R64] Download and setup separate ATF image for booting directly into kernel or u-boot.

Download sdmmc-header.img

Download sdmmc-atf.img

Download emmc-header.img

Download emmc-atf.img

Setup a GPT formatted sd-card with parted with the following partitions:

  • atf - Starting at sector 34 (sectorsize 512 bytes) This will contain the entire ATF bootloader
  • fip - Where to write fip containig ether kernel + dtb or uboot
  • root - Root partition

Like so:

sudo parted -s -- /dev/sdX unit MiB \
  mklabel gpt \
  mkpart primary 16 100% \
  mkpart primary 1 16 \
  mkpart primary 0% 1 \
  name 1 root-bpir64-sdmmc \
  name 2 fip \
  name 3 atf \

0% here is the first available block and is sector 34 on a GPT disk.

Create the fiptool:

git clone https://github.com/mtk-openwrt/arm-trusted-firmware.git
cd arm-trusted-firmware/
make fiptool
cd ..
cp arm-trusted-firmware/tools/fiptool/fiptool ./
rm -rf arm-trusted-firmware/

Create a fip image with the fiptool from the kernel + dtb like so:

./fiptool --verbose create fip.bin \
  --nt-fw linux/arch/arm64/boot/Image \
  --nt-fw-config linux/arch/arm64/boot/dts/mediatek/mt7622-bananapi-bpi-r64.dtb

With this image you can directly load and boot kernel from the ATF.

Or create a fip image with the fiptool from uboot, 64 bit version, like so:

atf/tools/fiptool/fiptool --verbose create fip.bin \
  --nt-fw uboot/u-boot.bin

With this image ATF loads and boots into u-boot.


  • /dev/sdX is the device of the sd-card
  • /dev/sdXY is the atf partition on the sd-card
  • /dev/sdXZ is the fip partition on the sd-card
  • /dev/xxxXQ is the root partition

Check which partition is which with:

lsblk -o name,partlabel,size /dev/sdX

Now write the bootloader and fip images:


sudo dd of=/dev/sdX  if=sdmmc-header.img
sudo dd of=/dev/sdXY if=sdmmc-atf.img
sudo dd of=/dev/sdXZ if=fip.img

emmc (running on bpi-r64 sd-card):

dd of=/dev/mmcblk0 if=emmc-header.img
dd of=/dev/mmcblk0Y if=emmc-atf.img
dd of=/dev/mmcblk0Z if=fip.img
mmc bootpart enable 7 1 /dev/mmcblk0

Format the root partition with (SD_ERASE_SIZE_MB=4):

sudo mkfs.ext4 -v -b 4096 -L BPI-ROOT -E stride=2,stripe-width=512 /dev/xxxXQ

Bootstrap the distribution of your choice.

When using parted again to modify/add partitions, be sure to rewrite the header!


For booting directly in kernel, mt7622-bananapi-bpi-r64.dts needs to be edited:

		bootargs = "console=ttyS0,115200 rw rootwait root=PARTLABEL=root-bpir64-sdmmc"


	memory {
		device_type = "memory";
		reg = <0 0x40000000 0 0x40000000>;

Example fip images, with corresponding kernel files can be downloaded here:

Download fip-linux-5.16-rc3.tar.xz for directly booting into kernel from ATF.

Download fip-uboot-aarch64-v2021.10-rc3.tar.xz for booting into u-boot from ATF. Uboot then boots the example kernel (included).

For the source of all of the above binaries,check: