intel partitioning system: fix build for non-x86 systems

* There is no need for the Intel partitioning system to write MBR
  bootcode on non-x86 systems
* The MBR_HEADER define is used to prevent Jam from making MBR.h
  a dependency; the dependency is then specified explicitly when
  building for x86/x86_64 platforms
This commit is contained in:
Jessica Hamilton 2015-06-04 18:30:55 +12:00
parent e460be6cbd
commit d8ba3b0990
2 changed files with 10 additions and 1 deletions

View File

@ -10,6 +10,10 @@ BuildMBR [ FGristFiles mbr.bin ] : mbr.S ;
DataFileToSourceFile [ FGristFiles MBR.h ] : [ FGristFiles mbr.bin ]
: kMBR : kMBRSize ;
if $(HAIKU_ARCH) = "x86" || $(HAIKU_ARCH) = "x86"64 {
Depends [ FGristFiles PartitionMapWriter.cpp ] : [ FGristFiles MBR.h ] ;
}
KernelAddon intel :
intel.cpp
PartitionLocker.cpp

View File

@ -37,7 +37,10 @@ using std::nothrow;
#endif
#include "MBR.h"
#if defined(__INTEL__) || defined(__x86_64__)
#define MBR_HEADER "MBR.h"
#include MBR_HEADER
#endif
bool
@ -103,12 +106,14 @@ PartitionMapWriter::WriteMBR(const PartitionMap* map, bool writeBootCode)
status_t error = _ReadBlock(0, partitionTable);
if (error != B_OK)
return error;
#ifdef MBR_HEADER
if (writeBootCode) {
// the boot code must be small enough to fit in the code area
STATIC_ASSERT(kMBRSize <= sizeof(partitionTable.code_area));
partitionTable.clear_code_area();
partitionTable.fill_code_area(kMBR, kMBRSize);
}
#endif
partitionTable.signature = kPartitionTableSectorSignature;