writembr: Implement support for GPT partitions, #4028.

* This should support both GPT and MBR formatted partitions.
* To boot Haiku from a GPT partition, it must have the correct
  BFS UUID for the partition.
* Tools such as gdisk/gptfdisk can create partitions with
  the correct BFS UUID.
This commit is contained in:
Jessica Hamilton
2015-06-04 15:07:13 +12:00
parent 6ff95509c2
commit 11e8ecdd94
6 changed files with 482 additions and 420 deletions
+13
View File
@@ -134,3 +134,16 @@ actions BootStaticLibraryObjects
$(RM) "$(1)"
$(HAIKU_AR_$(TARGET_PACKAGING_ARCH)) -r "$(1)" "$(2)" ;
}
rule BuildMBR binary : source
{
SEARCH on $(source) = $(SUBDIR) ;
MakeLocateDebug $(binary) ;
Depends $(binary) : $(source) ;
}
actions BuildMBR
{
$(RM) $(1)
$(HAIKU_CC_$(HAIKU_PACKAGING_ARCH)) $(2) -o $(1) $(MBRFLAGS) -nostdlib -Xlinker --oformat=binary -Xlinker -S -Xlinker -N -Xlinker "-e start" -Xlinker "-Ttext=0x600"
}
+2 -15
View File
@@ -4,19 +4,6 @@ HAIKU_ANYBOOT_DIR ?= $(HAIKU_DEFAULT_ANYBOOT_DIR) ;
HAIKU_ANYBOOT = $(HAIKU_ANYBOOT_NAME) ;
HAIKU_ANYBOOT_LABEL ?= $(HAIKU_DEFAULT_ANYBOOT_LABEL) ;
rule BuildAnybootMBR binary : source {
Depends $(binary) : $(source) ;
MBR_SOURCE on $(binary) = $(source) ;
BuildAnybootMBR1 $(binary) ;
}
actions BuildAnybootMBR1 {
$(RM) $(1)
$(HAIKU_NASM) -f bin $(MBR_SOURCE) -O5 -o $(1)
}
rule BuildAnybootImage anybootImage : mbrPart : isoPart : imageFile {
local anyboot = <build>anyboot ;
@@ -33,8 +20,8 @@ actions BuildAnybootImage1 {
}
local baseMBR = base_mbr.bin ;
local mbrSource = [ FDirName $(HAIKU_TOP) src bin writembr mbr.nasm ] ;
BuildAnybootMBR $(baseMBR) : $(mbrSource) ;
local mbrSource = [ FDirName $(HAIKU_TOP) src bin writembr mbr.S ] ;
BuildMBR $(baseMBR) : $(mbrSource) ;
MakeLocate $(baseMBR) : $(HAIKU_OUTPUT_DIR) ;
MakeLocate $(HAIKU_ANYBOOT) : $(HAIKU_ANYBOOT_DIR) ;
BuildAnybootImage $(HAIKU_ANYBOOT) : $(baseMBR) : $(HAIKU_CD_BOOT_IMAGE)