Compare commits

...

15 Commits

Author SHA1 Message Date
ec06bb2377 add build-tools path 2025-11-28 14:20:57 -05:00
95894bc379 change required tools 2025-11-28 12:42:59 -05:00
5dad1e212b fix susfs patch 2025-11-28 12:36:34 -05:00
3b139f43d2 add susfs patch to track changes 2025-11-28 12:25:04 -05:00
760874d472 add build-tools subtree 2025-11-28 06:27:53 -05:00
113980e8db buncha changes, pin versions 2025-11-28 06:20:08 -05:00
b67c8ea14b pin susfs4ksu version 2025-11-27 22:58:20 -05:00
c69fefb15c update build.sh 2025-11-27 22:58:07 -05:00
06d8c125c9 fixes 2025-11-27 22:31:22 -05:00
e84242a31e change magisk path 2025-11-27 14:26:40 -05:00
c2a515477b change repo name again 2025-11-27 14:17:00 -05:00
e1636e761f change repo path for meta 2025-11-27 14:13:47 -05:00
ea97c4455f fix wrong linkfile arg 2025-11-27 14:12:11 -05:00
6510c8155d remove links for sukisu, must be manually created by scripts after cleaning 2025-11-27 14:11:46 -05:00
ce913a85e6 potato 2025-11-27 14:08:33 -05:00
6 changed files with 2690 additions and 188 deletions

File diff suppressed because it is too large Load Diff

6
README.md Normal file
View File

@@ -0,0 +1,6 @@
# Sources
-
- [AnyKernel3](https://github.com/osm0sis/AnyKernel3)
- [magiskboot](

View File

@@ -4,7 +4,7 @@
### AnyKernel setup ### AnyKernel setup
# global properties # global properties
properties() { ' properties() { '
kernel.string=LiteKernel for OnePlus SM8750 kernel.string=Modified LineageOS Kernel for OnePlus 13
do.devicecheck=0 do.devicecheck=0
do.modules=0 do.modules=0
do.systemless=0 do.systemless=0
@@ -41,64 +41,3 @@ else
flash_boot flash_boot
fi fi
## end boot install ## end boot install
## init_boot files attributes
#init_boot_attributes() {
#set_perm_recursive 0 0 755 644 $RAMDISK/*;
#set_perm_recursive 0 0 750 750 $RAMDISK/init* $RAMDISK/sbin;
#} # end attributes
# init_boot shell variables
#BLOCK=init_boot;
#IS_SLOT_DEVICE=1;
#RAMDISK_COMPRESSION=auto;
#PATCH_VBMETA_FLAG=auto;
# reset for init_boot patching
#reset_ak;
# init_boot install
#dump_boot; # unpack ramdisk since it is the new first stage init ramdisk where overlay.d must go
#write_boot;
## end init_boot install
## vendor_kernel_boot shell variables
#BLOCK=vendor_kernel_boot;
#IS_SLOT_DEVICE=1;
#RAMDISK_COMPRESSION=auto;
#PATCH_VBMETA_FLAG=auto;
# reset for vendor_kernel_boot patching
#reset_ak;
# vendor_kernel_boot install
#split_boot; # skip unpack/repack ramdisk, e.g. for dtb on devices with hdr v4 and vendor_kernel_boot
#flash_boot;
## end vendor_kernel_boot install
## vendor_boot files attributes
#vendor_boot_attributes() {
#set_perm_recursive 0 0 755 644 $RAMDISK/*;
#set_perm_recursive 0 0 750 750 $RAMDISK/init* $RAMDISK/sbin;
#} # end attributes
# vendor_boot shell variables
#BLOCK=vendor_boot;
#IS_SLOT_DEVICE=1;
#RAMDISK_COMPRESSION=auto;
#PATCH_VBMETA_FLAG=auto;
# reset for vendor_boot patching
#reset_ak;
# vendor_boot install
#dump_boot; # use split_boot to skip ramdisk unpack, e.g. for dtb on devices with hdr v4 but no vendor_kernel_boot
#write_boot; # use flash_boot to skip ramdisk repack, e.g. for dtb on devices with hdr v4 but no vendor_kernel_boot
## end vendor_boot install

458
build.sh
View File

@@ -1,124 +1,396 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Set $BASEDIR and use it to ensure we're in the correct directory. usage() {
BASEDIR=$(realpath "$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")/..") cat << EOF
Usage: $(basename "$0") [COMMAND]
# Ensure that .repo is present in $BASEDIR. Commands:
# This code probably won't ever fire unless you're doing something weird. build Build the kernel (default)
if [ ! -d "$BASEDIR/.repo" ]; then menuconfig Run menuconfig and save customizations
echo ".dir missing, initializing..." repack Repack stock boot image with custom kernel
pushd "$BASEDIR" > /dev/null download Download latest LineageOS boot image
repo init -u "$BASEDIR/repo" --git-lfs help Show this help message
Examples:
$(basename "$0") # Build the kernel
$(basename "$0") build # Build the kernel
$(basename "$0") menuconfig # Configure kernel interactively
$(basename "$0") repack # Repack stock_boot.img with new kernel (auto-downloads if missing)
$(basename "$0") download # Download latest LineageOS boot.img for dodge
EOF
exit 0
}
set_vars() {
# Ensure that everything is contained within the project.
# We expect that we're going to be running out of [PROJECT]/meta, so we hop up one directory.
BASEDIR=$(realpath "$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")/..")
# Add build-tools to PATH
PATH="${BASEDIR}/prebuilts/build-tools/linux-x86/bin:${PATH}"
# Build toolchain locations
CLANGDIR="${BASEDIR}/prebuilts/clang/host/linux-x86/clang-r547379"
GCCDIR="${BASEDIR}/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9"
GCCDIR32="${BASEDIR}/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9"
KERNELBUILDTOOLS="${BASEDIR}/prebuilts/kernel-build-tools/linux-x86"
# Array for all of the custom paths introduced by prebuilts
PREBUILTS_PATH=(
"${CLANGDIR}/bin"
"${GCCDIR}/bin"
"${KERNELBUILDTOOLS}/bin"
)
# Common options used for `make`, particularly for cross-compile
MAKEOPTS=(
O="${BASEDIR}/work"
ARCH=arm64
PATH="${CLANGDIR}/bin:${GCCDIR}/bin:${KERNELBUILDTOOLS}/bin:${PATH}"
LD_LIBRARY_PATH="${CLANGDIR}/lib"
LLVM=1
CROSS_COMPILE="${GCCDIR}/bin/aarch64-linux-android-"
CROSS_COMPILE_ARM32="${GCCDIR32}/bin/arm-linux-androideabi-"
CLANG_TRIPLE=aarch64-linux-gnu-
)
# Environment tools that are already somewhere in the project so we'll use them instead of adding extra dependencies
BUSYBOX="${BASEDIR}/prebuilts/magisk/lib/x86_64/libbusybox.so"
MAGISKBOOT="${BASEDIR}/prebuilts/magisk/lib/x86_64/libmagiskboot.so"
PYTHON="${BASEDIR}/prebuilts/clang/host/linux-x86/clang-r547379/python3/bin/python3"
}
check_tools() {
# Ensure that we have everything we need to work before we get started.
TOOLS_NEEDED=()
[ ! -x "$(command -v curl)" ] && TOOLS_NEEDED+=(curl)
[ ! -x "$(command -v zip)" ] && TOOLS_NEEDED+=(zip)
if [ "${#TOOLS_NEEDED[@]}" -gt 0 ]; then
echo "You are missing: ${TOOLS_NEEDED[@]}"
exit 1
fi
}
ensure_repo_initialized() {
# Sync the repo if it's not there.
# Mainly used for dev+test, repo should be handled mostly by the user.
if [ ! -d "${BASEDIR}/.repo" ]; then
echo ".repo missing, initializing..."
pushd "${BASEDIR}" > /dev/null
repo init -u "${BASEDIR}/meta" --git-lfs
repo sync repo sync
popd > /dev/null popd > /dev/null
fi fi
}
clean_kernel_source() {
# Reset the kernel source to an unmodified state.
# This is mostly necessary since we apply modifications to the source and it's kinda hard to track them.
echo "Preparing source..."
pushd "${BASEDIR}/kernel/oneplus/sm8750" > /dev/null
git reset --hard
git clean -fd
# Download latest magisk and extract it.
# TODO: Put extracted Magisk in a repo so that it can be handled by repo.
if [ ! -d "$BASEDIR/prebuilts/magisk" ]; then
echo "Magisk binaries missing, downloading..."
mkdir -p "$BASEDIR/prebuilts/magisk"
pushd "$BASEDIR/prebuilts/magisk" > /dev/null
wget "https://github.com/topjohnwu/Magisk/releases/download/v29.0/Magisk-v29.0.apk" || curl -OL "https://github.com/topjohnwu/Magisk/releases/download/v29.0/Magisk-v29.0.apk"
unzip "Magisk-v29.0.apk"
popd > /dev/null popd > /dev/null
fi }
# Set some variables for well-known directories. add_sukisu() {
GCCDIR="$BASEDIR/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9" pushd "${BASEDIR}/kernel/oneplus/sm8750" > /dev/null
GCCDIR32="$BASEDIR/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9"
CLANGDIR="$BASEDIR/prebuilts/clang/host/linux-x86/clang-r547379"
KERNELBUILDTOOLS="$BASEDIR/prebuilts/kernel-build-tools/linux-x86"
# Define common options used with make ln -sf "${BASEDIR}/external/SukiSU-Ultra" "KernelSU"
MAKEOPTS=( ln -sf "${BASEDIR}/external/SukiSU-Ultra/kernel" "drivers/kernelsu"
O="$BASEDIR/work" ${BUSYBOX} grep -q "kernelsu" "drivers/Makefile" || ${BUSYBOX} printf "\nobj-\$(CONFIG_KSU) += kernelsu/\n" >> "drivers/Makefile" && echo "[+] Modified Makefile."
ARCH=arm64 ${BUSYBOX} grep -q "source \"drivers/kernelsu/Kconfig\"" "drivers/Kconfig" || ${BUSYBOX} sed -i "/endmenu/i\source \"drivers/kernelsu/Kconfig\"" "drivers/Kconfig" && echo "[+] Modified Kconfig."
PATH="$CLANGDIR/bin:$GCCDIR/bin:$KERNELBUILDTOOLS/bin:$PATH"
LD_LIBRARY_PATH="$CLANGDIR/lib"
LLVM=1
CROSS_COMPILE="$GCCDIR/bin/aarch64-linux-android-"
CROSS_COMPILE_ARM32="$GCCDIR32/bin/arm-linux-androideabi-"
CLANG_TRIPLE=aarch64-linux-gnu-
)
echo Preparing source... popd > /dev/null
pushd "$BASEDIR/kernel/oneplus/sm8750" > /dev/null }
# Reset everything add_susfs() {
git reset --hard pushd "${BASEDIR}/kernel/oneplus/sm8750" > /dev/null
git clean -fd
ln -s "${BASEDIR}/external/SukiSU-Ultra" "KernelSU"
ln -s "${BASEDIR}/external/SukiSU-Ultra/kernel" "drivers/kernelsu"
# Add SukiSU cp "${BASEDIR}/external/susfs4ksu/kernel_patches/fs/"* "fs/" || { echo "Failed to copy fs patches"; exit 1; }
MOD=false cp "${BASEDIR}/external/susfs4ksu/kernel_patches/include/linux/"* "include/linux/" || { echo "Failed to copy linux patches"; exit 1; }
grep -q "kernelsu" "drivers/Makefile" || printf "\nobj-\$(CONFIG_KSU) += kernelsu/\n" >> "drivers/Makefile" || echo "[+] Modified Makefile." # Patch modified so that it works within a constrained environment
grep -q "source \"drivers/kernelsu/Kconfig\"" "drivers/Kconfig" || sed -i "/endmenu/i\source \"drivers/kernelsu/Kconfig\"" "drivers/Kconfig" && echo "[+] Modified Kconfig." patch -p1 < "${BASEDIR}/meta/50_add_susfs_in_gki-android15-6.6.patch" || { echo "Failed to patch kernel source for susfs"; exit 1; }
# Add SUSFS popd > /dev/null
cp "${BASEDIR}/external/susfs4ksu/kernel_patches/fs/"* "fs/" }
cp "${BASEDIR}/external/susfs4ksu/kernel_patches/include/linux/"* "include/linux/"
patch --fuzz=3 -p1 < "${BASEDIR}/external/susfs4ksu/kernel_patches/50_add_susfs_in_gki-android15-6.6.patch"
mkdir -p "$BASEDIR/out" configure_kernel() {
mkdir -p "$BASEDIR/work" pushd "${BASEDIR}/kernel/oneplus/sm8750" > /dev/null
# Ensure things are clean?
make ${MAKEOPTS[@]} mrproper # Ensure that the output directories exist
# Start with the GKI base configuration mkdir -p "${BASEDIR}/out"
make ${MAKEOPTS[@]} gki_defconfig mkdir -p "${BASEDIR}/work"
# Merge configurations that are specific to the device
scripts/kconfig/merge_config.sh -m -O "$BASEDIR/work" \ # Start by cleaning directories and starting with the GKI config
"$BASEDIR/work/.config" \ make ${MAKEOPTS[@]} mrproper
make ${MAKEOPTS[@]} gki_defconfig
# Add customizations specific to our device
scripts/kconfig/merge_config.sh -m -O "${BASEDIR}/work" \
"${BASEDIR}/work/.config" \
arch/arm64/configs/vendor/sun_perf.config \ arch/arm64/configs/vendor/sun_perf.config \
arch/arm64/configs/vendor/oplus/sun_perf.config arch/arm64/configs/vendor/oplus/sun_perf.config
if [ -e "${BASEDIR}/.config" ]; then # Add further customizations to keep in line with vanilla
echo Adding custom configuration... echo "CONFIG_DODGE_DTB=y" >> "${BASEDIR}/work/.config"
echo "CONFIG_OPLUS_DEVICE_DTBS=y" >> "${BASEDIR}/work/.config"
echo "CONFIG_COMPAT=y" >> "${BASEDIR}/work/.config"
echo "CONFIG_COMPAT_VDSO=y" >> "${BASEDIR}/work/.config"
# Add custom configurations if we're not looking for the stock configuration
if [ "${1}" != "stock" ]; then
if [ -e "${BASEDIR}/.config" ]; then
echo "Adding custom configuration..."
scripts/kconfig/merge_config.sh -m -O "${BASEDIR}/work" \ scripts/kconfig/merge_config.sh -m -O "${BASEDIR}/work" \
"${BASEDIR}/work/.config" \ "${BASEDIR}/work/.config" \
"${BASEDIR}/.config" "${BASEDIR}/.config"
fi fi
fi
# Add in things that are missing from the above config templates # Run a final olddefconfig to make sure that the config is complete for non-interactive compile.
echo "CONFIG_DODGE_DTB=y" >> "$BASEDIR/work/.config" make ${MAKEOPTS[@]} olddefconfig
echo "CONFIG_OPLUS_DEVICE_DTBS=y" >> "$BASEDIR/work/.config"
echo "CONFIG_COMPAT=y" >> "$BASEDIR/work/.config"
echo "CONFIG_COMPAT_VDSO=y" >> "$BASEDIR/work/.config"
# Re-process the configuration and accept defaults for unknowns. popd > /dev/null
make ${MAKEOPTS[@]} olddefconfig }
# Compile the kernel build_kernel() {
make ${MAKEOPTS[@]} \ pushd "${BASEDIR}/kernel/oneplus/sm8750" > /dev/null
make ${MAKEOPTS[@]} \
KCFLAGS="-Wno-error=frame-larger-than=" \ KCFLAGS="-Wno-error=frame-larger-than=" \
-j$(nproc) 2>&1 | tee "$BASEDIR/work/build.log" -j"$(${BUSYBOX} nproc)" 2>&1 | ${BUSYBOX} tee "${BASEDIR}/work/build.log"
popd > /dev/null
# Prepare AnyKernel3 with our customizations popd > /dev/null
echo "Preparing AnyKernel3 package..." }
rm -rf "${BASEDIR}/work/AnyKernel3"
mkdir -p "${BASEDIR}/work/AnyKernel3"
cp -ra "${BASEDIR}/external/AnyKernel3/"* "${BASEDIR}/work/AnyKernel3/"
cp "${BASEDIR}/repo/anykernel.sh" "${BASEDIR}/work/AnyKernel3/anykernel.sh"
cp "${BASEDIR}/prebuilts/magisk/lib/arm64-v8a/libbusybox.so" "${BASEDIR}/work/AnyKernel3/tools/busybox"
cp "${BASEDIR}/prebuilts/magisk/lib/arm64-v8a/libmagiskboot.so" "${BASEDIR}/work/AnyKernel3/tools/magiskboot"
chmod +x "${BASEDIR}/work/AnyKernel3/tools/"*
# Copy kernel Image prepare_anykernel() {
echo "Copying kernel Image..." echo "Preparing AnyKernel3 package..."
cp "${BASEDIR}/work/arch/arm64/boot/Image" "${BASEDIR}/work/AnyKernel3/"
# Create flashable zip # Start with a new empty folder
echo "Creating flashable zip..." rm -rf "${BASEDIR}/work/AnyKernel3"
KERNEL_VERSION=$(cat "${BASEDIR}/kernel/oneplus/sm8750/include/config/kernel.release" 2>/dev/null || echo "unknown") mkdir -p "${BASEDIR}/work/AnyKernel3"
OUTPUT_ZIP="${BASEDIR}/out/LiteKernel-${KERNEL_VERSION}-$(date +%Y%m%d-%H%M%S).zip" # Copy down a fresh revision of AK3 (should exclude dotfiles)
cp -ra "${BASEDIR}/external/AnyKernel3/"* "${BASEDIR}/work/AnyKernel3/"
# Add in our customized anykernel.sh
cp "${BASEDIR}/meta/anykernel.sh" "${BASEDIR}/work/AnyKernel3/anykernel.sh"
# Add in arm64 versions of tools from Magisk project
cp "${BASEDIR}/prebuilts/magisk/lib/arm64-v8a/libbusybox.so" "${BASEDIR}/work/AnyKernel3/tools/busybox"
cp "${BASEDIR}/prebuilts/magisk/lib/arm64-v8a/libmagiskboot.so" "${BASEDIR}/work/AnyKernel3/tools/magiskboot"
cp "${BASEDIR}/prebuilts/magisk/lib/arm64-v8a/libmagiskpolicy.so" "${BASEDIR}/work/AnyKernel3/tools/magiskpolicy"
# Remove unused tools
rm -f "${BASEDIR}/work/AnyKernel3/tools/fec"
rm -f "${BASEDIR}/work/AnyKernel3/tools/httools_static"
rm -f "${BASEDIR}/work/AnyKernel3/tools/lptools_static"
rm -f "${BASEDIR}/work/AnyKernel3/tools/snapshotupdater_static"
# Ensure the tools are executable
chmod +x "${BASEDIR}/work/AnyKernel3/tools/"*
pushd "${BASEDIR}/work/AnyKernel3" > /dev/null echo "Copying kernel Image..."
zip -r9 "${OUTPUT_ZIP}" * -x .git README.md .gitignore ./*.zip if [ ! -f "${BASEDIR}/work/arch/arm64/boot/Image" ]; then
popd > /dev/null echo "Error: Kernel build failed, Image not found"
exit 1
fi
cp "${BASEDIR}/work/arch/arm64/boot/Image" "${BASEDIR}/work/AnyKernel3/"
}
echo "Build complete!" create_flashable_zip() {
echo "Flashable zip: ${OUTPUT_ZIP}" echo "Creating flashable zip..."
KERNEL_VERSION=$(cat "${BASEDIR}/kernel/oneplus/sm8750/include/config/kernel.release" 2>/dev/null || echo "unknown")
OUTPUT_ZIP="${BASEDIR}/out/LiteKernel-${KERNEL_VERSION}-$(date +%Y%m%d-%H%M%S).zip"
pushd "${BASEDIR}/work/AnyKernel3" > /dev/null
zip -r9 "${OUTPUT_ZIP}" * -x .git README.md .gitignore ./*.zip
popd > /dev/null
echo "Build complete!"
echo "Flashable zip: ${OUTPUT_ZIP}"
}
run_menuconfig() {
set_vars
mkdir -p "${BASEDIR}/out"
mkdir -p "${BASEDIR}/work"
pushd "${BASEDIR}/kernel/oneplus/sm8750" > /dev/null
echo "Generating base configuration..."
configure_kernel stock
cp "$BASEDIR/work/.config" "$BASEDIR/work/.config.base"
if [ -e "${BASEDIR}/.config" ]; then
echo "Merging existing custom configuration..."
scripts/kconfig/merge_config.sh -m -O "${BASEDIR}/work" \
"${BASEDIR}/work/.config" \
"${BASEDIR}/.config"
make ${MAKEOPTS[@]} olddefconfig
fi
make ${MAKEOPTS[@]} menuconfig
extract_custom_config
popd > /dev/null
}
extract_custom_config() {
echo "Extracting custom configuration differences..."
if [ ! -f "${BASEDIR}/work/.config.base" ]; then
echo "Warning: No base config found for comparison"
return
fi
> "${BASEDIR}/.config"
declare -A base_configs
declare -A current_configs
while IFS= read -r line; do
if [[ "$line" =~ ^CONFIG_([^=]+)= ]]; then
config_name="${BASH_REMATCH[1]}"
base_configs["$config_name"]="$line"
elif [[ "$line" =~ ^#\ (CONFIG_[^\ ]+)\ is\ not\ set ]]; then
config_name="${BASH_REMATCH[1]#CONFIG_}"
base_configs["$config_name"]="$line"
fi
done < "${BASEDIR}/work/.config.base"
while IFS= read -r line; do
if [[ "$line" =~ ^CONFIG_([^=]+)= ]]; then
config_name="${BASH_REMATCH[1]}"
current_configs["$config_name"]="$line"
elif [[ "$line" =~ ^#\ (CONFIG_[^\ ]+)\ is\ not\ set ]]; then
config_name="${BASH_REMATCH[1]#CONFIG_}"
current_configs["$config_name"]="$line"
fi
done < "${BASEDIR}/work/.config"
for config_name in "${!current_configs[@]}"; do
if [[ "${base_configs[$config_name]}" != "${current_configs[$config_name]}" ]]; then
echo "${current_configs[$config_name]}" >> "${BASEDIR}/.config"
fi
done
if [ -s "${BASEDIR}/.config" ]; then
${BUSYBOX} sort -o "${BASEDIR}/.config" "${BASEDIR}/.config"
echo ""
echo "Custom configuration saved to: ${BASEDIR}/.config"
echo "Changes from base configuration:"
${BUSYBOX} cat "${BASEDIR}/.config"
echo ""
else
echo "No configuration changes from base detected."
rm -f "${BASEDIR}/.config"
fi
}
download_lineageos_boot() {
set_vars
echo "Fetching latest LineageOS build information for dodge..."
BOOT_URL=$(${BUSYBOX} wget -qO- "https://download.lineageos.org/api/v2/devices/dodge/builds" | ${PYTHON} -c 'import sys,json;d=json.load(sys.stdin);boot=[f for f in d[0]["files"] if f["filename"]=="boot.img"][0];print(boot["url"])' 2>/dev/null)
if [ -z "$BOOT_URL" ]; then
echo "Error: Failed to fetch boot.img URL from LineageOS API"
return 1
fi
echo "Found boot.img URL: $BOOT_URL"
echo "Downloading boot.img..."
${BUSYBOX} wget -O "${BASEDIR}/stock_boot.img" "$BOOT_URL" || { echo "Error: Failed to download boot.img"; return 1; }
if [ ! -f "${BASEDIR}/stock_boot.img" ]; then
echo "Error: Failed to download boot.img"
return 1
fi
echo "Boot image saved to: ${BASEDIR}/stock_boot.img"
}
repack_boot_image() {
set_vars
if [ ! -f "${BASEDIR}/stock_boot.img" ]; then
echo "stock_boot.img not found, attempting to download from LineageOS..."
download_lineageos_boot || return 1
fi
if [ ! -f "${BASEDIR}/work/arch/arm64/boot/Image" ]; then
echo "Error: Kernel Image not found at ${BASEDIR}/work/arch/arm64/boot/Image"
echo "Please build the kernel first using: $(basename "$0") build"
return 1
fi
MAGISKBOOT="${BASEDIR}/prebuilts/magisk/lib/x86_64/libmagiskboot.so"
chmod +x "${MAGISKBOOT}"
echo "Repacking boot image..."
rm -rf "${BASEDIR}/out/repack"
mkdir -p "${BASEDIR}/out/repack"
pushd "${BASEDIR}/out/repack" > /dev/null
${MAGISKBOOT} unpack "${BASEDIR}/stock_boot.img"
cp "${BASEDIR}/work/arch/arm64/boot/Image" kernel
${MAGISKBOOT} repack "${BASEDIR}/stock_boot.img" "${BASEDIR}/out/new_boot.img"
popd > /dev/null
echo ""
echo "Boot image repacked successfully!"
echo "Output: ${BASEDIR}/out/new_boot.img"
}
build() {
set -e
set_vars
ensure_repo_initialized
clean_kernel_source
add_sukisu
add_susfs
configure_kernel
build_kernel
prepare_anykernel
create_flashable_zip
}
main() {
# Start by checking if all necessary tools are installed.
check_tools
local command="${1:-build}"
case "$command" in
build)
build
;;
menuconfig)
run_menuconfig
;;
repack)
repack_boot_image
;;
download)
download_lineageos_boot
;;
help|--help|-h)
usage
;;
*)
echo "Error: Unknown command '$command'"
echo ""
usage
;;
esac
}
main "$@"

View File

@@ -1,15 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<manifest> <manifest>
<!-- Repository definitions -->
<remote name="github" fetch="https://github.com" review="review.lineageos.org" /> <remote name="github" fetch="https://github.com" review="review.lineageos.org" />
<remote name="gitlab" fetch="https://gitlab.com" /> <remote name="gitlab" fetch="https://gitlab.com" />
<!-- TEMP --> <remote name="i5" fetch="https://git.i5.wtf" />
<remote name="aosp" fetch="https://android.googlesource.com" review="android-review.googlesource.com" revision="refs/tags/android-16.0.0_r1" /> <remote name="aosp" fetch="https://android.googlesource.com" review="android-review.googlesource.com" revision="refs/tags/android-16.0.0_r1" />
<default revision="refs/heads/lineage-23.0" remote="github" sync-c="true" sync-j="4" /> <default revision="refs/heads/lineage-23.0" remote="github" sync-c="true" sync-j="4" />
<project path="prebuilts/clang/host/linux-x86/clang-r547379" name="KiTTYsh/clang-r547379" clone-depth="1" revision="main" /> <!-- This repository -->
<project path="prebuilts/kernel-build-tools" name="kernel/prebuilts/build-tools" clone-depth="1" remote="aosp" revision="main-kernel-build-2024" /> <!-- MOVE TO GITHUB BEFORE RELEASE --> <project path="meta" name="kitty/los-kernel-dodge-sukisu-susfs" remote="i5" revision="master" >
<linkfile src="build.sh" dest="build.sh" />
</project>
<!-- Build tools -->
<project path="prebuilts/build-tools/linux-x86" name="KiTTYsh/android_prebuilts_build-tools_linux-x86" clone-depth="1" revision="main" />
<project path="prebuilts/clang/host/linux-x86/clang-r547379" name="KiTTYsh/android_prebuilts_clang_host_linux-x86_clang-r547379" clone-depth="1" revision="main" />
<project path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9" name="LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9" clone-depth="1" revision="lineage-19.1" /> <project path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9" name="LineageOS/android_prebuilts_gcc_linux-x86_aarch64_aarch64-linux-android-4.9" clone-depth="1" revision="lineage-19.1" />
<project path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9" name="LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9" clone-depth="1" revision="lineage-19.1" /> <project path="prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.9" name="LineageOS/android_prebuilts_gcc_linux-x86_arm_arm-linux-androideabi-4.9" clone-depth="1" revision="lineage-19.1" />
<project path="prebuilts/kernel-build-tools" name="kernel/prebuilts/build-tools" clone-depth="1" remote="aosp" revision="main-kernel-build-2024" />
<project path="prebuilts/magisk" name="KiTTYsh/magisk-unpacked" clone-depth="1" revision="main" />
<project path="external/AnyKernel3" name="osm0sis/AnyKernel3" clone-depth="1" revision="master" />
<!-- Kernel sources -->
<project path="kernel/oneplus/sm8750" name="LineageOS/android_kernel_oneplus_sm8750" clone-depth="1" /> <project path="kernel/oneplus/sm8750" name="LineageOS/android_kernel_oneplus_sm8750" clone-depth="1" />
<project path="kernel/oneplus/sm8750-modules" name="LineageOS/android_kernel_oneplus_sm8750-modules" clone-depth="1" > <project path="kernel/oneplus/sm8750-modules" name="LineageOS/android_kernel_oneplus_sm8750-modules" clone-depth="1" >
<linkfile src="oplus/kernel/touchpanel/kernelFwUpdate" dest="kernel/oneplus/sm8750/drivers/base" /> <linkfile src="oplus/kernel/touchpanel/kernelFwUpdate" dest="kernel/oneplus/sm8750/drivers/base" />
@@ -18,10 +31,8 @@
<linkfile src="." dest="kernel/oneplus/sm8750/arch/arm64/boot/dts/vendor" /> <linkfile src="." dest="kernel/oneplus/sm8750/arch/arm64/boot/dts/vendor" />
<linkfile src="bindings" dest="kernel/oneplus/sm8750/Documentation/devicetree/bindings" /> <linkfile src="bindings" dest="kernel/oneplus/sm8750/Documentation/devicetree/bindings" />
</project> </project>
<project path="external/AnyKernel3" name="osm0sis/AnyKernel3" clone-depth="1" revision="master" />
<project path="external/SukiSU-Ultra" name="SukiSU-Ultra/SukiSU-Ultra" clone-depth="1" revision="susfs-main" > <!-- Kernel modifications -->
<linkfile src="." dest="kernel/oneplus/sm8750/KernelSU" /> <project path="external/SukiSU-Ultra" name="SukiSU-Ultra/SukiSU-Ultra" revision="c61d6fb6654dc12fa87c60c6f1eb57a4392995c2" /> <!-- v4.0.0 susfs-main -->
<linkfile src="kernel" dest="kernel/oneplus/sm8750/drivers/kernelsu" /> <project path="external/susfs4ksu" name="simonpunk/susfs4ksu" clone-depth="1" remote="gitlab" revision="c49b1dab205bbc4ef20b120e84c5b7530355961d" /> <!-- v1.5.12 gki-android15-6.6 -->
</project>
<project path="external/susfs4ksu" name="simonpunk/susfs4ksu" clone-depth="1" remote="gitlab" revision="gki-android15-6.6" />
</manifest> </manifest>

View File

@@ -1,14 +0,0 @@
#!/usr/bin/env bash
BASEDIR=$(realpath "$(dirname -- "$(realpath -- "${BASH_SOURCE[0]}")")/..")
MAGISKBOOT="${BASEDIR}/prebuilts/magisk/lib/x86_64/libmagiskboot.so"
chmod +x "${MAGISKBOOT}"
rm -rf "${BASEDIR}/out/repack"
mkdir -p "${BASEDIR}/out/repack"
pushd "${BASEDIR}/out/repack" > /dev/null
${MAGISKBOOT} unpack "${BASEDIR}/stock_boot.img"
cp "${BASEDIR}/out/arch/arm64/boot/Image" kernel
${MAGISKBOOT} repack "${BASEDIR}/stock_boot.img" "${BASEDIR}/new_boot.img"
popd > /dev/null