Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 04 Aug 2015 20:15:40 -0700
From:      David Benfell <benfell@parts-unknown.org>
To:        freebsd-questions@freebsd.org
Subject:   Re: windows entry for grub2
Message-ID:  <20150804201540.Horde.tVjfGgqFaL11N353NCxJOb4@mail.parts-unknown.org>
In-Reply-To: <55C1418A.8020904@SDF.org>
References:  <20150804034108.Horde._OTrFyjhdRQUM4x9GSp-yLG@mail.parts-unknown.org> <CAFYkXjm9eJVdVFkbzR9esVf8D9qeF5aLZ3Hj8rGRN2HRAb3Etg@mail.gmail.com> <20150804132218.Horde.Gj6WjgZdXie82Uv8hJ6DwzP@mail.parts-unknown.org> <55C1418A.8020904@SDF.org>

next in thread | previous in thread | raw e-mail | index | archive | help
This message is in MIME format and has been PGP signed.

--=_LHdbH5W2aKPDEzhp9v9QkWz
Content-Type: text/plain; charset=utf-8; format=flowed; DelSp=Yes
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Quoting Cary <cary@sdf.org>:

> David Benfell wrote:
>> Quoting CeDeROM <cederom@tlen.pl>:
>>
>>> Hello David :-)
>>>
>>> EFI is different than MBR/BIOS. I did not manage to boot Grub2/Linux on=
 my
>>> new EFI machine. Only FreeBSD and Windows starts.
>>
>> It *is* a very weird and poorly documented process and I haven't actuall=
y
>> checked to see yet if I succeeded in getting grub to work.
>
> Do you see any output after running grub-mkconfig(8) ?

Yes, and this (but see below for the resulting grub.cfg) looks like=20=20
more=20trouble:

home-desktop# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found kernel of FreeBSD: /boot/kernel/kernel
Found kernel module directory: /boot/kernel
grub-probe: error: cannot find a GRUB drive for /dev/da0p1.  Check=20=20
your=20device.map.
grub-probe: error: cannot find a GRUB drive for /dev/da1p1.  Check=20=20
your=20device.map.
done

I don't have even the first idea why it's looking for /dev/da0p1 or=20=20
/dev/da1p1.=20I've tried both creating /boot/grub/device.map with just=20=
=20
an=20entry for /dev/ada0 and deleting it.

I managed to copy in the EFI directory from my other local system. I'm=20=
=20
in=20the middle of stuff right now, so I haven't yet tested this.=20=20
grub-mkconfig=20does, however, create /boot/grub/grub.cfg which, among=20=
=20
other=20things, appears to contain entries (see below) for Windows (and=20=
=20
Dell)=20stuff.

And grub-install appears to work:

home-desktop# mount /boot/efi
home-desktop# grub-install --target x86_64-efi /dev/ada0
Installing for x86_64-efi platform.
Installation finished. No error reported.
home-desktop# ls -al /boot/efi/EFI
total 192
drwxr-xr-x  1 root  wheel  16384 Jan 21  2015 .
drwxr-xr-x  1 root  wheel  16384 Dec 31  1979 ..
drwxr-xr-x  1 root  wheel  16384 Jan 21  2015 Boot
drwxr-xr-x  1 root  wheel  16384 Jul  5  2014 Dell
drwxr-xr-x  1 root  wheel  16384 Jan 21  2015 Microsoft
drwxr-xr-x  1 root  wheel  16384 Aug  4 17:01 grub

One thing that is surprising is that I am no longer having to switch=20=20
the=20partition type back and forth between bios-boot and efi. I don't=20=
=20
know=20what changed here--oops.

grub.cfg contains:

home-desktop# cat /boot/grub/grub.cfg
#
# 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 ###
insmod part_gpt
if [ -s $prefix/grubenv ]; then
   load_env
fi
set default=3D"0"

if [ x"${feature_menuentry_id}" =3D xy ]; then
   menuentry_id_option=3D"--id"
else
   menuentry_id_option=3D""
fi

export menuentry_id_option

if [ x"${gelipassphrase}" !=3D x ]; then
   set pass=3D"$gelipassphrase"
   export pass
fi

if [ "${prev_saved_entry}" ]; then
   set saved_entry=3D"${prev_saved_entry}"
   save_env saved_entry
   set prev_saved_entry=3D
   save_env prev_saved_entry
   set boot_once=3Dtrue
fi

function savedefault {
   if [ -z "${boot_once}" ]; then
     saved_entry=3D"${chosen}"
     save_env saved_entry
   fi
}

function load_video {
   insmod vbe
   insmod vga
   insmod video_bochs
   insmod video_cirrus
}

if [ x$feature_default_font_path =3D xy ] ; then
    font=3Dunicode
else
insmod part_gpt
insmod zfs
if [ x$feature_platform_search_hint =3D xy ]; then
   search --no-floppy --fs-uuid --set=3Droot  55b27d6ad121af05
else
   search --no-floppy --fs-uuid --set=3Droot 55b27d6ad121af05
fi
     font=3D"/share/grub/unicode.pf2"
fi

if loadfont $font ; then
   if [ x"${grub_platform}" =3D xpc ] ; then
     set gfxmode=3Dauto
     load_video
     insmod gfxterm
   else
     # EFI
     insmod efi_gop
     insmod gfxterm
     insmod font
     insmod videotest
     insmod videoinfo
     set gfxmode=3Dauto
   fi
fi
terminal_output gfxterm
set timeout=3D15
### END /usr/local/etc/grub.d/00_header ###

### BEGIN /usr/local/etc/grub.d/10_kfreebsd ###
menuentry 'FreeBSD' --class freebsd --class bsd --class os=20=20
$menuentry_id_option=20'kfreebsd-simple-55a8c7840b09a772' {
	insmod part_gpt
	insmod zfs
	if [ x$feature_platform_search_hint =3D xy ]; then
	  search --no-floppy --fs-uuid --set=3Droot  55a8c7840b09a772
	else
	  search --no-floppy --fs-uuid --set=3Droot 55a8c7840b09a772
	fi
	echo			'Loading kernel of FreeBSD kernel ...'
	kfreebsd		/boot/kernel/kernel
	kfreebsd_loadenv	/boot/device.hints
	insmod part_gpt
	insmod zfs
	if [ x$feature_platform_search_hint =3D xy ]; then
	  search --no-floppy --fs-uuid --set=3Droot  55a8c7840b09a772
	else
	  search --no-floppy --fs-uuid --set=3Droot 55a8c7840b09a772
	fi
	kfreebsd_module_elf	/boot/kernel/ufs.ko
	set kFreeBSD.vfs.root.mountfrom=3Dufs:ufsid/55a8c7840b09a772
	set kFreeBSD.vfs.root.mountfrom.options=3Drw
}
submenu 'Advanced options for FreeBSD' $menuentry_id_option=20=20
'kfreebsd-advanced-55a8c7840b09a772'=20{
	menuentry 'FreeBSD, with kFreeBSD kernel' --class freebsd --class bsd=20=
=20
--class=20os $menuentry_id_option=20=20
'kfreebsd-kernel-advanced-55a8c7840b09a772'=20{
		insmod part_gpt
		insmod zfs
		if [ x$feature_platform_search_hint =3D xy ]; then
		  search --no-floppy --fs-uuid --set=3Droot  55a8c7840b09a772
		else
		  search --no-floppy --fs-uuid --set=3Droot 55a8c7840b09a772
		fi
		echo			'Loading kernel of FreeBSD kernel ...'
		kfreebsd		/boot/kernel/kernel
		kfreebsd_loadenv	/boot/device.hints
		insmod part_gpt
		insmod zfs
		if [ x$feature_platform_search_hint =3D xy ]; then
		  search --no-floppy --fs-uuid --set=3Droot  55a8c7840b09a772
		else
		  search --no-floppy --fs-uuid --set=3Droot 55a8c7840b09a772
		fi
		kfreebsd_module_elf	/boot/kernel/ufs.ko
		set kFreeBSD.vfs.root.mountfrom=3Dufs:ufsid/55a8c7840b09a772
		set kFreeBSD.vfs.root.mountfrom.options=3Drw
	}
	menuentry 'FreeBSD, with kFreeBSD kernel (recovery mode)' --class=20=20
freebsd=20--class bsd --class os $menuentry_id_option=20=20
'kfreebsd-kernel-recovery-55a8c7840b09a772'=20{
		insmod part_gpt
		insmod zfs
		if [ x$feature_platform_search_hint =3D xy ]; then
		  search --no-floppy --fs-uuid --set=3Droot  55a8c7840b09a772
		else
		  search --no-floppy --fs-uuid --set=3Droot 55a8c7840b09a772
		fi
		echo			'Loading kernel of FreeBSD kernel ...'
		kfreebsd		/boot/kernel/kernel -s
		kfreebsd_loadenv	/boot/device.hints
		insmod part_gpt
		insmod zfs
		if [ x$feature_platform_search_hint =3D xy ]; then
		  search --no-floppy --fs-uuid --set=3Droot  55a8c7840b09a772
		else
		  search --no-floppy --fs-uuid --set=3Droot 55a8c7840b09a772
		fi
		kfreebsd_module_elf	/boot/kernel/ufs.ko
		set kFreeBSD.vfs.root.mountfrom=3Dufs:ufsid/55a8c7840b09a772
		set kFreeBSD.vfs.root.mountfrom.options=3Drw
	}
}

### END /usr/local/etc/grub.d/10_kfreebsd ###

### BEGIN /usr/local/etc/grub.d/10_ktrueos ###
### END /usr/local/etc/grub.d/10_ktrueos ###

### BEGIN /usr/local/etc/grub.d/30_os-prober ###
menuentry "Chainload Disk (hd0 - /EFI/Boot/bootx64.efi)" {
    set root=3D('hd0,gpt1')
    chainloader /EFI/Boot/bootx64.efi
}

menuentry "Chainload Disk (hd0 - /EFI/Microsoft/Boot/bootmgr.efi)" {
    set root=3D('hd0,gpt1')
    chainloader /EFI/Microsoft/Boot/bootmgr.efi
}

menuentry "Chainload Disk (hd0 - /EFI/Microsoft/Boot/memtest.efi)" {
    set root=3D('hd0,gpt1')
    chainloader /EFI/Microsoft/Boot/memtest.efi
}

menuentry "Chainload Disk (hd0 - /EFI/Microsoft/Boot/bootmgfw.efi)" {
    set root=3D('hd0,gpt1')
    chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}

menuentry "Chainload Disk (hd0 - /EFI/Dell/Boot/bootmgfw.efi)" {
    set root=3D('hd0,gpt1')
    chainloader /EFI/Dell/Boot/bootmgfw.efi
}

menuentry "Chainload Disk (hd0 - /EFI/Dell/Boot/bootmgr.efi)" {
    set root=3D('hd0,gpt1')
    chainloader /EFI/Dell/Boot/bootmgr.efi
}

menuentry "Chainload Disk (hd0 - /EFI/Dell/Boot/bootx64.efi)" {
    set root=3D('hd0,gpt1')
    chainloader /EFI/Dell/Boot/bootx64.efi
}

menuentry "Chainload Disk (hd0 - /EFI/Dell/Boot/memtest.efi)" {
    set root=3D('hd0,gpt1')
    chainloader /EFI/Dell/Boot/memtest.efi
}

menuentry "Chainload Disk (hd0 - /EFI/grub/grubx64.efi)" {
    set root=3D('hd0,gpt1')
    chainloader /EFI/grub/grubx64.efi
}

menuentry "Chainload Disk (hd1)" {
    set root=3D(hd1)
    chainloader +1
}
menuentry "Chainload Disk (hd2)" {
    set root=3D(hd2)
    chainloader +1
}
### END /usr/local/etc/grub.d/30_os-prober ###

### BEGIN /usr/local/etc/grub.d/40_custom.dist ###
# This file provides an easy way to add custom menu entries.  Simply type t=
he
# menu entries you want to add after this comment.  Be careful not to chang=
e
# the 'exec tail' line above.
### END /usr/local/etc/grub.d/40_custom.dist ###

### 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 ###

### BEGIN /usr/local/etc/grub.d/50_otherbe ###
### END /usr/local/etc/grub.d/50_otherbe ###

I'm hoping for the best. As soon as I get through with all this other=20=20
stuff,=20I'll attempt a reboot and see if I can actually get into 1)=20=20
grub,=20and 2) Windows. The latter, as previously mentioned, might fail=20=
=20
because=20the files I copied in are from Windows 8.1 rather than Windows=20=
=20
10.

I=20do have another Windows 10 installation lying about but I haven't=20=20
found=20how reliably to get into the firmware to boot it under something=20=
=20
else=20that will let me actually copy the files from its EFI partition.=20=
=20
This=20other system is a super-cheap Asus laptop and Google is not being=20=
=20
my friend.

--=20
David=20Benfell <benfell@parts-unknown.org>

--=_LHdbH5W2aKPDEzhp9v9QkWz
Content-Type: application/pgp-signature
Content-Description: PGP Digital Signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAABAgAGBQJVwX/cAAoJEBV64x4SNmArziUP+gJ4SBS7JnxIoa+tiISf7oMx
gsaJ35OTspouRhjoLyZJ+dbSP15bbxDlktIiTmyBwskW29C0ejkYIjIi+FTAikwB
LlCjheZHlFLCEAPFZHqc9vRGKvdXAy13hZgLp43NPQFm/3Q0/U+1kFXrG8Pk1hvq
4asrGEm9KFOukNTtCJCgIqYz0044so9QiQnxV+H1qI2IWRbfDAkt0MsWf0mLruAY
vOgpJ35IavcPI1wWVIc06XzK74tW+z9C8Vd8jgVUX+lY5zJHJDEz2piGo7ZQmjhF
48PupkRTnSWkpCBHJELa3Ju24UBfbTMDi86Ify8Nxs/VPlRtFfIWC6ztoT+chjSt
V1iyk4HFL5EfSQV/8sLyp2nn39VO06u+WOGlDQKUFIWUC6F/v7wo5te4yC+Nvaam
DJ1AzbNaTD/zNuzkBrrflNZIzVgTEL2BaQxVPvp4oPxWZ0IERFvckDtppH8PUcGu
YZfC7oHlmcIgfEShm+ufR2CAdmaH0uiE1B8U38kj0pZ+pBR13+1JRA2XhYZ8wlcP
kYG6bWAKAyKQ9cmHPDA3JdjMV1Y8H1X/FrjHCvnGiXJfPV/KWyvieojlHQ/LNRmH
jjSfVuQvteCDzJBJS8AKcPwm3/A6QuoJfA6aYB2UVikTgP0s13UDMgZxBVjgwK8Y
VFR3kQBAeVn5I1K6guLX
=Jn/H
-----END PGP SIGNATURE-----

--=_LHdbH5W2aKPDEzhp9v9QkWz--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20150804201540.Horde.tVjfGgqFaL11N353NCxJOb4>