bootimg.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. /* tools/mkbootimg/bootimg.h
  2. **
  3. ** Copyright 2007, The Android Open Source Project
  4. **
  5. ** Licensed under the Apache License, Version 2.0 (the "License");
  6. ** you may not use this file except in compliance with the License.
  7. ** You may obtain a copy of the License at
  8. **
  9. ** http://www.apache.org/licenses/LICENSE-2.0
  10. **
  11. ** Unless required by applicable law or agreed to in writing, software
  12. ** distributed under the License is distributed on an "AS IS" BASIS,
  13. ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. ** See the License for the specific language governing permissions and
  15. ** limitations under the License.
  16. */
  17. #ifndef _BOOT_IMAGE_H_
  18. #define _BOOT_IMAGE_H_
  19. typedef struct boot_img_hdr boot_img_hdr;
  20. #define BOOT_MAGIC "ANDROID!"
  21. #define BOOT_MAGIC_SIZE 8
  22. #define BOOT_NAME_SIZE 16
  23. #define BOOT_ARGS_SIZE 512
  24. struct boot_img_hdr
  25. {
  26. unsigned char magic[BOOT_MAGIC_SIZE];
  27. unsigned kernel_size; /* size in bytes */
  28. unsigned kernel_addr; /* physical load addr */
  29. unsigned ramdisk_size; /* size in bytes */
  30. unsigned ramdisk_addr; /* physical load addr */
  31. unsigned second_size; /* size in bytes */
  32. unsigned second_addr; /* physical load addr */
  33. unsigned tags_addr; /* physical addr for kernel tags */
  34. unsigned page_size; /* flash page size we assume */
  35. unsigned dt_size; /* device tree in bytes */
  36. unsigned unused; /* future expansion: should be 0 */
  37. unsigned char name[BOOT_NAME_SIZE]; /* asciiz product name */
  38. unsigned char cmdline[BOOT_ARGS_SIZE];
  39. unsigned id[8]; /* timestamp / checksum / sha1 / etc */
  40. };
  41. /*
  42. ** +-----------------+
  43. ** | boot header | 1 page
  44. ** +-----------------+
  45. ** | kernel | n pages
  46. ** +-----------------+
  47. ** | ramdisk | m pages
  48. ** +-----------------+
  49. ** | second stage | o pages
  50. ** +-----------------+
  51. ** | device tree | p pages
  52. ** +-----------------+
  53. ** | signature | 256 bytes
  54. ** +-----------------+
  55. **
  56. ** n = (kernel_size + page_size - 1) / page_size
  57. ** m = (ramdisk_size + page_size - 1) / page_size
  58. ** o = (second_size + page_size - 1) / page_size
  59. ** p = (dt_size + page_size - 1) / page_size
  60. **
  61. ** 0. all entities are page_size aligned in flash
  62. ** 1. kernel and ramdisk are required (size != 0)
  63. ** 2. second is optional (second_size == 0 -> no second)
  64. ** 3. load each element (kernel, ramdisk, second) at
  65. ** the specified physical address (kernel_addr, etc)
  66. ** 4. prepare tags at tag_addr. kernel_args[] is
  67. ** appended to the kernel commandline in the tags.
  68. ** 5. r0 = 0, r1 = MACHINE_TYPE, r2 = tags_addr
  69. ** 6. if second_size != 0: jump to second_addr
  70. ** else: jump to kernel_addr
  71. */
  72. #if 0
  73. typedef struct ptentry ptentry;
  74. struct ptentry {
  75. char name[16]; /* asciiz partition name */
  76. unsigned start; /* starting block number */
  77. unsigned length; /* length in blocks */
  78. unsigned flags; /* set to zero */
  79. };
  80. /* MSM Partition Table ATAG
  81. **
  82. ** length: 2 + 7 * n
  83. ** atag: 0x4d534d70
  84. ** <ptentry> x n
  85. */
  86. #endif
  87. #endif