All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/1] efi_loader: bootefi hello should use loadaddr
@ 2017-08-28 16:54 Heinrich Schuchardt
  2017-08-28 23:30 ` Alexander Graf
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2017-08-28 16:54 UTC (permalink / raw)
  To: u-boot

Command 'bootefi hello' currently uses CONFIG_SYS_LOAD_ADDR
as loading address.

qemu machines have by default 128 MiB RAM.
CONFIG_SYS_LOAD_ADDR for x86 is 0x20000000 (512 MiB).
This causes 'bootefi hello' to fail.

We should use the environment variable loadaddr if available.
It defaults to 0x1000000 (16 MiB) on qemu_x86.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
---
 cmd/bootefi.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/cmd/bootefi.c b/cmd/bootefi.c
index 47771f87cc..a3768158a2 100644
--- a/cmd/bootefi.c
+++ b/cmd/bootefi.c
@@ -300,7 +300,11 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
 	if (!strcmp(argv[1], "hello")) {
 		ulong size = __efi_hello_world_end - __efi_hello_world_begin;
 
-		addr = CONFIG_SYS_LOAD_ADDR;
+		saddr = env_get("loadaddr");
+		if (saddr)
+			addr = simple_strtoul(saddr, NULL, 16);
+		else
+			addr = CONFIG_SYS_LOAD_ADDR;
 		memcpy((char *)addr, __efi_hello_world_begin, size);
 	} else
 #endif
-- 
2.11.0

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

* [U-Boot] [PATCH 1/1] efi_loader: bootefi hello should use loadaddr
  2017-08-28 16:54 [U-Boot] [PATCH 1/1] efi_loader: bootefi hello should use loadaddr Heinrich Schuchardt
@ 2017-08-28 23:30 ` Alexander Graf
  2017-08-29  5:56   ` Heinrich Schuchardt
  0 siblings, 1 reply; 4+ messages in thread
From: Alexander Graf @ 2017-08-28 23:30 UTC (permalink / raw)
  To: u-boot



On 28.08.17 18:54, Heinrich Schuchardt wrote:
> Command 'bootefi hello' currently uses CONFIG_SYS_LOAD_ADDR
> as loading address.
> 
> qemu machines have by default 128 MiB RAM.
> CONFIG_SYS_LOAD_ADDR for x86 is 0x20000000 (512 MiB).
> This causes 'bootefi hello' to fail.
> 
> We should use the environment variable loadaddr if available.
> It defaults to 0x1000000 (16 MiB) on qemu_x86.
> 
> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
> ---
>   cmd/bootefi.c | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
> index 47771f87cc..a3768158a2 100644
> --- a/cmd/bootefi.c
> +++ b/cmd/bootefi.c
> @@ -300,7 +300,11 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>   	if (!strcmp(argv[1], "hello")) {
>   		ulong size = __efi_hello_world_end - __efi_hello_world_begin;
>   
> -		addr = CONFIG_SYS_LOAD_ADDR;
> +		saddr = env_get("loadaddr");
> +		if (saddr)
> +			addr = simple_strtoul(saddr, NULL, 16);
> +		else
> +			addr = CONFIG_SYS_LOAD_ADDR;

I'm not terribly happy about that logic. Ideally I would want to have it 
load to *one* explicit address, not multiple ones.

Maybe we could just always memalign() a region?

Alternatively if we can not use memalign, I would rather drop the 
CONFIG_SYS_LOAD_ADDR branch and *only* rely on loadaddr.


Alex

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

* [U-Boot] [PATCH 1/1] efi_loader: bootefi hello should use loadaddr
  2017-08-28 23:30 ` Alexander Graf
@ 2017-08-29  5:56   ` Heinrich Schuchardt
  2017-08-29 11:22     ` Alexander Graf
  0 siblings, 1 reply; 4+ messages in thread
From: Heinrich Schuchardt @ 2017-08-29  5:56 UTC (permalink / raw)
  To: u-boot

