# How to create a DOS-bootable gpt partition



## balanga (Jun 1, 2017)

I'm attempting to boot DOS from a gpt ms-basic-data type partition. I have `dd`'ed a FREEDOS img to the partition and attempted to load it using grub chainloader. The result is:

```
partition signature !=55AA
```

Is what I'm attempting actually doable?


----------



## tingo (Jun 1, 2017)

If their wiki is up to date, FreeDOS doesn't support GPT yet: http://wiki.freedos.org/wiki/index.php/(Free)DOS_development_wishlist


----------



## Beeblebrox (Jun 2, 2017)

When using grub, FreeDOS limitations should not matter.
Try using memdisk, which is like a magic wand in most cases. Place it in /boot/grub (or wherever grub resides) & edit your grub.cfg as:

```
set root="hd0,gpt?"  # This is your grub-partition
set memfile="memdisk"  # expected to be in grub folder
set imgfile="?.img"    # name of img or iso or whatever
linux16 ($root)$memfile floppy pause    # wait=slow-down, floppy=older images require
initrd16 ($root)$imgfile
```

With, this, you don't even need a separate partition, the image file can be booted straight-up.
HTH


----------



## balanga (Jun 3, 2017)

Beeblebrox said:


> When using grub, FreeDOS limitations should not matter.
> Try using memdisk, which is like a magic wand in most cases. Place it in /boot/grub (or wherever grub resides) & edit your grub.cfg as:
> 
> ```
> ...


Many thanks for this insight.

After some experimentation, I think some progress is being made after making these changes:-

```
set root=(hd0,gpt2)
set memfile="/boot/grub/memdisk"  #  memdisk from syslinux 6.03
set imgfile="/boot/grub/dos.img"    #  balder10.img renamed as dos.img
linux16 ($root)$memfile floppy pause  
initrd16 ($root)$imgfile
```
This is what I got:-


> Booting a command list
> 
> error: you need to load the kernel first.
> 
> ...


Looks as though `memdisk` is starts but there may be something wrong with balder.img. Also which 'kernel' is being referred? It doesn't really seem to matter that it hasn't been loaded as the process continues anyway.

BTW I'm using the grub2-efi FreeBSD pkg.


----------



## Beeblebrox (Jun 3, 2017)

It was late, it slipped my mind 

The solution I gave is apparently for the FreeDOS floppy.img

The full .img file wil be more complex, as .img files are not images of a partition, but usually of a whole disk. That means they start with a bootloader and a partition table. Under normal circumstances, you have to find out the layout of the .img and modify the grub entry accordingly.

Lucky for you, memdisk has a complete how-to page. IDK which image you downloaded, so review 
http://www.syslinux.org/wiki/index.php?title=MEMDISK


----------



## balanga (Jun 3, 2017)

Thanks for pointing this out. I had actually looked at this page previously but failed to notice:



> *GRUB2*
> Add the following in your config scripts for grub2:
> 
> menuentry "Hardware Detection Tool from floppy" {
> ...



Armed with this, I'll be adding a number of entries to my FreeBSD rescue disk.


----------



## Beeblebrox (Jun 3, 2017)

Glad I could help. I have a separate Grub partition at the end of my HDD (size 128M - 256M should suffice), so that I can boot into some rescue mode no matter what.
But my main purpose of using Grub is to boot PXE clients to almost anything, including loopbacked iso files served from my http server )) . PXE allows safer virus scans on suspected Windows PC's.
I also have GPT partitioned USB sticks that allow me to Grub-boot several tools for rescuing or modifying systems.


----------



## balanga (Jun 3, 2017)

Actually, I'm a big fan of PXE... I guess you have seen Warren Block's PXE Booting Utilities page ... took me some time to make it all work, but I'd be lost without it now. I'm not sure I understand how you use Grub with PXE.... although I'm only just getting the hang of Grub, but can't get it installed with an EFI based FreeBSD.

As for PXE utilities, I'm looking for something that will boot off a PXE server and allow me to mount network resources. mfsBSD would be ideal, but it doesn't seem to support SAMBA or NFS, as it comes.


----------



## Beeblebrox (Jun 3, 2017)

It's all doable and pretty simple. I'll see if I can write a how-to


----------



## balanga (Jun 4, 2017)

Looking forward to it...


----------



## balanga (Jun 23, 2017)

Beeblebrox said:


> It's all doable and pretty simple. I'll see if I can write a how-to


How's the how-to going ?


----------



## GeorgeMitchell (Jun 26, 2017)

Looking forward to the How-To, especially if it is also applicable to putting FreeDOS on a USB hard drive.  Thanks!


----------



## Beeblebrox (Jun 29, 2017)

I need some time to get to it. Had a python web scraping project to finish.


----------

