Skip to content

Instantly share code, notes, and snippets.

@MagneFire
Last active July 31, 2023 21:09
Show Gist options
  • Save MagneFire/fe4e91ca658ef6d3ca79ce4e344bd914 to your computer and use it in GitHub Desktop.
Save MagneFire/fe4e91ca658ef6d3ca79ce4e344bd914 to your computer and use it in GitHub Desktop.
AsteroidOS - Random porting notes

Ray

  • When using the stock kernel config on ray and booting to debug-ramdisk, the watch remains 'stuck'. Likely due to an kernel config mishap for configuring the USB adb mode.

hoki

The port is based on the beluga port (Android 9). Using a system and vendor dump provided via XDA.

Android R

Sources: https://forum.sailfishos.org/t/livecasting-porting-notes-for-zenfone-8/14727

Modem

The modem is crashing causing for a system reboot.

The modem can be stared by executing /system/vendor/bin/pm-proxy.

The system reboot can be avoided by changing the restart_level:

    write /sys/bus/msm_subsys/devices/subsys0/restart_level "RELATED"
    write /sys/bus/msm_subsys/devices/subsys1/restart_level "RELATED"
    write /sys/bus/msm_subsys/devices/subsys2/restart_level "RELATED"
    write /sys/bus/msm_subsys/devices/subsys3/restart_level "RELATED"
    write /sys/bus/msm_subsys/devices/subsys4/restart_level "RELATED"

Side note: The devices map to:

modem: Sensors, GPS
adsp: Audio (mic, speaker)
wcnss: WLAN
venus: Also WLAN
bg-wear: Crown

Retrieving logs can be done using:

cat /sys/kernel/debug/ipc_logging/soc:qcom,smd:modem/log_cont

This results in:

[     0.141965937/         0x9d54e85] qcom_smd_register_edge: soc:qcom,smd:modem
[    19.639723236/        0x20258a4b] qcom_smd_channel_reset: ch IPCRTR ed mpss
[    19.639798028/        0x20258fe6] qcom_smd_create_device: registering ch IPCRTR
[    19.640206778/        0x2025ae8f] qcom_smd_channel_set_state: ch IPCRTR ed mpss
[    19.640237299/        0x2025b0d8] qcom_smd_edge_intr: to APPS ch IPCRTR ed mpss
[    19.640246830/        0x2025b18f] qcom_smd_channel_set_state: ch IPCRTR ed mpss
[    19.640278393/        0x2025b3ee] qcom_smd_channel_get_rx_avail: h: 0x48 t: 0x0 ch IPCRTR ed mpss
[    19.640283340/        0x2025b44c] qcom_smd_channel_intr: pkt_size: 52 ch IPCRTR ed mpss
[    19.640285997/        0x2025b47f] qcom_smd_channel_get_rx_avail: h: 0x48 t: 0x14 ch IPCRTR ed mpss
[    19.640290320/        0x2025b4d2] qcom_smd_channel_recv_single: ret -11 len 52 ch IPCRTR
[    19.640293861/        0x2025b516] qcom_smd_channel_intr: fail ret -11 ch IPCRTR ed mpss
[    19.640295424/        0x2025b534] qcom_smd_edge_intr: to APPS ch IPCRTR ed mpss
[    19.640447611/        0x2025c09f] qcom_smd_channel_get_rx_avail: h: 0x48 t: 0x14 ch IPCRTR ed mpss
[    19.640498028/        0x2025c466] qcom_smd_channel_recv_single: len 52 ch IPCRTR ed mpss
[    19.640500424/        0x2025c494] qcom_smd_channel_get_rx_avail: h: 0x48 t: 0x48 ch IPCRTR ed mpss
[    19.643242038/        0x20269233] qcom_smd_channel_get_rx_avail: h: 0x48 t: 0x48 ch IPCRTR ed mpss
[    19.643275268/        0x202694b1] qcom_smd_edge_intr: to APPS ch IPCRTR ed mpss
[    19.643360215/        0x20269b11] qcom_smd_channel_reset: ch SSM_RTR_MODEM_APPS ed mpss
[    19.643564695/        0x2026aa67] qcom_smd_create_device: registering ch SSM_RTR_MODEM_APPS

This is where it ends, supossedly, hanging the modem causing for the eventual:

