[haiku-bugs] Re: [Haiku] #8434: Building to GPT disks may write boot-code to wrong partition

  • From: "axeld" <trac@xxxxxxxxxxxx>
  • Date: Sat, 31 Mar 2012 13:00:41 -0000

#8434: Building to GPT disks may write boot-code to wrong partition
----------------------------+----------------------------
   Reporter:  tqh           |      Owner:  bonefish
       Type:  bug           |     Status:  new
   Priority:  normal        |  Milestone:  R1
  Component:  Build System  |    Version:  R1/Development
 Resolution:                |   Keywords:
 Blocked By:                |   Blocking:
Has a Patch:  0             |   Platform:  All
----------------------------+----------------------------

Comment (by axeld):

 Alright, so the problem is actually pretty simple, see http://cgit.haiku-
 os.org/haiku/tree/src/bin/makebootable/platform/bios_ia32/makebootable.cpp#n460
 -- it only parses the Intel partition map, it doesn't parse GPT as it
 would have to in this case. The FreeBSD solution has the same problem.

 If libudev is installed you could use udev_device_get_syspath() to get the
 path of the device in /sys, and then parse the "start" file to find the
 actual partition offset. Since you can never reliably guess how Linux
 assigns the device names, this should be the best solution we can come up
 with. It just adds another build dependency, though (and possibly should
 be made optional, as I don't know if udev is mandatory in Linux).

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/8434#comment:5>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: