Re: [U-Boot] [PATCH 0/3] Net Boot Controller

2010-11-17 Thread Stefano Babic
On 11/16/2010 07:04 PM, tristan.lel...@blunderer.org wrote:
 From: Tristan Lelong tristan.lel...@blunderer.org
 
 This patch allow to interrupt u-boot autoboot from remote PC and 
 auto-reconfigure a netconsole redirected to this remote PC
 
 Tristan Lelong (3):
   Add support for Net Boot Controller (NBC) packet
   Add sendnbc tool to broadcast NBC magic packet
   Add the NBC + netconsole corresponding documentation
 

Hi Tristan,

  common/main.c |5 +
  doc/README.netconsole |   66 +++
  include/net.h |6 +-
  net/Makefile  |2 +
  net/nbc.c |  143 
  net/nbc.h |   39 +
  net/net.c |   17 
  tools/Makefile|6 ++
  tools/sendnbc.c   |  219 
 +
  9 files changed, 502 insertions(+), 1 deletions(-)
  create mode 100644 doc/README.netconsole
  create mode 100644 net/nbc.c
  create mode 100644 net/nbc.h
  create mode 100644 tools/sendnbc.c

Is NBC a standard ? Could you provide a link describing this protocol ?

I am quite confuse, this seems a way to replace DHCP in a simplest form
to set up the ip address using some sort of knocking-port. As additional
feature, the

Why cannot we reach the same result using the Vendor Specific
Information (or another option field) of DHCP answer ? You can set
there some infos that the target could understand.

It seems to me that the first packet is always sent to the broadcast
address. What happens if we have two boards on the network, both waiting
in autoboot ? Do they obtain the same ip address ?

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/3] Net Boot Controller

2010-11-17 Thread Michael Zaidman
Hi Tristan,

On Tue, Nov 16, 2010 at 8:04 PM, tristan.lel...@blunderer.org wrote:

 From: Tristan Lelong tristan.lel...@blunderer.org

 This patch allow to interrupt u-boot autoboot from remote PC and 
 auto-reconfigure a netconsole redirected to this remote PC

 Tristan Lelong (3):
  Add support for Net Boot Controller (NBC) packet
  Add sendnbc tool to broadcast NBC magic packet
  Add the NBC + netconsole corresponding documentation


We usually need netconsole when serial console is not the option. The
u-boot autorun lasts for few seconds only afterwards the control is
passed to OS. That means that u-boot will be capable of NBC catching
during very sort period of time. How the user is supposed to know when
to issue the NBC packet?

It is also not clear how proposed feature will coexist with BOOTP?

In order to remotely connect to u-boot via netconsole I use the
following approach - the u-boot wakes up with serial console and after
few seconds switches to netconsole if user did not hit any key to stay
with serial console.

The code is very simple and compact.

Add to your board configuration file:

#define CONFIG_NETCONSOLE   1
#define CONFIG_PREBOOT  setenv stdout nc;setenv stderr nc;setenv stdin nc;

Override the last_stage_init() in your board .c file:

int last_stage_init(void)
{
int i, abort = 0;
int bootdelay = 2; /* Seconds */

printf(\nHit any key to stay with serial console: %2d , bootdelay);

while ((bootdelay--  0)  (!abort)) {

/* delay 100 * 10mS */
for (i=0; !abort  i100; ++i) {
if (tstc()) { /* we got a key press */
abort  = 1;
bootdelay = 0; /* no more delay */
(void)getc(); /* consume input */
setenv(preboot,echo);
break;
}
udelay(1);
}
printf(\b\b\b%2d , bootdelay);
}
putc('\n');

return 0;
}



Regards,
Michael
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/3] Net Boot Controller

2010-11-17 Thread tristan
Hi Stefano,

2010/11/17 Stefano Babic sba...@denx.de

 On 11/16/2010 07:04 PM, tristan.lel...@blunderer.org wrote:
  From: Tristan Lelong tristan.lel...@blunderer.org
 
  This patch allow to interrupt u-boot autoboot from remote PC and
 auto-reconfigure a netconsole redirected to this remote PC
 
  Tristan Lelong (3):
