diff mbox series

image-board: fix wrong implementation ram disk address setup from cmdline

Message ID 20211016051915.4157293-1-art@khadas.com
State Superseded
Delegated to: Tom Rini
Headers show
Series image-board: fix wrong implementation ram disk address setup from cmdline | expand

Commit Message

Art Nikpal Oct. 16, 2021, 5:19 a.m. UTC
Problem

Wrong implementation logic: ramdisk cmdline image address always ignored!
Next block { rd_addr = hextoul(select, NULL) } unusable for raw initrd.

We have unbootable raw initrd images because, select_ramdisk for raw
initrd images ignore submited select addr and setup rd_datap value to 0

Come-from: https://patchwork.ozlabs.org/project/uboot/patch/20211015101501.4091141-1-art@khadas.com/

Signed-off-by: Artem Lapkin <art@khadas.com>
---
 common/image-board.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Simon Glass Oct. 31, 2021, 11:47 p.m. UTC | #1
Hi Artem,

On Fri, 15 Oct 2021 at 23:19, Artem Lapkin <email2tema@gmail.com> wrote:
>
> Problem
>
> Wrong implementation logic: ramdisk cmdline image address always ignored!
> Next block { rd_addr = hextoul(select, NULL) } unusable for raw initrd.
>
> We have unbootable raw initrd images because, select_ramdisk for raw
> initrd images ignore submited select addr and setup rd_datap value to 0
>
> Come-from: https://patchwork.ozlabs.org/project/uboot/patch/20211015101501.4091141-1-art@khadas.com/
>
> Signed-off-by: Artem Lapkin <art@khadas.com>
> ---
>  common/image-board.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)

Fixes: f33a2c1bd0f ("image: Remove #ifdefs from select_ramdisk()")

(I believe, can you confirm?)

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


