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
7 * Copyright (C) 2008 The Android Open Source Project
9 * SPDX-License-Identifier: BSD-2-Clause
12 #ifndef _ANDROID_IMAGE_H_
13 #define _ANDROID_IMAGE_H_
15 #define ANDR_BOOT_MAGIC "ANDROID!"
16 #define ANDR_BOOT_MAGIC_SIZE 8
17 #define ANDR_BOOT_NAME_SIZE 16
18 #define ANDR_BOOT_ARGS_SIZE 512
21 char magic[ANDR_BOOT_MAGIC_SIZE];
23 u32 kernel_size; /* size in bytes */
24 u32 kernel_addr; /* physical load addr */
26 u32 ramdisk_size; /* size in bytes */
27 u32 ramdisk_addr; /* physical load addr */
29 u32 second_size; /* size in bytes */
30 u32 second_addr; /* physical load addr */
32 u32 tags_addr; /* physical addr for kernel tags */
33 u32 page_size; /* flash page size we assume */
34 u32 unused[2]; /* future expansion: should be 0 */
36 char name[ANDR_BOOT_NAME_SIZE]; /* asciiz product name */
38 char cmdline[ANDR_BOOT_ARGS_SIZE];
40 u32 id[8]; /* timestamp / checksum / sha1 / etc */
45 * | boot header | 1 page
51 * | second stage | o pages
54 * n = (kernel_size + page_size - 1) / page_size
55 * m = (ramdisk_size + page_size - 1) / page_size
56 * o = (second_size + page_size - 1) / page_size
58 * 0. all entities are page_size aligned in flash
59 * 1. kernel and ramdisk are required (size != 0)
60 * 2. second is optional (second_size == 0 -> no second)
61 * 3. load each element (kernel, ramdisk, second) at
62 * the specified physical address (kernel_addr, etc)
63 * 4. prepare tags at tag_addr. kernel_args[] is
64 * appended to the kernel commandline in the tags.
65 * 5. r0 = 0, r1 = MACHINE_TYPE, r2 = tags_addr
66 * 6. if second_size != 0: jump to second_addr
67 * else: jump to kernel_addr