diff options
author | Che-Liang Chiou <clchiou@chromium.org> | 2011-08-11 19:16:20 +0800 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2011-08-29 10:59:28 -0700 |
commit | c3a491a2ba4d15e787c3ce8e8ab54b49d3e6e079 (patch) | |
tree | c0891c723aabe0778165fadc47190c9393ed7092 | |
parent | b1f0f438e3fd22c8c38b9820ea341e17c606ea6a (diff) |
CHROMIUM: port test codes to current codebase
The test codes were not compiled because it depended on a prototype
codebase which is not used/compiled now.
This patch removes the dependency to the prototype codebase and let the
test codes be enabled when VBOOT_DEBUG is defined.
Because the test codes test GBB loader and we use a static buffer for
holding GBB data, this patch also moves the location of GBB buffer to
chromeos.h, which is globally accessible.
BUG=chromium-os:16542
TEST=run "vboot_test all" and see all tests pass on Kaen
TEST=run "vbexpot_test all" and see all tests pass on Kaen
Change-Id: I24c7e51cd254f31b4b28fd0becdbc77fb4ede2f8
Reviewed-on: http://gerrit.chromium.org/gerrit/5729
Tested-by: Che-Liang Chiou <clchiou@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
-rw-r--r-- | common/Makefile | 4 | ||||
-rw-r--r-- | common/cmd_vbexport_test.c | 14 | ||||
-rw-r--r-- | common/cmd_vboot_twostop.c | 15 | ||||
-rw-r--r-- | include/configs/chromeos.h | 20 |
4 files changed, 27 insertions, 26 deletions
diff --git a/common/Makefile b/common/Makefile index 7104a8b57fc..71483a7851c 100644 --- a/common/Makefile +++ b/common/Makefile @@ -74,11 +74,11 @@ COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o COBJS-$(CONFIG_CMD_CONSOLE) += cmd_console.o COBJS-$(CONFIG_CMD_CPLBINFO) += cmd_cplbinfo.o -COBJS-$(CONFIG_CMD_VBEXPORT_TEST) += cmd_vbexport_test.o COBJS-$(CONFIG_CMD_VBOOT_BOOTSTUB) += cmd_vboot_bootstub.o COBJS-$(CONFIG_CMD_VBOOT_MAIN) += cmd_vboot_main.o -COBJS-$(CONFIG_CMD_VBOOT_TEST) += cmd_vboot_test.o COBJS-$(CONFIG_CHROMEOS) += cmd_vboot_twostop.o +COBJS-$(CONFIG_CHROMEOS_TEST) += cmd_vbexport_test.o +COBJS-$(CONFIG_CHROMEOS_TEST) += cmd_vboot_test.o COBJS-$(CONFIG_DATAFLASH_MMC_SELECT) += cmd_dataflash_mmc_mux.o COBJS-$(CONFIG_CMD_DATE) += cmd_date.o ifdef CONFIG_4xx diff --git a/common/cmd_vbexport_test.c b/common/cmd_vbexport_test.c index bfd3e14862b..3813ce18109 100644 --- a/common/cmd_vbexport_test.c +++ b/common/cmd_vbexport_test.c @@ -19,7 +19,6 @@ #include <gbb_header.h> #include <chromeos/firmware_storage.h> #include <chromeos/gbb.h> -#include <vboot/global_data.h> #include <vboot_api.h> @@ -400,11 +399,9 @@ static int show_screen_and_delay(uint32_t screen_type) static uint8_t *read_gbb_from_firmware(void) { - vb_global_t *global; firmware_storage_t file; struct twostop_fmap fmap; - - global = get_vboot_global(); + void *gbb = (void *)GBB_ADDRESS; if (decode_twostop_fmap(&fmap)) { VbExDebug("Failed to load fmap config!\n"); @@ -417,13 +414,12 @@ static uint8_t *read_gbb_from_firmware(void) return NULL; } - if (init_vboot_global(global, &file)) { - VbExDebug("Failed to init vboot global data!\n"); + if (gbb_init(gbb, &file, fmap.readonly.gbb.offset)) { + VbExDebug("Failed to read GBB!\n"); return NULL; } - if (gbb_read_bmp_block(global->gbb_data, &file, - fmap.readonly.gbb.offset)) { + if (gbb_read_bmp_block(gbb, &file, fmap.readonly.gbb.offset)) { VbExDebug("Failed to load BMP Block in GBB!\n"); return NULL; } @@ -432,7 +428,7 @@ static uint8_t *read_gbb_from_firmware(void) VbExDebug("Failed to close firmware device!\n"); } - return global->gbb_data; + return gbb; } static int show_images_and_delay(BmpBlockHeader *bmph, int index) diff --git a/common/cmd_vboot_twostop.c b/common/cmd_vboot_twostop.c index 2869835e020..3c1676f0b0d 100644 --- a/common/cmd_vboot_twostop.c +++ b/common/cmd_vboot_twostop.c @@ -66,21 +66,6 @@ * initialized by the bootstub, and which are by the readwrite firmware. */ -/* - * We use fixed memory address for the parameters --- this should be simpler - * than atags or a register holding the address of the parameters. Besides, - * Chrome OS kernel is loaded to a fixed location, we could simply use this - * location as our anchor for the location of the parameters. - */ -/* - * Layout: first, the kernel buffer, then the crossystem data (and the - * VbSharedData), and finally, the GBB. - */ -#define CROSSYSTEM_DATA_ADDRESS \ - (CHROMEOS_KERNEL_LOADADDR + CHROMEOS_KERNEL_BUFSIZE) -#define CROSSYSTEM_DATA_MAXSIZE 0x8000 -#define GBB_ADDRESS (CROSSYSTEM_DATA_ADDRESS + CROSSYSTEM_DATA_MAXSIZE) - DECLARE_GLOBAL_DATA_PTR; /* The margin to keep extra stack region that not to be wiped. */ diff --git a/include/configs/chromeos.h b/include/configs/chromeos.h index 8ddb56de608..411182d21f6 100644 --- a/include/configs/chromeos.h +++ b/include/configs/chromeos.h @@ -15,6 +15,11 @@ /* Enable verified boot */ #define CONFIG_CHROMEOS +/* Enable test codes */ +#ifdef VBOOT_DEBUG +#define CONFIG_CHROMEOS_TEST +#endif /* VBOOT_DEBUG */ + /* Enable graphics display */ #define CONFIG_LCD_BMP_RLE8 #define CONFIG_LZMA @@ -37,9 +42,24 @@ */ #define CONFIG_OF_UPDATE_FDT_BEFORE_BOOT +/* + * We use fixed memory address for the parameters --- this should be simpler + * than atags or a register holding the address of the parameters. Besides, + * Chrome OS kernel is loaded to a fixed location, we could simply use this + * location as our anchor for the location of the parameters. + */ +/* + * Layout: first, the kernel buffer, then the crossystem data (and the + * VbSharedData), and finally, the GBB. + */ /* For security reason, Chrome OS kernel must be loaded to specific location. */ #define CHROMEOS_KERNEL_LOADADDR 0x00100000 #define CHROMEOS_KERNEL_BUFSIZE 0x00800000 +#define CROSSYSTEM_DATA_ADDRESS \ + (CHROMEOS_KERNEL_LOADADDR + CHROMEOS_KERNEL_BUFSIZE) +#define CROSSYSTEM_DATA_MAXSIZE 0x8000 +#define GBB_ADDRESS \ + (CROSSYSTEM_DATA_ADDRESS + CROSSYSTEM_DATA_MAXSIZE) /* * This is the default kernel command line to a Chrome OS kernel. An ending |