I'm trying to boot Android 11 using U-Boot and it's not decompressing the kernel image.
My bootcommand is as follows:
echo Starting AOSP boot sequence && env set devnum 0 && mmc dev $devnum && echo Reading boot... && part start mmc $devnum boot boot_start && part size mmc $devnum boot boot_size && mmc read $loadaddr $boot_start $boot_size && echo Reading dtbo... && abootimg get dtb_load_addr dtboaddr && part start mmc $devnum dtbo dtbo_start && part size mmc $devnum dtbo dtbo_size && mmc read $dtboaddr $dtbo_start $dtbo_size && echo Copying dtb... && abootimg get dtb --index=0 dtb0_start dtb0_size && env set fdtaddr 0x600000 && cp.b $dtb0_start $fdtaddr $dtb0_size && echo Merging DTB... && fdt addr $fdtaddr 0x100000 && adtimg addr $dtboaddr && adtimg get dt --index=0 dtbo0_addr && fdt apply $dtbo0_addr && echo Booting AOSP... && bootm $loadaddr $loadaddr $fdtaddr
Here is the same broken up into multiple lines (for readability sake):
echo Starting AOSP boot sequence
env set devnum 0
mmc dev $devnum
echo Reading boot...
part start mmc $devnum boot boot_start
part size mmc $devnum boot boot_size
mmc read $loadaddr $boot_start $boot_size
echo Reading dtbo...
abootimg get dtb_load_addr dtboaddr
part start mmc $devnum dtbo dtbo_start
part size mmc $devnum dtbo dtbo_size
mmc read $dtboaddr $dtbo_start $dtbo_size
echo Copying dtb...
abootimg get dtb --index=0 dtb0_start dtb0_size
env set fdtaddr 0x600000
cp.b $dtb0_start $fdtaddr $dtb0_size
echo Merging DTB...
fdt addr $fdtaddr 0x100000
adtimg addr $dtboaddr
adtimg get dt --index=0 dtbo0_addr
fdt apply $dtbo0_addr
echo Booting AOSP...
bootm $loadaddr $loadaddr $fdtaddr
I basically followed the guide here, adding missing bits and pieces as needed.
The log prints as follows (serial console):
...memory initialization omitted for brevity...
U-Boot SPL 2023.10-aosp-00615-gd1c943e343 (Nov 06 2023 - 21:59:41 +0100)
Trying to boot from MMC1
## Checking hash(es) for config config-1 ... OK
## Checking hash(es) for Image atf-1 ... sha256+ OK
## Checking hash(es) for Image u-boot ... sha256+ OK
## Checking hash(es) for Image fdt-1 ... sha256+ OK
## Checking hash(es) for Image atf-2 ... sha256+ OK
## Checking hash(es) for Image atf-3 ... sha256+ OK
## Checking hash(es) for Image atf-4 ... sha256+ OK
## Checking hash(es) for Image atf-5 ... sha256+ OK
## Checking hash(es) for Image atf-6 ... sha256+ OK
INFO: Preloader serial: 2
NOTICE: BL31: v2.3():v2.3-607-gbf602aff1:cl
NOTICE: BL31: Built : 10:16:03, Jun 5 2023
INFO: GICv3 without legacy support detected.
INFO: ARM GICv3 driver initialized in EL3
INFO: pmu v1 is valid 220114
INFO: dfs DDR fsp_param[0].freq_mhz= 1056MHz
INFO: dfs DDR fsp_param[1].freq_mhz= 324MHz
INFO: dfs DDR fsp_param[2].freq_mhz= 528MHz
INFO: dfs DDR fsp_param[3].freq_mhz= 780MHz
INFO: Using opteed sec cpu_context!
INFO: boot cpu mask: 0
INFO: BL31: Initializing runtime services
WARNING: No OPTEE provided by BL2 boot loader, Booting device without OPTEE initialization. SMC`s destined for OPTEE will return SMC_UNK
ERROR: Error initializing runtime service opteed_fast
INFO: BL31: Preparing for EL3 exit to normal world
INFO: Entry point address = 0xa00000
INFO: SPSR = 0x3c9
U-Boot 2023.10-aosp-00615-gd1c943e343 (Nov 06 2023 - 23:32:08 +0100)
Model: Pine64 RK3566 Quartz64-A Board
DRAM: 8 GiB (effective 7.7 GiB)
PMIC: RK8170 (on=0x40, off=0x00)
Core: 307 devices, 23 uclasses, devicetree: separate
MMC: mmc@fe2b0000: 1, mmc@fe2c0000: 2, mmc@fe310000: 0
Loading Environment from nowhere... OK
In: serial@fe660000
Out: serial@fe660000
Err: serial@fe660000
Model: Pine64 RK3566 Quartz64-A Board
rockchip_dnl_key_pressed: no saradc device found
Hit any key to stop autoboot: 0
Starting AOSP boot sequence
switch to partitions #0, OK
mmc0(part 0) is current device
Reading boot...
MMC read: dev # 0, block # 32768, count 65536 ... 65536 blocks read: OK
Reading dtbo...
MMC read: dev # 0, block # 98304, count 16384 ... 16384 blocks read: OK
Copying dtb...
Merging DTB...
Working FDT set to 600000
0x22f (559)
Booting AOSP...
## Booting Android Image at 0x00c00800 ...
Kernel load addr 0x00c01000 size 15184 KiB
Kernel command line: console=ttyS2,1500000 earlycon=uart8250,mmio32,0xfe660000 androidboot.selinux=permissive service_locator.enable=1 kpti=0 loop.max_part=7 firmware_class.path=/vendor/etc/firmware buildvariant=user
RAM disk load addr 0x01ad5000 size 751 KiB
## Flattened Device Tree blob at 00600000
Booting using the fdt blob at 0x600000
Working FDT set to 600000
Uncompressing Kernel Image
lz4 compressed: uncompress error -71
Must RESET board to recover
=>
Can anyone provide some guidance on how to boot Android Boot Images (v2) using U-Boot? The boot image is located on eMMC and U-Boot is able to read the DTB:
U-Boot 2023.10-aosp-00615-gd1c943e343 (Nov 06 2023 - 22:16:45 +0100)
Model: Pine64 RK3566 Quartz64-A Board
DRAM: 8 GiB (effective 7.7 GiB)
PMIC: RK8170 (on=0x40, off=0x00)
Core: 307 devices, 23 uclasses, devicetree: separate
MMC: mmc@fe2b0000: 1, mmc@fe2c0000: 2, mmc@fe310000: 0
Loading Environment from nowhere... OK
In: serial@fe660000
Out: serial@fe660000
Err: serial@fe660000
Model: Pine64 RK3566 Quartz64-A Board
rockchip_dnl_key_pressed: no saradc device found
Hit any key to stop autoboot: 0
=> env set devnum 0
=> mmc dev $devnum
switch to partitions #0, OK
mmc0(part 0) is current device
=> part start mmc $devnum boot boot_start
=> part size mmc $devnum boot boot_size
=> mmc read $loadaddr $boot_start $boot_size
MMC read: dev # 0, block # 32768, count 65536 ... 65536 blocks read: OK
=> abootimg get dtb_load_addr dtboaddr
=> echo $dtboaddr
11f00000
=> abootimg help
abootimg - manipulate Android Boot Image
Usage:
abootimg addr <boot_img_addr> [<vendor_boot_img_addr>]>
- set the address in RAM where boot image is located
($loadaddr is used by default)
abootimg dump dtb
- print info for all DT blobs in DTB area
abootimg get ver [varname]
- get header version
abootimg get recovery_dtbo [addr_var [size_var]]
- get address and size (hex) of recovery DTBO area in the image
[addr_var]: variable name to contain DTBO area address
[size_var]: variable name to contain DTBO area size
abootimg get dtb_load_addr [varname]
- get load address (hex) of DTB, from image header
abootimg get dtb --index=<num> [addr_var [size_var]]
- get address and size (hex) of DT blob in the image by index
<num>: index number of desired DT blob in DTB area
[addr_var]: variable name to contain DT blob address
[size_var]: variable name to contain DT blob size
=> abootimg dump dtb
## DTB area contents (concat format):
- DTB #0:
(DTB)size = 89040
(DTB)model = Rockchip PX30 AD D6 board
(DTB)compatible = rockchip,px30-ad-d6
- DTB #1:
(DTB)size = 89498
(DTB)model = Rockchip PX30 AD R35 MB board
(DTB)compatible = rockchip,px30-ad-r35-mb
- DTB #2:
(DTB)size = 91054
(DTB)model = Rockchip PX30 AD R35 MB board
(DTB)compatible = rockchip,px30-ad-r35-mb
- DTB #3:
(DTB)size = 88737
(DTB)model = Rockchip PX30 AD R35 MB board
(DTB)compatible = rockchip,px30-ad-r35-mb
...omitted for brevity...
- DTB #114:
(DTB)size = 116053
(DTB)model = Rockchip RK3568 NVR DEMO DDR4 V12 Linux SPI NAND Board
(DTB)compatible = rockchip,rk3568-nvr-demo-ddr4-v12-linux-spi-nand
- DTB #115:
(DTB)size = 116029
(DTB)model = Rockchip RK3568 NVR DEMO DDR4 V12 Linux Board
(DTB)compatible = rockchip,rk3568-nvr-demo-ddr4-v12-linux
- DTB #116:
(DTB)size = 111760
(DTB)model = Rockchip RK3568J CORE DDR4 V10 Board
(DTB)compatible = rockchip,rk3568j-core-ddr4-v10
- DTB #117:
(DTB)size = 118858
(DTB)model = Rockchip RK630 RK3568 DDR3 V10 Board
(DTB)compatible = rockchip,rk630-rk3568-ddr3-v10
EDIT: The kernel starts booting when not compressed (all CONFIG_COMPRESS_* options set to n). I would still like to solve the decompression issue. Although the boot image size is not of concern to me since I can easily repartition the eMMC, I would still prefer to have compression enabled.
See:
U-Boot 2023.10-aosp-00615-gd1c943e343 (Nov 06 2023 - 23:32:08 +0100)
Model: Pine64 RK3566 Quartz64-A Board
DRAM: 8 GiB (effective 7.7 GiB)
PMIC: RK8170 (on=0x40, off=0x00)
Core: 307 devices, 23 uclasses, devicetree: separate
MMC: mmc@fe2b0000: 1, mmc@fe2c0000: 2, mmc@fe310000: 0
Loading Environment from nowhere... OK
In: serial@fe660000
Out: serial@fe660000
Err: serial@fe660000
Model: Pine64 RK3566 Quartz64-A Board
rockchip_dnl_key_pressed: no saradc device found
Hit any key to stop autoboot: 0
Starting AOSP boot sequence
switch to partitions #0, OK
mmc0(part 0) is current device
Reading boot...
MMC read: dev # 0, block # 32768, count 98304 ... 98304 blocks read: OK
Reading dtbo...
MMC read: dev # 0, block # 131072, count 16384 ... 16384 blocks read: OK
Copying dtb...
Merging DTB...
Working FDT set to 600000
0x22f (559)
Booting AOSP...
## Booting Android Image at 0x00c00800 ...
Kernel load addr 0x00c01000 size 29319 KiB
Kernel command line: console=ttyS2,1500000 earlycon=uart8250,mmio32,0xfe660000 androidboot.selinux=permissive service_locator.enable=1 kpti=0 loop.max_part=7 firmware_class.path=/vendor/etc/firmware buildvariant=userdebug
RAM disk load addr 0x028a3000 size 890 KiB
## Flattened Device Tree blob at 00600000
Booting using the fdt blob at 0x600000
Working FDT set to 600000
XIP Kernel Image
Loading Ramdisk to ede37000, end edf155c6 ... OK
ERROR: reserving fdt memory region failed (addr=0 size=0 flags=0)
Loading Device Tree to 00000000edd34000, end 00000000ede36fff ... OK
Working FDT set to edd34000
Starting kernel ...
[ 0.000000] Booting Linux on physical CPU 0x0000000000 [0x412fd050]
[ 0.000000] Linux version 4.19.154-xos (nobody@android-build) (Android (6877366 based on r383902b1) clang version 11.0.2 (https://android.googlesource.com/toolchain/llvm-project b397f81060ce6d701042b782172ed13bee898b79), GNU ld (binutils-2.27-bd24d23f) 2.27.0.20170315) #27 SMP PREEMPT Tue Nov 7 18:37:58 CET 2023