INTRODUCTION
DragonFlyBSD is the novel derivative of FreeBSD with the Hammer filesystem, which includes as main features: failure recovery, checking of data integrity, control of the history of the files, as well as the possibility of making a mirror to other volumes.
GRUB2, although still under development, already allows much more than its predecessor Grub 0.97.
In our case, Grub2 allowed us to boot an operating system, DragonFlyBSD, installed on a disk not recognised by the BIOS, and which therefore could not be booted with the traditional boot managers.
INITIAL CONSIDERATIONS
The computer used is an old computer without a SATA disk controller, and no option in the BIOS to recognise those hard disks. A PCI controller for SATA disks was recently added to it, but that does not change the fact that it is not recognised by the BIOS.
So we have:
- 1 IDE disk with Debian GNU/Linux installed.
- 1 SATA disk not recognised by the BIOS.
INSTALLING DragonFlyBSD
We download the DragonFly LiveCD from http://www.dragonflybsd.org/download/ and burn it to a CD.
I boot the computer with the LiveCD, which at the end of the boot allows us to log in as root to try the operating system, or as installer. When logging in as installer the installation process starts, which DOES recognise the SATA hard disk, and I install DragonFly on it. The process is very simple and linear. I choose the Hammer filesystem, instead of the traditional UFS.
We now have DragonFly installed, but I still cannot boot it, since the BIOS does not recognise it…
So before rebooting we log in as root in the LiveCD and copy the DragonFly kernel to the Debian partition where grub2 will be.
mkdir /tmp/ad0s1
mount_ext2fs /dev/ad0s1 /tmp/ad0s1
mkdir /tmp/ad0s1/boot/dragonfly
cp /boot/kernel /tmp/ad0s1/boot/dragonfly/
umount /tmp/ad0s1
Replace ad0s1 with the partition of your hard disk that contains grub. You can use dmesg, mount and fdisk to help you find out which one it is.
It is time to reboot and boot Debian from the first IDE disk.
INSTALLING GRUB
From Debian, we install grub2. You can use your favourite package manager (synaptic, aptitude, etc…) In my case.
# apt-get install grub2 grub-common grub-pc grub-splashimages
These are the versions of the packages that were installed:
ii grub-common 1.96+20090603-1
GRand Unified Bootloader, version 2 (common files)
ii grub-pc 1.96+20090603-1
GRand Unified Bootloader, version 2 (PC/BIOS version)
ii grub-splashimages 1.2.3
a collection of great GRUB splashimages
ii grub2 1.96+20090603-1
GRand Unified Bootloader, version 2 (dummy package)
In Debian, we get the following message:
Los scripts de actualización han detectado en /boot/grub una configuración
heredada de una versión anterior de GRUB.
Para reemplazar la versión anterior de GRUB en su sistema, se recomienda
que se ajuste /boot/grub/menu.lst para que cargue en cadena a partir de su
configuración preexistente de GRUB. Este paso debería hacerse ahora de forma
automática.
Antes de instalar GRUB 2 directamente en el MBR («Master Boot Record») se
recomienda que acepte cargarlo en cadena desde el menu.lst y que verifique que
puede utilizar la nueva configuración de GRUB 2.
En cualquier caso, cuando quiera que GRUB 2 se inicie directamente desde
el MBR, puede hacerlo usando (como root) la siguiente orden:
upgrade-from-grub-legacy
¿Desea realizar la carga en cadena desde menu.lst?
We recommend accepting Debian’s suggestion, which is handy for testing until we make sure that grub2 has been perfectly configured, and what it means to us is that grub2 will be chainloaded from grub-legacy.
If we make any mistake in the grub2 configuration we will always be able to keep booting from grub, and once we verify that grub2 is perfect, we will be able to install grub2 in the MBR with the command: upgrade-from-grub-legacy.
For now, let’s continue.
INSTALLING GRUB2 WITH THE ATA MODULE
You can skip the part about modifying grub-install if your computer recognises the SATA hard disks without problems.
GRUB2 has a modular design, and when installing it we can choose which modules we want to be installed.
We copy all the modules into /boot/grub
cp /usr/lib/grub/i386-pc/*.mod /boot/grub
We apply this patch to /usr/sbin/grub-install. You can use the patch tool, or modify it manually.
Removing the lines that begin with «-» and adding those that begin with «+».
With this patch we tell grub2 to always use the ata module to
detect all the hard disks (SATA included), skipping whatever the
BIOS has told it.
--- grub-install.old 2009-06-04 09:02:32.000000000 +0200
+++ grub-install 2009-06-11 15:51:43.000000000 +0200
@@ -254,7 +254,7 @@
# The order in this list is critical. Be careful when modifying it.
if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
- modules="$modules biosdisk"
+ modules="$modules ata"
else
modules="$modules ata"
fi
@@ -267,7 +267,7 @@
else
install_drive="`$grub_probe --target=drive --device ${install_device}`"
fi
- grub_drive="`$grub_probe --target=drive --device ${grub_device}`"
+ grub_drive="`$grub_probe --target=drive --device ${grub_device}|sed -e 's/h
d/ata/'`"
# Strip partition number
install_drive="`echo ${install_drive} | sed -e s/,[0-9]*[a-z]*//g`"
@@ -291,7 +291,9 @@
modules="$modules fs_uuid"
fi
else
- prefix_drive=`$grub_probe --target=drive --device ${grub_device}`
+ uuid="`$grub_probe --target=fs_uuid --device ${grub_device}`"
+ prefix_drive="(UUID=${uuid})"
+ modules="$modules fs_uuid"
fi
relative_grubdir=`make_system_path_relative_to_its_root ${grubdir}` || exit 1
In future versions of Grub2 the «–disk-module» parameter will be included, which will avoid having to patch grub-install.
We modify /etc/grub.d/40_custom and add the entry to be able to boot DragonFlyBSD.
menuentry "DragonFlyBSD" {
set root=(ata3)
# chainloader +1 #No se usa. No hacemos chainload porque la BIOS no reconoce ese disco
freebsd (ata0,1)/boot/dragonfly/kernel
set FreeBSD.vfs.root.mountfrom=hammer:ad6s1a
}
Notes:
(ata0,1)
refers to the first partition of the first hard disk. Where grub2 is installed, and where we previously copied the DragonFly kernel.
(We got this value because in our experiments during earlier boots we saw that grub2 allows doing «ls» at its prompt to list the hard disks, or even the contents of the hard disks. A marvel.
ataX,X is the nomenclature of the disks when the ata module of grub2 is used
)
hammer:ad6s1a
refers to mounting the ad6s1a disk (according to DragonFlyBSD’s nomenclature) with the hammer filesystem.
(We got this value after installing DragonFlyBSD with the LiveCD; from the LiveCD we learned how DragonFlyBSD recognises the second SATA disk)
It is time to install GRUB2, in the first partition of the IDE hard disk, with the modules that worked for us. We install it in the first partition of the IDE hard disk (Debian) /dev/hda1 instead of the MBR, since as we have said we will keep grub-legacy until we confirm that grub2 can boot all the operating systems.
This must be run on a single line.
grub-install --modules="date pc ata boot ls gpt raid ext2 ufs fat echo cpio gzio
gfxterm video aout pcpart extcmd help reboot blocklist fs_uuid sh parttool linux
fshelp dm_nv datehook jpeg test bsd cmp memdisk acpi elf affs xfs cpuid crc play
mdraid sleep search chain lua memrw ata_pthru configfile linux16 raid5rec hello
vga_text vbeinfo gptsync bufio hdparm bitmap terminfo hfs lsmmap png tar lspci
tga scsi lvm raid iso9660 raid6rec udf vbe handler raid6rec halt read multiboot
xnu normal loopback sfs jfs vbetest cat afs hexdump loadenv minicmd drivemap
font vga" /dev/hda1
This will generate the file /boot/grub/grub.cfg with all the lines that allow booting our operating systems. We see that the line to boot DragonFlyBSD also appears, since grub-install takes care of adding
/etc/grub.d/40_custom to grub.cfg.
We can now reboot the computer. We will get the typical Grub-Legacy window, with an option to Chainload to Grub2, along with the other lines to boot our operating systems.
If we choose to boot Grub2, we will see the options of Grub2.cfg and we will be able to boot DragonFlyBSD.
Enjoy it.