Skip to content

Commit

Permalink
新增 解压vendor_boot
Browse files Browse the repository at this point in the history
  • Loading branch information
zjw2017 committed Jul 20, 2024
1 parent 4e6bcb6 commit f72bb03
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
Binary file added tools/magiskboot
Binary file not shown.
32 changes: 29 additions & 3 deletions unpack.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#!/bin/bash
# shellcheck disable=SC2034
# shellcheck disable=SC2154
# shellcheck disable=SC2164
# shellcheck disable=SC2181

# 适用于出厂安卓13的机型
unpack_partiton="system odm system_ext product vendor mi_ext system_dlkm vendor_dlkm"
# unpack_partiton="system odm system_ext product vendor mi_ext system_dlkm vendor_dlkm"
# 适用于升级到安卓13的机型
# unpack_partiton="system odm system_ext product vendor mi_ext"
# 适用于没有官方安卓13的机型
# unpack_partiton="system odm system_ext product vendor"
unpack_partiton=vendor_boot

mkdir -p "$GITHUB_WORKSPACE"/get_files

Expand Down Expand Up @@ -45,8 +49,30 @@ get_overlay() {
cp -r "$GITHUB_WORKSPACE"/"$device"/product/overlay "$GITHUB_WORKSPACE"/get_files/product
}

get_vendor_boot() {
mkdir -p "$GITHUB_WORKSPACE"/get_files/vendor_boot
cd "$GITHUB_WORKSPACE"/get_files/vendor_boot
mv -f "$GITHUB_WORKSPACE"/"$device"/vendor_boot.img "$GITHUB_WORKSPACE"/get_files/vendor_boot
cp -f "$GITHUB_WORKSPACE"/tools/magiskboot "$GITHUB_WORKSPACE"/get_files/vendor_boot
"$GITHUB_WORKSPACE"/get_files/vendor_boot/magiskboot unpack -h "$GITHUB_WORKSPACE"/get_files/vendor_boot/vendor_boot.img
comp=$("$GITHUB_WORKSPACE"/get_files/vendor_boot/magiskboot decompress ramdisk.cpio 2>&1 | grep -v 'raw' | sed -n 's;.*\[\(.*\)\];\1;p')
if [ "$comp" ]; then
mv -f ramdisk.cpio ramdisk.cpio."$comp"
"$GITHUB_WORKSPACE"/get_files/vendor_boot/magiskboot decompress ramdisk.cpio."$comp" ramdisk.cpio
if [ $? != 0 ] && $comp --help 2>/dev/null; then
$comp -dc ramdisk.cpio."$comp" >ramdisk.cpio
fi
fi
mkdir -p ramdisk
chmod 755 ramdisk
cd ramdisk
EXTRACT_UNSAFE_SYMLINKS=1 cpio -d -F ../ramdisk.cpio -i
cd "$GITHUB_WORKSPACE"
}

extract_files() {
cp "$GITHUB_WORKSPACE"/info.txt "$GITHUB_WORKSPACE"/get_files
get_prop_files
get_files_config
# get_prop_files
# get_files_config
get_vendor_boot
}

0 comments on commit f72bb03

Please sign in to comment.