Add support for Net Boot Controller (NBC) packet
Add sendnbc tool to broadcast NBC magic packet
Add the NBC + netconsole corresponding documentation
 

 Hi Tristan,

   common/main.c |5 +
   doc/README.netconsole |   66 +++
   include/net.h |6 +-
   net/Makefile  |2 +
   net/nbc.c |  143 
   net/nbc.h |   39 +
   net/net.c |   17 
   tools/Makefile|6 ++
   tools/sendnbc.c   |  219
 +
   9 files changed, 502 insertions(+), 1 deletions(-)
   create mode 100644 doc/README.netconsole
   create mode 100644 net/nbc.c
   create mode 100644 net/nbc.h
   create mode 100644 tools/sendnbc.c

 Is NBC a standard ? Could you provide a link describing this protocol ?


NBC is not a standard, this is just a simple protocol I designed for this
purpose



 I am quite confuse, this seems a way to replace DHCP in a simplest form
 to set up the ip address using some sort of knocking-port. As additional
 feature, the


 Why cannot we reach the same result using the Vendor Specific
 Information (or another option field) of DHCP answer ? You can set
 there some infos that the target could understand.


I did think about using DHCP for this, but finally decided to use a new
packet format since the use is very specific and using DHCP



 It seems to me that the first packet is always sent to the broadcast
 address. What happens if we have two boards on the network, both waiting
 in autoboot ? Do they obtain the same ip address ?


All the packets are sent to the broadcast adress, so if two boards are
waiting at the same time there will be a conflict.
The way to use it in my mind is to start broadcasting with sendnbc, and then
start the board.
As the sendnbc tool will stop broadcasting right after one target answered
to the packet by sending back the u-booy prompt, the only case that can lead
to this problem is if both targets are started exactly at the same time.

Indeed there could be some potential improvement on this conflicted
situation.

Regards



 Best regards,
 Stefano Babic

 --
 =
 DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
 Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
 =




-- 
618FE3EF
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/3] Net Boot Controller

2010-11-17 Thread tristan
Hi Michael,

2010/11/17 Michael Zaidman michael.zaid...@gmail.com

 Hi Tristan,

 On Tue, Nov 16, 2010 at 8:04 PM, tristan.lel...@blunderer.org wrote:
 
  From: Tristan Lelong tristan.lel...@blunderer.org
 
  This patch allow to interrupt u-boot autoboot from remote PC and
 auto-reconfigure a netconsole redirected to this remote PC
 
  Tristan Lelong (3):
   Add support for Net Boot Controller (NBC) packet
   Add sendnbc tool to broadcast NBC magic packet
   Add the NBC + netconsole corresponding documentation
 

 We usually need netconsole when serial console is not the option. The
 u-boot autorun lasts for few seconds only afterwards the control is
 passed to OS. That means that u-boot will be capable of NBC catching
 during very sort period of time. How the user is supposed to know when
 to issue the NBC packet?


You're right, netconsole is there when the serial console is not an option.
The best example for me would be in a training class for embedded linux
(where u-boot is not the subject but only a tool to handle kernels and
rootfs), the need for several serial adapter is a real constrain that can be
avoided.

The sendnbc will broadcast in a loop NBC packets until one board answer by
sending the u-boot prompt. So, the user won't need to be aware of the right
moment to send the packets, he will just start broadcasting and then start
the board.



 It is also not clear how proposed feature will coexist with BOOTP?

 In order to remotely connect to u-boot via netconsole I use the
 following approach - the u-boot wakes up with serial console and after
 few seconds switches to netconsole if user did not hit any key to stay
 with serial console.


