Commit Graph
295 Commits
Author SHA1 Message Date
osm0sis 0e3b7304e6 AK3: fix partition detection taking first match on older devices
- `test -e` could fail due to unexpanded *'s in $target
2019-08-06 18:53:08 -03:00
osm0sis f3f80014cc AK3+Backend: fix multi-line abort outputs 2019-08-04 01:16:54 -03:00
osm0sis 958b2c873a AK3: reset_ak: don't remove $ramdisk unless has already been unpacked
- running reset_ak before an unpack would remove any included ramdisk files from zip, so only remove if $split_img is detected suggesting an unpack has already occurred
2019-07-20 23:12:51 -03:00
osm0sis f1494f366d README: update for set_perm and set_perm_recursive 2019-07-20 21:12:49 -03:00
osm0sis 96f961b239 Example: update to use set_perm_recursive
DO NOT MERGE if you have already updated your ramdisk properly for your device
2019-07-20 21:10:37 -03:00
osm0sis 84d9032606 AK3: add file/directory attributes functions
- from my "Complete Shell Script Flashable Zip Replacement" reference thread: https://forum.xda-developers.com/android/software-hacking/dev-complete-shell-script-flashable-zip-t2934449
2019-07-20 20:50:50 -03:00
osm0sis 559a6082e8 Backend: remember we needs them busybox awks 2019-07-20 18:43:02 -03:00
osm0sis 0bd7ab9deb README: document supported.patchlevels 2019-07-20 18:36:13 -03:00
osm0sis 3b554e8bc5 anykernel: add supported.patchlevels 2019-07-20 18:23:48 -03:00
osm0sis e4a907b745 Backend: introduce Android security patch level check, cleanups
- checks the supported.patchlevels prop in anykernel.sh and matches against it to prevent users flashing incorrect kernels for patch levels
- this is possibly more important than supported.versions now since modern Android doesn't really do point releases anymore, so a patch level is more likely to signify breakage than a version change
- supported.patchlevels can be a closed or open-ended range of dates in the format YYYY-MM, e.g. "2019-04 - 2019-06", "2019-04 -" or "- 2019-06" where the last two examples show setting a minimum and maximum, respectively
- clean up device and version checks a bit while we're at it
2019-07-20 18:21:55 -03:00
Chris Renshaw bb013da815 README: add caveat about slots + modules
- this is a limitation which will need a serious restructuring of the back end and how modules are handled to be resolved properly
2019-07-15 14:00:31 -03:00
osm0sis c2d3d2513b Backend: speed up and simplify is_mounted use 2019-07-12 21:07:16 -03:00
osm0sis 823e8a6cfa README: update for optional arch detect 2019-07-12 20:18:52 -03:00
osm0sis 6872cf5977 AK3: add simple arch detect to optionally support arm + x86 in same zip
- for use with broad zips targetting many devices including different architectures
- enable support by putting current tools binary contents in tools/arm and adding tools/x86

(thanks @Zackptg5 for the nudge)
2019-07-01 17:46:34 -03:00
osm0sis d3363b7dcb tools: update magisk utils to v19.4-05658caf(19305) canary 2019-06-30 23:56:41 -03:00
wloot db390aaafe Backend: use recovery umount for /vendor
* It is a *HACK*
* Avoid "Mount /cust (Device or resource busy) failed" error on orangefox which
  mounting /cust as /vendor and also runing a non-treble ROM.
* It is a Orangefox feature that mount both /vendor and /cust while runing a
  non-treble ROM (Obviously, there is a BUG that it shouldnt mount both but /cust
  only), so both of them have a same block. In this case, normal busybox unmount
  will only un-mount what we inputted. I guess that orangefox hacked umount command
  to make /cust is binding with /vendor.

(See comments in #41)

Signed-off-by: wloot <wlootlxt123@gmail.com>
2019-06-26 17:22:15 -03:00
wloot a7af28e25b Backend: fix getting parent directory on some devices
/tmp/updater: line 33: cd: /tmp/anykernel/..: No such file or directory

Closes #41
2019-06-26 17:16:06 -03:00
osm0sis 46614b2f84 tools: update magisk utils to v19.4-1058aeb0(19302) canary 2019-06-24 12:31:49 -03:00
osm0sis 4e403f12e5 AK3: better living through sed
- clean up magiskboot compression type output parsing
2019-06-17 23:01:04 -03:00
osm0sis 3685456911 AK3: fix support for forced uncompressed cpio ramdisk repacks
- resolves https://github.com/osm0sis/AnyKernel3/commit/698682123053cab9e3277c9c9df783a97b3e8958 "IMPORTANT NOTE" 1
2019-06-15 21:27:44 -03:00
osm0sis 6b8b178c12 tools: update magiskboot to v19.4-ee407472(19301)
- resolves https://github.com/osm0sis/AnyKernel3/commit/698682123053cab9e3277c9c9df783a97b3e8958 "IMPORTANT NOTE" 2, and allows 1 to be supported (via script change in subsequent commit)
2019-06-15 21:27:10 -03:00
osm0sis a82b99ce24 README: update to emphasize final kernel build product shouldn't be renamed 2019-06-12 22:35:05 -03:00
osm0sis 9f9182ecda Example: remove more things confusing to new adopters
- remove zImage since people were still thinking they needed to rename their kernel build product to zImage to have it work, while actually all filenames are detected and supported automatically, whether it's called zImage, zImage-dtb, Image.gz, Image.gz-dtb, Image.lz4-dtb, whatever (https://github.com/osm0sis/AnyKernel3/blob/7ccf4d62cede0527b7d895a8255f18b9b56046cc/tools/ak3-core.sh#L228); in fact it's extra important it be named correctly now with AK3 using magiskboot so that any appended *-dtb is supported correctly and doesn't get appended multiple times in subsequent flashes
- remove pointless patch file examples
- add unified tuna variant name just because I feel like it since it's otherwise not a working example anymore

DO NOT MERGE if you have already updated your ramdisk/anykernel.sh properly for your device
2019-06-12 22:34:23 -03:00
Chris Renshaw 7ccf4d62ce AK3: fix signing derp
Thanks @Zackptg5

Closes #40
2019-06-12 16:52:29 -03:00
osm0sis 6d25afd03a AK3: allow ChromeOS auto-detect, clean up signing, fixes
- since magiskboot has built-in detection for the ChromeOS image pre-header signature, allow it to be auto-detected and if futility and signing files are present re-sign automatically (thanks @Zackptg5 for the nudge)
- simplify signing and error catching
- fix typo breaking ramdisk_recovery partition detection
- hide expected stderr for formats where some files may not exist (cmdline for ELF, etc.)
2019-06-10 23:12:00 -03:00
Chris Renshaw a48ce68a7c Backend: avoid tar complaining when there is no recovery.log
- clean up needless $parent stuff
- recovery.log will only be in /tmp regardless of $home
2019-06-10 00:10:35 -03:00
Chris Renshaw 16b147e939 Backend: only take relevant files for debug .tgz
- per suggestion from eng.stk avoid archiving all of $home since /tmp in recovery might hold sensitive crypto data
- restrict tar to $home (i.e. /tmp/anykernel by default) and $parent/recovery.log (i.e. /tmp/recovery.log)
- probably no need to be verbose when making the archive, it kinda clutters up the end of the captured log
2019-06-09 23:41:07 -03:00
osm0sis e4497f231e AK3: clean up "OG AK" mode stderr on images with no kernel/ramdisk present 2019-06-07 23:28:18 -03:00
osm0sis bf38d208c8 AK3: be clear when unpack_ramdisk fails because there is no ramdisk
- previously this was failing a bit too spectacularly for my liking since $comp would erroneously get set to "fopen: ramdisk.cpio failed with 2: No such file or directory"
- on devices where there is no ramdisk.cpio unless rooted with Magisk this will indicate better to developers working on the device that they should be using "OG AK" mode to avoid trying to unpack a ramdisk which may or may not exist
2019-06-07 21:35:10 -03:00
osm0sis da324c430f Backend: fix debugging .tgz creation for booted installs
- some apps copy the zip to be flashed to the app cache, which would result in the .tgz going either somewhere unknown/inaccessbile to the user or get deleted when the app cleans up after flash, so instead send to /sdcard if the device is booted to Android
2019-06-07 20:22:03 -03:00
osm0sis 76d59d67e6 AK3: also make mtd partition detection variables local 2019-06-06 16:04:43 -03:00
osm0sis ad665cc95f AK3: cleanups and fixes to config/setup functions
- simplify rdtmp and $ramdisk creation and keep only in `unpack_ramdisk`
- fix `reset_ak` and `setup_ak` behavior if run before $block is set
- only save boot.img and boot-new.img in *-files subdirectories on multi-partition setups since otherwise the tmpfs (in recovery) and ext4 .img (when booted) size usage gets quickly out of hand
- fix slot_select=inactive when used with block=auto or block=boot partition detection
2019-06-06 15:42:40 -03:00
osm0sis 725e3a0006 tools: update magisk tools to v19.3(19300) stable 2019-06-05 20:33:59 -03:00
osm0sis 192ccc94d3 AK3: support MTK /dev/bootimg and /dev/recovery partition matching
(note these probably require nanddump and nandwrite to access correctly)
2019-06-04 23:45:47 -03:00
osm0sis 97de781a55 AK3: resolve non-zero return code introduced by cat <img> /dev/zero > <block>
- the expected "cat: write error: No space left on device" gives a non-zero return code so always return true
- devices that flash dtbo abort since the return code would get passed back to the Backend and silently fail as the final command in anykernel.sh (via `write_boot`), so catch seperately with a proper error message for other image write methods
2019-06-02 19:15:47 -03:00
osm0sis 5fdf659d01 README: updates and touchups for AK3
- bring in line with XDA thread
2019-06-02 16:21:43 -03:00
osm0sis 24032c0732 AK3: allow workaround for dtbo devices with cat /dev/zero issues
- some device recoveries (e.g. TWRP for wahoo) seem to have issues with the new `cat <image> /dev/zero > <block>` method of flashing, so allow setting customdd="bs=1048576" shell variable in anykernel.sh to work around this by reverting back to dd wipe+flash for dtbo as it does with boot
2019-06-02 15:44:49 -03:00
Chris Renshaw c8d087bbad AK3: fix elftool repack cmdline handling 2019-06-01 01:30:56 -03:00
osm0sis a10312941a README: Update for AK3 2019-06-01 00:00:40 -03:00
osm0sis 8724d88159 anykernel: Update for AK3 2019-06-01 00:00:17 -03:00
osm0sis cba94d3103 tools: rename ak2-core.sh to ak3-core.sh 2019-05-31 23:59:39 -03:00
osm0sis 6986821230 Welcome to AK3: AnyKernel2 + Magisk = AnyKernel3!
- 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
2019-05-31 23:49:19 -03:00
osm0sis 6672e75f54 README: cosmetic changes to match XDA thread 2019-05-10 11:51:19 -03:00
osm0sis 1bd118035f AK2: underp opposite slot case 2019-05-10 02:35:10 -03:00
osm0sis ef2edf7e47 README: update for multi-slot zip instructions 2019-05-09 16:22:19 -03:00
osm0sis 1a143d7306 AK2: add support for multi-slot zips
- 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
2019-05-09 16:13:47 -03:00
osm0sis c3e298ecc6 AK2: add U-Boot RAMDisk uImage support 2019-05-01 11:04:13 -03:00
osm0sis a24e07f0d2 README: update for Intel OSIP mboot, customdd, touchups 2019-04-18 22:19:05 -03:00
osm0sis a38790caed AK2: add $OS$ header Android image format support
- add built-in support for mboot for Intel OSIP devices (see: https://github.com/osm0sis/mboot)
2019-04-18 21:56:30 -03:00
osm0sis d3792a4856 AK2: fix dump failures for unpackelf and dumpimage (with ramdisk) 2019-04-18 21:53:23 -03:00