- abstract out execution directory as $home to fascilitate testing individual scripts (defaults to /tmp/anykernel)
- general script clean ups for uniformity, readability, speed and simplicity
- simplify consecutive `ui_print` commands where possible
Backend only fixes:
- use busybox umount and mount whenever possible to avoid linker warnings in stderr during system-as-root setup
- use `busybox --install -s` for bin/* setup
- consolidate setup to abort earlier if there are issues
- add backwards compatible symlinks for those who might not have updated their anykernel.sh with ak3-core.sh (to be renamed in subsequent commit)
Tools only fixes:
- add magiskboot to replace separate support for AOSP and PXA-AOSP formats, with MTK headers, BLOB, DHTB, SEAndroid and Nook signing
- add magiskpolicy to allow for easy sepolicy patching
- remove xz and lz4 since magiskboot supports these
AK3 Core only fixes:
- use full `ui_print` function implementation like the backend
- add `abort` function to simplify exit on errors
- fix $patch directory being excluded from `reset_ak`
- update $ramdisk_compression handling for magiskboot
- magiskboot also resolves long-standing request for built-in Bump support (#18)
- update Sony ELF and related support for initial repack as AOSP by using mkbootimg as plug-and-play optional add-in binary
- update Sony ELF MTK header support using mkmtkhdr only when ELF is initially unpacked by unpackelf
- add support for MTK RECOVERY ramdisk header type with Sony ELF
- simplify U-Boot dumpimage/mkimage and Sony ELF unpackelf/mkbootimg split_img file handling
- update patch_cmdline to handle both magiskboot as header prop file, and unpackelf or mboot as cmdline.txt
- use `cp -fp` for `backup_file` and `restore_file` to hopefully better preserve attributes if used outside of the ramdisk
- refactor setup into `setup_ak` to simplify `reset_ak` trigger to find slot and block again
- add fallback to busybox for compression formats (i.e. lzop) which magiskboot cannot handle
IMPORTANT NOTES:
1) forcing repack with uncompressed cpio ramdisk is not currently supported by magiskboot
2) forcing repack with lzop ramdisk when previously another format is not currently supported by magiskboot
- extend `reset_ak` with `reset_ak keep` which will keep files to be available to patch the other slot
- add optional slot_select=inactive shell variable to force inactive slot during slot detection
- AOSP has added --dtb, so to avoid conflicts *unpackbootimg and unpackelf have had what was previously dumped as *-dtb renamed to *-dt
- the same corresponds to any replacement version of these included in the zip root, i.e. they are now dt or dt.img for the old style from before hdr_v1, and dtb or dtb.img for the new style for hdr_v2
Note: You MUST update to the newer mkbootimg and unpackbootimg for this commit if you are using architectures other than the included ARM builds!
See AIK-mobile v3.5 for updated unpackelf, and mkbootimg/unpackbootimg binaries:
https://forum.xda-developers.com/showthread.php?t=2073775
- dd uses bs=512 by default, which is far from optimal for sequential reads.
Use bs=1048576(1M) for initial dump.
This improves read performance by a measurable amount.
- Zero-fill only the remaining blocks.
There's no need to zero-fill all blocks,
not to mention the additional/unnecessary wear and tear
to the flash storage.
Linux pipe uses bs=4096 by default. By using cat for this,
we additionally gain much better write performance.
On the OnePlus 6T, final write operation took 7.1 seconds in total with
2 consecutive dd commands. With cat, it now takes 0.08 seconds.
Signed-off-by: Park Ju Hyung <qkrwngud825@gmail.com>
- some ROMs have taken it upon themselves to go against AOSP, i.e. where starting with Pie AOSP now versions it as only 9, some ROMs are still making it 9.0
- introduce integer 2 float function that will add a decimal place to all for comparisons
- this should support the majority of ROMs, but anything crazy like 9.0.0, or crazier like 09.0.0 should be frowned upon by the community and the ROM devs should be made to get it together and follow AOSP
- 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
- getprop failures are not only a system-as-root device issue, as it now also happens on OnePlus 5T in recovery when ROM is Pie Open Beta
- this appears to come down to a libc mismatch between recovery and ROM resulting in direct property checks failing but getprop without arguments printing all properties working
- revert most of https://github.com/osm0sis/AnyKernel2/commit/b1524da099efa716616a8eb3357876bca6a73540 since this should remain resolved with the new implementation
- keep the old check and file_getprop fallback for devices without getprop entirely
- add new getprop fallback that parses the full getprop output
- some custom ROMs on some devices (e.g. Lineage on Pocophone) bind mount modules in /system over modules on /vendor, so remount rw at the bind target to ensure the bind source is also remounted and replaced
- toybox mount doesn't accept the /. prefixed paths from find so ensure we use busybox for mounts
Thanks franciscofranco and topjohnwu for the tips!
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