Skip to contentSkip to conversation

common: image: minimal android image iminfo support

RFC PATCH Superseded Michael Trimarchi 3 participants 5 messages Jun 10, 2016 – Jun 25, 2016

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 common: image: minimal android image iminfo support

---
 cmd/bootm.c            |  6 ++++++
 common/image-android.c | 28 ++++++++++++++++++++++++++++
 include/image.h        |  1 +
 3 files changed, 35 insertions(+)
cmd/bootm.c +6 -0
index 1bca6fa..eb4e904 100644
@@ -275,6 +275,12 @@ static int image_info(ulong addr)
 		puts("OK\n");
 		return 0;
 #endif
+#if defined(CONFIG_ANDROID_BOOT_IMAGE)
+	case IMAGE_FORMAT_ANDROID:
+		puts("   Android image found\n");
+		android_print_contents(hdr);
+		return 0;
+#endif
 #if defined(CONFIG_FIT)
 	case IMAGE_FORMAT_FIT:
 		puts("   FIT image found\n");
common/image-android.c +28 -0
index b6a94b3..6284c4c 100644
@@ -145,3 +145,31 @@ int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
 	*rd_len = hdr->ramdisk_size;
 	return 0;
 }
+
+#if !defined(CONFIG_SPL_BUILD)
+/**
+ * android_print_contents - prints out the contents of the Android format image
+ * @hdr: pointer to the Android format image header
+ *
+ * fit_print_contents() formats a multi line Android image contents description.
+ * The routine prints out Android image properties
+ *
+ * returns:
+ *     no returned results
+ */
+void android_print_contents(const struct andr_img_hdr *hdr)
+{
+	const char * const p = IMAGE_INDENT_STRING;
+
+	printf("%skernel size:      0x%x\n", p, hdr->kernel_size);
+	printf("%skernel address:   0x%x\n", p, hdr->kernel_addr);
+	printf("%sramdisk size:     0x%x\n", p, hdr->ramdisk_size);
+	printf("%sramdisk addrress: 0x%x\n", p, hdr->ramdisk_addr);
+	printf("%ssecond size:      0x%x\n", p, hdr->second_size);
+	printf("%ssecond address:   0x%x\n", p, hdr->second_addr);
+	printf("%stags address:     0x%x\n", p, hdr->tags_addr);
+	printf("%spage size:        0x%x\n", p, hdr->page_size);
+	printf("%sname:             %s\n", p, hdr->name);
+	printf("%scmdline:          %s\n", p, hdr->cmdline);
+}
+#endif
include/image.h +1 -0
index f9ee564..61b5d3b 100644
@@ -1151,6 +1151,7 @@ int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
 			      ulong *rd_data, ulong *rd_len);
 ulong android_image_get_end(const struct andr_img_hdr *hdr);
 ulong android_image_get_kload(const struct andr_img_hdr *hdr);
+void android_print_contents(const struct andr_img_hdr *hdr);
 
 #endif /* CONFIG_ANDROID_BOOT_IMAGE */
 
Signature · 1 line
2.8.4
#1 lore raw

RFC PATCH 1/1 common: image: minimal android image iminfo support

Quoted 2 lines · Michael Trimarchi

Commit message?

Quoted 47 lines
---
 cmd/bootm.c            |  6 ++++++
 common/image-android.c | 28 ++++++++++++++++++++++++++++
 include/image.h        |  1 +
 3 files changed, 35 insertions(+)
cmd/bootm.c +6 -0
index 1bca6fa..eb4e904 100644
@@ -275,6 +275,12 @@ static int image_info(ulong addr)
                puts("OK\n");
                return 0;
 #endif
+#if defined(CONFIG_ANDROID_BOOT_IMAGE)
+       case IMAGE_FORMAT_ANDROID:
+               puts("   Android image found\n");
+               android_print_contents(hdr);
+               return 0;
+#endif
 #if defined(CONFIG_FIT)
        case IMAGE_FORMAT_FIT:
                puts("   FIT image found\n");
common/image-android.c +16 -0
index b6a94b3..6284c4c 100644
@@ -145,3 +145,31 @@ int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
        *rd_len = hdr->ramdisk_size;
        return 0;
 }
+
+#if !defined(CONFIG_SPL_BUILD)
+/**
+ * android_print_contents - prints out the contents of the Android format image
+ * @hdr: pointer to the Android format image header
+ *
+ * fit_print_contents() formats a multi line Android image contents description.
+ * The routine prints out Android image properties
+ *
+ * returns:
+ *     no returned results
+ */
+void android_print_contents(const struct andr_img_hdr *hdr)
+{
+       const char * const p = IMAGE_INDENT_STRING;
+

common/image-android.c int android_image_get_ramdisk(const struct andr_img_hdr *hdr, · line 173

Quoted 10 lines
common/image-android.c +10 -0
+       printf("%skernel size:      0x%x\n", p, hdr->kernel_size);
+       printf("%skernel address:   0x%x\n", p, hdr->kernel_addr);
+       printf("%sramdisk size:     0x%x\n", p, hdr->ramdisk_size);
+       printf("%sramdisk addrress: 0x%x\n", p, hdr->ramdisk_addr);
+       printf("%ssecond size:      0x%x\n", p, hdr->second_size);
+       printf("%ssecond address:   0x%x\n", p, hdr->second_addr);
+       printf("%stags address:     0x%x\n", p, hdr->tags_addr);
+       printf("%spage size:        0x%x\n", p, hdr->page_size);
+       printf("%sname:             %s\n", p, hdr->name);
+       printf("%scmdline:          %s\n", p, hdr->cmdline);

U-Boot uses hex by default so I think you can drop the 0x.

Quoted 15 lines
common/image-android.c +2 -0
+}
+#endif
include/image.h +1 -1
index f9ee564..61b5d3b 100644
@@ -1151,6 +1151,7 @@ int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
                              ulong *rd_data, ulong *rd_len);
 ulong android_image_get_end(const struct andr_img_hdr *hdr);
 ulong android_image_get_kload(const struct andr_img_hdr *hdr);
+void android_print_contents(const struct andr_img_hdr *hdr);
 
 #endif /* CONFIG_ANDROID_BOOT_IMAGE */
 
--
Quoted 2 lines

2.8.4

Regards,
Simon

#2 lore raw

RFC PATCH v2 1/1 common: image: minimal android image iminfo support

In reply to Michael Trimarchi

We already support iminfo for other images. The idea of this patch is start to have a minimal support for android image format. We still need to print id[] array

---
Changes V1 -> V2:
- remove 0x on hex print
- fix comment in the function
- add commit message

---
 cmd/bootm.c            |  6 ++++++
 common/image-android.c | 29 +++++++++++++++++++++++++++++
 include/image.h        |  1 +
 3 files changed, 36 insertions(+)
cmd/bootm.c +6 -0
index 1bca6fa..eb4e904 100644
@@ -275,6 +275,12 @@ static int image_info(ulong addr)
 		puts("OK\n");
 		return 0;
 #endif
+#if defined(CONFIG_ANDROID_BOOT_IMAGE)
+	case IMAGE_FORMAT_ANDROID:
+		puts("   Android image found\n");
+		android_print_contents(hdr);
+		return 0;
+#endif
 #if defined(CONFIG_FIT)
 	case IMAGE_FORMAT_FIT:
 		puts("   FIT image found\n");
common/image-android.c +29 -0
index b6a94b3..ee03b96 100644
@@ -145,3 +145,32 @@ int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
 	*rd_len = hdr->ramdisk_size;
 	return 0;
 }
+
+#if !defined(CONFIG_SPL_BUILD)
+/**
+ * android_print_contents - prints out the contents of the Android format image
+ * @hdr: pointer to the Android format image header
+ *
+ * android_print_contents() formats a multi line Android image contents
+ * description.
+ * The routine prints out Android image properties
+ *
+ * returns:
+ *     no returned results
+ */
+void android_print_contents(const struct andr_img_hdr *hdr)
+{
+	const char * const p = IMAGE_INDENT_STRING;
+
+	printf("%skernel size:      %x\n", p, hdr->kernel_size);
+	printf("%skernel address:   %x\n", p, hdr->kernel_addr);
+	printf("%sramdisk size:     %x\n", p, hdr->ramdisk_size);
+	printf("%sramdisk addrress: %x\n", p, hdr->ramdisk_addr);
+	printf("%ssecond size:      %x\n", p, hdr->second_size);
+	printf("%ssecond address:   %x\n", p, hdr->second_addr);
+	printf("%stags address:     %x\n", p, hdr->tags_addr);
+	printf("%spage size:        %x\n", p, hdr->page_size);
+	printf("%sname:             %s\n", p, hdr->name);
+	printf("%scmdline:          %s\n", p, hdr->cmdline);
+}
+#endif
include/image.h +1 -0
index f9ee564..61b5d3b 100644
@@ -1151,6 +1151,7 @@ int android_image_get_ramdisk(const struct andr_img_hdr *hdr,
 			      ulong *rd_data, ulong *rd_len);
 ulong android_image_get_end(const struct andr_img_hdr *hdr);
 ulong android_image_get_kload(const struct andr_img_hdr *hdr);
+void android_print_contents(const struct andr_img_hdr *hdr);
 
 #endif /* CONFIG_ANDROID_BOOT_IMAGE */
 
Signature · 1 line
2.8.4
#3 lore raw

RFC PATCH v2 1/1 common: image: minimal android image iminfo support

Quoted 10 lines · Michael Trimarchi

We already support iminfo for other images. The idea of this patch is start to have a minimal support for android image format. We still need to print id[] array

---
Changes V1 -> V2:
- remove 0x on hex print
- fix comment in the function
- add commit message

Quoted 5 lines
---
 cmd/bootm.c            |  6 ++++++
 common/image-android.c | 29 +++++++++++++++++++++++++++++
 include/image.h        |  1 +
 3 files changed, 36 insertions(+)
#4 lore raw
In reply to Michael Trimarchi
Quoted 6 lines · Michael Trimarchi

We already support iminfo for other images. The idea of this patch is start to have a minimal support for android image format. We still need to print id[] array

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160624/522bee70/attachment.sig>