here, I choosed to add the wait on NBC packet after the serial console
autoboot abort feature. This is done to keep the serial console with the
higher priority and give the opportunity to skip nbc feature if a serial
console is available.



 The code is very simple and compact.

 Add to your board configuration file:

 #define CONFIG_NETCONSOLE   1
 #define CONFIG_PREBOOT  setenv stdout nc;setenv stderr nc;setenv stdin
 nc;

 Override the last_stage_init() in your board .c file:

 int last_stage_init(void)
 {
int i, abort = 0;
int bootdelay = 2; /* Seconds */

printf(\nHit any key to stay with serial console: %2d ,
 bootdelay);

while ((bootdelay--  0)  (!abort)) {

/* delay 100 * 10mS */
for (i=0; !abort  i100; ++i) {
if (tstc()) { /* we got a key press */
abort  = 1;
bootdelay = 0; /* no more delay */
(void)getc(); /* consume input */
setenv(preboot,echo);
break;
}
udelay(1);
}
printf(\b\b\b%2d , bootdelay);
}
putc('\n');

return 0;
 }



 Regards,
 Michael


Regards


-- 
618FE3EF
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/3] Net Boot Controller

2010-11-17 Thread Stefano Babic
On 11/17/2010 02:17 PM, tristan wrote:
 Is NBC a standard ? Could you provide a link describing this protocol ?
 
 
 NBC is not a standard, this is just a simple protocol I designed for
 this purpose

IMHO we should not add such as protocol to u-boot, considering that
u-boot already implements standard ways (DHCP, BOOTP) to achieve what
you want.
Your solution works only locally and you have to synchronize yourself to
send the broadcast message when you reset the board. DHCP works in anyway.

Michael sent an example how to switch the console to NetConsole. Is it
not suitable for you ? You could add the dhcp command to the preboot
variable if you need to obtain an IP address after a reset.

 I did think about using DHCP for this, but finally decided to use a new
 packet format since the use is very specific and using DHCP 

Not really, Your protocol is a way to set the IP address, after that you
switch the console. Providing network addresses is exactly the DHCP's job.

 All the packets are sent to the broadcast adress, so if two boards are
 waiting at the same time there will be a conflict. 

This is not good...

 The way to use it in my mind is to start broadcasting with sendnbc, and
 then start the board.
 As the sendnbc tool will stop broadcasting right after one target
 answered to the packet by sending back the u-booy prompt, the only case
 that can lead to this problem is if both targets are started exactly at
 the same time.

It not so uncommon to have a lot of boards connected to the same
network. If all of them support your protocol, we get in big trouble.

Best regards,
Stefano Babic

-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: off...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/3] Net Boot Controller

2010-11-17 Thread Wolfgang Denk
Dear tristan,

In message aanlkti=01bccmnbenot6ojcstvfazpxx+azpqkxk3...@mail.gmail.com you 
wrote:

  Is NBC a standard ? Could you provide a link describing this protocol ?
 
 NBC is not a standard, this is just a simple protocol I designed for this
 purpose

Sorry, but in this case, and considering all the othe rproblems
pointed out by Stefano, please maintain this code out of tree. We
will not add this to mainline.

NAK for all three patches.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
No problem is insoluble.
-- Dr. Janet Wallace, The Deadly Years, stardate 3479.4
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/3] Net Boot Controller

2010-11-17 Thread tristan
Thank you for your time. As I understand, there are some ways to achieve
almost the same feature using only the preboot command.
I'll take a closer look at it.

Regards

2010/11/17 Wolfgang Denk w...@denx.de

 Dear tristan,

 In message 
 aanlkti=01bccmnbenot6ojcstvfazpxx+azpqkxk3...@mail.gmail.com01bccmnbenot6ojcstvfazpxx%2bazpqkxk3...@mail.gmail.com
 you wrote:
 
   Is NBC a standard ? Could you provide a link describing this protocol ?
 
  NBC is not a standard, this is just a simple protocol I designed for this
  purpose

 Sorry, but in this case, and considering all the othe rproblems
 pointed out by Stefano, please maintain this code out of tree. We
 will not add this to mainline.

 NAK for all three patches.

 Best regards,

 Wolfgang Denk

 --
 DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
 HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
 Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
 No problem is insoluble.
-- Dr. Janet Wallace, The Deadly Years, stardate 3479.4




-- 
618FE3EF
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot