Commit Graph

486 Commits

Author SHA1 Message Date
残页
d868ff3080 AVD test release builds as well 2023-10-10 15:52:41 -07:00
topjohnwu
5c92d39498 Enable Zygisk by default in emulators
Make sure CI tests Zygisk
2023-09-28 20:25:26 -07:00
osm0sis
9b3896fd3d Retain PREINITDEVICE during A-only addon.d 2023-09-23 23:51:36 -07:00
残页
de00f1d5a9 Always check mounts to detect legacy SAR on bootmode 2023-08-30 01:02:19 -07:00
残页
e9b9bf987b Fix syntax error in util_functions.sh 2023-08-29 15:33:03 -07:00
topjohnwu
75d905a56d Fix device detection scripts and logic 2023-08-28 22:13:36 -07:00
topjohnwu
51afe43a30 Cleanup util_functions 2023-08-28 22:13:36 -07:00
vvb2060
d12d9e82f1 Force kernel to load rootfs only for legacy SAR devices 2023-08-18 17:18:34 -07:00
topjohnwu
f86c66c99d Officially support API 34 2023-08-11 09:46:45 -07:00
南宫雪珊
bcdcfa1104 Update scripts/avd_magisk.sh 2023-08-02 09:12:00 -07:00
vvb2060
e0a4230dac avd_magisk: hide stderr 2023-08-02 09:12:00 -07:00
topjohnwu
4d2b62da0d Do not override global variables in document 2023-07-21 12:04:42 -07:00
topjohnwu
f33343b4e6 Remove unused code and logic 2023-07-17 18:58:48 -07:00
topjohnwu
16d728f379 Partially document global variables in scripts 2023-07-17 16:07:16 -07:00
LoveSy
33a9abc946 Fix backup fails when ramdisk does not exist 2023-06-30 15:57:09 -07:00
vvb2060
ff1c56683d Skip magisk32 for 64bit only avd 2023-06-29 20:45:51 -07:00
topjohnwu
d7d0a44693 Remove randomness from Magisk 2023-06-14 17:05:49 -07:00
LoveSy
6ee6685f4c AVD test on API 34 2023-06-12 03:23:27 -07:00
topjohnwu
feb44f875e Migrate PREINITDEVICE in recovery mode
Close #6917
2023-06-02 16:49:04 -07:00
topjohnwu
6c47d8f556 Support 32 bit only AVD patch
Close #7010
2023-05-23 18:12:06 -07:00
topjohnwu
1610092ec4 Increase wait timeout 2023-05-10 16:13:45 -07:00
topjohnwu
851153dd7c Fix avd_test.sh 2023-05-09 23:11:11 -07:00
topjohnwu
8c2ad3883a Update avd_magisk.sh 2023-05-09 17:33:20 -07:00
vvb2060
3733c9a091 CI: add avd test 2023-04-25 23:00:59 -07:00
vvb2060
e9f32e4f68 Set text and background color 2023-04-25 23:00:59 -07:00
vvb2060
68c2817d40 Enable avd hack for debug build 2023-04-25 23:00:59 -07:00
osm0sis
18fe0e6442 Fix scripts
manager.sh + boot_patch.sh:
- all listed files from boot_patch.sh header are required for boot patching, but stub.apk was being removed so install_magisk via addon.d.sh would fail without it; leave it in place

