openwrt单独编译ipk包

问题描述:如何将openwrt ipk包直接编译到固件 这篇文章主要介绍了openwrt怎么编译第三方软件,具有一定借鉴价值,需要的朋友可以参考下。希望大家阅读完这篇文章后大有收获,下面让小编带着大家一起了解一下。

如何在Openwrt的平台上编译单独一个package

openwrt单独编译ipk包的相关图片

如果你只是要编译一个自定义的固件(默认带什么软件,不带什么软件,自定义默认的配置等等),那推荐你用ImageBuilder,简单快速,省心省力 你要是需要自己开发软件包,用OpenWRT的SDK,直接出ipk文件 要完全重写就buildroot。

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

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

一般来说,在编译时,进行make menuconfig,可以选择你需要编译的包。工具会帮助你完成包依赖的处理,包括依赖包的下载以及编译)。

如果要手动编译一个包,则需要自己解决包依赖的问题。例如想编译一个nano的包,可以通过命令opkg info nano 来知道包依赖是什么 。

如何在OpenWRT环境下做开发的相关图片

如何在OpenWRT环境下做开发

(!文末附加戏写编译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。

64位(x86_64)请执行列命令(装哪些库或软件包呢请您仔细看看哦): 。

# 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 individual 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 modules' option is required if you need specific (non-standard) drivers and so forth – this would typically be things like modules 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 dual core CPU.。

如何为现有的openwrt编译一个opkg上没有的软件的相关图片

如何为现有的openwrt编译一个opkg上没有的软件

1、搭建开发环境

       首先,在执行make menuconfig后,会出现下图:

其中,图中红框部分是我定制路由器的系统版本,大家可以根据不同的路由器进行不同的选择;绿框部分表示我们需要编译一个SDK开发环境(默认情况下,此项未勾选)。

编译过程中需要通过官网下载很多相关的软件包,所以必须保证能够顺利连上外网。由于下载速度的限制,编译过程大概需要数小时。编译结束后,所有的产品都会放在编译根目录下的bin/yourtarget/. 例如:我所编译的产物都放在./bin/brcm47xx/下,其中文件主要有几类:

(1).bin/.trx 文件: 这些都是在我们所选的target-system的类别之下,针对不同路由器型号、版本编译的路由器固件。这些不同路由器的型号和版本是openwrt预先设置好的,我们不需要更改。至于.bin和.trx的区别,一种说法是,第一次刷路由器的时候,需要用.bin文件,如果需要再升级,则不能再使用.bin文件,而需要用.trx文件。原因是,.bin是将路由器的相关配置信息和.trx封装在一起而生成的封包,也就是说是包含路由器版本信息的.trx。在第一次刷固件的时候,我们需要提供这样的信息,而在后续升级时,则不再需要,用.trx文件即可。

(2)packages文件夹: 里面包含了我们在配置文件里设定的所有编译好的软件包。默认情况下,会有默认选择的软件包。

(3)OpenWrt-SDK.**.tar.bz2: 这个也就是我们定制编译好的OpenWRT SDK环境。我们将用这个来进行OpenWrt软件包的开发。例如,我所编译好的SDK环境包为:/bin/brcm47xx/OpenWrt-SDK-brcm47xx-for-Linux-x86_64-gcc-4.3.3+cs_uClibc-0.9.30.1.tar.bz2。

可以从名称上看出,target system是brcm47xx,host system是Linux-x86_64,使用的编译工具以及库是4.3.3+cs_uClibc-0.9.30.1。

(4)md5sums 文件: 这个文件记录了所有我们编译好的文件的MD5值,来保证文件的完整性。因为文件的不完整,很容易将路由器变成“砖头”。

需要主要的是,编译完成后,一定要将编译好的bin目录进行备份(如果里面东西对你很重要的话),因为在下次编译之前,执行make clean 会将bin目录下的所有文件给清除掉!!。

2、 更改原有packages。

在编译根目录下会有一个dl的目录,这个目录其实是“download”的简写,在编译前期,需要从网络下载的数据包都会放在这个目录下,这些软件包的一个特点就是,会自动安装在所编译的固件中,也就是我们make menuconfig的时候,为固件配置的一些软件包。如果我们需要更改这些源码包,只需要将更改好的源码包打包成相同的名字放在这个目录下,然后开始编译即可。编译时,会将软件包解压到build_dir目录下。

当然,你也可以自己在dl里面创建自己的软件包,然后更改相关的配置文件,让openwrt可以识别这个文件包。

由于我的项目更改的内容是底层的,需要跟固件一起安装。所以,我使用的方法就是直接更改dl目录下软件包,然后重新进行固件编译。感觉类似于Linux的内核编译。反复编过十多次,没有任何问题。

3、 新建自己的packages。

对于自己新建的package,而这个package又不需要随固件一起安装,换句话说,就是可以当做一个可选软件包的话。我们可以利用我们的SDK环境来单独编译,编译后会生成一个ipk的文件包。然后利用 opkg install xxx.ipk 来安装这个软件。

下面具体说下,如何编译一个helloword的软件包。

(1)首先,编写helloworld程序 。

编写helloworld.c 。

/**************** 。

* Helloworld.c 。

* The most simplistic C program ever written. 。

* An epileptic monkey on crack could write this code. 。

*****************/。

#include <stdio.h>。

#include <unistd.h> 。

int main(void) 。

printf("Hell! O' world, why won't my code compile?\n\n"); 。

return 0; 

编写Makefile文件

# build helloworld executable when user executes "make"。

helloworld: helloworld.o。

$(CC) $(LDFLAGS) helloworld.o -o helloworld。

helloworld.o: helloworld.c。

$(CC) $(CFLAGS) -c helloworld.c。

# remove object files and executable when user executes "make clean"。

clean: 

rm *.o helloworld 。

在这两个文件的目录下,执行make 应该可以生成helloworld的可执行文件。执行helloworld后,能够打印出“Hell! O' world, why won't my code compile?”。 这一步,主要保证我们的源程序是可以正常编译的。下面我们将其移植到OpenWRT上。

(2)将OpenWrt-SDK-brcm47xx-for-Linux-x86_64-gcc-4.3.3+cs_uClibc-0.9.30.1.tar.bz2解压。

tar –xvf OpenWrt-SDK-brcm47xx-for-Linux-x86_64-gcc-4.3.3+cs_uClibc-0.9.30.1.tar.bz2。

(3)进入SDK

cd OpenWrt-SDK-brcm47xx-for-Linux-x86_64-gcc-4.3.3+cs_uClibc-0.9.30.1 。

可以看到里面的目录结构跟我们之前source的目录结构基本相同,所需要编译的软件包,需要放置在package目录下。

(4)在package目录下创建helloworld目录。

cd package 

mkdir helloworld 。

cd helloworld

(5)创建src目录,拷贝 helloworld文件。

mkdir src 

cp /home/wrt/test/helloworld.c src 。

cp /home/wrt/test/Makefile src。

(6)在helloworld目录下创建Makefile文件。

这个Makefile文件是给OpenWRT读的,而之前写的那个Makefile文件是针对helloworld给编译其读的。两个Makefile不在同一层目录下。

touch Makefile

vim Makefile

Makefile文件模板内容如下:

############################################## 。

# OpenWrt Makefile for helloworld program 。

# Most of the variables used here are defined in 。

# the include directives below. We just need to 。

# specify a basic description of the package, 。

# where to build our program, where to find 。

# the source files, and where to install the 。

# compiled program on the router. 。

# Be very careful of spacing in this file. 。

# Indents should be tabs, not spaces, and 。

# there should be no trailing whitespace in 。

# lines that are not commented. 。

##############################################。

include $(TOPDIR)/rules.mk。

# Name and release number of this package。

PKG_NAME:=helloworld 。

PKG_RELEASE:=1

# This specifies the directory where we're going to build the program.。

# The root build directory, $(BUILD_DIR), is by default the build_mipsel 。

# directory in your OpenWrt SDK directory 。

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)。

include $(INCLUDE_DIR)/package.mk。

# Specify package information for this program.。

# The variables defined here should be self explanatory. 。

# If you are running Kamikaze, delete the DESCRIPTION 。

# variable below and uncomment the Kamikaze define 。

# directive for the description below 。

define Package/helloworld 。

SECTION:=utils 。

CATEGORY:=Utilities 。

TITLE:=Helloworld -- prints a snarky message 。

endef

# Uncomment portion below for Kamikaze and delete DESCRIPTION variable above。

define Package/helloworld/description 。

If you can't figure out what this program does, you're probably 。

brain-dead and need immediate medical attention. 。

endef

# Specify what needs to be done to prepare for building the package.。

# In our case, we need to copy the source files to the build directory. 。

# This is NOT the default. The default uses the PKG_SOURCE_URL and the 。

# PKG_SOURCE which is not defined here to download the source from the web. 。

# In order to just build a simple program that we have just written, it is 。

# much easier to do it this way. 。

define Build/Prepare 。

mkdir -p $(PKG_BUILD_DIR) 。

$(CP) ./src/* $(PKG_BUILD_DIR)/ 。

endef

# We do not need to define Build/Configure or Build/Compile directives。

# The defaults are appropriate for compiling a simple program such as this one。

# Specify where and how to install the program. Since we only have one file,。

# the helloworld executable, install it by copying it to the /bin directory on 。

# the router. The $(1) variable represents the root directory on the router running 。

# OpenWrt. The $(INSTALL_DIR) variable contains a command to prepare the install 。

# directory if it does not already exist. Likewise $(INSTALL_BIN) contains the 。

# command to copy the binary file from its current location (in our case the build 。

# directory) to the install directory. 。

define Package/helloworld/install 。

$(INSTALL_DIR) $(1)/bin 。

$(INSTALL_BIN) $(PKG_BUILD_DIR)/helloworld $(1)/bin/ 。

endef

# This line executes the necessary commands to compile our program.。

# The above define directives specify all the information needed, but this 。

# line calls BuildPackage which in turn actually uses this information to 。

# build a package. 。

$(eval $(call BuildPackage,helloworld))。

(7)返回到SDK的根目录

执行make进行编译 

编译过程会在build_dir目录下完成 。

编译结果会放在 bin/[yourtarget]/package目录下helloworld_1_bcm47xx.ipk。

(8)上传helloworld_1_bcm47xx.ipk。

使用sftp软件上传helloworld_1_bcm47xx.ipk至路由器 。

执行 opkg install helloworld_1_bcm47xx.ipk 。

输入hello然后按Tab键,发现openwrt中已经有helloworld可执行命令。 。

执行 helloworld 查看程序的效果。

Hell! O' world, why won't my code compile?。

【End】

希望对大家能有帮助 :)

转载

Openwrt 编译ipk出错,如下错误,怎么解决? denghuinow@Ubuntu:

一、安装编译环境(以ubuntu10.10为例)

依次输入以下命令:

1.ubuntu开发环境需要的软件:

sudo

apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf 。

gettext texinfo unzip sharutils subversion libncurses5-dev ncurses-term 。

zlib1g-dev gawk。

sudo apt-get update。

2.创建目录

mkdir openwrt

3.获取OpenWrt源代码和安装包,更新。

svn checkout svn://svn.openwrt.org/openwrt/backfire。

cd backfire

./scripts/feeds update -a。

./scripts/feeds install -a。

4.配置编译选项

make menuconfig。

在target system里选择Broadcom BCM63xx,根据需要选择其他的软件,

*:表示该模块直接编译到核心中。

M:该模块以被核心支持,可以后再安装。

空白:不支持该模块

具体模块的起什么作用需要多google;

5.编译选项配置保存后,开始编译。

make V=99

V=99表示输出详细的debug信息;

二、编译准备

1.下载源文件

下载地址:http://ftp.awk.cz/cntlm/ ,最新的版本是0.91rc6;

2.获取md5sum码

进入下载文件目录,在终端里输入 。

md5sum cntlm-0.91rc6.tar.gz。

获得md5验证码:21ccd60294269cb8fbe3e2e49374ab1b。

3.编写makefile文件

在openwrt/backfire目录中的package目录下新建cntlm目录,在cntlm目录下新建文件,命名为makefile,编辑makefile文件,加入如下内容:

---------------------------------------------------------------------------------------------------------------------------。

# Copyright (C) 2006-2008 OpenWrt.org。

# This is free software, licensed under the GNU General Public License v2.。

# See /LICENSE for more information.。

include $(TOPDIR)/rules.mk。

PKG_NAME:=cntlm。

PKG_VERSION:=0.91rc6。

PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz。

PKG_SOURCE_URL:=http://ftp.awk.cz/cntlm/。

PKG_MD5SUM:=21ccd60294269cb8fbe3e2e49374ab1b。

PKG_INSTALL:=1

include $(INCLUDE_DIR)/package.mk。

define Package/cntlm。

SUBMENU:=Proxy Servers。

SECTION:=net

CATEGORY:=Network。

TITLE:=Cntlm is a Fast NTLM Authentication Proxy。

URL:=http://cntlm.sourceforge.net/。

endef

define Package/cntlm/install。

$(INSTALL_DIR) $(1)/usr/sbin。

$(CP) $(PKG_INSTALL_DIR)/usr/sbin/cntlm $(1)/usr/sbin/。

$(INSTALL_DIR) $(1)/usr/share/man/man1。

$(CP) $(PKG_INSTALL_DIR)/usr/share/man/man1/$(PKG_NAME).1 $(1)/usr/share/man/man1。

$(INSTALL_DIR) $(1)/etc/。

$(CP) $(PKG_INSTALL_DIR)/etc/cntlm.conf $(1)/etc/。

endef

$(eval $(call BuildPackage,cntlm))。

---------------------------------------------------------------------------------------------------------------------------。

4.编写patch文件

由于BCM63xx核心是big。

endian,而我们常用的intel或AMD的cpu都是little 。

endian的,cntlm虽然能够自己检测编译环境的endian,但我们是在交叉编译环境中编译,cntlm检测出来的还是ubuntu系统的endian,因此需要设置手动endian为big。

endian。具体就是将源码文件中的config/endian.c文件的rc设定为0.。

将源码文件中的endian.c文件分别复制到a目录下的config目录和b目录下的config目录,打开b目录下的config目录中的endian.c文件,并将其修改为:

-------------------------------------------------------------------------------------------------------------------------。

#include

#include

int main(int argc, char **argv) {。

int rc;

rc = 0;

printf("%s\n", rc ? "little endian" : "big endian");。

return rc;

---------------------------------------------------------------------------------------------------------------------------。

然后保存。

运行:

diff -Naur a/config/endian.c b/config/endian.c >endian.patch。

endian.patch文件内容如下:

---------------------------------------------------------------------------------------------------------------------------。

--- a/config/endian.c 2007-08-20 07:23:17.000000000 +0800。

+++ b/config/endian.c 2010-11-01 18:36:32.000000000 +0800。

@@ -1,15 +1,11 @@。

#include

#include

-uint8_t num[] = { 0xEF, 0xBE };。

-/*

- * RC: 1 = LE, 0 = BE。

- */

int main(int argc, char **argv) {。

int rc;。

- rc = (*((uint16_t *)num) == 0xBEEF);。

+ rc = 0;

printf("%s\n", rc ? "little endian" : "big endian");。

return rc;。

---------------------------------------------------------------------------------------------------------------------------。

将endian.patch文件复制到package/cntlm/patches/目录下(没有patches目录就新建一个)。

三、编译

1.选定安装包

终端输入:

make menuconfig。

在Network——》Proxy Severs中选择cntlm;

2.开始编译

终端输入:

make package/cntlm/compile V=99。

中间可能会出现一些提示(Note),可以不用理会。编译完成后在bin/packages目录下可以看到cntlm_0.91rc6-1_brcm63xx.ipk文件啦。

四、补充

上面提到在编译过程中出会现提示(Note),一般如下:

utils.c:1: note: someone does not honour COPTS correctly, passed 0 times。

这是由于cntlm源码文件中CFLAG的设置是覆盖而不是续接,与openwrt要求不同,在openwrt一般写成CFLAG += 的方式。可以通过如下修改去除note:

将源码包中的Makefile文件复制到a目录和b目录,打开b目录下的Makefile文件,作如下修改:

CFLAGS+=$(FLAGS)。

即增加上面的“+”号,保存。

运行:

diff -Naur a/Makefile b/Makefile > makefile.patch。

得到的makefile.patch文件如下:

---------------------------------------------------------------------------------------------------------------------------。

--- a/Makefile 2010-04-29 19:18:58.000000000 +0800。

+++ b/Makefile 2010-11-09 20:17:33.405177000 +0800。

@@ -16,7 +16,7 @@。

CC=gcc

VER=`cat VERSION`。

OBJS=utils.o ntlm.o xcrypt.o config.o socket.o acl.o auth.o http.o forward.o direct.o scanner.o pages.o main.o。

-CFLAGS=$(FLAGS)。

-std=c99 -Wall -pedantic -O3 -D__BSD_VISIBLE -D_ALL_SOURCE 。

-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112 -D_ISOC99_SOURCE 。

-D_REENTRANT -DVERSION=\"`cat VERSION`\" -g。

+CFLAGS+=$(FLAGS) 。

-std=c99 -Wall -pedantic -O3 -D__BSD_VISIBLE -D_ALL_SOURCE 。

-D_XOPEN_SOURCE=600 -D_POSIX_C_SOURCE=200112 -D_ISOC99_SOURCE 。

-D_REENTRANT -DVERSION=\"`cat VERSION`\" -g。

OS=$(shell uname -s)。

OSLDFLAGS=$(shell [ $(OS) = "SunOS" ] && echo "-lrt -lsocket -lnsl")。

LDFLAGS:=-lpthread $(OSLDFLAGS)。

---------------------------------------------------------------------------------------------------------------------------。

将makefile.patch文件复制到package/cntlm/patches目录下,重新编译即可。

原文地址:http://www.qianchusai.com/openwrt%E5%8D%95%E7%8B%AC%E7%BC%96%E8%AF%91ipk%E5%8C%85.html

sleepex-70

sleepex-70

lw/大班益智区角图片大全,大班益智区区角活动教案30篇

lw/大班益智区角图片大全,大班益智区区角活动教案30篇

19야동다모아-20

19야동다모아-20

人耸-80,人耸肩是什么意思

人耸-80,人耸肩是什么意思

v2ray官网,小火箭服务器节点购买

v2ray官网,小火箭服务器节点购买

eliciting,eliciting教学方法

eliciting,eliciting教学方法

proumb.cow,proumb.cow-120

proumb.cow,proumb.cow-120

cv-70,华为安居智能摄像机cv70

cv-70,华为安居智能摄像机cv70

lamp1-20

lamp1-20

kake,kakee是什么意思

kake,kakee是什么意思