#235 GPT MBR entry unfriendly to some BIOS

closed
Volker
5
2014-08-16
2007-08-11
Kent Hauser
No

The MBR entry created by FreeBSD GPT causes my BIOS to hang on boot. If a GPT disk is attached to the system, the BIOS will lock up and not boot any device.

The solution is to generate a more generic MBR entry. Since the MBR entry is just supposed to be for compatabilty, there is not reason to make it anything other than normal. For what it's worth, my BIOS hangs if the head field of the CHS is 255 (which it never is in PC-land).

Patch to gpt/create.c attached (and also forwarded to FreeBSD list).

Index: create.c

RCS file: /home/ncvs/src/sbin/gpt/create.c,v
retrieving revision 1.10.2.1
diff -u -r1.10.2.1 create.c
--- create.c 6 Sep 2005 23:59:01 -0000 1.10.2.1
+++ create.c 10 Aug 2007 22:08:14 -0000
@@ -93,11 +93,11 @@
mbr = gpt_read(fd, 0LL, 1);
bzero(mbr, sizeof(*mbr));
mbr->mbr_sig = htole16(MBR_SIG);
- mbr->mbr_part[0].part_shd = 0xff;
- mbr->mbr_part[0].part_ssect = 0xff;
- mbr->mbr_part[0].part_scyl = 0xff;
+ mbr->mbr_part[0].part_shd = 1;
+ mbr->mbr_part[0].part_ssect = 1;
+ mbr->mbr_part[0].part_scyl = 0;
mbr->mbr_part[0].part_typ = 0xee;
- mbr->mbr_part[0].part_ehd = 0xff;
+ mbr->mbr_part[0].part_ehd = 0xfe;
mbr->mbr_part[0].part_esect = 0xff;
mbr->mbr_part[0].part_ecyl = 0xff;
mbr->mbr_part[0].part_start_lo = htole16(1);

Discussion

  • Logged In: YES
    user_id=1370551
    Originator: NO

    Excellent, I will try to add it.
    What about the reaction about this patch on the FreeBSD mailing list ?

     
  • Volker
    Volker
    2007-08-24

    Logged In: YES
    user_id=1598685
    Originator: NO

    Hi,
    i'm sorry to say but right at the moment our build system does not support modifications on userland applications (world is not build, only kernel).
    Maybe i can create a port to make a workaround.
    Currently i've checked the FreeBSD state, but i realized that there are no responses to your post. http://www.freebsd.org/cgi/query-pr.cgi?pr=115406&cat=
    Maybe raise another PR with an higher priority to get any response.

    Greetings
    Volker

     
  • Volker
    Volker
    2007-08-24

    Logged In: YES
    user_id=1598685
    Originator: NO

    OK,
    experimental port has been added to subversion repository. See:
    http://freenas.svn.sourceforge.net/viewvc/freenas/trunk/build/ports/gpt/

    Greetings
    Volker

    P.S.: I will upload a new nightly build tomorrow including this patch.

     
  • Logged In: YES
    user_id=1312539
    Originator: NO

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 14 days (the time period specified by
    the administrator of this Tracker).