NSLU2-Linux
view · edit · print · history

Plug Computers Project Page

(Please be aware that you are responsible for any damage to your hardware, software, or files, so use extreme caution when following guides/instructons on this site. NO warranty is explicitly or implicitly provided. It is assumed that you know what you are doing and if not, get assistance from somebody that does, or do not perform the installation.)

Please read the installation page about verifying which version of Busybox is on your system. This will determine whether you follow the Standard/Marvell Kirkwood installation or the Pogoplug Pro/PLX OXNAS installation.

Upgrading Packages

A lot of packages are getting upgraded. You might want to upgrade everything by:

 "ipkg update"

 "ipkg upgrade"

If you do not want your setup overwritten, follow the prompts. Probably would be a good idea to make back ups before. If you have enough disk space, whenever I install a package I also download the actual .ipk package from http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/ so that if I have problems with the new version, I have the option of reloading the old version. Here is a link to the Packages information, just like the one you get with "ipkg info" but it contains "all" the packages - http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable/Packages.

Remember, to see ipkg options, just type "ipkg".

Setting the ipkg repository

For users of Pogoplugs (V1, V2, Pogoplug Pro/Video/V3(P21) (see installation about wget) and Biz) and Dockstars/GoFlex who are running Optware ( defunct OpenPogo ), and want to install more software. You can directly link to the original repository by changing the source. To do this:

A. Change to the ipkg configuration directory

 cd /opt/etc/ipkg

B. Check the name of the conf file

 ls

C. Should see some filename with .conf in the ending, then edit this file

 vi or nano filename.conf (probably armel-feed.conf)

D. Comment out current repo

  "src cross http://openpogo.com/repo" to "#src cross http://openpogo.com/repo"

E. Then add the new repo underneath

 src cross http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/stable

F. Exit from your editor, then reboot your system

 sync
sync
reboot

G. Once rebooted, log back in to your system and do an update

 ipkg update

At this point you are now linked to the main repository and can update packages. If you feel brave enough and have backed up everything, you can do an ipkg upgrade, and follow the prompts. You may need to check /opt/etc/ipkg.conf to see if there is also a reference to the openpogo repo and change that to the nslu2 optware repository.

Miscellaneous Package Information

To see how to set up some packages, you can go back to the Packages page. Suggested packages to install to improve your Linux experience are "procps", "psmisc", and "coreutils" (see installation page for Pro). To actually get these packages working, you need to modify your PATH. There are two ways, probably doing both would cover all circumstances. One is to modify you "/etc/profile" if you have one so:

 "mount -o rw,remount /"
"cd /etc"
"vi or nano profile"

"#!/bin/bash"
"#"
"alias ls='ls --color=auto'"
"PS1='[\u@\h \W]\$ '"
"export PATH=/opt/bin:/opt/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/opt/lib"

"mount -o ro,remount /"

Then reboot your system. The second is to modify your .bash_profile in your home directory:

 "PS1='[\u@\h \W]\$ '"
"export TERM=linux-lat"
"export PATH=/opt/bin:/opt/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/opt/lib"
"alias ls='ls --color=auto'"

Then log out and then log in again. In both cases make sure your "/opt" subdirectories are first so that the new utilities will overide the original. Modify the PATH to what is appropriate for your system if you have installed other packages.

Added instructions for the plugs on how to install FreePBX and Asterisk on the Asterisk Howto (towards the bottom of the page).

Added instructions for the plugs on how to install Samba2 with Swat at the bottom of their respective pages.

If you are having problems with Samba2, then Samba3 would be a better option (volume space reporting errors). Here is a page with a guide to convert from Samba2 to Samba3.

Added instructions for the plugs on how to set up a web server by installing LLMP (Linux, Lighttpd, MySQL, and PHP) instead of LAMP. Lighttpd was chosen due to it's combination of being lightweight but still powerful. To access your website externally, you may want to set up a dynamic dns updater. Here is a comparison of various Web Servers available in Optware. You can also set up a reverse proxy.

If you want to compare UPnP media servers for Optware, a table is provided at "UPnP servers compares".

To set up other programs such as BitTorrent, Tor server and other packages, please see additional Optware Plug setups.

To set up a new installation of Optware on Pogoplug/Dockstar then see Optware installation. You can perform a quick install with files from http://tech.groups.yahoo.com/group/nslu2-general/files/Plug%20Files/ if you know Linux (Use at your own risk, as-is no warranty, read the readme.txt).

There are some great articles concerning Pogoplug Projects such as Seongbae's Random Thoughts on ... Nearly Anything - Turning Pogoplug into a Time Machine.

 "http://seongbae.blogspot.com/2009/09/turning-pogoplug-into-timemachine.html"

This article plus the existing articles in the Time Machine Backups How To are great guides in the setup of a Pogoplug Pro Time Machine, but could also work for other Plug Platforms or the NSLU2 et al. If you want to set up AFP it is also a good guide and seems to be faster than Samba.

Building Repository Packages

If you would like to see about making/building the repository packages, you can do this on a desktop or on your plug computer. Install the Optware development package "ipkg install optware-devel" (this will install autoconf , automake , bash , bison , bzip2 , coreutils , diffutils , file , findutils , flex , gawk , groff , gzip , libstdc++ , libtool , make , m4 , ncurses , openssl , patch , perl , pkgconfig , python25 , rsync , sed , svn , tar , tcl , wget-ssl , binutils , libc-dev , gcc). Warning: wget-ssl in optware-devel might be missing a dependency - libidn, so before installing optware-devel, do "ipkg install libidn". Go to the subdirectory that you will use for making packages and then type:

 "svn co http://svn.nslu2-linux.org/svnroot/optware/trunk optware"

This will make an optware subdirectory and download the build packages. Then, go into the optware subdirectory and type "make sheevaplug-target". On the desktop, this could take some time because it will download the toolchain. Then, type "cd sheevaplug" to get into the sheevaplug directory. Then type "make directories toolchain ipkg-utils". If you want to make a package, type "make packagename", and to create the ipkg, type "make packagename-ipk". There might be some errors if you have not installed some base packages but you can install them at that point and make again. More details are at Add a package to optware.

Cross Compiling

If you want to cross-compile on the desktop, outside of the packages, you will need a Linux environment. If you are using windows, you can use virtualbox or some other virtualization software to set up a Linux environment. Then you can set up a CodeSourcery environment by borrowing a script from NAS central:

   "http://general.nas-central.org/wiki/Setting_up_the_codesourcery_toolchain_for_X86_to_ARM9_cross_compiling"
  or "http://ftp.maddes.net/hardware/Linkstation/setup_codesourcery.sh"

and modifying the script for arm-2008q1 (originally for V2 and earlier use this, unless CE updates this also, for later see below):

   "http://www.codesourcery.com/sgpp/lite/arm/portal/package2549/public/
    arm-none-linux-gnueabi/arm-2008q1-126-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2".

If this location changes just look for Sourcery G++ Lite 2008q1-126 for ARM GNU/Linux package on CodeSourcery site.

Building the kernel and modules

You can also download and recompile the kernel by going to the pogoplug.com site (thank you cloudengines), under Developers/Open Source. Get the address of the kernel e.g.

  "http://download.pogoplug.com/opensource/pogoplug-linux-2.6.22.18.tar.bz2".

Use "wget" to download this file. Install this archive with "tar xjvf". Then go into the kernel subdirectory and type

 "cp pogoplug_kernel.config linux-2.6.22.18/.config".

Then change directory to the linux subdirectory "cd linux-2.6.22.18". If you are using the plug computer as your development platform, you need to make a simple alteration to the Makefile. Edit the makefile and there are 4 lines to modify:

  #ARCH           ?= $(SUBARCH)
#CROSS_COMPILE ?=
ARCH ?= arm
CROSS_COMPILE=arm-none-linux-gnueabi-

to

  ARCH            ?= $(SUBARCH)
CROSS_COMPILE ?=
#ARCH ?= arm
#CROSS_COMPILE=arm-none-linux-gnueabi-

Addendum:
If you have upgraded "make" to 3.82, this will cause some errors due to the parser being "tightened up".
Some lines need to be changed in the Makefile:

 config %config: scripts_basic outputmakefile FORCE
 to
       %config: scripts_basic outputmakefile FORCE
 and
 / %/: prepare scripts FORCE
 to
   %/: prepare scripts FORCE

I believe the lines are around 391 and 1445 respectively.

Needless to say if you are cross-compiling, do not modify the file (see Addendum). Now, you can type "make menuconfig" which will create the menu configuration for the kernel and can make modifications. You can for example, enable cifs support to be able to mount windows partitions to your plug computer. Then type "make". You can use "find . -name cifs.ko" to find the module, and then install the module using "insmod cifs.ko". You do not have to install the new kernel per se. You can then try

 "mount -t cifs //servername/share -o username=myusername,password=mypassword /tmp/somemountname".

The Pogoplug Pro/Video/V3(P21)/B0Xs/OXNAS Kernel requires toolchain arm-2008q3 or newer. Download the sourcecode:

 "http://download.pogoplug.com/opensource/pro/pogopro-linux-2.6.31.6.tar.bz2"
