File tree Expand file tree Collapse file tree 4 files changed +43
-18
lines changed
base/cvd/cuttlefish/host/libs/image_aggregator Expand file tree Collapse file tree 4 files changed +43
-18
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,7 @@ cf_cc_library(
7777
7878cf_cc_library (
7979 name = "mbr" ,
80+ srcs = ["mbr.cc" ],
8081 hdrs = ["mbr.h" ],
8182)
8283
Original file line number Diff line number Diff line change @@ -53,24 +53,6 @@ namespace {
5353
5454constexpr int GPT_NUM_PARTITIONS = 128 ;
5555
56- /* *
57- * Creates a "Protective" MBR Partition Table header. The GUID
58- * Partition Table Specification recommends putting this on the first sector
59- * of the disk, to protect against old disk formatting tools from misidentifying
60- * the GUID Partition Table later and doing the wrong thing.
61- */
62- MasterBootRecord ProtectiveMbr (std::uint64_t size) {
63- MasterBootRecord mbr = {
64- .partitions = {{
65- .partition_type = 0xEE ,
66- .first_lba = 1 ,
67- .num_sectors = (std::uint32_t )size / kSectorSize ,
68- }},
69- .boot_signature = {0x55 , 0xAA },
70- };
71- return mbr;
72- }
73-
7456struct __attribute__ ((packed)) GptHeader {
7557 std::uint8_t signature[8 ];
7658 std::uint8_t revision[4 ];
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (C) 2020 The Android Open Source Project
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+ #include " cuttlefish/host/libs/image_aggregator/mbr.h"
17+
18+ #include < stdint.h>
19+
20+ namespace cuttlefish {
21+
22+ MasterBootRecord ProtectiveMbr (uint64_t size) {
23+ MasterBootRecord mbr = {
24+ .partitions = {{
25+ .partition_type = 0xEE ,
26+ .first_lba = 1 ,
27+ .num_sectors = (uint32_t )size / kSectorSize ,
28+ }},
29+ .boot_signature = {0x55 , 0xAA },
30+ };
31+ return mbr;
32+ }
33+
34+ } // namespace cuttlefish
Original file line number Diff line number Diff line change @@ -39,4 +39,12 @@ struct __attribute__((packed)) MasterBootRecord {
3939
4040static_assert (sizeof (MasterBootRecord) == kSectorSize );
4141
42+ /* *
43+ * Creates a "Protective" MBR Partition Table header. The GUID
44+ * Partition Table Specification recommends putting this on the first sector
45+ * of the disk, to protect against old disk formatting tools from misidentifying
46+ * the GUID Partition Table later and doing the wrong thing.
47+ */
48+ MasterBootRecord ProtectiveMbr (uint64_t size);
49+
4250} // namespace cuttlefish
You can’t perform that action at this time.
0 commit comments