Posted by: yegorich | October 31, 2013

OpenWrt: Creating a Package Containing Only Files

This tutorial describes how to write OpenWrt packages. Most packages have to be built from source. This blog post shows some hints about creating a package containing only files like for example scripts. So far I had tree issues:

  1. With standard template OpenWrt called make trying to compile the package and failed as there was no Makefile in the package.
  2. During the installation part OpenWrt tried to invoke make as make install too.
  3. As scripts were not part of the compilation process they don’t reside in PKG_INSTALL_DIR.

The first issue can be solved via empty Build/Compile section:


define Build/Compile
endef

The second issue can be solved via removing PKG_INSTALL:=1.

To install files use PKG_BUILD_DIR macro.


include $(TOPDIR)/rules.mk

PKG_NAME:=foo

.......

include $(INCLUDE_DIR)/package.mk

define Package/foo
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Foo scripts
URL:=www.mypage.com
endef

define Package/foo/description
Foo scripts description
endef

define Build/Compile
endef

define Package/foo/install
$(INSTALL_DIR) $(1)/sbin
$(CP) $(PKG_BUILD_DIR)/bar $(1)/sbin/
endef
$(eval $(call BuildPackage,foo))

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: