如何为Openwrt交叉编译.c文件?

时间:2015-04-29 04:47:20

标签: linux arm cross-compiling beagleboneblack openwrt

我正在尝试为Openwrt交叉编译.c文件。我下载了Openwrt并将我的文件添加到包目录中并为其创建了Makefile,但在编译时它正在跳过。我不知道出了什么问题

这是Makefile:

*

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=gav
PKG_VERSION:=1
PKG_RELEASE:=1
include $(INCLUDE_DIR)/package.mk
define Package/gav
  SECTION:=utils
  CATEGORY:=Base system
  TITLE:=gaurav
endef
define Package/gav/description
 This package contains an utility useful to upgrade from other firmware or 
 older OpenWrt releases.
endef
define Build/Prepare
    mkdir -p $(PKG_BUILD_DIR/)
    $(CP) ./src/* $(PKG_BUILD_DIR)/
endef
define Package/gav/install
    $(INSTALL_DIR) $(1)/sbin
    $(INSTALL_BIN) $(PKG_BUILD_DIR)/gav $(1)/sbin/
endef
$(eval $(call Buildpackage,gav))

*

1 个答案:

答案 0 :(得分:2)

如果工具链完全跳过Makefile,很可能你没有运行 make menuconfig

所以一般来说步骤是:

  1. 将openWRT Makefile放入openwrt / package / name文件夹
  2. 运行 make menuconfig
  3. 弹出对话框中的
  4. 通过在其旁边放置 M 或*来选择要编译的包。
  5. 运行 make package / name / compile
  6. 你会在openwrt / bin /
  7. 中找到.ipk文件