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

Bootable USB images (Re: using d-i to install kfreebsd-i386 from usb)



On Thu, Dec 17, 2009 at 01:48:10PM +0000, Thorsten Glaser wrote:
> The standard (I have Ecma 119 (= ISO 9660), SUSP, RRIP and El Torito here
> as PDFs, they’re “freeware”) however specifies that the first 32 KiB of
> an ISO 9660 filesystem image are empty and available for, for example,
> bootloaders.

I found this a very interesting observation.  In fact I just implemented
support in GRUB to build USB-capable CD images, using this approach.  You
just need to dd them:

  $ dd if=mini.iso of=/dev/sdb

You will need 1.98~20091221-1 (which I just uploaded to sid), plus attached
patch.

This takes advantage of the new infrastructure for bootable image generation
(grub-mkrescue), which abstracts the architecture-specific GRUB setup so that
you only need to worry about your grub.cfg and not about image building.

-- 
Robert Millan
Index: boot/kfreebsd/grub-kfreebsd-i386.cfg
===================================================================
--- boot/kfreebsd/grub-kfreebsd-i386.cfg	(revision 61792)
+++ boot/kfreebsd/grub-kfreebsd-i386.cfg	(working copy)
@@ -3,9 +3,12 @@
 
 if loadfont /boot/grub/font.pf2 ; then
 	set gfxmode=640x480
+	insmod vbe
+	insmod gfxterm
 	terminal_output gfxterm
 fi
 
+insmod png
 if background_image /boot/grub/splash.png ; then
 	set color_normal=white/black
 	set color_highlight=black/white
Index: boot/kfreebsd/grub-kfreebsd-amd64.cfg
===================================================================
--- boot/kfreebsd/grub-kfreebsd-amd64.cfg	(revision 61792)
+++ boot/kfreebsd/grub-kfreebsd-amd64.cfg	(working copy)
@@ -3,9 +3,12 @@
 
 if loadfont /boot/grub/font.pf2 ; then
 	set gfxmode=640x480
+	insmod vbe
+	insmod gfxterm
 	terminal_output gfxterm
 fi
 
+insmod png
 if background_image /boot/grub/splash.png ; then
 	set color_normal=white/black
 	set color_highlight=black/white
Index: config/kfreebsd.cfg
===================================================================
--- config/kfreebsd.cfg	(revision 61792)
+++ config/kfreebsd.cfg	(working copy)
@@ -7,10 +7,6 @@
 # The font to load in GRUB
 GRUB_FONT=/usr/share/grub/ascii.pf2
 
-# GRUB modules
-GRUB_MODDIR=/usr/lib/grub/i386-pc
-GRUB_MODULES=biosdisk bsd chain echo gfxterm handler iso9660 minicmd normal png sh vbe
-
 # Unsupported targets
 arch_boot_screens:
 arch_tree:
@@ -32,15 +28,8 @@
 		cp $(SPLASH_PNG) $(TEMP_CD_TREE)/boot/grub/splash.png; \
 	fi
 
-	grub-mkimage -o $(TEMP_CD_TREE)/boot/grub/core.img $(GRUB_MODULES)
-	cat $(GRUB_MODDIR)/cdboot.img $(TEMP_CD_TREE)/boot/grub/core.img \
-		> $(TEMP_CD_TREE)/boot/grub/grub_eltorito
-	rm $(TEMP_CD_TREE)/boot/grub/core.img
+	grub-mkrescue --output=$(TEMP_MINIISO) $(TEMP_CD_TREE)
 
-	genisoimage -r -J -b boot/grub/grub_eltorito -c boot.cat -no-emul-boot \
-		-boot-load-size 4 -boot-info-table \
-		-o $(TEMP_MINIISO) $(TEMP_CD_TREE)
-
 # Netboot files
 .PHONY: arch_netboot_dir
 arch_netboot_dir:

Reply to: