src/get-openwrt.sh

This commit is contained in:
klzgrad 2024-11-20 19:35:58 +08:00
parent fbe8fc219f
commit 35c964473c

View File

@ -15,17 +15,33 @@ arm_*) abi=musl_eabi;;
*) abi=musl;; *) abi=musl;;
esac esac
if [ "$subtarget" ]; then major=${release%%.*}
SDK_PATH=openwrt-toolchain-$release-$target-${subtarget}_gcc-${gcc_ver}_${abi}.Linux-x86_64 if [ "$major" -ge 22 ]; then
path_suffix=toolchain
else else
subtarget='generic' path_suffix=sdk
SDK_PATH=openwrt-toolchain-$release-${target}_gcc-${gcc_ver}_${abi}.Linux-x86_64 fi
if [ ! "$subtarget" ]; then
subtarget=generic
fi
if [ "$subtarget" != generic -o "$major" -ge 22 ]; then
SDK_PATH=openwrt-$path_suffix-$release-$target-${subtarget}_gcc-${gcc_ver}_${abi}.Linux-x86_64
else
SDK_PATH=openwrt-$path_suffix-$release-${target}_gcc-${gcc_ver}_${abi}.Linux-x86_64
fi fi
SDK_URL=https://downloads.openwrt.org/releases/$release/targets/$target/$subtarget/$SDK_PATH.tar.xz SDK_URL=https://downloads.openwrt.org/releases/$release/targets/$target/$subtarget/$SDK_PATH.tar.xz
rm -rf $SDK_PATH rm -rf $SDK_PATH
curl $SDK_URL | tar xJf - curl $SDK_URL | tar xJf -
cd $SDK_PATH
full_root=toolchain-*_gcc-${gcc_ver}_${abi} full_root=toolchain-*_gcc-${gcc_ver}_${abi}
if [ "$major" -lt 22 ]; then
mv $SDK_PATH/staging_dir/$full_root $SDK_PATH
fi
cd $SDK_PATH
cat >include.txt <<EOF cat >include.txt <<EOF
./include ./include
./lib/*.o ./lib/*.o