如何将一个现成的ipk加入到openwrt编译出的固件中

发布网友 发布时间:2022-04-19 09:43

我来回答

1个回答

热心网友 时间:2023-06-25 11:55

(!文末附加戏写编译OPENWRTTXT内容直接跳至末尾例)
 Openwrt 官式发行版已编译映像文件(缀名bin或trx、trx2)映像文件Openwrt官网站载页面轻松获取连接址 OpenWrt官网站些编译映像文件基于默认配置设置且针受支持平台或设备要打造自映像文件理由四点:
您想拥性化配置OpenWrt(彰显性朋友圈显摆显摆玩笑);
您想实验性平台测试OpenWrt;
您参与测试或参与发OpenWrt工作;
或者简单目保持自Openwrt新版本;
 若想实现述目其实简单按述文字即功编译您Openwrt
准备工作
始编译Openwrt前需要您做些准备工作;与其编译程类似编译工具编译环境必少:
构建OpenWrt映像系统平台简单说准备操作系统(比Ubuntu、Debian等);
确保安装所需依赖关系库 (debian系统安装各种需要软件包)
OpenWrt源代码副本
首先 机登陆支持编译Openwrt操作系统(废)实体机或者虚拟机(Vmware 或者 Qemu)操作系统都行推荐使用Linux系统 bsdmac osx系统编推荐且未验证否编译功文假定您使用Debian操作系统使用 apt-get 管理包. 替代选择 Ubuntu (支 Kubuntu, Xubuntu 等即)
第二步, 安装所需要各种软件包, 包括编译器,解压工具,特定库等. 些工作简单通键入命令 (通需要root 或者 sudo 权限)root权限安装列软件包(能并完整提示提示缺少即装):
32位(x86)请执行列命令:
# apt-get install build-essential asciidoc binutils bzip2 gawk gettext \
git libncurses5-dev libz-dev patch unzip zlib1g-dev

位(x86_)请执行列命令(装哪些库或软件包呢请您仔细看看哦):
# apt-get install build-essential asciidoc binutils bzip2 gawk gettext \
git libncurses5-dev libz-dev patch unzip zlib1g-dev ia32-libs \
lib32gcc1 libc6-dev-i386

参考 本列表 所列编译环境所需要软件包或库
某些依赖库或软件包许操作系统已经安装apt-get作提示(提示您忽略或重新安装)别紧张放轻松些编译Openwrt像编译DD-WRT难(至少本体编译DD-WRT难)
载份完整 Openwrt 源码编译环境关于Openwrt源代码载途径二通 svn 通 git建议使用 svn Openwrt主要 svn 维护Openwrt系统版本另外请注意Openwrt同支版本用较发快照俗称 trunk二稳定版俗称 backfire
安装Subversion
若想通svn载源代码,需安装 SubversionSubversion,或称SVN, OpenWrtproject用控制版本系统,非类似 CVS界面使用条款 执行述命令即安装SVN容易:
# apt-get install subversion

Subversion安装完毕通SVN命令获取份OpenWrt纯净源代码您创建目录便存放获取Openwrt源代码要获取源代码输入subversion命令获取 (svn种操作称'check out') 命令简单继续看能见别着急耐点
编译流程
编译专属于您设备特定Openwrt固件五步骤:
通Subversion命令获源代码;
更新(或安装) package feeds[package feeds确切翻译待译吧);
创建默认配置检查编译环境否搭建 (假需要);
用Menuconfig配置即编译固件映像文件配置项;
始编译固件;
载源代码
载份完整OpenWrt源代码选择:
载稳定发行版或
载发版 (俗称"trunk"版)
使用发行版源码
截止本文, Openwrt公发行稳定版 OpenWrt 10.03 "backfire"版本稳定许包括新更新补丁或新编写新功能
述代码即举例说明通svnbrandkfire获backfire源代码(版本意思trunk支补丁backfire版本即包含修复补丁):
# mkdir OpenWrt/
# cd OpenWrt/
# svn co svn://svn.openwrt.org/openwrt/branches/backfire

注解: 述svn命令前目录创建 OpenWrt/backfire/ 目录目录包含命令获取源代码
您通述命令载含修复补丁backfire原版源码:
# svn co svn://svn.openwrt.org/openwrt/tags/backfire_10.03

使用发版源代码
前发版本支(trunk)已包含新实验补丁支或许突破Openwrt原所支持硬件设备*哦惊喜同风险存编译trunk版慎~
# mkdir OpenWrt/
# cd OpenWrt/
# svn co svn://svn.openwrt.org/openwrt/trunk/

更详细资料详见:
跟进并更新源代码
Openwrt源代码随都变故命令确保您所获取源码新性述假设您用backfire版本源码:
## Here, backfire is the directory name of the current release branch you're tracking
# cd OpenWrt/backfire/
# svn up

'svn up' 命令用于更新SVN更新本尚未更新部源代码(本实践证明命令本源码与SVN源码先比较若SVN更新才载更新部实用命令)未指定目标路径则命令更新前目录及前目录目录内源码
Feeds载
Feeds即包含OpenWrt环境额外软件包索引类(feed译名莫衷至2008底止没十通用备受认文译名;所文我用英文feed称呼) 主要Feeds三:
'packages' - 路由基本功能,
'LuCI' - OpenWrt默认GUI(WEB管理界面), 及
'Xwrt' - 其GUI
般情况至少需要含 'packages' 'LuCI'两Feeds
载完feeds (编译OpenWrtrecipies额外预定义包) 您检查哪些feeds要包括内编辑编译环境根目录'feeds.conf.default'文件
使用列命令始载(注:能需要先运行cd trunk进入trunk目录才能功执行列命令):
# ./scripts/feeds update -a

载软件包需要安装亦即指边命令啦若路边install命令则续make menuconfig功执行(注:能需要先运行cd trunk进入trunk目录才能功执行列命令):
# ./scripts/feeds install -a

需编辑Feeds配置文件或运行更新命令即便更新或添加新实验性packages源码并编译OpenWrt固件
注意:请坛友及旧新闻组员注意步取代创建符号链接symlinks办哦
更新Feeds
诸类源码,定期更新Feeds 通相同命令:
# ./scripts/feeds update -a
# ./scripts/feeds install -a

注意:若清楚知道需添加新packagesmenuconfig更新Feeds跳步
配置
You may not have to make configration always after updating sources and feeds, but making it ensures that all packages from source and feeds are correctly included in your build configuration.
Defconfig
步检查编译环境若进行编译则默认配置:
# make defconfig

若defconfig显提示缺少软件包或编译库等依赖则按提示安装所缺软件包或库等即难细点行
Menuconfig
menuconfig基于文本工具处理选择目标(需要需要)、编译软件包(openwrtIPKG格式)及内核选项(编译模块内核)等等
# make menuconfig

离并保存配置文件(默认都.config)自配置依赖关系让着手编译更新固件
众通'menuconfig'简单图形化配置环境非轻松编译专属您本OpenWrt固件
用'menuconfig'发意图编译OpenWrt固件自()创造结构简单功能强环境(句实难翻译能意译并且请家都习编译OP固件让OP固件盈利丢掉肮脏饭碗)
Menuconfig或或少些难说明即使专业配置寻求帮助并加解决 需要指定何种目标平台要包含package软件包内核模块等均需要指定配置标准程包括修改:
目标平台(即路由器何种架构BCM呢AR均选择)
选择要包含package软件包
构建系统设置
内核模块
Target system is selected from the extensive list of supported platforms, with the numerous target profiles – ranging from specific devices to generic profiles, all depending on the particular device at hand. Package selection has the option of either 'selecting all package', which might be un-practical in certain situation, or relying on the default set of packages will be adequate or make an indivial selection. It is here needed to mention that some package combinations might break the build process, so it can take some experimentation before the expected result is reached. Added to this, the OpenWrt developers are themselves only maintaining a smaller set of packages – which includes all default packages – but, the feeds-script makes it very simple to handle a locally maintained set of packages and integrate them in the build-process.
假需要LuCI, 要Administration 菜单,LuCI组件菜单, 并选择: luci-admin-core, luci-admin-full, and luci-admin-mini组件包
假需要PPP,Network菜单取消选择便编译包含组件
Menuconfig用: 确保些组件包 '*'星号标记 'M'标记
星号 '*'标记该组件包, 则该组件包编译进终OpenWrt固件
仅 'M'标记该组件包, 则该组件包编译进终OpenWrt固件
The final step before the process of compiling the intended image(s) is to exit 'menuconfig' – this also includes the option to save a specific configuration or load an already existing, and pre-configured, version.
Exit and save.
Source Mirrors
The 'Build system settings' include some efficient options for changing package locations which makes it easy to handle a local package set:
Local mirror for source packages
Download folder
In the case of the first option, you simply enter a full URL to the web or ftp server on which the package sources are hosted. Download folder would in the same way be the path to a local folder on the build system (or network). If you have a web/ftp-server hosting the tarballs, the OpenWrt build system will try this one before trying to download from the location(s) mentioned in the Makefiles . Similar if a local 'download folder', residing on the build system, has been specified. The 'Kernel moles' option is required if you need specific (non-standard) drivers and so forth – this would typically be things like moles for USB or particular network interface drivers etc.
编译固件
万事具备欠东风,通面简单make命令编译:
# make

核电脑编译
具核CPU处理器电脑进行编译使用述参数令编译程加速 规用 – 例使用3进程编译 (即双核CPU), 命令及参数:
# make -j 3

台编译
若系统内编译OpenWrt同处理其让闲置I/O及CPU台编译固件 (双核CPU):
# ionice -c 3 nice -n 20 make -j 2

编译简单基本软件包
OpenWrt发或打包软件包,编译简单基本软件包轻易编译该软件包 (例 软件包cups):
# make package/cups/compile V=99

Feeds软件包约:
# make package/feeds/packages/ndyndns/compile V=99

编译错误
某种知道原编译失败,面种简单知编译底错哪:
# make V=99 2>&1 |tee build.log |grep -i error

述编译命令意:V99参数错信息保存build.log输完整详细副本(with stdout piped to stderr)屏幕显示错误
举例说明:
# ionice -c 3 nice -n 20 make -j 2 V=99 CONFIG_DEBUG_SECTION_MISMATCH=y 2>&1 \
|tee build.log |egrep -i '(warn|error)'

The above saves a full verbose copy of the build output (with stdout piped to stderr) in build.log and outputs only warnings and errors while building using only background resources on a al core CPU.

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com
19.736221s