* [U-Boot] [PATCH] Revert 'rockchip: mkimage: remove placeholder functions from rkimage'
@ 2017-06-22 8:11 Guillaume GARDET
2017-06-22 16:19 ` Dr. Philipp Tomsich
0 siblings, 1 reply; 3+ messages in thread
From: Guillaume GARDET @ 2017-06-22 8:11 UTC (permalink / raw)
To: u-boot
Revert commit 253c60a557d6740f15169a1f15772d7e64928d9b as it breaks the
return value of 'mkimage -T rkimage' and print the following error:
'./tools/mkimage: Can't print header for Rockchip Boot Image support: Success'
Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
---
tools/rkimage.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/tools/rkimage.c b/tools/rkimage.c
index 9880b1569f..44d098c775 100644
--- a/tools/rkimage.c
+++ b/tools/rkimage.c
@@ -13,6 +13,16 @@
static uint32_t header;
+static int rkimage_verify_header(unsigned char *buf, int size,
+ struct image_tool_params *params)
+{
+ return 0;
+}
+
+static void rkimage_print_header(const void *buf)
+{
+}
+
static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
struct image_tool_params *params)
{
@@ -23,6 +33,11 @@ static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
rkcommon_rc4_encode_spl(buf, 4, params->file_size);
}
+static int rkimage_extract_subimage(void *buf, struct image_tool_params *params)
+{
+ return 0;
+}
+
static int rkimage_check_image_type(uint8_t type)
{
if (type == IH_TYPE_RKIMAGE)
@@ -40,10 +55,10 @@ U_BOOT_IMAGE_TYPE(
4,
&header,
rkcommon_check_params,
- NULL,
- NULL,
+ rkimage_verify_header,
+ rkimage_print_header,
rkimage_set_header,
- NULL,
+ rkimage_extract_subimage,
rkimage_check_image_type,
NULL,
NULL
--
2.12.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] Revert 'rockchip: mkimage: remove placeholder functions from rkimage'
2017-06-22 8:11 [U-Boot] [PATCH] Revert 'rockchip: mkimage: remove placeholder functions from rkimage' Guillaume GARDET
@ 2017-06-22 16:19 ` Dr. Philipp Tomsich
2017-06-26 8:08 ` Guillaume Gardet
0 siblings, 1 reply; 3+ messages in thread
From: Dr. Philipp Tomsich @ 2017-06-22 16:19 UTC (permalink / raw)
To: u-boot
Guillaume,
> On 22 Jun 2017, at 10:11, Guillaume GARDET <guillaume.gardet@free.fr> wrote:
>
> Revert commit 253c60a557d6740f15169a1f15772d7e64928d9b as it breaks the
> return value of 'mkimage -T rkimage' and print the following error:
> './tools/mkimage: Can't print header for Rockchip Boot Image support: Success’
If you revert the underlying change, then 'dumpimage -l spl.img’ will break for all
Rockchip rksd/rkspi images (see the original commit message for details why it
is necessary).
E.g. with the change in question reverted:
ptomsich at android:~/rk3399/u-boot$ tools/dumpimage -l spl-3368.img
ptomsich at android:~/rk3399/u-boot$
With the change in question in place:
ptomsich at android:~/rk3399/u-boot$ tools/dumpimage -l spl-3368.img
Image Type: Rockchip RK33 (SD/MMC) boot image
Data Size: 28672 bytes
ptomsich at android:~/rk3399/u-boot$
Looks like correctly doing this is even more involved in the imagetool framework
than meets the eye, as you error is coming from:
> /* Print the image information by processing image header */
> if (tparams->print_header)
> tparams->print_header (ptr);
> else {
> fprintf (stderr, "%s: Can't print header for %s: %s\n",
> params.cmdname, tparams->name, strerror(errno));
> exit (EXIT_FAILURE);
> }
So you might want to check whether adding but just the print_header
function works for you—the verify should be a sufficient guard for the
dumpimage case.
A yet better solution would be to implement verify_header/print_header
in a useful way for the rkimage type as well …
Regards,
Philipp.
> Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
>
> Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
> Cc: Simon Glass <sjg@chromium.org>
> Cc: Tom Rini <trini@konsulko.com>
>
> ---
> tools/rkimage.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/tools/rkimage.c b/tools/rkimage.c
> index 9880b1569f..44d098c775 100644
> --- a/tools/rkimage.c
> +++ b/tools/rkimage.c
> @@ -13,6 +13,16 @@
>
> static uint32_t header;
>
> +static int rkimage_verify_header(unsigned char *buf, int size,
> + struct image_tool_params *params)
> +{
> + return 0;
> +}
> +
> +static void rkimage_print_header(const void *buf)
> +{
> +}
> +
> static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
> struct image_tool_params *params)
> {
> @@ -23,6 +33,11 @@ static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
> rkcommon_rc4_encode_spl(buf, 4, params->file_size);
> }
>
> +static int rkimage_extract_subimage(void *buf, struct image_tool_params *params)
> +{
> + return 0;
> +}
> +
> static int rkimage_check_image_type(uint8_t type)
> {
> if (type == IH_TYPE_RKIMAGE)
> @@ -40,10 +55,10 @@ U_BOOT_IMAGE_TYPE(
> 4,
> &header,
> rkcommon_check_params,
> - NULL,
> - NULL,
> + rkimage_verify_header,
> + rkimage_print_header,
> rkimage_set_header,
> - NULL,
> + rkimage_extract_subimage,
> rkimage_check_image_type,
> NULL,
> NULL
> --
> 2.12.3
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [U-Boot] [PATCH] Revert 'rockchip: mkimage: remove placeholder functions from rkimage'
2017-06-22 16:19 ` Dr. Philipp Tomsich
@ 2017-06-26 8:08 ` Guillaume Gardet
0 siblings, 0 replies; 3+ messages in thread
From: Guillaume Gardet @ 2017-06-26 8:08 UTC (permalink / raw)
To: u-boot
Le 22/06/2017 à 18:19, Dr. Philipp Tomsich a écrit :
> Guillaume,
>
>> On 22 Jun 2017, at 10:11, Guillaume GARDET <guillaume.gardet@free.fr> wrote:
>>
>> Revert commit 253c60a557d6740f15169a1f15772d7e64928d9b as it breaks the
>> return value of 'mkimage -T rkimage' and print the following error:
>> './tools/mkimage: Can't print header for Rockchip Boot Image support: Success’
> If you revert the underlying change, then 'dumpimage -l spl.img’ will break for all
> Rockchip rksd/rkspi images (see the original commit message for details why it
> is necessary).
>
> E.g. with the change in question reverted:
> ptomsich at android:~/rk3399/u-boot$ tools/dumpimage -l spl-3368.img
> ptomsich at android:~/rk3399/u-boot$
> With the change in question in place:
> ptomsich at android:~/rk3399/u-boot$ tools/dumpimage -l spl-3368.img
> Image Type: Rockchip RK33 (SD/MMC) boot image
> Data Size: 28672 bytes
> ptomsich at android:~/rk3399/u-boot$
>
> Looks like correctly doing this is even more involved in the imagetool framework
> than meets the eye, as you error is coming from:
>> /* Print the image information by processing image header */
>> if (tparams->print_header)
>> tparams->print_header (ptr);
>> else {
>> fprintf (stderr, "%s: Can't print header for %s: %s\n",
>> params.cmdname, tparams->name, strerror(errno));
>> exit (EXIT_FAILURE);
>> }
>
> So you might want to check whether adding but just the print_header
> function works for you—the verify should be a sufficient guard for the
> dumpimage case.
>
> A yet better solution would be to implement verify_header/print_header
> in a useful way for the rkimage type as well …
I am not familiar with RK, so I cannot implement this.
We should find a solution quite quickly since the release is not so far. Later, we could implement missing functions if wanted.
Could you propose a fix to your commit which is working for you, please?
Guillaume
>
> Regards,
> Philipp.
>
>> Signed-off-by: Guillaume GARDET <guillaume.gardet@free.fr>
>>
>> Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>
>> Cc: Simon Glass <sjg@chromium.org>
>> Cc: Tom Rini <trini@konsulko.com>
>>
>> ---
>> tools/rkimage.c | 21 ++++++++++++++++++---
>> 1 file changed, 18 insertions(+), 3 deletions(-)
>>
>> diff --git a/tools/rkimage.c b/tools/rkimage.c
>> index 9880b1569f..44d098c775 100644
>> --- a/tools/rkimage.c
>> +++ b/tools/rkimage.c
>> @@ -13,6 +13,16 @@
>>
>> static uint32_t header;
>>
>> +static int rkimage_verify_header(unsigned char *buf, int size,
>> + struct image_tool_params *params)
>> +{
>> + return 0;
>> +}
>> +
>> +static void rkimage_print_header(const void *buf)
>> +{
>> +}
>> +
>> static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
>> struct image_tool_params *params)
>> {
>> @@ -23,6 +33,11 @@ static void rkimage_set_header(void *buf, struct stat *sbuf, int ifd,
>> rkcommon_rc4_encode_spl(buf, 4, params->file_size);
>> }
>>
>> +static int rkimage_extract_subimage(void *buf, struct image_tool_params *params)
>> +{
>> + return 0;
>> +}
>> +
>> static int rkimage_check_image_type(uint8_t type)
>> {
>> if (type == IH_TYPE_RKIMAGE)
>> @@ -40,10 +55,10 @@ U_BOOT_IMAGE_TYPE(
>> 4,
>> &header,
>> rkcommon_check_params,
>> - NULL,
>> - NULL,
>> + rkimage_verify_header,
>> + rkimage_print_header,
>> rkimage_set_header,
>> - NULL,
>> + rkimage_extract_subimage,
>> rkimage_check_image_type,
>> NULL,
>> NULL
>> --
>> 2.12.3
>>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-06-26 8:08 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-22 8:11 [U-Boot] [PATCH] Revert 'rockchip: mkimage: remove placeholder functions from rkimage' Guillaume GARDET
2017-06-22 16:19 ` Dr. Philipp Tomsich
2017-06-26 8:08 ` Guillaume Gardet
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.