[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Building floppy images without having to mount the image



Hi again.

Maybe this is more productive than the last question.
Is avoiding to be root or modify fstab in order to do make floppy_images
something you could care about?
If it is, I have created together the following patch that does just that.
Note that you need ldlinux.sys and ldlinux.bss from the syslinux build tree
(unfortunately those are compiled into the syslinux binaries, but if you wanted
non-root-buildable floppies, it might worth trying). It also need mtools.
Obviously having the HOME=. for mtools and the dd's to get the bootsector (or
rather the right bits) in isn't too pretty, but it's the best I came up with
without using other packages or even patching mtools.
Of course the whole idea might be rubbish, too, but I just liked the idea of
having an alternative to messing with my fstab or sudo'ing.

Regards

Thomas
--- debian-installer/build/Makefile.orig	Tue Feb 11 00:16:36 2003
+++ debian-installer/build/Makefile	Tue Feb 11 00:19:36 2003
@@ -77,6 +77,9 @@
 # or just something extra on a floppy.
 #EXTRAFILES=/usr/bin/strace
 
+# Use mtools to build floppies to avoid having to mount stuff
+PREFER_MTOOLS="yes"
+
 # set DEBUG to y if you want to get the source for and compile 
 # debug versions of the needed udebs
 DEBUG=n
@@ -437,6 +440,7 @@
 	dd if=/dev/zero of=$(FLOPPY_IMAGE).new bs=1k count=$(FLOPPY_SIZE)
 	mkfs.msdos -i deb00001 -n 'Debian Installer' -C $(FLOPPY_IMAGE).new $(FLOPPY_SIZE)
 
+ifndef PREFER_MTOOLS
 ifdef USER_MOUNT_HACK
 	ln -sf `pwd`/$(FLOPPY_IMAGE).new $(USER_MOUNT_HACK)
 	mount $(TMP_MNT)
@@ -457,6 +461,21 @@
 	rm -f $(USER_MOUNT_HACK)
 else
 	syslinux $(SYSLINUX_OPTS) $(FLOPPY_IMAGE).new
+endif
+else    # ifndef PREFER_MTOOLS
+	echo drive a: file=\"$(FLOPPY_IMAGE).new\" exclusive > .mtoolsrc
+	echo MTOOLS_NO_VFAT=1 >> .mtoolsrc
+	HOME=. mcopy $(KERNEL) A:/linux
+	HOME=. mcopy $(INITRD) A:/initrd.gz
+	cp syslinux.cfg $(TEMP)/syslinux.cfg.tmp
+	todos $(TEMP)/syslinux.cfg.tmp
+	HOME=. mcopy $(TEMP)/syslinux.cfg.tmp A:/syslinux.cfg
+	rm $(TEMP)/syslinux.cfg.tmp
+	HOME=. mcopy ldlinux.sys a:\LDLINUX.SYS
+	HOME=. mattrib +r a:\LDLINUX.SYS
+	dd if=ldlinux.bss of=$(FLOPPY_IMAGE).new bs=11 count=1 conv=notrunc
+	dd if=ldlinux.bss of=$(FLOPPY_IMAGE).new bs=62 skip=1 seek=1 conv=notrunc
+	rm .mtoolsrc
 endif
 
 	# Finalize the image.

Attachment: pgpPoAg4iv3M4.pgp
Description: PGP signature


Reply to: