# Writing a custom grub2 entry



## joelkr (May 21, 2015)

I recently installed FreeBSD 10.1 on a 1T GPT disk. I installed two linux distros in the first 500G of the disk with a large LVM partition and then left the final 500G as free space and let the FreeBSD installer do what it wanted with it. This produced an install with 3 gpt partitions, one tiny partition of 64k, one main partion, and another of 4G which is evidently swap. Each of these was a separate gpt partition according to gparted. I have my linux installs booting fine after a bit of struggle, but I wondered what I should point my custom grub entry to. The 64k partition is gpt8, so I was thinking something like:

```
menuentry "FreeBSD" {
  set root='(hd0,8)'
  kfreebsd /boot/loader
}
```
My first attempt with this didn't seem to find anything, so I was wondering if I needed to tell the boot loader where to find the kernel, add insmod terms, or something else?


----------



## scottro (May 22, 2015)

On the Linux install run as root or with root privilege

`cfdisk /dev/sda`
(Or fdisk if you're familiar with it) and see partition it shows as a FreeBSD partition.

There are those pre created custom files in most Linux distros,  but I just create one called custom.cfg and put it in /boot/grub or in RedHat and its offshoots /boot/grub2.

Do you mean that you're not seeing anything in the menu when you boot the machine or that when you boot and select it it gives an error? 

I have a page on grub2, though I'm not sure if it would have any info you need, at 
http://srobb.net/grub2.html

I don't use gpt partitions though.


----------

