diff mbox series

[4/4] X86: pxeboot: bugfix: Set variable for size of initrd

Message ID 20230502094923.4024-5-thomas.mittelstaedt@bosch.com
State Superseded
Delegated to: Bin Meng
Headers show
Series Enable U-Boot at Virtualbox to boot images | expand

Commit Message

thomas.mittelstaedt@bosch.com May 2, 2023, 9:49 a.m. UTC
From: mtt2hi <thomas.mittelstaedt@de.bosch.com>

The problem was, that zboot() didn't work because of missing
ramdisc size.

Signed-off-by: mtt2hi <thomas.mittelstaedt@de.bosch.com>
---
 boot/pxe_utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mittelstaedt Thomas (XC-CT/EBV3) May 2, 2023, 1:02 p.m. UTC | #1
> -----Ursprüngliche Nachricht-----
> Von: Heinrich Schuchardt <xypron.glpk@gmx.de>
> Gesendet: Dienstag, 2. Mai 2023 12:15
> An: Mittelstaedt Thomas (XC-CT/EBV3) <thomas.mittelstaedt@bosch.com>; u-
> boot@lists.denx.de
> Cc: Simon Glass <sjg@chromium.org>; Niel Armstrong
> <neil.armstrong@linaro.org>; Patrick Delaunay <patrick.delaunay@foss.st.com>;
> Ramon Fried <rfried.dev@gmail.com>; Marek Vasut <marex@denx.de>; Manuel
> Traut <manuel.traut@mt.com>; Bin Meng <bmeng.cn@gmail.com>
> Betreff: Re: [PATCH 4/4] X86: pxeboot: bugfix: Set variable for size of initrd
> 
> On 5/2/23 11:49, thomas.mittelstaedt@bosch.com wrote:
> > From: mtt2hi <thomas.mittelstaedt@de.bosch.com>
> >
> > The problem was, that zboot() didn't work because of missing ramdisc
> > size.
> 
> Can we create a test for this?

We could test it, if all would be fine. 
Atm this function seems only to be called by distroboot implementation. And this is not activated yet.

But for the first time a code walk trough seems to be more appropriate.

At line 551/552 the initrd is loaded to memory and the size is saved to variable size.
My correction at 557 stores a string representing the size to variable initrd_filesize
At line 725 initrd_filesize is set to parameters of function zboot().
So it must fail without the correction.

> 
> Best regards
> 
> Heirnich
> 
> >
> > Signed-off-by: mtt2hi <thomas.mittelstaedt@de.bosch.com>
> > ---
> >   boot/pxe_utils.c | 2 +-
> >   1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c index
> > 3a1e50f2b1..87c32b6e62 100644
> > --- a/boot/pxe_utils.c
> > +++ b/boot/pxe_utils.c
> > @@ -554,7 +554,7 @@ static int label_boot(struct pxe_context *ctx, struct
> pxe_label *label)
> >   			       label->name);
> >   			goto cleanup;
> >   		}
> > -
> > +		strcpy(initrd_filesize, simple_xtoa(size));
> >   		initrd_addr_str = env_get("ramdisk_addr_r");
> >   		size = snprintf(initrd_str, sizeof(initrd_str), "%s:%lx",
> >   				initrd_addr_str, size);
diff mbox series

Patch

diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 3a1e50f2b1..87c32b6e62 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -554,7 +554,7 @@  static int label_boot(struct pxe_context *ctx, struct pxe_label *label)
 			       label->name);
 			goto cleanup;
 		}
-
+		strcpy(initrd_filesize, simple_xtoa(size));
 		initrd_addr_str = env_get("ramdisk_addr_r");
 		size = snprintf(initrd_str, sizeof(initrd_str), "%s:%lx",
 				initrd_addr_str, size);