LeOS-20
harvey186 2023-12-16 09:26:25 +01:00
parent 980f57ad6d
commit 1b99380eb6
66 changed files with 974 additions and 0 deletions

View File

@ -0,0 +1,173 @@
import /system/etc/init/hw/init.${ro.zygote}.rc
on early-fs
export LD_PRELOAD :
mkdir /mnt/runtime/full 0755 root root
mkdir /mnt/runtime/full/self 0755 root root
mkdir /apex 0777 root root
mount tmpfs tmpfs /apex mode=0755,uid=0,gid=0
restorecon /apex
export ANDROID_RUNTIME_ROOT /apex/com.android.runtime
export ANDROID_TZDATA_ROOT /apex/com.android.tzdata
symlink /system/product /product
symlink /system/system_ext /system_ext
mount none /system/phh/empty /sbin/adbd bind
mkdir /apex/com.android.mediaprovider 0777 root root
mkdir /apex/com.android.apex.cts.shim.v1_with_prebuilts 0777 root root
mkdir /apex/com.android.vndk.current 0777 root root
mkdir /apex/com.android.vndk.v28 0777 root root
mkdir /apex/com.android.sdkext 0777 root root
mkdir /apex/com.android.i18n 0777 root root
mkdir /apex/com.android.art 0777 root root
mkdir /apex/com.android.media.swcodec 0777 root root
mkdir /apex/com.android.media 0777 root root
mkdir /apex/com.android.os.statsd 0777 root root
mkdir /apex/com.android.extservices 0777 root root
mkdir /apex/com.android.runtime 0777 root root
mkdir /apex/com.android.neuralnetworks 0777 root root
mkdir /apex/com.android.cellbroadcast 0777 root root
mkdir /apex/com.android.vndk.v27 0777 root root
mkdir /apex/com.android.vndk.v26 0777 root root
mkdir /apex/com.android.adbd 0777 root root
mkdir /apex/com.android.tzdata 0777 root root
mkdir /apex/com.android.permission 0777 root root
mkdir /apex/com.android.tethering 0777 root root
mkdir /apex/com.android.resolv 0777 root root
mkdir /apex/com.android.ipsec 0777 root root
mkdir /apex/com.android.vndk.v29 0777 root root
mkdir /apex/com.android.conscrypt 0777 root root
mkdir /apex/com.android.wifi 0777 system system
mount none /system_ext/apex/com.android.mediaprovider /apex/com.android.mediaprovider bind
mount none /system_ext/apex/com.android.apex.cts.shim.v1_with_prebuilts /apex/com.android.apex.cts.shim.v1_with_prebuilts bind
mount none /system_ext/apex/com.android.vndk.current /apex/com.android.vndk.current bind
mount none /system_ext/apex/com.android.vndk.v28 /apex/com.android.vndk.v28 bind
mount none /system_ext/apex/com.android.sdkext /apex/com.android.sdkext bind
mount none /system_ext/apex/com.android.i18n /apex/com.android.i18n bind
mount none /system_ext/apex/com.android.art.debug /apex/com.android.art bind
mount none /system_ext/apex/com.android.art.release /apex/com.android.art bind
mount none /system_ext/apex/com.android.media.swcodec /apex/com.android.media.swcodec bind
mount none /system_ext/apex/com.android.media /apex/com.android.media bind
mount none /system_ext/apex/com.android.os.statsd /apex/com.android.os.statsd bind
mount none /system_ext/apex/com.android.extservices /apex/com.android.extservices bind
mount none /system_ext/apex/com.android.runtime /apex/com.android.runtime bind
mount none /system_ext/apex/com.android.neuralnetworks /apex/com.android.neuralnetworks bind
mount none /system_ext/apex/com.android.cellbroadcast /apex/com.android.cellbroadcast bind
mount none /system_ext/apex/com.android.vndk.v27 /apex/com.android.vndk.v27 bind
mount none /system_ext/apex/com.android.vndk.v26 /apex/com.android.vndk.v26 bind
mount none /system_ext/apex/com.android.adbd /apex/com.android.adbd bind
mount none /system_ext/apex/com.android.tzdata /apex/com.android.tzdata bind
mount none /system_ext/apex/com.android.permission /apex/com.android.permission bind
mount none /system_ext/apex/com.android.tethering /apex/com.android.tethering bind
mount none /system_ext/apex/com.android.resolv /apex/com.android.resolv bind
mount none /system_ext/apex/com.android.ipsec /apex/com.android.ipsec bind
mount none /system_ext/apex/com.android.vndk.v29 /apex/com.android.vndk.v29 bind
mount none /system_ext/apex/com.android.conscrypt /apex/com.android.conscrypt bind
mount none /system_ext/apex/com.android.wifi /apex/com.android.wifi bind
mkdir /apex/com.android.art.debug 0777 root root
mount none /apex/com.android.art /apex/com.android.art.debug bind
mkdir /apex/com.android.art.release 0777 root root
mount none /apex/com.android.art /apex/com.android.art.release bind
exec -- /system/bin/apexd --bootstrap
mkdir /linkerconfig 0777 root root
mount tmpfs tmpfs /linkerconfig mode=0755,uid=0,gid=0
restorecon /linkerconfig
#vndk-detect is a shell script so requires a working linker config. But linkerconfig will default to vndk v27
#So we need to 1. setup some linkerconfig (being v27 is ok on v26 just to run a shellscript), 2. autodetect vndk; 3. regenerate linkerconfig
exec -- /system/bin/linkerconfig --target /linkerconfig
exec - root -- /system/bin/vndk-detect
exec u:r:phhsu_daemon:s0 root -- /system/bin/resetprop_phh ro.vndk.version ${persist.sys.vndk}
setprop ro.vndk.version ${persist.sys.vndk}
exec -- /system/bin/linkerconfig --target /linkerconfig
setprop ro.product.manufacturer phh
setprop ro.product.model phh
setprop persist.sys.usb.config adb
mkdir /data/system_de 0770 system system
mkdir /data/system_ce 0770 system system
mkdir /data/misc_de 01771 system misc
mkdir /data/misc_ce 01771 system misc
mkdir /data/user 0711 system system
mkdir /data/user_de 0711 system system
mkdir /data/vendor 0711 system system
mkdir /data/vendor_de 0711 system system
rm /data/user/0
mkdir /data/user/0 0700 system system
mount none /data/data /data/user/0 bind rec
mkdir /data/misc/installd 0700 root root
mkdir /data/misc/credstore 0777 system system
mkdir /data/rollback 0700 system system
setprop sys.usb.config adb
setprop ro.build.fingerprint unknown/unknown/unknown:11/RP1A.200720.011/phh:userdebug/test-keys
# Create mirror directory for jit profiles
mkdir /data_mirror/cur_profiles 0700 root root
mount none /data/misc/profiles/cur /data_mirror/cur_profiles bind rec
mkdir /data_mirror 0777 root root
start adbd_apex
on post-fs-data
mkdir /data/system_de 0770 system system
mkdir /data/system_ce 0770 system system
mkdir /data/misc_de 01771 system misc
mkdir /data/misc_ce 01771 system misc
mkdir /data/user 0711 system system
mkdir /data/user_de 0711 system system
mkdir /data/vendor 0711 system system
mkdir /data/vendor_de 0711 system system
rm /data/user/0
mkdir /data/user/0 0700 system system
mount none /data/data /data/user/0 bind rec
mkdir /data/misc/installd 0700 root root
mkdir /data/misc/credstore 0777 system system
mkdir /data/misc/apexdata 0711 root root
mkdir /data/misc/apexdata/com.android.wifi 0771 system system
chown system system /data/misc/apexdata/com.android.wifi
mkdir /data/rollback 0700 system system
init_user0
service adbd_apex /apex/com.android.adbd/bin/adbd --root_seclabel=u:r:su:s0
class core
socket adbd stream 660 system system
disabled
override
seclabel u:r:adbd:s0
on post-fs-data
mkdir /data/misc/installd 0700 root root
mkdir /data/misc/credstore 0777 system system
mount tmpfs tmpfs /data_mirror nodev noexec nosuid mode=0700,uid=0,gid=1000
restorecon /data_mirror
mkdir /data_mirror/data_ce 0700 root root
mkdir /data_mirror/data_de 0700 root root
# Create CE and DE data directory for default volume
mkdir /data_mirror/data_ce/null 0700 root root
mkdir /data_mirror/data_de/null 0700 root root
# Bind mount CE and DE data directory to mirror's default volume directory
mount none /data/user /data_mirror/data_ce/null bind rec
mount none /data/user_de /data_mirror/data_de/null bind rec
on fs
exec u:r:su:s0 -- /system/bin/umount -l /product
exec u:r:su:s0 -- /system/bin/rmdir /product
symlink /system/product /product
on property:sys.usb.state=adb
restart adbd_apex
on property:sys.usb.state=mtp,adb
restart adbd_apex

BIN
sas-creator/lib64/libc++.so Executable file

Binary file not shown.

View File

@ -0,0 +1,80 @@
#!/bin/bash
#Usage:
#bash lite-adapter.sh <32|64> [/path/to/system/image]
#cleanups
umount d
set -ex
origin="$(readlink -f -- "$0")"
origin="$(dirname "$origin")"
[ ! -d vendor_vndk ] && git clone https://github.com/phhusson/vendor_vndk -b android-10.0
targetArch=64
[ "$1" == 32 ] && targetArch=32
[ -z "$ANDROID_BUILD_TOP" ] && ANDROID_BUILD_TOP=/home/ich/src/LeOS-20/
if [ "$targetArch" == 32 ];then
srcFile="$ANDROID_BUILD_TOP/out/target/product/phhgsi_a64_ab/system.img"
else
srcFile="$ANDROID_BUILD_TOP/out/target/product/phhgsi_arm64_ab/system.img"
fi
if [ -f "$2" ];then
srcFile="$2"
fi
if [ ! -f "$srcFile" ];then
echo "Usage: sudo bash lite-adapter.sh <32|64> [/path/to/system.img]"
exit 1
fi
"$origin"/simg2img "$srcFile" s.img || cp "$srcFile" s.img
rm -Rf tmp
mkdir -p d tmp
e2fsck -y -f s.img
resize2fs s.img 3500M
e2fsck -E unshare_blocks -y -f s.img
mount -o loop,rw s.img d
(
cd d
find -name \*.capex -or -name \*.apex -type f -delete
for vndk in 28 29;do
for arch in 32 64;do
d="$origin/vendor_vndk/vndk-${vndk}-arm${arch}"
[ ! -d "$d" ] && continue
p=lib
[ "$arch" = 64 ] && p=lib64
[ ! -d system/system_ext/apex/com.android.vndk.v${vndk}/${p}/ ] && continue
for lib in $(cd "$d"; echo *);do
cp "$origin/vendor_vndk/vndk-${vndk}-arm${arch}/$lib" system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
xattr -w security.selinux u:object_r:system_lib_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
echo $lib >> system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
done
sort -u system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
grep -v -e libgui.so -e libft2.so system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
done
done
mkdir -p firmware/radio
xattr -w security.selinux u:object_r:firmware_file:s0 firmware
xattr -w security.selinux u:object_r:firmware_file:s0 firmware/radio
)
sleep 1
umount d
e2fsck -f -y s.img || true
resize2fs -M s.img
bash securize.sh s.img
mv s-secure.img LeOS-20-VNDKLITE-arm64_bvN.img
sudo bash lite-adapterS.sh 64 /home/ich/src/LeOS-20/out/target/product/phhgsi_arm64_ab/system.img

View File

@ -0,0 +1,88 @@
#!/bin/bash
#Usage:
#bash lite-adapter.sh <32|64> [/path/to/system/image]
#cleanups
umount d
set -ex
origin="$(readlink -f -- "$0")"
origin="$(dirname "$origin")"
[ ! -d vendor_vndk ] && git clone https://github.com/phhusson/vendor_vndk -b android-10.0
targetArch=64
[ "$1" == 32 ] && targetArch=32
[ -z "$ANDROID_BUILD_TOP" ] && ANDROID_BUILD_TOP=/home/ich/src/LeOS19.1/
if [ "$targetArch" == 32 ];then
srcFile="$ANDROID_BUILD_TOP/out/target/product/tdgsi_a64_ab/system.img"
else
srcFile="$ANDROID_BUILD_TOP/out/target/product/tdgsi_arm64_ab/system.img"
fi
if [ -f "$2" ];then
srcFile="$2"
fi
if [ ! -f "$srcFile" ];then
echo "Usage: sudo bash lite-adapter.sh <32|64> [/path/to/system.img]"
exit 1
fi
simg2img "$srcFile" s.img || cp "$srcFile" s.img
rm -Rf tmp
mkdir -p d tmp
e2fsck -y -f s.img
resize2fs s.img 3500M
e2fsck -E unshare_blocks -y -f s.img
mount -o loop,rw s.img d
(
cd d
find -name \*.capex -or -name \*.apex -type f -delete
for vndk in 28 29;do
for arch in 32 64;do
d="$origin/vendor_vndk/vndk-${vndk}-arm${arch}"
[ ! -d "$d" ] && continue
p=lib
[ "$arch" = 64 ] && p=lib64
[ ! -d system/system_ext/apex/com.android.vndk.v${vndk}/${p}/ ] && continue
for lib in $(cd "$d"; echo *);do
cp "$origin/vendor_vndk/vndk-${vndk}-arm${arch}/$lib" system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
xattr -w security.selinux u:object_r:system_lib_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
echo $lib >> system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
done
sort -u system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
grep -v -e libgui.so -e libft2.so system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
done
done
mkdir -p firmware/radio
xattr -w security.selinux u:object_r:firmware_file:s0 firmware
xattr -w security.selinux u:object_r:firmware_file:s0 firmware/radio
)
sleep 1
#mount -o loop,rw LeOS.img d
sudo touch d/system/phh/secure
rm d/system/xbin/su
rm d/system/etc/init/su.rc
rm d/system/bin/phh-securize.sh
rm -Rf d/system/{app,priv-app}/me.phh.superuser/
sleep 1
umount d
e2fsck -f -y s.img || true
resize2fs -M s.img
mv s.img LeOS-20-VNDKLITE-arm64-bvN.img

View File

@ -0,0 +1,85 @@
#!/bin/bash
#Usage:
#bash lite-adapter.sh <32|64> [/path/to/system/image]
#cleanups
umount d
set -ex
origin="$(readlink -f -- "$0")"
origin="$(dirname "$origin")"
[ ! -d vendor_vndk ] && git clone https://github.com/phhusson/vendor_vndk -b android-10.0
targetArch=64
[ "$1" == 32 ] && targetArch=32
[ -z "$ANDROID_BUILD_TOP" ] && ANDROID_BUILD_TOP=/home/ich/src/LeOS19.1/
if [ "$targetArch" == 32 ];then
srcFile="$ANDROID_BUILD_TOP/out/target/product/tdgsi_a64_ab/system.img"
else
srcFile="$ANDROID_BUILD_TOP/out/target/product/tdgsi_arm64_ab/system.img"
fi
if [ -f "$2" ];then
srcFile="$2"
fi
if [ ! -f "$srcFile" ];then
echo "Usage: sudo bash lite-adapter.sh <32|64> [/path/to/system.img]"
exit 1
fi
simg2img "$srcFile" s.img || cp "$srcFile" s.img
rm -Rf tmp
mkdir -p d tmp
e2fsck -y -f s.img
resize2fs s.img 3500M
e2fsck -E unshare_blocks -y -f s.img
mount -o loop,rw s.img d
(
cd d
find -name \*.capex -or -name \*.apex -type f -delete
for vndk in 28 29;do
for arch in 32 64;do
d="$origin/vendor_vndk/vndk-${vndk}-arm${arch}"
[ ! -d "$d" ] && continue
p=lib
[ "$arch" = 64 ] && p=lib64
[ ! -d system/system_ext/apex/com.android.vndk.v${vndk}/${p}/ ] && continue
for lib in $(cd "$d"; echo *);do
cp "$origin/vendor_vndk/vndk-${vndk}-arm${arch}/$lib" system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
xattr -w security.selinux u:object_r:system_lib_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
echo $lib >> system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
done
sort -u system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
grep -v -e libgui.so -e libft2.so system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
done
done
mkdir -p firmware/radio
xattr -w security.selinux u:object_r:firmware_file:s0 firmware
xattr -w security.selinux u:object_r:firmware_file:s0 firmware/radio
)
sleep 1
#mount -o loop,rw LeOS.img d
sudo touch d/system/phh/secure
sleep 1
umount d
e2fsck -f -y s.img || true
resize2fs -M s.img
mv s.img LeOS-20-VNDKLITE-arm64-bvN.img

View File

@ -0,0 +1,88 @@
#!/bin/bash
#Usage:
#bash lite-adapter.sh <32|64> [/path/to/system/image]
#cleanups
umount d
set -ex
origin="$(readlink -f -- "$0")"
origin="$(dirname "$origin")"
[ ! -d vendor_vndk ] && git clone https://github.com/phhusson/vendor_vndk -b android-10.0
targetArch=64
[ "$1" == 32 ] && targetArch=32
[ -z "$ANDROID_BUILD_TOP" ] && ANDROID_BUILD_TOP=/home/ich/src/LeOS19.1/
if [ "$targetArch" == 32 ];then
srcFile="$ANDROID_BUILD_TOP/out/target/product/tdgsi_a64_ab/system.img"
else
srcFile="$ANDROID_BUILD_TOP/out/target/product/tdgsi_arm64_ab/system.img"
fi
if [ -f "$2" ];then
srcFile="$2"
fi
if [ ! -f "$srcFile" ];then
echo "Usage: sudo bash lite-adapter.sh <32|64> [/path/to/system.img]"
exit 1
fi
simg2img "$srcFile" s.img || cp "$srcFile" s.img
rm -Rf tmp
mkdir -p d tmp
e2fsck -y -f s.img
resize2fs s.img 3500M
e2fsck -E unshare_blocks -y -f s.img
mount -o loop,rw s.img d
(
cd d
find -name \*.capex -or -name \*.apex -type f -delete
for vndk in 28 29;do
for arch in 32 64;do
d="$origin/vendor_vndk/vndk-${vndk}-arm${arch}"
[ ! -d "$d" ] && continue
p=lib
[ "$arch" = 64 ] && p=lib64
[ ! -d system/system_ext/apex/com.android.vndk.v${vndk}/${p}/ ] && continue
for lib in $(cd "$d"; echo *);do
cp "$origin/vendor_vndk/vndk-${vndk}-arm${arch}/$lib" system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
xattr -w security.selinux u:object_r:system_lib_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
echo $lib >> system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
done
sort -u system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
grep -v -e libgui.so -e libft2.so system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
done
done
mkdir -p firmware/radio
xattr -w security.selinux u:object_r:firmware_file:s0 firmware
xattr -w security.selinux u:object_r:firmware_file:s0 firmware/radio
)
sleep 1
#mount -o loop,rw LeOS.img d
sudo touch d/system/phh/secure
rm d/system/xbin/su
rm d/system/etc/init/su.rc
rm d/system/bin/phh-securize.sh
rm -Rf d/system/{app,priv-app}/me.phh.superuser/
sleep 1
umount d
e2fsck -f -y s.img || true
resize2fs -M s.img
mv s.img LeOS-20-VNDKLITE-a64-bvN.img

View File

@ -0,0 +1,84 @@
#!/bin/bash
#Usage:
#bash lite-adapter.sh <32|64> [/path/to/system/image]
#cleanups
umount d
set -ex
origin="$(readlink -f -- "$0")"
origin="$(dirname "$origin")"
[ ! -d vendor_vndk ] && git clone https://github.com/phhusson/vendor_vndk -b android-10.0
targetArch=64
[ "$1" == 32 ] && targetArch=32
[ -z "$ANDROID_BUILD_TOP" ] && ANDROID_BUILD_TOP=/home/ich/src/LeOS19.1/
if [ "$targetArch" == 32 ];then
srcFile="$ANDROID_BUILD_TOP/out/target/product/tdgsi_a64_ab/system.img"
else
srcFile="$ANDROID_BUILD_TOP/out/target/product/tdgsi_arm64_ab/system.img"
fi
if [ -f "$2" ];then
srcFile="$2"
fi
if [ ! -f "$srcFile" ];then
echo "Usage: sudo bash lite-adapter.sh <32|64> [/path/to/system.img]"
exit 1
fi
simg2img "$srcFile" s.img || cp "$srcFile" s.img
rm -Rf tmp
mkdir -p d tmp
e2fsck -y -f s.img
resize2fs s.img 3500M
e2fsck -E unshare_blocks -y -f s.img
mount -o loop,rw s.img d
(
cd d
find -name \*.capex -or -name \*.apex -type f -delete
for vndk in 28 29;do
for arch in 32 64;do
d="$origin/vendor_vndk/vndk-${vndk}-arm${arch}"
[ ! -d "$d" ] && continue
p=lib
[ "$arch" = 64 ] && p=lib64
[ ! -d system/system_ext/apex/com.android.vndk.v${vndk}/${p}/ ] && continue
for lib in $(cd "$d"; echo *);do
cp "$origin/vendor_vndk/vndk-${vndk}-arm${arch}/$lib" system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
xattr -w security.selinux u:object_r:system_lib_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
echo $lib >> system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
done
sort -u system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
grep -v -e libgui.so -e libft2.so system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
done
done
mkdir -p firmware/radio
xattr -w security.selinux u:object_r:firmware_file:s0 firmware
xattr -w security.selinux u:object_r:firmware_file:s0 firmware/radio
)
sleep 1
#mount -o loop,rw LeOS.img d
sudo touch d/system/phh/secure
sleep 1
umount d
e2fsck -f -y s.img || true
resize2fs -M s.img
mv s.img LeOS-20-VNDKLITE-a64-bvN.img

View File

@ -0,0 +1,80 @@
#!/bin/bash
#Usage:
#bash lite-adapter.sh <32|64> [/path/to/system/image]
#cleanups
umount d
set -ex
origin="$(readlink -f -- "$0")"
origin="$(dirname "$origin")"
[ ! -d vendor_vndk ] && git clone https://github.com/phhusson/vendor_vndk -b android-10.0
targetArch=64
[ "$1" == 32 ] && targetArch=32
[ -z "$ANDROID_BUILD_TOP" ] && ANDROID_BUILD_TOP=/ome/ich/src/LeOS-20/
if [ "$targetArch" == 32 ];then
srcFile="$ANDROID_BUILD_TOP/out/target/product/tdgsi_a64_ab/system.img"
else
srcFile="$ANDROID_BUILD_TOP/out/target/product/tdgsi_arm64_ab/system.img"
fi
if [ -f "$2" ];then
srcFile="$2"
fi
if [ ! -f "$srcFile" ];then
echo "Usage: sudo bash lite-adapter.sh <32|64> [/path/to/system.img]"
exit 1
fi
"$origin"/simg2img "$srcFile" s.img || cp "$srcFile" s.img
rm -Rf tmp
mkdir -p d tmp
e2fsck -y -f s.img
resize2fs s.img 3500M
e2fsck -E unshare_blocks -y -f s.img
mount -o loop,rw s.img d
(
cd d
find -name \*.capex -or -name \*.apex -type f -delete
for vndk in 28 29;do
for arch in 32 64;do
d="$origin/vendor_vndk/vndk-${vndk}-arm${arch}"
[ ! -d "$d" ] && continue
p=lib
[ "$arch" = 64 ] && p=lib64
[ ! -d system/system_ext/apex/com.android.vndk.v${vndk}/${p}/ ] && continue
for lib in $(cd "$d"; echo *);do
cp "$origin/vendor_vndk/vndk-${vndk}-arm${arch}/$lib" system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
xattr -w security.selinux u:object_r:system_lib_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
echo $lib >> system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
done
sort -u system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
grep -v -e libgui.so -e libft2.so system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
done
done
mkdir -p firmware/radio
xattr -w security.selinux u:object_r:firmware_file:s0 firmware
xattr -w security.selinux u:object_r:firmware_file:s0 firmware/radio
)
sleep 1
umount d
e2fsck -f -y s.img || true
resize2fs -M s.img
mv s.img LeOS-20-VNDKLITE-arm64_bvS.img
#sudo bash lite-adapterN.sh 64 /home/ich/src/LeOS-20/out/target/product/tdgsi_arm64_ab/system.img

View File

@ -0,0 +1,78 @@
#!/bin/bash
#Usage:
#bash lite-adapter.sh <32|64> [/path/to/system/image]
#cleanups
umount d
set -ex
origin="$(readlink -f -- "$0")"
origin="$(dirname "$origin")"
[ ! -d vendor_vndk ] && git clone https://github.com/phhusson/vendor_vndk -b android-10.0
targetArch=64
[ "$1" == 32 ] && targetArch=32
[ -z "$ANDROID_BUILD_TOP" ] && ANDROID_BUILD_TOP=/ome/ich/src/LeOS-20/
if [ "$targetArch" == 32 ];then
srcFile="$ANDROID_BUILD_TOP/out/target/product/tdgsi_a64_ab/system.img"
else
srcFile="$ANDROID_BUILD_TOP/out/target/product/tdgsi_arm64_ab/system.img"
fi
if [ -f "$2" ];then
srcFile="$2"
fi
if [ ! -f "$srcFile" ];then
echo "Usage: sudo bash lite-adapter.sh <32|64> [/path/to/system.img]"
exit 1
fi
"$origin"/simg2img "$srcFile" s.img || cp "$srcFile" s.img
rm -Rf tmp
mkdir -p d tmp
e2fsck -y -f s.img
resize2fs s.img 3500M
e2fsck -E unshare_blocks -y -f s.img
mount -o loop,rw s.img d
(
cd d
find -name \*.capex -or -name \*.apex -type f -delete
for vndk in 28 29;do
for arch in 32 64;do
d="$origin/vendor_vndk/vndk-${vndk}-arm${arch}"
[ ! -d "$d" ] && continue
p=lib
[ "$arch" = 64 ] && p=lib64
[ ! -d system/system_ext/apex/com.android.vndk.v${vndk}/${p}/ ] && continue
for lib in $(cd "$d"; echo *);do
cp "$origin/vendor_vndk/vndk-${vndk}-arm${arch}/$lib" system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
xattr -w security.selinux u:object_r:system_lib_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
echo $lib >> system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
done
sort -u system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
grep -v -e libgui.so -e libft2.so system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt > v
mv -f v system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system/system_ext/apex/com.android.vndk.v${vndk}/etc/vndkprivate.libraries.${vndk}.txt
done
done
mkdir -p firmware/radio
xattr -w security.selinux u:object_r:firmware_file:s0 firmware
xattr -w security.selinux u:object_r:firmware_file:s0 firmware/radio
)
sleep 1
umount d
e2fsck -f -y s.img || true
resize2fs -M s.img
mv s.img LeOS-20-VNDKLITE-a64_bvS.img
#sudo bash lite-adapterNa64.sh 64 /home/ich/src/LeOS-20/out/target/product/tdgsi_a64_ab/system.img

217
sas-creator/run.sh Executable file
View File

@ -0,0 +1,217 @@
#!/bin/bash
#Usage:
#bash run.sh <32|64> [/path/to/system/image]
#cleanups
umount d
set -ex
origin="$(readlink -f -- "$0")"
origin="$(dirname "$origin")"
[ ! -d vendor_vndk ] && git clone https://github.com/phhusson/vendor_vndk -b android-10.0
targetArch=64
[ "$1" == 32 ] && targetArch=32
[ -z "$ANDROID_BUILD_TOP" ] && ANDROID_BUILD_TOP=/build2/AOSP-11.0/
if [ "$targetArch" == 32 ];then
srcFile="$ANDROID_BUILD_TOP/out/target/product/phhgsi_arm_ab/system.img"
else
srcFile="$ANDROID_BUILD_TOP/out/target/product/phhgsi_arm64_ab/system.img"
fi
if [ -f "$2" ];then
srcFile="$2"
fi
if [ ! -f "$srcFile" ];then
echo "Usage: sudo bash run.sh <32|64> [/path/to/system.img]"
exit 1
fi
"$origin"/simg2img "$srcFile" s.img || cp "$srcFile" s.img
rm -Rf tmp
mkdir -p d tmp
e2fsck -y -f s.img
resize2fs s.img 3500M
e2fsck -E unshare_blocks -y -f s.img
mount -o loop,rw s.img d
(
cd d
cp init.environ.rc "$origin"/tmp
find -maxdepth 1 -not -name system -not -name . -not -name .. -exec rm -Rf '{}' +
mv system/* .
rmdir system
rm -Rf system_ext/apex/com.android.vndk.v29
rm -Rf apex/*.apex
rm -Rf system_ext/apex/*.apex
sed -i \
-e '/ro.radio.noril/d' \
-e '/sys.usb.config/d' \
-e '/ro.build.fingerprint/d' \
-e '/persist.sys.theme/d' \
-e '/ro.opengles.version/d' \
-e '/ro.sf.lcd_density/d' \
-e '/sys.usb.controller/d' \
-e '/persist.dbg.volte_avail_ovr/d' \
-e '/persist.dbg.wfc_avail_ovr/d' \
-e '/persist.radio.multisim.config/d' \
-e /persist.dbg.vt_avail_ovr/d \
-e /ro.build.description/d \
-e /ro.build.display.id/d \
-e /ro.build.version.base_os/d \
-e /ro.com.android.dataroaming/d \
-e /ro.telephony.default_network/d \
-e /ro.vendor.build.fingerprint/d \
etc/selinux/plat_property_contexts
xattr -w security.selinux u:object_r:property_contexts_file:s0 etc/selinux/plat_property_contexts
cp "$origin"/files/apex-setup.rc etc/init/
xattr -w security.selinux u:object_r:system_file:s0 etc/init/apex-setup.rc
cp "$origin"/tmp/init.environ.rc etc/init/init-environ.rc
sed -i 's/on early-init/on init/g' etc/init/init-environ.rc
xattr -w security.selinux u:object_r:system_file:s0 etc/init/init-environ.rc
sed -i \
-e s/MREMAP_MAYMOVE/1/g \
etc/seccomp_policy/mediaextractor.policy \
etc/seccomp_policy/mediacodec.policy \
system_ext/apex/com.android.media/etc/seccomp_policy/mediaextractor.policy \
system_ext/apex/com.android.media.swcodec/etc/seccomp_policy/mediaswcodec.policy
sed -i '0,/^@include/s/^@include.*/getdents64: 1\n&/' etc/seccomp_policy/mediaextractor.policy \
system_ext/apex/com.android.media/etc/seccomp_policy/mediaextractor.policy
sed -i '0,/^@include/s/^@include.*/rt_sigprocmask: 1\n&/' etc/seccomp_policy/mediaextractor.policy \
system_ext/apex/com.android.media/etc/seccomp_policy/mediaextractor.policy
sed -i '0,/^@include/s/^@include.*/rt_sigprocmask: 1\nrt_sigaction: 1\n&/' etc/seccomp_policy/mediacodec.policy
xattr -w security.selinux u:object_r:system_file:s0 system_ext/apex/com.android.media/etc/seccomp_policy/mediaextractor.policy system_ext/apex/com.android.media.swcodec/etc/seccomp_policy/mediaswcodec.policy
xattr -w security.selinux u:object_r:system_seccomp_policy_file:s0 etc/seccomp_policy/mediacodec.policy etc/seccomp_policy/mediaextractor.policy etc/seccomp_policy/mediacodec.policy
#"lmkd" user and group don't exist
#"readproc" doesn't exist, use SYS_PTRACE instead
sed -i -E \
-e '/user lmkd/d' \
-e 's/group .*/group root/g' \
-e 's/capabilities (.*)/capabilities \1 SYS_PTRACE/g' \
etc/init/lmkd.rc
xattr -w security.selinux u:object_r:system_file:s0 etc/init/lmkd.rc
sed -i -E \
-e '/user/d' \
-e '/group/d' \
etc/init/credstore.rc
xattr -w security.selinux u:object_r:system_file:s0 etc/init/credstore.rc
cp system_ext/apex/com.android.media.swcodec/etc/init.rc etc/init/media-swcodec.rc
xattr -w security.selinux u:object_r:system_file:s0 etc/init/media-swcodec.rc
cp system_ext/apex/com.android.adbd/etc/init.rc etc/init/adbd.rc
xattr -w security.selinux u:object_r:system_file:s0 etc/init/adbd.rc
if [ -f system_ext/apex/com.android.adbd/lib64/libadb_protos.so ];then
cp system_ext/apex/com.android.adbd/lib64/libadb_protos.so lib64/libadb_protos.so
xattr -w security.selinux u:object_r:system_file:s0 lib64/libadb_protos.so
fi
if [ -f system_ext/apex/com.android.adbd/lib/libadb_protos.so ];then
cp system_ext/apex/com.android.adbd/lib/libadb_protos.so lib/libadb_protos.so
xattr -w security.selinux u:object_r:system_file:s0 lib/libadb_protos.so
fi
sed -i s/ro.iorapd.enable=true/ro.iorapd.enable=false/g etc/prop.default
xattr -w security.selinux u:object_r:system_file:s0 etc/prop.default
cp -R system_ext/apex/com.android.vndk.v27 system_ext/apex/com.android.vndk.v26
for i in vndkcore llndk vndkprivate vndksp;do
mv system_ext/apex/com.android.vndk.v26/etc/${i}.libraries.27.txt system_ext/apex/com.android.vndk.v26/etc/${i}.libraries.26.txt
done
find system_ext/apex/com.android.vndk.v26 -exec xattr -w security.selinux u:object_r:system_file:s0 '{}' \;
vndk=26
archs="64 32"
if [ "$targetArch" == 32 ];then
archs=32
fi
echo libstdc++.so >> system_ext/apex/com.android.vndk.v26/etc/vndksp.libraries.26.txt
for arch in $archs;do
for lib in $(cd "$origin/vendor_vndk/vndk-sp-${vndk}-arm${arch}"; echo *);do
#TODO: handle "hw"
[ ! -f "$origin/vendor_vndk/vndk-sp-${vndk}-arm${arch}"/$lib ] && continue
p=lib
[ "$arch" = 64 ] && p=lib64
cp "$origin/vendor_vndk/vndk-sp-${vndk}-arm${arch}/$lib" system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
xattr -w security.selinux u:object_r:system_lib_file:s0 system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
echo $lib >> system_ext/apex/com.android.vndk.v${vndk}/etc/vndksp.libraries.${vndk}.txt
done
sort -u system_ext/apex/com.android.vndk.v${vndk}/etc/vndksp.libraries.${vndk}.txt > v
mv -f v system_ext/apex/com.android.vndk.v${vndk}/etc/vndksp.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system_ext/apex/com.android.vndk.v${vndk}/etc/vndksp.libraries.${vndk}.txt
done
for vndk in 28 27 26;do
archs="64 32"
if [ "$targetArch" == 32 ];then
archs="32 32-binder32"
fi
for arch in $archs;do
t="$origin/vendor_vndk/vndk-${vndk}-arm${arch}"
[ -d "$t" ] && for lib in $(cd "$origin/vendor_vndk/vndk-${vndk}-arm${arch}"; echo *);do
p=lib
[ "$arch" = 64 ] && p=lib64
cp "$origin/vendor_vndk/vndk-${vndk}-arm${arch}/$lib" system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
xattr -w security.selinux u:object_r:system_lib_file:s0 system_ext/apex/com.android.vndk.v${vndk}/${p}/$lib
echo $lib >> system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
done
sort -u system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt > v
mv -f v system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
xattr -w security.selinux u:object_r:system_file:s0 system_ext/apex/com.android.vndk.v${vndk}/etc/vndkcore.libraries.${vndk}.txt
done
done
sed -i 's/v27/v26/g' system_ext/apex/com.android.vndk.v26/apex_manifest.pb
xattr -w security.selinux u:object_r:system_file:s0 system_ext/apex/com.android.vndk.v26/apex_manifest.pb
sed -E -i 's/(.*allowx adbd functionfs .*0x6782)/\1 0x67e7/g' etc/selinux/plat_sepolicy.cil
xattr -w security.selinux u:object_r:sepolicy_file:s0 etc/selinux/plat_sepolicy.cil
sed -E -i 's/\+passcred//g' etc/init/logd.rc
sed -E -i 's/\+passcred//g' etc/init/lmkd.rc
sed -E -i 's/reserved_disk//g' etc/init/vold.rc
xattr -w security.selinux u:object_r:system_file:s0 etc/init/vold.rc etc/init/logd.rc etc/init/lmkd.rc
sed -E -i /rlimit/d etc/init/bpfloader.rc etc/init/cameraserver.rc
xattr -w security.selinux u:object_r:system_file:s0 etc/init/bpfloader.rc etc/init/cameraserver.rc
sed -i -e s/readproc//g -e s/reserved_disk//g etc/init/hw/init.zygote64.rc etc/init/hw/init.zygote64_32.rc etc/init/hw/init.zygote32_64.rc etc/init/hw/init.zygote32.rc
xattr -w security.selinux u:object_r:system_file:s0 etc/init/hw/init.zygote64.rc etc/init/hw/init.zygote64_32.rc etc/init/hw/init.zygote32_64.rc etc/init/hw/init.zygote32.rc
ln -s /apex/com.android.vndk.v26/lib/ lib/vndk-sp-26
xattr -sw security.selinux u:object_r:system_lib_file:s0 lib/vndk-sp-26
ln -s /apex/com.android.vndk.v26/lib/ lib/vndk-26
xattr -sw security.selinux u:object_r:system_lib_file:s0 lib/vndk-26
if [ -d lib64 ];then
ln -s /apex/com.android.vndk.v26/lib64/ lib64/vndk-sp-26
xattr -sw security.selinux u:object_r:system_lib_file:s0 lib64/vndk-sp-26
ln -s /apex/com.android.vndk.v26/lib64/ lib64/vndk-26
xattr -sw security.selinux u:object_r:system_lib_file:s0 lib64/vndk-26
fi
)
sleep 1
umount d
e2fsck -f -y s.img || true
resize2fs -M s.img

BIN
sas-creator/simg2img Executable file

Binary file not shown.

@ -0,0 +1 @@
Subproject commit f67d0d575dd044f9cd929b198a72c86fda8454ff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.