Building Kernel for Pixel4 AOSP 10

1376 views
Skip to first unread message

Peter Weir

unread,
Dec 8, 2019, 7:29:22 PM12/8/19
to Android Building
I have been trying to build the kernel for android 10 and run it on a pixel 4. 

I followed the instructions on the source android website and used the following exact commands

repo init -u https://android.googlesource.com/kernel/manifest -b android-msm-coral-4.14-android10-c2f2
repo sync
build/build.sh

I then navigate into the aosp source tree and execute the following (after setting up the environment and running lunch aosp_flame-userdebug)
make bootimage TARGET_PREBUILT_KERNEL=<pathtodistdirectory>/Image.lz4

Then I navigate into the product out directory for flame and run
adb reboot bootloader
fastboot boot boot.img

At this point the phone does boot, and I'm reasonably confident it is using the kernel binary I gave it since when I use the prebuilt in the AOSP tree it works fine, but when I point at the one I built there are issues. The touchscreen is non responsive making the phone seem a little useless.

logcat shows me looping messages like

12-06 13:55:20.181   889   889 D /vendor/bin/adsprpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:2042: Error 0xffffffff: apps_dev_init failed for domain 0, errno Transport endpoint is not connected
12-06 13:55:20.181   889   889 D /vendor/bin/adsprpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:2135: Error 0xffffffff: open_dev (-1) failed for domain 0
12-06 13:55:20.181   889   889 D /vendor/bin/adsprpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:1017: Error 0x2c: remote_handle_invoke failed for handle 0xffffffff, method 0 on domain 0 (sc 0x0)
12-06 13:55:20.181   889   889 E /vendor/bin/adsprpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/adsprpcd.c:43:adsp daemon will restart after 25ms...
12-06 13:55:20.206   888   888 V /vendor/bin/adsprpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:1091: remote_handle_open: Successfully opened handle 0x5f for '":;./\attachguestos on domain 0
12-06 13:55:20.207   888   888 D /vendor/bin/adsprpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:2042: Error 0xffffffff: apps_dev_init failed for domain 0, errno Transport endpoint is not connected
12-06 13:55:20.207   888   888 D /vendor/bin/adsprpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:2135: Error 0xffffffff: open_dev (-1) failed for domain 0
12-06 13:55:20.207   888   888 D /vendor/bin/adsprpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:1017: Error 0x2c: remote_handle_invoke failed for handle 0xffffffff, method 0 on domain 0 (sc 0x0)
12-06 13:55:20.207   888   888 E /vendor/bin/adsprpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/adsprpcd.c:43:adsp daemon will restart after 25ms...
12-06 13:55:20.209   889   889 V /vendor/bin/adsprpcd: vendor/qcom/proprietary/commonsys-intf/adsprpc/src/fastrpc_apps_user.c:1091: remote_handle_open: Successfully opened handle 0x55 for '":;./\createstaticpd:audiopd on domain 0

I'm stumped beyond there seeming to be a problem with the proprietary drivers being unable to access a device handle on my hand built kernel. 

Has anyone seen anything like this before? I'm looking for a push in the right direction.

Peter


Peter Weir

unread,
Dec 9, 2019, 12:37:13 PM12/9/19
to Android Building
I have been doing some more comparisons between the the handbuilt kernel and the one that comes in the prebuilt.

The prebuilt one shows several modules in lsmod, 

Module                  Size  Used by
ftm5                  364544  0 
heatmap                28672  2 ftm5
videobuf2_vmalloc      28672  1 heatmap
videobuf2_memops       24576  1 videobuf2_vmalloc
lkdtm                  61440  0 
adsp_loader_dlkm       24576  0 
stub_dlkm              24576  1 
usf_dlkm               86016  0 
native_dlkm           233472  0 
machine_dlkm          229376  0 
platform_dlkm        2588672  59 native_dlkm
wcd_cpe_dlkm          151552  0 
wsa881x_dlkm           73728  1 machine_dlkm
wcd934x_dlkm          503808  1 machine_dlkm
wcd9360_dlkm          348160  0 
mbhc_dlkm             102400  1 wcd934x_dlkm
wcd9xxx_dlkm          110592  2 wcd934x_dlkm,wcd9360_dlkm
swr_ctrl_dlkm          49152  2 wcd934x_dlkm,wcd9360_dlkm
cs35l36_dlkm          311296  2 
q6_dlkm              1318912  10 usf_dlkm,native_dlkm,machine_dlkm,platform_dlkm,wcd_cpe_dlkm,wcd9xxx_dlkm,swr_ctrl_dlkm,cs35l36_dlkm
swr_dlkm               45056  2 wsa881x_dlkm,swr_ctrl_dlkm
apr_dlkm              253952  5 adsp_loader_dlkm,usf_dlkm,platform_dlkm,wcd934x_dlkm,q6_dlkm
q6_notifier_dlkm       24576  3 machine_dlkm,q6_dlkm,apr_dlkm
q6_pdr_dlkm            24576  1 q6_notifier_dlkm
wglink_dlkm            32768  0 
wcd_spi_dlkm           40960  0 
wcd_core_dlkm         188416  6 machine_dlkm,wcd_cpe_dlkm,wsa881x_dlkm,wcd934x_dlkm,wcd9360_dlkm,wcd9xxx_dlkm
pinctrl_wcd_dlkm       24576  0 
msm_11ad_proxy         45056  0 
wlan                11649024  0

