public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [RFC PATCH] common: image: minimal android image iminfo support
@ 2016-06-10 14:23 Michael Trimarchi
  2016-06-10 16:44 ` Simon Glass
  2016-06-10 17:54 ` [U-Boot] [RFC PATCH V2] " Michael Trimarchi
  0 siblings, 2 replies; 5+ messages in thread
From: Michael Trimarchi @ 2016-06-10 14:23 UTC (permalink / raw)
  To: u-boot


Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 cmd/bootm.c            |  6 ++++++
 common/image-android.c | 28 ++++++++++++++++++++++++++++
 include/image.h        |  1 +
 3 files changed, 35 insertions(+)

diff --git a/cmd/bootm.c b/cmd/bootm.c
index 1bca6fa..eb4e904 100644
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
@@ -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");
diff --git a/common/image-android.c b/common/image-android.c
index b6a94b3..6284c4c 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -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
diff --git a/include/image.h b/include/image.h
index f9ee564..61b5d3b 100644
--- a/include/image.h
+++ b/include/image.h
@@ -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 */
 
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [RFC PATCH] common: image: minimal android image iminfo support
  2016-06-10 14:23 [U-Boot] [RFC PATCH] common: image: minimal android image iminfo support Michael Trimarchi
@ 2016-06-10 16:44 ` Simon Glass
  2016-06-10 17:54 ` [U-Boot] [RFC PATCH V2] " Michael Trimarchi
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Glass @ 2016-06-10 16:44 UTC (permalink / raw)
  To: u-boot

On 10 June 2016 at 08:23, Michael Trimarchi
<michael@amarulasolutions.com> wrote:
>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>

Commit message?

> ---
>  cmd/bootm.c            |  6 ++++++
>  common/image-android.c | 28 ++++++++++++++++++++++++++++
>  include/image.h        |  1 +
>  3 files changed, 35 insertions(+)
>
> diff --git a/cmd/bootm.c b/cmd/bootm.c
> index 1bca6fa..eb4e904 100644
> --- a/cmd/bootm.c
> +++ b/cmd/bootm.c
> @@ -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");
> diff --git a/common/image-android.c b/common/image-android.c
> index b6a94b3..6284c4c 100644
> --- a/common/image-android.c
> +++ b/common/image-android.c
> @@ -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);

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

> +}
> +#endif
> diff --git a/include/image.h b/include/image.h
> index f9ee564..61b5d3b 100644
> --- a/include/image.h
> +++ b/include/image.h
> @@ -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 */
>
> --
> 2.8.4
>

Regards,
Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [RFC PATCH V2] common: image: minimal android image iminfo support
  2016-06-10 14:23 [U-Boot] [RFC PATCH] common: image: minimal android image iminfo support Michael Trimarchi
  2016-06-10 16:44 ` Simon Glass
@ 2016-06-10 17:54 ` Michael Trimarchi
  2016-06-12 21:15   ` Simon Glass
  2016-06-25  2:51   ` [U-Boot] [U-Boot, RFC, " Tom Rini
  1 sibling, 2 replies; 5+ messages in thread
From: Michael Trimarchi @ 2016-06-10 17:54 UTC (permalink / raw)
  To: u-boot

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

Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
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(+)

diff --git a/cmd/bootm.c b/cmd/bootm.c
index 1bca6fa..eb4e904 100644
--- a/cmd/bootm.c
+++ b/cmd/bootm.c
@@ -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");
diff --git a/common/image-android.c b/common/image-android.c
index b6a94b3..ee03b96 100644
--- a/common/image-android.c
+++ b/common/image-android.c
@@ -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
diff --git a/include/image.h b/include/image.h
index f9ee564..61b5d3b 100644
--- a/include/image.h
+++ b/include/image.h
@@ -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 */
 
-- 
2.8.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [RFC PATCH V2] common: image: minimal android image iminfo support
  2016-06-10 17:54 ` [U-Boot] [RFC PATCH V2] " Michael Trimarchi
@ 2016-06-12 21:15   ` Simon Glass
  2016-06-25  2:51   ` [U-Boot] [U-Boot, RFC, " Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Glass @ 2016-06-12 21:15 UTC (permalink / raw)
  To: u-boot

On 10 June 2016 at 11:54, Michael Trimarchi
<michael@amarulasolutions.com> wrote:
> 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
>
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> ---
> 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(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [U-Boot, RFC, V2] common: image: minimal android image iminfo support
  2016-06-10 17:54 ` [U-Boot] [RFC PATCH V2] " Michael Trimarchi
  2016-06-12 21:15   ` Simon Glass
@ 2016-06-25  2:51   ` Tom Rini
  1 sibling, 0 replies; 5+ messages in thread
From: Tom Rini @ 2016-06-25  2:51 UTC (permalink / raw)
  To: u-boot

On Fri, Jun 10, 2016 at 07:54:37PM +0200, Michael Trimarchi wrote:

> 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
> 
> Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
> Reviewed-by: Simon Glass <sjg@chromium.org>

Applied to u-boot/master, thanks!

-- 
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>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-25  2:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-10 14:23 [U-Boot] [RFC PATCH] common: image: minimal android image iminfo support Michael Trimarchi
2016-06-10 16:44 ` Simon Glass
2016-06-10 17:54 ` [U-Boot] [RFC PATCH V2] " Michael Trimarchi
2016-06-12 21:15   ` Simon Glass
2016-06-25  2:51   ` [U-Boot] [U-Boot, RFC, " Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox