build: Merge 2 build scripts in to 1
Made it possible by setting a variable FIREASF_VANILLA=true/false, its set automaticly when selecting a build option
This commit is contained in:
parent
ba2a228c25
commit
2ee255693e
3 changed files with 56 additions and 205 deletions
6
build.sh
6
build.sh
|
@ -2,13 +2,15 @@
|
|||
|
||||
command_one() {
|
||||
echo "Building without KernelSU Next..."
|
||||
./kernel_build/build.sh "$(pwd)" || exit 1
|
||||
export FIREASF_VANILLA=true
|
||||
./kernel_build/build-fireasf.sh "$(pwd)" || exit 1
|
||||
exit 0
|
||||
}
|
||||
|
||||
command_two() {
|
||||
echo "Building with KernelSU Next..."
|
||||
./kernel_build/build-ksu.sh "$(pwd)" || exit 1
|
||||
export FIREASF_VANILLA=false
|
||||
./kernel_build/build-fireasf.sh "$(pwd)" || exit 1
|
||||
exit 0
|
||||
}
|
||||
|
||||
|
|
|
@ -38,15 +38,24 @@ MONTH=$(date +%m)
|
|||
YEAR=$(date +%Y)
|
||||
HOUR=$(date +%H.%M) # Current hour in 24-hour format
|
||||
|
||||
OUT_KERNELZIP="$(pwd)/kernel_build/FireAsf/$DAY_MONTH.$MONTH.$YEAR/FireAsf-${FIRE_VERSION}-KSU-Testing233-${HOUR}.zip"
|
||||
OUT_KERNELTAR="$(pwd)/kernel_build/FireAsf/$DAY_MONTH.$MONTH.$YEAR/FireAsf-${FIRE_VERSION}-KSU-Testing233-${HOUR}.tar"
|
||||
if [ "FIREASF_VANILLA" = "true" ]; then
|
||||
OUT_VANILLA_KERNELZIP="$(pwd)/kernel_build/FireAsf/$DAY_MONTH.$MONTH.$YEAR/FireAsf-${FIRE_VERSION}-Vanilla-Testing233-${HOUR}.zip"
|
||||
OUT_VANILLA_KERNELTAR="$(pwd)/kernel_build/FireAsf/$DAY_MONTH.$MONTH.$YEAR/FireAsf-${FIRE_VERSION}-Vanilla-Testing233-${HOUR}.tar"
|
||||
else
|
||||
OUT_KSUNEXT_KERNELZIP="$(pwd)/kernel_build/FireAsf/$DAY_MONTH.$MONTH.$YEAR/FireAsf-${FIRE_VERSION}-KernelSU-Next-Testing233-${HOUR}.zip"
|
||||
OUT_KSUNEXT_KERNELTAR="$(pwd)/kernel_build/FireAsf/$DAY_MONTH.$MONTH.$YEAR/FireAsf-${FIRE_VERSION}-KernelSU-Next-Testing233-${HOUR}.tar"
|
||||
fi
|
||||
OUT_KERNEL="$OUTDIR/arch/arm64/boot/Image"
|
||||
OUT_BOOTIMG="$(pwd)/kernel_build/zip/boot.img"
|
||||
OUT_VENDORBOOTIMG="$(pwd)/kernel_build/zip/vendor_boot.img"
|
||||
OUT_DTBIMAGE="$TMPDIR/dtb.img"
|
||||
|
||||
# Kernel-side
|
||||
BUILD_ARGS="LOCALVERSION=-FireAsf-${FIRE_VERSION}-KSU-TestingFr KBUILD_BUILD_USER=Ksawlii KBUILD_BUILD_HOST=FireAsFuck"
|
||||
if [ "FIREASF_VANILLA" = "true" ]; then
|
||||
VANILLA_ARGS="LOCALVERSION=-FireAsf-${FIRE_VERSION}-Vanilla-TestingFr KBUILD_BUILD_USER=Ksawlii KBUILD_BUILD_HOST=FireAsFuck"
|
||||
else
|
||||
KSUNEXT_ARGS="LOCALVERSION=-FireAsf-${FIRE_VERSION}-KernelSU-Next-TestingFr KBUILD_BUILD_USER=Ksawlii KBUILD_BUILD_HOST=FireAsFuck"
|
||||
fi
|
||||
|
||||
kfinish() {
|
||||
rm -rf "$TMPDIR"
|
||||
|
@ -79,9 +88,16 @@ fi
|
|||
echo ""
|
||||
echo -e "Check in btop, htop, top (whatever you use) if its building.
|
||||
If you have some errors when trying to rebuild, delete $OUTDIR"
|
||||
make -j$(nproc --all) -C $(pwd) O=out $BUILD_ARGS a53x-ksu_defconfig >/dev/null
|
||||
make -j$(nproc --all) -C $(pwd) O=out $BUILD_ARGS dtbs >/dev/null
|
||||
make -j$(nproc --all) -C $(pwd) O=out $BUILD_ARGS >/dev/null
|
||||
|
||||
if [ "FIREASF_VANILLA" = "true" ]; then
|
||||
make -j$(nproc --all) -C $(pwd) O=out $VANILLA_VANILLA_ARGS a53x_defconfig >/dev/null
|
||||
make -j$(nproc --all) -C $(pwd) O=out $VANILLA_ARGS dtbs >/dev/null
|
||||
make -j$(nproc --all) -C $(pwd) O=out $VANILLA_ARGS >/dev/null
|
||||
else
|
||||
make -j$(nproc --all) -C $(pwd) O=out $KSUNEXT_ARGS a53x-ksu_defconfig >/dev/null
|
||||
make -j$(nproc --all) -C $(pwd) O=out $KSUNEXT_ARGS dtbs >/dev/null
|
||||
make -j$(nproc --all) -C $(pwd) O=out $KSUNEXT_ARGS >/dev/null
|
||||
fi
|
||||
make -j$(nproc --all) -C $(pwd) O=out INSTALL_MOD_STRIP="--strip-debug --keep-section=.ARM.attributes" INSTALL_MOD_PATH="$MODULES_OUTDIR" modules_install >/dev/null
|
||||
|
||||
rm -rf "$TMPDIR"
|
||||
|
@ -168,23 +184,47 @@ cd "$DIR"
|
|||
echo "Building a flashable zip file (Recovery)..."
|
||||
mkdir -p "$(pwd)/kernel_build/FireAsf/$DAY_MONTH.$MONTH.$YEAR"
|
||||
cd "$(pwd)/kernel_build/zip"
|
||||
rm -f "$OUT_KERNELZIP"
|
||||
if [ "FIREASF_VANILLA" = "true" ]; then
|
||||
rm -f "$OUT_VANILLA_KERNELZIP"
|
||||
else
|
||||
rm -f "$OUT_KSUNEXT_KERNELZIP"
|
||||
fi
|
||||
brotli --quality=11 -c boot.img > boot.br
|
||||
brotli --quality=11 -c vendor_boot.img > vendor_boot.br
|
||||
zip -r9 -q "$OUT_KERNELZIP" META-INF boot.br vendor_boot.br
|
||||
if [ "FIREASF_VANILLA" = "true" ]; then
|
||||
zip -r9 -q "$OUT_VANILLA_KERNELZIP" META-INF boot.br vendor_boot.br
|
||||
else
|
||||
zip -r9 -q "$OUT_KSUNEXT_KERNELZIP" META-INF boot.br vendor_boot.br
|
||||
fi
|
||||
rm -f boot.br vendor_boot.br
|
||||
cd "$DIR"
|
||||
echo "Done! Output: $OUT_KERNELZIP"
|
||||
if [ "FIREASF_VANILLA" = "true" ]; then
|
||||
echo "Done! Output: $OUT_VANILLA_KERNELZIP"
|
||||
else
|
||||
echo "Done! Output: $OUT_KSUNEXT_KERNELZIP"
|
||||
fi
|
||||
|
||||
echo "Building a flashable tar file (Download Mode)..."
|
||||
cd "$(pwd)/kernel_build"
|
||||
rm -f "$OUT_KERNELTAR"
|
||||
if [ "FIREASF_VANILLA" = "true" ]; then
|
||||
rm -f "$OUT_VANILLA_KERNELTAR"
|
||||
else
|
||||
rm -f "$OUT_KSUNEXT_KERNELTAR"
|
||||
fi
|
||||
lz4 -c -12 -B6 --content-size "$OUT_BOOTIMG" > boot.img.lz4
|
||||
lz4 -c -12 -B6 --content-size "$OUT_VENDORBOOTIMG" > vendor_boot.img.lz4
|
||||
tar -cf "$OUT_KERNELTAR" boot.img.lz4 vendor_boot.img.lz4
|
||||
if [ "FIREASF_VANILLA" = "true" ]; then
|
||||
tar -cf "$OUT_VANILLA_KERNELTAR" boot.img.lz4 vendor_boot.img.lz4
|
||||
else
|
||||
tar -cf "$OUT_KSUNEXT_KERNELTAR" boot.img.lz4 vendor_boot.img.lz4
|
||||
fi
|
||||
cd "$DIR"
|
||||
rm -f boot.img.lz4 vendor_boot.img.lz4
|
||||
echo "Done! Output: $OUT_KERNELTAR"
|
||||
if [ "FIREASF_VANILLA" = "true" ]; then
|
||||
echo "Done! Output: $OUT_VANILLA_KERNELTAR"
|
||||
else
|
||||
echo "Done! Output: $OUT_KSUNEXT_KERNELTAR"
|
||||
fi
|
||||
|
||||
echo "Cleaning..."
|
||||
rm -f "${OUT_VENDORBOOTIMG}" "${OUT_BOOTIMG}"
|
|
@ -1,191 +0,0 @@
|
|||
#!/bin/bash
|
||||
FIRE_VERSION="5.0"
|
||||
|
||||
set -e
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "Please exec from root directory"
|
||||
exit 1
|
||||
fi
|
||||
cd "$1"
|
||||
|
||||
if [ "$(uname -m)" != "x86_64" ]; then
|
||||
echo "This script requires an x86_64 (64-bit) machine."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export PATH="$(pwd)/kernel_build/bin:$PATH"
|
||||
|
||||
# Configs
|
||||
OUTDIR="$(pwd)/out"
|
||||
MODULES_OUTDIR="$(pwd)/modules_out"
|
||||
TMPDIR="$(pwd)/kernel_build/tmp"
|
||||
|
||||
IN_PLATFORM="$(pwd)/kernel_build/vboot_platform"
|
||||
IN_DLKM="$(pwd)/kernel_build/vboot_dlkm"
|
||||
IN_DTB="$OUTDIR/arch/arm64/boot/dts/exynos/s5e8825.dtb"
|
||||
|
||||
PLATFORM_RAMDISK_DIR="$TMPDIR/ramdisk_platform"
|
||||
DLKM_RAMDISK_DIR="$TMPDIR/ramdisk_dlkm"
|
||||
PREBUILT_RAMDISK="$(pwd)/kernel_build/boot/ramdisk"
|
||||
MODULES_DIR="$DLKM_RAMDISK_DIR/lib/modules"
|
||||
|
||||
MKBOOTIMG="$(pwd)/kernel_build/mkbootimg/mkbootimg.py"
|
||||
MKDTBOIMG="$(pwd)/kernel_build/dtb/mkdtboimg.py"
|
||||
|
||||
DAY_MONTH=$(date +%e | tr -d ' ') # Removes leading space for single-digit days
|
||||
MONTH=$(date +%m)
|
||||
YEAR=$(date +%Y)
|
||||
HOUR=$(date +%H.%M) # Current hour in 24-hour format
|
||||
|
||||
OUT_KERNELZIP="$(pwd)/kernel_build/FireAsf/$DAY_MONTH.$MONTH.$YEAR/FireAsf-${FIRE_VERSION}-Testing233-${HOUR}.zip"
|
||||
OUT_KERNELTAR="$(pwd)/kernel_build/FireAsf/$DAY_MONTH.$MONTH.$YEAR/FireAsf-${FIRE_VERSION}-Testing233-${HOUR}.tar"
|
||||
OUT_KERNEL="$OUTDIR/arch/arm64/boot/Image"
|
||||
OUT_BOOTIMG="$(pwd)/kernel_build/zip/boot.img"
|
||||
OUT_VENDORBOOTIMG="$(pwd)/kernel_build/zip/vendor_boot.img"
|
||||
OUT_DTBIMAGE="$TMPDIR/dtb.img"
|
||||
|
||||
# Kernel-side
|
||||
BUILD_ARGS="LOCALVERSION=-FireAsf-${FIRE_VERSION}-TestingFr KBUILD_BUILD_USER=Ksawlii KBUILD_BUILD_HOST=FireAsFuck"
|
||||
|
||||
kfinish() {
|
||||
rm -rf "$TMPDIR"
|
||||
rm -rf "$MODULES_OUTDIR"
|
||||
}
|
||||
|
||||
kfinish
|
||||
|
||||
DIR="$(readlink -f .)"
|
||||
PARENT_DIR="$(readlink -f ${DIR}/..)"
|
||||
|
||||
export CROSS_COMPILE="$PARENT_DIR/clang-r536225/bin/aarch64-linux-gnu-"
|
||||
export CC="$PARENT_DIR/clang-r536225/bin/clang"
|
||||
|
||||
export PLATFORM_VERSION=15.0
|
||||
export ANDROID_MAJOR_VERSION=s
|
||||
export PATH="$PARENT_DIR/build-tools/path/linux-x86:$PARENT_DIR/clang-r536225/bin:$PATH"
|
||||
export TARGET_SOC=s5e8825
|
||||
export LLVM=1 LLVM_IAS=1
|
||||
export ARCH=arm64
|
||||
|
||||
if [ ! -d "$PARENT_DIR/clang-r536225" ]; then
|
||||
git clone -j$(nproc --all) https://gitlab.com/crdroidandroid/android_prebuilts_clang_host_linux-x86_clang-r536225.git -b 15.0 "$PARENT_DIR/clang-r536225" --depth=1
|
||||
fi
|
||||
|
||||
if [ ! -d "$PARENT_DIR/build-tools" ]; then
|
||||
git clone https://android.googlesource.com/platform/prebuilts/build-tools "$PARENT_DIR/build-tools" --depth=1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "Check in btop, htop, top (whatever you use) if its building.
|
||||
If you have some errors when trying to rebuild, delete $OUTDIR"
|
||||
make -j$(nproc --all) -C $(pwd) O=out $BUILD_ARGS a53x_defconfig >/dev/null
|
||||
make -j$(nproc --all) -C $(pwd) O=out $BUILD_ARGS dtbs >/dev/null
|
||||
make -j$(nproc --all) -C $(pwd) O=out $BUILD_ARGS >/dev/null
|
||||
make -j$(nproc --all) -C $(pwd) O=out INSTALL_MOD_STRIP="--strip-debug --keep-section=.ARM.attributes" INSTALL_MOD_PATH="$MODULES_OUTDIR" modules_install >/dev/null
|
||||
|
||||
rm -rf "$TMPDIR"
|
||||
rm -f "$OUT_BOOTIMG"
|
||||
rm -f "$OUT_VENDORBOOTIMG"
|
||||
mkdir "$TMPDIR"
|
||||
mkdir -p "$MODULES_DIR/0.0"
|
||||
mkdir "$PLATFORM_RAMDISK_DIR"
|
||||
|
||||
cp -rf "$IN_PLATFORM"/* "$PLATFORM_RAMDISK_DIR/"
|
||||
mkdir "$PLATFORM_RAMDISK_DIR/first_stage_ramdisk"
|
||||
cp -f "$PLATFORM_RAMDISK_DIR/fstab.s5e8825" "$PLATFORM_RAMDISK_DIR/first_stage_ramdisk/fstab.s5e8825"
|
||||
|
||||
if ! find "$MODULES_OUTDIR/lib/modules" -mindepth 1 -type d | read; then
|
||||
echo "Unknown error!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
missing_modules=""
|
||||
|
||||
for module in $(cat "$IN_DLKM/modules.load"); do
|
||||
i=$(find "$MODULES_OUTDIR/lib/modules" -name $module);
|
||||
if [ -f "$i" ]; then
|
||||
cp -f "$i" "$MODULES_DIR/0.0/$module"
|
||||
else
|
||||
missing_modules="$missing_modules $module"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "$missing_modules" != "" ]; then
|
||||
echo "ERROR: the following modules were not found: $missing_modules"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
depmod 0.0 -b "$DLKM_RAMDISK_DIR"
|
||||
sed -i 's/\([^ ]\+\)/\/lib\/modules\/\1/g' "$MODULES_DIR/0.0/modules.dep"
|
||||
cd "$MODULES_DIR/0.0"
|
||||
for i in $(find . -name "modules.*" -type f); do
|
||||
if [ $(basename "$i") != "modules.dep" ] && [ $(basename "$i") != "modules.softdep" ] && [ $(basename "$i") != "modules.alias" ]; then
|
||||
rm -f "$i"
|
||||
fi
|
||||
done
|
||||
cd "$DIR"
|
||||
|
||||
cp -f "$IN_DLKM/modules.load" "$MODULES_DIR/0.0/modules.load"
|
||||
mv "$MODULES_DIR/0.0"/* "$MODULES_DIR/"
|
||||
rm -rf "$MODULES_DIR/0.0"
|
||||
|
||||
echo "Building dtb image..."
|
||||
python2 "$MKDTBOIMG" create "$OUT_DTBIMAGE" --custom0=0x00000000 --custom1=0xff000000 --version=0 --page_size=2048 "$IN_DTB" || exit 1
|
||||
|
||||
echo "Building boot image..."
|
||||
|
||||
$MKBOOTIMG --header_version 4 \
|
||||
--kernel "$OUT_KERNEL" \
|
||||
--output "$OUT_BOOTIMG" \
|
||||
--ramdisk "$PREBUILT_RAMDISK" \
|
||||
--os_version 12.0.0 \
|
||||
--os_patch_level 2024-09 || exit 1
|
||||
|
||||
echo "Building vendor_boot image..."
|
||||
|
||||
cd "$DLKM_RAMDISK_DIR"
|
||||
find . | cpio --quiet -o -H newc -R root:root | lz4 -9cl > ../ramdisk_dlkm.lz4
|
||||
cd ../ramdisk_platform
|
||||
find . | cpio --quiet -o -H newc -R root:root | lz4 -9cl > ../ramdisk_platform.lz4
|
||||
cd ..
|
||||
echo "buildtime_bootconfig=enable" > bootconfig
|
||||
|
||||
$MKBOOTIMG --header_version 4 \
|
||||
--vendor_boot "$OUT_VENDORBOOTIMG" \
|
||||
--vendor_bootconfig "$(pwd)/bootconfig" \
|
||||
--dtb "$OUT_DTBIMAGE" \
|
||||
--vendor_ramdisk "$(pwd)/ramdisk_platform.lz4" \
|
||||
--ramdisk_type dlkm \
|
||||
--ramdisk_name dlkm \
|
||||
--vendor_ramdisk_fragment "$(pwd)/ramdisk_dlkm.lz4" \
|
||||
--os_version 12.0.0 \
|
||||
--os_patch_level 2024-09 || exit 1
|
||||
|
||||
cd "$DIR"
|
||||
|
||||
|
||||
echo "Building a flashable zip file (Recovery)..."
|
||||
mkdir -p "$(pwd)/kernel_build/FireAsf/$DAY_MONTH.$MONTH.$YEAR"
|
||||
cd "$(pwd)/kernel_build/zip"
|
||||
rm -f "$OUT_KERNELZIP"
|
||||
brotli --quality=11 -c boot.img > boot.br
|
||||
brotli --quality=11 -c vendor_boot.img > vendor_boot.br
|
||||
zip -r9 -q "$OUT_KERNELZIP" META-INF boot.br vendor_boot.br
|
||||
rm -f boot.br vendor_boot.br
|
||||
cd "$DIR"
|
||||
echo "Done! Output: $OUT_KERNELZIP"
|
||||
|
||||
echo "Building a flashable tar file (Download Mode)..."
|
||||
cd "$(pwd)/kernel_build"
|
||||
rm -f "$OUT_KERNELTAR"
|
||||
lz4 -c -12 -B6 --content-size "$OUT_BOOTIMG" > boot.img.lz4
|
||||
lz4 -c -12 -B6 --content-size "$OUT_VENDORBOOTIMG" > vendor_boot.img.lz4
|
||||
tar -cf "$OUT_KERNELTAR" boot.img.lz4 vendor_boot.img.lz4
|
||||
cd "$DIR"
|
||||
rm -f boot.img.lz4 vendor_boot.img.lz4
|
||||
echo "Done! Output: $OUT_KERNELTAR"
|
||||
|
||||
echo "Cleaning..."
|
||||
rm -f "${OUT_VENDORBOOTIMG}" "${OUT_BOOTIMG}"
|
||||
kfinish
|
Loading…
Reference in a new issue