Apr 16 00:45:25 hoki kernel: Fatal error on the modem.
Apr 16 00:45:25 hoki kernel: modem subsystem failure reason: dog.c:1522:Watchdog detects stalled initialization.

The error string (containing SSM_RTR_MODEM_APPS) originates from modem/image/modem.b14.

Current ideas/strategies

  • Root WearOS
  • Retrieve modem logs from WearOS
  • Retrieve complete logcat logs
  • Retrieve dmesg logs

Crown

The crown doesn't work out of the box. Android services need to be started. The bgrsb kernel driver is responsible for this.

Start /vendor/bin/hw/[email protected] to make the crown work.

Vibrator

Uses the ffmemless implementation instead of the droid backend. This means a custom configuration is needed. This needed an update to ngfd as the kernel driver only supports Custom waveforms. The provided 50-ffmemless.ini doesn't result in any vribation/feedback. A 51-ffmemless.ini did result in feedback, but it was barely noticable, meaning that the config file needs manual tuning for hoki.

SELinux

Getting the errors as shown in the log? Enable SELinux and use SELinux stubs.

04-15 18:45:53.236   644   644 W /vendor/bin/hw/[email protected]: Could not find seccomp policy file at: /vendor/etc/seccomp_policy/[email protected]
04-15 18:45:53.237   644   644 I ServiceManagement: Removing namespace from process name [email protected] to [email protected].
04-15 18:45:53.237   644   644 F [email protected]: Could not register ISurfaceFlingerConfigs
04-15 18:45:53.237   646   646 E ServiceManagement: getService: defaultServiceManager()->getTransport returns Status(EX_TRANSACTION_FAILED): 'FAILED_TRANSACTION: '
04-15 18:45:53.237   646   646 E [email protected]: Could not get passthrough implementation for [email protected]::IComposer/default.
--------- beginning of crash
04-15 18:45:53.237   644   644 F libc    : Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 644 ([email protected]), pid 644 ([email protected])
04-15 18:45:53.238   630   630 I hwservicemanager: hwservicemanager is ready now.
04-15 18:45:53.238   641   641 E ServiceManagement: getService: defaultServiceManager()->getTransport returns Status(EX_TRANSACTION_FAILED): 'FAILED_TRANSACTION: '
04-15 18:45:53.238   641   641 E         : Could not get passthrough implementation for [email protected]::IBluetoothHci/default.
04-15 18:45:53.238   641   641 I [email protected]: Error while registering BT service: 1
04-15 18:45:53.242   645   645 E ServiceManagement: getService: defaultServiceManager()->getTransport returns Status(EX_TRANSACTION_FAILED): 'FAILED_TRANSACTION: '

Config used for hoki:

CONFIG_SECURITY_SELINUX=y
CONFIG_SECURITY_SELINUX_BOOTPARAM=y
CONFIG_SECURITY_SELINUX_BOOTPARAM_VALUE=1
# CONFIG_SECURITY_SELINUX_DISABLE is not set
CONFIG_SECURITY_SELINUX_DEVELOP=y
CONFIG_SECURITY_SELINUX_AVC_STATS=y
CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=0
CONFIG_SECURITY_SELINUX_SIDTAB_HASH_BITS=9

mkbootimgs

msm8226

bass

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'androidboot.hardware=bass user_debug=31 maxcpus=4 msm_rtb.filter=0x3F pm_levels.sleep_disabled=1 console=null androidboot.console=null' -o new_boot.img

dory

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'androidboot.hardware=dory user_debug=31 maxcpus=4 msm_rtb.filter=0x3F pm_levels.sleep_disabled=1 console=null androidboot.console=null' -o new_boot.img

lenok

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'androidboot.hardware=lenok user_debug=31 maxcpus=4 msm_rtb.filter=0x3F pm_levels.sleep_disabled=1 console=null androidboot.console=null' -o new_boot.img

nemo

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x18fff00 --cmdline 'androidboot.hardware=nemo user_debug=31 maxcpus=4 msm_rtb.filter=0x3F console=null androidboot.console=null androidboot.build.type=user' -o new_boot.img

smelt

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=bowfin utags.blkdev=/dev/block/platform/msm_sdcc.1/by-name/utags utags.backup=/dev/block/platform/msm_sdcc.1/by-name/utagsBackup user_debug=31 msm_rtb.filter=0x3 buildvariant=user' -o new_boot.img

sparrow

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=sparrow user_debug=31 maxcpus=4 msm_rtb.filter=0x3F androidboot.selinux=permissive buildvariant=user' -o new_boot.img

sturgeon

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'androidboot.hardware=sturgeon user_debug=31 maxcpus=4 msm_rtb.filter=0x3F pm_levels.sleep_disabled=1 selinux=0' --board 'sturgeon' -o new_boot.img

wren

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=wren user_debug=31 maxcpus=4 msm_rtb.filter=0x3F' -o new_boot.img

msm8909w

catfish

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x80000000 --cmdline 'androidboot.hardware=catfish msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 earlycon=msm_hsl_uart,0x78af000 firmware_class.path=/vendor/firmware_mnt/image console=null androidboot.console=null buildvariant=user' -o new_boot.img

firefish

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x81dfff00 --cmdline 'androidboot.hardware=firefish msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 console=null androidboot.console=null earlycon=msm_hsl_uart,0x78b0000 buildvariant=user' -o new_boot.img

narwhal

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x81dfff00 --cmdline 'androidboot.hardware=narwhal user_debug=31 maxcpus=4 msm_rtb.filter=0x3F lpm_levels.sleep_disabled=1 vmalloc=232M buildvariant=user' -o new_boot.img

nubia_alpha

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x4c4b340 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=qcom msm_rtb.filter=0x237 ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 earlyprintk buildvariant=user androidboot.selinux=permissive buildvariant=eng' -o new_boot.img

platy

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x80000000 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=platy msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 earlycon=msm_hsl_uart,0x78af000 ramoops.mem_address=0x8da00000 ramoops.mem_size=0x100000 ramoops.console_size=0x80000 buildvariant=user' -o new_boot.img

ray

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'androidboot.hardware=ray console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 earlycon=msm_hsl_uart,0x78af000 buildvariant=user selinux=0' --board 'ray' -o new_boot.img

sawfish

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'androidboot.hardware=sawfish console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 earlycon=msm_hsl_uart,0x78af000 buildvariant=user' -o new_boot.img

skipjack

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x81dfff00 --cmdline 'androidboot.hardware=skipjack msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 console=null androidboot.console=null earlycon=msm_hsl_uart,0x78b0000 buildvariant=user' -o new_boot.img

swift

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x80000000 --cmdline 'console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0 androidboot.hardware=swift msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 earlyprintk' -o new_boot.img

msm8909w_3100

beluga

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x81dfff00 --cmdline 'console=ttyMSM0,115200,n8 androidboot.console=ttyMSM0 androidboot.hardware=beluga msm_rtb.filter=0x237 ehci-hcd.park=3 lpm_levels.sleep_disabled=1 earlycon=msm_hsl_uart,0x78af000 ramoops.mem_address=0x93100000 ramoops.mem_size=0x100000 ramoops.record_size=0x20000 ramoops.dump_oops=0 buildvariant=user veritykeyid=id:27b8894f5753a3e5a6cbd26fa7ab31542db52f2d' -o new_boot.img

msm429

hoki

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x80000000 --cmdline 'androidboot.hardware=hoki user_debug=30 msm_rtb.filter=0x237 ehci-hcd.park=3 androidboot.bootdevice=7824900.sdhci lpm_levels.sleep_disabled=1 vmalloc=300M firmware_class.path=/vendor/firmware_mnt/image androidboot.usbconfigfs=true loop.max_part=7 console=/dev/null androidboot.console=/dev/null buildvariant=user' --pagesize 4096 -o new_boot.img

omap

minnow

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --cmdline 'rootwait init=/init utags.blkdev=/dev/block/platform/ocp.2/mmcblk0p7 omapfb.vram=0:1200K androidboot.hardware=minnow' -o new_boot.img

mtk

mooneye

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x81efff00 --cmdline 'buildvariant=user' -o new_boot.img

pike

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x81efff00 --cmdline 'buildvariant=user' -o new_boot.img

broadcom

tetra

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x82000000 -o new_boot.img

exynos

koi

mkbootimg --kernel zImage --ramdisk initramfs.cpio.gz --base 0x1dfff00 --cmdline 'buildvariant=user' -o new_boot.img
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment