Disclaimer :
This document is a work in progress and should not be considered official yet.
|
Gentoo on the Marvell SheevaPlug
1.
Overview
Installing Gentoo in the SheevaPlug is pretty simple. You can either use an USB mass storage
device, like an USB stick or an USB HDD, or you can use an SD card.
The SheevaPlug also has 512MB of NAND(flash) storage, but unless you want to install a very small system
it won't be enough for running a Gentoo installation. This is due to the portage tree, which is
~499MB. You could install Gentoo on the NAND, but you'll need to mount the portage tree using
NFS or other kind of storage.
Therefore, since we want a standalone system, we'll just use one of the two options
mentioned above.
2.
Requirements
To be able to install Gentoo, you'll need the following:
- A Marvell Sheevaplug
- One USB storage device/One SD card
- A network connection
- An USB cable where one end is an A-mini connection(to connect it to your plug)
- A TFTP server running and in the same network as the plug
3.
Preparing to boot your plug
Overview
Before we start the installation process, we need to set up our plug's serial and install a
TFTP server on our computer.
Accessing the plug's serial
For accessing the plug's serial, we need an USB cable where one end is a B-mini USB connector,
which we'll connect it to the connector of the same type near the SD slot, which is located
on the left side of the plug, supposing the RJ-45 and the normal USB connector are at the top.
Don't plug it to your computer yet.
For the serial to work, you need to have the needed kernel driver loaded on the computer. Make
sure you have it either as built-in in your kernel or as a module, if the latter, load it.
Code Listing 3.1: Enable the serial driver |
Device Drivers --->
<*> USB support --->
<*> USB Serial Converter support --->
<*> USB FTDI Single Port Serial Driver
|
If you built the driver as a module and you are unable to get the ttyUSB* devices(those devices
should only show up if the plug is powered on), you need to pass a few parameters when loading it:
Code Listing 3.2: Loading the kernel module |
# modprobe usbserial vendor=0x9e88 product=0x9e8f
# modprobe ftdi_sio vendor=0x9e88 product=0x9e8f
|
After that, you need a serial terminal emulator. You can use, for example
net-misc/minicom or net-misc/picocom, configured with the following parameters:
- Serial Device: /dev/ttyUSB1
- Baudrate: 115200bps
- Databits: 8
- Parity: None
- Stopbits: 1
- Hardware Flow Control: No
- Software Flow Control: No
That configuration is also known as 115200 8N1.
After configuring your favorite serial terminal emulator, plug your Sheevaplug and you should
see some boot information.
Installing a TFTP server
Since we need a TFTP server so our plug can get the kernel and the initramfs of the installation
environment, we'll install one. Remember that the TFTP server has to be in a computer that
its in the same network as the plug. I used net-misc/tftp-hpa.
Code Listing 3.3: Emerging net-misc/tftp-hpa |
# emerge tftp-hpa
|
Specify the directory where the kernel and initramfs files are located:
Code Listing 3.4: Setting the TFTP directory |
# nano -w /etc/conf.d/in.tftpd
INTFTPD_PATH="/tftproot/"
|
Warning: Make sure the directory exists! |
Now, start the TFTP server:
Code Listing 3.5: Starting the TFTP server |
# /etc/init.d/in.tftpd start
|
Now we have our TFTP server running, next, download the files needed for booting your plug
Getting the kernel and the initramfs
Now we'll download the kernel and the initramfs:
Code Listing 3.6: Downloading the files |
# cd /tftproot
# wget http://dev.gentoo.org/~armin76/arm/sheevaplug/install/uImage_kwplug
# wget http://dev.gentoo.org/~armin76/arm/sheevaplug/install/sheevaplug.initramfs
|
4.
Booting the installation environment
For booting our plug using the files from the TFTP server, we need to set up some variables
on U-Boot.
Once you have your serial terminal emulator working, start or reboot your plug, so you can see the
boot process and break into the U-Boot console.
Code Listing 4.1: Breaking into the U-Boot console |
[snip]
512 MB
CPU : Marvell Feroceon (Rev 1)
Streaming disabled
Write allocate disabled
USB 0: host mode
PEX 0: interface detected no Link.
Net: egiga0 [PRIME], egiga1
Hit any key to stop autoboot: 3
Marvell>>
|
Once we get the Marvell>> prompt, it means we're in U-Boot's console.
You need to give to the plug the IP address of the tftpserver and the IP for the device itself:
Code Listing 4.2: Setting network configuration |
Marvell>> setenv ipaddr 192.168.0.3 (replace with the IP you want the plug to have)
Marvell>> setenv serverip 192.168.0.1 (replace with the TFTP server IP)
|
For booting kernels from the mainline kernel, we need the following variables set:
Code Listing 4.3: Setting needed kernel-related variables |
Marvell>> setenv arcNumber 2097
Marvell>> setenv mainlineLinux yes
Marvell>> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
Marvell>> reset
|
Important: Please make sure you set those variables, as you'll be unable to boot your plug with our images if you don't. |
Now we'll tftpboot our plug:
Code Listing 4.4: Tftpbooting our plug |
Marvell>> tftpboot 0x8000000 sheevaplug.initramfs
Marvell>> tftpboot 0x2000000 uImage_kwplug
Marvell>> setenv bootargs console=ttyS0,115200 root=/dev/ram rw
Marvell>> bootm 0x2000000 0x8000000
|
Once it has booted, you can now proceed to the installation chapter.
5.
Installing Gentoo
Overview
The installation on this device is more or less the same as any other kind of machine.
So please read and follow the ARM Handbook from the beginning,
just skip the 10th chapter, as its irrelevant for our machine. I'll just explain what we have to do differently.
Please read below first so you know when you have to go back to this document during the installation.
Partitions
As I already explained, we don't need a boot partition, although you can create it anyway if you
want to have your kernels and initramfs separated from the main partition.
Stages information
Here's some information about the stages.
- Architecture: arm
- Subarchitecture: armv5tel
- CHOST: armv5tel-softfloat-linux-gnueabi
- Profile: default/linux/arm/10.0
We'll be using the new EABI, also called gnueabi, instead of the old ABI. That is armel on Debian.
There's no exact reason for why we should use this EABI and not the old one, apart that this one is better than the old.
Therefore, we need an armv5tel-softfloat-linux-gnueabi stage3, available under the
releases/arm/autobuilds directory in your favourite mirror
Configuring and installing the kernel
The SheevaPlug is supported in the mainline kernel since 2.6.30-rc1.
First, we need the following packages for compiling our own kernel:
Code Listing 5.1: Emerging needed packages |
# emerge u-boot-tools
|
Now, let's emerge vanilla-sources:
Code Listing 5.2: Emerging vanilla-sources |
# emerge '>=sys-kernel/vanilla-sources-2.6.30_rc1'
|
After that we can start configuring our kernel:
Code Listing 5.3: Configure the kernel with the default config |
# cd /usr/src/linux
# make kirkwood_defconfig menuconfig
|
Once you've configured it, you need to run the following command for creating an U-Boot kernel image and the kernel modules:
Code Listing 5.4: Building a kernel image for U-Boot and the modules |
# make uImage && make modules_install
|
Now we flash the kernel to the flash partition, mtdblock1.
Code Listing 5.5: Flashing the kernel |
# cat arch/arm/boot/uImage > /dev/mtdblock1
|
Enabling SSH access
Now we add sshd to the startup of our system so we can access it when we boot into our
new system.
Code Listing 5.6: Adding sshd to the startup |
# rc-update add sshd default
|
Enabling serial console access
By default the ttyS0 port is configured to 9600bps. Thats okay if you have your client configured to 9600bps,
however, as you probably know, the serial port on the machine is configured at 115200bps.
So probably you want to change the speed of the port in the ttyS0 line of the /etc/inittab file:
Code Listing 5.7: Configuring serial console |
# nano -w /etc/inittab
s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100
|
Finishing the installation
This is pretty much all the installation, read all the recommendations of the handbook, and remember
to change the root password and/or create some users.
6.
Booting to our new system
Once you've finished the installation of Gentoo into your SheevaPlug, there's still something you
need to do so it boots to our new system. We need to break into U-Boot console again,
have a look at the section explaining it to remember how to do it.
Once you're in, type the following commands:
Code Listing 6.1: Configuring U-Boot |
Marvell>> setenv bootcmd nand read 0x01000000 0x00100000 0x00400000\;setenv bootargs $(console) root=/dev/sda1 rootdelay=5\; bootm 0x01000000
Marvell>> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done
Marvell>> reset
|
After doing that, your plug should reboot into your new system! Have fun!
7.
References
You may find more documentation about the device itself and Linux-related on the following links:
8.
Thanks
I'd like to thank Marvell since they provided us some hardware
to do this porting and they've been very helpful.
The contents of this document are licensed under the Creative Commons -
Attribution / Share Alike license.
|