summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorMike Westerhof <mwester@dls.net>2006-07-11 03:37:51 +0000
committerOpenEmbedded Project <openembedded-devel@lists.openembedded.org>2006-07-11 03:37:51 +0000
commitc5caa8e5bab6d22e201661d904853c3b65ea23c2 (patch)
treef2d02698254d9d619c109aa295f31cfed2d75573 /packages
parent100c0e7c388a79d1a9e159193f5387b1a6072c0f (diff)
Unslung: netconsole debugging support
Diffstat (limited to 'packages')
-rw-r--r--packages/linux/unslung-kernel/netconsole.patch51
-rw-r--r--packages/linux/unslung-kernel_2.4.22.l2.3r63.bb2
-rw-r--r--packages/meta/unslung-image.bb3
-rw-r--r--packages/nslu2-binary-only/unslung-rootfs/NOTES4
-rwxr-xr-xpackages/nslu2-binary-only/unslung-rootfs/linuxrc114
-rw-r--r--packages/nslu2-binary-only/unslung-rootfs/rc.1-timestamp.patch8
-rw-r--r--packages/nslu2-binary-only/unslung-rootfs_2.3r63.bb3
7 files changed, 118 insertions, 67 deletions
diff --git a/packages/linux/unslung-kernel/netconsole.patch b/packages/linux/unslung-kernel/netconsole.patch
index c54f4d160e..2a50f6d837 100644
--- a/packages/linux/unslung-kernel/netconsole.patch
+++ b/packages/linux/unslung-kernel/netconsole.patch
@@ -23,9 +23,9 @@ diff -Naur linux-2.4.22/drivers/net/Makefile.orig linux-2.4.22/drivers/net/Makef
# HIPPI adapters
#
diff -Naur linux-2.4.22/drivers/net/netconsole.c.orig linux-2.4.22/drivers/net/netconsole.c
---- linux-2.4.22/drivers/net/netconsole.c.orig 1969-12-31 18:00:00.000000000 -0600
-+++ linux-2.4.22/drivers/net/netconsole.c 2006-02-26 16:16:23.000000000 -0600
-@@ -0,0 +1,342 @@
+--- linux-2.4.22/drivers/net/netconsole.c.orig 2006-07-02 23:40:44.597695500 -0500
++++ linux-2.4.22/drivers/net/netconsole.c 2006-07-10 15:58:44.000000000 -0500
+@@ -0,0 +1,347 @@
+/* linux/drivers/net/netconsole.c
+ *
+ * Copyright (C) 2001 Ingo Molnar <mingo@redhat.com>
@@ -38,6 +38,7 @@ diff -Naur linux-2.4.22/drivers/net/netconsole.c.orig linux-2.4.22/drivers/net/n
+ *
+ * 2001-09-17 started by Ingo Molnar.
+ * 2006-02-26 very minor modifications to suit the NSLU2 w/Unslung -- Mike Westerhof.
++ * 2006-07-10 usability mods for Unslung (text only, and IP addrs) -- Mike Westerhof.
+ */
+
+/****************************************************************
@@ -72,11 +73,12 @@ diff -Naur linux-2.4.22/drivers/net/netconsole.c.orig linux-2.4.22/drivers/net/n
+
+static struct net_device *netconsole_dev;
+static u16 source_port, target_port;
-+static u32 source_ip, target_ip;
++static u32 source_ipaddr, target_ip, target_ipaddr;
+static unsigned char daddr[6] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff} ;
+
+#define NETCONSOLE_VERSION 0x01
-+#define HEADER_LEN 5
++/* HEADER_LEN was "5" -- it's zero for Unslung; makes it work better with netcat */
++#define HEADER_LEN 0
+
+#define MAX_UDP_CHUNK 1460
+#define MAX_PRINT_CHUNK (MAX_UDP_CHUNK-HEADER_LEN)
@@ -86,7 +88,9 @@ diff -Naur linux-2.4.22/drivers/net/netconsole.c.orig linux-2.4.22/drivers/net/n
+ * to make sure the message gets out even in
+ * extreme OOM situations.
+ */
-+#define MAX_NETCONSOLE_SKBS 32
++/* Was 32, lowered to 16 for Unslung (to save memory) */
++#define MAX_NETCONSOLE_SKBS 16
++
+
+static spinlock_t netconsole_lock = SPIN_LOCK_UNLOCKED;
+static int nr_netconsole_skbs;
@@ -162,13 +166,14 @@ diff -Naur linux-2.4.22/drivers/net/netconsole.c.orig linux-2.4.22/drivers/net/n
+
+ atomic_set(&skb->users, 1);
+ skb_reserve(skb, total_len - msg_len - HEADER_LEN);
-+ skb->data[0] = NETCONSOLE_VERSION;
-+
-+ spin_lock_irqsave(&sequence_lock, flags);
-+ put_unaligned(htonl(offset), (u32 *) (skb->data + 1));
-+ offset += msg_len;
-+ spin_unlock_irqrestore(&sequence_lock, flags);
-+
++/* Header data removed for Unslung -- its presence makes netcat less useful
++ * skb->data[0] = NETCONSOLE_VERSION;
++ *
++ * spin_lock_irqsave(&sequence_lock, flags);
++ * put_unaligned(htonl(offset), (u32 *) (skb->data + 1));
++ * offset += msg_len;
++ * spin_unlock_irqrestore(&sequence_lock, flags);
++ */
+ memcpy(skb->data + HEADER_LEN, msg, msg_len);
+ skb->len += msg_len + HEADER_LEN;
+
@@ -189,8 +194,8 @@ diff -Naur linux-2.4.22/drivers/net/netconsole.c.orig linux-2.4.22/drivers/net/n
+ iph->ttl = 64;
+ iph->protocol = IPPROTO_UDP;
+ iph->check = 0;
-+ iph->saddr = source_ip;
-+ iph->daddr = target_ip;
++ iph->saddr = source_ipaddr;
++ iph->daddr = target_ipaddr;
+ iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
+
+ eth = (struct ethhdr *) skb_push(skb, ETH_HLEN);
@@ -257,7 +262,7 @@ diff -Naur linux-2.4.22/drivers/net/netconsole.c.orig linux-2.4.22/drivers/net/n
+MODULE_AUTHOR("Ingo Molnar <mingo@redhat.com>");
+MODULE_DESCRIPTION("kernel network console implementation");
+MODULE_LICENSE("GPL");
-+MODULE_PARM(target_ip, "i");
++MODULE_PARM(target_ip, "s");
+MODULE_PARM(target_eth_byte0, "i");
+MODULE_PARM(target_eth_byte1, "i");
+MODULE_PARM(target_eth_byte2, "i");
@@ -280,7 +285,7 @@ diff -Naur linux-2.4.22/drivers/net/netconsole.c.orig linux-2.4.22/drivers/net/n
+ if (!target_port)
+ target_port = 6666;
+ if (!source_port)
-+ source_port = 6666;
++ source_port = 6665;
+ if (!dev)
+ dev = "ixp0";
+
@@ -301,13 +306,13 @@ diff -Naur linux-2.4.22/drivers/net/netconsole.c.orig linux-2.4.22/drivers/net/n
+ printk(KERN_ERR "netconsole: network device %s is not an IP protocol device, aborting.\n", dev);
+ return -1;
+ }
-+ source_ip = ntohl(in_dev->ifa_list->ifa_local);
-+ if (!source_ip) {
++ source_ipaddr = ntohl(in_dev->ifa_list->ifa_local);
++ if (!source_ipaddr) {
+ printk(KERN_ERR "netconsole: network device %s has no local address, aborting.\n", dev);
+ return -1;
+ }
-+ source_ip = htonl(source_ip);
-+#define IP(x) ((char *)&source_ip)[x]
++ source_ipaddr = htonl(source_ipaddr);
++#define IP(x) ((char *)&source_ipaddr)[x]
+ printk(KERN_INFO "netconsole: using source IP %i.%i.%i.%i\n",
+ IP(0), IP(1), IP(2), IP(3));
+#undef IP
@@ -315,8 +320,8 @@ diff -Naur linux-2.4.22/drivers/net/netconsole.c.orig linux-2.4.22/drivers/net/n
+ printk(KERN_ERR "netconsole: target_ip parameter not specified, aborting.\n");
+ return -1;
+ }
-+ target_ip = htonl(target_ip);
-+#define IP(x) ((char *)&target_ip)[x]
++ target_ipaddr = in_aton(target_ip);
++#define IP(x) ((char *)&target_ipaddr)[x]
+ printk(KERN_INFO "netconsole: using target IP %i.%i.%i.%i\n",
+ IP(0), IP(1), IP(2), IP(3));
+#undef IP
diff --git a/packages/linux/unslung-kernel_2.4.22.l2.3r63.bb b/packages/linux/unslung-kernel_2.4.22.l2.3r63.bb
index 64868d289b..6ecfd7d0f2 100644
--- a/packages/linux/unslung-kernel_2.4.22.l2.3r63.bb
+++ b/packages/linux/unslung-kernel_2.4.22.l2.3r63.bb
@@ -4,7 +4,7 @@ include nslu2-linksys-kernel_2.4.22.bb
DESCRIPTION = "Unslung kernel for the Linksys NSLU2 device"
MAINTAINER = "NSLU2 Linux <www.nlsu2-linux.org>"
-PR = "r13"
+PR = "r14"
KERNEL_SUFFIX = "unslung"
diff --git a/packages/meta/unslung-image.bb b/packages/meta/unslung-image.bb
index de27c9236a..e57960ecdb 100644
--- a/packages/meta/unslung-image.bb
+++ b/packages/meta/unslung-image.bb
@@ -1,5 +1,5 @@
LICENSE = MIT
-PR = "r16"
+PR = "r17"
IMAGE_BASENAME = "unslung"
@@ -19,6 +19,7 @@ IPKG_INSTALL = "kernel update-modules unslung-rootfs \
libc6-unslung slingbox ipkg \
cpio \
findutils \
+ kernel-module-netconsole \
${UNSLUNG_EXTRA_INSTALL}"
IMAGE_PREPROCESS_COMMAND += "unslung_clean_image; "
diff --git a/packages/nslu2-binary-only/unslung-rootfs/NOTES b/packages/nslu2-binary-only/unslung-rootfs/NOTES
index 3ff7d79d43..d6d789a858 100644
--- a/packages/nslu2-binary-only/unslung-rootfs/NOTES
+++ b/packages/nslu2-binary-only/unslung-rootfs/NOTES
@@ -535,3 +535,7 @@ Flash filesystem cleanup (regained space):
Upgraded slingbox to v1.1.3 busybox base; enabled 'more' command
(note: upgrade added 3KB in size, 'more' added 4KB in size)
+
+Added network console debugging support:
+ - patched netconsole driver, added netconsole kernel module to image
+ - updated /linuxrc (& misc files) for basic support of same
diff --git a/packages/nslu2-binary-only/unslung-rootfs/linuxrc b/packages/nslu2-binary-only/unslung-rootfs/linuxrc
index d8a0e5d06c..c12984bf1d 100755
--- a/packages/nslu2-binary-only/unslung-rootfs/linuxrc
+++ b/packages/nslu2-binary-only/unslung-rootfs/linuxrc
@@ -1,5 +1,25 @@
#!/bin/sh
+NC_SLUGIP="192.168.1.77"
+NC_TARGIP="192.168.1.100"
+
+if ( [ -f "/.nc" ] ) ; then
+ if ( [ -z "$RERUN" ] ) ; then
+ /bin/echo " DEBUG: Starting network console from flash ..."
+ . /.nc
+ /bin/echo "Insmod ixp400"
+ /sbin/insmod ixp400.o
+ /bin/echo "Insmod ixp425"
+ /sbin/insmod ixp425_eth.o
+ /sbin/ifconfig ixp0 $NC_SLUGIP
+ /bin/echo "Insmod netconsole"
+ /sbin/insmod netconsole.o target_ip=$NC_TARGIP
+ /bin/echo "Redirecting output via nc and restarting /linuxrc ..."
+ export RERUN=1
+ exec /linuxrc 2>&1 | tee /dev/console | /usr/bin/nc $NC_TARGIP 6666
+ fi
+fi
+
# **** DO NOT EVEN THINK OF EDITING OR REMOVING THIS FILE ****
# **** UNLESS YOU REALLY KNOW *EXACTLY* WHAT YOU ARE DOING. ****
@@ -8,62 +28,74 @@
/bin/mount -t proc proc /proc
-echo "1" > /proc/sys/kernel/panic
-
-/bin/echo "Sleeping while waiting for disk..."
-cnt=20
-while [ $cnt -gt 0 ] ; do
- echo -ne "\r$cnt "
- sleep 1
- [ -e /.sda1root -a -f /proc/hdd_sda ] && cnt=0
- [ -e /.sdb1root -a -f /proc/hdd_sdb ] && cnt=0
- cnt=`expr $cnt - 1`
-done
-echo
-
-sleep 5
-
-mounted=
-
-for prefroot in sda1 sdb1 ; do
- if [ -z "$mounted" -a -e /.${prefroot}root ] ; then
- if /bin/mount -rt ext3 /dev/$prefroot /mnt ; then
- if [ -e /mnt/.${prefroot}root -a -x /mnt/bin/init ] ; then
- /bin/echo "Root filesystem will be mounted from /dev/$prefroot ..."
- mounted=/mnt
- else
- /bin/umount /mnt
- /bin/echo "Can't find valid rootfs on /dev/$prefroot ..."
+/bin/echo "1" > /proc/sys/kernel/panic
+
+if ( ! [ -f /.nodisk ] ) ; then
+
+ /bin/echo "Sleeping while waiting for disk..."
+ cnt=20
+ while [ $cnt -gt 0 ] ; do
+ /bin/echo -ne "\r$cnt "
+ /bin/sleep 1
+ [ -e /.sda1root -a -f /proc/hdd_sda ] && cnt=0
+ [ -e /.sdb1root -a -f /proc/hdd_sdb ] && cnt=0
+ cnt=`expr $cnt - 1`
+ done
+ echo
+
+ /bin/sleep 5
+
+ mounted=
+
+ for prefroot in sda1 sdb1 ; do
+ if [ -z "$mounted" -a -e /.${prefroot}root ] ; then
+ if /bin/mount -rt ext3 /dev/$prefroot /mnt ; then
+ if [ -e /mnt/.${prefroot}root -a -x /mnt/bin/init ] ; then
+ /bin/echo "Root filesystem will be mounted from /dev/$prefroot ..."
+ mounted=/mnt
+ else
+ /bin/umount /mnt
+ /bin/echo "Can't find valid rootfs on /dev/$prefroot ..."
+ fi
fi
fi
+ done
+
+ if [ -z "$mounted" ] ; then
+ /bin/echo "Can't find valid rootfs, using ramdisk ..."
+ mounted=
fi
-done
-if [ -z "$mounted" ] ; then
- /bin/echo "Can't find valid rootfs, using ramdisk ..."
- mounted=
-fi
+ /bin/umount /proc
-/bin/umount /proc
+ # Pivot to the desired rootfs and run the initial executable.
-# Pivot to the desired rootfs and run the initial executable.
+ if [ -n "$mounted" ] ; then
-if [ -n "$mounted" ] ; then
+ cd $mounted
- cd $mounted
+ /bin/echo "Pivoting to external rootfs ..."
+ /sbin/pivot_root . initrd
- /bin/echo "Pivoting to external rootfs ..."
- /sbin/pivot_root . initrd
+ if ( [ -z "$RERUN" ] ) ; then
+ exec /usr/sbin/chroot . /bin/init < /dev/console 1> /dev/console 2> /dev/console
+ else
+ exec /usr/sbin/chroot . /bin/init
+ fi
+ else
- exec /usr/sbin/chroot . /bin/init < /dev/console 1> /dev/console 2> /dev/console
+ exec /bin/init
-else
+ fi
- exec /bin/init
+ /bin/echo "Can't pivot to external rootfs, using ramdisk ..."
+else
+ /bin/echo "Forced boot to internal flash ..."
+ /bin/echo "(One-time only, clearing forced boot flag file.)"
+ /bin/rm -f /.nodisk
fi
-/bin/echo "Can't pivot to external rootfs, using ramdisk ..."
exec /bin/init
# Last-resort fall-back - this should never be reached.
diff --git a/packages/nslu2-binary-only/unslung-rootfs/rc.1-timestamp.patch b/packages/nslu2-binary-only/unslung-rootfs/rc.1-timestamp.patch
new file mode 100644
index 0000000000..c0034b27ab
--- /dev/null
+++ b/packages/nslu2-binary-only/unslung-rootfs/rc.1-timestamp.patch
@@ -0,0 +1,8 @@
+--- nslu2-linksys-ramdisk-2.3r63/etc/rc.d/rc.1~ 2006-07-10 19:48:11.000000000 -0500
++++ nslu2-linksys-ramdisk-2.3r63/etc/rc.d/rc.1 2006-07-10 19:48:24.000000000 -0500
+@@ -45,3 +45,5 @@
+ /usr/bin/Set_Led ready
+ /usr/bin/Set_Led beep1
+ /bin/echo "Checking disk status :"; /usr/sbin/CheckDiskFull 2 >/dev/null
++/bin/sleep 5
++/bin/date
diff --git a/packages/nslu2-binary-only/unslung-rootfs_2.3r63.bb b/packages/nslu2-binary-only/unslung-rootfs_2.3r63.bb
index ff0172d84d..c9ec1fbdde 100644
--- a/packages/nslu2-binary-only/unslung-rootfs_2.3r63.bb
+++ b/packages/nslu2-binary-only/unslung-rootfs_2.3r63.bb
@@ -1,6 +1,6 @@
SECTION = "base"
-PR = "r13"
+PR = "r14"
DEPENDS = "nslu2-linksys-libs nslu2-linksys-sambacodepages"
@@ -20,6 +20,7 @@ SRC_URI = "http://nslu.sf.net/downloads/nslu2-linksys-ramdisk-2.3r63-2.tar.bz2 \
file://rc.optware-stop \
file://rc-diversion.patch;patch=1 \
file://rc.1-diversion.patch;patch=1 \
+ file://rc.1-timestamp.patch;patch=1 \
file://rc.crond-diversion.patch;patch=1 \
file://rc.halt-diversion.patch;patch=1 \
file://rc.local-diversion.patch;patch=1 \