Skip to content

Commit ceaebb3

Browse files
committed
Add support for Implied ApobNvCopy BHD directory entry
1 parent b17e2e4 commit ceaebb3

File tree

2 files changed

+47
-9
lines changed

2 files changed

+47
-9
lines changed

etc/turin-rubyred-1.0.0.2-p1.efs.json5

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13934,6 +13934,21 @@
1393413934
type: "ApcbBackup"
1393513935
}
1393613936
},
13937+
{
13938+
"source": "Implied",
13939+
"target": {
13940+
"type": "Apob",
13941+
"ram_destination_address": 0x4000000
13942+
}
13943+
},
13944+
{
13945+
"source": "Implied",
13946+
target: {
13947+
type: "ApobNvCopy",
13948+
flash_location: 0x12345678,
13949+
size: 0xd0000
13950+
}
13951+
},
1393713952
{
1393813953
source: {
1393913954
BlobFile: "Type0x64_AppbDdr5RdimmImem3_BRH.csbin"

src/main.rs

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1245,15 +1245,38 @@ fn prepare_bhd_directory_contents<'a>(
12451245
// done by try_from: raw_entry.set_size(size);
12461246
match source {
12471247
SerdeBhdSource::Implied => {
1248-
assert_eq!(entry.target.attrs.type_, BhdDirectoryEntryType::Apob,
1249-
"Implied supports is only supported for Apob, not {typ}. Are you sure you want to do that?",
1250-
typ = entry.target.attrs.type_);
1251-
assert!(flash_location.is_none(),
1252-
"You specified a fixed flash location for {typ} but it has an Implied source. What does that mean?",
1253-
typ = entry.target.attrs.type_);
1254-
custom_apob = Some(raw_entry.destination_location().expect("destination address"));
1255-
raw_entry.set_size(Some(0));
1256-
vec![(raw_entry, None, None)]
1248+
match entry.target.attrs.type_ {
1249+
BhdDirectoryEntryType::Apob => {
1250+
assert!(flash_location.is_none(), "You specified a
1251+
fixed flash location for {typ} but it has
1252+
an Implied source. What does that mean?",
1253+
typ = entry.target.attrs.type_);
1254+
custom_apob = Some(raw_entry.destination_location()
1255+
.expect("destination address"));
1256+
raw_entry.set_size(Some(0));
1257+
vec![(raw_entry, None, None)]
1258+
}
1259+
BhdDirectoryEntryType::ApobNvCopy => {
1260+
assert!(raw_entry.destination_location().is_none(),
1261+
"You specified a fixed RAM location for
1262+
{typ}. What does that mean?",
1263+
typ = entry.target.attrs.type_);
1264+
assert!(flash_location.is_some(), "You did not
1265+
specify a flash location for {typ}.",
1266+
typ = entry.target.attrs.type_);
1267+
assert_ne!(raw_entry.size(), Some(0), "You did not
1268+
specify a size for {typ}.",
1269+
typ = entry.target.attrs.type_);
1270+
vec![(raw_entry, None, None)]
1271+
}
1272+
_ => {
1273+
panic!("Implied source is only supported for Apob
1274+
and ApobNvCopy, not {typ}. Are you sure you
1275+
want to do that?",
1276+
typ = entry.target.attrs.type_);
1277+
}
1278+
}
1279+
12571280
}
12581281
SerdeBhdSource::BlobFile(blob_filename) => {
12591282
assert_ne!(entry.target.attrs.type_, BhdDirectoryEntryType::Apob,

0 commit comments

Comments
 (0)