- 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
- ramdisk_compression=auto; (or undefined) in anykernel.sh is the default, automatically repacking with the detected unpack format
- changing auto to gz lzo lzma xz bz2 lz4-l (for lz4 legacy) or lz4 force the repack as that format
- to this point only gzip was supported, so add support for bzip2, lzop, lzma, xz and lz4 by detecting file magic via plaintext od dump comparison
- busybox contains all necessary formats except for lzma/xz compression (has decompression), and lz4 so add both of these binaries to the minimal default setup
ARM binaries; see AIK-mobile v2.9 for other architectures and optional binaries:
https://forum.xda-developers.com/showthread.php?t=2073775
Users may forget to place the commas for removal or they may want to
remove something in the middle. This will remove all commas at the
beginning and end and will make sure there are only single commas
between entries.
Examples:
Options: ro,barrier=1,discard,errors=panic
patch_fstab fstab.qcom /system ext4 options "discard,errors=panic" ""
patch_fstab fstab.qcom /system ext4 options ",errors=panic" ""
patch_fstab fstab.qcom /system ext4 options "errors=panic" ""
patch_fstab fstab.qcom /system ext4 options "discard" ""
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
After aa1377c, trying to remove part of the original string was not
possible.
Example:
patch_fstab fstab.qcom /system ext4 flags “wait,verify” “wait”
Because "wait" is within "wait,verify", the entire if block will miss
since grep will succeed in finding it. To work around this, we'll
allow users to leave the last part blank and put in the part they
want to remove as the fifth parameter.
Example:
patch_fstab fstab.qcom /system ext4 flags “,verify” “”
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
- add workaround for malformed ramdisks without leading directory cpio entries
- explicitly set ramdisk root directory to 755 (AOSP default) to avoid issues in some environments
- remove more things confusing to new adopters (AK2 does not root)
- update patch_fstab examples for corrected syntax
DO NOT MERGE if you have already updated your ramdisk properly for your device
- the 'original string' ($5) was not being used, instead the entire part was always being replaced with the 'replacement string' ($6)
- replace the target 'original string' of the entry part with 'replacement string' as expected/intended
NOTE: any properly written patch_fstab commands with original string as the complete original part WILL remain working as this is a backwards compatible change
- add built-in support for rkcrc for Rockchip board devices signed ramdisk image (see: https://github.com/rockchip-linux/rkflashtool)
- add built-in detection and support for Barnes & Noble Nook 'Green Loader/Green Recovery' signature
- fix busybox getting permissions on some devices where chmod does not accept -R to recurse
- use busybox for more possibly non-standard broken recovery shell commands
- silence some more generally expected/inconsequential stderr
- symlinks under /system/lib/modules were getting broken, so follow them instead to replace the target file, avoiding issues with multiple versions of the same module and running out of free space (e.g. OnePlus devices link /system/lib/modules/wlan.ko to /system/lib/modules/qca_cld3/qca_cld3_wlan.ko)
- set contexts on copied modules (following symlinks) to system_file to avoid SELinux issues where unlabeled module files might not be allowed to load
- sometimes it's difficult to anchor to specific end lines due to variations across ROMs, so allow the end line to be blank " "
- note this will also remove the trailing blank line so for replacements a trailing \n should be added to maintain spacing; this should be pretty intuitive since you are including the blank line as the end line search
- some Samsung device images can be unpacked and repacked with the standard tools but the id sha1 is offset differently than in the standard header resulting in broken hash type detection
- to make it easier to diagnose issues with patches, image creation or flashing, adding "-debugging" to the end of the AK2 zip filename will enable the creation of a tar.gz of the entire /tmp directory after the installation process (but before cleanup, of course), this includes recovery.log, boot.img, boot-new.img and any other remnants to allow more thorough, direct debugging at a later time
- if it does not exist yet (i.e. hasn't been extracted) then assume cleanuponabort=1 since there wouldn't be anything to see on a failed extraction
- hide any missing file errors from file_getprop here now that we've taken care of that case
- add built-in support for dumpimage/mkimage for DENX U-Boot uImage devices (see: http://git.denx.de/u-boot.git)
- add built-in support for pxa1088-unpackbootimg/pxa1088-mkbootimg for Marvell PXA1088 board devices' deviation from the AOSP standard (see: https://github.com/osm0sis/pxa1088-mkbootimg)
patch_prop:
- if matched name is not present, appends new prop entry to the end of the file
- if matched name is present, replaces the entry with the new value