Skip to content

Commit

Permalink
anykernel: sync to latest AnyKernel changes
Browse files Browse the repository at this point in the history
Also, fix banner CRLF madness
  • Loading branch information
AkiraNoSushi committed Mar 12, 2023
1 parent 4fb2878 commit 29d22c9
Show file tree
Hide file tree
Showing 10 changed files with 131 additions and 106 deletions.
27 changes: 5 additions & 22 deletions AnyKernel3/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,9 @@ busybox: GPLv2
(pre-patched source tree used to build available upon request)

lptools_static: Apache License 2.0
fec: Apache License 2.0

Copyright (C) 2020 Pierre-Hugues Husson <[email protected]>
Copyright their respective authors, (linked below).

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand All @@ -91,8 +92,9 @@ lptools_static: Apache License 2.0
See the License for the specific language governing permissions and
limitations under the License.

Source not required, however, respective source is provided:
Source not required, however, respective sources are provided:
https://github.com/phhusson/vendor_lptools
https://android.googlesource.com/platform/system/extras/+/master/verity/fec/

httools_static: MIT

Expand All @@ -119,25 +121,6 @@ httools_static: MIT
Source not required, however, respective source is provided:
https://github.com/capntrips/HashtreePatcher

fec: Apache License 2.0

Copyright (c) 2013-2015, The Android Open Source Project

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Source not required, however, respective source is provided:
https://android.googlesource.com/platform/system/extras/+/refs/tags/android-12.1.0_r5/verity/fec/


## Optional Binary Licenses:

Expand All @@ -163,7 +146,7 @@ boot_signer*.jar: Apache License 2.0
https://github.com/osm0sis/mkbootfs
https://github.com/osm0sis/mkbootimg
https://github.com/osm0sis/mkmtkhdr
https://android.googlesource.com/platform/system/extras/+/master
https://android.googlesource.com/platform/system/extras/+/master/verity/

flash_erase, nanddump, nandwrite (mtd-utils): GPLv2
dumpimage, mkimage (U-Boot): GPLv2+
Expand Down
50 changes: 29 additions & 21 deletions AnyKernel3/META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ find_slot() {
[ "$slot" ] || slot=$($BB grep -o 'androidboot.slot=.*$' /proc/cmdline | $BB cut -d\ -f1 | $BB cut -d= -f2);
[ "$slot" ] && slot=_$slot;
fi;
[ "$slot" == "normal" ] && unset slot;
[ "$slot" ] && echo "$slot";
}
setup_mountpoint() {
Expand Down Expand Up @@ -66,7 +67,7 @@ mount_apex() {
$BB unzip -qo $apex apex_payload.img -d /apex;
$BB mv -f /apex/original_apex $dest.apex 2>/dev/null;
$BB mv -f /apex/apex_payload.img $dest.img;
$BB mount -t ext4 -o ro,noatime $dest.img $dest 2>/dev/null;
$BB mount -t ext4 -o ro,noatime $dest.img $dest 2>/dev/null && echo "$dest (direct)" >&2;
if [ $? != 0 ]; then
while [ $num -lt 64 ]; do
loop=/dev/block/loop$num;
Expand All @@ -75,22 +76,24 @@ mount_apex() {
num=$((num + 1));
$BB losetup $loop | $BB grep -q $dest.img && break;
done;
$BB mount -t ext4 -o ro,loop,noatime $loop $dest;
$BB mount -t ext4 -o ro,loop,noatime $loop $dest && echo "$dest (loop)" >&2;
if [ $? != 0 ]; then
$BB losetup -d $loop 2>/dev/null;
fi;
fi;
;;
*) $BB mount -o bind $apex $dest;;
*) $BB mount -o bind $apex $dest && echo "$dest (bind)" >&2;;
esac;
done;
for var in $($BB grep -o 'export .* /.*' /system_root/init.environ.rc | $BB awk '{ print $2 }'); do
eval OLD_${var}=\$$var;
done;
$($BB grep -o 'export .* /.*' /system_root/init.environ.rc | $BB sed 's; /;=/;'); unset export;
$BB touch /apex/apexak3;
}
umount_apex() {
[ -d /apex ] || return 1;
[ -f /apex/apexak3 ] || return 1;
echo "Unmounting apex..." >&2;
local dest loop var;
for var in $($BB grep -o 'export .* /.*' /system_root/init.environ.rc 2>/dev/null | $BB awk '{ print $2 }'); do
if [ "$(eval echo \$OLD_$var)" ]; then
Expand All @@ -106,22 +109,23 @@ umount_apex() {
[ "$loop" ] && $BB losetup -d $loop;
done;
[ -f /apex/apextmp ] && $BB umount /apex;
$BB rm -rf /apex 2>/dev/null;
$BB rm -rf /apex/apexak3 /apex 2>/dev/null;
}
mount_all() {
local byname mount slot system;
echo "Mounting..." >&2;
if ! is_mounted /cache; then
$BB mount /cache 2>/dev/null && UMOUNT_CACHE=1;
$BB mount /cache 2>/dev/null && echo "/cache" >&2 && UMOUNT_CACHE=1;
fi;
if ! is_mounted /data; then
$BB mount /data && UMOUNT_DATA=1;
$BB mount /data && echo "/data" >&2 && UMOUNT_DATA=1;
fi;
(for mount in /vendor /product /system_ext /persist; do
$BB mount -o ro -t auto $mount;
done) 2>/dev/null;
for mount in /vendor /product /system_ext /persist; do
$BB mount -o ro -t auto $mount 2>/dev/null && echo "$mount (fstab)" >&2;
done;
setup_mountpoint $ANDROID_ROOT;
if ! is_mounted $ANDROID_ROOT; then
$BB mount -o ro -t auto $ANDROID_ROOT 2>/dev/null;
$BB mount -o ro -t auto $ANDROID_ROOT 2>/dev/null && echo "$ANDROID_ROOT (\$ANDROID_ROOT)" >&2;
fi;
byname=bootdevice/by-name;
[ -d /dev/block/$byname ] || byname=$($BB find /dev/block/platform -type d -name by-name 2>/dev/null | $BB head -n1 | $BB cut -d/ -f4-);
Expand All @@ -132,36 +136,38 @@ mount_all() {
/system)
if ! is_mounted /system && ! is_mounted /system_root; then
setup_mountpoint /system_root;
$BB mount -o ro -t auto /system_root;
$BB mount -o ro -t auto /system_root && echo "/system_root (fstab)" >&2;
elif [ -f /system/system/build.prop ]; then
setup_mountpoint /system_root;
$BB mount --move /system /system_root;
$BB mount --move /system /system_root && echo "/system_root (moved)" >&2;
fi;
if [ $? != 0 ]; then
($BB umount /system;
$BB umount -l /system) 2>/dev/null;
$BB mount -o ro -t auto /dev/block/$byname/system$slot /system_root;
$BB mount -o ro -t auto /dev/block/$byname/system$slot /system_root && echo "/system_root (direct)" >&2;
fi;
;;
esac;
[ -f /system_root/system/build.prop ] && system=/system;
for mount in /vendor /product /system_ext; do
if ! is_mounted $mount && [ -L /system$mount -o -L /system_root$system$mount ]; then
setup_mountpoint $mount;
$BB mount -o ro -t auto /dev/block/$byname$mount$slot $mount;
$BB mount -o ro -t auto /dev/block/$byname$mount$slot $mount && echo "$mount (direct)" >&2;
fi;
done;
if is_mounted /system_root; then
mount_apex;
$BB mount -o bind /system_root$system /system;
$BB mount -o bind /system_root$system /system && echo "/system (bind)" >&2;
fi;
if ! is_mounted /persist && [ -e /dev/block/bootdevice/by-name/persist ]; then
setup_mountpoint /persist;
$BB mount -o ro -t auto /dev/block/bootdevice/by-name/persist /persist;
$BB mount -o ro -t auto /dev/block/bootdevice/by-name/persist /persist && echo "/persist (direct)" >&2;
fi;
echo " " >&2;
}
umount_all() {
local mount;
echo "Unmounting..." >&2;
(if [ ! -d /postinstall/tmp ]; then
$BB umount /system;
$BB umount -l /system;
Expand Down Expand Up @@ -203,7 +209,7 @@ setup_env() {
if [ ! "$(getprop 2>/dev/null)" ]; then
getprop() {
local propdir propfile propval;
for propdir in / /system_root /system /vendor /product /system_ext /odm; do
for propdir in / /system_root /system /vendor /product /product/etc /system_ext/etc /odm/etc; do
for propfile in default.prop build.prop; do
if [ "$propval" ]; then
break 2;
Expand Down Expand Up @@ -232,6 +238,7 @@ restore_env() {
[ "$OLD_LD_PRE" ] && export LD_PRELOAD=$OLD_LD_PRE;
[ "$OLD_LD_CFG" ] && export LD_CONFIG_FILE=$OLD_LD_CFG;
unset OLD_LD_PATH OLD_LD_PRE OLD_LD_CFG;
$BB sleep 1;
umount_all;
[ -L /etc_link ] && $BB rm -rf /etc/*;
(for dir in /etc /apex /system_root /system /vendor /product /system_ext /persist; do
Expand Down Expand Up @@ -432,7 +439,7 @@ do_modules() {
cd $AKHOME;
}

show_progress 1.34 4;
show_progress 1.34 25;
ui_print " ";
cleanup;
mkdir -p $AKHOME/bin;
Expand Down Expand Up @@ -485,18 +492,19 @@ do_levelcheck;
ui_print "Installing...";
CORE=$($BB grep -oE 'ak.*core.sh' anykernel.sh);
[ -f tools/$CORE ] || $BB ln -s $AKHOME/tools/ak*-core.sh $AKHOME/tools/$CORE;
PATH="$AKHOME/bin:$PATH" home=$AKHOME $BB ash anykernel.sh $2;
PATH="$AKHOME/bin:$PATH" ZIPFILE="$3" home=$AKHOME $BB ash anykernel.sh $2;
if [ $? != 0 ]; then
abort;
fi;

do_modules;

debugging;
ui_print " ";
restore_env;

if [ "$(file_getprop anykernel.sh do.cleanup)" == 1 ]; then
cleanup;
fi;

ui_print " " " " "Done!";
ui_print " " "Done!";
2 changes: 1 addition & 1 deletion AnyKernel3/META-INF/com/google/android/updater-script
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
# Dummy file; update-binary is a shell script (DO NOT CHANGE)
#
#
# AK_BASE_VERSION=20220608
# AK_BASE_VERSION=20230208
7 changes: 4 additions & 3 deletions AnyKernel3/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ supported.patchlevels=2019-07 -
block=/dev/block/platform/omap/omap_hsmmc.0/by-name/boot;
is_slot_device=0;
ramdisk_compression=auto;
patch_vbmeta_flag=auto;
```

__do.devicecheck=1__ specified requires at least device.name1 to be present. This should match ro.product.device, ro.build.product, ro.product.vendor.device or ro.vendor.product.device from the build.prop files for your device. There is support for as many device.name# properties as needed. You may remove any empty ones that aren't being used.
Expand All @@ -43,7 +44,7 @@ __supported.versions=__ will match against ro.build.version.release from the cur

__supported.patchlevels=__ will match against ro.build.version.security_patch from the current ROM's build.prop. It can be set as a closed or open-ended range of dates in the format YYYY-MM, whitespace optional, e.g. `2019-04 - 2019-06`, `2019-04 -` or `- 2019-06` where the last two examples show setting a minimum and maximum, respectively.

`block=auto` instead of a direct block filepath enables detection of the device boot partition for use with broad, device non-specific zips. Also accepts specifically `boot`, `recovery` or `vendor_boot`.
`block=auto` instead of a direct block filepath enables detection of the device boot partition for use with broad, device non-specific zips. Also accepts any partition filename (from by-name), e.g. `boot`, `recovery` or `vendor_boot`.

`is_slot_device=1` enables detection of the suffix for the active boot partition on slot-based devices and will add this to the end of the supplied `block=` path. Also accepts `auto` for use with broad, device non-specific zips.

Expand Down Expand Up @@ -142,9 +143,9 @@ Optionally moving ARM builds to tools/arm and putting x86 builds in tools/x86 wi

1. Place final kernel build product, e.g. Image.gz-dtb or zImage to name a couple, in the zip root (any separate dt, dtb or recovery_dtbo, dtbo and/or vendor_dlkm should also go here for devices that require custom ones, each will fallback to the original if not included)

2. Place any required ramdisk files in /ramdisk (/vendor_ramdisk for simple multi-partition vendor_boot support) and module files in /modules (with the full path like /modules/system/lib/modules)
2. Place any required ramdisk files in /ramdisk (/vendor_ramdisk for simple multi-partition vendor_boot v3 support) and module files in /modules (with the full path like /modules/system/lib/modules)

3. Place any required patch files (generally partial files which go with AK3 file editing commands) in /patch (/vendor_patch for simple multi-partition vendor_boot support)
3. Place any required patch files (generally partial files which go with AK3 file editing commands) in /patch (/vendor_patch for simple multi-partition vendor_boot v3 support)

4. Modify the anykernel.sh to add your kernel's name, boot partition location, permissions for any added ramdisk files, and use methods for any required ramdisk modifications (optionally, also place banner and/or version files in the root to have these displayed during flash)

Expand Down
30 changes: 15 additions & 15 deletions AnyKernel3/banner
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
_
| |
___| |__ ___ _ __ _ __ _ _
/ __| '_ \ / _ \ '__| '__| | | |
| (__| | | | __/ | | | | |_| |
\___|_| |_|\___|_| |_| \__, |
__/ |
|___/
__.--~~.,-.__
`~-._.-(`-.__`-.
\ `~~`
.--./ \
/# \ \.--.
\ / /# \
'--' \ /
_
| |
___| |__ ___ _ __ _ __ _ _
/ __| '_ \ / _ \ '__| '__| | | |
| (__| | | | __/ | | | | |_| |
\___|_| |_|\___|_| |_| \__, |
__/ |
|___/
__.--~~.,-.__
`~-._.-(`-.__`-.
\ `~~`
.--./ \
/# \ \.--.
\ / /# \
'--' \ /
'--'
Loading

0 comments on commit 29d22c9

Please sign in to comment.