NSLU2-Linux
view · edit · print · history

Superceded by OpenSlug.SettingUpNetConsoleForRemoteSystemLogging

Netconsole is quite useful to see kernel-messages without having serial access to the NSLU2. Enabling it requires to modify the kernel and the ixp425_eth ethernet driver.

So, you'll have to enable the following options in your kernel-config:

 CONFIG_NETPOLL=y
 CONFIG_NETPOLL_RX=y
 CONFIG_NETPOLL_TRAP=y
 CONFIG_NET_POLL_CONTROLLER=y

 CONFIG_NETCONSOLE=m

Next, apply the following patch to ixp425_eth.c in build/tmp/work/ixp425-eth-1.1-r0. It enables the netconsole-feature in the ethernet-driver _and_ it disables the nasty irq-polling of the driver.

 --- ixp425_eth.c.orig  2005-02-16 17:56:47.000000000 +0100
 +++ ixp425_eth.c       2005-02-16 16:56:12.000000000 +0100
  -273,6 +273,11 
  extern void
  ixEthTxFrameDoneQMCallback(IxQMgrQId? qId, IxQMgrCallbackId? callbackId);

 +#ifdef CONFIG_NET_POLL_CONTROLLER
 +/* poll controller (needed for netconsole et al) */
 +static void ixp425eth_poll_controller(struct net_device *dev);
 +#endif
 +
  /* Private device data */
  typedef struct {
      unsigned int msdu_size;
  -2462,6 +2467,10 
      ndev->set_multicast_list = dev_set_multicast_list;
      ndev->flags |= IFF_MULTICAST;

 +#ifdef CONFIG_NET_POLL_CONTROLLER
 +    ndev->poll_controller = ixp425eth_poll_controller;
 +#endif
 +
      ndev->set_mac_address = dev_set_mac_address;

      memcpy(ndev->dev_addr, &default_mac_addr[priv->port_id].macAddress,
  -2491,6 +2500,23 
      return res;
  }

 +
 +#ifdef CONFIG_NET_POLL_CONTROLLER
 +/*
 + * Polling receive - used by netconsole and other diagnostic tools
 + * to allow network i/o with interrupts disabled.
 + * (stolen from 8139too.c by siddy)
 + */
 +static void ixp425eth_poll_controller(struct net_device *dev)
 +{
 +        disable_irq(dev->irq);
 +        dev_qmgr_os_isr(dev->irq, dev, NULL);
 +        enable_irq(dev->irq);
 +}
 +#endif
 +
 +
 +
  static int __devinit npe_eth_init_device(struct device *dev)
  {
      int res = -ENOMEM;
  -2675,11 +2701,12 
         * (which will trigger an interrupt for every packet) This function setup
         * the datapath in polling mode for better performances.
         */
 -
 -        if ((res = ethAcc_datapath_poll_setup()))
 -      {
 -           return res;
 -      }
 +// Disable the polling for stablility-reasons! All events will by handled by the
 +// "just-in-time-called" IRQ-handler dev_qmgr_os_isr
 +//        if ((res = ethAcc_datapath_poll_setup()))
 +//    {
 +//           return res;
 +//    }
      }

      TRACE;

Well, now just delete the compile-stamps for the kernel and the ixp425-driver, bb openslug-image, flash and boot it. ipkg install the netconsole-module and load it with some parameter "netconsole=@/,@/" or similar. Look at the kernel-documentation for more details on that parameter. And... finally you can watch your kernel-messages on UDP-port 6666 anywhere in your LAN!

view · edit · print · history · Last edited by repvik.
Originally by Siddy.
Page last modified on June 24, 2005, at 11:49 AM