Skip to content

Commit

Permalink
a52sxq/m52xq: move to new Magisk module-like structure
Browse files Browse the repository at this point in the history
Change-Id: Ia2130a94438adf9438c1a06fa34d7091a039577d
  • Loading branch information
salvogiangri committed Dec 5, 2023
1 parent 42ef28b commit b4d3884
Show file tree
Hide file tree
Showing 154 changed files with 133 additions and 368 deletions.
4 changes: 2 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ unica/flashable-zip/updater binary
unica/packages/fod/** binary
unica/packages/knox/** binary
unica/packages/vndk/30/** binary
target/a52sxq/patches/wpss/firmware/** binary
target/m52xq/patches/wpss/firmware/** binary
target/a52sxq/patches/wpss/vendor/firmware/** binary
target/m52xq/patches/wpss/vendor/firmware/** binary
*.apk binary
*.apex binary
*.so binary
Expand Down
2 changes: 2 additions & 0 deletions scripts/internal/apply_modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ APPLY_MODULE()
exit 1
fi

[[ "$MODPATH" == *"$TARGET_CODENAME/patches/props"* ]] && return 0

if [ ! -f "$MODPATH/module.prop" ]; then
echo "File not found: $MODPATH/module.prop"
exit 1
Expand Down
2 changes: 1 addition & 1 deletion scripts/make_rom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ if $BUILD_ROM; then
echo -e "\n- Applying ROM patches..."
bash "$SRC_DIR/scripts/internal/apply_modules.sh" "$SRC_DIR/unica/patches"
[[ -d "$SRC_DIR/target/$TARGET_CODENAME/patches" ]] \
&& find "$SRC_DIR/target/$TARGET_CODENAME/patches" -maxdepth 1 -executable -type f -exec bash {} \;
&& bash "$SRC_DIR/scripts/internal/apply_modules.sh" "$SRC_DIR/target/$TARGET_CODENAME/patches"

echo -e "\n- Recompiling APKs/JARs..."
while read -r i; do
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
#====================================================
# FILE: adb.sh
# AUTHOR: BlackMesa123, AgentFabulous
# DESCRIPTION: Enabled ADB at boot
#====================================================

set -e

# [
SRC_DIR="$(git rev-parse --show-toplevel)"
OUT_DIR="$SRC_DIR/out"
WORK_DIR="$OUT_DIR/work_dir"
# ]

echo "Enabling ADB at boot"
SKIPUNZIP=1

sed -i \
"$(sed -n "/persist.sys.usb.config/=" "$WORK_DIR/vendor/default.prop") cpersist.sys.usb.config=mtp,adb" \
Expand All @@ -25,5 +11,3 @@ if ! grep -q "persist.vendor.radio.port_index" "$WORK_DIR/vendor/etc/init/hw/ini
echo " setprop sys.usb.config adb"
} >> "$WORK_DIR/vendor/etc/init/hw/init.target.rc"
fi

exit 0
4 changes: 4 additions & 0 deletions target/a52sxq/patches/adb/module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id=adb
name=Debug USB
author=BlackMesa123, AgentFabulous
description=Enables ADB on boot.
37 changes: 0 additions & 37 deletions target/a52sxq/patches/assistant.sh

This file was deleted.

6 changes: 6 additions & 0 deletions target/a52sxq/patches/assistant/customize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rm -rf "$WORK_DIR/product/priv-app/HotwordEnrollmentOKGoogleEx4HEXAGON"
rm -rf "$WORK_DIR/product/priv-app/HotwordEnrollmentXGoogleEx4HEXAGON"
sed -i "s/HotwordEnrollmentXGoogleEx4HEXAGON/HotwordEnrollmentXGoogleEx3HEXAGON/g" "$WORK_DIR/configs/file_context-product"
sed -i "s/HotwordEnrollmentXGoogleEx4HEXAGON/HotwordEnrollmentXGoogleEx3HEXAGON/g" "$WORK_DIR/configs/fs_config-product"
sed -i "s/HotwordEnrollmentOKGoogleEx4HEXAGON/HotwordEnrollmentOKGoogleEx3HEXAGON/g" "$WORK_DIR/configs/file_context-product"
sed -i "s/HotwordEnrollmentOKGoogleEx4HEXAGON/HotwordEnrollmentOKGoogleEx3HEXAGON/g" "$WORK_DIR/configs/fs_config-product"
4 changes: 4 additions & 0 deletions target/a52sxq/patches/assistant/module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id=assistant
name=Google Assistant fix
author=BlackMesa123
description=
28 changes: 0 additions & 28 deletions target/a52sxq/patches/camera.sh

This file was deleted.

11 changes: 11 additions & 0 deletions target/a52sxq/patches/camera/customize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
SKIPUNZIP=1

HAL_LIBS="
$WORK_DIR/vendor/lib/hw/camera.qcom.so
$WORK_DIR/vendor/lib/hw/com.qti.chi.override.so
$WORK_DIR/vendor/lib64/hw/camera.qcom.so
$WORK_DIR/vendor/lib64/hw/com.qti.chi.override.so
"
for f in $HAL_LIBS; do
sed -i "s/ro.boot.flash.locked/ro.camera.notify_nfc/g" "$f"
done
4 changes: 4 additions & 0 deletions target/a52sxq/patches/camera/module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id=camera
name=Camera lock fix
author=DavidArsene
description=Fixes camera lock for devices with a rear SLSI sensor.
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
#====================================================
# FILE: crypto.sh
# AUTHOR: BlackMesa123
# DESCRIPTION: Remove FBE flags in device fstab
#====================================================
SKIPUNZIP=1

set -e

# [
SRC_DIR="$(git rev-parse --show-toplevel)"
OUT_DIR="$SRC_DIR/out"
WORK_DIR="$OUT_DIR/work_dir"
# ]

echo "Disable FBE"
LINE=$(sed -n "/^\/dev\/block\/bootdevice\/by-name\/userdata/=" "$WORK_DIR/vendor/etc/fstab.qcom")
sed -i -e "${LINE}s/,fileencryption=aes-256-xts:aes-256-cts:v2+inlinecrypt_optimized//g" \
-e "${LINE}s/,keydirectory=\/metadata\/vold\/metadata_encryption//g" \
-e "${LINE}s/,inlinecrypt//g" \
-e "${LINE}s/,wrappedkey//g" \
-e "${LINE}s/,,/,/g" "$WORK_DIR/vendor/etc/fstab.qcom"

exit 0
4 changes: 4 additions & 0 deletions target/a52sxq/patches/crypto/module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id=crypto
name=FBE disabler
author=BlackMesa123
description=Removes FBE flags in device fstab.
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
#====================================================
# FILE: miscs.sh
# AUTHOR: BlackMesa123
# DESCRIPTION: Misc patches
#====================================================

set -e

# [
SRC_DIR="$(git rev-parse --show-toplevel)"
OUT_DIR="$SRC_DIR/out"
FW_DIR="$OUT_DIR/fw"
WORK_DIR="$OUT_DIR/work_dir"

source "$OUT_DIR/config.sh"
# ]
SKIPUNZIP=1

MODEL=$(echo -n "$TARGET_FIRMWARE" | cut -d "/" -f 1)
REGION=$(echo -n "$TARGET_FIRMWARE" | cut -d "/" -f 2)
Expand All @@ -30,5 +15,3 @@ sed -i "/# Removed by /d" "$WORK_DIR/product/etc/build.prop" \
&& sed -i "s/#bluetooth./bluetooth./g" "$WORK_DIR/product/etc/build.prop" \
&& sed -i "s/?=/=/g" "$WORK_DIR/product/etc/build.prop" \
&& sed -i "$(sed -n "/provisioning.hostname/=" "$WORK_DIR/product/etc/build.prop" | sed "2p;d")d" "$WORK_DIR/product/etc/build.prop"

exit 0
4 changes: 4 additions & 0 deletions target/a52sxq/patches/miscs/module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id=miscs
name=Misc patches
author=BlackMesa123
description=
4 changes: 4 additions & 0 deletions target/a52sxq/patches/spf/module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id=spf
name=SEC Product Feature
author=BlackMesa123
description=
Original file line number Diff line number Diff line change
@@ -1,24 +1,3 @@
#====================================================
# FILE: wpss.sh
# AUTHOR: Simon1511
# DESCRIPTION: Add support for all the bootloader
# revisions
#====================================================

set -e

# [
SRC_DIR="$(git rev-parse --show-toplevel)"
OUT_DIR="$SRC_DIR/out"
WORK_DIR="$OUT_DIR/work_dir"
# ]

echo "Add custom wpss firmware mount"

[[ -f "$WORK_DIR/vendor/etc/init/wifi_firmware.rc" ]] && exit 0

rm -f "$WORK_DIR/vendor/firmware/wpss."*
cp -a --preserve=all "$SRC_DIR/target/a52sxq/patches/wpss/"* "$WORK_DIR/vendor"
{
echo "/vendor/etc/init/wifi_firmware\.rc u:object_r:vendor_configs_file:s0"
echo "/vendor/firmware/wpss\.b00 u:object_r:vendor_firmware_file:s0"
Expand Down Expand Up @@ -112,5 +91,3 @@ cp -a --preserve=all "$SRC_DIR/target/a52sxq/patches/wpss/"* "$WORK_DIR/vendor"
echo "vendor/firmware/wlan/a528n/rev2/wpss.mdt 0 0 644 capabilities=0x0"
} >> "$WORK_DIR/configs/fs_config-vendor"
echo "(allow init_30_0 vendor_firmware_file (file (mounton)))" >> "$WORK_DIR/vendor/etc/selinux/vendor_sepolicy.cil"

exit 0
4 changes: 4 additions & 0 deletions target/a52sxq/patches/wpss/module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id=wpss
name=WPSS blobs
author=Simon1511
description=Adds support for all the bootloader revisions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
#====================================================
# FILE: adb.sh
# AUTHOR: BlackMesa123, AgentFabulous
# DESCRIPTION: Enabled ADB at boot
#====================================================

set -e

# [
SRC_DIR="$(git rev-parse --show-toplevel)"
OUT_DIR="$SRC_DIR/out"
WORK_DIR="$OUT_DIR/work_dir"
# ]

echo "Enabling ADB at boot"
SKIPUNZIP=1

sed -i \
"$(sed -n "/persist.sys.usb.config/=" "$WORK_DIR/vendor/default.prop") cpersist.sys.usb.config=mtp,adb" \
Expand All @@ -25,5 +11,3 @@ if ! grep -q "persist.vendor.radio.port_index" "$WORK_DIR/vendor/etc/init/hw/ini
echo " setprop sys.usb.config adb"
} >> "$WORK_DIR/vendor/etc/init/hw/init.target.rc"
fi

exit 0
4 changes: 4 additions & 0 deletions target/m52xq/patches/adb/module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id=adb
name=Debug USB
author=BlackMesa123, AgentFabulous
description=Enables ADB on boot.
37 changes: 0 additions & 37 deletions target/m52xq/patches/assistant.sh

This file was deleted.

6 changes: 6 additions & 0 deletions target/m52xq/patches/assistant/customize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rm -rf "$WORK_DIR/product/priv-app/HotwordEnrollmentOKGoogleEx4HEXAGON"
rm -rf "$WORK_DIR/product/priv-app/HotwordEnrollmentXGoogleEx4HEXAGON"
sed -i "s/HotwordEnrollmentXGoogleEx4HEXAGON/HotwordEnrollmentXGoogleEx3HEXAGON/g" "$WORK_DIR/configs/file_context-product"
sed -i "s/HotwordEnrollmentXGoogleEx4HEXAGON/HotwordEnrollmentXGoogleEx3HEXAGON/g" "$WORK_DIR/configs/fs_config-product"
sed -i "s/HotwordEnrollmentOKGoogleEx4HEXAGON/HotwordEnrollmentOKGoogleEx3HEXAGON/g" "$WORK_DIR/configs/file_context-product"
sed -i "s/HotwordEnrollmentOKGoogleEx4HEXAGON/HotwordEnrollmentOKGoogleEx3HEXAGON/g" "$WORK_DIR/configs/fs_config-product"
4 changes: 4 additions & 0 deletions target/m52xq/patches/assistant/module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id=assistant
name=Google Assistant fix
author=BlackMesa123
description=
27 changes: 0 additions & 27 deletions target/m52xq/patches/camera.sh

This file was deleted.

4 changes: 4 additions & 0 deletions target/m52xq/patches/camera/customize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if ! grep -q "Camera End" "$WORK_DIR/vendor/ueventd.rc"; then
echo "" >> "$WORK_DIR/vendor/ueventd.rc"
cat "$SRC_DIR/target/m52xq/patches/camera/ueventd" >> "$WORK_DIR/vendor/ueventd.rc"
fi
4 changes: 4 additions & 0 deletions target/m52xq/patches/camera/module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
id=camera
name=Camera fix
author=BlackMesa123
description=Various camera-related patches.
Loading

0 comments on commit b4d3884

Please sign in to comment.