Ticket #10723: 0001-stage1-2-loaders-auto-generate-binary-files.patch

File 0001-stage1-2-loaders-auto-generate-binary-files.patch, 6.0 KB (added by jessicah, 10 years ago)
  • src/add-ons/kernel/partitioning_systems/intel/Jamfile

    From 859481ae9cd869fe7ec12f5a56546d718a153165 Mon Sep 17 00:00:00 2001
    From: Jessica Hamilton <jessica.l.hamilton@gmail.com>
    Date: Sat, 29 Mar 2014 21:54:44 +1300
    Subject: [PATCH] stage1/2 loaders: auto-generate binary files. Fixes #10723
    
     * previously, these were manually compiled and included as data in
       other sourcefiles, or committed as-is to the tree
    ---
     .../kernel/partitioning_systems/intel/Jamfile      |   1 +
     .../intel/PartitionMapWriter.cpp                   |  34 ++-------------------
     src/system/boot/platform/bios_ia32/Jamfile         |  14 +++++++++
     src/system/boot/platform/bios_ia32/stage1.bin      | Bin 1024 -> 0 bytes
     4 files changed, 18 insertions(+), 31 deletions(-)
     delete mode 100644 src/system/boot/platform/bios_ia32/stage1.bin
    
    diff --git a/src/add-ons/kernel/partitioning_systems/intel/Jamfile b/src/add-ons/kernel/partitioning_systems/intel/Jamfile
    index 3b96273..e020a8c 100644
    a b SubDir HAIKU_TOP src add-ons kernel partitioning_systems intel ;  
    22
    33UsePrivateHeaders kernel shared storage ;
    44UsePrivateSystemHeaders ;
     5UseHeaders [ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) bin writembr ] ;
    56
    67KernelAddon intel :
    78    intel.cpp
  • src/add-ons/kernel/partitioning_systems/intel/PartitionMapWriter.cpp

    diff --git a/src/add-ons/kernel/partitioning_systems/intel/PartitionMapWriter.cpp b/src/add-ons/kernel/partitioning_systems/intel/PartitionMapWriter.cpp
    index f7fa01b..0ca194d 100644
    a b using std::nothrow;  
    3737#endif
    3838
    3939
    40 // compiled mbr boot loader code
    41 static const uint8 kBootCode[] = {
    42     // compiled form of //haiku/trunk/src/bin/writembr/mbr.S
    43     // nasm -f bin -O5 -o mbrcode.bin mbr.S -dMBR_CODE_ONLY=1
    44     // bin2h <mbrcode.bin 12
    45     0xfa, 0xfc, 0x31, 0xc0, 0x8e, 0xc0, 0x8e, 0xd8, 0x8e, 0xd0, 0xbc, 0x00,
    46     0x7c, 0xbf, 0x00, 0x08, 0xb9, 0x18, 0x00, 0xf3, 0xaa, 0xbe, 0x00, 0x7c,
    47     0x89, 0x36, 0x0c, 0x08, 0xc6, 0x06, 0x08, 0x08, 0x10, 0xc6, 0x06, 0x0a,
    48     0x08, 0x01, 0xbf, 0x00, 0x06, 0xb5, 0x01, 0xf3, 0xa5, 0xea, 0x32, 0x06,
    49     0x00, 0x00, 0xfb, 0xbe, 0xbe, 0x07, 0xb0, 0x04, 0x80, 0x3c, 0x80, 0x74,
    50     0x09, 0x83, 0xc6, 0x10, 0xfe, 0xc8, 0x75, 0xf4, 0xeb, 0x6d, 0x89, 0x36,
    51     0x04, 0x08, 0x66, 0x8b, 0x44, 0x08, 0x66, 0xa3, 0x10, 0x08, 0x66, 0x85,
    52     0xc0, 0x74, 0x27, 0xb4, 0x41, 0xbb, 0xaa, 0x55, 0xcd, 0x13, 0x72, 0x1e,
    53     0xbe, 0x08, 0x08, 0xb4, 0x42, 0xcd, 0x13, 0x72, 0x15, 0x81, 0x3e, 0xfe,
    54     0x7d, 0x55, 0xaa, 0x75, 0x42, 0xbe, 0xfb, 0x06, 0xe8, 0x52, 0x00, 0x8b,
    55     0x36, 0x04, 0x08, 0xe9, 0x82, 0x75, 0x8b, 0x36, 0x04, 0x08, 0x8a, 0x74,
    56     0x01, 0x8b, 0x4c, 0x02, 0x88, 0xc8, 0x24, 0x3f, 0x84, 0xc0, 0x74, 0x23,
    57     0x3c, 0x3f, 0x75, 0x14, 0x89, 0xc8, 0xc0, 0xec, 0x06, 0x3d, 0xff, 0x03,
    58     0x75, 0x0a, 0x80, 0xfe, 0xff, 0x75, 0x05, 0x80, 0xfe, 0xfe, 0x74, 0x0b,
    59     0xbb, 0x00, 0x7c, 0xb0, 0x01, 0xb4, 0x02, 0xcd, 0x13, 0x73, 0xb6, 0xbe,
    60     0xdf, 0x06, 0xe8, 0x10, 0x00, 0xe8, 0x08, 0x00, 0xbe, 0xd5, 0x06, 0xe8,
    61     0x07, 0x00, 0xcd, 0x18, 0xb4, 0x00, 0xcd, 0x16, 0xc3, 0x31, 0xdb, 0xac,
    62     0xb4, 0x0e, 0xcd, 0x10, 0x08, 0xc0, 0x75, 0xf7, 0xc3, 0x52, 0x4f, 0x4d,
    63     0x20, 0x42, 0x41, 0x53, 0x49, 0x43, 0x00, 0x4e, 0x6f, 0x20, 0x62, 0x6f,
    64     0x6f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x61, 0x63, 0x74, 0x69, 0x76,
    65     0x65, 0x20, 0x76, 0x6f, 0x6c, 0x75, 0x6d, 0x65, 0x0d, 0x0a, 0x00, 0x4c,
    66     0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x73, 0x79, 0x73, 0x74, 0x65,
    67     0x6d, 0x0a, 0x0d, 0x00
    68 };
     40#include "MBR.h"
    6941
    7042
    7143bool
    PartitionMapWriter::WriteMBR(const PartitionMap* map, bool writeBootCode)  
    133105        return error;
    134106    if (writeBootCode) {
    135107        // the boot code must be small enough to fit in the code area
    136         STATIC_ASSERT(sizeof(kBootCode) <= sizeof(partitionTable.code_area));
     108        STATIC_ASSERT(kMBRSize <= sizeof(partitionTable.code_area));
    137109        partitionTable.clear_code_area();
    138         partitionTable.fill_code_area(kBootCode, sizeof(kBootCode));
     110        partitionTable.fill_code_area(kMBR, kMBRSize);
    139111    }
    140112
    141113    partitionTable.signature = kPartitionTableSectorSignature;
  • src/system/boot/platform/bios_ia32/Jamfile

    diff --git a/src/system/boot/platform/bios_ia32/Jamfile b/src/system/boot/platform/bios_ia32/Jamfile
    index 347d2b4..13e805a 100644
    a b BootMergeObject boot_platform_bios_ia32.o :  
    5151    : boot_platform_generic.a
    5252;
    5353
     54rule AssembleNasmBin object : source
     55{
     56    SEARCH on $(source) = $(SUBDIR) ;
     57    MakeLocateDebug $(object) ;
     58    Depends $(object) : $(source) ;
     59}
     60
     61actions AssembleNasmBin
     62{
     63    $(HAIKU_NASM) -f bin -O5 -o $(1) $(2)
     64}
     65
     66AssembleNasmBin stage1.bin : stage1.S ;
     67
    5468# Tell the build system to where stage1.bin can be found, so it can be used
    5569# elsewhere.
    5670SEARCH on stage1.bin = $(SUBDIR) ;
  • deleted file src/system/boot/platform/bios_ia32/stage1.bin

    diff --git a/src/system/boot/platform/bios_ia32/stage1.bin b/src/system/boot/platform/bios_ia32/stage1.bin
    deleted file mode 100644
    index ba89d0e5e1b34c9ee6d734df844b41d212178280..0000000000000000000000000000000000000000
    GIT binary patch
    literal 0
    HcmV?d00001