public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] cmd: set filesize variable in ubi read
@ 2017-08-30 16:38 Holger Dengler
  2017-08-31  7:25 ` Heiko Schocher
  2017-09-12  7:58 ` [U-Boot] [PATCH v1] " Holger Dengler
  0 siblings, 2 replies; 7+ messages in thread
From: Holger Dengler @ 2017-08-30 16:38 UTC (permalink / raw)
  To: u-boot

After a successful read of a UBI volume, the variable filesize is set
to the number of read bytes. To boot linux with a raw initramfs/initrd,
you must specify the exact size of the initramfs/initrd image in boot
command. If the initramfs/inird is read from UBI volume, $filesize is
required to access the number of read bytes.

Example:
  ubi read ${loadaddr} kernelvol
  ubi read ${fdtaddr} dtbvol
  ubi read ${initrd_addr} initrdvol
  bootz ${loadaddr} ${initrd_addr}:${filesize} ${fdt_addr}

Signed-off-by: Holger Dengler <dengler@linutronix.de>
---
 cmd/ubi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/cmd/ubi.c b/cmd/ubi.c
index 222be5a357..c49c7f94df 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -334,6 +334,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
 	unsigned long long tmp;
 	struct ubi_volume *vol;
 	loff_t offp = 0;
+	size_t len_read;
 
 	vol = ubi_find_volume(volume);
 	if (vol == NULL)
@@ -373,6 +374,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
 	tmp = offp;
 	off = do_div(tmp, vol->usable_leb_size);
 	lnum = tmp;
+	len_read = size;
 	do {
 		if (off + len >= vol->usable_leb_size)
 			len = vol->usable_leb_size - off;
@@ -398,6 +400,9 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
 		len = size > tbuf_size ? tbuf_size : size;
 	} while (size);
 
+	if (!size)
+		setenv_hex("filesize", len_read);
+
 	free(tbuf);
 	return err;
 }
-- 
2.14.1

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

* [U-Boot] [PATCH] cmd: set filesize variable in ubi read
  2017-08-30 16:38 [U-Boot] [PATCH] cmd: set filesize variable in ubi read Holger Dengler
@ 2017-08-31  7:25 ` Heiko Schocher
  2017-09-12  7:35   ` Heiko Schocher
  2017-09-12  7:58 ` [U-Boot] [PATCH v1] " Holger Dengler
  1 sibling, 1 reply; 7+ messages in thread
From: Heiko Schocher @ 2017-08-31  7:25 UTC (permalink / raw)
  To: u-boot

Hello Holger,

Am 30.08.2017 um 18:38 schrieb Holger Dengler:
> After a successful read of a UBI volume, the variable filesize is set
> to the number of read bytes. To boot linux with a raw initramfs/initrd,
> you must specify the exact size of the initramfs/initrd image in boot
> command. If the initramfs/inird is read from UBI volume, $filesize is
> required to access the number of read bytes.
>
> Example:
>    ubi read ${loadaddr} kernelvol
>    ubi read ${fdtaddr} dtbvol
>    ubi read ${initrd_addr} initrdvol
>    bootz ${loadaddr} ${initrd_addr}:${filesize} ${fdt_addr}
>
> Signed-off-by: Holger Dengler <dengler@linutronix.de>
> ---
>   cmd/ubi.c | 5 +++++
>   1 file changed, 5 insertions(+)

Thanks!

Reviewed-by: Heiko Schocher <hs@denx.de>

As new release is near, I pickup this patch when the next merge window
opens.

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

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

* [U-Boot] [PATCH] cmd: set filesize variable in ubi read
  2017-08-31  7:25 ` Heiko Schocher
@ 2017-09-12  7:35   ` Heiko Schocher
  2017-09-12  7:45     ` Holger Dengler
  0 siblings, 1 reply; 7+ messages in thread
From: Heiko Schocher @ 2017-09-12  7:35 UTC (permalink / raw)
  To: u-boot

Hello Holger,

