summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRom Lemarchand2015-05-07 16:08:31 -0500
committerRom Lemarchand2015-05-07 16:08:31 -0500
commitdfff829062ff9f5dabc2a6afd2a241a7bb12266e (patch)
treea0c78d191f7dd2ee55d2a9685f30cbdfe209476e /mkbootimg
parent0e278e2e8052744274bd149ad1dc0908bdb939b3 (diff)
downloadplatform-system-core-dfff829062ff9f5dabc2a6afd2a241a7bb12266e.tar.gz
platform-system-core-dfff829062ff9f5dabc2a6afd2a241a7bb12266e.tar.xz
platform-system-core-dfff829062ff9f5dabc2a6afd2a241a7bb12266e.zip
mkbootimg: use fixed-size types for image format
Change-Id: I471ef420c3944b3ffefdba9ca7122c6a7f09e5ac
Diffstat (limited to 'mkbootimg')
-rw-r--r--mkbootimg/bootimg.h32
-rw-r--r--mkbootimg/mkbootimg.c26
2 files changed, 30 insertions, 28 deletions
diff --git a/mkbootimg/bootimg.h b/mkbootimg/bootimg.h
index 9171d85a7..5ab619599 100644
--- a/mkbootimg/bootimg.h
+++ b/mkbootimg/bootimg.h
@@ -15,6 +15,8 @@
15** limitations under the License. 15** limitations under the License.
16*/ 16*/
17 17
18#include <stdint.h>
19
18#ifndef _BOOT_IMAGE_H_ 20#ifndef _BOOT_IMAGE_H_
19#define _BOOT_IMAGE_H_ 21#define _BOOT_IMAGE_H_
20 22
@@ -28,31 +30,31 @@ typedef struct boot_img_hdr boot_img_hdr;
28 30
29struct boot_img_hdr 31struct boot_img_hdr
30{ 32{
31 unsigned char magic[BOOT_MAGIC_SIZE]; 33 uint8_t magic[BOOT_MAGIC_SIZE];
32 34
33 unsigned kernel_size; /* size in bytes */ 35 uint32_t kernel_size; /* size in bytes */
34 unsigned kernel_addr; /* physical load addr */ 36 uint32_t kernel_addr; /* physical load addr */
35 37
36 unsigned ramdisk_size; /* size in bytes */ 38 uint32_t ramdisk_size; /* size in bytes */
37 unsigned ramdisk_addr; /* physical load addr */ 39 uint32_t ramdisk_addr; /* physical load addr */
38 40
39 unsigned second_size; /* size in bytes */ 41 uint32_t second_size; /* size in bytes */
40 unsigned second_addr; /* physical load addr */ 42 uint32_t second_addr; /* physical load addr */
41 43
42 unsigned tags_addr; /* physical addr for kernel tags */ 44 uint32_t tags_addr; /* physical addr for kernel tags */
43 unsigned page_size; /* flash page size we assume */ 45 uint32_t page_size; /* flash page size we assume */
44 unsigned unused[2]; /* future expansion: should be 0 */ 46 uint32_t unused[2]; /* future expansion: should be 0 */
45 47
46 unsigned char name[BOOT_NAME_SIZE]; /* asciiz product name */ 48 uint8_t name[BOOT_NAME_SIZE]; /* asciiz product name */
47 49
48 unsigned char cmdline[BOOT_ARGS_SIZE]; 50 uint8_t cmdline[BOOT_ARGS_SIZE];
49 51
50 unsigned id[8]; /* timestamp / checksum / sha1 / etc */ 52 uint32_t id[8]; /* timestamp / checksum / sha1 / etc */
51 53
52 /* Supplemental command line data; kept here to maintain 54 /* Supplemental command line data; kept here to maintain
53 * binary compatibility with older versions of mkbootimg */ 55 * binary compatibility with older versions of mkbootimg */
54 unsigned char extra_cmdline[BOOT_EXTRA_ARGS_SIZE]; 56 uint8_t extra_cmdline[BOOT_EXTRA_ARGS_SIZE];
55}; 57} __attribute__((packed));
56 58
57/* 59/*
58** +-----------------+ 60** +-----------------+
diff --git a/mkbootimg/mkbootimg.c b/mkbootimg/mkbootimg.c
index fc92b4dc3..31f76e4e5 100644
--- a/mkbootimg/mkbootimg.c
+++ b/mkbootimg/mkbootimg.c
@@ -96,24 +96,24 @@ int main(int argc, char **argv)
96{ 96{
97 boot_img_hdr hdr; 97 boot_img_hdr hdr;
98 98
99 char *kernel_fn = 0; 99 char *kernel_fn = NULL;
100 void *kernel_data = 0; 100 void *kernel_data = NULL;
101 char *ramdisk_fn = 0; 101 char *ramdisk_fn = NULL;
102 void *ramdisk_data = 0; 102 void *ramdisk_data = NULL;
103 char *second_fn = 0; 103 char *second_fn = NULL;
104 void *second_data = 0; 104 void *second_data = NULL;
105 char *cmdline = ""; 105 char *cmdline = "";
106 char *bootimg = 0; 106 char *bootimg = NULL;
107 char *board = ""; 107 char *board = "";
108 unsigned pagesize = 2048; 108 uint32_t pagesize = 2048;
109 int fd; 109 int fd;
110 SHA_CTX ctx; 110 SHA_CTX ctx;
111 const uint8_t* sha; 111 const uint8_t* sha;
112 unsigned base = 0x10000000; 112 uint32_t base = 0x10000000U;
113 unsigned kernel_offset = 0x00008000; 113 uint32_t kernel_offset = 0x00008000U;
114 unsigned ramdisk_offset = 0x01000000; 114 uint32_t ramdisk_offset = 0x01000000U;
115 unsigned second_offset = 0x00f00000; 115 uint32_t second_offset = 0x00f00000U;
116 unsigned tags_offset = 0x00000100; 116 uint32_t tags_offset = 0x00000100U;
117 size_t cmdlen; 117 size_t cmdlen;
118 118
119 argc--; 119 argc--;