Hi Joshua,

Thanks for your reply! 

> Are you building an unmodified image of AOSP and kernel for Android 12?
Yes and no. I did add some kernel options to the default, such as 
CONFIG_KPROBES, CONFIG_KPROBE_EVENT, CONFIG_FTRACE_SYSCALLS and so on. But 
I tried with unmodified kernel and it still won't boot.

> Have you also copied the kernel modules (.ko) files to 
device/google/<product> folder?
Yes, I've copied all the regular files to that folder (rm 
device/google/redbull-kernel/*; cp -v 
/build/android-kernel/out/android-msm-pixel-4.19/dist/* 
device/google/redbull-kernel/)

FYI, I just switch my AOSP repo to android-11_r34 and build the project 
using the above tricks (build kernel -> copy ko/img -> build aosp -> 
repalce vendor_boot), it works and successfully boot into android launcher!
Then I switch the kernel branch to android-msm-redbull-4.19-android12 and 
rebuid, it works, too.
Then I add my KPROBE config to the BUILD_CONFIG and rebuild, and also 
successfully boot to android launcher. However some of the APK will 
randomly crash, which is really wierd.

Now I am checking about LineageOS's repo, It seems that the kernel source 
is included (unlike AOSP, which only includes the kernel prebuilts). 

Thanks again,
Pangao
On Thursday, November 25, 2021 at 3:29:50 AM UTC+8 [email protected] wrote:

> Hi Serena,
>
> An yeong ha se yo!
>
> I checked the size of my product.img in out/target/product/redfin and it 
> is 229MB. Maybe you can compare the size of your product.img with mine.
> I am using branch refs/tags/android-11.0.0_r34 for AOSP.
>
> I didn't use the vendor_overlay method which you shared. I just copied the 
> vendor_boot.img file from my kernel output folder to AOSP. Then I just 
> flash directly without rebuilding again.
> May I know which AOSP branch and phone are you using?
>
>
> Hi Pangao,
>
> Ni hao!
>
> Sorry I haven't moved to Android 12 yet and I am still on Android 11. 
> Maybe we might move to the newer android version once I have completed my 
> work on 11.
> Are you building an unmodified image of AOSP and kernel for Android 12?
>
> Ok if you have checked that the vendor_boot.img are the same then you may 
> skip that step. Have you also copied the kernel modules (.ko) files to 
> device/google/<product> folder?
> Perhaps try to also include all the .img and .tar.gz files.
>
> Thank you.
>
> Best regards,
> Joshua
>
> On Thursday, 18 November 2021 at 18:16:32 UTC+8 [email protected] wrote:
>
>> Thank you for the tips!
>> I was building AOSP android-12.0.0_r11 and 
>> android-msm-redbull-4.19-android12 kernel. However when I fastboot 
>> flashall, it hangs on step2 (rebooting to userspace fastbootd) then throw 
>> errors and fallback to recovery mode, showing some error like 'failed to 
>> find /dev/block/.../misc'.
>>
>> I think it's not about the vendor_boot.img but the vendor.img (which 
>> packs all the .ko kernel modules) since I unpack and verify that the 
>> vendor_boot.img  generate by AOSP and the kernel modules are same as those 
>> from the kernel build.
>> Still trying to find a solution, or try Android 11 instead :<
>>
>> On Wednesday, June 23, 2021 at 1:11:13 PM UTC+8 [email protected] wrote:
>>
>>> Hi,
>>>
>>> I managed to solve this issue! Was able to build and boot a custom 
>>> kernel on the Pixel 5!
>>> It seems that Google has made some architectural changes to the kernel 
>>> in Android 11 as shown in the following link:
>>> https://source.android.com/setup/start/android-11-release#kernel
>>>
>>> What I realized is that after building the kernel, it generates a 
>>> boot.img and *vendor_boot.img*
>>> Usually we only have boot.img but this time there is an additional 
>>> vendor boot file. This led me to the idea that we need to also flash this 
>>> file to the phone.
>>>
>>> These are the steps that I generally performed:
>>>
>>>    1. repo init -u https://android.googlesource.com/kernel/manifest -b 
>>>    android-msm-redbull-4.19-android11-qpr2
>>>    2. repo sync
>>>    3. Build custom kernel with *build_redbull.sh* script:
>>>    ./build_redbull.sh
>>>    4. After building, boot.img and vendor_boot.img gets created in 
>>>    kernel/out/android-msm-pixel-4.19/dist/ along with loadable modules and 
>>>    Image.lz4 and Image.lz4-dtb 
>>>    5. Go to AOSP folder.  Copy Image.lz4, Image.lz4-dtb, 
>>>    kernel-uapi-headers.tar.gz and all the *.ko kernel modules from 
>>>    *kernel/out**/android-msm-pixel-4.19/dist/* to 
>>>    *aosp/device/google/redbull-kernel* folder.
>>>    
>>>    You may back-up the aosp/device/google/redbull-kernel folder at 
>>>    another location in case we would like to restore to the default files.
>>>    6. Run *make* to rebuild the images
>>>    7. Copy the vendor_boot.img from kernel to 
>>>    *out/target/product/redfin* folder
>>>    8. *adb reboot bootloader*
>>>    9. *fastboot flashall -w*
>>>    
>>> fastboot version: 31.0.2-7242960
>>> This was tested with AOSP android-11.0.0_r34 but I believe it can also 
>>> work for other versions.
>>>
>>> Hope this is able to help you save two weeks of development time. At 
>>> least that was the time it took me to setup a base AOSP and kernel on the 
>>> Pixel 5.
>>>
>>> On Wednesday, 16 June 2021 at 06:35:08 UTC+8 [email protected] wrote:
>>>
>>>> I'm following the instructions on source.android.com 
>>>> <https://source.android.com/setup/build/building-kernels> for building 
>>>> kernels and unable to get it working on the Pixel 5.
>>>>
>>>> There are a couple of paths I've taken with differing results.
>>>>
>>>> 1. Check out the aosp-kernel android-msm-redbull-4.19-android11-qpr2 
>>>> branch
>>>> 2. Run the build_redbull.sh (or build_rebull-gki.sh) script.
>>>> 3. In the aosp directory, export TARGET_PREBUILT_KERNEL to the built 
>>>> Image.lz4-dtb from aosp-kernel
>>>> 4. flash aosp using `fastboot flashall -w`
>>>> 5. Observe bootloop, the devices never reaches a point where adbd 
>>>> starts and I can shell in
>>>>
>>>> Then I saw from other posts that when recompiling the kernel the 
>>>> prebuilt kernel modules that are in the aosp repository are out of date 
>>>> and 
>>>> are being packaged into the vendor_boot image and failing to load.
>>>>
>>>> So... next I tried copying all of the compiled aosp-kernel modules and 
>>>> images into the aosp/device/google/redbull-kernel directory and rebuilding.
>>>>
>>>> This gets farther and I'm now able to adb shell into the device, but 
>>>> the display stays on the Android boot logo and various other 
>>>> services/sensors don't work.
>>>>
>>>> So, my question is, what's the process for a successful build/flash of 
>>>> the aosp kernel on the Pixel 5?
>>>>
>>>> For reference I'm using the aosp android-11.0.0_r37 branch and aosp 
>>>> kernel android-msm-redbull-4.19-android11-qpr2 branch.
>>>>
>>>> Any help/instruction would be greatly appreciated!
>>>>
>>>

-- 
-- 
You received this message because you are subscribed to the "Android Building" 
mailing list.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/android-building/e99d6f28-459b-4135-be47-9ee9042c2208n%40googlegroups.com.

Reply via email to