目 录CONTENT

文章目录

OpenWrt编译笔记

Administrator
2021-02-17 / 0 评论 / 1 点赞 / 328 阅读 / 9142 字

> 编译前相关 - [OpenWrt 编译 LuCI -> Applications 添加插件应用说明](https://www.right.com.cn/forum/thread-344825-1-1.html) - [OpenWrt实用插件指南](https://reallovebot.club/content.html?id=4)

查看空间容量:

df -h

$ ps -e | grep apt

显示:

11669 ?        00:00:02 aptd
25379 ?        00:00:00 update-apt-xapi

然后就执行

$ sudo kill 25379
$ sudo apt-get update
    • 方法二:
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock

  • [ ] 预先下载dl库,可以避免下载造成的编译失败。下载后拷贝到 /dl里面
make download V=s

make -j1 V=s

  • [ ] 清除bin和编译好的二进制过渡文件(慎用)
make clean
  • [ ] make dirclean=[make clean]+[清除交叉编译工具及工具链目录](慎用)
make dirclean
  • [ ] 清空编译环境, make distclean=[清除所有相关的东西,包括下载的软件包,配置文件,feed内容等]
make distclean -j1 V=s
  • [ ] 重新编译清除选项:
rm -rf build_dir staging_dir tmp

  • [ ] 重新配置
rm -rf ./tmp
rm -rf .config

> 开始编译 # - ## [openwrt编译笔记](https://www.right.com.cn/forum/thread-469400-1-1.html)
  • [x] 系统更新
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

curl -s https://build-scripts.immortalwrt.eu.org/init_build_environment.sh | sudo bash
  • [x] 下载源码
git clone https://github.com/coolsnowwolf/lede

git clone -b openwrt-18.06 --single-branch https://github.com/immortalwrt/immortalwrt && cd immortalwrt
  • [ ] 切换到dev分支或master主分支(慎用):
git checkout dev
git checkout master
  • [ ] clone分支(示例):
git clone https://github.com/coolsnowwolf/lede -b master 
git clone https://github.com/coolsnowwolf/lede -b dev 
  • [x] 进入目录:
cd openwrt
  • [x] 更新源+安装源:
./scripts/feeds update -a
./scripts/feeds install -a

或一次性更新feed

./scripts/feeds update -a && ./scripts/feeds install -a
  • [x] 打开配置:
make menuconfig
  • [ ] 打开内核配置(慎用):
make kernel_menuconfig

(一定要在file systems的Native language support设置好,不然网络共享文件名乱码)

  • [x] 配置差异部分
make defconfig
./scripts/diffconfig.sh > seed.config
  • [x] 提前下载DL库
make download V=s
  • [x] 编译
make -j1 V=s

(-jn的n为电脑cpu的进程数)


  • [ ] 非第一次编译
cd openwrt
git pull
./scripts/feeds update -a && ./scripts/feeds install -a
rm -rf ./tmp && rm -rf .config
make menuconfig
make kernel_menuconfig
make -j2 V=s
  • [ ] 没关闭终端的情况下简化为
rm -rf ./tmp
make menuconfig
make -j2 V=s

> 补充说明
  • [ ] 部分插件在branch分支,如Openclash(可选):
 git clone https://github.com/vernesong/OpenClash -b master package/lean/luci-app-openclash

  • [ ] 插件:

  • 路径:lede/feeds.conf.default

    • HelloWorld
src-git helloworld https://github.com/fw876/helloworld
    • PassWall
src-git passwall https://github.com/xiaorouji/openwrt-passwall
    • luci-app-unblockneteasemusic
src-git luci-app-unblockneteasemusic https://github.com/UnblockNeteaseMusic/luci-app-unblockneteasemusic

前面的注释符号去掉,再更新一次feeds即可


  • [ ] 修改ip
sed -i 's/192.168.1.1/192.168.0.1/g' package/base-files/files/bin/config_generate
  • [ ] 修改默认主题

  • 改源码的话,在 feeds/luci/collections/luci 文件夹下面的 Makefile 文件里面,找到 LUCI_DEPENDS 这一项,

  • 替换 and the default Bootstrap themeand the default Argon theme

  • 替换luci-theme-bootstrapluci-theme-argon (其它主题替换同理)

sed -i 's/luci-theme-bootstrap/luci-theme-argon-dark-mod/g' package/feeds/luci/luci/Makefile

  • 重新更新安装feeds 即可在make menuconfig里面默认选中你要的主题了,也会默认启用。

《【视频教程】OP/LEDE软路由当旁路由加速上网设置教程》

image


  • [ ] DHCP与AP示例

K2关掉DHCP 删掉防火墙劫持DNS的命令

K2/新三 改为WDS桥接

K2 LAN IP和新三改成一个段 网关指向软路由 DNS指向新三

  • 改ip

CONFIG_TARGET_PREINIT_IP="192.168.1.1"

CONFIG_TARGET_PREINIT_BROADCAST="192.168.1.255"

  • [ ] 临时打补丁以修正Bug示例
wget -O package/lean/qBittorrent/Makefile https://raw.githubusercontent.com/coolsnowwolf/lede/5001036ea61ec091dd990325d946dd7ff2ec6286/package/lean/qBittorrent/Makefile 
wget -O /usr/share/shadowsocksr/subscribe.lua https://raw.githubusercontent.com/coolsnowwolf/lede/b9ee8de9d6907fedb5b6c51f407deb4e2b200f72/package/lean/luci-app-ssr-plus/root/usr/share/shadowsocksr/subscribe.lua

  • [ ] Docker
/etc/docker-init
1
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin
  3. QQ打赏

    qrcode qq

评论区