Am 31.08.2017 um 09:25 schrieb Heiko Schocher:
> Hello Holger,
>
> Am 30.08.2017 um 18:38 schrieb Holger Dengler:
>> After a successful read of a UBI volume, the variable filesize is set
>> to the number of read bytes. To boot linux with a raw initramfs/initrd,
>> you must specify the exact size of the initramfs/initrd image in boot
>> command. If the initramfs/inird is read from UBI volume, $filesize is
>> required to access the number of read bytes.
>>
>> Example:
>>    ubi read ${loadaddr} kernelvol
>>    ubi read ${fdtaddr} dtbvol
>>    ubi read ${initrd_addr} initrdvol
>>    bootz ${loadaddr} ${initrd_addr}:${filesize} ${fdt_addr}
>>
>> Signed-off-by: Holger Dengler <dengler@linutronix.de>
>> ---
>>   cmd/ubi.c | 5 +++++
>>   1 file changed, 5 insertions(+)
>
> Thanks!
>
> Reviewed-by: Heiko Schocher <hs@denx.de>
>
> As new release is near, I pickup this patch when the next merge window
> opens.

Just tried a travis build, and it breaks a lot of boards, see

https://travis-ci.org/hsdenx/u-boot-ubi/builds/274457374

Do you have time to look into?

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de

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

* [U-Boot] [PATCH] cmd: set filesize variable in ubi read
  2017-09-12  7:35   ` Heiko Schocher
@ 2017-09-12  7:45     ` Holger Dengler
  0 siblings, 0 replies; 7+ messages in thread
From: Holger Dengler @ 2017-09-12  7:45 UTC (permalink / raw)
  To: u-boot

Hi Heiko,

sorry, my fault. I missed, that the function has been renamed. I'll resend the patch.

On 09/12/2017 09:35 AM, Heiko Schocher wrote:
> Hello Holger,
> 
> Am 31.08.2017 um 09:25 schrieb Heiko Schocher:
>> Hello Holger,
>>
>> Am 30.08.2017 um 18:38 schrieb Holger Dengler:
>>> After a successful read of a UBI volume, the variable filesize is set
>>> to the number of read bytes. To boot linux with a raw initramfs/initrd,
>>> you must specify the exact size of the initramfs/initrd image in boot
>>> command. If the initramfs/inird is read from UBI volume, $filesize is
>>> required to access the number of read bytes.
>>>
>>> Example:
>>>    ubi read ${loadaddr} kernelvol
>>>    ubi read ${fdtaddr} dtbvol
>>>    ubi read ${initrd_addr} initrdvol
>>>    bootz ${loadaddr} ${initrd_addr}:${filesize} ${fdt_addr}
>>>
>>> Signed-off-by: Holger Dengler <dengler@linutronix.de>
>>> ---
>>>   cmd/ubi.c | 5 +++++
>>>   1 file changed, 5 insertions(+)
>>
>> Thanks!
>>
>> Reviewed-by: Heiko Schocher <hs@denx.de>
>>
>> As new release is near, I pickup this patch when the next merge window
>> opens.
> 
> Just tried a travis build, and it breaks a lot of boards, see
> 
> https://travis-ci.org/hsdenx/u-boot-ubi/builds/274457374
> 
> Do you have time to look into?
> 
> bye,
> Heiko

-- 
Gruß,
Holger Dengler
--
phone: +49 7556 25 999 14; fax: +49 7556 25 999 99

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170912/f0d272ef/attachment.sig>

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

* [U-Boot] [PATCH v1] cmd: set filesize variable in ubi read
  2017-08-30 16:38 [U-Boot] [PATCH] cmd: set filesize variable in ubi read Holger Dengler
  2017-08-31  7:25 ` Heiko Schocher
@ 2017-09-12  7:58 ` Holger Dengler
  2017-09-12  8:21   ` Heiko Schocher
  2017-09-15  5:49   ` Heiko Schocher
  1 sibling, 2 replies; 7+ messages in thread
From: Holger Dengler @ 2017-09-12  7:58 UTC (permalink / raw)
  To: u-boot

After a successful read of a UBI volume, the variable filesize is set
to the number of read bytes. To boot linux with a raw initramfs/initrd,
you must specify the exact size of the initramfs/initrd image in boot
command. If the initramfs/inird is read from UBI volume, $filesize is
required to access the number of read bytes.

Example:
  ubi read ${loadaddr} kernelvol
  ubi read ${fdtaddr} dtbvol
  ubi read ${initrd_addr} initrdvol
  bootz ${loadaddr} ${initrd_addr}:${filesize} ${fdt_addr}

Signed-off-by: Holger Dengler <dengler@linutronix.de>
---
 cmd/ubi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/cmd/ubi.c b/cmd/ubi.c
index 222be5a357..ac9a582437 100644
--- a/cmd/ubi.c
+++ b/cmd/ubi.c
@@ -334,6 +334,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
 	unsigned long long tmp;
 	struct ubi_volume *vol;
 	loff_t offp = 0;
