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>
This commit is contained in:
Che-Liang Chiou
2012-04-05 17:36:10 +08:00
committed by Gerrit
parent f9e82e9695
commit 036922ed8a
3 changed files with 8 additions and 1 deletions

View File

@@ -38,6 +38,10 @@ uint8_t* find_kernel_config(uint8_t* blob, uint64_t blob_size,
return NULL; 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 /* 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 * table, but that's irrelevant for ARM. Both types keep the config blob in
* the same place, so just go find it. */ * the same place, so just go find it. */

View File

@@ -39,7 +39,7 @@ int main(int argc, char* argv[]) {
size_t blob_size; size_t blob_size;
char* infile = NULL; char* infile = NULL;
uint8_t *config = 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; int parse_error = 0;
char *e; char *e;
int i; int i;

View File

@@ -17,6 +17,9 @@
// Alignment of various chunks within the kernel blob // Alignment of various chunks within the kernel blob
#define CROS_ALIGN 4096 #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 // RAM address where the 32-bit kernel expects to be started
#define CROS_32BIT_ENTRY_ADDR 0x100000 #define CROS_32BIT_ENTRY_ADDR 0x100000