- checks the supported.versions prop in anykernel.sh and matches against it to prevent users flashing incorrect kernels for ROM versions
- supported.versions can be a list, e.g. "7.1.2, 8.0, 8.1" or a range, e.g. "8.1 - 9" of versions in the correct formatting for that Android version in ro.build.version.release in /system/build.prop
split_boot is for fine grained control over what exactly gets flashed
at what point. It makes more sense for flash_dtbo to live in write_boot,
which does everything all at once.
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
Some zips may want to flash just the dtbo so add a function that can be
called in anykernel.sh to make that happen.
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
- gzip in busybox 1.29.1 doesn't seem to use compression anymore, with -1 and -9 both coming
out to the same size, generally dramatically larger than previously resulting in
boot-new.img exceeding the partition size on some devices so then failing the check.
e.g. 28mb ramdisk.cpio -> 11.2mb ramdisk.cpio.gz in 1.28.4, is now 20mb in 1.29.1
thanks nathanchance for reporting
- was broken with search strings containing paths (a limitation with busybox sed)
- now matches blank lines and lines containing only white space for next-empty-line matching
- include end-of-file as the final possible end-point for next-empty-line matching
This reverts commit bafe4bd586.
A certain level of functioning recovery is expected by AnyKernel2 (versus this patch's source, the Magisk installer, which is extremely pessimistic).
- search using a list of known ramdisk/kernel or recovery by-name partition names
- block=auto is equivalent to block=boot
- for use with broad, device non-specific AK2-based mod zips
- check for and remove patch for multi-partition/reset_ak (so removal of ramdisk/ and patch/ with the addition of $(basename block)-files is now the full trigger)
- wipe $(basename block)-files/ramdisk to ensure proper copied output, as the original contents are retained in the copied rdtmp
- for ramdisk-only changes that don't require added files or patch snippets, create the $(basename block)-files subfolder for proper output backup with reset_ak
- if no ramdisk is found in the zip, check for and copy files in from "$(basename $block)-files", e.g. boot-files + recovery-files subfolders, each which can contain their own zImage, and ramdisk and patch subfolders, etc.
- as part of the reset_ak command, copy the output files back to the corresponding *-files subfolder for use in debugging
* when ak2-core.sh gets run again by reset_ak after changing block= in anykernel.sh the above process begins again
- was only available in the update-binary, so allow in anykernel.sh as well, for use with checking /system/build.prop, /default.prop, $ramdisk/default.prop, etc.
- clean up false error output where sections are already removed on repeat flashes
- move size check to just before flash since we must compare against the fully repacked, signed boot-new.img
elftool fails to repack the ELF boot image on Sony devices when a custom dtb file is not provided within the AnyKernel2 zip, because the "dtb" variable, that contains the name of the dtb file, is overridden before the dtb filename is actually passed to the "rpm" variable. Swapping these two lines of code fixes the issue (tested by me on a Sony Xperia SP).
Currently, trying to use insert_line to insert something on the second
to last line fails and places it on the last line.
AK2 line:
insert_line test "sched_boost 0" after "on property:sys.boot_completed=1" " write /proc/sys/kernel/sched_boost 0"
Before:
on property:sys.boot_completed=1
bootchart stop
After:
on property:sys.boot_completed=1
bootchart stop
write /proc/sys/kernel/sched_boost 0
Expected result:
on property:sys.boot_completed=1
write /proc/sys/kernel/sched_boost 0
bootchart stop
In this example, the file length is 2 but the line we're inserting
at is also 2, which is perfectly fine because everything will get
shifted down by 1. Only if the file length is less than the desired
position (in this example, 3) should be handled by >>. All three
cases are now handled fine by insert_line (position 1, 2, and 3).
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
- introduce reset_ak function to reset the /tmp/anykernel directory to allow for multi-partition mods; use after changing the AK2 shell (block, etc.) variables again
- make patch_cmdline more intuitive; match the string, and if it doesn't exist add the replacement string, and if so replace with it
- allow AVBv1 signing of recovery by adding simple partition type detection based on name
- restore LD_LIBRARY_PATH after AVBv1 signing to be friendly to recovery when flashed in between other zips
- split dump_boot into split_boot + unpack_ramdisk and write_boot into repack_ramdisk + flash_boot
- fully backwards compatible as dump_boot and write_boot still exist and call these new functions (i.e. no changes needed to anykernel.sh)
- those that wish to do zImage-only AK2 packages can now use split_boot intead of dump_boot and and flash_boot instead of repack_ramdisk in their anykernel.sh
- add failsafe check for failed boot-new.img creation to ensure abort before wiping target partition in edge cases
- hide some expected stderr for AK2 mods with no additional ramdisk files
- fix U-Boot support by passing correct repacked ramdisk filename
- fix multi-compression support during repack derp
- fix cleanup on successful flash not working due to double match from cleanuponabort
- dtbo may be added as dtbo or dtbo.img to the base of the zip
- new Pixel 2 ro.boot.slot doesn't contain _ like Pixel ro.boot.slot_suffix does
Thanks @nathanchance for the majority of the work and research on this one, via #12