From d5b0e08e9dfec6bdffca4b909f8188a40c541d21 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Thu, 9 Jun 2005 09:46:12 +0000 Subject: [PATCH] http://bugs.uclibc.org/view.php?id=178 This patch provides modutils and module-init-tools. I know busybox can load modules, but modinfo may also be very useful for kernel/driver debugging purposes. I have managed binaries concurrency between modutils and module-init-tools, but I'm not sure this is the best way to do it... Thanks for your work. --- package/Config.in | 2 + package/module-init-tools/Config.in | 10 +++ .../module-init-tools/module-init-tools.mk | 73 ++++++++++++++++++ .../module-init-tools/module-init-tools.patch | 77 +++++++++++++++++++ package/modutils/Config.in | 12 +++ package/modutils/modutils.mk | 62 +++++++++++++++ package/modutils/modutils.patch | 24 ++++++ 7 files changed, 260 insertions(+) create mode 100644 package/module-init-tools/Config.in create mode 100644 package/module-init-tools/module-init-tools.mk create mode 100644 package/module-init-tools/module-init-tools.patch create mode 100644 package/modutils/Config.in create mode 100644 package/modutils/modutils.mk create mode 100644 package/modutils/modutils.patch diff --git a/package/Config.in b/package/Config.in index df19a6b02f..0a4c21aa5b 100644 --- a/package/Config.in +++ b/package/Config.in @@ -66,6 +66,8 @@ source "package/microcom/Config.in" source "package/microperl/Config.in" source "package/microwin/Config.in" source "package/mkdosfs/Config.in" +source "package/module-init-tools/Config.in" +source "package/modutils/Config.in" source "package/mpg123/Config.in" source "package/mrouted/Config.in" source "package/mtd/Config.in" diff --git a/package/module-init-tools/Config.in b/package/module-init-tools/Config.in new file mode 100644 index 0000000000..7631b783da --- /dev/null +++ b/package/module-init-tools/Config.in @@ -0,0 +1,10 @@ +config BR2_PACKAGE_MODULE_INIT_TOOLS + bool "module-init-tools" + default n + help + The module-init-tools package contains a set of programs for + loading, inserting, and removing kernel modules for Linux + (versions 2.5.48 and above). It serves the same function that + the "modutils" package serves for Linux 2.4. + + http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/ diff --git a/package/module-init-tools/module-init-tools.mk b/package/module-init-tools/module-init-tools.mk new file mode 100644 index 0000000000..75bbf1b197 --- /dev/null +++ b/package/module-init-tools/module-init-tools.mk @@ -0,0 +1,73 @@ +############################################################# +# +# module-init-tools +# +############################################################# +MODULE_INIT_TOOLS_SOURCE=module-init-tools-3.1.tar.bz2 +MODULE_INIT_TOOLS_SITE=ftp://ftp.kernel.org/pub/linux/utils/kernel/module-init-tools/ +MODULE_INIT_TOOLS_DIR=$(BUILD_DIR)/module-init-tools-3.1 +MODULE_INIT_TOOLS_BINARY=modprobe +MODULE_INIT_TOOLS_TARGET_BINARY=$(TARGET_DIR)/sbin/$(MODULE_INIT_TOOLS_BINARY) + +STRIPPROG=$(STRIP) + +$(DL_DIR)/$(MODULE_INIT_TOOLS_SOURCE): + $(WGET) -P $(DL_DIR) $(MODULE_INIT_TOOLS_SITE)/$(MODULE_INIT_TOOLS_SOURCE) + +$(MODULE_INIT_TOOLS_DIR)/.source: $(DL_DIR)/$(MODULE_INIT_TOOLS_SOURCE) + bzcat $(DL_DIR)/$(MODULE_INIT_TOOLS_SOURCE) | tar -C $(BUILD_DIR) -xvf - + toolchain/patch-kernel.sh $(MODULE_INIT_TOOLS_DIR) \ + package/module-init-tools \*.patch + touch $(MODULE_INIT_TOOLS_DIR)/.source + +$(MODULE_INIT_TOOLS_DIR)/.configured: $(MODULE_INIT_TOOLS_DIR)/.source + (cd $(MODULE_INIT_TOOLS_DIR); \ + $(TARGET_CONFIGURE_OPTS) \ + INSTALL=$(MODULE_INIT_TOOLS_DIR)/install-sh \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/ \ + --sysconfdir=/etc \ + --program-transform-name='' \ + ); + touch $(MODULE_INIT_TOOLS_DIR)/.configured; + +$(MODULE_INIT_TOOLS_DIR)/$(MODULE_INIT_TOOLS_BINARY): $(MODULE_INIT_TOOLS_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(MODULE_INIT_TOOLS_DIR) + +ifeq ($(strip $(BR2_PACKAGE_MODUTILS)),y) +$(TARGET_DIR)/$(MODULE_INIT_TOOLS_TARGET_BINARY): \ + $(MODULE_INIT_TOOLS_DIR)/$(MODULE_INIT_TOOLS_BINARY) \ + modutils +else +$(TARGET_DIR)/$(MODULE_INIT_TOOLS_TARGET_BINARY): \ + $(MODULE_INIT_TOOLS_DIR)/$(MODULE_INIT_TOOLS_BINARY) +endif +ifeq ($(strip $(BR2_PACKAGE_MODUTILS)),y) + $(MAKE) prefix=$(TARGET_DIR) -C $(MODULE_INIT_TOOLS_DIR) moveold +endif + STRIPPROG='$(STRIPPROG)' \ + $(MAKE) prefix=$(TARGET_DIR) -C $(MODULE_INIT_TOOLS_DIR) install-exec + rm -Rf $(TARGET_DIR)/usr/man + +module-init-tools: uclibc $(TARGET_DIR)/$(MODULE_INIT_TOOLS_TARGET_BINARY) + +module-init-tools-source: $(DL_DIR)/$(MODULE_INIT_TOOLS_SOURCE) + +module-init-tools-clean: + $(MAKE) prefix=$(TARGET_DIR)/usr -C $(MODULE_INIT_TOOLS_DIR) uninstall + -$(MAKE) -C $(MODULE_INIT_TOOLS_DIR) clean + +module-init-tools-dirclean: + rm -rf $(MODULE_INIT_TOOLS_DIR) + +############################################################# +# +## Toplevel Makefile options +# +############################################################## +ifeq ($(strip $(BR2_PACKAGE_MODULE_INIT_TOOLS)),y) +TARGETS+=module-init-tools +endif diff --git a/package/module-init-tools/module-init-tools.patch b/package/module-init-tools/module-init-tools.patch new file mode 100644 index 0000000000..456ef1091b --- /dev/null +++ b/package/module-init-tools/module-init-tools.patch @@ -0,0 +1,77 @@ +diff -aur module-init-tools-3.1~orig/Makefile.in module-init-tools-3.1~patched/Makefile.in +--- module-init-tools-3.1~orig/Makefile.in 2004-11-15 01:59:48.000000000 +0100 ++++ module-init-tools-3.1~patched/Makefile.in 2005-03-22 22:10:26.843808464 +0100 +@@ -613,7 +613,7 @@ + check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS + check: check-am +-all-am: Makefile $(PROGRAMS) $(SCRIPTS) $(MANS) ++all-am: Makefile $(PROGRAMS) $(SCRIPTS) + + installdirs: + $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(sbindir) $(DESTDIR)$(man5dir) $(DESTDIR)$(man8dir) +@@ -760,17 +760,10 @@ + + release: check clean tarball testsuite + +-moveold: check-for-sbin check-for-old move-old-targets +- +-check-for-sbin: +- if [ "`echo $(DESTDIR)$(sbindir) | tr -s / /`" = /sbin ]; then :; \ +- else \ +- echo moveold usually only makes sense when installing into /sbin; \ +- exit 1; \ +- fi ++moveold: move-old-targets + + check-for-old: +- if [ -f /sbin/lsmod.old ]; then \ ++ if [ -f $(sbindir)/lsmod.old ]; then \ + echo Someone already moved old versions. >&2; exit 1; \ + fi + +@@ -778,27 +771,28 @@ + # RedHat 8.0 doesn't ship with readlink by default. Use ls -l. + # Also, make symlink from /bin to /sbin for lsmod (FHS compliant). + move-old-targets: ++ if [ ! -f $(sbindir)/lsmod.old ]; then \ + for f in lsmod modprobe rmmod depmod insmod modinfo; do \ +- if [ -L /sbin/$$f ]; then \ +- ln -sf `ls -l /sbin/$$f | sed 's/.* -> //'`.old /sbin/$$f; \ ++ if [ -L $(sbindir)/$$f ]; then \ ++ ln -sf `ls -l $(sbindir)/$$f | sed 's/.* -> //'`.old $(sbindir)/$$f; \ + fi; \ +- mv /sbin/$$f /sbin/$$f.old; \ +- if [ -f /usr/share/man/man8/$$f.8.gz ]; then \ +- mv /usr/share/man/man8/$$f.8.gz \ +- /usr/share/man/man8/$$f.old.8.gz; \ +- elif [ -f /usr/share/man/man8/$$f.8.bz2 ]; then \ +- mv /usr/share/man/man8/$$f.8.bz2 \ +- /usr/share/man/man8/$$f.old.8.bz2; \ +- else \ +- mv /usr/share/man/man8/$$f.8 /usr/share/man/man8/$$f.old.8; \ ++ mv $(sbindir)/$$f $(sbindir)/$$f.old; \ ++ if [ -f $(prefix)/usr/share/man/man8/$$f.8.gz ]; then \ ++ mv $(prefix)/usr/share/man/man8/$$f.8.gz \ ++ $(prefix)/usr/share/man/man8/$$f.old.8.gz; \ ++ elif [ -f $(prefix)/usr/share/man/man8/$$f.8.bz2 ]; then \ ++ mv $(prefix)/usr/share/man/man8/$$f.8.bz2 \ ++ $(prefix)/usr/share/man/man8/$$f.old.8.bz2; \ ++ elif [ -f $(prefix)/usr/share/man/man8/$$f.8 ]; then \ ++ mv $(prefix)/usr/share/man/man8/$$f.8 /usr/share/man/man8/$$f.old.8; \ + fi; \ +- done ++ done; \ + for f in kallsyms ksyms; do \ +- if [ -L /sbin/$$f ]; then \ +- ln -sf `ls -l /sbin/$$f | sed 's/.* -> //'`.old /sbin/$$f; \ ++ if [ -L $(sbindir)/$$f ]; then \ ++ ln -sf `ls -l $(sbindir)/$$f | sed 's/.* -> //'`.old $(sbindir)/$$f; \ + fi; \ +- done +- ln -s /sbin/lsmod.old /bin/lsmod.old ++ done; \ ++ fi + + # For installs in /usr/local/sbin + links: diff --git a/package/modutils/Config.in b/package/modutils/Config.in new file mode 100644 index 0000000000..581242ddca --- /dev/null +++ b/package/modutils/Config.in @@ -0,0 +1,12 @@ +config BR2_PACKAGE_MODUTILS + bool "modutils" + default n + help + The modutils packages includes the kerneld program for automatic + loading and unloading of modules, as well as other module + management programs. Examples of loaded and unloaded modules are + device drivers and filesystems, as well as some other things. + + linux v.<2.6 + + http://www.kernel.org/pub/linux/utils/kernel/modutils/v2.4 diff --git a/package/modutils/modutils.mk b/package/modutils/modutils.mk new file mode 100644 index 0000000000..01a55530db --- /dev/null +++ b/package/modutils/modutils.mk @@ -0,0 +1,62 @@ +############################################################# +# +# modutils +# +############################################################# +MODUTILS_SOURCE=modutils-2.4.27.tar.bz2 +MODUTILS_SITE=ftp://ftp.kernel.org/pub/linux/utils/kernel/modutils/v2.4/ +MODUTILS_DIR=$(BUILD_DIR)/modutils-2.4.27 +MODUTILS_BINARY=insmod +MODUTILS_TARGET_BINARY=$(TARGET_DIR)/sbin/$(MODUTILS_BINARY) + +STRIPPROG=$(STRIP) + +$(DL_DIR)/$(MODUTILS_SOURCE): + $(WGET) -P $(DL_DIR) $(MODUTILS_SITE)/$(MODUTILS_SOURCE) + +$(MODUTILS_DIR)/.source: $(DL_DIR)/$(MODUTILS_SOURCE) + bzcat $(DL_DIR)/$(MODUTILS_SOURCE) | tar -C $(BUILD_DIR) -xvf - + toolchain/patch-kernel.sh $(MODUTILS_DIR) \ + package/modutils \*.patch + touch $(MODUTILS_DIR)/.source + +$(MODUTILS_DIR)/.configured: $(MODUTILS_DIR)/.source + (cd $(MODUTILS_DIR); \ + $(TARGET_CONFIGURE_OPTS) \ + INSTALL=$(MODUTILS_DIR)/install-sh \ + ./configure \ + --target=$(GNU_TARGET_NAME) \ + --host=$(GNU_TARGET_NAME) \ + --build=$(GNU_HOST_NAME) \ + --prefix=/ \ + --sysconfdir=/etc \ + ); + touch $(MODUTILS_DIR)/.configured; + +$(MODUTILS_DIR)/$(MODUTILS_BINARY): $(MODUTILS_DIR)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(MODUTILS_DIR) + +$(TARGET_DIR)/$(MODUTILS_TARGET_BINARY): $(MODUTILS_DIR)/$(MODUTILS_BINARY) + STRIPPROG='$(STRIPPROG)' \ + $(MAKE) prefix=$(TARGET_DIR) -C $(MODUTILS_DIR) install-bin + rm -Rf $(TARGET_DIR)/usr/man + +modutils: uclibc $(TARGET_DIR)/$(MODUTILS_TARGET_BINARY) + +modutils-source: $(DL_DIR)/$(MODUTILS_SOURCE) + +modutils-clean: + $(MAKE) prefix=$(TARGET_DIR)/usr -C $(MODUTILS_DIR) uninstall + -$(MAKE) -C $(MODUTILS_DIR) clean + +modutils-dirclean: + rm -rf $(MODUTILS_DIR) + +############################################################# +# +## Toplevel Makefile options +# +############################################################## +ifeq ($(strip $(BR2_PACKAGE_MODUTILS)),y) +TARGETS+=modutils +endif diff --git a/package/modutils/modutils.patch b/package/modutils/modutils.patch new file mode 100644 index 0000000000..16a6527f83 --- /dev/null +++ b/package/modutils/modutils.patch @@ -0,0 +1,24 @@ +--- _modutils-2.4.26/Makefile.in 2005-02-01 12:41:39.000000000 +0100 ++++ modutils-2.4.26/Makefile.in 2005-02-01 12:39:18.000000000 +0100 +@@ -3,7 +3,7 @@ + include Makefile.common + + TARGETS = all install-bin clean distclean realclean dep depend +-SUBDIRS = util obj insmod genksyms depmod @kerneld_SUBDIR@ ++SUBDIRS = util obj insmod depmod @kerneld_SUBDIR@ + ifneq (@kerneld_SUBDIR@,) + SUBDIRS += man_kerneld + endif +--- _modutils-2.4.26/insmod/Makefile.in 2003-10-27 05:42:07.000000000 +0100 ++++ modutils-2.4.26/insmod/Makefile.in 2005-02-01 12:39:40.000000000 +0100 +@@ -126,10 +126,6 @@ + $(MKDIR) $(DESTDIR)$(sbindir); \ + $(INSTALL) $(STRIP) $$i $(DESTDIR)$(sbindir); done; + set -e; \ +- for i in $(srcdir)/insmod_ksymoops_clean $(srcdir)/kernelversion; do \ +- $(MKDIR) $(DESTDIR)$(sbindir); \ +- $(INSTALL) $$i $(DESTDIR)$(sbindir); done; +- set -e; \ + for i in $(COMB); do \ + ln -sf insmod $(DESTDIR)$(sbindir)/$$i; \ + (test "$(insmod_static)" = yes && \ -- 2.30.2