Lines Matching refs:hdr
20 static int android_check_header(const struct andr_img_hdr *hdr) in android_check_header() argument
22 return memcmp(ANDR_BOOT_MAGIC, hdr->magic, ANDR_BOOT_MAGIC_SIZE); in android_check_header()
36 static void spl_android_print_contents(const struct andr_img_hdr *hdr)
40 u32 os_ver = hdr->os_version >> 11;
41 u32 os_lvl = hdr->os_version & ((1U << 11) - 1);
42 u32 header_version = hdr->header_version;
44 printf("%skernel size: %x\n", p, hdr->kernel_size);
45 printf("%skernel address: %x\n", p, hdr->kernel_addr);
46 printf("%sramdisk size: %x\n", p, hdr->ramdisk_size);
47 printf("%sramdisk address: %x\n", p, hdr->ramdisk_addr);
48 printf("%ssecond size: %x\n", p, hdr->second_size);
49 printf("%ssecond address: %x\n", p, hdr->second_addr);
50 printf("%stags address: %x\n", p, hdr->tags_addr);
51 printf("%spage size: %x\n", p, hdr->page_size);
56 p, hdr->os_version,
59 printf("%sname: %s\n", p, hdr->name);
60 printf("%scmdline: %s\n", p, hdr->cmdline);
63 printf("%srecovery dtbo size: %x\n", p, hdr->recovery_dtbo_size);
64 printf("%srecovery dtbo offset: %llx\n", p, hdr->recovery_dtbo_offset);
65 printf("%sheader size: %x\n", p, hdr->header_size);
69 printf("%sdtb size: %x\n", p, hdr->dtb_size);
70 printf("%sdtb addr: %llx\n", p, hdr->dtb_addr);
74 printf("%scmdline: %s\n", p, hdr->total_cmdline);
75 printf("%svendor ramdisk size: %x\n", p, hdr->vendor_ramdisk_size);
76 printf("%svendor page size: %x\n", p, hdr->vendor_page_size);
77 printf("%svendor header version: %d\n", p, hdr->vendor_header_version);
78 printf("%svendor header size: %x\n", p, hdr->vendor_header_size);
83 p, hdr->vendor_ramdisk_table_size);
85 p, hdr->vendor_ramdisk_table_entry_num);
87 p, hdr->vendor_ramdisk_table_entry_size);
89 p, hdr->vendor_bootconfig_size);
94 static ulong android_size(struct andr_img_hdr *hdr) in android_size() argument
98 len = hdr->page_size + in android_size()
99 ALIGN(hdr->kernel_size, hdr->page_size) + in android_size()
100 ALIGN(hdr->ramdisk_size, hdr->page_size) + in android_size()
101 ALIGN(hdr->second_size, hdr->page_size); in android_size()
102 if (hdr->header_version > 0) in android_size()
103 len += ALIGN(hdr->recovery_dtbo_size, hdr->page_size); in android_size()
104 if (hdr->header_version > 1) in android_size()
105 len += ALIGN(hdr->dtb_size, hdr->page_size); in android_size()
107 spl_android_print_contents(hdr); in android_size()
152 struct andr_img_hdr *hdr = (void *)CONFIG_SPL_BOOT_IMAGE_BUF; in spl_hash_android() local
159 if (hdr->header_version >= 3) in spl_hash_android()
164 buf = (void *)hdr + hdr->page_size; in spl_hash_android()
165 sha1_update(&ctx, (const uchar *)buf, hdr->kernel_size); in spl_hash_android()
166 sha1_update(&ctx, (const uchar *)&hdr->kernel_size, sizeof(hdr->kernel_size)); in spl_hash_android()
168 buf += ALIGN(hdr->kernel_size, hdr->page_size); in spl_hash_android()
169 sha1_update(&ctx, (const uchar *)buf, hdr->ramdisk_size); in spl_hash_android()
170 sha1_update(&ctx, (const uchar *)&hdr->ramdisk_size, sizeof(hdr->ramdisk_size)); in spl_hash_android()
172 buf += ALIGN(hdr->ramdisk_size, hdr->page_size); in spl_hash_android()
173 sha1_update(&ctx, (const uchar *)buf, hdr->second_size); in spl_hash_android()
174 sha1_update(&ctx, (const uchar *)&hdr->second_size, sizeof(hdr->second_size)); in spl_hash_android()
176 if (hdr->header_version > 0) { in spl_hash_android()
177 buf += ALIGN(hdr->second_size, hdr->page_size); in spl_hash_android()
178 sha1_update(&ctx, (const uchar *)buf, hdr->recovery_dtbo_size); in spl_hash_android()
179 sha1_update(&ctx, (const uchar *)&hdr->recovery_dtbo_size, sizeof(hdr->recovery_dtbo_size)); in spl_hash_android()
181 if (hdr->header_version > 1) { in spl_hash_android()
182 buf += ALIGN(hdr->recovery_dtbo_size, hdr->page_size); in spl_hash_android()
183 sha1_update(&ctx, (const uchar *)buf, hdr->dtb_size); in spl_hash_android()
184 sha1_update(&ctx, (const uchar *)&hdr->dtb_size, sizeof(hdr->dtb_size)); in spl_hash_android()
189 if (memcmp(hash, hdr->id, 20)) { in spl_hash_android()
190 print_hash("Hash from header", (u8 *)hdr->id, 20); in spl_hash_android()
203 struct andr_img_hdr *hdr = (void *)CONFIG_SPL_BOOT_IMAGE_BUF; in spl_hash_android() local
211 if (hdr->header_version >= 3) in spl_hash_android()
221 ctx.length = hdr->kernel_size + sizeof(hdr->kernel_size) + in spl_hash_android()
222 hdr->ramdisk_size + sizeof(hdr->ramdisk_size) + in spl_hash_android()
223 hdr->second_size + sizeof(hdr->second_size); in spl_hash_android()
224 if (hdr->header_version > 0) in spl_hash_android()
225 ctx.length += hdr->recovery_dtbo_size + sizeof(hdr->recovery_dtbo_size); in spl_hash_android()
226 if (hdr->header_version > 1) in spl_hash_android()
227 ctx.length += hdr->dtb_size + sizeof(hdr->dtb_size); in spl_hash_android()
231 buf = (void *)hdr + hdr->page_size; in spl_hash_android()
232 crypto_sha_update(dev, buf, hdr->kernel_size); in spl_hash_android()
233 crypto_sha_update(dev, &hdr->kernel_size, sizeof(hdr->kernel_size)); in spl_hash_android()
235 buf += ALIGN(hdr->kernel_size, hdr->page_size); in spl_hash_android()
236 crypto_sha_update(dev, buf, hdr->ramdisk_size); in spl_hash_android()
237 crypto_sha_update(dev, &hdr->ramdisk_size, sizeof(hdr->ramdisk_size)); in spl_hash_android()
239 buf += ALIGN(hdr->ramdisk_size, hdr->page_size); in spl_hash_android()
240 crypto_sha_update(dev, buf, hdr->second_size); in spl_hash_android()
241 crypto_sha_update(dev, &hdr->second_size, sizeof(hdr->second_size)); in spl_hash_android()
243 if (hdr->header_version > 0) { in spl_hash_android()
244 buf += ALIGN(hdr->second_size, hdr->page_size); in spl_hash_android()
245 crypto_sha_update(dev, buf, hdr->recovery_dtbo_size); in spl_hash_android()
246 crypto_sha_update(dev, &hdr->recovery_dtbo_size, sizeof(hdr->recovery_dtbo_size)); in spl_hash_android()
248 if (hdr->header_version > 1) { in spl_hash_android()
249 buf += ALIGN(hdr->recovery_dtbo_size, hdr->page_size); in spl_hash_android()
250 crypto_sha_update(dev, buf, hdr->dtb_size); in spl_hash_android()
251 crypto_sha_update(dev, &hdr->dtb_size, sizeof(hdr->dtb_size)); in spl_hash_android()
256 if (memcmp(hash, hdr->id, 20)) { in spl_hash_android()
257 print_hash("Hash from header", (u8 *)hdr->id, 20); in spl_hash_android()