From def98703a81e99fa1f42f0220efd7b698036641c Mon Sep 17 00:00:00 2001 From: klzgrad Date: Sat, 19 Oct 2024 09:08:05 +0800 Subject: [PATCH] Fix static build to disable partition alloc --- .github/workflows/build.yml | 58 ++++++++++++++++++++++++------------- src/get-openwrt.sh | 26 +++++++++++++---- 2 files changed, 59 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7ff15e6f85..7f202d5a7b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,7 @@ defaults: shell: bash working-directory: src env: - CACHE_EPOCH: 1 + CACHE_EPOCH: 4 CCACHE_MAXSIZE: 200M CCACHE_MAXFILES: 0 SCCACHE_CACHE_SIZE: 200M @@ -386,7 +386,7 @@ jobs: openwrt: "target=x86 subtarget=64" target_cpu: x64 - arch: x86 - openwrt: "target=x86 subtarget=generic" + openwrt: "target=x86 subtarget=geode" target_cpu: x86 - arch: aarch64_cortex-a53 openwrt: "target=sunxi subtarget=cortexa53" @@ -395,7 +395,9 @@ jobs: - arch: aarch64_cortex-a53-static openwrt: "target=sunxi subtarget=cortexa53" target_cpu: arm64 - extra: 'arm_cpu="cortex-a53" build_static=true no_madvise_syscall=true' + extra: 'arm_cpu="cortex-a53" build_static=true use_allocator_shim=false use_partition_alloc=false' + openwrt_release: '23.05.0' + openwrt_gcc_ver: '12.3.0' - arch: aarch64_cortex-a72 openwrt: "target=mvebu subtarget=cortexa72" target_cpu: arm64 @@ -403,16 +405,20 @@ jobs: - arch: aarch64_cortex-a72-static openwrt: "target=mvebu subtarget=cortexa72" target_cpu: arm64 - extra: 'arm_cpu="cortex-a72" build_static=true no_madvise_syscall=true' + extra: 'arm_cpu="cortex-a72" build_static=true use_allocator_shim=false use_partition_alloc=false' + openwrt_release: '23.05.0' + openwrt_gcc_ver: '12.3.0' - arch: aarch64_generic - openwrt: "target=rockchip subtarget=armv8" + openwrt: "target=layerscape subtarget=armv8_64b" target_cpu: arm64 - arch: aarch64_generic-static - openwrt: "target=rockchip subtarget=armv8" + openwrt: "target=layerscape subtarget=armv8_64b" target_cpu: arm64 - extra: "build_static=true no_madvise_syscall=true" + extra: "build_static=true use_allocator_shim=false use_partition_alloc=false" + openwrt_release: '23.05.0' + openwrt_gcc_ver: '12.3.0' - arch: arm_arm1176jzf-s_vfp - openwrt: "target=bcm27xx subtarget=bcm2708" + openwrt: "target=brcm2708 subtarget=bcm2708" target_cpu: arm extra: 'arm_version=0 arm_cpu="arm1176jzf-s" arm_fpu="vfp" arm_float_abi="hard" arm_use_neon=false arm_use_thumb=false' - arch: arm_arm926ej-s @@ -420,29 +426,35 @@ jobs: target_cpu: arm extra: 'arm_version=0 arm_cpu="arm926ej-s" arm_float_abi="soft" arm_use_neon=false arm_use_thumb=false' - arch: arm_cortex-a15_neon-vfpv4 - openwrt: "target=armsr subtarget=armv7" + openwrt: "target=ipq806x subtarget=generic" target_cpu: arm extra: 'arm_version=0 arm_cpu="cortex-a15" arm_fpu="neon-vfpv4" arm_float_abi="hard" arm_use_neon=true' - arch: arm_cortex-a5_vfpv4 - openwrt: "target=at91 subtarget=sama5" + openwrt: "target=at91 subtarget=sama5d3" target_cpu: arm extra: 'arm_version=0 arm_cpu="cortex-a5" arm_fpu="vfpv4" arm_float_abi="hard" arm_use_neon=false' - arch: arm_cortex-a7 openwrt: "target=mediatek subtarget=mt7629" target_cpu: arm extra: 'arm_version=0 arm_cpu="cortex-a7" arm_float_abi="soft" arm_use_neon=false' + openwrt_release: '21.02.0' + openwrt_gcc_ver: '8.4.0' - arch: arm_cortex-a7_neon-vfpv4 openwrt: "target=sunxi subtarget=cortexa7" target_cpu: arm extra: 'arm_version=0 arm_cpu="cortex-a7" arm_fpu="neon-vfpv4" arm_float_abi="hard" arm_use_neon=true' + - arch: arm_cortex-a7_neon-vfpv4-static + openwrt: "target=sunxi subtarget=cortexa7" + target_cpu: arm + extra: 'arm_version=0 arm_cpu="cortex-a7" arm_fpu="neon-vfpv4" arm_float_abi="hard" arm_use_neon=true build_static=true use_allocator_shim=false use_partition_alloc=false' + openwrt_release: '23.05.0' + openwrt_gcc_ver: '12.3.0' - arch: arm_cortex-a7_vfpv4 openwrt: "target=at91 subtarget=sama7" target_cpu: arm extra: 'arm_version=0 arm_cpu="cortex-a7" arm_fpu="vfpv4" arm_float_abi="hard" arm_use_neon=false' - - arch: arm_cortex-a7_neon-vfpv4-static - openwrt: "target=sunxi subtarget=cortexa7" - target_cpu: arm - extra: 'arm_version=0 arm_cpu="cortex-a7" arm_fpu="neon-vfpv4" arm_float_abi="hard" arm_use_neon=true build_static=true no_madvise_syscall=true' + openwrt_release: '22.03.0' + openwrt_gcc_ver: '11.2.0' - arch: arm_cortex-a8_vfpv3 openwrt: "target=sunxi subtarget=cortexa8" target_cpu: arm @@ -454,13 +466,15 @@ jobs: - arch: arm_cortex-a9-static openwrt: "target=bcm53xx subtarget=generic" target_cpu: arm - extra: 'arm_version=0 arm_cpu="cortex-a9" arm_float_abi="soft" arm_use_neon=false build_static=true no_madvise_syscall=true' + extra: 'arm_version=0 arm_cpu="cortex-a9" arm_float_abi="soft" arm_use_neon=false build_static=true use_allocator_shim=false use_partition_alloc=false' + openwrt_release: '23.05.0' + openwrt_gcc_ver: '12.3.0' - arch: arm_cortex-a9_neon - openwrt: "target=zynq subtarget=generic" + openwrt: "target=imx6 subtarget=generic" target_cpu: arm extra: 'arm_version=0 arm_cpu="cortex-a9" arm_fpu="neon" arm_float_abi="hard" arm_use_neon=true' - arch: arm_cortex-a9_vfpv3-d16 - openwrt: "target=tegra subtarget=generic" + openwrt: "target=mvebu subtarget=cortexa9" target_cpu: arm extra: 'arm_version=0 arm_cpu="cortex-a9" arm_fpu="vfpv3-d16" arm_float_abi="hard" arm_use_neon=false' - arch: arm_mpcore @@ -478,17 +492,21 @@ jobs: - arch: mipsel_24kc-static openwrt: "target=ramips subtarget=rt305x" target_cpu: mipsel - extra: 'mips_arch_variant="r2" mips_float_abi="soft" build_static=true no_madvise_syscall=true' + extra: 'mips_arch_variant="r2" mips_float_abi="soft" build_static=true use_allocator_shim=false use_partition_alloc=false' + openwrt_release: '23.05.0' + openwrt_gcc_ver: '12.3.0' - arch: mipsel_mips32 - openwrt: "target=bcm47xx subtarget=generic" + openwrt: "target=brcm47xx subtarget=legacy" target_cpu: mipsel extra: 'mips_arch_variant="r1" mips_float_abi="soft"' - arch: riscv64 openwrt: "target=sifiveu subtarget=generic" target_cpu: riscv64 + openwrt_release: '23.05.0' + openwrt_gcc_ver: '12.3.0' env: EXTRA_FLAGS: target_cpu="${{ matrix.target_cpu }}" target_os="openwrt" ${{ matrix.extra }} - OPENWRT_FLAGS: arch=${{ matrix.arch }} release=23.05.0 gcc_ver=12.3.0 ${{ matrix.openwrt }} + OPENWRT_FLAGS: arch=${{ matrix.arch }} release=${{ matrix.openwrt_release || '18.06.0' }} gcc_ver=${{ matrix.openwrt_gcc_ver || '7.3.0' }} ${{ matrix.openwrt }} BUNDLE: naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }} steps: - uses: actions/checkout@v4 diff --git a/src/get-openwrt.sh b/src/get-openwrt.sh index 4ae0056172..547c92fc53 100755 --- a/src/get-openwrt.sh +++ b/src/get-openwrt.sh @@ -15,17 +15,33 @@ arm_*) abi=musl_eabi;; *) abi=musl;; esac -if [ "$subtarget" ]; then - SDK_PATH=openwrt-toolchain-$release-$target-${subtarget}_gcc-${gcc_ver}_${abi}.Linux-x86_64 +major=${release%%.*} +if [ "$major" -ge 22 ]; then + path_suffix=toolchain else - subtarget='generic' - SDK_PATH=openwrt-toolchain-$release-${target}_gcc-${gcc_ver}_${abi}.Linux-x86_64 + path_suffix=sdk +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 SDK_URL=https://downloads.openwrt.org/releases/$release/targets/$target/$subtarget/$SDK_PATH.tar.xz rm -rf $SDK_PATH curl $SDK_URL | tar xJf - -cd $SDK_PATH + 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 <