Commit 210a7176ee11b6af6746ba7ca025f5b9afbcb003

Authored by Alex Deymo
Committed by Tom Rini
1 parent b1f2a17c78

image: Update include/android_image.h

Update the Android image header format to the latest version published
in AOSP. The original code moved to a new repository, so this patch also
updates the reference to that path.

Signed-off-by: Alex Deymo <deymo@google.com>
Reviewed-by: Simon Glass <sjg@chromium.org>

Showing 2 changed files with 28 additions and 5 deletions Side-by-side Diff

common/image-android.c
... ... @@ -161,6 +161,9 @@
161 161 void android_print_contents(const struct andr_img_hdr *hdr)
162 162 {
163 163 const char * const p = IMAGE_INDENT_STRING;
  164 + /* os_version = ver << 11 | lvl */
  165 + u32 os_ver = hdr->os_version >> 11;
  166 + u32 os_lvl = hdr->os_version & ((1U << 11) - 1);
164 167  
165 168 printf("%skernel size: %x\n", p, hdr->kernel_size);
166 169 printf("%skernel address: %x\n", p, hdr->kernel_addr);
... ... @@ -170,6 +173,12 @@
170 173 printf("%ssecond address: %x\n", p, hdr->second_addr);
171 174 printf("%stags address: %x\n", p, hdr->tags_addr);
172 175 printf("%spage size: %x\n", p, hdr->page_size);
  176 + /* ver = A << 14 | B << 7 | C (7 bits for each of A, B, C)
  177 + * lvl = ((Y - 2000) & 127) << 4 | M (7 bits for Y, 4 bits for M) */
  178 + printf("%sos_version: %x (ver: %u.%u.%u, level: %u.%u)\n",
  179 + p, hdr->os_version,
  180 + (os_ver >> 7) & 0x7F, (os_ver >> 14) & 0x7F, os_ver & 0x7F,
  181 + (os_lvl >> 4) + 2000, os_lvl & 0x0F);
173 182 printf("%sname: %s\n", p, hdr->name);
174 183 printf("%scmdline: %s\n", p, hdr->cmdline);
175 184 }
include/android_image.h
1 1 /*
2 2 * This is from the Android Project,
3   - * Repository: https://android.googlesource.com/platform/bootable/bootloader/legacy
4   - * File: include/boot/bootimg.h
5   - * Commit: 4205b865141ff2e255fe1d3bd16de18e217ef06a
  3 + * Repository: https://android.googlesource.com/platform/system/core/
  4 + * File: mkbootimg/bootimg.h
  5 + * Commit: d162828814b08ada310846a33205befb69ef5799
6 6 *
7 7 * Copyright (C) 2008 The Android Open Source Project
8 8 *
9 9  
... ... @@ -12,10 +12,13 @@
12 12 #ifndef _ANDROID_IMAGE_H_
13 13 #define _ANDROID_IMAGE_H_
14 14  
  15 +typedef struct andr_img_hdr andr_img_hdr;
  16 +
15 17 #define ANDR_BOOT_MAGIC "ANDROID!"
16 18 #define ANDR_BOOT_MAGIC_SIZE 8
17 19 #define ANDR_BOOT_NAME_SIZE 16
18 20 #define ANDR_BOOT_ARGS_SIZE 512
  21 +#define ANDR_BOOT_EXTRA_ARGS_SIZE 1024
19 22  
20 23 struct andr_img_hdr {
21 24 char magic[ANDR_BOOT_MAGIC_SIZE];
22 25  
23 26  
... ... @@ -31,14 +34,25 @@
31 34  
32 35 u32 tags_addr; /* physical addr for kernel tags */
33 36 u32 page_size; /* flash page size we assume */
34   - u32 unused[2]; /* future expansion: should be 0 */
  37 + u32 unused; /* reserved for future expansion: MUST be 0 */
35 38  
  39 + /* operating system version and security patch level; for
  40 + * version "A.B.C" and patch level "Y-M-D":
  41 + * ver = A << 14 | B << 7 | C (7 bits for each of A, B, C)
  42 + * lvl = ((Y - 2000) & 127) << 4 | M (7 bits for Y, 4 bits for M)
  43 + * os_version = ver << 11 | lvl */
  44 + u32 os_version;
  45 +
36 46 char name[ANDR_BOOT_NAME_SIZE]; /* asciiz product name */
37 47  
38 48 char cmdline[ANDR_BOOT_ARGS_SIZE];
39 49  
40 50 u32 id[8]; /* timestamp / checksum / sha1 / etc */
41   -};
  51 +
  52 + /* Supplemental command line data; kept here to maintain
  53 + * binary compatibility with older versions of mkbootimg */
  54 + char extra_cmdline[ANDR_BOOT_EXTRA_ARGS_SIZE];
  55 +} __attribute__((packed));
42 56  
43 57 /*
44 58 * +-----------------+