Skip to content

Commit 60795ea

Browse files
Merge pull request #1 from AndreasAakesson/master
Update conanfile
2 parents e8a709b + 54448b4 commit 60795ea

3 files changed

Lines changed: 61 additions & 7 deletions

File tree

conanfile.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ def get_version():
2121
return '0.0.0'
2222

2323

24-
class VmrunnerConan(ConanFile):
24+
class DiskbuilderConan(ConanFile):
2525
settings="os_build","arch_build"
26-
name = "diskimagebuild"
26+
name = "diskbuilder"
2727
version = get_version()
2828
license = "Apache-2.0"
2929
description = "A tool to create an IncludeOS binary filesystem image"
@@ -40,9 +40,9 @@ class VmrunnerConan(ConanFile):
4040

4141
def _cmake_configure(self):
4242
cmake=CMake(self)
43-
cmake.configure(source_folder=self.source_folder+"/diskimagebuild")
43+
cmake.configure(source_folder=self.source_folder)
4444
return cmake
45-
45+
4646
def build(self):
4747
cmake=self._cmake_configure()
4848
cmake.build()

mbr.hpp

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// More or less a copy of mbr.hpp in IncludeOS
2+
3+
#pragma once
4+
5+
#include <string>
6+
#include <cstdint>
7+
8+
struct MBR {
9+
static constexpr int PARTITIONS {4};
10+
11+
struct partition {
12+
uint8_t flags;
13+
uint8_t CHS_BEG[3];
14+
uint8_t type;
15+
uint8_t CHS_END[3];
16+
uint32_t lba_begin;
17+
uint32_t sectors;
18+
} __attribute__((packed));
19+
20+
/** Legacy BIOS Parameter Block */
21+
struct BPB {
22+
uint16_t bytes_per_sector;
23+
uint8_t sectors_per_cluster;
24+
uint16_t reserved_sectors;
25+
uint8_t fa_tables;
26+
uint16_t root_entries;
27+
uint16_t small_sectors;
28+
uint8_t media_type; // 0xF8 == hard drive
29+
uint16_t sectors_per_fat;
30+
uint16_t sectors_per_track;
31+
uint16_t num_heads;
32+
uint32_t hidden_sectors;
33+
uint32_t large_sectors; // Used if small_sectors == 0
34+
uint8_t disk_number; // Starts at 0x80
35+
uint8_t current_head;
36+
uint8_t signature; // Must be 0x28 or 0x29
37+
uint32_t serial_number; // Unique ID created by mkfs
38+
char volume_label[11]; // Deprecated
39+
char system_id[8]; // FAT12 or FAT16
40+
} __attribute__((packed));
41+
42+
struct mbr {
43+
uint8_t jump[3];
44+
char oem_name[8];
45+
uint8_t boot[435]; // Boot-code
46+
partition part[PARTITIONS];
47+
uint16_t magic; // 0xAA55
48+
49+
inline BPB* bpb() noexcept
50+
{ return reinterpret_cast<BPB*>(boot); }
51+
} __attribute__((packed));
52+
53+
static std::string id_to_name(uint8_t);
54+
}; //< struct MBR

writer.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include "filetree.hpp"
22

3-
#include "../api/fs/mbr.hpp"
3+
#include "mbr.hpp"
44
#include "fat_internal.hpp"
55
#include <cassert>
66
#include <cstring>
@@ -22,7 +22,7 @@ long FileSys::write(FILE* file)
2222
assert(file);
2323

2424
char mbr_code[SECT_SIZE];
25-
auto* mbr = (fs::MBR::mbr*) mbr_code;
25+
auto* mbr = (MBR::mbr*) mbr_code;
2626

2727
// create "valid" MBR
2828
memcpy(mbr->oem_name, "INCLUDOS", 8);
@@ -43,7 +43,7 @@ long FileSys::write(FILE* file)
4343
strcpy(BPB->volume_label, "IncludeOS");
4444
strcpy(BPB->system_id, "FAT32");
4545

46-
for (decltype(sizeof(fs::MBR::partition)) i = 0, e = 4*sizeof(fs::MBR::partition); i < e; ++i) {
46+
for (decltype(sizeof(MBR::partition)) i = 0, e = 4*sizeof(MBR::partition); i < e; ++i) {
4747
((char*) mbr->part)[i] = 0;
4848
}
4949

0 commit comments

Comments
 (0)