Skip to contentSkip to conversation

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

PATCH In review Artem Lapkin 4 participants 6 messages Nov 25, 2021 – Jan 24, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 image-board: fix wrong implementation ram disk address setup from cmdline

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

---
V2 changes
_ rebase to master
_ from https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

---
 boot/image-board.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
boot/image-board.c +3 -3
index bf8817165c..87a8f07432 100644
@@ -334,7 +334,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)) {
 			/*
@@ -352,13 +352,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) {
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Artem Lapkin

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

Quoted 8 lines

---
V2 changes
_ rebase to master
_ from https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

---
 boot/image-board.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Fixes f33a2c1bd0f ("image: Remove #ifdefs from select_ramdisk()")
#2 lore raw
In reply to Artem Lapkin
Quoted 37 lines · Artem Lapkin

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

---
V2 changes
_ rebase to master
_ from https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

---
 boot/image-board.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
boot/image-board.c +2 -1
index bf8817165c..87a8f07432 100644
@@ -334,7 +334,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)) {
 			/*
@@ -352,13 +352,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,

boot/image-board.c static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch, · line 364

Quoted 10 lines
boot/image-board.c +1 -2
 						      &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) {

I think we still need this? Can you please confirm and if so rebase to master again, sorry, thanks!

Signature · 1 line
Tom
author
#3 lore raw
Quoted 45 lines · Tom Rini
Quoted 42 lines · Artem Lapkin

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

---
V2 changes
_ rebase to master
_ from https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

---
 boot/image-board.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
boot/image-board.c +2 -2
index bf8817165c..87a8f07432 100644
@@ -334,7 +334,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)) {
                      /*
@@ -352,13 +352,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 {
Quoted 8 lines

boot/image-board.c static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch, · line 364

Quoted 5 lines
boot/image-board.c +1 -1
-                             done = false;
+                             done = true;
                      }
              }
              if (!done) {

I think we still need this? Can you please confirm and if so rebase to master again, sorry, thanks!

i need to check master and test it again - i'll replay soon tnx

Quoted 3 lines

--
Tom

author
#4 lore raw
In reply to Tom Rini
Quoted 45 lines · Tom Rini
Quoted 42 lines · Artem Lapkin

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

---
V2 changes
_ rebase to master
_ from https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

---
 boot/image-board.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
boot/image-board.c +2 -2
index bf8817165c..87a8f07432 100644
@@ -334,7 +334,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)) {
                      /*
@@ -352,13 +352,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 {
Quoted 8 lines

boot/image-board.c static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch, · line 364

Quoted 5 lines
boot/image-board.c +1 -1
-                             done = false;
+                             done = true;
                      }
              }
              if (!done) {

I think we still need this? Can you please confirm and if so rebase to master again, sorry, thanks!

i have check master which have new commit
621158d106fe53fbb2d786d9d19dff44ad1baf91

no need for this state !!

Author: Tom Rini <[email protected]>
Date:   Mon Dec 20 09:36:32 2021 -0500

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/[email protected]/

PS: about crash problem maybe its same reason may be need try apply my patch and no need reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

Quoted 3 lines

--
Tom

#5 lore raw

Hi,

Quoted 70 lines · Art Nikpal
Quoted 45 lines · Tom Rini
Quoted 42 lines · Artem Lapkin

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

---
V2 changes
_ rebase to master
_ from https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

---
 boot/image-board.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
boot/image-board.c +2 -2
index bf8817165c..87a8f07432 100644
@@ -334,7 +334,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)) {
                      /*
@@ -352,13 +352,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 {
Quoted 8 lines

boot/image-board.c static int select_ramdisk(bootm_headers_t *images, const char *select, u8 arch, · line 364

Quoted 5 lines
boot/image-board.c +1 -1
-                             done = false;
+                             done = true;
                      }
              }
              if (!done) {

I think we still need this? Can you please confirm and if so rebase to master again, sorry, thanks!

i have check master which have new commit
621158d106fe53fbb2d786d9d19dff44ad1baf91

no need for this state !!

Author: Tom Rini <[email protected]>
Date:   Mon Dec 20 09:36:32 2021 -0500

Revert "image: Remove #ifdefs from select_ramdisk()"

This reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

This causes a crash on some platforms as seen here:
https://lore.kernel.org/r/[email protected]/

Quoted 6 lines

PS: about crash problem maybe its same reason may be need try apply my patch and no need reverts commit f33a2c1bd0fb371511a485cac1f182ba50db51be.

Indeed, I missed this fix completely... anyway having a functional release was the most important at that time.

Re-sending "image: Remove #ifdefs from select_ramdisk()" with this fix squashed would be the time now.

Neil

Quoted 3 lines
Quoted 3 lines

--
Tom