Unable to flash/boot the Pixel5 with custom build kernel

1,547 views
Skip to first unread message

xiling.gong

unread,
Nov 29, 2020, 7:11:14 PM11/29/20
to Android Building
Hello, I'm working on a Pixel5 with AOSP and custom build kernel.
The issue is that I can't flash/boot the Pixel5 with custom build kernel.
Anyone please help to check this issue?
Thanks a lot.

kernel source:
       repo init -u https://android.googlesource.com/kernel/manifest -b android-msm-redfin-4.19-android11-d1 
AOSP source:
      repo init -u https://android.googlesource.com/platform/manifest -b android-11.0.0_r15

Build the kernel
       ./build/build.sh
Then put
       MSM_KERNEL/out/android-msm-pixel-4.19/dist/Image.gz-dtb 
to 
       AOSP_SOURCE/device/google/redfin-kernel/
then build the aosp
       source build/environment
       lunch aosp_redfin-userdebug
       make -j8
       fastboot flashall
When do flash, the flash process will hang at 
       < waiting for any device >
       --------------------------------------------
      Bootloader Version...: r3-0.3-6776358
      Baseband Version.....: g7250-00016-200911-B-6826885
      Serial Number........: 09261FDD4003XC
      --------------------------------------------
      Checking 'product'                                 OKAY [  0.068s]
      Setting current slot to 'b'                        OKAY [  0.411s]
      Sending 'boot_b' (98304 KB)                        OKAY [ 12.051s]
      Writing 'boot_b'                                   OKAY [  1.977s]
      Sending 'dtbo_b' (16384 KB)                        OKAY [  2.150s]
      Writing 'dtbo_b'                                   OKAY [  0.386s]
      Sending 'vbmeta_b' (8 KB)                          OKAY [  0.139s]
      Writing 'vbmeta_b'                                 OKAY [  0.078s]
       Sending 'vbmeta_system_b' (4 KB)                   OKAY [  0.140s]
       Writing 'vbmeta_system_b'                          OKAY [  0.078s]
       Sending 'vendor_boot_b' (98304 KB)                 OKAY [ 12.632s]
       Writing 'vendor_boot_b'                            OKAY [  2.020s]
       Rebooting into fastboot                            OKAY [  0.066s]
       < waiting for any device >  
And the phone keeps rebooting.

I've also tried to replace a single .ko (e.g., cam_flash.ko) in 
       MSM_KERNEL/android-msm-pixel-4.19/dist/
into 
       AOSP_SOURCE/device/google/redfin-kernel/
Then build the aosp and flashall, it will also failed to finish the flash and the system hang.

If I push MSM_KERNEL/android-msm-pixel-4.19/dist/cam_flash.ko to /data/local/tmp/,
and then insmod
     insmod cam_flash.ko
it will fail with message
     insmod : failed to load cam_flash.ko: Exec format error

Thanks a lot.

Henry da Costa

unread,
Dec 2, 2020, 1:36:48 PM12/2/20
to android-...@googlegroups.com
Hello,

I had a similar problem on a Pixel 4 and fixed it by pushing all the .ko files from the kernel dist directory to /vendor/lib/modules.

--
--
You received this message because you are subscribed to the "Android Building" mailing list.
To post to this group, send email to android-...@googlegroups.com
To unsubscribe from this group, send email to
android-buildi...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-building?hl=en

---
You received this message because you are subscribed to the Google Groups "Android Building" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-buildi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/android-building/f6f8fcc5-e617-4ef7-93ec-6b65a573b43fn%40googlegroups.com.

xiling.gong

unread,
Dec 14, 2020, 11:03:16 AM12/14/20
to Android Building

Hello Henry,

Thanks a lot for your reply.

I've got the same issue on Pixel4 and fixed it using your method. 

But Pixel5 looks like a bit different and unable to be fixed with the same solution.
All the .ko built on Pixel5 is unable to be insmod into kernel. 
Don't know where is the root cause...

Droid SMU

unread,
Jun 15, 2021, 6:35:19 PM6/15/21
to Android Building
Hello,

I am also facing the same issue on the Google Pixel 5 with redbull kernel.

If I use the default prebuilt kernel from the AOSP tree, I am able to flash and boot successfully. I was also having success with the factory image.
However, when building a custom kernel using the android-msm-redbull-4.19-android11-qpr2 repo branch provided by this guide, I am stuck at the Google logo screen with the  "waiting for any device" message:

Here is my log:

