LEDE源码编译教程

LEDE源码编译教程

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

Rockchip RK3568 预编译固件发布 Release 下载更新地址 (包括 H68K ):https://github.com/coolsnowwolf/lede/releases/tag/20220716

注意: 

XML/HTML代码
  1. 尽量不要用 root 用户进行编译  
  2. 国内用户编译前最好准备好梯子  
  3. 默认登陆IP 192.168.1.1 密码 password  

编译命令: 

1.首先装好 Linux 系统,推荐 Debian 11 或 Ubuntu LTS(Linux Mint Team 的Linux Mint 21和LMDE 5

2.安装编译依赖

XML/HTML代码
  1. sudo apt update -y  
  2. sudo apt full-upgrade -y  
  3. sudo apt install -y ack antlr3 aria2 asciidoc autoconf automake autopoint binutils bison build-essential \  
  4. bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib \  
  5. git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \  
  6. libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \  
  7. mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip libpython3-dev qemu-utils \  
  8. rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev  

3.下载源代码,更新 feeds 并选择配置 

XML/HTML代码
  1. git clone https://github.com/coolsnowwolf/lede    
  2. cd lede    
  3. ./scripts/feeds update -a && ./scripts/feeds install -a  
  4. make menuconfig    

4.下载 dl 库,编译固件 (-j 后面是线程数,第一次编译推荐用单线程) 

XML/HTML代码
  1. make download -j8  
  2. make V=s -j1  

本套代码保证肯定可以编译成功。里面包括了 R22 所有源代码,包括 IPK 的。

5.二次编译

XML/HTML代码
  1. cd lede  
  2. git pull  
  3. ./scripts/feeds update -a && ./scripts/feeds install -a  
  4. make menuconfig    
  5. make defconfig  
  6. make download -j8  
  7. make -j$(($(nproc) + 1)) V=s

如果需要重新配置:

 XML/HTML代码

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

编译完成后输出路径:bin/targets

简单编译命令,只要默认或者修改不是很多,也基本一次成功。

首次编译

XML/HTML代码
  1. git clone https://github.com/coolsnowwolf/lede    
  2. cd lede    
  3. ./scripts/feeds update -a && ./scripts/feeds install -a  
  4. make menuconfig    
  5. make -j$(($(nproc) + 1)) V=s 

二次编译

XML/HTML代码
  1. cd lede  
  2. git pull  
  3. ./scripts/feeds update -a && ./scripts/feeds install -a  
  4. make menuconfig
  5. make -j$(($(nproc) + 1)) V=s

feeds.conf.default 

XML/HTML代码
  1. src-git helloworld      https://github.com/fw876/helloworld.git    
  2. src-git passwall        https://github.com/xiaorouji/openwrt-passwall.git;packages  
  3. src-git passwall2       https://github.com/xiaorouji/openwrt-passwall2.git;packages      
  4. src-git passwall_luci   https://github.com/xiaorouji/openwrt-passwall.git;luci
  5. src-git OpenClash       https://github.com/vernesong/OpenClash.git    

 passwall现在分为package和luci两个分支.

XML/HTML代码
  1. src-git passwall_packages https://github.com/xiaorouji/openwrt-passwall.git;packages  
  2. src-git passwall_luci https://github.com/xiaorouji/openwrt-passwall.git;luci  

 passwall2

XML/HTML代码
  1. src-git passwall_packages https://github.com/xiaorouji/openwrt-passwall.git;packages  
  2. src-git passwall2 https://github.com/xiaorouji/openwrt-passwall2.git  

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用户环境下编译,需要输入命令禁用环境。

XML/HTML代码
  1. export FORCE_UNSAFE_CONFIGURE=1 
  2. 或者
  3. export FORCE=1  
  4. 或者在编译目录运行
  5. sudo make FORCE_UNSAFE_CONFIGURE=1

在线编译网站:https://supes.top/                       https://op.supes.top/

第三方插件仓库:
https://github.com/liuran001/openwrt-packages
https://github.com/kenzok8/openwrt-packages
https://github.com/kenzok8/small-package
https://github.com/kiddin9/openwrt-packages
https://github.com/NueXini/NueXini_Packages

openwrt固件与插件下载(kenzo):
https://op.dllkids.xyz/
 
ImmortalWrt:https://github.com/immortalwrt/immortalwrt
Download:https://downloads.immortalwrt.org/
在线编译网站:https://firmware-selector.immortalwrt.org/
 
精品系统:
eSir谷歌云盘:https://drive.google.com/drive/folders/1dqNUrMf9n7i3y1aSh68U5Yf44WQ3KCuh
sirpdboy固件:https://github.com/sirpdboy/openwrt
 
常用的 OpenWRT & LEDE x86_64 热门固件
XML/HTML代码
  1. # iStoreOS  
  2. https://fw.koolcenter.com/iStoreOS/x86_64/  
  3. # DHDAXCW(骷髅头)  
  4. https://github.com/DHDAXCW/OpenWRT_x86_x64  
  5. # SuLingGG  
  6. https://openwrt.cc/releases/targets/x86/64/  
  7. # coolsnowwolf  
  8. https://github.com/coolsnowwolf/lede  
  9. # immortalwrt  
  10. https://github.com/immortalwrt/immortalwrt  
编译教程:
安装编译必须组件(系统要求同LEDE)
XML/HTML代码
  1. sudo apt update -y  
  2. sudo apt full-upgrade -y  
  3. sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential \  
  4.   bzip2 ccache cmake cpio curl device-tree-compiler ecj fastjar flex gawk gettext gcc-multilib g++-multilib \  
  5.   git gperf haveged help2man intltool lib32gcc-s1 libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev \  
  6.   libmpc-dev libmpfr-dev libncurses5-dev libncursesw5 libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz \  
  7.   mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip python3-ply \  
  8.   python-docutils qemu-utils re2c rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip \  
  9.   vim wget xmlto xxd zlib1g-dev  
或者一键安装脚本:
XML/HTML代码
  1. sudo bash -c 'bash <(curl -s https://build-scripts.immortalwrt.eu.org/init_build_environment.sh)'  

首次编译

XML/HTML代码
  1. git clone -b master  --single-branch https://github.com/immortalwrt/immortal
  2. wrt
  3. cd immortalwrt
  4. ./scripts/feeds update -a && ./scripts/feeds install -a
  5. make menuconfig
  6. 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

二次编译
XML/HTML代码
  1. cd immortalwrt
  2. git pull
  3. ./scripts/feeds update -a && ./scripts/feeds install -a
  4. make menuconfig
  5. make -j$(($(nproc) + 1)) V=s
最新版本的LEDE内核已经升级到了6.1,占用资源更大,如果想切换到5.x核心,以X86为例,在 lede/target/linux/x86 目录下可以看到多个内核版本,config-5.4 config-5.10 config-5.15 config-6.1 这几个就是内核版本,选择你需要的版本,编译此目录下 Makefile 文件,修改 KERNEL_PATCHVER:=5.15 即可以编译5.15内核的LEDE。简单来说 以x86为例 /target/linux/x86/Makefile  修改 KERNEL_PATCHVER:=内核版本。保存编译OK。

上一篇: Linux如何修改只读文件
下一篇: Win11安装过程跳过强制联网

访客评论
目前还没有人评论,您发表点看法?
发表评论

评论内容 (必填):