>
> diff --git a/common/image-board.c b/common/image-board.c
> index e7660352e9..e7063016ef 100644
> --- a/common/image-board.c
> +++ b/common/image-board.c
> @@ -333,7 +333,7 @@ static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch,
>
>         if (select) {
>                 ulong default_addr;
> -               bool done = true;
> +               bool done = false;
>
>                 if (CONFIG_IS_ENABLED(FIT)) {
>                         /*
> @@ -351,13 +351,13 @@ static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch,
>                                            &fit_uname_config)) {
>                                 debug("*  ramdisk: config '%s' from image at 0x%08lx\n",
>                                       fit_uname_config, rd_addr);
> +                               done = true;
>                         } else if (fit_parse_subimage(select, default_addr,
>                                                       &rd_addr,
>                                                       &fit_uname_ramdisk)) {
>                                 debug("*  ramdisk: subimage '%s' from image at 0x%08lx\n",
>                                       fit_uname_ramdisk, rd_addr);
> -                       } else {
> -                               done = false;
> +                               done = true;
>                         }
>                 }
>                 if (!done) {
> --
> 2.25.1
>
Art Nikpal Nov. 1, 2021, 6:52 a.m. UTC | #2
hi Simon

> Fixes: f33a2c1bd0f ("image: Remove #ifdefs from select_ramdisk()")
> (I believe, can you confirm?)

confirm f33a2c1bd0f has wrong implementation logic for raw ramdisk image
sure i have tested it ...

On Mon, Nov 1, 2021 at 7:47 AM Simon Glass <sjg@chromium.org> wrote:
>
> Hi Artem,
>
> On Fri, 15 Oct 2021 at 23:19, Artem Lapkin <email2tema@gmail.com> wrote:
> >
> > Problem
> >
> > Wrong implementation logic: ramdisk cmdline image address always ignored!
> > Next block { rd_addr = hextoul(select, NULL) } unusable for raw initrd.
> >
> > We have unbootable raw initrd images because, select_ramdisk for raw
> > initrd images ignore submited select addr and setup rd_datap value to 0
> >
> > Come-from: https://patchwork.ozlabs.org/project/uboot/patch/20211015101501.4091141-1-art@khadas.com/
> >
> > Signed-off-by: Artem Lapkin <art@khadas.com>
> > ---
> >  common/image-board.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
>
> Fixes: f33a2c1bd0f ("image: Remove #ifdefs from select_ramdisk()")
>
> (I believe, can you confirm?)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
>
> >
> > diff --git a/common/image-board.c b/common/image-board.c
> > index e7660352e9..e7063016ef 100644
> > --- a/common/image-board.c
> > +++ b/common/image-board.c
> > @@ -333,7 +333,7 @@ static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch,
> >
> >         if (select) {
> >                 ulong default_addr;
> > -               bool done = true;
> > +               bool done = false;
> >
> >                 if (CONFIG_IS_ENABLED(FIT)) {
> >                         /*
> > @@ -351,13 +351,13 @@ static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch,
> >                                            &fit_uname_config)) {
> >                                 debug("*  ramdisk: config '%s' from image at 0x%08lx\n",
> >                                       fit_uname_config, rd_addr);
> > +                               done = true;
> >                         } else if (fit_parse_subimage(select, default_addr,
> >                                                       &rd_addr,
> >                                                       &fit_uname_ramdisk)) {
> >                                 debug("*  ramdisk: subimage '%s' from image at 0x%08lx\n",
> >                                       fit_uname_ramdisk, rd_addr);
> > -                       } else {
> > -                               done = false;
> > +                               done = true;
> >                         }
> >                 }
> >                 if (!done) {
> > --
> > 2.25.1
> >
Simon Glass Nov. 5, 2021, 2:02 a.m. UTC | #3
Hi Art,

On Mon, 1 Nov 2021 at 00:52, Art Nikpal <email2tema@gmail.com> wrote:
>
> hi Simon
>
> > Fixes: f33a2c1bd0f ("image: Remove #ifdefs from select_ramdisk()")
> > (I believe, can you confirm?)
>
> confirm f33a2c1bd0f has wrong implementation logic for raw ramdisk image
> sure i have tested it ...

Thanks!

BTW please can you try not to top-post?

Regards,
Simon


>
> On Mon, Nov 1, 2021 at 7:47 AM Simon Glass <sjg@chromium.org> wrote:
> >
> > Hi Artem,
> >
> > On Fri, 15 Oct 2021 at 23:19, Artem Lapkin <email2tema@gmail.com> wrote:
> > >
> > > Problem
> > >
> > > Wrong implementation logic: ramdisk cmdline image address always ignored!
> > > Next block { rd_addr = hextoul(select, NULL) } unusable for raw initrd.
> > >
> > > We have unbootable raw initrd images because, select_ramdisk for raw
> > > initrd images ignore submited select addr and setup rd_datap value to 0
> > >
> > > Come-from: https://patchwork.ozlabs.org/project/uboot/patch/20211015101501.4091141-1-art@khadas.com/
> > >
> > > Signed-off-by: Artem Lapkin <art@khadas.com>
> > > ---
> > >  common/image-board.c | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > Fixes: f33a2c1bd0f ("image: Remove #ifdefs from select_ramdisk()")
> >
> > (I believe, can you confirm?)
> >
> > Reviewed-by: Simon Glass <sjg@chromium.org>
> >
> >
> > >
> > > diff --git a/common/image-board.c b/common/image-board.c
> > > index e7660352e9..e7063016ef 100644
> > > --- a/common/image-board.c
> > > +++ b/common/image-board.c
> > > @@ -333,7 +333,7 @@ static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch,
> > >
> > >         if (select) {
> > >                 ulong default_addr;
> > > -               bool done = true;
> > > +               bool done = false;
> > >
> > >                 if (CONFIG_IS_ENABLED(FIT)) {
> > >                         /*
> > > @@ -351,13 +351,13 @@ static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch,
> > >                                            &fit_uname_config)) {
> > >                                 debug("*  ramdisk: config '%s' from image at 0x%08lx\n",
> > >                                       fit_uname_config, rd_addr);
> > > +                               done = true;
> > >                         } else if (fit_parse_subimage(select, default_addr,
> > >                                                       &rd_addr,
> > >                                                       &fit_uname_ramdisk)) {
> > >                                 debug("*  ramdisk: subimage '%s' from image at 0x%08lx\n",
> > >                                       fit_uname_ramdisk, rd_addr);
> > > -                       } else {
> > > -                               done = false;
> > > +                               done = true;
> > >                         }
> > >                 }
> > >                 if (!done) {
> > > --
> > > 2.25.1
> > >
diff mbox series

Patch

diff --git a/common/image-board.c b/common/image-board.c
index e7660352e9..e7063016ef 100644
--- a/common/image-board.c
+++ b/common/image-board.c
@@ -333,7 +333,7 @@  static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch,
 
 	if (select) {
 		ulong default_addr;
-		bool done = true;
+		bool done = false;
 
 		if (CONFIG_IS_ENABLED(FIT)) {
 			/*
@@ -351,13 +351,13 @@  static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch,
 					   &fit_uname_config)) {
 				debug("*  ramdisk: config '%s' from image at 0x%08lx\n",
 				      fit_uname_config, rd_addr);
+				done = true;
 			} else if (fit_parse_subimage(select, default_addr,
 						      &rd_addr,
 						      &fit_uname_ramdisk)) {
 				debug("*  ramdisk: subimage '%s' from image at 0x%08lx\n",
 				      fit_uname_ramdisk, rd_addr);
-			} else {
-				done = false;
+				done = true;
 			}
 		}
 		if (!done) {