OpenWRT的ipk编译方法
来源:互联网 发布:qq视频聊天优化 编辑:程序博客网 时间:2024/05/16 11:57
编译时要配置内核,make menuconfig
配置Build the OpenWrt SDK ,前提条件是openwrt编译成功
1.在编译好的文件中会有/bin/ramips/OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2文件
2.然后解压这个文件
2.然后解压这个文件
tar xvf OpenWrt-SDK-ramips-for-linux-x86_64-gcc-4.6-linaro_uClibc-0.9.33.2.tar.bz2
进入这个sdk,会看见一个package,在下新建mkdir -p helloworld/src 两个目录
在目录src下新建helloworld.c
#include<stdio.h>#include <unistd.h>int main(void){ printf("Hell! O' world, why won't my code compile?\n\n"); return 0;}
然后在此目录下创建Makefile(注意Makefile的语法要用tab)
# build helloworld executable when user executes "make"helloworld: helloworld.o $(CC) $(LDFLAGS) helloworld.o -o helloworldhelloworld.o: helloworld.c $(CC) $(CFLAGS) -c helloworld.c# remove object files and executable when user executes "make clean"clean: rm *.o helloworld
然后返回上层目录,即helloworld目录,在此目录下创建一个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 packagePKG_NAME:=helloworldPKG_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 directoryPKG_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 belowdefine Package/helloworld SECTION:=utils CATEGORY:=Utilities TITLE:=Helloworld -- prints a snarky messageendef# Uncomment portion below for Kamikaze and delete DESCRIPTION variable abovedefine 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))
0 0
- openWRT的ipk编译方法
- openWRT的ipk编译方法
- OpenWRT的ipk编译方法
- openWRT的ipk编译方法
- openwrt编译 IPK包
- PandoraBox/LEDE SDK交叉编译OpenWrt ipk安装包的方法
- OpenWrt固件编译、软件包Ipk的编译详解
- Openwrt 编译生成ipk包
- openwrt单个ipk编译过程
- openwrt install ipk 的步骤
- openwrt编译自定义软件helloworld.ipk
- OpenWrt-SDK-编译生成ipk软件包
- OpenWrt交叉编译及IPK生成
- 内核编译Openwrt制作ipk动态更新文件
- Ubuntu亲自手动编译Openwrt (DreamBox): for njit....ipk
- OpenWrt 内核编译制作ipk动态更新文件
- 内核编译Openwrt制作ipk动态更新文件
- openwrt在RT5350上编译安装运行helloworld.ipk
- QT信号槽机制
- 非常规手法求1+2+…+n的值。
- public,protect,private,
- C++ 自由存储区是否等价于堆?
- git pull/push时候总提示输入账号密码 - 免除设置
- OpenWRT的ipk编译方法
- GC基本算法及C++GC机制
- zoj 3057Beans Game
- 智能指针小分析
- AnnotationAwareAspectJAutoProxyCreator is only available on Java 1.5 and higher
- 关于传值与传引用的讨论
- Ubuntu下升级git版本(源码编译安装git)
- Android LayoutInflater深度解析
- C++编译期多态与运行期多态