Creating a FreeBSD multiboot USB flash drive, booting a FreeBSD iso image using GRUB.



We will start by installing Grub in the way that is most convenient for you.


cd /usr/ports/sysutils/grub2-pcbsd/


make install clean




pkg install grub2-pcbsd


Mount the usb stick and have a look at the partitions:


gpart show


Then mount the usb flash drive depending on how it is defined, mine is


mount_msdosfs /dev/da0s4 /mnt


Create a directory of boot, dev, and install GRUB on the USB-flash drive using


mkdir /mnt/boot


mkdir /mnt/dev


grub-install --boot-directory=/mnt/boot /dev/da0


Copy the iso images to a USB flash drive


cp -R /tmp/iso /mnt


Create a GRUB configuration file with the console editor EE or whatever you use.


ee /mnt/boot/grub/grub.cfg


My configuration file looks like this:



### BEGIN of grub.cfg ###

# Boot automatically after 30 secs.

set timeout=30


# By default, boot the first entry.

set default=0



insmod loopback

insmod iso9660

insmod ufs2

insmod ntfs

insmod msdosfs

menuentry "FreeBSD 13.0 amd64" {

set isofile="/iso/FreeBSD-13.0-RELEASE-amd64-disc1.iso"

loopback loop $isofile

kfreebsd (loop)/boot/kernel

set kFreeBSD.vfs.root.mountfrom=msdosfs:/dev/da0s4




menuentry "Slitaz GNU/Linux" {

loopback loop /iso/slitaz-rolling-core64.iso

linux (loop)/boot/vmlinuz-3.16.55-slitaz64 iso-scan/filename=/iso/slitaz-rolling-core64.iso boot=live quiet noeject noprompt

initrd (loop)/boot/rootfs.gz




menuentry "Clonezilla live" {

set isofile="/iso/clonezilla-live-2.8.0-27-i686.iso"

loopback loop $isofile

linux (loop)/live/vmlinuz boot=live union=overlay username=user config components quiet noswap nolocales edd=on nomodeset nodmraid ocs_live_run=\"ocs-live-general\" ocs_live_extra_param=\"\" keyboard-layouts= ocs_live_batch=\"no\" locales= vga=788 ip=frommedia nosplash toram=filesystem. squashfs findiso=$isofile

initrd (loop)/live/initrd.img





menuentry 'GParted i386' {

set gfxpayload=text # ~= vga='normal'

set isofile_abspath='/iso/gparted-live-1.0.0-5-i686.iso'

set isofile_devpath="${devroot}${isofile_abspath}"

loopback loop "(${root})${isofile_abspath}"

linux '(loop)/live/vmlinuz' boot='live' union='overlay' username='denis' config components noswap noeject toram='filesystem.squashfs' ip='' nosplash findiso='${isofile_abspath}"

initrd '(loop)/live/initrd.img'




menuentry 'ClamAV live' {

set isofile="/iso/AntivirusLiveCD-38.0-0.104.0.iso"

loopback loop $isofile

linux (loop)/boot/bzImage iso-scan/filename=/iso/AntivirusLiveCD-38.0-0.104.0.iso boot=live quiet noeject noprompt

initrd (loop)/boot/initrd.gz




### END of grub.cfg ###






Create a mount configuration file to boot FreeBSD



ee /mnt/.mount.conf


.timeout 3

.md /iso/FreeBSD-13.0-RELEASE-amd64-disc1.iso

.timeout 4

cd9660:/dev/md# ro




In this example, the multiboot USB stick will load the FreeBSD operating system, the Slitaz GNU/Linux operating system, the Clonezilla backup tool, the Gparted disk editor and ClamAV antivirus from the ISO image. Other system images can be downloaded the same way using Grub.