Created
August 29, 2015 05:13
-
-
Save jashank/9ec2f72126552068434c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### grub configuration for alyzon | |
# | |
# I run FreeBSD/amd64 with root-on-ZFS on a Lenovo ThinkCentre M83, | |
# which has UEFI. At the moment, this configuration is basically | |
# unsupported (although it's coming soon), but I want to be able to | |
# use my system. I've had prior experience with Lenovo UEFI boxes | |
# before (Arch on my ThinkPad T440), and I hate autogenerated GRUB | |
# configs, so I appropriated my hand-written GRUB config, and extended | |
# it. | |
# | |
# The main problem is the FreeBSD bootcode stack cannot boot a kernel | |
# with GPT, ZFS, and UEFI, all at once. Combinations are possible, | |
# but not the whole shebang. GRUB, however, has a kFreeBSD mode (for | |
# booting GNU/kFreeBSD systems, presumably), which understands how to | |
# load modules, the zpool cache, and kernel environment flags. | |
# | |
# You probably won't need some of these knobs, notably the MSI/MSI-X | |
# and TSO ones. These are to work around a broken Marvell Yukon | |
# chipset, which only _sometimes_ will pass traffic in both directions. | |
# You'll also need to check the module list for modules you want; I have | |
# a caicos-class Radeon graphics card, which I want to do KMS on. | |
# | |
# It should be noted you will probably need to recompile your kernel | |
# to support the EFI vt(4) console correctly. Otherwise, you'll get a | |
# blank screen until you (e.g.) start X. This stumped me. | |
# | |
# This requires GRUB from Git built with libZFS. | |
# | |
# -- Jashank Jeremy <[email protected]> | |
insmod part_gpt | |
insmod part_msdos | |
insmod fat | |
insmod zfs | |
insmod zfsinfo | |
if [ -s $prefix/grubenv ]; then | |
load_env | |
fi | |
if [ "${next_entry}" ] ; then | |
set default="${next_entry}" | |
set next_entry= | |
save_env next_entry | |
set boot_once=true | |
else | |
set default="0" | |
fi | |
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 | |
} | |
#insmod efi_gop | |
#insmod efi_uga | |
#loadfont ascii | |
#set gfxmode="1920x1080x32;auto" | |
#set gfxpayload=keep | |
#insmod gfxterm | |
#insmod gfxmenu | |
#insmod png | |
#terminal_output gfxterm | |
if [ x$feature_timeout_style = xy ] ; then | |
set timeout_style=menu | |
set timeout=5 | |
else | |
set timeout=5 | |
fi | |
set esp_uuid=XXXX-XXXX | |
search --no-floppy --fs-uuid --set=esp $esp_uuid | |
set root="hd0,gpt7" | |
set be="default" | |
set s=(hd0,gpt7)/ROOT/${be}/@ | |
set kern="kernel" | |
set kopts="" | |
menuentry "[alyzon] FreeBSD" --class freebsd --class os { | |
echo ":: loading ${kern} (options: ${kopts})..." | |
set p="${s}/boot/${kern}/kernel" | |
kfreebsd ${p} ${kopts} | |
kfreebsd_loadenv ${s}/boot/device.hints | |
echo ":: loading zpool.cache..." | |
kfreebsd_module ${s}/boot/zfs/zpool.cache type=/boot/zfs/zpool.cache | |
for kld in opensolaris zfs iicbus iic iicbb radeonkmsfw_CAICOS_pfp radeonkmsfw_CAICOS_me radeonkmsfw_BTC_rlc radeonkmsfw_CAICOS_mc drm2 radeonkms ; do echo ":: loading ${kld}..."; kfreebsd_module_elf ${s}/boot/${kern}/${kld}.ko; done | |
set kFreeBSD.console="efi,vidconsole" | |
set kFreeBSD.kern.vty="vt" | |
set kFreeBSD.vfs.root.mountfrom="zfs:alyzon/ROOT/${be}" | |
set kFreeBSD.vfs.zfs.arc_max="4294967296" | |
set kFreeBSD.hw.pci.enable_msi="0" | |
set kFreeBSD.hw.pci.enable_msix="0" | |
set kFreeBSD.net.inet.tcp.tso=0 | |
echo ":: booting." | |
echo "" | |
echo "--------------------------------------------------------------------" | |
echo " Due to the vagaries of graphics on this system, we may not be able" | |
echo " to display kernel probe data or boot progress. Please stand by." | |
echo "--------------------------------------------------------------------" | |
} | |
submenu "[alyzon] FreeBSD options..." { | |
submenu "kernel" { | |
menuentry "kernel" { set kern="kernel" } | |
menuentry "kernel.old" { set kern="kernel.old" } | |
menuentry "GENERIC" { set kern="GENERIC" } | |
} | |
submenu "boot environment" { | |
menuentry "default" { set be="default" } | |
} | |
submenu "kernel options (currently '${kopts}')" { | |
menuentry "single-user" { set kopts="${kopts} -s" } | |
menuentry "verbose" { set kopts="${kopts} -v" } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment