第1次编译

  1. 进入ubuntu server的非root账户。
  2. 进入目录:
1
cd /home/Disk/2Tsda/app
  1. 按照lede的网址,进行刚开始的设置:
1
https://github.com/coolsnowwolf/lede/
  1. 更新系统
1
sudo apt-get update && sudo apt-get upgrade
  1. 安装依赖
1
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
  1. 下载源码
1
git clone https://github.com/coolsnowwolf/lede
  1. 进入lede,进入目录:
1
cd lede
  1. 更新源码:
1
./scripts/feeds update -a && ./scripts/feeds install -a
  1. 下载dl库(国内请尽量全局科学上网)。
1
make -j8 download V=s
  1. 选择所需要的组件:
1
make menuconfig
  • 编译丰富插件时,建议修改下面两项默认大小,留足插件空间。( x86/64 )
    Target Images —> (16) Kernel partition size (in MB) #默认是 (16) 建议修改 (256)
    Target Images —> (160) Root filesystem partition size (in MB) #默认是 (160) 建议修改 (512)
  • 支持 iPv6:(现阶段不需要,会导致电视的YouTubeNext无法播放)
    Extra packages —> ipv6helper (选定这个后下面几项自动选择了)
    Network —> odhcp6c
    Network —> odhcpd-ipv6only
    LuCI —> Protocols —> luci-proto-ipv6
    LuCI —> Protocols —> luci-proto-ppp
  • 我需要的插件
我所需要的插件 解释
luci-app-accesscontrol 上网时间控制
luci-app-adbyby-plus 广告屏蔽大师Plus +
luci-app-advancedsetting 系统 -高级设置
luci-app-arpbind IP/MAC绑定
luci-app-autoreboot 自动重启
luci-app-ddns 动态域名解析
luci-app-filetransfer 系统-文件传输
luci-app-firewall 防火墙
luci-app-jd-dailybonus 京东自动签到
luci-app-nlbwmon 网络带宽监视器
luci-app-ramfree 释放内存
luci-app-serverchan 服务-微信推送
luci-app-upnp 通用即插即用UPnP(端口自动转发)
luci-app-vlmcsd KMS服务器(WIN激活工具)
luci-app-vssr 服务-Hello world
luci-app-wol 网络唤醒
luci-app-wrtbwmon 实时流量监测
luci-app-zerotier zerotier服务
luci-app-flowoffload Turbo ACC FLOW转发加速
luci-app-sfe Turbo ACC网络加速(开启Fast Path转发加速)
luci-app-usb-printer USB 打印服务器
  • 如果想在编译的固件加上日期,修改
    文件位置:/home/Disk/2Tsda/app/lede/include/image.mk的第40行为:
1
IMG_PREFIX:=$(shell date +"%Y%m%d%M")-$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))

含义:
在固件的名字前加上时间戳:$(shell date +”%Y%m%d%M”)
结果是:2022011543-openwrt-x86-64-generic-squashfs-rootfs.img
我的命令是:

1
IMG_PREFIX:=$(shell date +"%m%d%M%S")-$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))

输出的文件名是(月+日+分钟+秒+名字):

1
01155224-openwrt-x86-64-generic-squashfs-rootfs.img

我的命令是:

1
IMG_PREFIX:=$(shell date +"%m%d-%M%S")-$(VERSION_DIST_SANITIZED)-$(IMG_PREFIX_VERNUM)$(IMG_PREFIX_VERCODE)$(IMG_PREFIX_EXTRA)$(BOARD)$(if $(SUBTARGET),-$(SUBTARGET))

输出的文件名是(月日+分秒+名字):

1
0115-2829-openwrt-x86-64-generic-squashfs-rootfs.img
  • 进入/package/base-files/files/etc/config上传原来的network文件
  1. 开始编译:
1
make -j5 V=s

  默认登陆IP 192.168.1.1, 密码 password

  • 第1次编译快捷命令:
1
cd /home/Disk/2Tsda/app && git clone https://github.com/coolsnowwolf/lede && cd lede && ./scripts/feeds update -a && ./scripts/feeds install -a && cd /home/Disk/2Tsda/app/lede/package/lean && svn checkout https://github.com/fszok/luci-app-advancedsetting/trunk luci-app-advancedsetting && svn checkout https://github.com/jerrykuku/luci-app-vssr/trunk luci-app-vssr && svn checkout https://github.com/jerrykuku/lua-maxminddb/trunk lua-maxminddb && svn checkout https://github.com/yichya/luci-app-xray/trunk  luci-app-xray && svn checkout https://github.com/kenzok8/small/trunk small && svn checkout https://github.com/yichya/openwrt-xray/trunk  openwrt-xray && cd /home/Disk/2Tsda/app/lede && git pull && ./scripts/feeds update -a && ./scripts/feeds install -a  && make -j8 download V=s && make menuconfig && make -j5 V=s

第2次编译

  • 第2次编译快捷命令:
1
cd /home/Disk/2Tsda/app/lede/package/lean && svn checkout https://github.com/fszok/luci-app-advancedsetting/trunk luci-app-advancedsetting && svn checkout https://github.com/jerrykuku/luci-app-vssr/trunk luci-app-vssr && svn checkout https://github.com/jerrykuku/lua-maxminddb/trunk lua-maxminddb && svn checkout https://github.com/yichya/luci-app-xray/trunk  luci-app-xray && svn checkout https://github.com/kenzok8/small/trunk small && svn checkout https://github.com/yichya/openwrt-xray/trunk  openwrt-xray && cd /home/Disk/2Tsda/app/lede && git pull && ./scripts/feeds update -a && ./scripts/feeds install -a  &&  make -j8 download V=s && rm -rf ./tmp && make -j5 V=s
  • 调整后
1
cd /home/Disk/2Tsda/app/lede/package/lean && rm -rf luci-app-advancedsetting && rm -rf luci-app-vssr && rm -rf lua-maxminddb && rm -rf luci-app-xray && rm -rf   small  && rm -rf  openwrt-xray  && svn checkout https://github.com/fszok/luci-app-advancedsetting/trunk luci-app-advancedsetting && svn checkout https://github.com/jerrykuku/luci-app-vssr/trunk luci-app-vssr && svn checkout https://github.com/jerrykuku/lua-maxminddb/trunk lua-maxminddb && svn checkout https://github.com/yichya/luci-app-xray/trunk  luci-app-xray && svn checkout https://github.com/kenzok8/small/trunk small && svn checkout https://github.com/yichya/openwrt-xray/trunk  openwrt-xray && cd /home/Disk/2Tsda/app/lede && git pull && ./scripts/feeds update -a && ./scripts/feeds install -a  &&  make -j8 download V=s && rm -rf ./tmp && make -j5 V=s
  • 再次调整(删掉了advancesetting,保留了其他)
1
cd /home/Disk/2Tsda/app/lede/package/lean  && rm -rf luci-app-vssr && rm -rf lua-maxminddb && rm -rf luci-app-xray && rm -rf   small  && rm -rf  openwrt-xray   && svn checkout https://github.com/jerrykuku/luci-app-vssr/trunk luci-app-vssr && svn checkout https://github.com/jerrykuku/lua-maxminddb/trunk lua-maxminddb && svn checkout https://github.com/yichya/luci-app-xray/trunk  luci-app-xray && svn checkout https://github.com/kenzok8/small/trunk small && svn checkout https://github.com/yichya/openwrt-xray/trunk  openwrt-xray && cd /home/Disk/2Tsda/app/lede && git pull && ./scripts/feeds update -a && ./scripts/feeds install -a  &&  make -j8 download V=s && rm -rf ./tmp && make -j5 V=s

之前用的更新插件的命令:

  1. 进入文件目录
1
cd /home/Disk/2Tsda/app/lede/package/lean
  1. 使用以下命令更新:下载插件
1
2
3
4
5
6
7
8
9
svn checkout https://github.com/fszok/luci-app-advancedsetting/trunk luci-app-advancedsetting
svn checkout https://github.com/jerrykuku/luci-app-vssr/trunk luci-app-vssr
svn checkout https://github.com/jerrykuku/lua-maxminddb/trunk lua-maxminddb
svn checkout https://github.com/yichya/luci-app-xray/trunk luci-app-xray
svn checkout https://github.com/kenzok8/small/trunk small
svn checkout https://github.com/yichya/openwrt-xray/trunk openwrt-xray
可选
svn checkout https://github.com/iv7777/luci-app-pptp-server/trunk luci-app-pptp-server
svn checkout https://github.com/rufengsuixing/luci-app-adguardhome/trunk luci-app-adguardhome
  1. SVN的用法参考
    https://www.cnblogs.com/tqj-zyy/p/4559758.html

问题1 无法覆盖

  1. Please commit your changes or stash them before you merge。解决方法:直接完全覆盖本地修改
1
2
git reset --hard
git pull

问题2 缺少vssr的依赖

  1. 缺少依赖
1
2
WARNING: Makefile 'package/lean/luci-app-vssr/Makefile' has a dependency on 'xray-plugin', which does not exist
WARNING: Makefile 'package/lean/luci-app-xray/Makefile' has a dependency on 'openwrt-xray', which does not exist

  解决
  https://github.com/kenzok8/small
  https://github.com/yichya/openwrt-xray

1
2
3
4
5
6
7
8
cd /home/Disk/2Tsda/app/lede/package
git clone https://github.com/kenzok8/small.git
git clone https://github.com/yichya/openwrt-xray.git
cd /home/Disk/2Tsda/app/lede
git pull
./scripts/feeds update -a && ./scripts/feeds install -a
make menuconfig
make -j5 V=s
  1. 第二种报错
1
2
WARNING: Makefile 'package/feeds/helloworld/luci-app-ssr-plus/Makefile' has a dependency on 'shadowsocksr-libev-alt', which does not exist
WARNING: Makefile 'package/feeds/helloworld/luci-app-ssr-plus/Makefile' has a dependency on 'shadowsocksr-libev-server', which does not exist

  这个是lean的ssr-plus缺的依赖,不编译它,所以可以不用管。

问题3 缺少dl文件夹内的文件

  1. 文件下载错误导致
1
2
3
4
5
6
7
8
9
10
11
12
13
Makefile:44: recipe for target '/home/Disk/2Tsda/app/lede/dl/vlmcsd-svn1113.tar.gz' failed
make[3]: *** [/home/Disk/2Tsda/app/lede/dl/vlmcsd-svn1113.tar.gz] Error 2
make[3]: Leaving directory '/home/Disk/2Tsda/app/lede/package/lean/vlmcsd'
time: package/lean/vlmcsd/compile#0.27#0.13#0.40
ERROR: package/lean/vlmcsd failed to build.
package/Makefile:114: recipe for target 'package/lean/vlmcsd/compile' failed
make[2]: *** [package/lean/vlmcsd/compile] Error 1
make[2]: Leaving directory '/home/Disk/2Tsda/app/lede'
package/Makefile:110: recipe for target '/home/Disk/2Tsda/app/lede/staging_dir/target-x86_64_musl/stamp/.package_compile' failed
make[1]: *** [/home/Disk/2Tsda/app/lede/staging_dir/target-x86_64_musl/stamp/.package_compile] Error 2
make[1]: Leaving directory '/home/Disk/2Tsda/app/lede'
/home/Disk/2Tsda/app/lede/include/toplevel.mk:228: recipe for target 'world' failed
make: *** [world] Error 2

  灵感来源的链接
  编译错误提示如下,可以看出是vlmcsd-svn1113.tar.gz这个文件没有下载导致的。
  因此下载这个文件后,把它放在/home/Disk/2Tsda/app/lede/dl中,即可。
  或者可以通过命令下载全部依赖包:make download V=s
  如果还是不行,通过命令清理缓存:make clean