Show pagesourceOld revisionsBacklinksBack to top × Table of Contents 使用SDK开发工具包 获取SDK 下载 软件 feeds 加载软件列表 用法 选择 packages 编译软件 This page is not fully translated, yet. Please help completing the translation. (remove this paragraph once the translation is finished) 使用SDK开发工具包 该SDK是预编译工具链设计的交叉编译软件包为特定目标而无需从头编译整个系统. 您可以使用SDK完成的任务: 为特定版本编译自定义软件及同时确保二进制和功能兼容性 为特定版本编译某些软件包的较新版本 使用自定义补丁或不同功能重新编译现有软件包 您无法使用SDK完成的任务: 将其用作交叉编译工具链的插件以编译整个固件. 先决条件 SDK 与 buildroot 系统具有相同的先决条件, 因此请参阅 Build system – Installation 页面以安装所需的软件以在SDK上构建软件包. Note: 在某些主机上需要安装 ccache 软件. 在没有 sudo 的情况下, 以非特权用户(而不是 root)的身份执行所有操作. 确保构建目录的完整路径中没有空格. 获取SDK 您可以下载预编译号的 SDK 或可以从源代码中自行编译. 从源代码编译只需启用 menuconfig 选项 Build the OpenWrt SDK (CONFIG_SDK). 预编译的 SDK 位于您找到设备固件映像的同一下载文件夹中. 下载 development snapshot SDK → Platforms → Supplementary Files → openwrt-sdk-<Platform>_gcc-<version>_musl.Linux-x86_64.tar.xz 21.02.0 → Platforms → Supplementary Files → openwrt-sdk-<Platform>_gcc-<version>_musl.Linux-x86_64.tar.xz 19.07.7 → Platforms → Supplementary Files → openwrt-sdk-<Platform>_gcc-<version>_musl.Linux-x86_64.tar.xz 软件 feeds 解压 SDK 存档后, 可选择编辑该 feeds.conf.default 文件以添加您的软件 feeds. 默认情况下, 这将包含构建 SDK 时使用的feeds. 您可以添加自己的本地或远程feed, 就像使用 buildroot 一样. 如果您只是重新构建额外的软件, 则根本不需要这样做. NOTE: 如果要覆盖来自现有feeds的软件, 则必须在包含要覆盖软件feed的行上方编写自定义feed. 例如, 你想制作一个已经在 Packages feed 中发行软件的自定义版本, 这就是你的 feeds.conf.default 的模板 (第一行是你自己的自定义软件 feed) src-link local /path/to/local/custom/feed src-git packages https://git.openwrt.org/feed/packages.git src-git luci https://git.openwrt.org/project/luci.git src-git routing https://git.openwrt.org/feed/routing.git src-git telephony https://git.openwrt.org/feed/telephony.git #src-git video https://github.com/openwrt/video.git #src-git targets https://github.com/openwrt/targets.git #src-git oldpackages http://git.openwrt.org/packages.git #src-link custom /usr/src/openwrt/custom-feed 加载软件列表 使用 ./scripts/feeds update -a 命令获取和更新定义软件. 更新定义后, ./scripts/feeds install <packagename> 准备软件及其依赖项. ./scripts/feeds install -a 将再次使所有软件可用, 就像在 buildroot 一样. 用法 选择 packages 在 SDK 的文件夹中打开一个终端, 然后通过运行命令 make menuconfig 打开 SDK 的菜单. SDK menuconfig 系统与 buildroot 相同. 帮助说明位于顶部, 可通过 ? 按键获得帮助. 您 很可能 想要禁用一些默认设置, 这些设置会构建每个可用的软件. 进入 Global Build Settings 并在子菜单中, 取消选择/排除以下选项: Select all target specific packages by default Select all kernel module packages by default Select all userspace packages by default 仍然在菜单中, 找到要构建的软件并按 “m” 选择它, 这也会选择所有依赖项, 您将在菜单中看到它们都带有 “<M>” 标记. 您也可以选择多个包. 保存配置并退出菜单. 编译软件 After the Makefile is in place, the usual buildroot commands apply: make package/example/download - download the soures of example make package/example/prepare - extract the sources, apply patches and download if necessary make package/example/compile - compile example, prepare and download if necessary make package/example/clean - clean the sourcecode make package/index - build a repository index to make the output directory usable as local opkg source Or, just run make to build everything selected. You can compile faster by writing make -j5 or similar as appropriate for your build host. After the compilation is finished, the generated .ipk files are placed in the bin/packages and bin/targets directories inside the directory you extracted the SDK into. This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.OKMore information about cookies Last modified: 2021/12/14 21:56by guyezi