mkbootimg: support longer kernel command lines

We can't simply increase the value of BOOT_ARGS_SIZE since that
would break past binary compatibility; the offset of 'id' would
change. This can cause serious problems with incremental OTA updates.

Instead, define a supplemental field which stores command line
information beyond the first 512 bytes. A value of 1024 was chosen
to keep the total size of struct boot_img_hdr under the smallest
page size of 2048 bytes.

Even if the extra_cmdline field is used, the original cmdline
field is still always NULL-terminated to avoid issues with older
bootloaders that haven't been updated.

Change-Id: I887e6f1db351a5b71a61e3a03363cf8856123d74
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
diff --git a/mkbootimg/bootimg.h b/mkbootimg/bootimg.h
index 242ab35..9171d85 100644
--- a/mkbootimg/bootimg.h
+++ b/mkbootimg/bootimg.h
@@ -24,6 +24,7 @@
 #define BOOT_MAGIC_SIZE 8
 #define BOOT_NAME_SIZE 16
 #define BOOT_ARGS_SIZE 512
+#define BOOT_EXTRA_ARGS_SIZE 1024
 
 struct boot_img_hdr
 {
@@ -43,10 +44,14 @@
     unsigned unused[2];    /* future expansion: should be 0 */
 
     unsigned char name[BOOT_NAME_SIZE]; /* asciiz product name */
-    
+
     unsigned char cmdline[BOOT_ARGS_SIZE];
 
     unsigned id[8]; /* timestamp / checksum / sha1 / etc */
+
+    /* Supplemental command line data; kept here to maintain
+     * binary compatibility with older versions of mkbootimg */
+    unsigned char extra_cmdline[BOOT_EXTRA_ARGS_SIZE];
 };
 
 /*