准备编译环境:
推荐使用ubuntu,源码作者推荐使用Ubuntu 18 LTS x64 本篇使用系统为Ubuntu 20.10 LXC模板
注意:
- 不要用 root 用户进行编译!!!
- 国内用户编译前最好准备好梯子
- 默认登陆IP 192.168.1.1 密码 password
更换阿里源:
sudo mv /etc/apt/sources.list /etc/apt/sources.list.bak nano /etc/apt/sources.list 添加下面的源地址 deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
命令行输入:
sudo apt-get update sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch python3 python2.7 unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint device-tree-compiler g++-multilib antlr3 gperf wget curl swig rsync
下载源码:
git clone https://github.com/coolsnowwolf/lede
cd lede目录,执行对应命令:
./scripts/feeds update -a ./scripts/feeds install -a make menuconfig
然后下载对应dl库:
make -j8 download V=s
输入命令开始编译:
make -j1 V=s \\为了保证编译成功率建议使用1线程
二次编译:
cd lede git pull ./scripts/feeds update -a && ./scripts/feeds install -a make defconfig make -j8 download make -j$(($(nproc) + 1)) V=s
如果需要重新配置:
rm -rf ./tmp && rm -rf .config make menuconfig make -j$(($(nproc) + 1)) V=s
编译完成后固件输出目录:
lede/bin/targets