and the modules installed in /sys/module look like 

adreno           cam_context_utils cs35l36_dlkm   esoc_mdm_drv   hid_magicmouse l2tp_netlink   msm_drm               nf_conntrack_netbios_ns ppp_mppe         random          snd_pcm           tcp_cubic      videobuf2_memops  workqueue    
adsp_loader_dlkm cam_cpas_hw       debug_reboot   eud            i2c_algo_bit   l2tp_ppp       msm_performance       nf_conntrack_sane       printk           rcupdate        snd_timer         ufshcd_core    videobuf2_v4l2    wsa881x_dlkm 
apr_dlkm         cam_csiphy_core   diagchar       event_timer    icnss          libcomposite   msm_poweroff          nf_conntrack_tftp       pstore           rcutree         snd_usb_audio     ufshcd_pltfrm  videobuf2_vmalloc xhci_hcd     
arm_smmu         cam_debug_util    dm_bufio       fb             ip6_tunnel     lkdtm          msm_show_resume_irq   oscar                   q6_dlkm          rfkill          spidev            uinput         vmpressure        xpad         
asix             cam_ois_core      dm_mod         firmware_class ipv6           lm36011_module msm_vidc_ar50_dyn_gov overheat_mitigation     q6_notifier_dlkm rmnet_ipa       spurious          usb_bam        watchdog_v2       xt_quota2    
battery          cam_smmu_api      dm_verity      fscrypto       kernel         loop           msm_vidc_dyn_gov      overlay                 q6_pdr_dlkm      rndis           srcutree          usb_f_gsi      wcd934x_dlkm      xz_dec       
binder           cdc_ncm           dns_resolver   ftm5           keydebug       lpm_levels     native_dlkm           pac193x                 qcom_llcc_edac   rng_core        st21nfc           usb_f_mtp      wcd9360_dlkm      
binder_alloc     cfg80211          drm            fuse           kgsl           lpm_stats      nf_conntrack          pci_msm                 qmi_rmnet        sch_htb         stub_dlkm         usb_storage    wcd9xxx_dlkm      
block            configfs          drm_kms_helper gasket         kgsl_gmu       machine_dlkm   nf_conntrack_amanda   peripheral_loader       qpnp_power_on    scsi_mod        subsystem_restart usbcore        wcd_core_dlkm     
bluetooth        core_hang_detect  dummy          glink_pkt      l2tp_core      mbhc_dlkm      nf_conntrack_ftp      phy_xgene               qpnp_rtc         service_locator suspend           usbhid         wcd_cpe_dlkm      
bonding          cpufreq           dwc3           heatmap        l2tp_eth       mhi_qcom       nf_conntrack_h323     pinctrl_wcd_dlkm        qpnp_smb5        sg              swr_ctrl_dlkm     usf_dlkm       wcd_spi_dlkm      
brd              cpuidle           dynamic_debug  hid            l2tp_ip        module         nf_conntrack_ipv4     platform_dlkm           r8152            sit             swr_dlkm          v4l2_mem2mem   wglink_dlkm       
bridge           cryptomgr         edac_core      hid_apple      l2tp_ip6       msm_11ad_proxy nf_conntrack_irc      ppp_generic             ramoops          snd             sysrq             videobuf2_core wlan   


On the one that I built 

lsmod looks like

lsmod
Module                  Size  Used by
flame:/ $ 

and the built in drivers look like