addon.d.sh:
- remove old redundant recovery_actions call (it's also performed by setup_flashable in initialize)
- print ABI to match flash_script.sh output

boot_patch.sh:
- catch and abort on any errors from ramdisk.cpio patching in the future

util_functions.sh:
- fix hiding of mount_partitions /system_root umount stderr
- quote mount_apex .pb DEST name parsing charset for safety even though both work

Fixes #6828
2023-04-08 21:13:40 -07:00
topjohnwu
24ba4ab95b Better AVD support 2023-04-04 02:04:49 -07:00
vvb2060
46ce765860 Use stable random seed 2023-04-03 18:32:11 -07:00
topjohnwu
3f4f4598e8 Better AVD support 2023-03-31 17:21:12 -07:00
LoveSy
dba5020e4f Refactor magiskrc 2023-03-22 17:53:15 -07:00
LoveSy
3dd94672b0 Fix preinit scripts 2023-03-22 03:07:34 -07:00
topjohnwu
4e2b88b3d0 Rename rules to preinit
It is possible that we will allow more preinit files for modules.
Rename the partition and folders from rules to preinit.
2023-03-21 00:40:11 -07:00
LoveSy
7048aa1014 Rename sepolicy.rules -> rules 2023-03-21 00:40:11 -07:00
LoveSy
1c2fcd14b5 Mount sepolicy.rules for migration 2023-03-21 00:40:11 -07:00
vvb2060
362eea741f Refactor sepolicy.rules resolve native
Co-authored-by: LoveSy <shana@zju.edu.cn>
2023-03-21 00:40:11 -07:00
LoveSy
54ecc001f4 Clean up more codes 2023-03-19 23:20:19 -07:00
Chris Renshaw
33fb4653f0 Sanitize any bad chars from mount_apex apex_manifest.pb string parsing
For example, Lineage's com.android.ondevicepersonalization apex_manifest.pb has a # char, which strings keeps in its output, and breaks the mount for that apex before this fix
2023-03-17 02:44:36 -07:00
vvb2060
85a4b249b3 Skip copy old rule 2023-03-02 02:05:38 -08:00
LoveSy
e5641d5bdb Fix avd-magisk 2023-02-27 23:00:42 -08:00
vvb2060
2c53356bfd Remove unexpected files 2023-02-26 03:47:38 -08:00
残页
ae34659b26
No kernel repack if it isn't patched at all
It turns out that decompressing and recompressing the kernel is enough to break booting on many devices that use MT6763.
Fix #5124, fix #6204, fix #6566 

Co-authored-by: LoveSy <shana@zju.edu.cn>
Co-authored-by: 南宫雪珊 <vvb2060@gmail.com>
2023-02-17 15:00:14 -08:00
LoveSy
9e8c68af12
Refactor sepolicy.rules resolve
We resolve available partitions for sepolicy.rules when patching
boot and bind mount the partition by magiskinit.

For older devices, the previous logic won't work because the part name
is never readable.

Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2023-02-12 00:36:38 -08:00
shìwēi nguyen
03418ddcbf
run module uninstall.sh on Magisk uninstallation 2023-02-09 20:36:58 -08:00
Chris Renshaw
d740bbe058 Ignore AMLogic "normal" slot suffix in scripts as well
Fixes #6572
2023-02-03 10:44:43 -08:00
LoveSy
aa0a2f77cf Add inode plt hook APIs 2023-01-10 02:42:45 +08:00
topjohnwu
76fbf4634a Update scripts 2022-12-26 16:07:04 -08:00
vvb2060
ad0e6511e1 Stop embedding stub.apk in magiskinit 2022-12-26 16:07:04 -08:00
osm0sis
0d38c94c9c scripts: fix root loss until reboot after Magisk addon.d-v2
- /system/bin/su was being removed in error from the live system so update remove_system_su to be aware of a running A/B OTA and generalize/simplify removal logic with relative paths to correctly run on the updated system slot
2022-12-23 16:36:44 -08:00
topjohnwu
0b82fe197c Update avd_test.sh 2022-09-15 19:45:58 -07:00
topjohnwu
6bfe34e5a8 Support testing magiskinit on arm64 AVD 2022-08-19 02:40:33 -07:00
topjohnwu
d17ed2b979 Support patching AVD with release builds 2022-08-02 03:37:04 -07:00
canyie
1a964e78dd Support 32-bit emulators
This would be helpful when debugging arch-related bugs, there is no reason to prevent it.
2022-07-23 02:27:50 -07:00
残页
d155da52ce
More friendly and clear error message 2022-07-01 15:15:54 -07:00
topjohnwu
6e5df1f06b Abort when unsupported dtb is detected 2022-06-16 01:47:23 -07:00
vvb2060
87801b6f23 Fix mv file when install module 2022-06-07 02:46:16 -07:00
topjohnwu
9dc6d9afce Restore AVD after testing 2022-06-07 01:06:27 -07:00
topjohnwu
d4fe8632ec Support SELinux disabled on debug builds 2022-05-31 22:24:13 -07:00
topjohnwu
351f0269ae Install stub if necessary 2022-05-19 22:54:49 -07:00
topjohnwu
985249c3d0 Support GKIs without ramdisk
Fix #5819
2022-05-12 03:04:55 -07:00
Rei Ryuki
97135879a1
Fix sepolicy rules dir is not found in recovery 2022-05-07 02:43:26 -07:00
JumbomanXDA
e88eed9a8d Update util_functions.sh 2022-05-06 00:03:38 -07:00
LoveSy
b4c398542a Fix signboot signature 2022-05-06 00:00:20 -07:00
topjohnwu
ff340ce3d8 Suppress verbose output to stderr 2022-04-29 04:57:28 -07:00
topjohnwu
c2b74aa83e Update avd_test.sh 2022-04-16 07:28:20 -07:00
南宫雪珊
f639f39e79
More friendly info 2022-04-08 02:26:11 -07:00
vvb2060
01a1213463 /data/adb/magisk/magisk.apk no longer exists 2022-04-07 23:20:42 -07:00
topjohnwu
1257ba41c6 Add MagiskInit AVD automation test 2022-03-18 04:56:19 -07:00
topjohnwu
fa8900be65 Use standalone magiskpolicy 2022-03-17 03:15:39 -07:00
vvb2060
50b159b43d Add init_boot parition 2022-03-02 22:50:05 -08:00
LoveSy
c849759682 Use magiskboot to patch avd
Fix #5421
2022-02-11 00:25:07 -08:00
topjohnwu
21c8ad5b9e Fix up some AVD scripts 2022-01-20 01:33:59 -08:00
topjohnwu
519bd2f30f Disable AVD hacks by default 2022-01-19 20:28:01 -08:00
topjohnwu
20ef724fad Add new build command avd_patch 2022-01-19 05:12:11 -08:00
topjohnwu
21505a7470 Update scripts for PATCHVBMETAFLAG 2022-01-12 02:29:34 -08:00
vvb2060
fd7bf2bc3a Support PATCHVBMETAFLAG env variable 2022-01-12 02:29:34 -08:00
残页
de1b2b19b0 Only store sepolicy rules into partitions in ext4 format
Fix topjohnwu#5013
When installing from recovery, previous implementation may select f2fs partitions to store sepolicy rules, but magiskinit won't mount them and unable to load sepolicy rules.
2022-01-11 02:25:34 -08:00
topjohnwu
490e51c1d7 Don't set RECOVERYMODE if recovery_dtbo exists
Apparently some boot images with ramdisk still have recovery_dtbo,
so this assumption is no longer safe to do. Expect the user to
set this option properly themselves in the app.

Fix #4976, close #5070, close #5184
2022-01-11 00:17:47 -08:00
topjohnwu
f4ed6274a4 Invert vbmeta header patching config
vbmeta header should not be patched in most cases
2021-12-14 04:52:25 -08:00
topjohnwu
228570640e Introduce KEEPVBMETAFLAG env variable
Close #4447, close #4906, close #4901, close #4964
2021-11-23 22:14:12 -08:00
osm0sis
68ac409bfd Scripts fixes and improvements
- ensure all scripts use $NVBASE $MAGISKBIN $POSTFSDATAD and $SERVICED where appropriate
- simplify new grep_cmdline() using xargs and more sed
- show correct active sepolicy $RULESDIR on devices with no encryption
- add support for Android 12 .capex (compressed apex) files
2021-11-20 14:17:02 -08:00
LoveSy
4dac9e40bd Support bootconfig on util_functions.sh
Close #4869
2021-11-07 11:22:21 -08:00
Chris Renshaw
258e89c964 Fix script typo for Sony init.real support
- though may still be broken on magiskinit side, see #4885
2021-11-06 23:44:43 -07:00
topjohnwu
ae23ae2d37 Remove code in scripts that should be removed 2021-10-31 11:30:48 -07:00
osm0sis
ff3f377911 scripts: touch up print_title
- stars aren't pounds, let's just call it a title bar :P
2021-10-31 10:53:55 -07:00
osm0sis
18065826b9 scripts: improve basic module setup
- expand utility of the basic module setup (zip without customize.sh) by setting more default perms, since really it couldn't do any simple binary files additions correctly withonly 0755 0644
- ensure CON stays local
2021-10-31 10:53:55 -07:00
Chris Renshaw
6663fd3526
Support custom legacy Sony devices with init.real setup
Custom ROM bring-ups of legacy Sony devices contain the following:
/init (symlink to /bin/init_sony)
/init.real (the "real" Android init)
/bin/init_sony (this was /sbin/init_sony on Android <11)

Kernel loads the ramdisk and starts /init -> /bin/init_sony
/bin/init_sony does low-level device setup (see: https://github.com/LineageOS/android_device_sony_common/blob/lineage-18.1/init/init_main.cpp)
/bin/init_sony unlinks /init and renames /init.real to /init
/bin/init_sony starts /init

Since init_sony needs to run first magiskinit needs to replace init.real instead, so add workarounds based on detection of init.real to boot patcher and uninstaller

Thanks @115ek and @bleckdeth

Fixes #3636

Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2021-10-30 18:59:20 -07:00
topjohnwu
ca99808fd2 Update AVD support
- Support arm64 AVD images
- Support setup on Windows

 Close #4637
2021-09-07 03:03:02 -07:00
vvb2060
477ff12cde print sepolicy rules dir 2021-09-02 21:46:43 -07:00
vvb2060
773bf0c6bc Do not use glob in the system's unzip parameter
https://android.googlesource.com/platform/system/core/+/refs/tags/android-10.0.0_r47/libziparchive/unzip.cpp#57 unzip did not support glob before Android 11
2021-08-29 13:03:41 -07:00
vvb2060
350144df29 Do not allow remove the module to be updated 2021-08-29 11:35:46 -07:00
topjohnwu
4771c2810b Significantly better AVD support 2021-08-26 03:09:56 -07:00
topjohnwu
9b3efffba9 Use magiskd to setup files 2021-08-18 03:44:32 -07:00
topjohnwu
7717f0a6b0 Support Android S AVD 2021-05-13 04:45:13 -07:00
topjohnwu
5e1fba3603 Build a single APK for all ABIs 2021-05-13 00:21:04 -07:00
vvb2060
66cc9bc545 Pure 64bit support 2021-05-12 16:38:34 -07:00
vvb2060
93ba4cca68 Fix copy sepolicy rules when install module 2021-05-04 22:11:10 -07:00
jenslody
fe4981da21 Fix strings fallback in find_manager_apk
There is no preceding character (at least on some devices).
This regex should work in any cases, with and without preceding character.
2021-04-23 18:10:02 -07:00
jenslody
e4f94c4c52 Adapt find_magisk_apk for A11
Add a fallback for Android 11's new app location.
2021-04-23 18:10:02 -07:00
topjohnwu
01b985eded Remove more pre SDK 21 stuffs 2021-04-09 21:29:42 -07:00