[PATCH] /tmp & make modules_install

Nicholas J. Leon (nicholas@binary9.net)
Sat, 10 Oct 1998 00:11:07 -0400 (EDT)


Okie --

Here's my contribution to the subject. As far as I'm concerned, it
contains two hacks in it. The first is to translate NET_MISC modules to
NET and NLS_MODULES to FS by hand. The second is to prevent a cp error
when installing. Apparently net/Makefile allows ipv4.o and sched.o to be
put inside NET_MISC_MODULES, yet they aren't modules (just SUBDIRs).
Instead of fixing that (I assume there is a reason its done that way and I
just don't understand it), I just made a line that checks for the
existance of the .o file before copying it.

I moved MODLIB outside the modules_install rule so that it can be
overwritten on the command line ala:

make modules_install MODLIB=/tmp/modulestest

Features (such as they are):

* no temp files used
* no hardcoded listing of module types (it looks for *_MODULES files in
the modules directory)
* can install modules anywhere ala the example above

Please, correct what I have done :)

--- linux/Makefile.dist Fri Oct 9 23:52:35 1998
+++ linux/Makefile Fri Oct 9 23:54:20 1998
@@ -298,34 +298,31 @@
$(patsubst %, _mod_%, $(SUBDIRS)) : include/linux/version.h
$(MAKE) -C $(patsubst _mod_%, %, $@) CFLAGS="$(CFLAGS) $(MODFLAGS)" MAKING_MODULES=1 modules

+MODLIB=$(INSTALL_MOD_PATH)/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)
+
modules_install:
- @( \
- MODLIB=$(INSTALL_MOD_PATH)/lib/modules/$(VERSION).$(PATCHLEVEL).$(SUBLEVEL); \
- cd modules; \
- MODULES=""; \
- inst_mod() { These="`cat $$1`"; MODULES="$$MODULES $$These"; \
- mkdir -p $$MODLIB/$$2; cp $$These $$MODLIB/$$2; \
- echo Installing modules under $$MODLIB/$$2; \
- }; \
- \
- if [ -f BLOCK_MODULES ]; then inst_mod BLOCK_MODULES block; fi; \
- if [ -f NET_MODULES ]; then inst_mod NET_MODULES net; fi; \
- if [ -f IPV4_MODULES ]; then inst_mod IPV4_MODULES ipv4; fi; \
- if [ -f IPV6_MODULES ]; then inst_mod IPV6_MODULES ipv6; fi; \
- if [ -f SCSI_MODULES ]; then inst_mod SCSI_MODULES scsi; fi; \
- if [ -f FS_MODULES ]; then inst_mod FS_MODULES fs; fi; \
- if [ -f NLS_MODULES ]; then inst_mod NLS_MODULES fs; fi; \
- if [ -f CDROM_MODULES ]; then inst_mod CDROM_MODULES cdrom; fi; \
- if [ -f HAM_MODULES ]; then inst_mod HAM_MODULES net; fi; \
- if [ -f SOUND_MODULES ]; then inst_mod SOUND_MODULES sound; fi; \
- if [ -f VIDEO_MODULES ]; then inst_mod VIDEO_MODULES video; fi; \
- if [ -f FC4_MODULES ]; then inst_mod FC4_MODULES fc4; fi; \
- \
- ls *.o > $$MODLIB/.allmods; \
- echo $$MODULES | tr ' ' '\n' | sort | comm -23 $$MODLIB/.allmods - > $$MODLIB/.misc; \
- if [ -s $$MODLIB/.misc ]; then inst_mod $$MODLIB/.misc misc; fi; \
- rm -f $$MODLIB/.misc $$MODLIB/.allmods; \
- )
+ @(cd modules; \
+ ALLMODS=`echo *.o`; \
+ echo "Installing modules under $$MODLIB"; \
+ for d in `echo *_MODULES`; do \
+ nd=`echo $$d | sed 's/_MODULES//' | tr A-Z a-z`; \
+ echo -n " $$nd"; \
+ [ "$$nd" = "net_misc" ] && nd="net"; \
+ [ "$$nd" = "nls" ] && nd="fs"; \
+ mkdir -p $$MODLIB/$$nd; \
+ for m in `cat $$d`; do \
+ ALLMODS=`echo $$ALLMODS | sed "s/$$m//"`; \
+ [ -f $$m ] && cp $$m $$MODLIB/$$nd; \
+ done; \
+ done; \
+ if [ -n "$$ALLMODS" ]; then \
+ echo -n " misc"; \
+ mkdir -p $$MODLIB/misc; \
+ for m in $$ALLMODS; do \
+ cp $$m $$MODLIB/misc; \
+ done; \
+ fi; \
+ echo)

# modules disabled....

G'day!

-- n i c h o l a s j l e o n
/ elegance through simplicity /
/ good fortune through truth / http://mrnick.binary9.net
/ not all questions have answers / mailto:nicholas@binary9.net

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/