diff options
author | Sol Boucher <solb@chromium.org> | 2015-03-05 15:38:03 -0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-04-25 12:14:25 +0200 |
commit | 0e53931fee0178c4f4ac4e2e6b355b103b5e8c42 (patch) | |
tree | f38674ea0f24986093c5852115966fa27db2130a /util/cbfstool/cbfstool.c | |
parent | c13ad6c6df709fda1d70743a860a406643620b9e (diff) |
cbfstool: Clean up in preparation for adding new files
This enables more warnings on the cbfstool codebase and fixes the
issues that surface as a result. A memory leak that used to occur
when compressing files with lzma is also found and fixed.
Finally, there are several fixes for the Makefile:
- Its autodependencies used to be broken because the target for
the .dependencies file was misnamed; this meant that Make
didn't know how to rebuild the file, and so would silently
skip the step of updating it before including it.
- The ability to build to a custom output directory by defining
the obj variable had bitrotted.
- The default value of the obj variable was causing implicit
rules not to apply when specifying a file as a target without
providing a custom value for obj.
- Add a distclean target for removing the .dependencies file.
BUG=chromium:461875
TEST=Build an image with cbfstool both before and after.
BRANCH=None
Change-Id: I951919d63443f2b053c2e67c1ac9872abc0a43ca
Signed-off-by: Sol Boucher <solb@chromium.org>
Original-Commit-Id: 49293443b4e565ca48d284e9a66f80c9c213975d
Original-Change-Id: Ia7350c2c3306905984cfa711d5fc4631f0b43d5b
Original-Signed-off-by: Sol Boucher <solb@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/257340
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
Reviewed-on: http://review.coreboot.org/9937
Tested-by: build bot (Jenkins)
Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'util/cbfstool/cbfstool.c')
-rw-r--r-- | util/cbfstool/cbfstool.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c index 3554cfa2bc..db521d67f5 100644 --- a/util/cbfstool/cbfstool.c +++ b/util/cbfstool/cbfstool.c @@ -22,6 +22,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <strings.h> #include <ctype.h> #include <unistd.h> #include <getopt.h> @@ -104,8 +105,10 @@ static int cbfs_add_integer_component(const char *cbfs_name, goto done; } - if (cbfs_add_entry(&image, &buffer, name, CBFS_COMPONENT_RAW, param.baseaddress) != 0) { - ERROR("Failed to add %llu into ROM image as '%s'.\n", (long long unsigned)u64val, name); + if (cbfs_add_entry(&image, &buffer, name, CBFS_COMPONENT_RAW, offset) != + 0) { + ERROR("Failed to add %llu into ROM image as '%s'.\n", + (long long unsigned)u64val, name); goto done; } @@ -189,8 +192,8 @@ static int cbfstool_convert_mkstage(struct buffer *buffer, uint32_t *offset) { struct buffer output; int ret; - ret = parse_elf_to_stage(buffer, &output, param.arch, param.algo, - offset, param.ignore_section); + ret = parse_elf_to_stage(buffer, &output, param.algo, offset, + param.ignore_section); if (ret != 0) return -1; buffer_delete(buffer); @@ -205,7 +208,7 @@ static int cbfstool_convert_mkpayload(struct buffer *buffer, struct buffer output; int ret; /* per default, try and see if payload is an ELF binary */ - ret = parse_elf_to_payload(buffer, &output, param.arch, param.algo); + ret = parse_elf_to_payload(buffer, &output, param.algo); /* If it's not an ELF, see if it's a UEFI FV */ if (ret != 0) @@ -641,6 +644,11 @@ static void usage(char *name) " update-fit -n MICROCODE_BLOB_NAME -x EMTPY_FIT_ENTRIES\n " "Updates the FIT table with microcode entries\n" "\n" + "OFFSETs:\n" + " Numbers accompanying -b, -H, and -o switches may be provided\n" + " in two possible formats: if their value is greater than\n" + " 0x80000000, they are interpreted as a top-aligned x86 memory\n" + " address; otherwise, they are treated as an offset into flash.\n" "ARCHes:\n" " arm64, arm, mips, x86\n" "TYPEs:\n", name, name |