Skip to content

Commit

Permalink
Merge branch 'sbwml:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Q2297045667 authored Nov 19, 2024
2 parents 280f7fe + e1aee1f commit d9ff94c
Show file tree
Hide file tree
Showing 7 changed files with 300 additions and 287 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ jobs:
shell: bash

steps:
- name: Checkout
continue-on-error: true
uses: actions/checkout@main
with:
path: r4s_build_script

- name: Setup variables
run: |
sudo timedatectl set-timezone 'Asia/Shanghai'
Expand All @@ -68,6 +74,16 @@ jobs:
uname -a
echo
- name: Install Caddy Server
run: |
sudo curl -sL -o /usr/bin/caddy https://github.com/sbwml/r4s_build_script/releases/download/caddy/caddy
sudo chmod 755 /usr/bin/caddy
echo ":8080 {" > caddyfile
echo " root * $(pwd)/r4s_build_script" >> caddyfile
echo " file_server browse" >> caddyfile
echo "}" >> caddyfile
sudo /usr/bin/caddy start --config caddyfile --adapter caddyfile
- name: Free disk space
uses: sbwml/actions@free-disk
with:
Expand Down Expand Up @@ -105,10 +121,9 @@ jobs:
id: compile
continue-on-error: true
run: |
export GITHUB_REPO=${{ github.repository }}
export ${{ github.event.inputs.build_options }} LAN=${{ github.event.inputs.lan_addr }} USE_GCC15=y
[ ${{ github.event.inputs.ccache }} = 'true' ] && export ENABLE_CCACHE=y
bash <(curl -sS https://raw.githubusercontent.com/${{ github.repository }}/master/openwrt/build.sh) ${{ env.build_version }} ${{ github.event.inputs.device }}
bash <(curl -sS http://127.0.0.1:8080/build.sh) ${{ env.build_version }} ${{ github.event.inputs.device }}
cd openwrt
if [ "${{ github.event.inputs.version }}" = release ]; then
tags=OpenWrt-$(git describe --abbrev=0 --tags)
Expand Down
74 changes: 39 additions & 35 deletions openwrt/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ ip_info=`curl -sk https://ip.cooluc.com`;

# script url
if [ "$isCN" = "CN" ]; then
export mirror=init.cooluc.com
export mirror=https://init.cooluc.com
else
export mirror=init2.cooluc.com
export mirror=https://init2.cooluc.com
fi

# github actions - automatically retrieve `github raw` links
if [ "$(whoami)" = "runner" ] && [ -n "$GITHUB_REPO" ]; then
export mirror=raw.githubusercontent.com/$GITHUB_REPO/master
# github actions - caddy server
if [ "$(whoami)" = "runner" ] && [ -z "$git_password" ]; then
export mirror=http://127.0.0.1:8080
fi

# private gitea
Expand Down Expand Up @@ -91,7 +91,7 @@ if [ "$1" = "dev" ]; then
export branch=openwrt-24.10
export version=dev
elif [ "$1" = "rc2" ]; then
latest_release="v$(curl -s https://$mirror/tags/v24)"
latest_release="v$(curl -s $mirror/tags/v24)"
export branch=$latest_release
export version=rc2
fi
Expand Down Expand Up @@ -143,7 +143,7 @@ else
echo -e "${GREEN_COLOR}Model: nanopi-r4s${RES}"
[ "$1" = "rc2" ] && model="nanopi-r4s"
fi
get_kernel_version=$(curl -s https://$mirror/tags/kernel-6.12)
get_kernel_version=$(curl -s $mirror/tags/kernel-6.12)
kmod_hash=$(echo -e "$get_kernel_version" | awk -F'HASH-' '{print $2}' | awk '{print $1}' | tail -1 | md5sum | awk '{print $1}')
kmodpkg_name=$(echo $(echo -e "$get_kernel_version" | awk -F'HASH-' '{print $2}' | awk '{print $1}')~$(echo $kmod_hash)-r1)
echo -e "${GREEN_COLOR}Kernel: $kmodpkg_name ${RES}"
Expand Down Expand Up @@ -178,7 +178,7 @@ git clone https://$github/immortalwrt/packages master/immortalwrt_packages --dep
if [ -d openwrt ]; then
cd openwrt
echo "1730409337" > version.date # OpenWrt v24.10: set branch defaults
curl -Os https://$mirror/openwrt/patch/key.tar.gz && tar zxf key.tar.gz && rm -f key.tar.gz
curl -Os $mirror/openwrt/patch/key.tar.gz && tar zxf key.tar.gz && rm -f key.tar.gz
else
echo -e "${RED_COLOR}Failed to download source code${RES}"
exit 1
Expand Down Expand Up @@ -228,17 +228,17 @@ fi
echo -e "\n${GREEN_COLOR}Patching ...${RES}\n"

# scripts
curl -sO https://$mirror/openwrt/scripts/00-prepare_base.sh
curl -sO https://$mirror/openwrt/scripts/01-prepare_base-mainline.sh
curl -sO https://$mirror/openwrt/scripts/02-prepare_package.sh
curl -sO https://$mirror/openwrt/scripts/03-convert_translation.sh
curl -sO https://$mirror/openwrt/scripts/04-fix_kmod.sh
curl -sO https://$mirror/openwrt/scripts/05-fix-source.sh
curl -sO https://$mirror/openwrt/scripts/99_clean_build_cache.sh
curl -sO $mirror/openwrt/scripts/00-prepare_base.sh
curl -sO $mirror/openwrt/scripts/01-prepare_base-mainline.sh
curl -sO $mirror/openwrt/scripts/02-prepare_package.sh
curl -sO $mirror/openwrt/scripts/03-convert_translation.sh
curl -sO $mirror/openwrt/scripts/04-fix_kmod.sh
curl -sO $mirror/openwrt/scripts/05-fix-source.sh
curl -sO $mirror/openwrt/scripts/99_clean_build_cache.sh
if [ -n "$git_password" ] && [ -n "$private_url" ]; then
curl -u openwrt:$git_password -sO "$private_url"
else
curl -sO https://$mirror/openwrt/scripts/10-custom.sh
curl -sO $mirror/openwrt/scripts/10-custom.sh
fi
chmod 0755 *sh
[ "$(whoami)" = "runner" ] && group "patching openwrt"
Expand All @@ -256,44 +256,44 @@ rm -rf ../master

# Load devices Config
if [ "$platform" = "x86_64" ]; then
curl -s https://$mirror/openwrt/24-config-musl-x86 > .config
curl -s $mirror/openwrt/24-config-musl-x86 > .config
elif [ "$platform" = "bcm53xx" ]; then
if [ "$MINIMAL_BUILD" = "y" ]; then
curl -s https://$mirror/openwrt/24-config-musl-r8500-minimal > .config
curl -s $mirror/openwrt/24-config-musl-r8500-minimal > .config
else
curl -s https://$mirror/openwrt/24-config-musl-r8500 > .config
curl -s $mirror/openwrt/24-config-musl-r8500 > .config
fi
sed -i '1i\# CONFIG_PACKAGE_kselftests-bpf is not set\n# CONFIG_PACKAGE_perf is not set\n' .config
elif [ "$platform" = "rk3568" ]; then
curl -s https://$mirror/openwrt/24-config-musl-r5s > .config
curl -s $mirror/openwrt/24-config-musl-r5s > .config
elif [ "$platform" = "armv8" ]; then
curl -s https://$mirror/openwrt/24-config-musl-armsr-armv8 > .config
curl -s $mirror/openwrt/24-config-musl-armsr-armv8 > .config
else
curl -s https://$mirror/openwrt/24-config-musl-r4s > .config
curl -s $mirror/openwrt/24-config-musl-r4s > .config
fi

# config-common
if [ "$MINIMAL_BUILD" = "y" ]; then
[ "$platform" != "bcm53xx" ] && curl -s https://$mirror/openwrt/24-config-minimal-common >> .config
[ "$platform" != "bcm53xx" ] && curl -s $mirror/openwrt/24-config-minimal-common >> .config
echo 'VERSION_TYPE="minimal"' >> package/base-files/files/usr/lib/os-release
else
[ "$platform" != "bcm53xx" ] && curl -s https://$mirror/openwrt/24-config-common >> .config
[ "$platform" != "bcm53xx" ] && curl -s $mirror/openwrt/24-config-common >> .config
[ "$platform" = "armv8" ] && sed -i '/DOCKER/Id' .config
fi

# ota
[ "$ENABLE_OTA" = "y" ] && [ "$version" = "rc2" ] && echo 'CONFIG_PACKAGE_luci-app-ota=y' >> .config

# bpf
[ "$ENABLE_BPF" = "y" ] && curl -s https://$mirror/openwrt/generic/config-bpf >> .config
[ "$ENABLE_BPF" = "y" ] && curl -s $mirror/openwrt/generic/config-bpf >> .config

# LTO
export ENABLE_LTO=$ENABLE_LTO
[ "$ENABLE_LTO" = "y" ] && curl -s https://$mirror/openwrt/generic/config-lto >> .config
[ "$ENABLE_LTO" = "y" ] && curl -s $mirror/openwrt/generic/config-lto >> .config

# glibc
[ "$ENABLE_GLIBC" = "y" ] && {
curl -s https://$mirror/openwrt/generic/config-glibc >> .config
curl -s $mirror/openwrt/generic/config-glibc >> .config
sed -i '/NaiveProxy/d' .config
}

Expand Down Expand Up @@ -334,11 +334,11 @@ fi

# gcc15 patches
[ "$(whoami)" = "runner" ] && group "patching toolchain"
curl -s https://$mirror/openwrt/patch/generic-24.10/202-toolchain-gcc-add-support-for-GCC-15.patch | patch -p1
curl -s $mirror/openwrt/patch/generic-24.10/202-toolchain-gcc-add-support-for-GCC-15.patch | patch -p1
# gcc config
[ "$USE_GCC13" = "y" ] && curl -s https://$mirror/openwrt/generic/config-gcc13 >> .config
[ "$USE_GCC14" = "y" ] && curl -s https://$mirror/openwrt/generic/config-gcc14 >> .config
[ "$USE_GCC15" = "y" ] && curl -s https://$mirror/openwrt/generic/config-gcc15 >> .config
[ "$USE_GCC13" = "y" ] && curl -s $mirror/openwrt/generic/config-gcc13 >> .config
[ "$USE_GCC14" = "y" ] && curl -s $mirror/openwrt/generic/config-gcc14 >> .config
[ "$USE_GCC15" = "y" ] && curl -s $mirror/openwrt/generic/config-gcc15 >> .config
[ "$(whoami)" = "runner" ] && endgroup

# uhttpd
Expand Down Expand Up @@ -420,7 +420,8 @@ if [ "$platform" = "x86_64" ]; then
if [ "$NO_KMOD" != "y" ]; then
cp -a bin/targets/x86/*/packages $kmodpkg_name
rm -f $kmodpkg_name/Packages*
cp -a bin/packages/x86_64/base/*natflow*.ipk $kmodpkg_name/
cp -a bin/packages/x86_64/base/rtl88*a-firmware*.ipk $kmodpkg_name/
cp -a bin/packages/x86_64/base/natflow*.ipk $kmodpkg_name/
[ "$ENABLE_DPDK" = "y" ] && {
cp -a bin/packages/x86_64/base/*dpdk*.ipk $kmodpkg_name/ || true
cp -a bin/packages/x86_64/base/*numa*.ipk $kmodpkg_name/ || true
Expand Down Expand Up @@ -461,7 +462,8 @@ elif [ "$platform" = "armv8" ]; then
if [ "$NO_KMOD" != "y" ]; then
cp -a bin/targets/armsr/armv8*/packages $kmodpkg_name
rm -f $kmodpkg_name/Packages*
cp -a bin/packages/aarch64_generic/base/*natflow*.ipk $kmodpkg_name/
cp -a bin/packages/aarch64_generic/base/rtl88*a-firmware*.ipk $kmodpkg_name/
cp -a bin/packages/aarch64_generic/base/natflow*.ipk $kmodpkg_name/
[ "$ENABLE_DPDK" = "y" ] && {
cp -a bin/packages/aarch64_generic/base/*dpdk*.ipk $kmodpkg_name/ || true
cp -a bin/packages/aarch64_generic/base/*numa*.ipk $kmodpkg_name/ || true
Expand Down Expand Up @@ -492,7 +494,8 @@ elif [ "$platform" = "bcm53xx" ]; then
if [ "$NO_KMOD" != "y" ]; then
cp -a bin/targets/bcm53xx/generic/packages $kmodpkg_name
rm -f $kmodpkg_name/Packages*
cp -a bin/packages/arm_cortex-a9/base/*natflow*.ipk $kmodpkg_name/
cp -a bin/packages/arm_cortex-a9/base/rtl88*a-firmware*.ipk $kmodpkg_name/
cp -a bin/packages/arm_cortex-a9/base/natflow*.ipk $kmodpkg_name/
bash kmod-sign $kmodpkg_name
tar zcf bcm53xx-$kmodpkg_name.tar.gz $kmodpkg_name
rm -rf $kmodpkg_name
Expand Down Expand Up @@ -524,7 +527,8 @@ else
if [ "$NO_KMOD" != "y" ] && [ "$platform" != "rk3399" ]; then
cp -a bin/targets/rockchip/armv8*/packages $kmodpkg_name
rm -f $kmodpkg_name/Packages*
cp -a bin/packages/aarch64_generic/base/*natflow*.ipk $kmodpkg_name/
cp -a bin/packages/aarch64_generic/base/rtl88*a-firmware*.ipk $kmodpkg_name/
cp -a bin/packages/aarch64_generic/base/natflow*.ipk $kmodpkg_name/
[ "$ENABLE_DPDK" = "y" ] && {
cp -a bin/packages/aarch64_generic/base/*dpdk*.ipk $kmodpkg_name/ || true
cp -a bin/packages/aarch64_generic/base/*numa*.ipk $kmodpkg_name/ || true
Expand Down
Loading

0 comments on commit d9ff94c

Please sign in to comment.