# sysutils/grub2 patch for grub-mkconfig to work correctly



## free-and-bsd (Dec 8, 2014)

Those using sysutils/grub2 may have noticed that grub-mkconfig produces useless output. Now here is a patch correcting the configuration for FreeBSD in /usr/local/etc/grub.d/10_kfreebsd and it now produces usable grub.cfg -- at least on my system on ZFS root.
Would like to see how it works for other configurations.

UPDATED: updated the patch to apply less alterations, suggesting that what is there is there for a reason. So let it be there but serve our purpose.


----------



## woodsb02 (Dec 12, 2014)

The CBSD team use GRUB2. Might be a good idea to ask them if they have noticed this issue and used a similar patch?


----------



## free-and-bsd (Dec 12, 2014)

woodsb02 said:


> The PCBSD team use GRUB2. Might be a good idea to ask them if they have noticed this issue and used a similar patch?


Oh, since you've mentioned it, we also have this port sysutils/grub2-pcbsd. Maybe this issue is fixed there, I never tried, because this port pulls in a couple of dependencies I don't want on my system. Anyway, this patch is for a different port, sysutils/grub2. But whether or not it is needed I don't know, I've submitted a PR.

Now as I understand it, the file in question may be meant _not_ for FreeBSD itself, but for GNU/Linux (namely Debian) running the kFreeBSD kernel. In which case this patch is not welcome there, but in that case, in addition to 10_kfreebsd file there may be created a separate file named, say, 20_freebsd, to search for a native FreeBSD system running kFreeBSD (in GRUB2 terms) kernel. And perhaps the GNU folks leave such things to the FreeBSD port maintainers. I don't entirely follow their logic in the GRUB2 scripts, seeing that grub-mkconfig produces almost garbage and even back in my Linux days I had to create my configuration by hand. Which was also a recommended way of doing it as per HOWTOs...


----------

