Openwrt构建

Openwrt构建

编译环境搭建

一些常用命令

  • 跟着install-buildsystem安装一堆包
  • 跟着use-buildsystem克隆源码
  • 跟着using_official_build_config构建一个路由器能用的镜像。下载config.buildinfo文件到.config。
    • 我手头的路由器是AX6S,ROM的下载链接是:http://downloads.openwrt.org/releases/23.05.0/targets/mediatek/mt7622/openwrt-23.05.0-mediatek-mt7622-xiaomi_redmi-router-ax6s-squashfs-factory.bin,所以我就执行:wget https://mirror-01.infra.openwrt.org/releases/23.05.0/targets/mediatek/mt7622/config.buildinfo -O .configwget https://mirror-01.infra.openwrt.org/releases/23.05.0/targets/mediatek/mt7622/feeds.buildinfo -O feeds.conf
  • 构建GRE、netifd包:make package/network/config/netifd/compile V=s (加上了V=s可以看到使用的相关命令)

重新构建一切

make dirclean defconfig download clean world

包编译的细节

  • 首先源码的压缩包,会被下载:openwrt/dl/netifd-2023-09-19-7a58b995.tar.xz
  • 然后被解压:openwrt/build_dir/target-aarch64_cortex-a53_musl/netifd-2023-09-19-7a58b995
  • 在上面文件夹里进行编译
  • 被安装:openwrt/build_dir/target-aarch64_cortex-a53_musl/netifd-2023-09-19-7a58b995/ipkg-install/usr/sbin/netifd
  • 打包

单个包的开发

给核心仓库提交代码

  • Submitting patches页面,提到了核心包可以通过Github PR或者邮件列表提交。
  • 这个Patch先出现在邮件列表,然后commit才出现在netifd的列表里,说明他们还是在用mailing list的,可以考虑直接写patch交patch。

给包增加Patch

https://openwrt.org/docs/guide-developer/toolchain/use-patches-with-buildsystem

quilt import https://github.com/am009/mosdns/commit/4f90490dc7c56c94880f09b5bf2542ac65d97530.patch