[coreboot-gerrit] Change in coreboot[master]: [WIP]cbfstool: Add compression attribute

Patrick Rudolph (Code Review) gerrit at coreboot.org
Fri Jun 15 11:25:44 CEST 2018


Patrick Rudolph has uploaded this change for review. ( https://review.coreboot.org/27115


Change subject: [WIP]cbfstool: Add compression attribute
......................................................................

[WIP]cbfstool: Add compression attribute

Add the compression attribute to stage, payload and flat payloads.

Test:
The compression is shown in cbfstool coreboot.rom print instead of "none".

Change-Id: I03927dcbd486602f54210a344d5cc7af2265c965
Signed-off-by: Patrick Rudolph <siro at das-labor.org>
---
M util/cbfstool/cbfstool.c
1 file changed, 38 insertions(+), 0 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/15/27115/1

diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index 08f2e32..2b6cb31 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -614,6 +614,19 @@
 		ret = parse_elf_to_stage(buffer, &output, param.compression,
 					 offset, param.ignore_section);
 
+        struct cbfs_file_attr_compression *attrs =
+                (struct cbfs_file_attr_compression *)
+                cbfs_add_file_attr(header,
+                        CBFS_FILE_ATTR_TAG_COMPRESSION,
+                        sizeof(struct cbfs_file_attr_compression));
+        if (attrs == NULL) {
+                buffer_delete(buffer);
+                return -1;
+        }
+
+	attrs->compression = htonl(param.compression);
+	attrs->decompressed_size = htonl(buffer_size(buffer));
+
 	if (ret != 0)
 		return -1;
 	buffer_delete(buffer);
@@ -647,6 +660,18 @@
 		return -1;
 	}
 
+        struct cbfs_file_attr_compression *attrs =
+                (struct cbfs_file_attr_compression *)
+                cbfs_add_file_attr(header,
+                        CBFS_FILE_ATTR_TAG_COMPRESSION,
+                        sizeof(struct cbfs_file_attr_compression));
+        if (attrs == NULL) {
+                buffer_delete(buffer);
+                return -1;
+        }
+        attrs->compression = htonl(param.compression);
+        attrs->decompressed_size = htonl(buffer_size(buffer));
+
 	buffer_delete(buffer);
 	// direct assign, no dupe.
 	memcpy(buffer, &output, sizeof(*buffer));
@@ -664,6 +689,19 @@
 					 param.compression) != 0) {
 		return -1;
 	}
+
+        struct cbfs_file_attr_compression *attrs =
+                (struct cbfs_file_attr_compression *)
+                cbfs_add_file_attr(header,
+                        CBFS_FILE_ATTR_TAG_COMPRESSION,
+                        sizeof(struct cbfs_file_attr_compression));
+        if (attrs == NULL) {
+                buffer_delete(buffer);
+                return -1;
+        }
+        attrs->compression = htonl(param.compression);
+        attrs->decompressed_size = htonl(buffer_size(buffer));
+
 	buffer_delete(buffer);
 	// direct assign, no dupe.
 	memcpy(buffer, &output, sizeof(*buffer));

-- 
To view, visit https://review.coreboot.org/27115
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I03927dcbd486602f54210a344d5cc7af2265c965
Gerrit-Change-Number: 27115
Gerrit-PatchSet: 1
Gerrit-Owner: Patrick Rudolph <siro at das-labor.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20180615/1d40e9b3/attachment.html>


More information about the coreboot-gerrit mailing list