adreno       bridge            core_hang_detect drm            firmware_class ip6_tunnel l2tp_netlink   msm_performance       nf_conntrack_irc        pci_msm           qpnp_rtc  rng_core        spidev            uinput         vmpressure  
arm_smmu     cam_context_utils cpufreq          drm_kms_helper fscrypto       ipv6       l2tp_ppp       msm_poweroff          nf_conntrack_netbios_ns peripheral_loader qpnp_smb5 sch_htb         spurious          usb_bam        watchdog_v2 
asix         cam_cpas_hw       cpuidle          dummy          fuse           kernel     libcomposite   msm_show_resume_irq   nf_conntrack_sane       phy_xgene         r8152     scsi_mod        srcutree          usb_f_gsi      workqueue   
battery      cam_csiphy_core   cryptomgr        dwc3           gasket         keydebug   lm36011_module msm_vidc_ar50_dyn_gov nf_conntrack_tftp       ppp_generic       ramoops   service_locator st21nfc           usb_f_mtp      xhci_hcd    
binder       cam_debug_util    debug_reboot     dynamic_debug  glink_pkt      kgsl       loop           msm_vidc_dyn_gov      nvme                    ppp_mppe          random    sg              subsystem_restart usb_storage    xpad        
binder_alloc cam_ois_core      diagchar         edac_core      hid            kgsl_gmu   lpm_levels     nf_conntrack          nvme_core               printk            rcupdate  sit             suspend           usbcore        xt_quota2   
block        cam_smmu_api      dm_bufio         esoc_mdm_drv   hid_apple      l2tp_core  lpm_stats      nf_conntrack_amanda   oscar                   pstore            rcutree   snd             sysrq             usbhid         xz_dec      
bluetooth    cdc_ncm           dm_mod           eud            hid_magicmouse l2tp_eth   mhi_qcom       nf_conntrack_ftp      overheat_mitigation     qcom_llcc_edac    rfkill    snd_pcm         tcp_cubic         v4l2_mem2mem   
bonding      cfg80211          dm_verity        event_timer    i2c_algo_bit   l2tp_ip    module         nf_conntrack_h323     overlay                 qmi_rmnet         rmnet_ipa snd_timer       ufshcd_core       videobuf2_core 
brd          configfs          dns_resolver     fb             icnss          l2tp_ip6   msm_drm        nf_conntrack_ipv4     pac193x                 qpnp_power_on     rndis     snd_usb_audio   ufshcd_pltfrm     videobuf2_v4l2


It appears that the one I built doesn't provide something necessary for the dynamic modules to load, and it also looks like the built in directory does not contain several dlkm binaries.

Peter Weir

unread,
Dec 12, 2019, 1:04:55 PM12/12/19
to Android Building
It appears that the instructions on the build/install kernel page are insufficient ( although technically they do install the kernel. ) 

I found on this link https://source.android.com/devices/architecture/kernel/linux-stable-merges under the Testing section instructions about deploying the modules.

This requires having root access to the phone however, but it does indeed work, and allows all of the missing modules to load and the error messages to go away.

Is there a better way of deploying the modules?

Peter


On Sunday, December 8, 2019 at 4:29:22 PM UTC-8, Peter Weir wrote:

samson

unread,
May 18, 2020, 10:50:48 AM5/18/20
to Android Building
I referred to this thread to solve the same issue: https://groups.google.com/forum/#!topic/android-building/ou630PviyDc

Derek Selander

unread,
Aug 9, 2022, 2:48:41 AMAug 9
to Android Building
Hey Peter, 

Sorry to revive a dying thread, but I came across the exact same adsprpcd situation when attempting to patch a  Pixel 4a on Android 11 with a self compiled kernel and an existing boot.img.  For what I want to do, I am hoping that I can get away with using a recovery boot.img and patch it via magiskboot or any other tool instead of having to completely regenerate the boot.img manually.  I was wondering if you had any insight as to what could be causing the kernel modules to fail to load like this.  I get this was several years ago and this problem has likely faded, but I am hoping you have a tip or two from this experience. I have been pretty liberal on disabling any CONFIG.*MODULE params that could cause problems in my custom kernel (i.e. unset CONFIG_MODULE_SIG, CONFIG_MODULE_FORCE_LOAD=y, etc)

* Do you think this could be a problem with any kernel command params? Here's my dump of kernel args

console=ttyMSM0,115200n8 androidboot.console=ttyMSM0 printk.devkmsg=on msm_rtb.filter=0x237 ehci-hcd.park=3 service_locator.enable=1 androidboot.memcg=1 cgroup.memory=nokmem lpm_levels.sleep_disabled=1 usbcore.autosuspend=7 loop.max_part=7 androidboot.usbcontroller=a600000.dwc3 swiotlb=1 androidboot.boot_devices=soc/1d84000.ufshc buildvariant=user

* Do you think it could be a problem with the extracted dtb from the boot.img? (appears to be no problematic fstab)

Thanks!
Reply all
Reply to author
Forward
0 new messages