SheevaPlug

I have install OpenWrt BARRIER BREAKER (Bleeding Edge, r40579) on the NAND memory of a SheevaPlug with success.

Hope these notes will help to explain how reproduce it.

There are a lot of advantages to put OpenWrt on a SheevaPlug NAND, for example:

  • Have a system it can be shutdown as a modem.
  • Use an external USB hard drive and spin it down for noise reduction.
  • Have fast restart of the system, very good thing for a PBX
  • Etc …

Unfortunately, there aren't any pre-built images offered for download for the SheevaPLug device.

In fact the port is simple. It just needs to regenerate a openwrt-kirkwood-uImage file after having enabled the SheevaPlug motherboard support.

What You Need To Know

  1. The jffs2-nand support file system is only available on the trunk version.
  2. The rootfs size reserved by u-boot will be too small by default.
  3. Never use /snapshots/trunk/kirkwood/uboot-kirkwood-sheevaplug/ to update your u-boot.

Preparations

Might look like a bad joke, but in fact when I started the SheevaPlug port I'd only read the Wiki documentation. All the necessary info for build it on you own devices is there.

  1. You will be using OpenWrt Buildroot for this, so read about it
  2. Pull OpenWrt Buildroot per svn/git and install its prerequisites on your system: OpenWrt Buildroot – Installation
  3. See howto use it OpenWrt Buildroot – Usage
  4. In case questions pop up, cf. OpenWrt Buildroot – Technical Reference (Work in Progress)

Debian 7 :

sudo apt-get install libncurses5-dev zlib1g-dev gawk subversion build-essential libncurses5-dev zlib1g-dev gawk git ccache gettext libssl-dev xsltproc

Note: If you simply and swiftly want to cross compile a program, see crosscompile.

Procedure

1. Pull OpenWrt Buildroot and install its dependencies

2. Pull sources for BARRIER BREAKER

cd ~
mkdir -p ~/openwrt
cd ~/openwrt
svn checkout svn://svn.openwrt.org/openwrt/trunk
cd trunk

Configure Target system

make menuconfig
  - Target System ---> Marvell Kirkwood
  - Target Profile ---> Generic (default)
  - Save and Exit
make kernel_menuconfig
System Type  ---> 
  Marvell Kirkwood Implementations  --->
   [*] Marvell eSATA SheevaPlug Reference Board
   [*] Marvell SheevaPlug Reference Board
  Target Images  ---> 
   [*] jffs2 for NAND
  Device Drivers  ---> 
   [*] USB support  --->
     <*>   Support for Host-side USB
  [*] Network device support  --->
    USB Network Adapters  --->
      <*> Multi-purpose USB Networking Framework
      <*>   CDC NCM support
      <*>   Host for RNDIS and ActiveSync devices
      <*>   QMI WWAN driver for Qualcomm MSM based 3G and LTE modems
      <*> USB-to-WWAN Driver for Sierra Wireless modems
      -*-   CDC Ethernet support (smart devices such as cable modems)
  - Save and Exit
We add feeds after have declare the System Type, then generate default configuration
./scripts/feeds update -a
./scripts/feeds install -a
make defconfig
make prereq
make oldconfig
It time to add necessay packages for can configure the SheevaPlug via Luci.

I have try many time and manything without succes, for finally found that doc http://ofmodemsandmen.com/build.html fro Ofmodedemsandmen, it describ very well the necessary for have a USB it work well with OpenWrt. That why the setting propose here is the same as Ofmodemsandmen , i haven't the require skill for make better. Appologize for that.

make menuconfig
Kernel modules  --->
  USB Support  --->
    <*> kmod-usb-acm......................... Support for modems/isdn controllers
    <*> kmod-usb-net............... Kernel modules for USB-to-Ethernet convertors
    <*> kmod-usb-net-sierrawireless.......... Support for Sierra Wireless devices
    <*> kmod-usb-ohci............................... Support for OHCI controllers
    <*> kmod-usb-serial..................... Support for USB-to-Serial converters
    <*> kmod-usb-serial-option................... Support for Option HSDPA modems
    <*> kmod-usb-serial-qualcomm................. Support for Qualcomm USB serial
    <*> kmod-usb-serial-sierrawireless....... Support for Sierra Wireless devices
    <*> kmod-usb-uhci............................... Support for UHCI controllers
    <*> kmod-usb2................................... Support for USB2 controllers
LuCI  ---> 
  1. Collections  ---> <*> luci-ssl
    -*- luci
    <*> luci-ssl......................... Standard OpenWrt set with HTTPS support
  6. Protocols  --->
    <*> luci-proto-3g............................................. Support for 3G
    <*> luci-proto-relay....................... Support for relayd pseudo bridges
  3. Applications  --->
    <*> luci-app-qos..................... Quality of Service configuration module
    <*> luci-app-ddns........................... Dynamic DNS configuration module
    <*> luci-app-ntpc.............. NTP time synchronisation configuration module
Network  --->
  <*> ppp........................................................... PPP daemon
  <*> ppp-mod-pppoe............................................... PPPoE plugin
  <*> wpad-mini............ IEEE 802.1x Authenticator/Supplicant (WPA-PSK only)
Utilities  --->
  <*> usb-modeswitch................................ USB mode switching utility
  <*> procps.................................................... proc utilities  ---> (ALL)
Base system  --->
  <*> wireless-tools.......... Tools for manipulating Linux Wireless Extensions 
- Save and Exit

Then we start the compilation

make V=s

It results in a minimally functioning system , but that probably a wrong thing to stop you work here. The better is build all others available packages as module, especially kernel-modules. That because lot of packages can depends of kernel sign. That can take days to generate all packages as opkg format, but that a good way for never have to recompile anything.

It have 512Mo Of NAND memory

It's time to save you configuration via ./scripts/env script and configure special thing. Space will be , not a problem. VPN , PBX , Tvheadend with IPTV tuner who know …

user@youhost:~/openwrt/trunk$rmdir ./env/files
user@youhost:~/openwrt/trunk$./script/env save
Initialized empty Git repository in /home/hts/openwrt/trunk/env/.git/
[master 14ece99] Update at jeudi 8 mai 2014, 21:51:48 (UTC+0200)
 1 file changed, 4045 insertions(+)
./scripts/env new sheevaplug_strongswan
Switched to a new branch 'sheevaplug_strongswan'
Do you want to start your configuration repository with the current configuration? (Y/n): y
# On branch sheevaplug_strongswan
nothing to commit (working directory clean)
user@youhost:~/openwrt/trunk$ ./scripts/env list
  master
* sheevaplug_strongswan

StrongSwan :

StrongSwan is a VPN IPV6/IPV4 Ipsec capable.

Start by enable the require StrangSwan Original source: http://wiki.strongswan.org/projects/strongswan/wiki/KernelModules

make kernel_menuconfig
Networking  --->
  [*] Networking support  --->
        Networking options  --->
          <*> Transformation user configuration interface
          <*> PF_KEY sockets
          [*] TCP/IP networking
          [*]   IP: advanced router
          [*]   IP: policy routing
          <*>   IP: AH transformation
          <*>   IP: ESP transformation
          <*>   IP: IPComp transformation
          <*>   IP: IPsec transport mode
          <*>   IP: IPsec tunnel mode
          <*>   IP: IPsec BEET mode
          <*>   The IPv6 protocol  --->
            <*>   IPv6: AH transformation
            <*>   IPv6: ESP transformation
            <*>   IPv6: IPComp transformation
            <*>   IPv6: IPsec transport mode
            <*>   IPv6: IPsec tunnel mode
            <*>   IPv6: IPsec BEET mode
            [*]   IPv6: Multiple Routing Tables
         [*] Network packet filtering framework (Netfilter)  --->
               Core Netfilter Configuration  --->
                 <*> Netfilter Xtables support (required for ip_tables)
                 <*>   IPsec "policy" match support

 Cryptographic API
   Select algorithms you want to use... ???

make menuconfig
<*> luci-proto-ipv6................. Support for DHCPv6/6in4/6to4/6rd/DS-Lite
<*> strongswan.................................................... StrongSwan
<*> strongswan-charon................... StrongSwan IKEv1/IKEv2 keying daemon
<*> strongswan-default.................................. StrongSwan (default)
<*> strongswan-mod-uci................ StrongSwan UCI config interface plugin

3. Prepare a TFTP server

Unfortunately for you I have use a TFTP server to inject both kernel and rootfs image on the SheevaPlug NAND. I use Debian 7 host for all my test, then the example is for GNU/Linux system. For other OS it should be possible, you just have to put openwrt-kirkwood-uImage and openwrt-kirkwood-generic-jffs2-nand-2048-128k.img on the "root" of you TFTP server.

apt-get install tftpd-hpa

Take a look on /etc/default/tftpd-hpa file , it should look like that:

# /etc/default/tftpd-hpa
RUN_DAEMON="yes"
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="--secure --verbose"
then
/etc/init.d/tftpd-hpa restart
[ ok ] Restarting HPA's tftpd: in.tftpd.

copy openwrt-kirkwood-uImage and openwrt-kirkwood-generic-jffs2-nand-2048-128k.img on /srv/tftp/ directory

cp ./bin/kirkwood/openwrt-kirkwood-uImage /srv/tftp/
cp ./bin/kirkwood/openwrt-kirkwood-generic-jffs2-nand-2048-128k.img /srv/tftp/

Very hard , that all

4. Deal with u-boot

You probably have to update you u-boot , you can found it here: http://people.debian.org/~tbm/u-boot/ And you should follow that doc: http://www.cyrius.com/debian/kirkwood/sheevaplug/uboot-upgrade/

Never use the u-boot file generate by OpenWrt SDK, or found on anywhere of OpenWrt, that simply break you device. Prefer Debian u-boot file.

  1. Connect the sheevaPlug MiniUSB to a USB port of you computer
  2. Open a terminal session
  3. Use screen or Minicom

screen /dev/ttyUSB0 115200

Start by creating a backup of you u-boot environment variables, by printenv and copy past the result inside you favorite text editor.

Marvell>> printenv

Unset almost every variables by use : sentenv VARIABLE_NAME '' when it's pretty clean inject it environment setting :

 setenv loadaddr '0x6400000'
 setenv console 'console=ttyS0,115200 panic=20'
 setenv bootargs_root 'root=/dev/mtdblock2 rootfstype=jffs2'
 setenv kernel_name 'openwrt-kirkwood-uImage'
 setenv rootfs_name 'openwrt-kirkwood-generic-jffs2-nand-2048-128k.img'
 setenv download_kernel 'mw $(loadaddr) 0xffff 0x300000; tftp $(loadaddr) $(kernel_name);'
 setenv flash_kernel 'nand erase 0x100000 0x400000; nand write.e $(loadaddr) 0x100000 0x400000;'
 setenv download_rootfs 'mw $(loadaddr) 0xffff 0x200000; tftp $(loadaddr) $(rootfs_name);'
 setenv flash_rootfs 'nand erase 0x500000 0xfb00000; nand write.e $(loadaddr) 0x500000 0x900000;'
 setenv load_openwrt 'setenv bootargs $(console) $(bootargs_root); nand read $(loadaddr) 0x100000 0x400000; bootm $(loadaddr)'
 setenv bootcmd 'run load_openwrt'
 saveenv
 setenv arcNumber '2097
If you have an eSATA SheevaPlug »> you have to inform u-boot «< If you have an eSATA SheevaPlug, type:
setenv machid a76
Found you ethadd and replace 'XX:XX:XX:XX:XX:XX' by you true Mac Addr, you can found with you MAC Addr on a sticker put on the back of you device
 setenv ethaddr 'XX:XX:XX:XX:XX:XX'
As you imagine you should save you setting
saveenv
If you have DHCP it inject TFTP information:
 dhcp;run download_kernel;run flash_kernel;run download_rootfs;run flash_rootfs;reset;
Else:
 setenv ipaddr '192.168.1.100'
 setenv serverip '192.168.1.10'
 run download_kernel;run flash_kernel;run download_rootfs;run flash_rootfs;reset;
where ipaddr is you IP address on you network, and serverip the TFTP server IP address on you network.

5. Frist boot

At first boot, the filesytem ill take a moment to grow the rootfs partition to MAX size, ot can be slow (5 minutes)

Troubleshooting

Download a valide u-boot from here : http://people.debian.org/~tbm/u-boot/

cd $HOME
wget http://people.debian.org/~tbm/u-boot/2013.10-2/sheevaplug/u-boot.kwb
wget http://people.debian.org/~tbm/u-boot/2013.10-2/sheevaplug/uboot.elf

Install openocd for can unbrike you SheevaPlug device.

sudo apt-get update && apt-get install openocd telnet screen

Power connect the SheevaPlug and connect the miniusb port to you computer.

Open a terminal session and initialize openocd:

#openocd -f /usr/share/openocd/scripts/board/sheevaplug.cfg -s /usr/share/openocd/scripts

Open On-Chip Debugger 0.5.0 (2011-08-09-08:45)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.berlios.de/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
2000 kHz
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain
adapter_nsrst_delay: 200
jtag_ntrst_delay: 200
dcc downloads are enabled
Warn : use 'feroceon.cpu' as target identifier, not '0'
sheevaplug_load_uboot
Info : clock speed 2000 kHz
Error: JTAG scan chain interrogation failed: all zeroes
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: feroceon.cpu: IR capture error; saw 0x00 not 0x01
Warn : Bypassing JTAG setup events due to errors
Info : Embedded ICE version 0
Info : feroceon.cpu: hardware has 1 breakpoint/watchpoint unit
Error: unexpected Feroceon EICE version signature

Download a valide u-boot.elf Copy it on you home Open a other terminal session and connect you with telnet on localhost 4444.

user@youhost:~$ telnet localhost 4444
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
>
You obtain a prompt, that the moment to inject a valid u-boot and write it on the NAND.
reset;sheevaplug_init;load_image u-boot.elf;resume 0x00600000

Now you can see Uboot starting to run "screen /dev/ttyUSB0 115200" you are ready to start restoring your plug.

Reference Documents: https://newit.co.uk/forum/index.php?topic=2835.0;wap2

Notes

I don't provide any image that because my images, don't respect default OpenWrt configuration, I have totally made my own thing, via the amazing OpenWrt SDK. It's still an OpenWrt but it's ready out of the box for my own personal usage. Here is what I have done:

 Compile natively the entire GNU Core Utilities, and not install busybox
 Compile natively NTPD
 Compile natively SSHD and not install dropbear
 Compile natively Asterisk 11 - chan_sscp-b (for Cisco support)
 Compile natively DJBDNS and not dnsmasq then not install dhcp server thing
 Compile natively StrangSwan an IPSEC thing
 Not install Luci
 Inject all my default config file, via the ./script/env and ./file/ directory

Back to top

doc/howtobuild/sheevaplug.txt · Last modified: 2014/05/09 00:11 by tuux