更新 toolchain/build.sh

Signed-off-by: zhao <zhao@noreply.localhost>
This commit is contained in:
zhao 2025-03-22 08:45:19 +08:00
parent 6b9ba39737
commit cd3c7e32da

View File

@ -1,13 +1,7 @@
#!/bin/bash -e #!/bin/bash -e
# Clone source code # Clone source code
if [ "$model" = "Padavanonly_MT798X_v24.10" ]; then git clone -b openwrt-24.10 --single-branch --filter=blob:none https://github.com/openwrt/openwrt openwrt
git clone -b 2410 --single-branch --filter=blob:none https://github.com/padavanonly/immortalwrt-mt798x-24.10 openwrt
elif [ "$model" = "Hanwckf_MT798X_v21.02" ]; then
git clone --depth=1 https://github.com/hanwckf/immortalwrt-mt798x openwrt
elif [ "$model" = "OpenWrt_Rockchip_v24.10" ] || [ "$model" = "OpenWrt_X86_64_v24.10" ]; then
git clone -b openwrt-24.10 --single-branch --filter=blob:none https://github.com/immortalwrt/immortalwrt openwrt
fi
# Enter source code # Enter source code
cd openwrt cd openwrt
@ -16,17 +10,33 @@ cd openwrt
./scripts/feeds update -a ./scripts/feeds update -a
./scripts/feeds install -a ./scripts/feeds install -a
# gcc15 patches
curl -s https://raw.githubusercontent.com/oppen321/ZeroWrt-Action/refs/heads/master/patch/GCC/202-toolchain-gcc-add-support-for-GCC-15.patch | patch -p1
# Load devices Config # Load devices Config
if [ "$model" = "Padavanonly_MT798X_v24.10" ]; then if [ "$model" = "OpenWrt_Rockchip_v24.10" ]; then
curl -s https://git.kejizero.online/zhao/files/raw/branch/main/toolchain/Configs/padavanonly_mt798x.config > .config
elif [ "$model" = "Hanwckf_MT798X_v21.02" ]; then
curl -s https://git.kejizero.online/zhao/files/raw/branch/main/toolchain/Configs/hanwckf_mt798x.config > .config
elif [ "$model" = "OpenWrt_Rockchip_v24.10" ]; then
curl -s https://git.kejizero.online/zhao/files/raw/branch/main/toolchain/Configs/immortalwrt_rockchip.config > .config curl -s https://git.kejizero.online/zhao/files/raw/branch/main/toolchain/Configs/immortalwrt_rockchip.config > .config
elif [ "$model" = "OpenWrt_X86_64_v24.10" ]; then elif [ "$model" = "OpenWrt_X86_64_v24.10" ]; then
curl -s https://git.kejizero.online/zhao/files/raw/branch/main/toolchain/Configs/immortalwrt_x86_64.config > .config curl -s https://git.kejizero.online/zhao/files/raw/branch/main/toolchain/Configs/immortalwrt_x86_64.config > .config
fi fi
# gcc14 & 15
if [ "$USE_GCC13" = y ]; then
export USE_GCC13=y gcc_version=13
elif [ "$USE_GCC14" = y ]; then
export USE_GCC14=y gcc_version=14
elif [ "$USE_GCC15" = y ]; then
export USE_GCC15=y gcc_version=15
else
export USE_GCC14=y gcc_version=14
fi
# gcc config
echo -e "\n# gcc ${gcc_version}" >> .config
echo -e "CONFIG_DEVEL=y" >> .config
echo -e "CONFIG_TOOLCHAINOPTS=y" >> .config
echo -e "CONFIG_GCC_USE_VERSION_${gcc_version}=y\n" >> .config
# Compile # Compile
make defconfig make defconfig
make -j$(nproc) make -j$(nproc)
@ -67,13 +77,23 @@ fi
mkdir toolchain-cache mkdir toolchain-cache
# Compression toolchain # Compression toolchain
if [ "$model" = "Padavanonly_MT798X_v24.10" ]; then case "$model" in
tar -I zstd -cvf toolchain-cache/toolchain_musl_padavanonly_mediatek_gcc-13.tar.zst build_dir dl tmp staging_dir "OpenWrt_Rockchip_v24.10" | "OpenWrt_X86_64_v24.10")
elif [ "$model" = "Hanwckf_MT798X_v21.02" ]; then if [ -z "$gcc_version" ]; then
tar -I zstd -cvf toolchain-cache/toolchain_musl_hanwckf_mediatek_gcc-8.tar.zst build_dir dl tmp staging_dir echo "Error: GCC version not set!"
elif [ "$model" = "OpenWrt_Rockchip_v24.10" ]; then exit 1
tar -I zstd -cvf toolchain-cache/toolchain_musl_immortalwrt_rockchip_gcc-13.tar.zst build_dir dl tmp staging_dir
elif [ "$model" = "OpenWrt_X86_64_v24.10" ]; then
tar -I zstd -cvf toolchain-cache/toolchain_musl_immortalwrt_X86_64_gcc-13.tar.zst build_dir dl tmp staging_dir
fi fi
if [ "$model" = "OpenWrt_Rockchip_v24.10" ]; then
output_file="toolchain_musl_openwrt_rockchip_gcc-${gcc_version}.tar.zst"
elif [ "$model" = "OpenWrt_X86_64_v24.10" ]; then
output_file="toolchain_musl_openwrt_X86_64_gcc-${gcc_version}.tar.zst"
fi
tar -I zstd -cvf "toolchain-cache/${output_file}" build_dir dl tmp staging_dir
;;
*)
echo "Error: Unknown model '$model'!"
exit 1
;;
esac