################################################################################## # Document: INSTALL_KIRKWOOD.TXT # Purpose : How to install Slackware ARM on the Marvell SoC Kirkwood series # including: # SheevaPlug # GuruPlug # OpenRD Base # OpenRD Client # Author : Stuart Winter # Date : 05-Jun-2010 ################################################################################## # # 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 # http://www.cyrius.com/debian/kirkwood/openrd/install.html # http://code.google.com/p/openrd/wiki/UbootConfigForMainLineKernel ################################################################################## 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. Kirkwood system: - You want to install the OS onto an eSATA hard disc, MMC device or a USB hard drive or USB memory device. Some Kirkwood devices such as the OpenRD and some "Plug" devices have an eSATA port. If you have an eSATA enclosure, it's recommended to use this because the disc throughput will be faster. You have at least an 8GB hard disk or USB flash stick - a full installation of Slackware is approximately 5.5GB. - 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-13.1 . 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 Kirkwood 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. Copy the Kernel and Initial RAM disk images into the tftpboot directory: # mkdir -vpm755 /tftpboot/armedslack-13.1 # cd /export/armedslack/armedslack-13.1/ Copy the Slackware ARM installer: # cp -fav isolinux/uinitrd-kirkwood.img /tftpboot/armedslack-13.1/ The Linux Kernel: # cp -fav kernels/kirkwood/uImage* /tftpboot/armedslack-13.1/ 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 -fav kernels/kirkwood/uinitrd* /tftpboot/armedslack-13.1/ 2.4.1 Adding the U-Boot update to the /tftpboot directory --------------------------------------------------- When the SheevaPlugs were first released, the u-Boot shipped with them was not very reliable. The version of u-boot on your system may require an upgrade. Please visit the Kirkwood maintenance page for details and a HOWTO guide. http://www.armedslack.org/maint_kirkwooduboot ** Note for GuruPlug ** The factory supplied u-boot on the GuruPlugs does not support ext2 filesystems, nor booting a non-factory Kernel. Therefore you must upgrade your u-boot prior to installing Slackware. Instructions can be found at the URL above. 3.0 Connecting to the Kirkwood system via the Serial Port ----------------------------------------------------- 1. Create a udev rules file for the Kirkwood system: Create a udev rules file to create a device entry in /dev. When you power cycle the Kirkwood system, 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/99-marvell-kirkwood.rules # Attach /dev/{openrd,sheevaplug} to the serial console of the Marvel Kirkwood systems. # by Jim Hawkins # # The JTAG module supplied with the GuruPlug identifies itself as "SheevaPlug" so you # can use the /dev/sheevaplug device. # ACTION=="add", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="01", ATTRS{interface}=="SheevaPlug JTAGKey FT2232D B", SYMLINK+="sheevaplug" ACTION=="add", SUBSYSTEM=="tty", SUBSYSTEMS=="usb", ATTRS{bInterfaceNumber}=="01", ATTRS{interface}=="OpenRD JTAGKey FT2232D B", SYMLINK+="openrd" ' > /etc/udev/rules.d/99-marvell-kirkwood.rules Cause udev to find the new rules: # sh /etc/rc.d/rc.udev restart 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 Kirkwood system, the ttyUSB device (that /dev/{sheevaplug,openrd} 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/openrd ( or /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/openrd 115200,-crtscts # or /dev/sheevaplug 4. Connect the USB serial cable that comes with the Kirkwood system 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 Kirkwood system unit. 7. Open the connection to the Kirkwood system serial port Example: # screen /dev/openrd 115200,-crtscts # or /dev/sheevaplug 8. You should see the output from the Kirkwood system 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 Kirkwood system ------------------------------- 1. Set or request an IP address for the Kirkwood system: The Kirkwood system 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 Kirkwood system 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 Kirkwood system expects to boot a non-stock Kernel, save the settings & reboot the device: For the SheevaPlug systems: Marvell>> setenv arcNumber 2097 For the SheevaPlug eSATA systems: Marvell>> setenv arcNumber 2678 For the GuruPlug: Marvell>> setenv arcNumber 2659 For the OpenRD *CLIENT* systems: Marvell>> setenv arcNumber 2361 For the OpenRD *BASE* systems: Marvell>> setenv arcNumber 2325 Save the settings: Marvell>> setenv mainlineLinux yes Marvell>> saveenv Marvell>> reset 4.0 Slackware ARM installation -------------------------- Power cycle/reset the Kirkwood system and Interrupt the boot process. 4.1 Performing an installation to a USB disc ---------------------------------------- If you want to perform the installation to a USB disc: 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 Kirkwood system simply does not like your device and you'll either have to check if there's a newer U-Boot version for your Kirkwood system system, or find another USB enclosure. If the systtem 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.2 Performing an installation to an eSATA disc ------------------------------------------- To perform an installation to an eSATA drive, we need to reset the IDE interface: Marvell>> ide reset 4.3 Performing an installation to an MMC device ------------------------------------------- Start the MMC interface: Marvell>> mmcinit 4.4 Booting the installer --------------------- Now download the Kernel and Slackware ARM installer via TFTP: Marvell>> tftpboot 0x01100000 armedslack-13.1/uinitrd-kirkwood.img Marvell>> tftpboot 0x00800000 armedslack-13.1/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 over the serial console; but you can configure it later in the main 'setup' menu. 4.4.1 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.5 Begin the setup --------------- Slackware ARM has an identical installer to Slackware x86, so the same tools are available, including fdisk. 4.5.1 Connect to the installer via SSH -------------------------------- The easiest way to get Slackware ARM onto a Kirkwood system is to login to the installer via SSH. On your x86 host PC, ssh into the IP address of the Kirkwood system: # 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 Kirkwood. 4.5.2 Partitioning your hard disk --------------------------- You should find your USB/eSATA drives are identified as /dev/sda. If you're using an MMC device you will find it identified as /dev/mmcblk0 and the partitions as /dev/mmcblk0pN (where N is the partition number). In the examples below, for MMC the device names become /dev/sda1 = /dev/mmcblk0p1 /dev/sda2 = /dev/mmcblk0p2 /dev/sda3 = /dev/mmcblk0p3 The rest of the examples use the /dev/sda names for ease of documentation. If you're using MMC, you need to substitute /dev/sda for the MMC device names in the table above. Please choose a partitioning scheme. The recommended scheme is: /dev/sda1 - Size: 100MB Mount point: /boot Partition type: 83 "Linux" Filesystem: ext2 * Note: * The reason for a separate /boot partition with an ext2 filesystem, rather than say one large / formatted as ext4, is because the ext2 support in u-boot does not support anything higher than 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.5.3 Start the installer menu ------------------------ In the SSH terminal window, on the Kirkwood system's 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 Kirkwood 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.5.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.5.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-13.1/slackware 4.5.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.5.7 Choosing an X Window Manager ---------------------------- The OpenRD Client has a video port so that it can be used as a graphical workstation. The OpenRD base unit and most of the SheevaPlugs are 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-13.1/ /mnt # cd /mnt/extra/tightvnc # installpkg tightvnc-*.tgz You can now setup the VNC X server by running the "vncserver" command. 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 Kirkwood, and you'll be dropped into the familiar 'Marvell>>' U-Boot console. We now need to tell the Kirkwood 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,jfs,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 Kirkwood 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 'setenv bootargs $(bootargs_console) $(bootargs_root); run bootcmd_slk ; reset' For installation to a *USB* disc: Marvell>> setenv bootcmd_slk 'usb start;ext2load usb 0:1 0x01100000 /uinitrd-kirkwood;ext2load usb 0:1 0x00800000 /uImage-kirkwood;bootm 0x00800000 0x01100000' For installations to an *eSATA* disc: Marvell>> setenv bootcmd_slk 'ide reset;ext2load ide 1:1 0x01100000 /uinitrd-kirkwood;ext2load ide 1:1 0x00800000 /uImage-kirkwood;bootm 0x00800000 0x01100000' For installations to an *MMC* device: Marvell>> setenv bootcmd_slk 'mmcinit;ext2load mmc 0:1 0x01100000 /uinitrd-kirkwood;ext2load mmc 0:1 0x00800000 /uImage-kirkwood;bootm 0x00800000 0x01100000' Finally, save the settings and reboot the device: Marvell>> saveenv Marvell>> reset The Kirkwood will reboot and should begin running the Linux Kernel, and booting into your new Slackware ARM installation. 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