NanoPi R4S: https://r4s.cooluc.com
NanoPi R5S/R5C: https://r5s.cooluc.com
X86_64: https://x86.cooluc.com
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-15,可以通过 llvm 官方提供源安装:https://apt.llvm.org
# debian 11
sudo sh -c 'echo "deb http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-15 main" >> /etc/apt/sources.list'
sudo sh -c 'echo "deb-src http://apt.llvm.org/bullseye/ llvm-toolchain-bullseye-15 main" >> /etc/apt/sources.list'
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y clang-15
# ubuntu 20.04
sudo sh -c 'echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" >> /etc/apt/sources.list'
sudo sh -c 'echo "deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal-15 main" >> /etc/apt/sources.list'
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y clang-15
# debian 12 or latest & ubuntu 22 or latest
sudo apt-get update
sudo apt-get install -y clang-15
启用 Clang/LLVM 构建内核
export KERNEL_CLANG_LTO=y
启用 glibc (实验性)
export USE_GLIBC=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 USE_MOLD=y
启用 eBPF 支持
export ENABLE_BPF=y
启用 LRNG
export ENABLE_LRNG=y
脚本会使用 toolchain 缓存代替源码构建,与常规构建相比能节省大约 60 分钟的编译耗时,仅适用于 Github Actions ubuntu-22.04
环境
export BUILD_FAST=y
export MINIMAL_BUILD=y
export LAN=10.0.0.1
# linux-6.6
bash <(curl -sS https://init2.cooluc.com/build.sh) rc2 nanopi-r4s
# linux-6.6
bash <(curl -sS https://init2.cooluc.com/build.sh) rc2 nanopi-r5s
# linux-6.6
bash <(curl -sS https://init2.cooluc.com/build.sh) rc2 x86_64
# linux-6.6
bash <(curl -sS https://init2.cooluc.com/build.sh) dev nanopi-r4s
# linux-6.6
bash <(curl -sS https://init2.cooluc.com/build.sh) dev nanopi-r5s
# linux-6.6
bash <(curl -sS https://init2.cooluc.com/build.sh) dev x86_64
将 init.cooluc.com 脚本默认连接替换为你的 github raw 连接(不带 https://),像这样 raw.githubusercontent.com/你的用户名/r4s_build_script/master
# script url
if [ "$isCN" = "CN" ]; then
- export mirror=init.cooluc.com
+ export mirror=raw.githubusercontent.com/你的用户名/r4s_build_script/master
else
- export mirror=init2.cooluc.com
+ export mirror=raw.githubusercontent.com/你的用户名/r4s_build_script/master
fi
# linux-6.6
bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_script/master/openwrt/build.sh) rc2 nanopi-r4s
# linux-6.6
bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_script/master/openwrt/build.sh) rc2 nanopi-r5s
# linux-6.6
bash <(curl -sS https://raw.githubusercontent.com/你的用户名/r4s_build_script/master/openwrt/build.sh) rc2 x86_64