Skip to content
The bootloader for Raspberry Pi 3 to boot Android 9 Pie
Branch: master
Clone or download
Pull request Compare This branch is even with pie-device-brobwind-rpi3.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Documentation/devicetree/bindings
Licenses
api
arch
board
cmd
common
configs
disk
doc
drivers
dts
env
examples
fs
include
lib
net
post
prebuilt-intermediates
scripts
test
tools
.checkpatch.conf
.gitignore
.mailmap
.travis.yml
Kbuild
Kconfig
LICENSE
MAINTAINERS
METADATA
MODULE_LICENSE_GPL
Makefile
NOTICE
PREUPLOAD.cfg
README
README.md
config.mk

README.md

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 https://github.com/brobwind/pie-device-brobwind-rpi3.

And already built the whole project.

Download source code

  1. Download the source code from https://github.com/brobwind/pie-device-brobwind-rpi3-u-boot/
$ git clone https://github.com/brobwind/pie-device-brobwind-rpi3-u-boot/ device/brobwind/rpi3/u-boot
  1. Download mkknlimg from https://github.com/raspberrypi/linux/blob/rpi-4.14.y/scripts/mkknlimg
$ curl https://raw.githubusercontent.com/raspberrypi/linux/rpi-4.14.y/scripts/mkknlimg > device/brobwind/rpi3/u-boot/mkknlimg
$ chmod +x device/brobwind/rpi3/u-boot/mkknlimg

Build

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. https://developer.android.com/things/hardware/raspberrypi#serial-console

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:

android_rootdev="/dev/mmcblk${android_root_devnum}p${android_root_partnum}"

autoload=no

board=rpi3

board_name=3 Model B+

board_rev=0xD

board_rev_scheme=1

board_revision=0xA020D3

bootcmd=\

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}"; \

reset

ethaddr=b8:27:eb:3a:df:1c

fastbootcmd=\

usb start && \

dhcp && \

fastboot udp

fdt_addr=2eff9400

fdt_high=2e000000

  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 192.168.5.211 (6 ms)

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

Using lan78xx_eth device

Listening for fastboot command on 192.168.5.211

  1. Flash images

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

$ fastboot -s udp:192.168.5.211 flash rpiboot out/target/product/rpi3/rpiboot.img
$ fastboot -s udp:192.168.5.211 flash boot_a out/target/product/rpi3/boot.img
$ fastboot -s udp:192.168.5.211 flash system_a out/target/product/rpi3/system.img
$ fastboot -s udp:192.168.5.211 flash vendor_a out/target/product/rpi3/vendor.img
  1. Erase userdata partition
$ fastboot -s udp:192.168.5.211 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:

  1. https://www.brobwind.com/archives/1600
You can’t perform that action at this time.