$ fastboot flashall -w
--------------------------------------------
Bootloader Version...: r3-0.3-7051238
Baseband Version.....: g7250-00069-210128-B-7108850
Serial Number........: 11141FDD4001LG
--------------------------------------------
Checking 'product'                                 OKAY [  0.070s]
Setting current slot to 'a'                        OKAY [  0.290s]
Sending 'boot_a' (9324 KB)                         OKAY [  0.412s]
Writing 'boot_a'                                   OKAY [  0.324s]
Sending 'dtbo_a' (16384 KB)                        OKAY [  0.650s]
Writing 'dtbo_a'                                   OKAY [  0.180s]
Sending 'vbmeta_a' (8 KB)                          OKAY [  0.140s]
Writing 'vbmeta_a'                                 OKAY [  0.078s]
Sending 'vbmeta_system_a' (4 KB)                   OKAY [  0.140s]
Writing 'vbmeta_system_a'                          OKAY [  0.077s]
Sending 'vendor_boot_a' (18844 KB)                 OKAY [  0.670s]
Writing 'vendor_boot_a'                            OKAY [  0.120s]
Rebooting into fastboot                            OKAY [  0.070s]
< waiting for any device >

No changes have been made to the kernel.
Would appreciate any advice.

Thanks!

~Joshua

Droid SMU

unread,
Jun 15, 2021, 6:35:22 PM6/15/21
to Android Building
Hi,

I also encounter the same issue.
The build setup that I am using is as follows:

AOSP Build ID: RQ2A.210505.003 (Tag: android-11.0.0_r37)
Kernel branch: android-msm-redbull-4.19-android11-qpr2
Build configuration: aosp_redfin-userdebug

I got stuck at the "waiting for device" message after executing the "fastboot flashall -w" command.
Then what I did was I copied all the *.ko files into the <aosp tree>/device/google/redbull_kernel folder. This step was able to overcome the error above and flash successfully.
However, after flashing, the system tries to boot but it gets stuck at the "android" logo screen (this happens after the Google logo screen).

Would appreciate some advice on this topic.

Thanks!
On Tuesday, 15 December 2020 at 00:03:16 UTC+8 xiling.gong wrote:

Andrew Fernandes

unread,
Jun 23, 2021, 1:06:46 AM6/23/21
to Android Building
I've solved the issue and posted my solution in https://groups.google.com/g/android-building/c/6HPwJloQkP8.

Droid SMU

unread,
Jun 23, 2021, 1:11:17 AM6/23/21
to Android Building
I managed to solve this issue. The solution is currently pending approval and is posted at the following thread:

Cheers!

Abhinav Saxena

unread,
Jul 11, 2022, 12:47:51 PM7/11/22
to Android Building
Hi all. Sorry. I've been trying to build a working kernel for raviole for the past week. Has anyone succeeded in building a monolith kernel for Pixel 6/Pro? I don't want to build aosp. Just need to replace the kernel. I keep getting boot loops. Any ideas?

I also tried to compile as follow:
BUILD_BOOT_IMG=1 SKIP_VENDOR_BOOT=1 KERNEL_BINARY=Image GKI_RAMDISK_PREBUILT_BINARY=gki-ramdisk.lz4 BUILD_CONFIG=private/gs-google/build.config.gki.aarch64 ./build/build.sh

where gki-ramdisk.lz4 is the ramdisk extracted from the prebuilt images found here https://developers.google.com/android/images#oriole

李大锐

unread,
Jul 25, 2022, 4:10:48 PM7/25/22
to Android Building
This is the script I use to launch a custom kernel which is working on pixel 4a. The key is flashing boot.img twice after sending *.ko. 

```
        $kernel_ko = $KERNEL_SRCDIR + "/out/android-msm-pixel-4.14/dist/*.ko"
        scp "${KSERVER}:${kernel_ko}" $aosp_host_build_dir
        $env:ANDROID_PRODUCT_OUT = $aosp_host_build_dir; fastboot -s ${serial_l} flashall -w --disable-verity --disable-verification
        adb wait-for-device remount
        foreach ($file in (Get-ChildItem (Join-Path -Path $aosp_host_build_dir -ChildPath "*.ko")))  { adb push $file /vendor/lib/modules/ }
        adb reboot bootloader
        fastboot -s ${serial_l} flash boot --slot all (Join-Path -Path $aosp_host_build_dir -ChildPath boot.img)
        fastboot -s ${serial_l} reboot
```

I think the the root cause is that the ko file built by the kernel does not enter the boot.img built by aosp. To fundamentally solve this problem a correct boot.img might be needed.
Reply all
Reply to author
Forward
0 new messages