OpenWrt adding modules Makefile and config.in

Source: Internet
Author: User

Add Module compilation

Found on the internet, a lot of information about compiling OPENWRT system, but these things chip manufacturers to provide the development package has been completed, but did not find the system introduced the information, add a package of introduction there are not many, of which there are two very valuable reference:

http://blog.csdn.net/lj627889343/article/details/7997463

http://kamikaze.openwrt.org/docs/openwrt.html#x1-460002.1.2

The detailed steps are as follows:

Create the module directory My_module in the package directory, including:

Makefile is used to establish a OPENWRT connection and become a package of openwrt.

src contains its own code

src/hello.c Source code

src/makefile source code for Makefile

The following will mainly explain the current system makefile understanding:

Include $ (TOPDIR)/rules.mk must contain
#include $ (include_dir)/kernel.mk kernel module included, currently not required

Pkg_name:=my_module package name, displayed in Menuconfig
pkg_version:=0.0.1 Package Version number
Pkg_base_name:=my_module package name, create pkg_base_name-pkg_version directory under Build_dir, for storing source code
#PKG_SOURCE: =$ (pkg_base_name)-$ (pkg_version). tar.gz
pkg_build_dir:=$ (Build_dir)/$ (pkg_base_name)-$ (pkg_version) specify code storage path
#PKG_RELEASE: =1
#PKG_SOURCE_URL: =http://localhost
pkg_build_depends:=
Pkg_bin_dir= commented on three items in order to not allow OpenWrt to download the code (and copy the code from the local, see instructions later)

Include $ (include_dir)/package-version-override.mk don't know what to do with, it should be a must
Include $ (include_dir)/package.mk don't know what to do with, it should be a must

Ifeq ($ (DUMP),)                                                                                           don't know what to do with
 stamp_configured:=$ (Strip $ (stamp_configured)) _$ (Shell $ (sh_func) grep ' ^config_gpon_ ' $ (topdir)/.config | md5s )
EndIf

Define package/$ (Pkg_name) options for setting the Menuconfig
Section:=application do not know what to do with, similar options have net/sys/driver. . should be a classification of Linux systems
Category:=teddy menuconfig Top Directory
Title:=the first module by Teddy Directory entry description for this package (catalog item name is package name)
url:=http://www.teddy.com/don't know what to do with it, it's not very useful.
Maintainer:=teddy don't know what to do with it, it's not very useful.
Depends:= depends on the package, and will not be used
Menu:=1 directory entry enable if the base module can be set to 0
Endef

Define package/$ (Pkg_name)/description don't know what to do, it's not very useful.
Teddy ' s first package on OpenWRT.
Endef

Define package/$ (Pkg_name)/config combines config/config.in to set more complex catalog items without
Menu "Detail Configurations" first option, set by developer
Depends on package_$ (pkg_name)
SOURCE "$ (source)/config/config.in"
Endmenu
$ (call package/$ (pkg_name)/override_version) The second option, provided by the system, should be another specified version number
$ (call package/$ (pkg_name)/override_source_path) The third option, which is provided by the system, should be specified in the code to store the path
Endef

Configure_args + =

Ifeq ($ (config_mips), y)                                                                             don't know what to do with
Configure_args + =--enable-add_drv_cflags= "-fno-pic-mno-abicalls-mlong-calls-g 0"
endif

Define build/prepare                                                                                    This is the key, on the above canceled from the network download, by the statement here to copy the SRC code to the specified location
 mkdir-p $ (Pkg_build_dir)
 $ (CP)./src/* $ (pkg_build_dir)/
Endef

Define build/clean                                                                                          clear statements, no use for
 @-RM-RF $ (pkg_build_dir)/ipkg*
 @-[-E $ (pkg_build_dir)/makefile] && $ (make)-C $ (pkg_build_dir ) Clean
 $ (call Build/clean/default)
Endef


Define package/$ (pkg_name)/install forget what to do with, it seems to be used to create a directory, no this sentence will cause the compilation but
$ (Install_dir) $ (1)/$ (Pkg_bin_dir)
Endef

$ (eval $ (call buildpackage,$ (pkg_name))) must be

You can also create

Config/config.in

For detail definitions, such as

Menu "Macros"
Config First_macro here the config value can be used by makefile, but not yet Found source code can be used
BOOL "First macro defined in my module"
Default Y
Config Second_macro
BOOL "Second macro defined in my module"
Default Y
Endmenu

OpenWrt adding modules Makefile and config.in

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.