summaryrefslogtreecommitdiffstats
path: root/include/aimage.h
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-04-11 07:42:34 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-04-13 12:08:42 +0200
commit5efbed3b272b2b8b6bfa1e8317801f1637eeec88 (patch)
tree9b7e002816b02d711efd99cc78242b500bfa6876 /include/aimage.h
parent2c3db7776b81afd2b36a07d484a49216cb72199b (diff)
downloadbarebox-5efbed3b272b2b8b6bfa1e8317801f1637eeec88.tar.gz
barebox-5efbed3b272b2b8b6bfa1e8317801f1637eeec88.tar.xz
arm: add Android boot image support
The Android Image contains 3 components and params - kernel - initrd - second stage (optional) - tags addr - bootargs In fast boot the initrd is mandatory, in barebox we are less restrictive use the initrd only if present add to env params: aimage_noverwrite_bootargs Disable overwrite of the bootargs with the one present in aimage aimage_noverwrite_tags Disable overwrite of the tags addr with the one present in aimage Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Cc: Magnus Damm <magnus.damm@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/aimage.h')
-rw-r--r--include/aimage.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/include/aimage.h b/include/aimage.h
new file mode 100644
index 0000000000..9702b7d35c
--- /dev/null
+++ b/include/aimage.h
@@ -0,0 +1,74 @@
+/*
+ * (C) Copyright 2011 Jean-Christhophe PLAGNIOL-VILLARD <plagniol@jcrosoft.com>
+ *
+ * Android boot image
+ *
+ * Under GPLv2 only
+ */
+
+#ifndef __AIMAGE_H__
+#define __AIMAGE_H__
+
+#define BOOT_MAGIC "ANDROID!"
+#define BOOT_MAGIC_SIZE 8
+#define BOOT_NAME_SIZE 16
+#define BOOT_ARGS_SIZE 512
+
+struct android_header_comp
+{
+ unsigned size;
+ unsigned load_addr;
+};
+
+struct android_header
+{
+ u8 magic[BOOT_MAGIC_SIZE];
+
+ struct android_header_comp kernel;
+
+ struct android_header_comp ramdisk;
+
+ struct android_header_comp second_stage;
+
+ /* physical addr for kernel tags */
+ unsigned tags_addr;
+ /* flash page size we assume */
+ unsigned page_size;
+ /* future expansion: should be 0 */
+ unsigned unused[2];
+
+ unsigned char name[BOOT_NAME_SIZE]; /* asciiz product name */
+
+ unsigned char cmdline[BOOT_ARGS_SIZE];
+
+ unsigned id[8]; /* timestamp / checksum / sha1 / etc */
+};
+
+/*
+ * +-----------------+
+ * | boot header | 1 page
+ * +-----------------+
+ * | kernel | n pages
+ * +-----------------+
+ * | ramdisk | m pages
+ * +-----------------+
+ * | second stage | o pages
+ * +-----------------+
+ *
+ * n = (kernel_size + page_size - 1) / page_size
+ * m = (ramdisk_size + page_size - 1) / page_size
+ * o = (second_size + page_size - 1) / page_size
+ *
+ * 0. all entities are page_size aligned in flash
+ * 1. kernel and ramdisk are required (size != 0)
+ * 2. second is optional (second_size == 0 -> no second)
+ * 3. load each element (kernel, ramdisk, second) at
+ * the specified physical address (kernel_addr, etc)
+ * 4. prepare tags at tag_addr. kernel_args[] is
+ * appended to the kernel commandline in the tags.
+ * 5. r0 = 0, r1 = MACHINE_TYPE, r2 = tags_addr
+ * 6. if second_size != 0: jump to second_addr
+ * else: jump to kernel_addr
+ */
+
+#endif /* __AIMAGE_H__ */