+	size_t len_read;
 
 	vol = ubi_find_volume(volume);
 	if (vol == NULL)
@@ -373,6 +374,7 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
 	tmp = offp;
 	off = do_div(tmp, vol->usable_leb_size);
 	lnum = tmp;
+	len_read = size;
 	do {
 		if (off + len >= vol->usable_leb_size)
 			len = vol->usable_leb_size - off;
@@ -398,6 +400,9 @@ int ubi_volume_read(char *volume, char *buf, size_t size)
 		len = size > tbuf_size ? tbuf_size : size;
 	} while (size);
 
+	if (!size)
+		env_set_hex("filesize", len_read);
+
 	free(tbuf);
 	return err;
 }
-- 
2.14.1

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

* [U-Boot] [PATCH v1] cmd: set filesize variable in ubi read
  2017-09-12  7:58 ` [U-Boot] [PATCH v1] " Holger Dengler
@ 2017-09-12  8:21   ` Heiko Schocher
  2017-09-15  5:49   ` Heiko Schocher
  1 sibling, 0 replies; 7+ messages in thread
From: Heiko Schocher @ 2017-09-12  8:21 UTC (permalink / raw)
  To: u-boot

Hello Holger,

thanks for the fast fix! Hm... some nitpick:

This is v2 not v1 ... seems patchwork has a problem, as your patch
does not popup at:
http://patchwork.ozlabs.org/project/uboot/list/?page=1

(or patchwork does work slowly today ...)

Am 12.09.2017 um 09:58 schrieb Holger Dengler:
> After a successful read of a UBI volume, the variable filesize is set
> to the number of read bytes. To boot linux with a raw initramfs/initrd,
> you must specify the exact size of the initramfs/initrd image in boot
> command. If the initramfs/inird is read from UBI volume, $filesize is
> required to access the number of read bytes.
>
> Example:
>    ubi read ${loadaddr} kernelvol
>    ubi read ${fdtaddr} dtbvol
>    ubi read ${initrd_addr} initrdvol
>    bootz ${loadaddr} ${initrd_addr}:${filesize} ${fdt_addr}
>
> Signed-off-by: Holger Dengler <dengler@linutronix.de>
> ---

add here please a summary, what has changed since v1. You may
use patman ... see u-boot:tools/patman/README

Thanks!

Nevertheless, I started a new travis build with this patch, see:
https://travis-ci.org/hsdenx/u-boot-ubi/builds/274502903

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de

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

* [U-Boot] [PATCH v1] cmd: set filesize variable in ubi read
  2017-09-12  7:58 ` [U-Boot] [PATCH v1] " Holger Dengler
  2017-09-12  8:21   ` Heiko Schocher
@ 2017-09-15  5:49   ` Heiko Schocher
  1 sibling, 0 replies; 7+ messages in thread
From: Heiko Schocher @ 2017-09-15  5:49 UTC (permalink / raw)
  To: u-boot

Hello Holger,

Am 12.09.2017 um 09:58 schrieb Holger Dengler:
> After a successful read of a UBI volume, the variable filesize is set
> to the number of read bytes. To boot linux with a raw initramfs/initrd,
> you must specify the exact size of the initramfs/initrd image in boot
> command. If the initramfs/inird is read from UBI volume, $filesize is
> required to access the number of read bytes.
>
> Example:
>    ubi read ${loadaddr} kernelvol
>    ubi read ${fdtaddr} dtbvol
>    ubi read ${initrd_addr} initrdvol
>    bootz ${loadaddr} ${initrd_addr}:${filesize} ${fdt_addr}
>
> Signed-off-by: Holger Dengler <dengler@linutronix.de>
> ---
>   cmd/ubi.c | 5 +++++
>   1 file changed, 5 insertions(+)

Applied to u-boot-ubi.git

Thanks!

bye,
Heiko
-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: hs at denx.de

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

end of thread, other threads:[~2017-09-15  5:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-30 16:38 [U-Boot] [PATCH] cmd: set filesize variable in ubi read Holger Dengler
2017-08-31  7:25 ` Heiko Schocher
2017-09-12  7:35   ` Heiko Schocher
2017-09-12  7:45     ` Holger Dengler
2017-09-12  7:58 ` [U-Boot] [PATCH v1] " Holger Dengler
2017-09-12  8:21   ` Heiko Schocher
2017-09-15  5:49   ` Heiko Schocher

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