From 4ea909d089bcf223822d2370f022c30924dc216b Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Tue, 4 Dec 2001 15:42:15 +0000 Subject: support install from USB CDROMS (using usb-storage) --- mdk-stage1/.cvsignore | 2 +- mdk-stage1/Makefile | 23 +++++++++++------------ mdk-stage1/probing.c | 29 +++++++++++++---------------- mdk-stage1/usb-resource/update-usb-ids.pl | 10 +++------- 4 files changed, 28 insertions(+), 36 deletions(-) (limited to 'mdk-stage1') diff --git a/mdk-stage1/.cvsignore b/mdk-stage1/.cvsignore index af2397e4b..a96a43de4 100644 --- a/mdk-stage1/.cvsignore +++ b/mdk-stage1/.cvsignore @@ -8,5 +8,5 @@ debug.log *.rdz* mkinitrd_helper.tar.bz2 hack_* -stage1-usbnet +stage1-usb rescue-gui diff --git a/mdk-stage1/Makefile b/mdk-stage1/Makefile index a58fabaa7..cedaef119 100644 --- a/mdk-stage1/Makefile +++ b/mdk-stage1/Makefile @@ -23,7 +23,7 @@ # # ix86 # init with minilibc - # stage1 with dietlibc except some targets + # stage1 with dietlibc # # ppc # init with dietlibc @@ -122,8 +122,7 @@ STAGE1OBJS-NETWORK = $(subst .c,-NETWORK.o,$(STAGE1SRC) $(NETWORKSRC)) NETWORK_DEFS = -DDISABLE_CDROM -DDISABLE_DISK -STAGE1OBJS-USBNET = $(subst .c,-USBNET.o,$(STAGE1SRC) $(NETWORKSRC)) - +STAGE1OBJS-USB = $(subst .c,-USB.o,$(STAGE1SRC) $(CDROMSRC) $(DISKSRC) $(NETWORKSRC)) STAGE1OBJS-FULL = $(subst .c,-FULL.o,$(STAGE1SRC) $(CDROMSRC) $(DISKSRC) $(NETWORKSRC)) @@ -144,7 +143,7 @@ endif BINS = init stage1-full ifeq (i386, $(ARCH)) -BINS += stage1-cdrom stage1-disk stage1-network stage1-usbnet +BINS += stage1-cdrom stage1-disk stage1-network stage1-usb endif ifneq (ia64, $(ARCH)) @@ -164,8 +163,8 @@ PCMCIA_DEFS = -DENABLE_PCMCIA endif -USBNET_DEFS_GEN = -DENABLE_USB -DENABLE_USBNET -USBNET_DEFS = $(USBNET_DEFS_GEN) -DDISABLE_PCINET +USB_DEFS_GEN = -DENABLE_USB +USB_DEFS = -DENABLE_USB -DDISABLE_PCIADAPTERS all: dirs $(BINS) @@ -190,7 +189,7 @@ stage1-network: $(STAGE1OBJS-NETWORK) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(CC) $(LDFLAGS_STAGE1) -o $@ $^ $(STRIPCMD) $@ -stage1-usbnet: $(STAGE1OBJS-USBNET) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC) +stage1-usb: $(STAGE1OBJS-USB) $(STAGE1_OWN_LIBS) $(STAGE1_NETWORK_LIBS) $(FRONTEND_LINK) $(STAGE1_LIBC) $(CC) $(LDFLAGS_STAGE1) -o $@ $^ $(STRIPCMD) $@ @@ -211,11 +210,11 @@ $(STAGE1OBJS-DISK): %-DISK.o: %.c $(STAGE1OBJS-NETWORK): %-NETWORK.o: %.c $(COMPILE) $(INCLUDES) $(NETWORK_DEFS) -c $< -o $@ -$(STAGE1OBJS-USBNET): %-USBNET.o: %.c - $(COMPILE) $(INCLUDES) $(NETWORK_DEFS) $(USBNET_DEFS) -c $< -o $@ +$(STAGE1OBJS-USB): %-USB.o: %.c + $(COMPILE) $(INCLUDES) $(USB_DEFS) -c $< -o $@ $(STAGE1OBJS-FULL): %-FULL.o: %.c - $(COMPILE) $(INCLUDES) $(USBNET_DEFS_GEN) $(PCMCIA_DEFS) -c $< -o $@ + $(COMPILE) $(INCLUDES) $(USB_DEFS_GEN) $(PCMCIA_DEFS) -c $< -o $@ .c.o: $(COMPILE) $(INCLUDES) -c $< @@ -225,7 +224,7 @@ clean: @for n in $(DIRS); do \ (cd $$n; make clean) \ done - rm -f *.o .depend *.rdz *.img $(BINS) + rm -f *.o .depend *.rdz *.img rescue-gui $(BINS) tar-mkinitrd_helper: clean @@ -255,7 +254,7 @@ endif *-NETWORK.o: %-NETWORK.o: %.o -*-USBNET.o: %-USBNET.o: %.o +*-USB.o: %-USB.o: %.o *-FULL.o: %-FULL.o: %.o diff --git a/mdk-stage1/probing.c b/mdk-stage1/probing.c index 3390636e2..7dca40336 100644 --- a/mdk-stage1/probing.c +++ b/mdk-stage1/probing.c @@ -136,6 +136,7 @@ static void probe_that_type(enum driver_type type) struct pci_module_map * pcidb = NULL; switch (type) { +#ifndef DISABLE_PCIADAPTERS #ifndef DISABLE_MEDIAS case SCSI_ADAPTERS: pcidb = medias_pci_ids; @@ -143,7 +144,6 @@ static void probe_that_type(enum driver_type type) break; #endif #ifndef DISABLE_NETWORK -#ifndef DISABLE_PCINET case NETWORK_DEVICES: pcidb = network_pci_ids; len = network_num_ids; @@ -225,17 +225,6 @@ static void probe_that_type(enum driver_type type) char buf[200]; struct usb_module_map * usbdb = NULL; - switch (type) { -#ifdef ENABLE_USBNET - case NETWORK_DEVICES: - usbdb = usbnet_usb_ids; - len = usbnet_usb_num_ids; - break; -#endif - default: - goto end_usb_probe; - } - if (!already_probed_usb_controllers) { already_probed_usb_controllers = 1; probe_that_type(USB_CONTROLLERS); @@ -243,6 +232,7 @@ static void probe_that_type(enum driver_type type) if (!already_mounted_usbdev) { already_mounted_usbdev = 1; + my_insmod("usb-storage", SCSI_ADAPTERS, NULL); if (mount("/proc/bus/usb", "/proc/bus/usb", "usbdevfs", 0, NULL)) { log_message("USB: couldn't mount /proc/bus/usb"); goto end_usb_probe; @@ -257,11 +247,20 @@ static void probe_that_type(enum driver_type type) goto end_usb_probe; } + switch (type) { + case NETWORK_DEVICES: + usbdb = usb_usb_ids; + len = usb_usb_num_ids; + break; + default: + goto end_usb_probe; + } + while (1) { int i, vendor, id; if (!fgets(buf, sizeof(buf), f)) break; - + if (strstr(buf, "Keyboard")) { my_insmod("usbkbd", ANY_DRIVER_TYPE, NULL); my_insmod("keybdev", ANY_DRIVER_TYPE, NULL); @@ -273,7 +272,6 @@ static void probe_that_type(enum driver_type type) for (i = 0; i < len; i++) { if (usbdb[i].vendor == vendor && usbdb[i].id == id) { log_message("USB: device %04x %04x is \"%s\" (%s)", vendor, id, usbdb[i].name, usbdb[i].module); -#ifdef ENABLE_USBNET if (type == NETWORK_DEVICES) { stg1_info_message("About to load driver for usb network device:\n \n%s", usbdb[i].name); prepare_intf_descr(usbdb[i].name); @@ -281,7 +279,6 @@ static void probe_that_type(enum driver_type type) if (intf_descr_for_discover) /* for modules providing more than one net intf */ net_discovered_interface(NULL); } -#endif } } @@ -630,7 +627,7 @@ char ** get_net_devices(void) "tr0", "plip0", "plip1", "plip2", "fddi0", -#ifdef ENABLE_USBNET +#ifdef ENABLE_USB "usb0", "usb1", "usb2", "usb3", #endif NULL diff --git a/mdk-stage1/usb-resource/update-usb-ids.pl b/mdk-stage1/usb-resource/update-usb-ids.pl index 2e66db638..03ddb1355 100755 --- a/mdk-stage1/usb-resource/update-usb-ids.pl +++ b/mdk-stage1/usb-resource/update-usb-ids.pl @@ -25,8 +25,7 @@ struct usb_module_map { }; '; -print "#ifdef ENABLE_USB -struct pci_module_map usb_pci_ids[] = { +print "struct pci_module_map usb_pci_ids[] = { "; @@ -42,11 +41,10 @@ while (my ($k, $v) = each %$drivers) { print "}; int usb_num_ids=sizeof(usb_pci_ids)/sizeof(struct pci_module_map); -#endif "; -my @t = ('usbnet'); +my @t = ('usb'); foreach $type (@t) { @@ -56,8 +54,7 @@ foreach $type (@t) { push @$modulez, (`../mar/mar -l $_`); } - print "#ifdef ENABLE_".uc($type)." -struct usb_module_map ${type}_usb_ids[] = { + print "struct usb_module_map ${type}_usb_ids[] = { "; foreach my $usbentry (@usbtable) { grep(/^\t$usbentry->{'module'}\.o\s/, @$modulez) or next; @@ -67,7 +64,6 @@ struct usb_module_map ${type}_usb_ids[] = { print "}; int ${type}_usb_num_ids=sizeof(${type}_usb_ids)/sizeof(struct usb_module_map); -#endif "; } -- cgit v1.2.1