Will the patched boot image work with LineageOS?
No, this does not work on LineageOS (at on the latest 15.1 nightlies).
Here are the steps I took to build a working boot.img for LineageOS. The boot.img I start with is from the LineageOS zip file (use same version you have flashed to your device), you can get it here:
https://download.lineageos.org/bullhead
This is the tool I for unpacking/packing boot.img and recovery.img. It includes a binary for mkbootimg, and I highly recommend not using it and using your own built from source since running arbitrary binaries from random people on the internet is never a good idea. mkbootimg's source is in the AOSP tree, and I think some folks mirror it on github somewhere. The bash script mkboot in this repo is incredibly useful though.
https://github.com/xiaolu/mkbootimg_tools
# boot.img
## Extract boot.img:
Code:
~/src/mkbootimg_tools/mkboot boot.img boot
## Edit boot/img_info, change boot_cpus=0-3 and add maxcpus=4:
Code:
cmd_line='console=ttyHSL0,115200,n8 androidboot.hardware=bullhead boot_cpus=0-3 maxcpus=4 lpm_levels.sleep_disabled=1 msm_poweroff.download_mode=0 loop.max_part=7 buildvariant=userdebug'
## Edit ramdisk/init.bullhead.rc:111:
Code:
write /dev/cpuset/foreground/cpus 0-3
write /dev/cpuset/foreground/boost/cpus 0-3
write /dev/cpuset/background/cpus 3
write /dev/cpuset/system-background/cpus 2-3
write /dev/cpuset/top-app/cpus 0-3
## Pack new boot.img:
Code:
~/src/mkbootimg_tools/mkboot boot boot_4cpus.img
You can actually use the same process to patch the kernel cmdline used in TWRP to get a working recovery again:
## Unpack recovery:
Code:
~/src/mkbootimg_tools/mkboot twrp-3.2.3-0-bullhead.img twrp
## Edit twrp/img_info insert into cmd_line (boot_cpus already exists, so change it):
## Pack recovery and flash:
Code:
~/src/mkbootimg_tools/mkboot twrp twrp-3.2.3-0-bullhead_4cpu.img
fastboot flash recovery twrp-3.2.3-0-bullhead_4cpu.img