From 19ddbe866235ff89ad9c65ed44e125c4fa6fa6d5 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Tue, 18 Jul 2006 16:17:19 +0000 Subject: [PATCH] move some of the kernel module packaging to package/kernel/ SVN-Revision: 4146 --- openwrt/include/kernel-build.mk | 89 ------------------- openwrt/package/kernel/Makefile | 87 ++++++++++++++++++ .../{include => package/kernel}/modules.mk | 10 +-- 3 files changed, 92 insertions(+), 94 deletions(-) create mode 100644 openwrt/package/kernel/Makefile rename openwrt/{include => package/kernel}/modules.mk (77%) diff --git a/openwrt/include/kernel-build.mk b/openwrt/include/kernel-build.mk index 55a74701c7..942a91516b 100644 --- a/openwrt/include/kernel-build.mk +++ b/openwrt/include/kernel-build.mk @@ -136,92 +136,3 @@ clean: FORCE rm -rf $(KERNEL_BUILD_DIR) rm -f $(TARGETS) - -define AutoLoad -add_module $(1) "$(2)"; -endef - -define KernelPackage/Defaults - VERSION:=$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE) - DEPENDS:= - MAINTAINER:=OpenWrt Developers Team - SOURCE:=$(patsubst $(TOPDIR)/%,%,${shell pwd}) - PKGARCH:=$(ARCH) - PRIORITY:=optional - KCONFIG:= - FILES:= - BUILD:= - MODULES:= - TITLE:= - DESCRIPTION:= -endef - -define KernelPackage - NAME:=$(1) - $(eval $(call KernelPackage/Defaults)) - $(eval $(call KernelPackage/$(1))) - $(eval $(call KernelPackage/$(1)/$(KERNEL))) - - PKG_$(1) := $(PACKAGE_DIR)/kmod-$(1)_$(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE)_$(ARCH).ipk - I_$(1) := $(KMOD_BUILD_DIR)/ipkg/$(1) - - IDEPEND_$(1):='kernel ($(LINUX_VERSION)-$(BOARD)-$(LINUX_RELEASE))' $(DEPENDS) - - ifeq ($$(strip $(KCONFIG)),) - KDEPEND_$(1):=m - else - KDEPEND_$(1):=$($(KCONFIG)) - endif - ifeq ($$(KDEPEND_$(1)),m) - ifneq ($(CONFIG_PACKAGE_kmod-$(1)),) - packages: $$(PKG_$(1)) - endif - ifeq ($(CONFIG_PACKAGE_kmod-$(1)),y) - install-kmod-$(1): FORCE - $(IPKG) install $$(PKG_$(1)) - pkg-install: install-kmod-$(1) - endif - endif - - $$(PKG_$(1)): $(LINUX_DIR)/.modules_done - rm -rf $$(I_$(1)) - install -d -m0755 $$(I_$(1))/CONTROL - echo "Package: kmod-$(1)" > $$(I_$(1))/CONTROL/control - echo "Version: $(VERSION)" >> $$(I_$(1))/CONTROL/control - ( \ - DEPENDS=; \ - for depend in $$(filter-out @%,$$(IDEPEND_$(1))); do \ - DEPENDS=$$$${DEPENDS:+$$$$DEPENDS, }$$$${depend##+}; \ - done; \ - echo "Depends: $$$$DEPENDS" >> $$(I_$(1))/CONTROL/control; \ - ) - echo "Source: $(SOURCE)" >> $$(I_$(1))/CONTROL/control - echo "Section: kernel" >> $$(I_$(1))/CONTROL/control - echo "Priority: $(PRIORITY)" >> $$(I_$(1))/CONTROL/control - echo "Maintainer: $(MAINTAINER)" >> $$(I_$(1))/CONTROL/control - echo "Architecture: $(PKGARCH)" >> $$(I_$(1))/CONTROL/control - echo "Description: $(DESCRIPTION)" | sed -e 's,\\,\n ,g' >> $$(I_$(1))/CONTROL/control - ifneq ($(strip $(FILES)),) - mkdir -p $$(I_$(1))/lib/modules/$(LINUX_VERSION) - $(CP) $(FILES) $$(I_$(1))/lib/modules/$(LINUX_VERSION)/ - endif - ifneq ($(MODULES),) - export modules=; \ - add_module() { \ - mkdir -p $$(I_$(1))/etc/modules.d; \ - echo "$$$$2" > $$(I_$(1))/etc/modules.d/$$$$1-$(1); \ - modules="$$$${modules:+$$$$modules }$$$$1-$(1)"; \ - }; \ - $(MODULES) \ - mkdir -p $$(I_$(1))/etc/modules.d; \ - echo "#!/bin/sh" >> $$(I_$(1))/CONTROL/postinst; \ - echo "[ -z \"\$$$$IPKG_INSTROOT\" ] || exit" >> $$(I_$(1))/CONTROL/postinst; \ - echo ". /etc/functions.sh" >> $$(I_$(1))/CONTROL/postinst; \ - echo "load_modules $$$$modules" >> $$(I_$(1))/CONTROL/postinst; \ - chmod 0755 $$(I_$(1))/CONTROL/postinst; - endif - $(IPKG_BUILD) $$(I_$(1)) $(PACKAGE_DIR) -endef - --include $(INCLUDE_DIR)/modules.mk - diff --git a/openwrt/package/kernel/Makefile b/openwrt/package/kernel/Makefile new file mode 100644 index 0000000000..580bf19371 --- /dev/null +++ b/openwrt/package/kernel/Makefile @@ -0,0 +1,87 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=kernel +PKG_VERSION:=$(LINUX_VERSION)-$(BOARD) +PKG_RELEASE:=1 + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/packages + +include $(INCLUDE_DIR)/package.mk +ifeq ($(DUMP),) +-include $(LINUX_DIR)/.config +include $(INCLUDE_DIR)/netfilter.mk +endif + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Compile +endef + +define KernelPackage/Defaults +FILES:= +KCONFIG:= +AUTOLOAD:= +endef + +define ModuleAutoLoad + export modules=; \ + add_module() { \ + mkdir -p $(2)/etc/modules.d; \ + echo "$$$$$$$$2" > $(2)/etc/modules.d/$$$$$$$$1-$(1); \ + modules="$$$$$$$${modules:+$$$$$$$$modules }$$$$$$$$1-$(1)"; \ + }; \ + $(3) \ + [ -n "$$$$$$$$modules" ] && { \ + mkdir -p $(2)/etc/modules.d; \ + echo "#!/bin/sh" >> $(2)/CONTROL/postinst; \ + echo "[ -z \"\$$$$$$$$IPKG_INSTROOT\" ] || exit" >> $(2)/CONTROL/postinst; \ + echo ". /etc/functions.sh" >> $(2)/CONTROL/postinst; \ + echo "load_modules $$$$$$$$modules" >> $(2)/CONTROL/postinst; \ + chmod 0755 $(2)/CONTROL/postinst; \ + } +endef + + +define KernelPackage + NAME:=$(1) + $(eval $(call KernelPackage/Defaults)) + $(eval $(call KernelPackage/$(1))) + $(eval $(call KernelPackage/$(1)/$(KERNEL))) + + ifneq ($(KCONFIG),m) + CONFIG_PACKAGE_kmod-$(1):= + endif + + define Package/kmod-$(1) + TITLE:=$(TITLE) + SECTION:=kernel + CATEGORY:=Kernel modules + DESCRIPTION:=$(DESCRIPTION) + EXTRA_DEPENDS:='kernel (=$(PKG_VERSION))' + endef + + define Package/kmod-$(1)/install + mkdir -p $$(1)/lib/modules/$(LINUX_VERSION) + $(CP) $(FILES) $$(1)/lib/modules/$(LINUX_VERSION)/ + $(call ModuleAutoLoad,$(1),$$(1),$(AUTOLOAD)) + endef + $$(eval $$(call BuildPackage,kmod-$(1))) +endef + +define AutoLoad +add_module $(1) "$(2)"; +endef + +include ./modules.mk + diff --git a/openwrt/include/modules.mk b/openwrt/package/kernel/modules.mk similarity index 77% rename from openwrt/include/modules.mk rename to openwrt/package/kernel/modules.mk index d20fd41bb0..b777c1177e 100644 --- a/openwrt/include/modules.mk +++ b/openwrt/package/kernel/modules.mk @@ -4,7 +4,7 @@ # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. # -include $(TOPDIR)/include/kernel.mk +# $Id$ define KernelPackage/ide-core TITLE:=Kernel support for IDE @@ -16,18 +16,18 @@ DESCRIPTION:=Kernel modules for IDE support\\\ - ide-detect \\\ - ide-disk \\\ - pdc202xx_old -KCONFIG:=CONFIG_IDE +KCONFIG:=$(CONFIG_IDE) FILES:=$(MODULES_DIR)/kernel/drivers/ide/*.$(LINUX_KMOD_SUFFIX) -MODULES:=$(call AutoLoad,20,ide-core) $(call AutoLoad,90,ide-detect ide-disk) +AUTOLOAD:=$(call AutoLoad,20,ide-core) $(call AutoLoad,90,ide-detect ide-disk) endef $(eval $(call KernelPackage,ide-core)) define KernelPackage/ide-pdc202xx TITLE:=PDC202xx IDE driver DESCRIPTION:=PDC202xx IDE driver -KCONFIG:=CONFIG_BLK_DEV_PDC202XX_OLD +KCONFIG:=$(CONFIG_BLK_DEV_PDC202XX_OLD) FILES:=$(MODULES_DIR)/kernel/drivers/ide/pci/pdc202xx_old.$(LINUX_KMOD_SUFFIX) -MODULES:=$(call AutoLoad,30,pdc202xx_old) +AUTOLOAD:=$(call AutoLoad,30,pdc202xx_old) endef $(eval $(call KernelPackage,ide-pdc202xx)) -- 2.30.2