Skip to content
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
155 lines (138 sloc) 4.08 KB

The bootloader for Raspberry Pi 3 to boot Android 9 Pie

Setup build environment

Assuming you already downloaded Android 9 Pie source code and the device configuration files from

And already built the whole project.

Download source code

  1. Download the source code from
$ git clone device/brobwind/rpi3/u-boot
  1. Download mkknlimg from
$ curl > device/brobwind/rpi3/u-boot/mkknlimg
$ chmod +x device/brobwind/rpi3/u-boot/mkknlimg


Assuming current path is device/brobwind/rpi3/u-boot, execute following commands will build a 64-bit u-boot.

  1. Run configuration
$ ARCH=arm64 CROSS_COMPILE=../../../../prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-androidkernel- make rpi_3_defconfig
  1. Make
$ ARCH=arm64 CROSS_COMPILE=../../../../prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-androidkernel- make
  1. Add a trailer
$ ./mkknlimg --dtok --ddtk --270x u-boot.bin u-boot-dtok.bin

Common usage

Uses a USB-to-TTL serial cable to connect the Raspberry Pi to PC and uses minicom to interactive with the bootloader.

The serial port setup parameter is 115200,8n1:

$ sudo minicom -b 115200 -D /dev/ttyUSB0

Also connect to a wired Ethernet network and the IP address can obtain from DHCP

  1. Print environment information
U-Boot> printenv

It will show information like this:




board_name=3 Model B+





fdt addr "${fdt_addr}"; \

fdt resize "${oem_overlay_max_size}"; \

android_ab_select "android_slot" mmc "0;misc" || run fastbootcmd || reset; \

test "${android_slot}" = "a" && env set oem_part "${oem_bootloader_a}"; \

test "${android_slot}" = "b" && env set oem_part "${oem_bootloader_b}"; \

ext2load mmc "0:${oem_part}" "${fdt_high}" /kernel.dtbo && \

  fdt apply "${fdt_high}"; \\

fdt get value bootargs /chosen bootargs; \

setenv bootargs "${bootargs} androidboot.serialno=${serial#}"; \

boot_android mmc "0;misc" "${android_slot}" "${kernel_addr_r}"; \




usb start && \

dhcp && \

fastboot udp



  1. Run in fastboot mode
U-Boot> run fastbootcmd

It will show information:

starting USB...

USB0: scanning bus 0 for devices... 5 USB Device(s) found

   scanning usb for storage devices... 0 Storage Device(s) found

lan78xx_eth Waiting for PHY auto negotiation to complete..... done

BOOTP broadcast 1

DHCP client bound to address (6 ms)

lan78xx_eth Waiting for PHY auto negotiation to complete...... done

Using lan78xx_eth device

Listening for fastboot command on

  1. Flash images

Once the bootloader run in fastboot mode, you can use fastboot command to download images:

$ fastboot -s udp: flash rpiboot out/target/product/rpi3/rpiboot.img
$ fastboot -s udp: flash boot_a out/target/product/rpi3/boot.img
$ fastboot -s udp: flash system_a out/target/product/rpi3/system.img
$ fastboot -s udp: flash vendor_a out/target/product/rpi3/vendor.img
  1. Erase userdata partition
$ fastboot -s udp: erase userdata
  1. Run boot command
U-Boot> run bootcmd
  1. Show flat device tree
U-Boot> fdt addr ${fdt_addr}
U-Boot> fdt print

For detail info, please refer:

You can’t perform that action at this time.