鉴于目前OpenWrt官方已经更新到25.12版本了。而lede为了兼容性还是基于较旧的版本,并使用iptables等旧的核心模块。
做为x86_64软路由的用户,决定迁移到更活跃的ImmortalWrt分支上。紧跟官方步调。
使用的是ImmortalWrt的官方源:

https://github.com/immortalwrt/immortalwrt

大体步骤与文档中描述的基本一致,但是因为是在arm64的主机上。因此有几个点与x86机器编译不同,这里记录一下。

检出代码官方推荐基于release tag,这样的代码虽然不是最新,但是更为稳定。
比如基于最新的v25.12.1tag:

git clone -b v25.12.1 --single-branch --filter=blob:none https://github.com/immortalwrt/immortalwrt

编译的系统是Ubuntu 24.04 aarch64。
首先安装编译环境的包就与x86不太一样。具体是:

sudo apt update -y
sudo apt full-upgrade -y
sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \
  bzip2 ccache clang cmake cpio curl device-tree-compiler ecj fastjar flex gawk gettext gcc-x86-64-linux-gnu \
  g++-x86-64-linux-gnu git golang gnutls-dev gperf haveged help2man intltool libelf-dev \
  libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses-dev libpython3-dev \
  libreadline-dev libssl-dev libtool libyaml-dev libz-dev lld llvm lrzsz mkisofs msmtp nano \
  ninja-build p7zip p7zip-full patch pkgconf python3 python3-pip python3-ply python3-docutils \
  python3-pyelftools qemu-utils re2c rsync scons squashfs-tools subversion swig texinfo uglifyjs \
  upx-ucl unzip vim wget xmlto xxd zlib1g-dev zstd

因为本人需要集成加强版geodata文件,要添加一个本地feeds:

src-link custom /home/ubuntu/openwrt/feeds

自用的feeds配置总结为:

src-link custom /home/ubuntu/openwrt/feeds
src-git lucky https://github.com/gdy666/luci-app-lucky.git
src-git passwall_packages https://github.com/Openwrt-Passwall/openwrt-passwall-packages.git;main
src-git passwall_luci https://github.com/Openwrt-Passwall/openwrt-passwall.git;main
src-git passwall2_luci https://github.com/Openwrt-Passwall/openwrt-passwall2.git;main

更新 feeds 什么的跟官方文档一样。

./scripts/feeds update -a
./scripts/feeds install -a

接下来,重点来了。必须多做一件与x86系统不同的配置,否则会报这个错误。

Makefile:366: * go-bootstrap cannot be installed on linux/arm64. Stop.

看报错信息,是编译过程无法安装go到arm64系统上。所以需要手动安装golang,并把路径设置到编译配置中。
在配置编译参数时:

make menuconfig

要加入以下设置:

Languages > Go > Configuration > External bootstrap Go root directory

按上面的环境安装后,go应该默认在 /usr/lib/go 目录下。将 /usr/lib/go 写入这项配置。

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

选好其它需要的配置后,开始编译:

make download -j8
make V=s -j1

慢慢等待编译完成吧。编译完成后输出路径:bin/targets

需要更新代码再次编译的话:

cd lede
git pull
./scripts/feeds update -a
./scripts/feeds install -a
make defconfig
make download -j8
make V=s -j$(nproc)

如果需要重新配置:

rm -rf ./tmp && rm -rf .config
make menuconfig
make V=s -j$(nproc)

标签: openwrt, arm64, ImmortalWrt, 软路由

添加新评论