OpenWrt Forum Archive

Topic: How to build custom kernel module for Openwrt?

The content of this topic has been archived on 23 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm using Kamikaze 8.09 RC2 (BRCM-2.4) and I want to use ACCEL-PPTP kernel module as PPTP client on OpenWRT.
It's good solution to increase pptp performance and decrease system usage.
How I can build this module as a package to use with OpenWRT platform?

I already integrated this module to Linux at my PC, but I need to understand how to do this for OpenWRT platform. Also, according to my information, D-link DIR-300 uses this module for the PPTP connection in the latest stock firmware.

How I can modify source files before compile package?
For example, I need to modify accel-pptp-0.8.2/kernel/driver/MakeFile :

TARGET = pptp
OBJS = pptp.o  
MDIR = net

KDIR ?= $(shell sh find_kernel_headers)
#KDIR = /usr/src/linux-2.6.24-rc1

obj-m      := $(TARGET).o
#$(TARGET)-objs      := $(OBJS)

ifneq (,$(findstring 2.4.,$(CURRENT)))
CURRENT = $(shell uname -r)
EXTRA_CFLAGS = -DEXPORT_SYMTAB
PWD = $(shell pwd)
DEST = /lib/modules/$(CURRENT)/kernel/$(MDIR)
KERNEL_INCLUDE := /lib/modules/$(CURRENT)/build/include
CC = gcc -c

Now I have compiled modules, but x86, and for host system kernel headers sad

How I can create and submit patches for cross-compile accel-pptp package?

Can u help me ?

Check out this example-

https://dev.openwrt.org/browser/trunk/package/madwifi

Your Makefile should have the 'KernelPackage' section defined...

define KernelPackage/madwifi
  SUBMENU:=Wireless Drivers
  TITLE:=Driver for Atheros wireless chipsets
  URL:=http://madwifi.org/
  DEPENDS:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @!TARGET_ar7 @!TARGET_avr32 @!TARGET_etrax @!TARGET_uml
  FILES:=$(MADWIFI_FILES)
  AUTOLOAD:=$(call AutoLoad,50,$(MADWIFI_AUTOLOAD))
endef

...and the your patches (created with 'diff -ruN') go into the 'patches' directory.

Hope this helps,
Charlie

The current linux kernel does not include the pptp kernel driver under drivers/net. Which driver are you using for accel-pptp?

Try to use this code

Code:

define KernelPackage/madwifi
  SUBMENU:=Wireless Drivers
  TITLE:=Driver for Atheros wireless chipsets
  URL:=http://madwifi.org/
  DEPENDS:=+wireless-tools @PCI_SUPPORT||TARGET_atheros @!TARGET_ar7 @!TARGET_avr32 @!TARGET_etrax @!TARGET_uml
  FILES:=$(MADWIFI_FILES)
  AUTOLOAD:=$(call AutoLoad,50,$(MADWIFI_AUTOLOAD))
endef

The discussion might have continued from here.