标签 openwrt 下的文章

2025年3月更新:
此方法已经失效!
至2025年3月,openwrt lede分支已经更新到23.05版本。已默认集成了argon主题,直接在原生代码的配置中打开即可。


自己编译了openwrt固件,朋友试用之后,说web管理界面太丑了……
我是实用派,一开始完全没在意外观的问题。听朋友这么一说决定给换个默认主题。

看了一下目前lean使用的主流界面是argon,就决定用它了。

https://github.com/jerrykuku/luci-theme-argon.git

根据argon官方文档的说法,他的主分支是跟随openwrt官方版本的。而lean目前只支持18.06这个分支。

首先进入lede的根目录中,拉取最新的代码:

cd lede
rm -rf package/lean/luci-theme-argon
git clone -b 18.06 https://github.com/jerrykuku/luci-theme-argon.git package/lean/luci-theme-argon

替换默认主题:

sed -i 's/luci-theme-bootstrap/luci-theme-argon/' feeds/luci/collections/luci/Makefile

因为个人有点小洁癖,不喜欢带不需要的东西,所以只想带一个主题。运行:

make menuconfig

进入LUCI->Theme,选中Luci-theme-argon,并去掉原来默认的luci-theme-bootstrap主题。

接下来正常编译就行了。

使用的是lean的源:

https://github.com/coolsnowwolf/lede.git

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

编译的系统是Ubuntu 20.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 cmake cpio curl device-tree-compiler fastjar flex gawk gettext  gcc-multilib-arm-linux-gnueabihf \
g++-multilib-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

2025年更新,最新的lede分支已经包含了以下两个源的绝大多数重点内容,没有特别需求可以不用添加了。
用git拉回代码后,还需要加入特别需要的包。
feeds.conf.default 文件中添加几行:

src-git passwall_packages https://github.com/xiaorouji/openwrt-passwall-packages.git;main
src-git passwall_luci https://github.com/xiaorouji/openwrt-passwall.git;main
src-git passwall2_luci https://github.com/xiaorouji/openwrt-passwall2.git;main

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

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

更新 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)

PS:第一次编译有概率会出现一个错误。

bash: po2lmo: command not found

这个是因为包依赖关系没有处理好,被依赖的luci-base包没有先编译出来。所以只要先编译好就可以了。
用以下命令指定编译luci-base

make package/feeds/luci/luci-base/compile V=99

给编译的固件加个自己的签名……

cd lede
vim package/lean/default-settings/files/zzz-default-settings

找到DISTRIB_REVISION或者DISTRIB_DESCRIPTION,加上想要添加的内容。比如:

(Compiled by winger. On $(date +%F))