sudo apt-get update
sudo apt-get install -y build-essential flex bison g++ gawk gcc-multilib g++-multilib gettext git libfuse-dev libncurses5-dev libssl-dev python3 python3-pip python3-ply python3-distutils python3-pyelftools rsync unzip zlib1g-dev file wget subversion patch upx-ucl autoconf automake curl asciidoc binutils bzip2 lib32gcc-s1 libc6-dev-i386 uglifyjs msmtp texinfo libreadline-dev libglib2.0-dev xmlto libelf-dev libtool autopoint antlr3 gperf ccache swig coreutils haveged scons libpython3-dev jq
启用 Clang/LLVM 构建内核
export KERNEL_CLANG_LTO=y
# GCC13
export USE_GCC13=y
# GCC14
export USE_GCC14=y
# GCC15
export USE_GCC15=y
启用 LTO 优化
export ENABLE_LTO=y
启用 MOLD 现代链接器(需要启用 USE_GCC13=y
或 USE_GCC14=y
或 USE_GCC15=y
)
export ENABLE_MOLD=y
启用 eBPF 支持
export ENABLE_BPF=y
启用 LRNG
export ENABLE_LRNG=y
启用 Glibc 库构建 (实验性)
export ENABLE_GLIBC=y
export ENABLE_LOCAL_KMOD=y
启用 DPDK 支持
export ENABLE_DPDK=y
脚本会使用 toolchain 缓存代替源码构建,与常规构建相比能节省大约 60 分钟的编译耗时,仅适用于 Github Actions ubuntu-24.04
环境
export BUILD_FAST=y
export MINIMAL_BUILD=y
export LAN=10.0.0.1
export ENABLE_UHTTPD=y
export NO_KMOD=y
# linux-6.12
bash <(curl -sS https://init2.cooluc.com/build.sh) rc2 nanopi-r4s
# linux-6.12
bash <(curl -sS https://init2.cooluc.com/build.sh) rc2 nanopi-r5s
# linux-6.12
bash <(curl -sS https://init2.cooluc.com/build.sh) rc2 x86_64
# linux-6.12
bash <(curl -sS https://init2.cooluc.com/build.sh) dev nanopi-r4s
# linux-6.12
bash <(curl -sS https://init2.cooluc.com/build.sh) dev nanopi-r5s
# linux-6.12
bash <(curl -sS https://init2.cooluc.com/build.sh) dev x86_64
将 init.cooluc.com 脚本默认连接替换为你的 github raw 连接,像这样 https://raw.githubusercontent.com/你的用户名/r4s_build_script/refs/heads/master
# script url
if [ "$isCN" = "CN" ]; then
- export mirror=https://init.cooluc.com
+ export mirror=https://raw.githubusercontent.com/你的用户名/r4s_build_script/refs/heads/master
else
- export mirror=https://init2.cooluc.com
+ export mirror=https://raw.githubusercontent.com/你的用户名/r4s_build_script/refs/heads/master
fi
# linux-6.12
bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_script/refs/heads/master/openwrt/build.sh) rc2 nanopi-r4s
# linux-6.12
bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_script/refs/heads/master/openwrt/build.sh) rc2 nanopi-r5s
# linux-6.12
bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_script/refs/heads/master/openwrt/build.sh) rc2 x86_64