[U-Boot] [PATCH] Testing netconsole fix

Swarthout Edward L-SWARTHOU SWARTHOU at freescale.com
Thu Jan 28 23:35:05 CET 2010


From: Peter Tyser 
> Sent: Tuesday, January 26, 2010 12:44 PM
> 
> This *seemed* to work, but I'm probably overlooking something obvious.
> The other thing this patch doesn't do is ever shut down an interface, 
> eg prior to booting an OS.  I'm also not sure how it would work if 
> using multiple interfaces, eg eTSEC1 for netconsole, and eTSEC2 for 
> TFTP.

I tested some simple things and found two cases where the netconsole was
not working:

1. switching from netconsole to serial console and back to netconsole.

2. if using CONFIG_SERIAL_MULTI and CONFIG_SYS_CONSOLE_IS_ENV and
   having stdout/stdin set to nc, the netconsole never became active.
   Normally it becomes active in time to see the autoboot countdown.

For now, I will just use your getenv tip to disable the message in
tsec.c when stdin is set to nc.

Thanks,
Ed

> On Tue, 2010-01-26 at 12:37 -0600, Peter Tyser wrote:
> > ---
> >  net/eth.c |   15 ++++++++++++---
> >  net/net.c |    4 ++++
> >  2 files changed, 16 insertions(+), 3 deletions(-)
> > 
> > diff --git a/net/eth.c b/net/eth.c
> > index b650a20..9f17ac8 100644
> > --- a/net/eth.c
> > +++ b/net/eth.c
> > @@ -312,12 +312,17 @@ int eth_init(bd_t *bis)  {
> >  	int eth_number;
> >  	struct eth_device *old_current, *dev;
> > +	int netconsole_enabled = (strcmp(getenv("stdout"), "nc") == 0);
> >  
> >  	if (!eth_current) {
> >  		puts ("No ethernet found.\n");
> >  		return -1;
> >  	}
> >  
> > +	/* Don't re-init already up port when using netconsole */
> > +	if (netconsole_enabled && (eth_current->state !=
ETH_STATE_INIT))
> > +		return 0;
> > +
> >  	/* Sync environment with network devices */
> >  	eth_number = 0;
> >  	dev = eth_devices;
> > @@ -350,12 +355,16 @@ int eth_init(bd_t *bis)
> >  
> >  void eth_halt(void)
> >  {
> > +	int netconsole_enabled = (strcmp(getenv("stdout"), "nc") == 0);
> > +
> >  	if (!eth_current)
> >  		return;
> >  
> > -	eth_current->halt(eth_current);
> > -
> > -	eth_current->state = ETH_STATE_PASSIVE;
> > +	/* Don't shut down active interface if using netconsole */
> > +	if (!netconsole_enabled) {
> > +		eth_current->halt(eth_current);
> > +		eth_current->state = ETH_STATE_PASSIVE;
> > +	}
> >  }
> >  
> >  int eth_send(volatile void *packet, int length) diff --git 
> > a/net/net.c b/net/net.c index 595abd9..7f870a2 100644
> > --- a/net/net.c
> > +++ b/net/net.c
> > @@ -340,6 +340,10 @@ NetLoop(proto_t protocol)
> >  		NetArpWaitTxPacketSize = 0;
> >  	}
> >  
> > +	/*
> > +	 * Note, these hopefully won't do anything if the interface is
> > +	 * already up and we're using netconsole
> > +	 */
> >  	eth_halt();
> >  #ifdef CONFIG_NET_MULTI
> >  	eth_set_current();


More information about the U-Boot mailing list