[Android Software/Hacking General [Developers Only]] xda4evers:
boot image testing using "$fastboot boot"

I have a question regarding custom kernel packaging with ramdisk to create boot images.

I use osm0sis unpackbootimg (https://github.com/osm0sis/mkbootimg) tool on the kernel created from an google AOSP build to extract its address and command line info. I then use this address and command line info to pack the stock AOSP ramdisk with my newly compiled kernel (based off the android stock kernel) to create a new boot image.

I have had success in testing the new boot image with prior nexus 5 and nexus 6 AOSP and Lineage OS, but am having problems with the Pixel XL stock image and kernel.

Below are my build and testing steps for custom kernel and boot image creation for pixel xl:

1) build stock aosp images for pixel xl (android-msm-marlin-3.18-pie-qpr1-s2)

$ repo init -u https://android.googlesource.com/platform/manifest -b android-9.0.0_r20

$ repo sync

$ source build/envsetup.sh

$ lunch aosp_marlin-userdebug

// boot.img and ramdisk.img located at <aosp_android_9_0_0_r20 source>/out/target/product/marlin

2) use osm0sis unpackimage to extract boot image address and command line info from boot.img in (1)

$ <osm0sis source>/mkbootimg-master/unpackbootimg -i boot.img -o unpack

// unpack directory contains boot image address and command line info

BOARD_KERNEL_CMDLINE console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=marlin user_debug=31 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 cma=32M@0-0xffffffff loop.max_part=7 buildvariant=userdebug veritykeyid=id:7e4333f9bba00adfe0ede979e28ed1920492b40f

BOARD_KERNEL_BASE 80000000

BOARD_NAME

BOARD_PAGE_SIZE 4096

BOARD_HASH_TYPE sha1

BOARD_KERNEL_OFFSET 00008000

BOARD_RAMDISK_OFFSET 01000000

BOARD_SECOND_OFFSET 00f00000

BOARD_TAGS_OFFSET 00000100

BOARD_OS_VERSION 9.0.0

BOARD_OS_PATCH_LEVEL 2018-12

BOARD_HEADER_VERSION 0

3) flashed the stock aosp built image from (1) to pixel xl

4) identify kernel version associated with this stock aosp image as

git sha 4212e6b8dac5835bcf395e82f29987ff8975763c

repo - android.googlesource.com/kernel/msm

branch - android-msm-marlin-3.18-pie-qpr1-s2

4) build kernel as described in this thread

output in <kernel source>/msm/arch/arm64/boot/Image.lz4-dtb

5) use aosp provided mkbootimg to package my kernel from (4) with ramdisk from (1) and address extracted in (2)

$ <aosp_android_9_0_0_r20 source>/out/host/linux-x86/bin/mkbootimg --kernel <kernel source>/msm/arch/arm64/boot/Image.lz4-dtb --ramdisk <aosp_android_9_0_0_r20 source>/out/target/product/marlin/ramdisk.img --cmdline "console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=marlin user_debug=31 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 cma=32M@0-0xffffffff loop.max_part=7 buildvariant=userdebug veritykeyid=id:7e4333f9bba00adfe0ede979e28ed1920492b40f" --base 80000000 --pagesize 4096 --ramdisk_offset 01000000 --second_offset 0x00f00000 --tags_offset 00000100 --output new-boot.img

6) test resulting new-boot.img using fastboot

$ adb reboot bootloader

$ sudo fastboot boot new-boot.img

downloading 'boot.img'...

OKAY [ 0.820s]

booting...

FAILED (status read failed (No such device))

finished. total time: 13.602s

7) kernel build information in "System/About Phone/Android Version" indicate new-boot.img kernel did not load (stock kernel build with aosp was loaded)

Q: Any ideas to what to following failure means ? "FAILED (status read failed (No such device))"

Q: Any suggestions on simple packaging tools/techniques of a custom kernel into a boot image?