50 lines
1.7 KiB
Bash
50 lines
1.7 KiB
Bash
#!/bin/bash -e
|
|
|
|
# Clone source code
|
|
if [ "$model" = "Padavanonly_MT798X_v24.10" ]; then
|
|
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
|
|
cd openwrt
|
|
|
|
# Load devices Config
|
|
if [ "$model" = "Padavanonly_MT798X_v24.10" ]; then
|
|
cp -f defconfig/mt7981-ax3000.config .config
|
|
elif [ "$model" = "Hanwckf_MT798X_v21.02" ]; then
|
|
cp -f defconfig/mt7981-ax3000.config .config
|
|
elif [ "$model" = "OpenWrt_Rockchip_v24.10" ] || [ "$model" = "OpenWrt_X86_64_v24.10" ]; then
|
|
cp -f defconfig/mt7981-ax3000.config .config
|
|
fi
|
|
|
|
# Init feeds
|
|
./scripts/feeds update -a
|
|
./scripts/feeds install -a
|
|
|
|
# Compile
|
|
make defconfig
|
|
make -j$(nproc)
|
|
|
|
# Organize files
|
|
rm -rf build_dir/hostpkg
|
|
rm -rf staging_dir/hostpkg
|
|
rm -rf staging_dir/packages
|
|
rm -rf staging_dir/target-aarch64_cortex-a53_musl/host
|
|
rm -rf staging_dir/target-aarch64_cortex-a53_musl/packages
|
|
rm -rf staging_dir/target-aarch64_cortex-a53_musl/pkginfo
|
|
rm -rf staging_dir/target-aarch64_cortex-a53_musl/root-mediatek
|
|
find build_dir/target-aarch64_cortex-a53_musl -mindepth 1 -maxdepth 1 ! -name 'stamp' -exec rm -rf {} +
|
|
|
|
|
|
# Create folder
|
|
mkdir toolchain-cache
|
|
|
|
# Compression toolchain
|
|
tar -I zstd -cvf toolchain-cache/toolchain_mediatek.tar.zst build_dir dl tmp staging_dir
|
|
|
|
# tar -czvf toolchain-cache/toolchain.tar.gz tools toolchain
|