Commit Graph
80 Commits
Author SHA1 Message Date
Chris Renshaw 32073dff09 AK3: add per-partition attributes, multi-partition fixes
- attributes function now runs via core in setup_ak and reset_ak, but only if it exists, allowing more easy removal of it for setups with no ramdisk changes (so all should now remove the awkward `&& attributes` call from anykernel3.sh, see next commit)
- for multi-partition zips with multiple ramdisks requiring different files, multiple attributes functions may now be specified, either redefine attributes() in anykernel.sh for the next partition, or add a different function for each partition, e.g. boot_attributes() and vendor_boot_attributes()
- fix block=auto multi-partition setup creating an "auto-files" directory instead of final found block, e.g. "init_boot-files"
2023-08-10 13:11:32 -03:00
Chris Renshaw 4030d36655 AK3+Backend: helper module improvements and full KernelSU support
- only parse kernel strings when both do.modules=1 and do.systemless=1 are set
- support post-fs-data.sh in systemless kernel helper module (gets renamed and sourced from the built-in one)
- show systemless kernel helper module as an update pending reboot in module apps if flashed while booted
- add system_ext support to systemless kernel helper module
- show a warning during flash if systemless kernel helper module is configured but there's no decrypted /data access to be able to install it
- detect the installed KernelSU app as the indicator the user intends to use KernelSU, and install systemless kernel helper module to modules_update.img accordingly
- do KernelSU directory setup and create modules_update.img if this appears to be the initial KernelSU install
- set all systemless kernel helper module files to system_file context, since unlabeled files are not gracefully handled by KernelSU (they trigger a reboot and the module gets rejected)

NOTE: currently it appears KernelSU won't parse the modules_update.img on the first boot where it sets itself up from initial KernelSU install, but it will then do it after the following reboot. Hopefully this can be fixed by a future KernelSU release so that the systemless kernel helper module is active right away as this might be necessary to boot fully on some devices
2023-07-16 16:33:47 -03:00
osm0sis 0b37d0bfa4 AK3+Backend: add preliminary KernelSU support 2023-07-04 15:32:02 -03:00
osm0sis c91542d29f AK3: don't attempt to AVBv1 sign if /system/bin/dalvikvm is not present
- latest Android has moved dalvikvm to /apex/com.android.art/bin/dalvikvm but there's currently no way to run this from recovery due to linkerconfig
- AVBv1 signing is most likely only needed on older devices running older Android which will still have /system/bin/dalvikvm so this shouldn't really affect anything
2023-06-05 12:56:37 -03:00
Captain Trips 68564baf10 AK3: clear cow before logical partition replace or resize (#78) 2023-05-04 13:36:15 -03:00
osm0sis ba82924dab AK3+Backend: pass AKHOME via export 2023-05-03 15:45:34 -03:00
osm0sis b3c769f1db AK3+Backend: use busybox as much as possible + OLD_PATH for exceptions 2023-04-23 00:09:54 -03:00
osm0sis f2dbe60f63 AK3: partial revert of d6e040c2 until issue with kernel_dtb is addressed
- magiskboot split needs to be updated to not decompress so that if there's a patched kernel_dtb it can be properly appended to the restored unpatched compressed new kernel

see: https://github.com/topjohnwu/Magisk/pull/6597#issuecomment-1518709863
2023-04-23 00:05:05 -03:00
osm0sis d6e040c227 AK3: update for latest magiskboot, don't un/repack kernel if not patched 2023-04-18 13:27:44 -03:00
Captain Trips ddbb40edc8 AK3: detect flashing to inactive slot during OTA on VAB devices (#77) 2023-04-16 18:06:44 -03:00
osm0sis c2e33f95d1 AK3+Backend: support AMLogic devices where A-only sets slot=normal 2023-02-08 12:53:48 -04:00
osm0sis 6ffb765c8c AK3: correct cmdline to remove any type of leading whitespace 2023-01-20 12:37:19 -04:00
osm0sis 8077d11135 AK3: also remove leading spaces from cmdline 2023-01-09 19:19:13 -04:00
osm0sis c2e0bd7c4b AK3: flash_* display/output/debug improvements
- tidy up flash_generic block display output to match setup_ak
- add helpful flash_generic debugging stderr for mapper flashing
- hide flash_boot harmless stderr from strings command in TWRP
2023-01-07 14:25:44 -04:00
osm0sis aea91db9e7 AK3: block=auto and flash_generic improvements
- restore block=auto covering both ramdisk and boot, with ramdisk list favored to accomodate init_boot
- favor mapper/by-name in flash_generic
- add block/by-name over bootdevice/by-name in flash_generic to mirror block=auto/<name> path finding behavior
2023-01-06 22:16:52 -04:00
osm0sis 1fd27023b8 AK3: partition auto-detect improvements
- remove whitelist to allow auto-detect for any partition based on by-name filename only
- add more error catching for manually specified partition paths
- restore Huawei Treble partitions to auto-detect (kernel, ramdisk and recovery_ramdisk)
2022-12-01 19:59:09 -04:00
osm0sis 020ca6fddb AK3: add support for simple init_boot + vendor_kernel_boot setup
- starting with Pixel 7 series, boot_img_hdr_v4 is now even more complicated, adding 2 more new partitions (init_boot and vendor_kernel_boot) so let's attempt to keep it as simple as we can
- if init_boot partition is detected split up flash files for boot (kernel), init_boot (ramdisk), and vendor_kernel_boot (dtb)
- continue to support current practice of Image* and dtb in zip root by automatically creating a multi-partition AK3 zip setup from these files (ramdisk directory is for the init_boot partition since that's where Magisk and overlay.d will be)

NOTE 1: anykernel.sh must still be setup for multi-parition patching - see the updated Example file for parts to uncomment
NOTE 2: currently magiskboot still does not support unpack/repack of VNDRBOOT v4 multi-ramdisk format (i.e. vendor_boot v4 and vendor_kernel_boot) so if modifications are necessary in these ramdisks they will need to be prebuilt and flashed whole by including vendor_boot.img and/or vendor_kernel_boot.img in the zip root
2022-11-11 22:20:59 -04:00
Chris Renshaw cf1a93136c AK3: separate init_boot and boot partition detections
- both boot for kernel and init_boot for first stage ramdisk access to overlay.d will be needed
- remove ramdisk and recovery_ramdisk from detection since devices which use them also use kernel partition and would need to be multi-partition setups either way
2022-10-19 23:19:09 -03:00
Matthew Alex 042d0ccf6d AK3: add support for vendor_kernel_boot (#75) 2022-10-19 23:07:26 -03:00
Captain Trips 97794de0a2 AK3: use lptools resize for vendor_dlkm (#73)
- default to replace and fallback to resize when not enough space in super
2022-08-02 17:31:51 -03:00
Captain Trips bc736e9ce1 AK3: add support for avb patching (#70)
- this supports custom kernel users to continue not having to fastboot reflash vbmeta with --disable-verity and --disable-verification, now that Magisk 24303+ no longer patches avb out of the fstab on-the-fly at boot time
- checks for an avb option in the fstab entry for the current partition
- if found, it checks if verity or verification is disabled on the top-level vbmeta, and if so, appends a hashtree and FEC data to the partition and updates the hashtree descriptor in the vbmeta partition referenced in the avb option
2022-06-08 13:33:19 -03:00
Chris Renshaw c8961dedb8 AK3: silence placeholder cleanup rmdir noise 2022-06-07 20:19:45 -03:00
Captain TripsandChris Renshaw 79cb6945ff AK3: add support for resizing logical partitions (#69)
- add flash_generic support for flashing to dynamic/logical partitions larger than stock using phhusson's lptools binary
- enable full automated support for flashing custom vendor_dlkm.img (note: must NOT be sparse format; factory images are sparse, but images generated from source are not)

Co-authored-by: Chris Renshaw <osm0sis@outlook.com>
2022-04-30 20:01:03 -03:00
osm0sis adb09dcc81 AK3: ensure no template files from beginner devs get to the ramdisk 2022-04-23 18:47:35 -03:00
osm0sis 97d2d7ffd5 AK3: also ensure $comp fallback is a working command for ramdisks 2022-04-10 22:30:19 -03:00
osm0sis c19c5be18c AK3: fix unpack/repack with magiskboot zimage kernel support
- exclude "zimage" as a compression type since magiskboot unpack, split and repack handle it automatically and there is no fallback
- ensure $comp is a working command for all busybox compression fallbacks
2022-04-03 09:19:15 -03:00
Chris Renshaw 743bb44ed1 AK3: add support for new upstream AOSP init_boot partition
https://android-review.googlesource.com/c/platform/build/+/1882268
2022-03-04 13:45:59 -04:00
Alexander Winkowski 076e748dc3 AK3: Fix patch_fstab function (#66)
Patching system partition entry won't work if system_ext partition is present. Fix this by adding [[:space:]] to the end of the pattern.
Note that grep -w can't be used in this case because there is still a possibility of erroneous matches from grep using / as a whole word delimiter, e.g., logical vendor partition (that is just "vendor") and "/vendor/dsp".
2022-03-04 03:59:38 -04:00
Alexander Winkowski 3e99a63e92 AK3: fix no_block_display behaviour with flash_generic (#65) 2022-02-01 13:14:43 -04:00
osm0sis fb5fbb1516 AK3: update KEEPVBMETAFLAG -> PATCHVBMETAFLAG for Canary 23016+ 2021-12-15 20:20:27 -04:00
osm0sis 12baa2739a AK3: better backwards compatibility for keep_vbmeta_flag (unset=auto) 2021-12-11 00:12:14 -04:00
osm0sis 6e7fcd6d28 AK3: add magiskboot KEEPVBMETAFLAG support
- some devices fail to boot when magiskboot changes the vbmeta flag is set in the AVBv2 signature from 00 to 03, this allows disabling that behavior
- set keep_vbmeta_flag=1 in anykernel.sh to force it to keep whatever's there, =auto will take it from the existing image if Magisk-patched (Canary 23016 or later), and =0 will allow the default magiskboot behavior
2021-12-10 23:30:24 -04:00
osm0sis 66f42c1951 AK3+Backend: grep cleanups
- fix duplicate kernel version (vertmp) entries from some kernels
- don't use head when grep -m1 will suffice
- fix some (bad) OEM prop files including entries twice, use last entry like live system
2021-12-10 17:34:54 -04:00
Chris Renshaw 08a76000ad AK3: unbreak anykernel scripts using flash_dtbo directly 2021-12-06 13:45:16 -04:00
osm0sis 297d6c3b99 AK3: add flash_generic to reduce code duplication 2021-12-06 10:04:54 -04:00
engstkandosm0sis 2b7f6e8889 AK3: add full vendor_dlkm.img flash support
- Use similar dtbo.img logic
- Support new hdr v4 images without repacking
- Process before boot to safe bail
- No resize available, checks output size and bounces if larger
- Handle block state correctly to fix boot check warning

Co-authored-by: osm0sis <osm0sis@outlook.com>

Signed-off-by: engstk <eng.stk@sapo.pt>
2021-12-04 18:11:38 -04:00
engstk 146f9b27c5 AK3: add full vendor_boot.img flash support
- Use similar dtbo.img logic
- Support new hdr v4 images without repacking
- Process before boot to safe bail

Signed-off-by: engstk <eng.stk@sapo.pt>
2021-12-04 18:11:38 -04:00
osm0sis 216eefce20 AK3: fix new .img backup in debugging tgz, multipartition output tweak 2021-07-21 01:49:27 -03:00
osm0sis 3cfdc71d10 AK3: fix systemless modules on single-partition setups 2021-06-09 00:21:21 -03:00
osm0sis 5035d6b7cb AK3+Backend: fix systemless modules on multi-partition setups 2021-06-08 17:00:03 -03:00
osm0sis 484ea072a8 AK3: hide expected potential simple vendor_boot support stderr 2021-06-08 16:54:47 -03:00
osm0sis beff4d4596 AK3: ensure dtbo does not get flashed twice in multi-partition setups 2021-06-08 16:24:20 -03:00
osm0sis 92f9828619 AK3: add vendor_ramdisk support to simple vendor_boot support
- use vendor_ramdisk and vendor_patch directories in zip root to specify changes for vendor_boot flash
2021-06-08 16:16:16 -03:00
osm0sis 83ff0c07a7 AK3: add support for simple vendor_boot dtb replacement
- boot_img_hdr_v3 now has dtb stored in a new partition called vendor_boot
- allow block=vendor_boot partition detection
- support current practice of Image* and dtb in zip root by automatically creating a multi-partition AK3 zip setup from these files (ramdisk directory is assumed to be for the boot partition)
- fix reset_ak current files cleanup
2021-06-08 01:14:03 -03:00
osm0sis 4904913295 AK3: fix unpackbootimg/unpackelf suffixes, fix elf to bootimg repack
- unpackbootimg/unpackelf kernel+ramdisk suffixes were corrected to match their corresponding mkbootimg argument in my latest forked tools (AIK-mobile v3.8)
- fix repack from unpackelf to mkbootimg broken base value introduced with AK3 rewrite
2021-05-03 00:20:08 -03:00
osm0sis 8df26b0389 AK3+Backend: cleanups, update *_line functions
- touch up a couple pesky minor things
- add global scope to replace_line and remove_line so they match replace_string, and can now work on all matches found in a file
2021-01-28 17:31:33 -04:00
osm0sis 630f926617 AK3: clean up old style tic 2021-01-20 15:02:52 -04:00
osm0sis 4731595e88 AK3: unlock blocks before flash to handle post-incremental-OTA cases 2020-11-27 18:02:22 -04:00
osm0sis c137cbf93d AK3: allow hiding block display for zips with custom output 2020-05-30 11:35:41 -03:00
osm0sis 7f82f21de9 AK3: update for latest optional binaries
- fix naming BootSignature_Android.jar -> boot_signer-dexed.jar for my own builds (see https://issuetracker.google.com/issues/143810860)
- correct unpackbootimg/unpackelf suffixes which now correspond to their matching mkbootimg argument
2020-05-24 06:36:59 -03:00