On 08/29/2017 01:30 AM, Alexander Graf wrote:
> 
> 
> On 28.08.17 18:54, Heinrich Schuchardt wrote:
>> Command 'bootefi hello' currently uses CONFIG_SYS_LOAD_ADDR
>> as loading address.
>>
>> qemu machines have by default 128 MiB RAM.
>> CONFIG_SYS_LOAD_ADDR for x86 is 0x20000000 (512 MiB).
>> This causes 'bootefi hello' to fail.
>>
>> We should use the environment variable loadaddr if available.
>> It defaults to 0x1000000 (16 MiB) on qemu_x86.
>>
>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>> ---
>>   cmd/bootefi.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
>> index 47771f87cc..a3768158a2 100644
>> --- a/cmd/bootefi.c
>> +++ b/cmd/bootefi.c
>> @@ -300,7 +300,11 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag,
>> int argc, char * const argv[])
>>       if (!strcmp(argv[1], "hello")) {
>>           ulong size = __efi_hello_world_end - __efi_hello_world_begin;
>>   -        addr = CONFIG_SYS_LOAD_ADDR;
>> +        saddr = env_get("loadaddr");
>> +        if (saddr)
>> +            addr = simple_strtoul(saddr, NULL, 16);
>> +        else
>> +            addr = CONFIG_SYS_LOAD_ADDR;
> 
> I'm not terribly happy about that logic. Ideally I would want to have it
> load to *one* explicit address, not multiple ones.
> 
> Maybe we could just always memalign() a region?
> 
> Alternatively if we can not use memalign, I would rather drop the
> CONFIG_SYS_LOAD_ADDR branch and *only* rely on loadaddr.
> 
> 
> Alex
> 

A user might have deleted loadaddr from the environment.
If we do not fallback to CONFIG_SYS_LOAD_ADDR we would have to create an
error message saying that we cannot do without loadaddr.

Shall I adjust the patch in this way?

Best regards

Heinrich

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

* [U-Boot] [PATCH 1/1] efi_loader: bootefi hello should use loadaddr
  2017-08-29  5:56   ` Heinrich Schuchardt
@ 2017-08-29 11:22     ` Alexander Graf
  0 siblings, 0 replies; 4+ messages in thread
From: Alexander Graf @ 2017-08-29 11:22 UTC (permalink / raw)
  To: u-boot

On 08/29/2017 07:56 AM, Heinrich Schuchardt wrote:
> On 08/29/2017 01:30 AM, Alexander Graf wrote:
>>
>> On 28.08.17 18:54, Heinrich Schuchardt wrote:
>>> Command 'bootefi hello' currently uses CONFIG_SYS_LOAD_ADDR
>>> as loading address.
>>>
>>> qemu machines have by default 128 MiB RAM.
>>> CONFIG_SYS_LOAD_ADDR for x86 is 0x20000000 (512 MiB).
>>> This causes 'bootefi hello' to fail.
>>>
>>> We should use the environment variable loadaddr if available.
>>> It defaults to 0x1000000 (16 MiB) on qemu_x86.
>>>
>>> Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
>>> ---
>>>    cmd/bootefi.c | 6 +++++-
>>>    1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/cmd/bootefi.c b/cmd/bootefi.c
>>> index 47771f87cc..a3768158a2 100644
>>> --- a/cmd/bootefi.c
>>> +++ b/cmd/bootefi.c
>>> @@ -300,7 +300,11 @@ static int do_bootefi(cmd_tbl_t *cmdtp, int flag,
>>> int argc, char * const argv[])
>>>        if (!strcmp(argv[1], "hello")) {
>>>            ulong size = __efi_hello_world_end - __efi_hello_world_begin;
>>>    -        addr = CONFIG_SYS_LOAD_ADDR;
>>> +        saddr = env_get("loadaddr");
>>> +        if (saddr)
>>> +            addr = simple_strtoul(saddr, NULL, 16);
>>> +        else
>>> +            addr = CONFIG_SYS_LOAD_ADDR;
>> I'm not terribly happy about that logic. Ideally I would want to have it
>> load to *one* explicit address, not multiple ones.
>>
>> Maybe we could just always memalign() a region?
>>
>> Alternatively if we can not use memalign, I would rather drop the
>> CONFIG_SYS_LOAD_ADDR branch and *only* rely on loadaddr.
>>
>>
>> Alex
>>
> A user might have deleted loadaddr from the environment.
> If we do not fallback to CONFIG_SYS_LOAD_ADDR we would have to create an
> error message saying that we cannot do without loadaddr.
>
> Shall I adjust the patch in this way?

No, let's do it the same way as booti / bootz. Just use the global 
load_addr variable.


Alex

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

end of thread, other threads:[~2017-08-29 11:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-28 16:54 [U-Boot] [PATCH 1/1] efi_loader: bootefi hello should use loadaddr Heinrich Schuchardt
2017-08-28 23:30 ` Alexander Graf
2017-08-29  5:56   ` Heinrich Schuchardt
2017-08-29 11:22     ` Alexander Graf

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.