使用Lean大神源码二次开发
coolsnowwolf/lede: Lean’s LEDE source (github.com)
注意
- 不要用root用户编译
- 国内用户编译前最好准备好梯子
- 默认登陆IP 192.168.1.1 密码 password
编译命令
1.系统推荐Debian 11 或 Ubuntu LTS,安装编译依赖
sudo apt update -ysudo apt full-upgrade -ysudo apt install -y ack antlr3 aria2 asciidoc autoconf automake autopoint binutils bison build-essential \bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \git gperf haveged help2man intltool libc6-dev-i386 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 libpython3-dev qemu-utils \rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev
2.下载源代码,更新feeds并选择配置
git clone https://github.com/coolsnowwolf/lede
cd lede
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
3.添加额外软件包
https://github.com/kenzok8/openwrt-packages
sed -i '$a src-git kenzo https://github.com/kenzok8/openwrt-packages' feeds.conf.default
sed -i '$a src-git small https://github.com/kenzok8/small' feeds.conf.default
git pull
./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig
4.下载 dl 库,编译固件(-j 后面是线程数,第一次编译推荐用单线程)
make download -j8
make V=sc -j1 FORCE_UNSAFE_CONFIGURE=1
二次编译
cd lede
git pull
./scripts/feeds update -a
./scripts/feeds install -a
make defconfig
make download -j8
make V=s -j$(nproc) FORCE_UNSAFE_CONFIGURE=1
如果需要重新配置:
rm -rf ./tmp && rm -rf .config
make menuconfig
make V=s -j$(nproc)
编译完成后输出路径:bin/targets
编译中遇到的一些错误,仅供参考
WSL2编译设置代理,设置proxy,可添加到.bashrc文件,例如我使用socks代理
export all_proxy=socks5://192.168.8.12:1080
即使设置了代理依然可能出现下载模块超时的情况,比如下载docker时遇到TLS error,多试几次就好了
GnuTLS recv error (-110): The TLS connection was non-properly terminated.
Golong被墙设置代理解决办法,二选一
1、 设置代理
export GOPROXY=https://proxy.golang.com.cn,direct
2、 在出错的软件修改makefile
export GO111MODULE=on
export GOPROXY=https://goproxy.cn
Microsoft/GSL错误
git clone https://github.com/Microsoft/GSL/ ./external/GSL
/home/laohu/lede/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/trojan-plus-10.0.3/external/GSL
ruby optparse (LoadError)
1、先make menuconfig,进入Languages->Ruby->ruby-optparse选上
2、删除残留
rm -rf staging_dir/hostpkg/lib/ruby
rm -rf staging_dir/hostpkg/include/ruby-*
rm staging_dir/hostpkg/lib/pkgconfig/ruby-*
rm staging_dir/hostpkg/bin/ruby
rm -rf build_dir/hostpkg/ruby-*