diff options
author | Bill Richardson <wfrichar@chromium.org> | 2014-09-23 12:49:26 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-09-25 20:26:53 +0000 |
commit | e192e7f6cea5f2c4556b729bf57ef1f552e0242a (patch) | |
tree | 1cfcde6d0b2a6a5490f4953080849f3ec9e3ab21 /futility/cmd_vbutil_kernel.c | |
parent | c6fa98d2ed1816d88e8517cd988de186fd6477b8 (diff) | |
download | vboot-e192e7f6cea5f2c4556b729bf57ef1f552e0242a.tar.gz |
futility: clean up a few shared functions
Move the Debug() function into a common place instead of several
copies in different files, rename shared functions to start with
"futil_"
BUG=none
BRANCH=ToT
TEST=make runtests
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Change-Id: I6b844553dff95c24894dae611102716a8da5312d
Reviewed-on: https://chromium-review.googlesource.com/219645
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'futility/cmd_vbutil_kernel.c')
-rw-r--r-- | futility/cmd_vbutil_kernel.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/futility/cmd_vbutil_kernel.c b/futility/cmd_vbutil_kernel.c index 740c3af4..855c7a53 100644 --- a/futility/cmd_vbutil_kernel.c +++ b/futility/cmd_vbutil_kernel.c @@ -28,7 +28,6 @@ #include "vboot_common.h" /* Global opts */ -static int opt_debug; static int opt_verbose; static int opt_vblockonly; static uint64_t opt_pad = 65536; @@ -54,12 +53,6 @@ enum { OPT_MINVERSION, }; -typedef enum { - ARCH_ARM, - ARCH_X86, /* default */ - ARCH_MIPS -} arch_t; - static const struct option long_opts[] = { {"pack", 1, 0, OPT_MODE_PACK}, {"repack", 1, 0, OPT_MODE_REPACK}, @@ -78,7 +71,7 @@ static const struct option long_opts[] = { {"vblockonly", 0, 0, OPT_VBLOCKONLY}, {"pad", 1, 0, OPT_PAD}, {"verbose", 0, &opt_verbose, 1}, - {"debug", 0, &opt_debug, 1}, + {"debug", 0, &debugging_enabled, 1}, {NULL, 0, 0, 0} }; @@ -140,18 +133,6 @@ static void print_help(const char *progname) printf(usage, progname, progname, progname); } -static void Debug(const char *format, ...) -{ - if (!opt_debug) - return; - - va_list ap; - va_start(ap, format); - fprintf(stderr, "DEBUG: "); - vfprintf(stderr, format, ap); - va_end(ap); -} - static void Fatal(const char *format, ...) { va_list ap; @@ -266,7 +247,7 @@ static uint64_t CmdLineOffset(VbKernelPreambleHeader *preamble) /* This initializes g_vmlinuz and g_param from a standard vmlinuz file. * It returns 0 on error. */ -static int ImportVmlinuzFile(const char *vmlinuz_file, arch_t arch, +static int ImportVmlinuzFile(const char *vmlinuz_file, enum arch_t arch, uint64_t kernel_body_load_address) { uint8_t *kernel_buf; @@ -495,7 +476,7 @@ static void UnpackKernelBlob(uint8_t *kernel_blob_data, /****************************************************************************/ static uint8_t *CreateKernBlob(uint64_t kernel_body_load_address, - arch_t arch, uint64_t *size_ptr) + enum arch_t arch, uint64_t *size_ptr) { uint8_t *kern_blob; uint64_t kern_blob_size; @@ -721,7 +702,7 @@ static int do_vbutil_kernel(int argc, char *argv[]) char *vmlinuz_file = NULL; char *bootloader_file = NULL; char *config_file = NULL; - arch_t arch = ARCH_X86; + enum arch_t arch = ARCH_X86; char *address_str = NULL; uint64_t kernel_body_load_address = CROS_32BIT_ENTRY_ADDR; int mode = 0; |