or
"http://download.pogoplug.com/opensource/pro/pogopro-linux-2.6.31.6-r2.tar.bz2"
"tar xjvf" to extract the source.
Then go into the resulting source directory and type "cp ../pogopro_kernel_config ./.config" or "cp ./.config.old ./.config", then "make menuconfig". Make your selections (Turn on PCI for Pros and Videos, Off for B0Xs since they do not have PCI capabilities). Exit and type "make".
This will allow you to make modules such as those needed for video capture, V4L, webcams, arduino, etc....

Building Busybox

You can also download the source code for busybox from the Pogoplug developer's site: http://download.pogoplug.com/opensource/pro/busybox-1.16.1.tar.bz2

Just untar it and use "make menuconfig" to modify it to your needs (you can probably find the renamed .config that Cloud Engines used). You can use this to enable, for example mdev, pivot root, and add more functions to utilities such as wget.

TIME

To get the time zone (Pacific Time will be used as an example).

 "mount -o rw,remount /"
"ipkg install psmisc"
"ipkg install tz"
"ln -s /opt/share/zoneinfo /usr/share/zoneinfo"
"ln -s /usr/share/zoneinfo/PST8PDT /etc/localtime"
"mount -o ro,remount /"

To get a list of time zones:

 "ls /opt/share/zoneinfo"

For the US: Pacific - PST8PDT, Mountain - MST7MDT, Central - CST6CDT, Eastern - EST5EDT.
To Install the NTP daemon in order to set time on startup and continously:

 "mount -o rw,remount /"
"ipkg install ntp"
"cd /opt/etc/init.d"
Edit the S77ntp script to add -g so that there will be an initial time setting (you can also add ntpdate if you are really paranoid like me): ##################### Start of Script ###################
#!/bin/sh if [ -n "`/opt/bin/pidof ntpd`" ]; then /usr/bin/killall ntpd 2>/dev/null fi if [ ! -d /var/spool/ntp ] ; then mkdir -p /var/spool/ntp fi /opt/bin/ntpdate -u pool.ntp.org /opt/bin/ntpd -g -c /opt/etc/ntp/ntp.conf -f /var/spool/ntp/ntp.drift -s /var/spool/ntp -k /opt/etc/ntp -l /var/spool/ntp/ntp.log ##################### End of Script ###################
Add S77ntp to your /etc/init.d/rcS.
"mount -o ro,remount /"
"sync"
"sync"
"reboot"

You can edit "/opt/etc/ntp/ntp.conf" to set your servers and settings.

Since most of the Pogoplug derivatives do not have a real time clock, there have been several articles to add RTC, mostly to Dockstars (use Google Translate if you need to):

 "http://www.mikrocontroller.net/articles/Dockstar#RTC_nachr.C3.BCsten" German.

"http://plugapps.com/forum/viewtopic.php?f=6&t=258&start=10" English.

"http://gsg-elektronik.de/?id=92" German using a capacitor instead of Battery.

Even better and simpler, add a GPS USB dongle and install gpsd "ipkg install gpsd" then "gpsd -n /dev/ttyUSB0". Make sure you do this after making the root filesystem writeable with "mount -o rw,remount /". You will probably need to add some kernel modules (usbserial.ko, garmin_gps.ko, pl2303.ko, etc.) depending on what dongle you use (see above how to build kernel modules). You then need to set up the serial device ttyUSB0:

Create a uucp user and group. In your /etc/passwd, there should be an entry like "uucp:x:503:503:Linux User,,,:/home/uucp:/bin/sh" and in /etc/group, like "uucp:x:503:". The UID and GID can be different from 503 if it is already in use. then you can type:

 "mknod /dev/ttyUSB0 c 188 0"
 "chmod 0660 /dev/ttyUSB0"
 "chgrp uucp /dev/ttyUSB0"

Check your installation with "dmesg" and "more /proc/devices". Make sure your dongle is in binary mode (google this). Verify gpsd with "gpsd -n -N -D2 /dev/ttyUSB0". Change "-D" debug level as needed. You can test with "cgps", or if it is a SIRF dongle "sirfmon".

You can then add the GPS server lines "127.127.28.0" to your /opt/etc/ntp/ntp.conf:

#Default conf file for ntpd

driftfile /var/spool/ntp/ntp.drift

tinker panic 0

tos mindist 0.050

server 127.127.28.0 minpoll 4 maxpoll 4 prefer
fudge 127.127.28.0 time1 0.796 refid GPS

server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org

Adjust time1 offset to match your system.

You can create a start file "/opt/etc/init.d/S75gpsd" with the contents:

#!/bin/sh

if [ -n "`pidof gpsd`" ]; then 
    /usr/bin/killall gpsd 2>/dev/null
fi

/opt/sbin/gpsd -n /dev/ttyUSB0
/bin/sleep 1

Place the start file call before the one for ntpd in your /etc/init.d/rcS or /etc/init.d/mount_optextX and adjust sleep delay for your system. Now your plug not only should keep time correctly, but can function as a local time server. Check function with "ntpq -p" and make adjustments as needed. Good references on the internet are "http://gpsd.berlios.de/", "http://www.lammertbies.nl/comm/info/GPS-time.html", and "http://www.meinberg.de/english/info/ntp.htm". Just remember that the USB interface has no mechanism to transfer a pulse signal so no PPS. Make sure after making your modifications to make the root filesystem read only with "mount -o ro,remount /" or reboot the system.

Setting up Syslogd

On non-Pro versions, you can use the native busybox syslogd. The busybox syslogd performs it's own log rogrotation. The messages are kept in /tmp so they dissappear when the system is rebooted and do not cause wear if you are using a flash drive. For the Pro, you can replace its busybox with the same as the other plugs (copy from another plug or compile from the pogoplug.com-Developer's section) or install Syslog-ng. You can create the script S11syslogd (Be sure to place an entry in /etc/init.d/rcS) with the content:

 #!/bin/sh

 if [ -n "`pidof syslogd`" ]; then
    /usr/bin/killall syslogd 2>/dev/null
 fi

 /bin/mount -o rw,remount /
 /sbin/syslogd -O /tmp/messages -b 2
 /bin/sleep 1
 /bin/mount -o ro,remount /

Cron

Setting up cron is staightforward and involves installing, configuring, and set up to run at start up:

    1.  Type "mount -o rw,remount /"

    2.  Type "ipkg install cron"

    3.  Change to /opt/etc directory "cd /opt/etc"

    4.  Edit crontab and place your script, then save:
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/opt/sbin:/opt/bin
MAILTO=""
HOME=/
# ---------- ---------- Default is Empty ---------- ---------- #
* * * * * root /opt/sbin/yourscript.sh
     5.  Test by running "/opt/etc/init.d/S10cron" and fix any errors.

     6.  Add "/opt/etc/init.d/S10cron" to your rcS or mount_optextX.

     7.  Make root file system read only with "mount -o ro,remount /".

For more information on cron "http://www.linuxhelp.net/guides/cron/". You can type "crontab -l" to list or "crontab -e" to edit (in vi).

Shutdown

So busybox plugs do not have a shutdown command, only poweroff, halt, and of course reboot. But you can setup a shutdown script that is automatically called when poweroff, halt, and reboot are called. In "/etc/inittab" make an entry:

 ::shutdown:/etc/init.d/rc.shutdown

In "/etc/init.d/rc.shutdown", you need to create and modify this to suit your system.

 #!/bin/sh
 #### Turns off the front pogoplug light to show that the script started.
 /sbin/rmmod xce
 #### Logs the shutdown time.
 /bin/echo "Shutdown Time is `date`" > /opt/var/log/lastshutdown.txt
 #### Paranoia on my part to make sure all files are written to.
 /bin/sync
 /bin/sync
 #### Turn off swap.  I had to explicitly use the device name.
 /sbin/swapoff /dev/your-swap-device-name
 #### Shutdown Processes except for the one running the script.
 /usr/bin/killall -15 processes-that-do-not-use-start-stop
 /opt/etc/init.d/SXXprocess stop
 #### Unmount data drives.
 /bin/umount -r /tmp/data-drive
 /bin/umount -r /tmp/data-drive
 #### If it is a hard drive, spin it down (ipkg install sdparm).
 ####  Remember /dev/sda not /dev/sda1.
 /opt/bin/sdparm --command=stop /dev/data-drive
 #### Unmount opt drive.
 /bin/umount -r /opt
 /bin/umount -r /opt
 #### More paranoia.  Although swapoff -a did not work for me.
 /bin/sync
 /bin/sync
 /sbin/swapoff -a
 /bin/umount -a -r

* Off topic, if you are using your plug as a file server, sometimes you get disconnections from your drive, or drive clicking, your usb drive cable may be marginal. I use both usb powered and external powered usb drives and find that the external ones are more reliable. You can also try a shorter, better shielded cable.

Credits to: fenschop, bturrie, Irregular Shed and bzhou.

view · edit · print · history · Last edited by OddballHero.
Originally by OddballHero.
Page last modified on November 16, 2011, at 09:10 PM