[ASUS ZenFone 8] bnsmb:
While trying to get TWRP to boot on a phone with LIneageOS 20.x installed, I found some information about the boot parameters for the Android OS, which I document with this forum post.

To view the current kernel parameter for the Android kernel the command

cat /proc/cmdline

can be used. e.g

1|ASUS_I006D:/ $ su - -c cat /proc/cmdline
cgroup_disable=pressure log_buf_len=256K earlycon=msm_geni_serial,0x98c000 rcupdate.rcu_expedited=1 rcu_nocbs=0-7 kpti=off noirqdebug androidboot.console=ttyMSM0 androidboot.hardware=qcom androidboot.memcg=1 androidboot.usbcontroller=a600000.dwc3 cgroup.memory=nokmem,nosocket console=ttyMSM0,115200n8 ip6table_raw.raw_before_defrag=1 iptable_raw.raw_before_defrag=1 loop.max_part=7 lpm_levels.sleep_disabled=1 msm_rtb.filter=0x237 pcie_ports=compat service_locator.enable=1 swiotlb=0 kpti=off buildvariant=userdebug androidboot.verifiedbootstate=orange androidboot.keymaster=1 androidboot.bootdevice=1d84000.ufshc androidboot.fstab_suffix=default androidboot.boot_devices=soc/1d84000.ufshc androidboot.serialno=M6AIB760D0939LX androidboot.baseband=msm msm_drm.dsi_display0=qcom,mdss_dsi_samsung_fhd_cmd: androidboot.slot_suffix=_b rootwait ro init=/init androidboot.dtbo_idx=0 androidboot.dtb_idx=0 androidboot.force_normal_boot=1 androidboot.pre-ftm=0 androidboot.id.prj=4 androidboot.id.stage=7 androidboot.id.sku=3 androidboot.id.rf=1 androidboot.id.pcb=4731 androidboot.id.nfc=1 androidboot.country_code=EU androidboot.bootcount=0 androidboot.rawdump_en=0 androidboot.asus.authorized=0 androidboot.cpuid.hash=551c6708e291a3a57e013f5bdf2afe4a androidboot.toolid=15715839e737449088fe70f7faf618f0 SB=Y androidboot.fused=1 SBNR=Y androidboot.fused.norpmb=1 androidboot.id.panel=1 androidboot.id.ufs=3 androidboot.factory.crc=0x4FE99984 androidboot.ddr.manufacturer_id=FF androidboot.ddr.device_type=8 LCD=AC0E0041 androidboot.bootreason=hard
ASUS_I006D:/ $

Additional boot parameter can be defined in the boot partition. To do this the Magisk binary magiskboot can be used; Example (for doing this in an Android shell):

#
# the commands must be done as user root
#
ASUS_I006D:/ $ su -

ASUS_I006D:/ # mkdir /data/develop

ASUS_I006D:/ # cd /data/develop

ASUS_I006D:/data/develop # getprop ro.boot.slot_suffix
_b
ASUS_I006D:/data/develop #

#
# unpack the current boot partition to the current directory
#
# Note: The parameter -h for magiskboot is required to write the header file
#
ASUS_I006D:/data/develop # /data/adb/magisk/magiskboot unpack -h /dev/block/by-name/boot_b
Parsing boot image: [/dev/block/by-name/boot_b]
HEADER_VER [4]
KERNEL_SZ [39909888]
RAMDISK_SZ [43610592]
OS_VERSION [13.0.0]
OS_PATCH_LEVEL [2023-05]
PAGESIZE [4096]
CMDLINE []
KERNEL_FMT [raw]
RAMDISK_FMT [lz4_legacy]
VBMETA
ASUS_I006D:/data/develop #

ASUS_I006D:/data/develop # ls -l
total 129960
-rw-rw-rw- 1 root root 50 2023-06-25 14:31 header
-rw-r--r-- 1 root root 39909888 2023-06-25 14:31 kernel
-rw-r--r-- 1 root root 93031052 2023-06-25 14:31 ramdisk.cpio
ASUS_I006D:/data/develop #

ASUS_I006D:/data/develop # cat header
cmdline=
os_version=13.0.0
os_patch_level=2023-05
ASUS_I006D:/data/develop #

To define additional boot parameter add them to the line cmdline= in the file header and repack the boot image, e.g:

ASUS_I006D:/data/develop # sed -i -e "s/cmdline=/cmdline=debug /g" header
ASUS_I006D:/data/develop #

ASUS_I006D:/data/develop # cat header
cmdline=debug
os_version=13.0.0
os_patch_level=2023-05
ASUS_I006D:/data/develop #

ASUS_I006D:/data/develop # /data/adb/magisk/magiskboot repack /dev/block/by-name/boot_b ../new_boot.img
Parsing boot image: [/dev/block/by-name/boot_b]
HEADER_VER [4]
KERNEL_SZ [39909888]
RAMDISK_SZ [43610592]
OS_VERSION [13.0.0]
OS_PATCH_LEVEL [2023-05]
PAGESIZE [4096]
CMDLINE []
KERNEL_FMT [raw]
RAMDISK_FMT [lz4_legacy]
VBMETA
Repack to boot image: [../new_boot.img]
HEADER_VER [4]
KERNEL_SZ [39909888]
RAMDISK_SZ [43610592]
OS_VERSION [13.0.0]
OS_PATCH_LEVEL [2023-05]
PAGESIZE [4096]
CMDLINE [debug]
ASUS_I006D:/data/develop #

Use dd (or fastboot) to flash the new boot image, e.g:

dd if=../new_boot.img of=/dev/block/by-name/boot_b

Notes:

To define additional kernel parameter add them to the line using the blank as separator for the parameter - e.g.:

cmdline=loglevel=7 debug

The list of known kernel parameter for the ASUS Zenfone 8 can be found in the file

./kernel/asus/sm8350/Documentation/admin-guide/kernel-parameters.txt

in the source for the Android OS used (but most of the parameter described there are useless for the Android OS I guess ...)

The method described above can also be used to define additional kernel parameter for the kernel in the TWRP image. Note that you should never delete the kernel parameter twrpfastboot=1 in the TWRP boot image.

Unpacking and repacking the boot image can also be done on a PC running the Linux OS using the x86 version of magiskboot from the Magisk apk file.

To extract the magiskboot binary for 64 Bit Linux from the apk file use these commands:

unzip -p Magisk-v26.1.apk lib/x86_64/libmagiskboot.so >magiskboot
chmod 755 magiskboot

The x86 binaries from the Magisk apk file are static linked binaries and should work on every Linux OS running on x86.

The Magisk Module cmdpatch (https://github.com/Magisk-Modules-Alt-Repo/cmdpatch) contains a script to add new kernel parameter