Ext3 and USB Ethernet/Serial for NS-K330/OpenWRT

This post follows on from my initial experiments with running OpenWRT on the NS-K330. I briefly document adding support for Ext3-formatted USB drives (using kmod-fs-ext4), ASIX-based and DM9601-based USB-Ethernet adapters and PL2303-based USB-Serial adapters to my NS-K330.

Adding the necessary modules to the OpenWRT image

The required support is enabled by selecting the following OpenWRT modules using “make menuconfig” and then re-building your flash-resident OpenWRT images (openwrt-cns21xx-ns-k330-zImage and openwrt-cns21xx-ns-k330-root.squashfs).

– (*) block-mount (for external USB drives)
– kmod usb support for storage devices
– kmod-fs-ext4 (As of r26645, this is the module to provide ext2 & ext3 support too)
– kmod- (USB serial support for pl2303, USB ethernet for ASIX and DM9601)

The rebuild should progress without hitch. As described here, copy over the zImage and root.squashfs files and use mtd to write these to the NS-K330’s Flash. Then reboot.

Try a USB flash drive with ext3 partition

I had a 512MB USB stick lying around containing an ext3 partition (a Debian chroot tree for SnakeOS as it happened). Once plugged into USB1 it appeared as /dev/sda and the ext3 partition was /dev/sda1

  root@OpenWrt:/# ls /dev/sd*
  /dev/sda   /dev/sda1
  root@OpenWrt:/# mount /dev/sda1 /mnt
  [  199.500000] EXT4-fs (sda1): mounting ext3 file system using the ext4 subsystem
  [  199.530000] EXT4-fs (sda1): warning: checktime reached, running e2fsck is recommended
  [  199.550000] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)
  root@OpenWrt:/#
  root@OpenWrt:/# df -h
  Filesystem                Size      Used Available Use% Mounted on
     [...]
  /dev/sda1               483.7M    317.7M    141.1M  69% /mnt
  root@OpenWrt:/#
  root@OpenWrt:/# ls -al /mnt
  drwxr-xr-x    6 root     root          1024 Mar 20  2011 .
  drwxr-xr-x    1 root     root             0 Jan  1  1970 ..
  drwxr-xr-x   22 root     root          1024 Jan  1  2011 debian
  drwxr-xr-x    2 root     root          1024 Mar 20  2011 ftp
  drwx------    2 root     root         12288 Jan  1  2011 lost+found
  drwxr-xr-x    2 root     root          1024 Mar 20  2011 recovery
  -rw-r--r--    1 root     root      10240000 Jan  6  2011 test1
  root@OpenWrt:/#

Yay! Ext3 support appears basically functional.

Try my ASIX-based USB-Ethernet adaptor

Plugged the ASIX-based adaptor into USB2 on the NS-K330 (while USB1 still has 512MB USB stick in it). On the console we see:

  [  508.120000] usb 1-2: new high-speed USB device number 3 using cns21xx-ehci
  [  508.620000] asix 1-2:1.0: eth1: register 'asix' at usb-cns21xx-ehci-2, ASIX AX88772 USB 2.0 Ethernet, 00:60:6e:42:55:a3

Configure it with an unused IP address on my 10.1.1/24 LAN, and temporarily turn off (down) br-lan (which is connected to the NS-K330’s internal Ethernet port).

  root@OpenWrt:/# ifconfig eth1
  eth1      Link encap:Ethernet  HWaddr 00:60:6E:42:55:A3
	    BROADCAST MULTICAST  MTU:1500  Metric:1
	    RX packets:0 errors:0 dropped:0 overruns:0 frame:0
	    TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
	    collisions:0 txqueuelen:1000
	    RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

  root@OpenWrt:/#
  root@OpenWrt:/# ifconfig eth1 10.1.1.68 netmask 255.255.255.0
  root@OpenWrt:/# route
  Kernel IP routing table
  Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
  default         10.1.1.12       0.0.0.0         UG    0      0        0 br-lan
  10.1.1.0        *               255.255.255.0   U     0      0        0 br-lan
  10.1.1.0        *               255.255.255.0   U     0      0        0 eth1
  root@OpenWrt:/#
  root@OpenWrt:/# ifconfig br-lan down
  root@OpenWrt:/#
  root@OpenWrt:/# route
  Kernel IP routing table
  Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
  10.1.1.0        *               255.255.255.0   U     0      0        0 eth1
  root@OpenWrt:/#
  root@OpenWrt:/# ping 10.1.1.12
  PING 10.1.1.12 (10.1.1.12): 56 data bytes
  64 bytes from 10.1.1.12: seq=0 ttl=64 time=0.000 ms
  64 bytes from 10.1.1.12: seq=1 ttl=64 time=0.000 ms
  ^C
  --- 10.1.1.12 ping statistics ---
  2 packets transmitted, 2 packets received, 0% packet loss
  round-trip min/avg/max = 0.000/0.000/0.000 ms
  root@OpenWrt:/#

Cool. The ASIX-based adapter comes up as eth1 and appears capable of basic network connectivity.

Try my DM9601-based USB-Ethernet adaptor

Pull the ASIX-ethernet adapter from USB2, and plug in my DM9601-based adapter. On the console we see:

  [ 1158.510000] usb 2-2: new full-speed USB device number 2 using cns21xx-ohci
  [ 1158.970000] dm9601 2-2:1.0: eth1: register 'dm9601' at usb-cns21xx-ohci-2, Davicom DM9601 USB Ethernet, 00:e0:4c:53:44:58

Configure it with the same unused IP address on my 10.1.1/24 LAN, and leave br-lan down as for the preceding test of the ASIX-based adapter.

  root@OpenWrt:/# ifconfig eth1 10.1.1.68 netmask 255.255.255.0
  [ 1279.440000] dm9601 2-2:1.0: eth1: link up, 100Mbps, full-duplex, lpa 0xFFFF
  root@OpenWrt:/#
  root@OpenWrt:/# ifconfig eth1
  eth1      Link encap:Ethernet  HWaddr 00:E0:4C:53:44:58
	    inet addr:10.1.1.68  Bcast:10.1.1.255  Mask:255.255.255.0
	    UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
	    RX packets:15 errors:0 dropped:0 overruns:0 frame:0
	    TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
	    collisions:0 txqueuelen:1000
	    RX bytes:1522 (1.4 KiB)  TX bytes:244 (244.0 B)

  root@OpenWrt:/#
  root@OpenWrt:/#
  root@OpenWrt:/# route
  Kernel IP routing table
  Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
  10.1.1.0        *               255.255.255.0   U     0      0        0 eth1
  root@OpenWrt:/#
  root@OpenWrt:/# ping 10.1.1.12
  PING 10.1.1.12 (10.1.1.12): 56 data bytes
  64 bytes from 10.1.1.12: seq=0 ttl=64 time=0.000 ms
  64 bytes from 10.1.1.12: seq=1 ttl=64 time=0.000 ms
  ^C
  --- 10.1.1.12 ping statistics ---
  2 packets transmitted, 2 packets received, 0% packet loss
  round-trip min/avg/max = 0.000/0.000/0.000 ms
  root@OpenWrt:/#

Cool. The DM9601-based adapter comes up as eth1 and appears capable of basic network connectivity.

Try my USB-Serial adapter

Plugged in my PL2303-based USB-Serial adapter. On the console we see:

  [ 1709.560000] usb 2-1: new full-speed USB device number 3 using cns21xx-ohci
  [ 1709.840000] pl2303 2-1:1.0: pl2303 converter detected
  [ 1709.890000] usb 2-1: pl2303 converter now attached to ttyUSB0

The device appears to present us with a /dev/ttyUSB0

  root@OpenWrt:/# ls -al /dev/ttyU*
  crw-rw-rw-    1 root     root      188,   0 Dec 24 05:54 /dev/ttyUSB0
  root@OpenWrt:/#

Further tests TBD.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: