Kyösti Mälkki has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/41832 )
Change subject: uti/cbfstool: Add option --pow2page ......................................................................
uti/cbfstool: Add option --pow2page
For add-stage command, --pow2page is equivalent of passing -P log2ceil(sizeof stage). The sizeof stage can be hard to determine in Makefile to be passed on the commandline.
Change-Id: If4b5329c1df5afe49d27ab10220095d747024ad6 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M util/cbfstool/cbfstool.c 1 file changed, 15 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/41832/1
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 4ec8c90..dd87a04 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -65,6 +65,7 @@ bool fill_partial_downward; bool show_immutable; bool stage_xip; + bool force_pow2_pagesize; bool autogen_attr; bool machine_parseable; bool unprocessed; @@ -169,6 +170,14 @@
DEBUG("File size is %zd (0x%zx)\n", data_size, data_size);
+ /* Use a page size that can fit the entire file. */ + if (param.force_pow2_pagesize) { + param.pagesize = 1; + while (param.pagesize < data_size) + param.pagesize <<= 1; + DEBUG("Page size is %d (0x%x)\n", param.pagesize, param.pagesize); + } + /* Include cbfs_file size along with space for with name. */ metadata_size += cbfs_calculate_file_header_size(param.name); /* Adjust metadata_size if additional attributes were added */ @@ -1259,7 +1268,7 @@ true, true}, {"add-payload", "H:r:f:n:c:b:C:I:p:vA:gh?", cbfs_add_payload, true, true}, - {"add-stage", "a:H:r:f:n:t:c:b:P:S:p:yvA:gh?", cbfs_add_stage, + {"add-stage", "a:H:r:f:n:t:c:b:P:Q:S:p:yvA:gh?", cbfs_add_stage, true, true}, {"add-int", "H:r:i:n:b:vgh?", cbfs_add_integer, true, true}, {"add-master-header", "H:r:vh?j:", cbfs_add_master_header, true, true}, @@ -1311,6 +1320,7 @@ {"offset", required_argument, 0, 'o' }, {"padding", required_argument, 0, 'p' }, {"page-size", required_argument, 0, 'P' }, + {"pow2page", no_argument, 0, 'Q' }, {"ucode-region", required_argument, 0, 'q' }, {"size", required_argument, 0, 's' }, {"top-aligned", required_argument, 0, 'T' }, @@ -1405,7 +1415,7 @@ "Add a payload to the ROM\n" " add-stage [-r image,regions] -f FILE -n NAME [-A hash] \\n" " [-c compression] [-b base] [-S section-to-ignore] \\n" - " [-a alignment] [-y|--xip] [-P page-size] [--ibb] " + " [-a alignment] [-y|--xip] [-P page-size] [-Q] [--ibb] " "Add a stage to the ROM\n" " add-flat-binary [-r image,regions] -f FILE -n NAME \\n" " [-A hash] -l load-address -e entry-point \\n" @@ -1664,6 +1674,9 @@ return 1; } break; + case 'Q': + param.force_pow2_pagesize = 1; + break; case 'o': param.cbfsoffset = strtoul(optarg, &suffix, 0); if (!*optarg || (suffix && *suffix)) {
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41832 )
Change subject: uti/cbfstool: Add option --pow2page ......................................................................
Patch Set 1: Code-Review+1
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41832 )
Change subject: uti/cbfstool: Add option --pow2page ......................................................................
Patch Set 1:
(2 comments)
https://review.coreboot.org/c/coreboot/+/41832/1/util/cbfstool/cbfstool.c File util/cbfstool/cbfstool.c:
https://review.coreboot.org/c/coreboot/+/41832/1/util/cbfstool/cbfstool.c@17... PS1, Line 174: if (param.force_pow2_pagesize) { Should we check if -P as provided and signal error that both -P and -Q were on the cmdline? Seems to me -P parameters are entirely ignored so we should enforce that.
https://review.coreboot.org/c/coreboot/+/41832/1/util/cbfstool/cbfstool.c@14... PS1, Line 1418: ] s/[ ]/ | /
Hello build bot (Jenkins), Patrick Georgi, Arthur Heymans, Aaron Durbin,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/41832
to look at the new patch set (#2).
Change subject: uti/cbfstool: Add option --pow2page ......................................................................
uti/cbfstool: Add option --pow2page
For add-stage command, --pow2page is equivalent of passing -P log2ceil(sizeof stage). The sizeof stage can be hard to determine in Makefile to be passed on the commandline.
Change-Id: If4b5329c1df5afe49d27ab10220095d747024ad6 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M util/cbfstool/cbfstool.c 1 file changed, 19 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/41832/2
Aaron Durbin has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41832 )
Change subject: uti/cbfstool: Add option --pow2page ......................................................................
Patch Set 2: Code-Review+2
Kyösti Mälkki has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41832 )
Change subject: uti/cbfstool: Add option --pow2page ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/c/coreboot/+/41832/1/util/cbfstool/cbfstool.c File util/cbfstool/cbfstool.c:
https://review.coreboot.org/c/coreboot/+/41832/1/util/cbfstool/cbfstool.c@17... PS1, Line 174: if (param.force_pow2_pagesize) {
Should we check if -P as provided and signal error that both -P and -Q were on the cmdline? Seems to […]
Combination of -P and -Q now sort of makes sense.
https://review.coreboot.org/c/coreboot/+/41832/1/util/cbfstool/cbfstool.c@14... PS1, Line 1418: ]
s/[ ]/ | /
Combination of -P and -Q now sort of makes sense.
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41832 )
Change subject: uti/cbfstool: Add option --pow2page ......................................................................
Patch Set 2:
(2 comments)
https://review.coreboot.org/c/coreboot/+/41832/2/util/cbfstool/cbfstool.c File util/cbfstool/cbfstool.c:
https://review.coreboot.org/c/coreboot/+/41832/2/util/cbfstool/cbfstool.c@12... PS2, Line 1294: LONGOPT_START = 256, is this ascii with parity bit? ^^
https://review.coreboot.org/c/coreboot/+/41832/2/util/cbfstool/cbfstool.c@14... PS2, Line 1422: " [-a alignment] [-y|--xip] [-P page-size] [-Q] [--ibb] " There seems to be nothing in the help text that tells us what it is. Do we really need a single-letter option at all? A `--pow2page` here would at least give a hint what it is about.
Hello build bot (Jenkins), Patrick Georgi, Arthur Heymans, Aaron Durbin,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/41832
to look at the new patch set (#3).
Change subject: util/cbfstool: Add option --pow2page ......................................................................
util/cbfstool: Add option --pow2page
For add-stage command, --pow2page is equivalent of passing -P log2ceil(sizeof stage). The sizeof stage can be hard to determine in Makefile to be passed on the commandline.
Change-Id: If4b5329c1df5afe49d27ab10220095d747024ad6 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M util/cbfstool/cbfstool.c 1 file changed, 20 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/41832/3
Angel Pons has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41832 )
Change subject: util/cbfstool: Add option --pow2page ......................................................................
Patch Set 3: Code-Review+1
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41832 )
Change subject: util/cbfstool: Add option --pow2page ......................................................................
Patch Set 3:
(2 comments)
https://review.coreboot.org/c/coreboot/+/41832/2/util/cbfstool/cbfstool.c File util/cbfstool/cbfstool.c:
https://review.coreboot.org/c/coreboot/+/41832/2/util/cbfstool/cbfstool.c@14... PS2, Line 1422: " [-a alignment] [-y|--xip] [-P page-size] [-Q] [--ibb] "
There seems to be nothing in the help text that tells us what it is. Do […]
Done
https://review.coreboot.org/c/coreboot/+/41832/3/util/cbfstool/cbfstool.c File util/cbfstool/cbfstool.c:
https://review.coreboot.org/c/coreboot/+/41832/3/util/cbfstool/cbfstool.c@12... PS3, Line 1272: : what's this colon doing?
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41832 )
Change subject: util/cbfstool: Add option --pow2page ......................................................................
Patch Set 3:
(1 comment)
https://review.coreboot.org/c/coreboot/+/41832/3/util/cbfstool/cbfstool.c File util/cbfstool/cbfstool.c:
https://review.coreboot.org/c/coreboot/+/41832/3/util/cbfstool/cbfstool.c@12... PS3, Line 1272: :
what's this colon doing?
Sorry, I assumed you know what it's doing and added it by accident. It signifies a mandatory argument to the -Q option. In other words, I think it's not supposed to be there.
Hello build bot (Jenkins), Patrick Georgi, Angel Pons, Arthur Heymans, Aaron Durbin,
I'd like you to reexamine a change. Please visit
https://review.coreboot.org/c/coreboot/+/41832
to look at the new patch set (#4).
Change subject: util/cbfstool: Add option --pow2page ......................................................................
util/cbfstool: Add option --pow2page
For add-stage command, --pow2page is equivalent of passing -P log2ceil(sizeof stage). The sizeof stage can be hard to determine in Makefile to be passed on the commandline.
Change-Id: If4b5329c1df5afe49d27ab10220095d747024ad6 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com --- M util/cbfstool/cbfstool.c 1 file changed, 20 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/32/41832/4
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41832 )
Change subject: util/cbfstool: Add option --pow2page ......................................................................
Patch Set 4: Code-Review+2
Nico Huber has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41832 )
Change subject: util/cbfstool: Add option --pow2page ......................................................................
Patch Set 4:
(1 comment)
https://review.coreboot.org/c/coreboot/+/41832/3/util/cbfstool/cbfstool.c File util/cbfstool/cbfstool.c:
https://review.coreboot.org/c/coreboot/+/41832/3/util/cbfstool/cbfstool.c@12... PS3, Line 1272: :
Sorry, I assumed you know what it's doing and added it by accident. It […]
Done
Nico Huber has submitted this change. ( https://review.coreboot.org/c/coreboot/+/41832 )
Change subject: util/cbfstool: Add option --pow2page ......................................................................
util/cbfstool: Add option --pow2page
For add-stage command, --pow2page is equivalent of passing -P log2ceil(sizeof stage). The sizeof stage can be hard to determine in Makefile to be passed on the commandline.
Change-Id: If4b5329c1df5afe49d27ab10220095d747024ad6 Signed-off-by: Kyösti Mälkki kyosti.malkki@gmail.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/41832 Tested-by: build bot (Jenkins) no-reply@coreboot.org Reviewed-by: Nico Huber nico.h@gmx.de --- M util/cbfstool/cbfstool.c 1 file changed, 20 insertions(+), 2 deletions(-)
Approvals: build bot (Jenkins): Verified Nico Huber: Looks good to me, approved
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index decbd05..d2df1cc 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -65,6 +65,7 @@ bool fill_partial_downward; bool show_immutable; bool stage_xip; + bool force_pow2_pagesize; bool autogen_attr; bool machine_parseable; bool unprocessed; @@ -169,6 +170,18 @@
DEBUG("File size is %zd (0x%zx)\n", data_size, data_size);
+ /* Use a page size that can fit the entire file and is no smaller than + optionally provided with -P parameter. */ + if (param.force_pow2_pagesize) { + uint32_t pagesize = 1; + while (pagesize < data_size) + pagesize <<= 1; + while (pagesize < param.pagesize) + pagesize <<= 1; + param.pagesize = pagesize; + DEBUG("Page size is %d (0x%x)\n", param.pagesize, param.pagesize); + } + /* Include cbfs_file size along with space for with name. */ metadata_size += cbfs_calculate_file_header_size(param.name); /* Adjust metadata_size if additional attributes were added */ @@ -1256,7 +1269,7 @@ true, true}, {"add-payload", "H:r:f:n:c:b:C:I:p:vA:gh?", cbfs_add_payload, true, true}, - {"add-stage", "a:H:r:f:n:t:c:b:P:S:p:yvA:gh?", cbfs_add_stage, + {"add-stage", "a:H:r:f:n:t:c:b:P:QS:p:yvA:gh?", cbfs_add_stage, true, true}, {"add-int", "H:r:i:n:b:vgh?", cbfs_add_integer, true, true}, {"add-master-header", "H:r:vh?j:", cbfs_add_master_header, true, true}, @@ -1308,6 +1321,7 @@ {"offset", required_argument, 0, 'o' }, {"padding", required_argument, 0, 'p' }, {"page-size", required_argument, 0, 'P' }, + {"pow2page", no_argument, 0, 'Q' }, {"ucode-region", required_argument, 0, 'q' }, {"size", required_argument, 0, 's' }, {"top-aligned", required_argument, 0, 'T' }, @@ -1402,7 +1416,8 @@ "Add a payload to the ROM\n" " add-stage [-r image,regions] -f FILE -n NAME [-A hash] \\n" " [-c compression] [-b base] [-S section-to-ignore] \\n" - " [-a alignment] [-y|--xip] [-P page-size] [--ibb] " + " [-a alignment] [-P page-size] [-Q|--pow2page] \\n" + " [-y|--xip] [--ibb] " "Add a stage to the ROM\n" " add-flat-binary [-r image,regions] -f FILE -n NAME \\n" " [-A hash] -l load-address -e entry-point \\n" @@ -1661,6 +1676,9 @@ return 1; } break; + case 'Q': + param.force_pow2_pagesize = 1; + break; case 'o': param.cbfsoffset = strtoul(optarg, &suffix, 0); if (!*optarg || (suffix && *suffix)) {
Arthur Heymans has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/41832 )
Change subject: util/cbfstool: Add option --pow2page ......................................................................
Patch Set 5:
(1 comment)
Patchset:
PS5: follow-up on this https://review.coreboot.org/c/coreboot/+/55581/