diff options
| author | Simon Glass <[email protected]> | 2019-07-08 13:18:56 -0600 |
|---|---|---|
| committer | Simon Glass <[email protected]> | 2019-07-24 12:53:46 -0700 |
| commit | e073d4e14ff76f545a71dc40fa324618ce80adcb (patch) | |
| tree | 203f4e7197ce2986f8fde0e55b423314096224e0 /tools/binman/etype | |
| parent | 7c173ced645b9fff4d5b41849375275a8b63f04d (diff) | |
binman: Add support for fixed-offset files in CBFS
A feature of CBFS is that it allows files to be positioned at particular
offset (as with binman in general). This is useful to support
execute-in-place (XIP) code, since this may not be relocatable.
Add a new cbfs-offset property to control this.
Signed-off-by: Simon Glass <[email protected]>
Diffstat (limited to 'tools/binman/etype')
| -rw-r--r-- | tools/binman/etype/cbfs.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/tools/binman/etype/cbfs.py b/tools/binman/etype/cbfs.py index 513df217bc1..49baa6a4f63 100644 --- a/tools/binman/etype/cbfs.py +++ b/tools/binman/etype/cbfs.py @@ -52,6 +52,7 @@ class Entry_cbfs(Entry): filename = "u-boot.dtb"; cbfs-type = "raw"; cbfs-compress = "lz4"; + cbfs-offset = <0x100000>; }; }; @@ -110,6 +111,15 @@ class Entry_cbfs(Entry): to add a flat binary with a load/start address, similar to the 'add-flat-binary' option in cbfstool. + cbfs-offset: + This is the offset of the file's data within the CBFS. It is used to + specify where the file should be placed in cases where a fixed position + is needed. Typical uses are for code which is not relocatable and must + execute in-place from a particular address. This works because SPI flash + is generally mapped into memory on x86 devices. The file header is + placed before this offset so that the data start lines up exactly with + the chosen offset. If this property is not provided, then the file is + placed in the next available spot. The current implementation supports only a subset of CBFS features. It does not support other file types (e.g. payload), adding multiple files (like the @@ -172,9 +182,10 @@ class Entry_cbfs(Entry): return False data = entry.GetData() if entry._type == 'raw': - cbfs.add_file_raw(entry._cbfs_name, data, entry._cbfs_compress) + cbfs.add_file_raw(entry._cbfs_name, data, entry._cbfs_offset, + entry._cbfs_compress) elif entry._type == 'stage': - cbfs.add_file_stage(entry._cbfs_name, data) + cbfs.add_file_stage(entry._cbfs_name, data, entry._cbfs_offset) data = cbfs.get_data() self.SetContents(data) return True @@ -186,6 +197,7 @@ class Entry_cbfs(Entry): entry._cbfs_name = fdt_util.GetString(node, 'cbfs-name', entry.name) entry._type = fdt_util.GetString(node, 'cbfs-type') compress = fdt_util.GetString(node, 'cbfs-compress', 'none') + entry._cbfs_offset = fdt_util.GetInt(node, 'cbfs-offset') entry._cbfs_compress = cbfs_util.find_compress(compress) if entry._cbfs_compress is None: self.Raise("Invalid compression in '%s': '%s'" % |
