On 8 July 2014 21:24, Tomas Daujotas <[email protected]> wrote:
> I was looking for a good reference for OpenWRT kernel module development
> workflow.

See attached file with commands. This allow you writing some external
module as an OpenWrt package.

helloworld/Makefile will have probably white spaces broken, you may
fix them by hand
cd package/kernel
mkdir -p helloworld/src

echo "obj-m += helloworld.o" > helloworld/src/Makefile

touch helloworld/src/helloworld.c

cat << 'EOF' > helloworld/Makefile
include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk

PKG_NAME:=helloworld
PKG_RELEASE:=1

include $(INCLUDE_DIR)/package.mk

define KernelPackage/helloworld
  SECTION:=kernel
  CATEGORY:=Kernel modules
  TITLE:=Hello world kernel module
  FILES:= \
        $(PKG_BUILD_DIR)/helloworld.ko
  AUTOLOAD:=$(call AutoLoad,30,helloworld)
endef

define Build/Prepare
        # Copy sources
        mkdir -p $(PKG_BUILD_DIR)
        cp -R ./src/* $(PKG_BUILD_DIR)/
endef

define Build/Compile
        $(MAKE) -C "$(LINUX_DIR)" \
                CROSS_COMPILE="$(TARGET_CROSS)" \
                ARCH="$(LINUX_KARCH)" \
                SUBDIRS="$(PKG_BUILD_DIR)" \
                modules
endef

$(eval $(call KernelPackage,helloworld))
EOF
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to