################################################################################## # Document: INSTALL_SHEEVAPLUG.TXT # Purpose : How to install Slackware ARM on the Marvell SheevaPlug # Author : Stuart Winter # Date : 16-May-2009 ################################################################################## # # References: # http://computingplugs.com/index.php/Booting_entirely_off_an_external_USB_device # http://www.cyrius.com/debian/kirkwood/sheevaplug/unpack.html # http://dev.gentoo.org/~armin76/arm/sheevaplug/install.xml ################################################################################## 1.0 Assumptions ----------- Several assumptions -- in the form of IP addresses and directory paths -- are made to help writing the examples for this documentation. These values are easy to modify to suit your environment. Environment: - You have a host machine running an existing Slackware system. Any other Unix/Linux system will suffice, but each Linux distribution is different so you'll have to make some adjustments. This machine will house the Slackware ARM tree, NFS & TFTP server. - Your host machine has Internet access, or some method of obtaining the Slackware ARM tree. - You have a secure (you trust the people using it) LAN, on 192.168.1.0/24 - Your host machine has the IP 192.168.1.1 - You can NFS export the Slackware ARM tree - You can run a TFTP daemon on your host - You want to use /export to house the Slackware ARM tree. Marvell SheevaPlug: - You want to install the OS onto a USB flash stick, or a USB hard drive. You have at least an 8GB hard disk or USB flash stick - a full installation of Slackware is approximately 4GB. - You want to retain the stock Ubuntu installation. 2.0 Configuring your environment ---------------------------- 2.1 NFS export ---------- On your Slackware host, add a line similar to the example below: /export/armedslack 192.168.1.0/255.255.255.0(ro,nohide,root_squash,sync,no_subtree_check) If you don't have an NFS server already running: # chmod +x /etc/rc.d/{rc.rpc,rc.nfsd} # /etc/rc.d/rc.nfsd restart If you have an NFS server already running: # exportfs -va 2.2 Setting up your TFTP boot server -------------------------------- Slackware ships a tftpd (TFTP boot daemon) in the 'tftp-hpa' package which can be found in the 'n/' package series. Ensure that inetd is running: # chmod +x /etc/rc.d/rc.inetd # /etc/rc.d/rc.inetd restart By default, the line in /etc/inetd.conf that loads the TFP server is commented out. # tftp dgram udp wait root /usr/sbin/in.tftpd in.tftpd -s /tftpboot -r blksize Uncomment that line. Note: If you want to use a directory other than /tftpboot to house the data, you may do so - but note that the instructions in this document refer to /tftpboot, so please remember to adjust the paths as you go. Cause inetd to re-load its configuration file: # killall -HUP inetd 2.3 Downloading Slackware ARM -------------------------- Assumptions: [ ] Your current user has read/write/execute access to /export Make the directory that we'll download Slackware ARM into: # mkdir -p /export/armedslack # cd /export/armedslack Download: The easiest way to download Slackware ARM is to use rsync. # rsync \ --exclude '*/source/*' \ --delete -Pavv \ ftp.armedslack.org::armedslack/armedslack-12.2 . Download speed will depend on the bandwidth speed of your Internet connection. Whilst it is possible to use the FTP installation inside the installer, it's recommended to download the full tree first, as in this example, and install off an NFS host on your LAN. The full download will be approximately 2GB. You may choose a mirror site - some are listed on the Slackware ARM web page: http://www.armedslack.org 2.4 Populating the /tftpboot directory ---------------------------------- Assumptions: [ ] Your current user has read/write/execute access to /tftpboot To begin the installation on the SheevaPlug unit, we'll boot the Linux Kernel and Initial RAM disk via TFTP. It *is* possible to place these two files onto an ext2 or FAT partition on USB stick/drive (even the one you'll be installing Slackware onto), but during development I've found it beneficial to have the images available by TFTP -- as you'll read later, the SheevaPlug can have trouble making a USB device 'ready' enough to boot from. Copy the Kernel and Initial RAM disk images into the tftpboot directory: # mkdir -p /tftpboot/armedslack # cd /export/armedslack/armedslack-12.2/ Copy the Slackware ARM installer: # cp -fa isolinux/uinitrd-kirkwood.img /tftpboot/armedslack/ The Linux Kernel: # cp -fa kernels/kirkwood/uImage* /tftpboot/armedslack/ The Initial RAM disk, used for booting the OS after installation (This shouldn't be needed, but if your SheevaPlug cannot make the USB device 'ready' at the U-Boot console, we still have the option to boot the initrd & Kernel from the network/tftp) # cp -fa kernels/kirkwood/uinitrd* /tftpboot/armedslack/ 2.4.1 Adding the U-Boot update to the /tftpboot directory --------------------------------------------------- If your version of U-Boot is earlier than "U-Boot 1.1.4 (Nov 4 2009 - 12:58:36) Marvell version: 3.4.23" then you must upgrade. The newer releases fix a number of bugs in the USB and SD Card support. The release of U-Boot running on your SheevaPlug can be found by entering "version" at the U-Boot Prompt: Marvell>> version U-Boot 1.1.4 (Nov 4 2009 - 12:58:36) Marvell version: 3.4.23 This copy of U-Boot and was taken from the PlugComputer.org forum: http://plugcomputer.org/plugforum/index.php?action=dlattach;topic=1134.0;attach=201 # cd /tftpboot # wget ftp://ftp.armedslack.org/armedslack/armedslack-devtools/sheevaplug/u-boot/releases/U-Boot_SheevaPlug_1.1.4_Dec_27_2009_Marvell_v3.4.27.bin # mv -fv U-Boot_SheevaPlug*.bin u-boot.bin 3.0 Connecting to the SheevaPlug via the Serial Port ------------------------------------------------ 1. Create a udev rules file for the SheevaPlug: Create a udev rules file to create a /dev/sheevaplug device. When you power cycle the SheevaPlug, often the /dev/ttyUSB device numbers will change which means you have to update your terminal program's settings; this way you don't need to. Paste the following into a root shell on your host: echo ' # /etc/udev/rules.d/10-sheevaplug.rules # Attach /dev/sheevaplug to the 2nd USB port on the SheevaPlug. # by Jim Hawkins # ACTION=="add", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="01", ATTRS{interface}=="SheevaPlug JTAGKey FT2232D B", SYMLINK+="sheevaplug" ' > /etc/udev/rules.d/10-sheevaplug.rules 2. Load the Kernel modules required: # modprobe usbserial vendor=0x9e88 product=0x9e8f # modprobe ftdi_sio vendor=0x9e88 product=0x9e8f 3. Configure your terminal software with the following settings: In Slackware you could use these programs which allow terminal emulation to tty: 'minicom' in the 'a/minicom' package 'screen' in the 'ap/screen' package Note: I find it easier to use 'screen' because when you power cycle the SheevaPlug, the ttyUSB device (that /dev/sheevaplug symlinks to) is removed from /dev by udev. This causes the program to either quit or hang up, making you have to reconnect. I find it faster to press the up arrow in my shell, and re-run screen, than having to do combinations in minicom. In Windows, you could use the bundled 'HyperTerm' utility but you'd need to download the USB drivers from the Marvell website first. Serial Device: /dev/sheevaplug Baudrate: 115200bps Databits: 8 Parity: None Stopbits: 1 Hardware Flow Control: No Software Flow Control: No Start minicom with the -s switch: # minicom -s and configure the serial settings. To use 'screen': # screen /dev/sheevaplug 115200,-crtscts 4. Connect the USB serial cable that comes with the SheevaPlug to your PC. 5. Connect your USB stick or hard disk to the unit. If the hard disk has an external power supply, power on the drive now and wait for it to spin up. 6. Power on the SheevaPlug unit. 7. Open the connection to the SheevaPlug serial port Example: # screen /dev/sheevaplug 115200,-crtscts 8. You should see the output from the SheevaPlug appearing in your terminal window. 9. You will see a prompt saying you can press any key to interrupt the boot process. Press ENTER a few times and you will be dropped into the U-Boot console, and sit at the 'Marvell>>' prompt. 3.1 Configuring the SheevaPlug -------------------------- 1. Set or request an IP address for the SheevaPlug: The SheevaPlug U-Boot console needs an IP address temporarily to contact the TFTP boot server. If you are running a DHCP server on your network, you may prefer to request an IP address by DHCP. However, after following the instructions here and updating U-Boot, the MAC address of the SheevaPlug will change - so if you were planning on binding a MAC to an IP address in your /etc/dhcpd.conf, don't just yet! To set an IP statically: Marvell>> setenv ipaddr 192.168.1.20 To request an IP via DHCP: Marvell>> dhcp 2. Set the IP address of the TFTP server: This is the IP address of your Slackware x86 host on which the TFTP daemon runs. Marvell>> setenv serverip 192.168.1.1 Change the settings so that the SheevaPlug expects to boot a non-stock Kernel, save the settings & reboot the device: Marvell>> setenv mainlineLinux yes Marvell>> setenv arcNumber 2097 Marvell>> saveenv Marvell>> reset 3.1 Upgrading U-boot on the SheevaPlug ----------------------------------- If you'd rather not update your version of U-Boot, you can skip this step and move to Section 4.0. However, if you cannot get the installer or installed OS to boot, you may want to revisit this and upgrade U-Boot. ** Note: I take no responsibility for any damage done to your SheevaPlug unit!! ** That said, I've upgraded U-Boot on two of my SheevaPlugs and suffered no ill effects. 1. Upgrade U-Boot: Marvell>> bubt You should see an indication that the download is happening, and will then be prompted as to whether you want to reset the environment variables: Respond 'Y' to changing the environment variables Notes: [a] Some documents on the web suggest not resetting the environment variables. However, I've not had any issues doing so on both of my SheevaPlug units; and it's the only way I've found to get console output from the Linux Kernel once it's 'live' (I'm not sure what the setting is that makes it work!). If you're concerned about this, I'd advise that you setup logging in your terminal program, and then issue a printenv command at the U-Boot console, so that you have a backup of the previous settings. Marvell>> printenv [b] If you're returning to this document after having successfully installed Slackware ARM and want to update to a newer release of u-boot, then you can answer "n" to changing environment variables. "Override Env parameters? (y/n) n" 2. Rebooting the device: You must now reboot the device to boot into the new version of U-Boot: Marvell>> reset The first time it boots, you'll see this message: NAND:512 MB *** Warning - bad CRC or NAND, using default environment Interrupt the boot sequence again by hitting the ENTER key a few times, until you're dropped to the U-Boot console. Note: The MAC address of the Unit will have changed (the SheevaPlug seems to generate new ones). If you want to set the MAC address to something in particular: Marvell>> setenv ethaddr xx:xx:xx:xx:xx:xx 3. Repeat Section 3.1 (Configuring the SheevaPlug settings) to re-configure the SheevaPlug one final time. Once you have reset the SheevaPlug, if you upgraded U-Boot you should notice that you no longer receieve the warning message about the bad CRC or NAND. 4.0 Slackware ARM installation -------------------------- Power cycle/reset the SheevaPlug and Interrupt the boot process. At the U-Boot console: Marvell>> usb start If your device says: (Re)start USB... USB: scanning bus for devices... 2 USB Device(s) found scanning bus for storage devices... Device NOT ready Request Sense returned 05 24 00 1 Storage Device(s) found Where it says that the device is not ready, reset the device again and retry. If after four or so goes it still doesn't work, then it may be that the SheevaPlug simply does not like your device and you will have to boot from the network. If the SheevaPlug finds your USB device, it should report something similar to: Marvell>> usb start (Re)start USB... USB: scanning bus for devices... 2 USB Device(s) found scanning bus for storage devices... 1 Storage Device(s) found Marvell>> 4.1 Booting the installer --------------------- Now download the Kernel and Slackware ARM installer via TFTP: Marvell>> tftpboot 0x01100000 armedslack/uinitrd-kirkwood.img Marvell>> tftpboot 0x00800000 armedslack/uImage-kirkwood Marvell>> setenv bootargs console=ttyS0,115200 nodhcp kbd=uk root=/dev/ram rw Marvell>> bootm 0x00800000 0x01100000 Note: The second line above ("setenv bootargs..") sets the keyboard setting to 'uk'. You may choose another such as "us", one one of the other valid keymaps. The installation will be conducted through SSH which uses your local keymap, but you may wish to set this keymap here since you'll need to type a few commands in once the installer has booted. For those of you who are familiar with the Slackware installer, you will note that you will not be presented with the option to select your keymap as soon as the installer has booted. This is because the cursor keys don't work properly in the menus; but you can configure it later in the main 'setup' menu. 4.1.3 Starting the network -------------------- Before you can mount the NFS share, you need to setup networking in the installer. # ifconfig eth0 You should see a stanza for eth0. If you have a DHCP server on your network, you can request an IP address by dhcp: # dhcpcd eth0 # ifconfig eth0 Note down the IP address. You'll be SSHing into it soon. If you don't have a DHCP server then you need to configure the network address manually: # ifconfig eth0 192.168.1.20 netmask 255.255.255.0 Remember that you'll need to adjust these network settings for your own LAN! Start the SSH server: # /etc/rc.d/rc.dropbear start 4.2 Begin the setup --------------- Slackware ARM has an identical installer to Slackware x86, so the same tools are available, including fdisk. 4.2.1 Connect to the installer via SSH -------------------------------- Since the SheevaPlug does not have a keyboard, mouse or monitor, and the installer doesn't yet work over the serial port, the easiest way to install is over SSH. On your x86 host PC, ssh into the IP address of the SheevaPlug: # ssh root@192.168.1.20 Type 'yes' when asked about confirming the identity of the host. Press ENTER when prompted for a password -- there is no password. You will now be logged into the installer running on the SheevaPlug. 4.2.2 Partitioning your hard disk --------------------------- You should find your USB stick/drives are identified as /dev/sda. Please choose a partitioning scheme. I recommend: /dev/sda1 - Size: 100MB Mount point: /boot Partition type: 83 "Linux" Filesystem: ext2 /dev/sda2 - Size: 800MB Mount point: Not applicable Partition tyoe: 82 "Linux Swap" Tip: If you have small sized storage you may wish to have a small swap partition. But if you're going to be doing software development, it's advisable to have a larger swap partition to 'avoid out of memory' errors. /dev/sda3 - Size: Remainder of the disc Mount point: / Partition type: 83 "Linux" Filesystem: ext4 (or your choice) You are free to choose your own partitioning scheme but U-Boot is restricted to loading files (the Linux Kernel & Initial RAM disk) from either ext2 or FAT partitions; therefore it's recommended to have a small ext2 formatted /boot partition. You can create the partition table using fdisk or cfdisk. 4.2.3 Start the installer menu ------------------------ In the SSH terminal window, at the SheevaPlug Slackware installer shell, start up the installer menu: # TERM=linux setup The first thing to select is the keymap. Whilst you will probably be using the SheevaPlug remotely, it's worth configuring the keymap for when you do connect via the serial port. From now on the installer will progress automatically on to the next steps. 4.2.4 Setting up filesystems ---------------------- The Slackware installer will first present a list of available "Linux" type partitions, and ask which one should be the root ('/') partition. If you are following the partition layout as suggested in this document then you should choose /dev/sda3, and choose any format you wish. The next step to "Select other Linux partitions for /etc/fstab" Here: - Select /dev/sda1 - Format it - Select 'ext2' as its filesystem - Mount point: /boot 4.2.5 Source media selection ---------------------- Choose '3 - Install from NFS (Network Filesystem)' Enter the IP address: 192.168.1.1 Enter the directory: /export/armedslack/armedslack-12.2/slackware 4.2.6 Package selection ----------------- Slackware ARM has all of the Slackware packages apart from those which are x86 only. It's up to you which packages you install, but we recommend a full installation. 4.2.7 Choosing an X Window Manager ---------------------------- The SheevaPlug unit is headless, but if you want to test graphical packages on Slackware ARM, you may wish to install the 'tightvnc' VNC server package from the 'extra' package directory once installation has finished and you've booted into the new OS. "tightvnc" uses the system wide X Window Manager settings. Once the system as booted into the OS, mount the Slackware ARM NFS mount once again. Example: # sh /etc/rc.d/rc.rpc restart # mount 192.168.1.1:/export/armedslack/armedslack-12.2/ /mnt # cd /mnt/extra/tightvnc # installpkg tightvnc-*.tgz You can now setup the VNC X server by running the "vncserver" command. 4.2.8 No mouse or console fonts to choose from? ----------------------------------------- If Slackware ARM detects that it is running on a SheevaPlug it will not prompt you to choose a mouse or out any console fonts. This is because you cannot use the results of your choices, so it seems sensible not to offer them! This doesn't stop you from running the setup tools after the operating system is running though, should you really want to! 5.0 Booting the Slackware ARM OS ---------------------------- Congratulations! After you've completed the installation of Slackware ARM, you should exit the 'setup' menu, drop to the shell and type # reboot Once again, interrupt the boot process of the SheevaPlug, and you'll be dropped into the familiar 'Marvell>>' U-Boot console. We now need to tell the SheevaPlug how to boot the Operating System. In section 4.2.2 (Partitioning your hard disk), you chose a disk layout and chose which filesystem to use. If you followed the example in this document, you won't need to change anything below. If you chose your own disk layout, here follows an explanation of the values contained in the U-Boot configuration below: The first line: root=/dev/sda3 This is where Linux will find its root filesystem ('/'). rootfs=ext4 The filesystem (e.g. ext2,ext3,ext4,xfs,reiserfs) used on the root filesystem. The second and third lines tell U-Boot to start the USB subsystem; load the Initial RAM disk off an ext2 filesystem which is the first partition on the disk; load the Linux Kernel off an ext2 filesystem which is on the first partition on the disk. The fourth line boots the Kernel and Initial RAM disk using the values configured. Paste these lines into your SheevaPlug U-Boot console, adjusting any necessary settings, as described above: Marvell>> setenv bootargs_console console=ttyS0,115200 Marvell>> setenv bootargs_root 'root=/dev/sda3 waitforroot=10 rootfs=ext4' Marvell>> setenv bootcmd_usb 'ext2load usb 0:1 0x0800000 /uinitrd-kirkwood ; ext2load usb 0:1 0x00800000 /uImage-kirkwood' Marvell>> setenv bootcmd 'usb start; setenv bootargs $(bootargs_console) $(bootargs_root); run bootcmd_usb ; bootm 0x00800000 0x0800000 ; reset' Finally, save the settings and reboot the device: Marvell>> saveenv Marvell>> reset The SheevaPlug will reboot and should begin running the Linux Kernel, and booting into your new Slackware ARM installation. 5.1 Network booting --------------- The aim of these instructions are to install Slackware ARM onto a USB device, and boot from it. However, if your SheevaPlug unit will not make your USB device 'ready' at boot time, there seems little that can be done - it's a known bug in the SheevaPlug. Network booting can also be a great way to test your new Kernel and initial RAM disk, knowing that you can safely reboot from the on-disk copy should the new one not work. In section 2.4 (Populating the /tftpboot directory), you copied the Kernel and Initial RAM disk into the x86 host's /tftpboot/armedslack directory; we can boot the Kernel and Initial RAM disk from the network and usually Linux will find your USB device and the OS can boot from the disc. Interrupt the SheevaPlug's boot sequence: Marvell>> tftpboot 0x01100000 armedslack/uinitrd-kirkwood Marvell>> tftpboot 0x00800000 armedslack/uImage-kirkwood Adjust the 'root=/dev/sda3' and 'rootfs=ext4' to match your setup. See section 5.0 (Booting the Slackware ARM OS) for an explanation of the values. Marvell>> setenv bootargs console=ttyS0,115200 root=/dev/sda3 waitforroot=10 rootfs=ext4 Marvell>> bootm 0x00800000 0x01100000 You could also configure your device to boot from the network automatically, but that is outside of the scope of this document - although please email me the instructions if you write some, and I'll include them here. 6.0 Suggestions/alterations ----------------------- If you have any suggestions, recommendations or corrections(!) for this document, please do email me. Thanks! Stuart Winter. -- Stuart Winter mozes@slackware.com