进行目录package/kernel
mkdir url-redirect
cd url-redirect
[[email protected] url-redirect]$ tree . |-- Makefile `-- src |-- Makefile |-- line.c |-- line.h |-- proc.c |-- proc.h |-- redirect.c `-- redirect.h 1 directory, 8 files
[[email protected] url-redirect]$ cat Makefile # # Copyright (C) 2008-2012 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # include $(TOPDIR)/rules.mk include $(INCLUDE_DIR)/kernel.mk PKG_NAME:=url-redirect PKG_RELEASE:=1 include $(INCLUDE_DIR)/package.mk define KernelPackage/url-redirect SUBMENU:=Other modules DEPENDS:[email protected]!LINUX_3_3 TITLE:=Lester‘s Test FILES:=$(PKG_BUILD_DIR)/url-redirect.ko AUTOLOAD:=$(call AutoLoad,99,url-redirect,1) KCONFIG:= endef define KernelPackage/url-redirect/description This is a url redirect model endef MAKE_OPTS:= ARCH="$(LINUX_KARCH)" CROSS_COMPILE="$(TARGET_CROSS)" SUBDIRS="$(PKG_BUILD_DIR)" define Build/Prepare mkdir -p $(PKG_BUILD_DIR) $(CP) ./src/* $(PKG_BUILD_DIR)/ endef define Build/Compile $(MAKE) -C "$(LINUX_DIR)" $(MAKE_OPTS) modules endef $(eval $(call KernelPackage,url-redirect))
[[email protected] url-redirect]$ cat src/Makefile obj-m := url-redirect.o url-redirect-objs := proc.o line.o redirect.o
cd ../../../
make menuconfig
Kernel modules ---> Other modules ---> <M> kmod-url-redirect.......................................... Lester‘s Test
make V=99 -j 12
时间: 2024-10-25 07:27:56