summaryrefslogtreecommitdiff
path: root/resources/scripts
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2023-05-14 08:16:12 +0100
committerLeah Rowe <leah@libreboot.org>2023-05-14 08:16:12 +0100
commit70e337afd08e6034f70cefbf8949a48dfbf5ec4a (patch)
treec2ec86a23f02b3f344f3e1f3a56ed4838c9b1759 /resources/scripts
parent174297885820a8500997cce87a79090059059604 (diff)
blobutil/inject: use x86 top-aligned mrc offset
the old code was specifing an absolute offset for insertion of mrc.bin - cbfstool interprets anything above 0x80000000 as top-aligned memory address in x86, and anything below as an obsolute offset in the flash, like with the old number where a top-aligned address is provided to cbfstool, the absolute position is calculated for the flash, and cbfstool inserts it in the correct rom location the benefit of this change is that the absolute offset is now calculated automatically, which means that the code will be correct even if the flash size changes. for example, if 16MB flash is used whereas 12MB is currently the default an support haswell hardware coreboot does not provide anything readably like Kconfig, for extracting this value. it's baked into the source code of coreboot, so you have to find it. the correct location is hardcoded for each platform, and always the same on each platform, regardless of mainboard
Diffstat (limited to 'resources/scripts')
-rwxr-xr-xresources/scripts/blobs/inject21
1 files changed, 19 insertions, 2 deletions
diff --git a/resources/scripts/blobs/inject b/resources/scripts/blobs/inject
index 511ac7fc..bbd6acec 100755
--- a/resources/scripts/blobs/inject
+++ b/resources/scripts/blobs/inject
@@ -233,9 +233,26 @@ inject_blob_intel_mrc()
printf 'adding mrc\n'
- # TODO: use offset defined in coreboot configs (don't hardcode)
+ # mrc.bin must be inserted at a specific offset. the only
+ # libreboot platform that needs it, at present, is haswell
+
+ # in cbfstool, -b values above 0x80000000 are interpreted as
+ # top-aligned x86 memory locations. this is converted into an
+ # absolute offset within the flash, and inserted accordingly
+ # at that offset into the ROM image file
+
+ # coreboot's own build system hardcodes the mrc.bin offset
+ # because there is only one correct location in memory, but
+ # it would be useful for lbmk if it could be easily scanned
+ # from Kconfig, with the option to change it where in practise
+ # it is not changed
+
+ # the hardcoded offset below is based upon reading of the coreboot
+ # source code, and it is *always* correct for haswell platform.
+ # TODO: this logic should be tweaked to handle more platforms
+
${cbfstool} ${rom} add -f mrc/haswell/mrc.bin -n mrc.bin -t mrc \
- -b 0x78fe00 || exit 1
+ -b 0xfffa0000 || exit 1
}
inject_blob_intel_me()