如何手动编译 OpenWrt 软件包
教你自己手动单独编译某一个 OpenWrt 软件包 - 无需编译整个固件
因为我下载的路由器固件不包含我想要的多拨插件 luci-app-syncdial,所以我需要自己手动编译。这里整理一下编译的流程。
找到并下载需要编译的目标路由器架构和已安装 OpenWrt 版本的 OpenWrt SDK,你可以去自己的 OpenWrt 现在的 opkg 的软件包源的 url 中找到,我这里要下载的是 wget https://mirror-03.infra.openwrt.org/releases/23.05.3/targets/mediatek/filogic/openwrt-sdk-23.05.3-mediatek-filogic_gcc-12.3.0_musl.Linux-x86_64.tar.xz
下载好之后解压 tar -xf openwrt-sdk-23.05.3-mediatek-filogic_gcc-12.3.0_musl.Linux-x86_64.tar.xz
下载或更新在 feeds.conf/feeds.conf.default 中定义的所有最新软件包:cd openwrt-sdk-23.05.3-mediatek-filogic_gcc-12.3.0_musl.Linux-x86_64
./scripts/feeds update -a
克隆要编译的软件包 git clone https://github.com/BenjaminX/luci-app-syncdial ./package/luci-app-syncdial,这一步必须要在 update -a 后面进行,不然 install luci-app-syncdial 的时候会提示 WARNING: No feed for package ‘luci-app-syncdial’ found
./scripts/feeds install luci-app-syncdial
编译,期间会弹出来 menuconfig 的窗口,直接 Save 即可 make package/luci-app-syncdial/compile ,编译产物会输出到 ./bin/packages/aarch64_cortex-a53/base/ 中
如果要编译的是 ImmortalWrt 的软件包,情况还有些不同
git clone https://github.com/padavanonly/immortalwrt-mt798x-6.6
The following tools are needed to compile ImmortalWrt, the package names vary between distributions.
sudo bash -c 'bash <(curl -s https://build-scripts.immortalwrt.org/init_build_environment.sh)'
更新并安装所有 feeds 中的软件包索引 ./scripts/feeds update -a
cp -f defconfig/mt7986-ax6000.config .config
克隆 luci-app-syncdial 仓库到 package 目录,这一步必须要在 update -a 后面进行,不然 install luci-app-syncdial 的时候会提示 WARNING: No feed for package 'luci-app-syncdial' found
git clone https://github.com/BenjaminX/luci-app-syncdial ./package/luci-app-syncdial
ImmortalWrt 的某些分支可能没有提供预编译好的工具链(Prebuilt Toolchain),因此必须由用户在本地完整生成一次, 如果你是第一次使用这套源码,最稳妥的方法是先跑一次全量编:make -j$(nproc) || make -j1 V=s
make toolchain/compile -j$(nproc)
make target/linux/compile -j$(nproc)
安装 luci-app-syncdial 包 (使其在 make menuconfig 中可见或作为依赖被处理) ./scripts/feeds install luci-app-syncdial
编译 luci-app-syncdial 包,期间可能会弹出 menuconfig 窗口,直接保存并退出即可。 make package/luci-app-syncdial/compile
编译产物会输出到 ./bin/packages/aarch64_cortex-a53/base/ 中
如果大家有什么疑问可以联系我,我如果明白的肯定知无不言。
参考:
- OPENWRT 插件 ipk 单独编译 - 无需编译整个固件_openwrt 单独编译 ipk 包-CSDN 博客
- OPENWRT 插件单独编译 - 无需编译整个固件_openwrt 单独编译插件-CSDN 博客
- [OpenWrt Wiki] 使用SDK 开发工具包
- (1 封私信) OpenWrt:编译自己的 HelloWorld 应用插件 - 知乎
1 post - 1 participant
Read full topic
via - 最新话题 (author: cesar)
评论已关闭