1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-23 22:34:04 +02:00

add support for new modules.mk format (no autogenerated Config.in yet)

git-svn-id: svn://svn.openwrt.org/openwrt/branches/buildroot-ng/openwrt@4083 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
nbd 2006-06-26 01:55:47 +00:00
parent 77aeb32a1d
commit 539e5f19d6
5 changed files with 134 additions and 13 deletions

View File

@ -127,3 +127,93 @@ clean: FORCE
rm -f $(STAMP_DIR)/.linux-compile
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

View File

@ -107,11 +107,6 @@ $(eval $(call KMOD_template,IP6TABLES,ip6tables,\
# Block devices
$(eval $(call KMOD_template,IDE,ide,\
$(MODULES_DIR)/kernel/drivers/ide/*.o \
$(MODULES_DIR)/kernel/drivers/ide/*/*.o \
,CONFIG_IDE,,20,pdc202xx_old ide-core ide-detect ide-disk))
$(eval $(call KMOD_template,LOOP,loop,\
$(MODULES_DIR)/kernel/drivers/block/loop.o \
,CONFIG_BLK_DEV_LOOP,,20,loop))

View File

@ -112,11 +112,6 @@ $(eval $(call KMOD_template,IP6TABLES,ip6tables,\
# Block devices
$(eval $(call KMOD_template,IDE,ide,\
$(MODULES_DIR)/kernel/drivers/ide/*.ko \
$(MODULES_DIR)/kernel/drivers/ide/*/*.ko \
,CONFIG_IDE))
$(eval $(call KMOD_template,LOOP,loop,\
$(MODULES_DIR)/kernel/drivers/block/loop.ko \
,CONFIG_BLK_DEV_LOOP,,20,loop))

27
include/modules.mk Normal file
View File

@ -0,0 +1,27 @@
include $(TOPDIR)/include/kernel.mk
define KernelPackage/ide-core
TITLE:=Kernel support for IDE
DESCRIPTION:=Kernel modules for IDE support\\\
useful for usb mass storage devices (e.g. on WL-HDD)\\\
\\\
Includes: \\\
- ide-core \\\
- ide-detect \\\
- ide-disk \\\
- pdc202xx_old
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)
endef
$(eval $(call KernelPackage,ide-core))
define KernelPackage/ide-pdc202xx
TITLE:=PDC202xx IDE driver
DESCRIPTION:=PDC202xx IDE driver
KCONFIG:=CONFIG_BLK_DEV_PDC202XX_OLD
FILES:=$(MODULES_DIR)/kernel/drivers/ide/pci/pdc202xx_old.$(LINUX_KMOD_SUFFIX)
MODULES:=$(call AutoLoad,30,pdc202xx_old)
endef
$(eval $(call KernelPackage,ide-pdc202xx))

View File

@ -265,8 +265,8 @@ endmenu
menu "Block devices support"
config PACKAGE_KMOD_IDE
prompt "kmod-ide.......................... IDE support"
config PACKAGE_kmod-ide-core
prompt "kmod-ide-core..................... IDE support"
tristate
default m
depends LINUX_2_4_X86 || LINUX_2_6_X86 || LINUX_2_4_BRCM || LINUX_2_6_BRCM
@ -278,7 +278,21 @@ config PACKAGE_KMOD_IDE
- ide-core
- ide-detect
- ide-disk
- pdc202xx_old
config PACKAGE_kmod-ide-pdc202xx
prompt "kmod-ide-pdc202xx................. PDC202xx driver"
tristate
default m
depends PACKAGE_kmod-ide-core
depends LINUX_2_4_X86 || LINUX_2_6_X86 || LINUX_2_4_BRCM || LINUX_2_6_BRCM
help
Kernel modules for IDE support
useful for usb mass storage devices (e.g. on WL-HDD)
Includes:
- ide-core
- ide-detect
- ide-disk
config PACKAGE_KMOD_LOOP
prompt "kmod-loop......................... Loop mount support"