自行编译OpenWrt(LEDE) 固件

2025 年 2 月 3 日 星期一

阅读此文章之前,你可能需要首先阅读以下的文章才能更好的理解上下文。

自行编译OpenWrt(LEDE) 固件

在 x86 平台编译可直接参考官方文档,在 arm 平台编译需要略作修改

X86 平台

apt update -y
apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
bzip2 ccache clang cmake cpio curl device-tree-compiler flex gawk gcc-multilib g++-multilib gettext \
genisoimage git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libfuse-dev libglib2.0-dev \
libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libpython3-dev \
libreadline-dev libssl-dev libtool llvm lrzsz msmtp ninja-build p7zip p7zip-full patch pkgconf \
python3 python3-pyelftools python3-setuptools qemu-utils rsync scons squashfs-tools subversion \
swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev

git clone https://github.com/coolsnowwolf/lede --depth=1
cd lede
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig    # 非首次编译 make defconfig

make download -j$(nproc)
make V=s -j$(nproc) || make V=s -j1     # 首次编译时使用多线程可能失败

编译后固件位于./bin/targets

ARM 平台

总体上与 X86 一样,安装依赖:

apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext  gcc-arm-linux-gnueabihf \
g++-arm-linux-gnueabihf git golang gperf haveged help2man intltool libelf-dev libglib2.0-dev \
libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \
mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip qemu-utils \
rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev

修改配置Languages > Go > Configuration > External bootstrap Go root directory,填/usr/lib/go

(/usr/lib/go) External bootstrap Go root directory

否则编译会报错

编译 easytier 插件

git clone https://github.com/EasyTier/luci-app-easytier --depth=1
cp -r luci-app-easytier/luci-app-easytier feeds/luci/applications
rm -rf luci-app-easytier
./scripts/feeds update -a
./scripts/feeds install -a

配置时在LuCI > Applications里勾选luci-app-easytier

参考

https://winger.alundra.uk/index.php/archives/8/

使用社交账号登录

  • Loading...
  • Loading...
  • Loading...
  • Loading...
  • Loading...