diff options
-rw-r--r-- | Makefile | 30 | ||||
-rwxr-xr-x | make_boot_img | 76 | ||||
-rwxr-xr-x | update_kernel | 51 |
3 files changed, 157 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..471e5abfc --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +BOOT_IMG = mdkinst_hd.img mdkinst_cdrom.img mdkinst_network.img mdkinst_network_ks.img +BINS = install/install install/local-install install/installinit/init + + + +.PHONY: $(BOOT_IMG) $(FLOPPY_IMG) $(BINS) update_kernel + +all: $(BOOT_IMG) + mkdir /export/images + cp -f $(BOOT_IMG) /export/images + +clean: + rm -rf $(BOOT_IMG) $(BINS) modules vmlinuz + +$(BOOT_IMG): $(BINS) + if [ ! -e modules ]; then $(MAKE) update_kernel; fi + ./make_boot_img $@ $(@:mdkinst_%.img=%) + +$(BINS): + $(MAKE) -C `dirname $@` + + +update_kernel: + ./update_kernel + +$(BOOT_IMG:%=%f): %f: % + dd if=$< of=/dev/fd0 + xmessage "Floppy done" + +# mkisofs -R -b images/mdkinst_cdrom.img -c images/b /tmp/r /mnt/disk/ | cdrecord -v -eject speed=6 dev=1,0 -
\ No newline at end of file diff --git a/make_boot_img b/make_boot_img new file mode 100755 index 000000000..e4bea7468 --- /dev/null +++ b/make_boot_img @@ -0,0 +1,76 @@ +#!/usr/bin/perl + +@ARGV >= 2 or die "usage: $0 <image> cdrom|hd|network|network_ks\n"; + +($img, $type) = @ARGV; + +$ks = "kickstart=floppy" if $type =~ s/_ks//; +$mnt = "/mnt/disk"; +if ($>) { + $sudo = "sudo"; + $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; +} + + +$install = $ {{ + network => "install", + cdrom => "local-install", + hd => "local-install" +}}{$type} or die; + +$0 =~ /initrd/ ? + initrd($mnt, $img) : + boot_img($mnt, $img); + +sub __ { print @_, "\n"; system(@_); } +sub _ { __ @_; $? and die; } + + +sub initrd { + my ($mnt, $img) = @_; + my $tmp = "$ENV{HOME}/tmp/initrd"; + + _ "install -s install/installinit/init install/install1/sbin/init"; + _ "install -s install/$install install/install1/sbin/install"; + + __ "$sudo umount $tmp $mnt 2>/dev/null"; + _ "dd if=/dev/zero of=$tmp bs=1k count=2000"; + _ "echo y | mke2fs $tmp"; + _ "$sudo mount $tmp $mnt -o loop"; + _ "$sudo cp -a install/install1/* $mnt"; + _ "$sudo install -d $mnt/modules"; + _ "$sudo cp -f modules/${type}_modules.cgz $mnt/modules/modules.cgz"; + _ "$sudo cp -f modules/modules.dep $mnt/modules/"; + _ "$sudo umount $mnt"; + _ "gzip -9 -c $tmp > $img"; + _ "rm -f $tmp"; +} + +sub boot_img { + my ($mnt, $img) = @_; + + __ "$sudo umount $mnt 2>/dev/null"; + _ "bunzip2 -c install/installinit/emptyboot.img.bz2 > $img"; + _ "$sudo mount -o umask=0 $img $mnt -o loop"; + _ "cat vmlinuz > $mnt/vmlinuz"; + initrd("${mnt}2", "$mnt/initrd.gz"); + + output("$mnt/syslinux.cfg", " +default linux +prompt 0 +label linux + kernel vmlinuz + append $ks initrd=initrd.gz mdkinst $type +"); + _ "cp -f install/installinit/ks.cfg $mnt 2>/dev/null" if $ks; + _ "sync"; +} + + + +sub output { + my $f = shift; + local *F; + open F, "> $f" or die "error writing to $f"; + print F join '', @_; +} diff --git a/update_kernel b/update_kernel new file mode 100755 index 000000000..9e483cd14 --- /dev/null +++ b/update_kernel @@ -0,0 +1,51 @@ +#!/bin/bash + +KERNEL_VERSION="*BOOT" +KERNEL_VERSION="2.2.11-BOOT" + +SCSI_DRIVERS=" + 53c7,8xx.o AM53C974.o BusLogic.o NCR53c406a.o advansys.o aha152x.o + aha1542.o aha1740.o aic7xxx.o dtc.o eata_dma.o eata_pio.o fdomain.o + g_NCR5380.o in2000.o megaraid.o ncr53c8xx.o pas16.o + qlogicisp.o seagate.o t128.o u14-34f.o wd7000.o ultrastor.o" + +# broken network modules: at1700.o +NETWORK_DRIVERS=" + 3c501.o 3c503.o 3c505.o 3c507.o 3c509.o 3c59x.o 82596.o 8390.o ac3200.o + epic100.o cs89x0.o de4x5.o de600.o de620.o dgrs.o e2100.o + eepro.o eepro100.o eexpress.o es3210.o eth16i.o hp-plus.o hp.o + hp100.o ibmtr.o lance.o lne390.o ne.o ne2k-pci.o ne3210.o ni52.o + ni5010.o ni65.o plip.o + pcnet32.o rtl8139.o rcpci45.o sktr.o smc9194.o smc-ultra.o + smc-ultra32.o tlan.o + tulip.o via-rhine.o wavelan.o wd.o yellowfin.o + + nfs.o lockd.o sunrpc.o" + +CD_DRIVERS="aztcd.o cm206.o isp16.o mcdx.o sbpcd.o sonycd535.o cdu31a.o gscd.o mcd.o optcd.o sjcd.o" + +BLOCK_DRIVERS="DAC960.o cpqarray.o" + +PCMCIAMODULES="pcmcia_core.o tcic.o ds.o i82365.o" + +MISCMODULES="lp.o parport_pc.o parport.o loop.o" + +FSMODULES="vfat.o fat.o" + +NETWORK_MODULES="$MISCMODULES $FSMODULES $NETWORK_DRIVERS" +CDROM_MODULES=" $MISCMODULES $FSMODULES $SCSI_DRIVERS $CD_DRIVERS" +HD_MODULES=" $MISCMODULES $FSMODULES $SCSI_DRIVERS $BLOCK_DRIVERS" + + +cp -f /boot/vmlinuz-$KERNEL_VERSION vmlinuz +rm -rf modules ; install -d modules + +(cd modules ; + cp -f `find /lib/modules/$KERNEL_VERSION -name "*.o"` . + /sbin/depmod -m /boot/System.map-$KERNEL_VERSION -i -e *.o | grep ': ' | sed 's/\.o//g' > modules.dep + ls *.o | cpio --quiet -H crc -o | bzip2 -9> modules.cpio.bz2 + ls $NETWORK_MODULES | cpio --quiet -H crc -o | gzip -9 > network_modules.cgz + ls $CDROM_MODULES | cpio --quiet -H crc -o | gzip -9 > cdrom_modules.cgz + ls $HD_MODULES | cpio --quiet -H crc -o | gzip -9 > hd_modules.cgz + rm -f $NETWORK_MODULES $CDROM_MODULES $HD_MODULES # leave in the directory non-install1 used modules +) |