summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@chromium.org>2012-04-05 17:36:10 +0800
committerGerrit <chrome-bot@google.com>2012-04-06 04:08:54 -0700
commit036922ed8a2a7f2b7de4d5d8e0fc8aff072dce3d (patch)
treed1f237d057d78a6190074cec8d98659e12ababdd
parentf9e82e9695d3f208b549cc0208baf24985bbb488 (diff)
downloadvboot-036922ed8a2a7f2b7de4d5d8e0fc8aff072dce3d.tar.gz
Read kernel body load address from preamble by default
The default behavior of dump_kernel_config is changed from using CROS_32BIT_ENTRY_ADDR to reading from kernel preamble. The main motivation for this change is in preparation for ARM boards of which kernel body load address cannot be CROS_32BIT_ENTRY_ADDR. Since we do not want that all ARM calling sides of dump_kernel_config have to carry the kloadaddr argument, it would be better to let dump_kernel_config read this address from the kernel preamble by default. BUG=chromium-os:28077 TEST=Run dump_kernel_config w/ and w/o this change Change-Id: I5eddcc35e5970dfce02cc66208438c57351f1c81 Reviewed-on: https://gerrit.chromium.org/gerrit/19660 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Don Garrett <dgarrett@chromium.org> Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Ready: Che-Liang Chiou <clchiou@chromium.org>
-rw-r--r--utility/dump_kernel_config.c4
-rw-r--r--utility/dump_kernel_config_main.c2
-rw-r--r--utility/include/kernel_blob.h3
3 files changed, 8 insertions, 1 deletions
diff --git a/utility/dump_kernel_config.c b/utility/dump_kernel_config.c
index 7a769af7..b01aedb8 100644
--- a/utility/dump_kernel_config.c
+++ b/utility/dump_kernel_config.c
@@ -38,6 +38,10 @@ uint8_t* find_kernel_config(uint8_t* blob, uint64_t blob_size,
return NULL;
}
+ /* Read body_load_address from preamble if no kernel_body_load_address */
+ if (kernel_body_load_address == CROS_NO_ENTRY_ADDR)
+ kernel_body_load_address = preamble->body_load_address;
+
/* The x86 kernels have a pointer to the kernel commandline in the zeropage
* table, but that's irrelevant for ARM. Both types keep the config blob in
* the same place, so just go find it. */
diff --git a/utility/dump_kernel_config_main.c b/utility/dump_kernel_config_main.c
index 7b8f237f..ed77f879 100644
--- a/utility/dump_kernel_config_main.c
+++ b/utility/dump_kernel_config_main.c
@@ -39,7 +39,7 @@ int main(int argc, char* argv[]) {
size_t blob_size;
char* infile = NULL;
uint8_t *config = NULL;
- uint64_t kernel_body_load_address = CROS_32BIT_ENTRY_ADDR;
+ uint64_t kernel_body_load_address = CROS_NO_ENTRY_ADDR;
int parse_error = 0;
char *e;
int i;
diff --git a/utility/include/kernel_blob.h b/utility/include/kernel_blob.h
index e8f813eb..5784542e 100644
--- a/utility/include/kernel_blob.h
+++ b/utility/include/kernel_blob.h
@@ -17,6 +17,9 @@
// Alignment of various chunks within the kernel blob
#define CROS_ALIGN 4096
+// Sentinel RAM address indicating that no entry address is specified
+#define CROS_NO_ENTRY_ADDR (~0)
+
// RAM address where the 32-bit kernel expects to be started
#define CROS_32BIT_ENTRY_ADDR 0x100000