Commit Graph
63 Commits
Author SHA1 Message Date
osm0sis d4f81e628e AK2: add reset_ak(), fix patch_cmdline(), improve AVBv1 signing
- 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
2018-01-15 02:41:23 -04:00
osm0sis 79f1c391ea AK2: allow U-Boot uImage without ramdisk 2018-01-13 17:47:37 -04:00
osm0sis fb44ff18e1 AK2: add support for repacking as Sony ELF
- add built-in support for elftool for older Sony devices which don't support AOSP boot.img repacks (see: #3, https://forum.xda-developers.com/xperia-j-e/development/arm-elftool-pack-unpack-boot-image-sony-t2146022)
2018-01-13 17:15:51 -04:00
osm0sis 7f47e21362 AK2: add "OG AK" mode by making the unpack/repack procedure more granular
- 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
2017-12-14 13:03:23 -04:00
osm0sis 13f2018ee3 tools: update to latest builds
Compiled from my own updated forks:
https://github.com/osm0sis/mkbootimg

ARM binaries; see AIK-mobile v3.0 for other architectures and optional binaries:
https://forum.xda-developers.com/showthread.php?t=2073775
2017-12-14 11:45:44 -04:00
osm0sis 79df8fcf0b AK2+Backend: misc fixes
- 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
2017-12-03 08:50:51 -04:00
osm0sis 3269b51d28 AK2: add dtbo and Pixel 2 slot prop support
- 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
2017-11-29 13:34:51 -04:00
osm0sis 45766e2afc AK2: tidy up compression support a little more 2017-11-22 19:31:34 -04:00
osm0sis 0535fd7ca0 AK2: allow forcing repack ramdisk compression format of choice
- 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
2017-11-22 13:28:47 -04:00
osm0sis 1ffbf0d1af AK2+tools: add support for alternate ramdisk compression formats
- 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
2017-11-22 09:58:20 -04:00
Nathan Chancellor 8decdd4624 AK2: Allow users to use either "" or " " for empty strings
Either one is now valid:
patch_fstab fstab.qcom /system ext4 options "discard" " "
patch_fstab fstab.qcom /system ext4 options "discard" ""

Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
2017-10-15 22:27:34 -03:00
Nathan Chancellor d907653c78 AK2: Sanitize patch_fstab for proper commas
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>
2017-10-15 22:27:34 -03:00
Nathan Chancellor cf764ee768 AK2: Improve patch_fstab
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>
2017-10-15 22:27:34 -03:00
osm0sis 6bcf2668e4 AK2: improve cpio ramdisk unpacking
- 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
2017-10-14 13:42:51 -03:00
osm0sis aa1377c9ab AK2: fix patch_fstab substring replacement
- 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
2017-09-22 01:35:51 -03:00
osm0sis 4863f79152 AK2: fix abort ui_prints from slot detection checks 2017-09-22 00:16:10 -03:00
osm0sis 66b221ef99 AK2: add KRNL and NOOK signed image support
- 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
2017-09-11 12:10:14 -03:00
osm0sis c867216f91 tools: update to latest builds, including busybox (1.27.2)
Compiled from my own updated forks:
https://github.com/osm0sis/mkbootimg
https://github.com/osm0sis/android-busybox-ndk

ARM binaries; see AIK-mobile v2.9 for other architectures and optional binaries:
https://forum.xda-developers.com/showthread.php?t=2073775
2017-09-10 23:26:12 -03:00
osm0sis d60281c8b2 AK2: add DHTB signed image support
- add built-in support for dhtbsign for Samsung/Spreadtrum board devices signature header (see: https://github.com/osm0sis/dhtbsign)
2017-09-10 23:05:47 -03:00
osm0sis 1787580bf9 AK2: rename pxa1088- AOSP variant tools to pxa- per upcoming AIK release 2017-09-10 22:55:53 -03:00
osm0sis ce29998bf9 AK2: silence possible expected mount stderr with AVB signing 2017-08-20 01:00:53 -03:00
osm0sis 79c2ab4f60 AK2: fix AVB signing 2017-07-14 13:16:12 -03:00
osm0sis b91ec4deda AK2: better fix for unknown hash type
- https://github.com/osm0sis/AnyKernel2/commit/45bfc5d602582c53433bd2398bdc5876a7e260c9 broke the error catching on unpackbootimg
- more easily worked around during repack, see linked commit for rationale for the assumption
2017-07-04 15:47:31 -03:00
osm0sis adc21ed2c3 AK2: allow next blank line (" ") for replace_section and remove_section
- 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
2017-07-04 14:24:12 -03:00
osm0sis 45bfc5d602 AK2: assume sha1 if "unknown" hash type encountered
- 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
2017-06-26 21:00:23 -03:00
osm0sis 05cb01112d AK2: accept .pem certificates for AVB signing
- turns out BootSignature.jar accepts .pem as well as .der
- AOSP uses "verity" keys by default for boot signatures: https://github.com/android/platform_build/tree/master/target/product/security
2017-06-16 17:00:46 -03:00
osm0sis 697e286654 AK2: add Android Verified Boot (AVB) signature support
- add built-in support for BootSignature_Android.jar for AVB signature enforcing devices (see https://forum.xda-developers.com/android/software-hacking/signing-boot-images-android-verified-t3600606)
2017-06-06 13:24:47 -03:00
osm0sis 89ba5089d2 tools: update to latest unpackbootimg build
Compiled from my own updated fork:
https://github.com/osm0sis/mkbootimg

ARM binary; see AIK-mobile v2.8 for other architectures and optional binaries:
https://forum.xda-developers.com/showthread.php?t=2073775
2017-06-05 16:27:16 -03:00
osm0sis 633e042fc6 AK2+Backend: tidy up remaining intentional stderr
- no need to see these when there is an expected error during normal use
2017-05-26 22:57:13 -03:00
osm0sis c24b2a299d AK2: add uImage and PXA1088 boot.img variant support
- 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)
2017-05-26 22:05:53 -03:00
osm0sis fd5bfaa381 AK2: introduce .prop files patching function
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
2017-05-04 18:02:00 -03:00
osm0sis a4adf0111e tools: update to latest builds, including busybox (1.26.2)
Compiled from my own updated forks:
https://github.com/osm0sis/mkbootimg
https://github.com/osm0sis/android-busybox-ndk

ARM binaries; see AIK-mobile v2.7 for other architectures and optional binaries:
https://forum.xda-developers.com/showthread.php?t=2073775
2017-05-04 17:22:51 -03:00
osm0sis b72155d3a2 AK2: add SignBlob support
- add built-in support for blobpack for Asus SignBlob devices (see https://github.com/AndroidRoot/BlobTools)
2017-05-04 17:20:05 -03:00
osm0sis dae85a0ed5 AK2: add support for sha256 hashed boot.img
- newer devices from Xiaomi use this, see latest commits here: https://github.com/osm0sis/mkbootimg
2017-04-25 08:59:09 -03:00
osm0sis 6fedeb5dc4 AK2: introduce cmdline patching function, misc cleanup
- use proper variable for ramdisk in mkbootfs support

patch_cmdline:
- if match not present, appends to the end of the current commandline
- if match is present, expands to full string (to allow for item=value entries), and optionally replaces with a second string, or just removes the entry, then cleans up doublespaces and trailing whitespace
2017-04-22 08:59:52 -03:00
osm0sis b89e3fd164 AK2: add boot partition sanity check
- only take the first word to allow workarounds for undefined partitions with dd skip=
2017-04-21 03:01:08 -03:00
osm0sis b31389512f AK2: misc cleanups
- hide unpackelf test stderr
- accept dtb and dt.img for dt
2017-04-10 20:03:33 -03:00
Chris Renshaw bc99ae1923 AK2: fix unpackelf fix
- underp the fallback logic
2017-03-01 00:07:04 -04:00
osm0sis 7c244c6dea tools: update to latest mkbootimg+unpackbootimg builds
Compiled from my own updated fork: https://github.com/osm0sis/mkbootimg

ARM binaries; see AIK-mobile v2.6 for other architectures and optional binaries:
https://forum.xda-developers.com/showthread.php?t=2073775
2017-02-27 19:43:19 -04:00
osm0sis efed2f07ea AK2: add Samsung SEAndroid footer support
- Chainfire inlines support for this into SuperSU (unlike the similar LG Bump support which must be added via /data/custom_boot_image_patch.sh), so we must also.
2017-02-27 19:27:53 -04:00
osm0sis befe258b96 AK2: repair unpackelf support on repeat dirty flashes
- on Sony devices supporting standard boot.img on unloacked bootloaders first AK2 flash would convert from ELF to boot.img, but second flash would attempt to use unpackelf again and fail, so fallback to unpackbootimg
- requires updated unpackelf binary for Sony ELF devices (see: https://github.com/osm0sis/unpackelf)
2017-02-27 17:25:29 -04:00
osm0sis 092a3b3880 AK2: add more compression types and Image.fit (ChromeOS) to zImage checks 2017-02-27 16:39:13 -04:00
osm0sis c709fd50f5 AK2: add ChromeOS support
- add built-in support for futility for ChromeOS devices (see https://github.com/osm0sis/futility)
- small path cleanup since we generally need to be in /tmp/anykernel for post-repack anyway
2017-02-27 16:35:32 -04:00
osm0sis 7d9d56d453 AK2: make backup only backup when needing backup 2017-02-02 18:26:39 -04:00
osm0sis b6d48eed5e AK2: add MTD device support and dd wiping
- add built-in support for mtd-utils (nanddump, flash_erase, nandwrite) for MTD-based Android devices that do not work with dd
- wipe boot block with dd before write to be clean/safe (SuperSU zip also does this)

Known working mtd-utils ARM binaries can be found in my FlashIt v2.5 package:
https://forum.xda-developers.com/showthread.php?t=2239421
2017-02-02 15:52:09 -04:00
osm0sis a531fff38b AK2: add ELF support (repacks as boot.img for unlocked bootloaders)
- add built-in support for unpackelf for Sony ELF devices (see: https://github.com/osm0sis/unpackelf)
- kernel section is not gzipped on ELF devices with non-QCDT/non-ELF dtb, which needs compression and the dtb appended before it can be repacked (thanks @tobiaswaldvogel)
2017-02-02 15:01:59 -04:00
osm0sis 6fa951efa1 AK2: simplify zImage checks and expand to cover Image.gz, etc. 2017-02-02 14:03:12 -04:00
osm0sis 846f9d5f25 tools: update to latest builds, including busybox (1.26.2)
Compiled from my own updated forks:
https://github.com/osm0sis/mkbootimg
https://github.com/osm0sis/android-busybox-ndk

ARM binaries; see AIK-mobile v2.5 for other architectures and optional binaries:
https://forum.xda-developers.com/showthread.php?t=2073775
2017-02-02 13:37:47 -04:00
osm0sis c13647eb2e AK2: add MTK support, insert_line fix
- add built-in support for mkmtkhdr for mtk devices (see: https://github.com/osm0sis/mkmtkhdr)
- fix insert_line when inserting after the last line
2017-01-04 02:08:43 -04:00
osm0sis 5bde2c094a AK2: split functions into ak2-core to make syncing easier for devs going forward 2016-11-30 23:45:28 -04:00