OK, as I said I'll work on "Adding Arch Linux to FreeBSD grub2",
here is what I was doing last hour:
/ I used another comp, because there are some spare disks, handsome for testing purpose.
It is uefi-based, but I installed this fresh FreeBSD 11.1 as non-uefi, bios-based installation.
Arch Linux is there on
NVME, and it is also bios-based (meaning non-uefi)
Nvme0 - Arch - with LUKS
Disk 1 - SSD - sda - Win10 (uefi) - irelevant
Disk 2 - SSD - sdb - FreeBSD (uefi, GELI)
Disk 3 - HDD - sdc - EXT4 Linux storage, backups
Disk 4 - HDD - sdd - NTFS storage
I erased Disk 4 and there installed FreeBSD (non-uefi) - used entire disk.
BTW, I was surprised because installation didn't offer GRUB2 as boot loader, but I think I mixed that (in my head) with TrueOS installer, which does offer it.
Then, after rebooting into that fresh installation on sdd / AKA ada3, I installed GRUB2:
Code:
# pkg install grub2
# grub-install /dev/ada3
# grub-mkconfig -o /boot/grub/grub.cfg
- there was error in cfg file, in front of every line there was one or two letters "t", but I figure that out, and edited and deleted those errors.
So there it was, fresh grub.cfg:
Code:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /usr/local/etc/grub.d and settings from /usr/local/etc/default/grub
#
### BEGIN /usr/local/etc/grub.d/00_header ###
if [ -s $prefix/grubenv ]; then
load_env
fi
set default="0"
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
if loadfont unicode ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=
insmod gettext
fi
terminal_output gfxterm
set timeout=15
### END /usr/local/etc/grub.d/00_header ###
### BEGIN /usr/local/etc/grub.d/10_kfreebsd ###
menuentry 'FreeBSD' --class freebsd --class bsd --class os $menuentry_id_option 'kfreebsd-simple-5a7caccca417dff6' {
insmod part_msdos
insmod ufs2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 5a7caccca417dff6
else
search --no-floppy --fs-uuid --set=root 5a7caccca417dff6
fi
echo 'Loading kernel of FreeBSD kernel ...'
kfreebsd /boot/kernel/kernel
kfreebsd_loadenv /boot/device.hints
insmod part_msdos
insmod ufs2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 5a7caccca417dff6
else
search --no-floppy --fs-uuid --set=root 5a7caccca417dff6
fi
kfreebsd_module_elf /boot/kernel/ufs.ko
set kFreeBSD.vfs.root.mountfrom=ufs:ufsid/5a7caccca417dff6
set kFreeBSD.vfs.root.mountfrom.options=rw
}
submenu 'Advanced options for FreeBSD' $menuentry_id_option 'kfreebsd-advanced-5a7caccca417dff6' {
menuentry 'FreeBSD, with kFreeBSD kernel' --class freebsd --class bsd --class os $menuentry_id_option 'kfreebsd-kernel-advanced-5a7caccca417dff6' {
insmod part_msdos
insmod ufs2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 5a7caccca417dff6
else
search --no-floppy --fs-uuid --set=root 5a7caccca417dff6
fi
echo 'Loading kernel of FreeBSD kernel ...'
kfreebsd /boot/kernel/kernel
kfreebsd_loadenv /boot/device.hints
insmod part_msdos
insmod ufs2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 5a7caccca417dff6
else
search --no-floppy --fs-uuid --set=root 5a7caccca417dff6
fi
kfreebsd_module_elf /boot/kernel/ufs.ko
set kFreeBSD.vfs.root.mountfrom=ufs:ufsid/5a7caccca417dff6
set kFreeBSD.vfs.root.mountfrom.options=rw
}
menuentry 'FreeBSD, with kFreeBSD kernel (recovery mode)' --class freebsd --class bsd --class os $menuentry_id_option 'kfreebsd-kernel-recovery-5a7caccca417dff6' {
insmod part_msdos
insmod ufs2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 5a7caccca417dff6
else
search --no-floppy --fs-uuid --set=root 5a7caccca417dff6
fi
echo 'Loading kernel of FreeBSD kernel ...'
kfreebsd /boot/kernel/kernel -s
kfreebsd_loadenv /boot/device.hints
insmod part_msdos
insmod ufs2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 5a7caccca417dff6
else
search --no-floppy --fs-uuid --set=root 5a7caccca417dff6
fi
kfreebsd_module_elf /boot/kernel/ufs.ko
set kFreeBSD.vfs.root.mountfrom=ufs:ufsid/5a7caccca417dff6
set kFreeBSD.vfs.root.mountfrom.options=rw
}
}
### END /usr/local/etc/grub.d/10_kfreebsd ###
### BEGIN /usr/local/etc/grub.d/30_os-prober ###
### END /usr/local/etc/grub.d/30_os-prober ###
### BEGIN /usr/local/etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /usr/local/etc/grub.d/40_custom ###
### BEGIN /usr/local/etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /usr/local/etc/grub.d/41_custom ###
Then I (
manually) inserted relevant Arch Linux part into FreeBSD's /boot/grub/grub.cfg:
Code:
### BEGIN /usr/local/etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-423334ef-0142-45fa-864f-afb675e580f1' {
insmod gzio
insmod part_msdos
insmod ext2
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root 64101886-c909-49eb-8a1d-d8b833c9132b
else
search --no-floppy --fs-uuid --set=root 64101886-c909-49eb-8a1d-d8b833c9132b
fi
echo 'Loading Linux linux ...'
linux /vmlinuz-linux root=UUID=423334ef-0142-45fa-864f-afb675e580f1 rw cryptdevice=/dev/nvme0n1p2:cryptroot:allow-discards quiet
echo 'Loading initial ramdisk ...'
initrd /initramfs-linux.img
}
### END /usr/local/etc/grub.d/40_custom ###
It may looks strange, but that is because of nvme device and LUKS encryption; You can easy modify cfg for your needs, the main thing is IT WORKS PERFECT!
