move some of the kernel module packaging to package/kernel/

git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4146 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Felix Fietkau 2006-07-18 16:17:19 +00:00
parent e85489b4d9
commit f525b8b028
3 changed files with 92 additions and 94 deletions

View File

@ -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 <openwrt-devel@openwrt.org>
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

87
package/kernel/Makefile Normal file
View File

@ -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

View File

@ -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))