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

[PATCH] use grub to boot d-i CD



This patch uses grub to boot kfreebsd-i386 d-i CD.
Thanks to Robert Millan.

I tested this on kfreebsd-i386.
It should not affect GNU/Linux builds.


Please note that in the meantime I
* added "hw.ata.ata_dma=0"
* added/improved comments for "hw.ata.ata_dma=0" and "hw.ata.atapi_dma=0"

I'm not writing these things in a changelog entry.
I think it is not needed, because this first version on d-i with
kfreebsd support is unreleased yet.


Cheers,
Luca Favatella
Index: build/boot/kfreebsd/grub.cfg
===================================================================
--- build/boot/kfreebsd/grub.cfg	(revision 0)
+++ build/boot/kfreebsd/grub.cfg	(revision 0)
@@ -0,0 +1,18 @@
+
+set cd=$root
+
+menuentry "Install Debian GNU/kFreeBSD" {
+	echo "Loading ..."
+	set root=$cd
+	freebsd /boot/kernel/kernel.gz
+	freebsd_module_elf /boot/kernel/acpi.ko
+	freebsd_module /boot/mfsroot.gz type=mfs_root
+	set FreeBSD.vfs.root.mountfrom=ufs:/dev/md0
+	set FreeBSD.hw.ata.ata_dma=0	# needed for qemu hard disk # TODO: delete
+	set FreeBSD.hw.ata.atapi_dma=0	# needed for qemu cd # TODO: 1
+}
+
+menuentry "Boot from first hard disk" {
+	set root=hd0
+	chainloader +1
+}
Index: build/config/kfreebsd-i386.cfg
===================================================================
--- build/config/kfreebsd-i386.cfg	(revision 60021)
+++ build/config/kfreebsd-i386.cfg	(working copy)
@@ -12,28 +12,36 @@
 INITRD_FS = ufs1
 
 
+grub_moddir=/usr/lib/grub/i386-pc
+
 arch_boot_screens:
 arch_tree:
 
 
-# Miniature CD image using kfreebsd-loader, with only an initrd, no udebs or debs.
+# Miniature CD image using GRUB, with only an initrd, no udebs or debs.
 .PHONY: arch_miniiso
 arch_miniiso: $(TEMP_INITRD) $(TEMP_KERNEL) $(TREE)
 	-rm -f $(TEMP_CD_TREE)/*
-	mkdir -p $(TEMP_CD_TREE)/boot/{kernel,defaults}
+	mkdir -p $(TEMP_CD_TREE)/boot/{kernel,grub}
 
 	cp $(TEMP_KERNEL)			$(TEMP_CD_TREE)/boot/kernel/kernel.gz
 	cp $(TEMP_INITRD)			$(TEMP_CD_TREE)/boot/mfsroot.gz
 	cp $(TREE)/lib/modules/*/acpi.ko	$(TEMP_CD_TREE)/boot/kernel/
 
-	cp /boot/{cdboot,loader*,*.4th}		$(TEMP_CD_TREE)/boot/
-	cp /boot/defaults/loader.conf		$(TEMP_CD_TREE)/boot/defaults/
-	echo "hw.ata.atapi_dma=0"		>> $(TEMP_CD_TREE)/boot/loader.conf	# TODO: 1
-	echo "mfsroot_load=\"YES\""		>> $(TEMP_CD_TREE)/boot/loader.conf
-	echo "mfsroot_type=\"mfs_root\""	>> $(TEMP_CD_TREE)/boot/loader.conf
-	echo "mfsroot_name=\"/boot/mfsroot\""	>> $(TEMP_CD_TREE)/boot/loader.conf
+	cp boot/kfreebsd/grub.cfg		$(TEMP_CD_TREE)/boot/grub/
 
-	genisoimage -r -J -b boot/cdboot -c boot.cat -no-emul-boot \
+	grub-mkimage -o $(TEMP_CD_TREE)/boot/grub/core.img \
+		biosdisk \
+		minicmd normal sh echo \
+		iso9660 \
+		bsd chain \
+		$(NULL)
+	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
+
+	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)
 
 
Index: debian/changelog
===================================================================
--- debian/changelog	(revision 60021)
+++ debian/changelog	(working copy)
@@ -107,6 +107,7 @@
 
   [ Luca Favatella ]
   * Use arch indipendent code for LSB_DISTRIB_DESCRIPTION.
+  * Use grub to boot kfreebsd-i386 d-i CD. Thanks to Robert Millan.
 
  -- Frans Pop <fjp@debian.org>  Tue, 04 Aug 2009 17:40:32 +0200
 

Reply to: