LEDE源码编译教程
Github:https://github.com/coolsnowwolf/lede
Rockchip RK3568 预编译固件发布 Release 下载更新地址 (包括 H68K ):https://github.com/coolsnowwolf/lede/releases/tag/20220716
注意:
- 尽量不要用 root 用户进行编译
- 国内用户编译前最好准备好梯子
- 默认登陆IP 192.168.1.1 密码 password
编译命令:
1.首先装好 Linux 系统,推荐 Debian 11 或 Ubuntu LTS(Linux Mint Team 的Linux Mint 21和LMDE 5)
2.安装编译依赖
- sudo apt update -y
- sudo apt full-upgrade -y
- sudo 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
3.下载源代码,更新 feeds 并选择配置
- git clone https://github.com/coolsnowwolf/lede
- cd lede
- ./scripts/feeds update -a && ./scripts/feeds install -a
- make menuconfig
4.下载 dl 库,编译固件 (-j 后面是线程数,第一次编译推荐用单线程)
- make download -j8
- make V=s -j1
本套代码保证肯定可以编译成功。里面包括了 R22 所有源代码,包括 IPK 的。
5.二次编译
- cd lede
- git pull
- ./scripts/feeds update -a && ./scripts/feeds install -a
- make menuconfig
- make defconfig
- make download -j8
- make -j$(($(nproc) + 1)) V=s
如果需要重新配置:
XML/HTML代码
- rm -rf ./tmp && rm -rf .config
- make menuconfig
- make -j$(($(nproc) + 1)) V=s
编译完成后输出路径:bin/targets
简单编译命令,只要默认或者修改不是很多,也基本一次成功。
首次编译
- git clone https://github.com/coolsnowwolf/lede
- cd lede
- ./scripts/feeds update -a && ./scripts/feeds install -a
- make menuconfig
- make -j$(($(nproc) + 1)) V=s
二次编译
- cd lede
- git pull
- ./scripts/feeds update -a && ./scripts/feeds install -a
- make menuconfig
- make -j$(($(nproc) + 1)) V=s
feeds.conf.default
- src-git helloworld https://github.com/fw876/helloworld.git;master
- src-git passwall https://github.com/xiaorouji/openwrt-passwall.git;main
- src-git passwall2 https://github.com/xiaorouji/openwrt-passwall2.git;main
- src-git passwall_packages https://github.com/xiaorouji/openwrt-passwall-packages.git;main
- src-git OpenClash https://github.com/vernesong/OpenClash.git;master
src-git homeproxy https://github.com/immortalwrt/homeproxy.git (不兼容lean的OP,防火墙冲突)
passwall现在分为package和luci两个分支.
- src-git passwall_packages https://github.com/xiaorouji/openwrt-passwall-packages.git;main
- src-git passwall https://github.com/xiaorouji/openwrt-passwall.git;main
passwall2
- src-git passwall_packages https://github.com/xiaorouji/openwrt-passwall-packages.git;main
- src-git passwall2 https://github.com/xiaorouji/openwrt-passwall2.git;main
lede/package/base-files/files/bin/config_generate
搜索192.168.1.1,找到下面的地址,修改即可修改编译的LEDE的默认地址。
lan) ipad=${ipaddr:-"192.168.1.1"} ;;
LEDE根目录下.config就是编译的固件配置,备份下在编译其他修改版本,可以避免出错。
lean大的openwrt不支持在root用户环境下编译,需要输入命令禁用环境。
- export FORCE_UNSAFE_CONFIGURE=1
- 或者
- export FORCE=1
- 或者在编译目录运行
- sudo make FORCE_UNSAFE_CONFIGURE=1
- #查看分支
- git tag
- #切换到20221001分支
- git checkout 20221001
- # iStoreOS
- https://fw.koolcenter.com/iStoreOS/x86_64/
- # DHDAXCW(骷髅头)
- https://github.com/DHDAXCW/OpenWRT_x86_x64
- # SuLingGG
- https://openwrt.cc/releases/targets/x86/64/
- # coolsnowwolf
- https://github.com/coolsnowwolf/lede
- # immortalwrt
- https://github.com/immortalwrt/immortalwrt
- 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 ecj fastjar flex gawk gettext gcc-multilib g++-multilib \
- git gperf haveged help2man intltool lib32gcc-s1 libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \
- libmpc-dev libmpfr-dev libncurses5-dev libncursesw5 libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \
- mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip python3-ply \
- python-docutils qemu-utils re2c rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip \
- vim wget xmlto xxd zlib1g-dev
- sudo bash -c 'bash <(curl -s https://build-scripts.immortalwrt.eu.org/init_build_environment.sh)'
首次编译
- git clone -b master --single-branch https://github.com/immortalwrt/immortalwrt
- cd immortalwrt
- ./scripts/feeds update -a && ./scripts/feeds install -a
- make menuconfig
- make -j$(($(nproc) + 1)) V=s
git clone -b <branch> --single-branch https://github.com/immortalwrt/immortalwrt
分支有:master openwrt-21.02 openwrt-18.06-k5.4 openwrt-18.06
- cd immortalwrt
- git pull
- ./scripts/feeds update -a && ./scripts/feeds install -a
- make menuconfig
- make -j$(($(nproc) + 1)) V=s
- Lean’Openwrt
- Extra packages --> ipv6helper
- NetWork --> Firewall --> ip6tables 下的俩个全选
- 原版 22.03 固件需要启用这 4 个 odhcp6c odhcpd ip6tables luci-proto-ipv6
- odhcpd 可替换成 odhcpd6
- git clone https://github.com/coolsnowwolf/lede.git
- cd lede
- git reset --hard b201c29fa2749a6265ebf0b80ac3a94ad34ba6e4
- export FORCE_UNSAFE_CONFIGURE=1
- ./scripts/feeds update -a && ./scripts/feeds install -a
- make menuconfig
- make -j$(($(nproc) + 1)) V=s
- src-git helloworld https://github.com/fw876/helloworld.git;master
- src-git passwall https://github.com/xiaorouji/openwrt-passwall.git;main
- src-git passwall_packages https://github.com/xiaorouji/openwrt-passwall-packages.git;main
- src-git OpenClash https://github.com/vernesong/OpenClash.git;master
- sed -i 's/ +libopenssl-legacy//g' feeds/helloworld/shadowsocksr-libev/Makefile
- option github_address_mod '0'
- 改成
- option github_address_mod 'https://mirror.ghproxy.com/'