All of lore.kernel.org
 help / color / mirror / Atom feed
* Right MAC address to PXE boot Arndale board
@ 2013-05-01 22:13 Birin Sanchez
  2013-05-02  9:21 ` Ian Campbell
  0 siblings, 1 reply; 4+ messages in thread
From: Birin Sanchez @ 2013-05-01 22:13 UTC (permalink / raw)
  To: xen-devel

Hi Xen-devel community!!

I'm new to xen development (not new to Xen ;) ). I'm learning the Xen 
internals and playing with Xen ARM so bear with me if I say/ask 
something silly.

I have a Arndale board and following the wiki instructions for PXE boot 
here:

http://wiki.xen.org/wiki/Xen_ARMv7_with_Virtualization_Extensions/Arndale#Booting_via_PXE

I realised that generating a random MAC address won't work because the 
MAC address is hard-coded in U-Boot binary. The only MAC address that 
will work is "00:40:5c:26:0a:5b". Obviously if you modify this piece of 
code:

diff --git a/board/samsung/smdk5250/smdk5250.c 
b/board/samsung/smdk5250/smdk5250.c
index d70976d..acb31f0 100644
--- a/board/samsung/smdk5250/smdk5250.c
+++ b/board/samsung/smdk5250/smdk5250.c
@@ -226,7 +226,7 @@ int board_late_init(void)
  {
  #ifdef CONFIG_PREBOOT
         setenv("preboot", CONFIG_PREBOOT);
-       setenv("usbethaddr", "00:40:5c:26:0a:5b");
+       //setenv("usbethaddr", "00:40:5c:26:0a:5b");
  #endif
  }
  #endif

You will be able to use the random MAC generator on that page without 
any trouble.

I hope this is not something too obvious or too silly :P

Cheers,

Birin

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

* Re: Right MAC address to PXE boot Arndale board
  2013-05-01 22:13 Right MAC address to PXE boot Arndale board Birin Sanchez
@ 2013-05-02  9:21 ` Ian Campbell
  2013-05-02 11:32   ` Julien Grall
  0 siblings, 1 reply; 4+ messages in thread
From: Ian Campbell @ 2013-05-02  9:21 UTC (permalink / raw)
  To: Birin Sanchez; +Cc: Julien Grall, Anthony Perard, xen-devel@lists.xen.org

On Wed, 2013-05-01 at 23:13 +0100, Birin Sanchez wrote:
> Hi Xen-devel community!!
> 
> I'm new to xen development (not new to Xen ;) ). I'm learning the Xen 
> internals and playing with Xen ARM so bear with me if I say/ask 
> something silly.
> 
> I have a Arndale board and following the wiki instructions for PXE boot 
> here:
> 
> http://wiki.xen.org/wiki/Xen_ARMv7_with_Virtualization_Extensions/Arndale#Booting_via_PXE
> 
> I realised that generating a random MAC address won't work because the 
> MAC address is hard-coded in U-Boot binary. The only MAC address that 
> will work is "00:40:5c:26:0a:5b".

Hardcoding a MAC address in the bootloader seems to me to be obviously
wrong in the general case, however CONFIG_PREBOOT says:

        - Pre-Boot Commands:
                        CONFIG_PREBOOT
        
                        When this option is #defined, the existence of the
                        environment variable "preboot" will be checked
                        immediately before starting the CONFIG_BOOTDELAY
                        countdown and/or running the auto-boot command resp.
                        entering interactive mode.
        
                        This feature is especially useful when "preboot" is
                        automatically generated or modified. For an example
                        see the LWMON board specific code: here "preboot" is
                        modified when the user holds down a certain
                        combination of keys on the (special) keyboard when
                        booting the systems

It sounds to me like this is intended as some sort of "factory
provisioning" mode or perhaps as unbrick functionality, but it should
only be activated if certain keys are held down. e.g. picking another
random board from the u-boot source (board/manroland/mucmc52/mucmc52.c):
        #ifdef CONFIG_PREBOOT
                struct kbd_data_t kbd_data;
                /* Decode keys */
                char *str = strdup (key_match (get_keys (&kbd_data)));
                /* Set or delete definition */
                setenv ("preboot", str);
                free (str);
        #endif /* CONFIG_PREBOOT */
Other boards set it to things like "run gs_slow_boot" iff some button is
pressed.

So I think the arndale support in u-boot is simply wrong to
unconditionally set preboot=CONFIG_PREBOOT, it supposed to be
*conditionally* set to some sort of recovery command.

Likewise it is wrong to hardcode a macaddress if CONFIG_PREBOOT is set.

I notice that mainline u-boot.git[0] doesn't have this code, so I expect
it is a Linaro u-boot special. Perhaps Anthony or Julien can recommend
where the bug report should go.

[0] git://git.denx.de/u-boot.git

> Obviously if you modify this piece of code:

IMHO this change is necessary, but not the whole story...

> diff --git a/board/samsung/smdk5250/smdk5250.c 
> b/board/samsung/smdk5250/smdk5250.c
> index d70976d..acb31f0 100644
> --- a/board/samsung/smdk5250/smdk5250.c
> +++ b/board/samsung/smdk5250/smdk5250.c
> @@ -226,7 +226,7 @@ int board_late_init(void)
>   {
>   #ifdef CONFIG_PREBOOT
>          setenv("preboot", CONFIG_PREBOOT);
> -       setenv("usbethaddr", "00:40:5c:26:0a:5b");
> +       //setenv("usbethaddr", "00:40:5c:26:0a:5b");
>   #endif
>   }
>   #endif
> 
> You will be able to use the random MAC generator on that page without 
> any trouble.
> 
> I hope this is not something too obvious or too silly :P

Well, (IMHO at least) it's not *you* which is being silly ;-)

Ian.

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

* Re: Right MAC address to PXE boot Arndale board
  2013-05-02  9:21 ` Ian Campbell
@ 2013-05-02 11:32   ` Julien Grall
  2013-05-03  8:18     ` Ian Campbell
  0 siblings, 1 reply; 4+ messages in thread
From: Julien Grall @ 2013-05-02 11:32 UTC (permalink / raw)
  To: Ian Campbell, Birin Sanchez; +Cc: Anthony Perard, xen-devel@lists.xen.org

On 05/02/2013 10:21 AM, Ian Campbell wrote:

> On Wed, 2013-05-01 at 23:13 +0100, Birin Sanchez wrote:
>> Hi Xen-devel community!!


Hi birin,

>> I'm new to xen development (not new to Xen ;) ). I'm learning the
>> Xen internals and playing with Xen ARM so bear with me if I say/ask
>>  something silly.
>> 
>> I have a Arndale board and following the wiki instructions for PXE
>> boot here:
>> 
>> http://wiki.xen.org/wiki/Xen_ARMv7_with_Virtualization_Extensions/Arndale#Booting_via_PXE
>>
>>
>> 

>>MAC address is hard-coded in U-Boot binary. The only MAC address
>> that will work is "00:40:5c:26:0a:5b".
> 
> Likewise it is wrong to hardcode a macaddress if CONFIG_PREBOOT is
> set.
> 
> I notice that mainline u-boot.git[0] doesn't have this code, so I
> expect it is a Linaro u-boot special. Perhaps Anthony or Julien can
> recommend where the bug report should go.
> 
> [0] git://git.denx.de/u-boot.git


Thanks for the report. In fact, Linaro has already an updated git with a
similar patch.

https://git.linaro.org/gitweb?p=boot/u-boot-linaro-stable.git;a=commit;h=b4eb22a60d15240d280785df7948448824d86fe5

I think you can use this repository instead of the one on the wiki page.
I asked Linaro if it's possible to update the wiki page.

Cheers,

-- 
Julien

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

* Re: Right MAC address to PXE boot Arndale board
  2013-05-02 11:32   ` Julien Grall
@ 2013-05-03  8:18     ` Ian Campbell
  0 siblings, 0 replies; 4+ messages in thread
From: Ian Campbell @ 2013-05-03  8:18 UTC (permalink / raw)
  To: Julien Grall; +Cc: Anthony Perard, Birin Sanchez, xen-devel@lists.xen.org

On Thu, 2013-05-02 at 12:32 +0100, Julien Grall wrote:
> Thanks for the report. In fact, Linaro has already an updated git with a
> similar patch.
> 
> https://git.linaro.org/gitweb?p=boot/u-boot-linaro-stable.git;a=commit;h=b4eb22a60d15240d280785df7948448824d86fe5
> 
> I think you can use this repository instead of the one on the wiki page.
> I asked Linaro if it's possible to update the wiki page.

Even with that change it seems to me that the implementation of
CONFIG_PREBOOT for Arndale in that tree is broken per u-boot's
description of CONFIG_PREBOOT.

At the very least it doesn't seem like enabling CONFIG_PREBOOT in your
own builds for this board is a good idea...

Ian.

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

end of thread, other threads:[~2013-05-03  8:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-01 22:13 Right MAC address to PXE boot Arndale board Birin Sanchez
2013-05-02  9:21 ` Ian Campbell
2013-05-02 11:32   ` Julien Grall
2013-05-03  8:18     ` Ian Campbell

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.