Trace of a Gentoo Install on a Seagte Dockstar
USB Stick
p1: 25MB ext2 (kernel) * p2: 1024MB swap p3: 6G ext3 (rootfs)
plugin in usb-stick, network cable then power led blinks green, then blinks orange, goes off and goes steady orange when ready.
$ ifconfig eth1 169.254.1.0
The fastest way to identify the dockstar's IP address is to use the last two bytes of the MAC (have a look at the bottom of the device :)) which seems to be the basis for seagates 169.254.x.y IP Generator. So when your MAC reads 00:10:75:00:AB
:CD
you can use printf and nmap smartly:
$ nmap -e eth1 -sP $(printf "169.254.%d.%d" 0xab 0xcd)
Starting Nmap 5.21 ( http://nmap.org ) at 2011-06-23 14:05 UTC Nmap scan report for 169.254.188.74 Host is up (0.00011s latency). MAC Address: 00:10:75:00:AB:CD (Maxtor) Nmap done: 1 IP address (1 host up) scanned in 0.10 seconds
$ nmap -e eth1 -sP 169.254.0.0/16
Starting Nmap 5.21 ( http://nmap.org ) at 2011-06-23 13:39 UTC Nmap scan report for 169.254.188.74 Host is up (0.000096s latency). MAC Address: 00:10:75:00:AB:CD (Maxtor)
Default dockstar firmware services:
$ nmap -sS 169.254.188.74
Starting Nmap 5.21 ( http://nmap.org ) at 2011-06-23 14:01 UTC Nmap scan report for 169.254.188.74 Host is up (0.00022s latency). Not shown: 996 closed ports PORT STATE SERVICE 22/tcp open ssh 23/tcp open telnet 80/tcp open http 3333/tcp open dec-notes MAC Address: 00:10:75:00:AB:CD (Maxtor) Nmap done: 1 IP address (1 host up) scanned in 1.29 seconds
ssh login user: root default password: stxadmin
$ ssh root@169.254.188.74 root@169.254.188.74's password: stxadmin -bash-3.2#
-bash-3.2# cat /proc/mtd
dev: size erasesize name mtd0: 00100000 00020000 "u-boot" mtd1: 00400000 00020000 "uImage" mtd2: 02000000 00020000 "root" mtd3: 0db00000 00020000 "data"
-bash-3.2# mount
rootfs on / type rootfs (rw) /dev/root on / type jffs2 (ro) none on /proc type proc (rw) none on /sys type sysfs (rw) none on /dev/pts type devpts (rw) none on /tmp type tmpfs (rw) /tmp/.cemnt/sda1 on /tmp/.cemnt/mnt_sda1 type ext2 (rw,nosuid,nodev,noexec,noatime) /tmp/.cemnt/sda3 on /tmp/.cemnt/mnt_sda3 type ext3 (rw,nosuid,nodev,noexec,noatime,data=ordered)
Plug in the power, wait until the LED is steadily orange and log in again. Because we need access to the Internet we are now disabling the startup of the Pogoplug software, so we are not risking that the device updates something when it can go online:
user@host ~ $ ssh root@ip_found # password is stxadmin -bash-3.2# killall hbwd # stop the Pogoplug software -bash-3.2# mount -o remount,rw / -bash-3.2# chmod go+w /dev/null # fix a bug -bash-3.2# vi /etc/init.d/rcS Comment out the line which starts the Pogoplug software using a dash save and quit vi:
… #/etc/init.d/hbmgr.sh start … (Warning: As already mentioned above, don't disable hbmgr on devices with a firmware where you have to enable ssh through the Pogoplug software. This will disable ssh after reboot/shutdown and you will loose access through ssh. Do this only, when you have access to the serial.)
Remount / again as read only and shutdown:
-bash-3.2# mount -o remount,ro / -bash-3.2# /sbin/halt Again, wait a minute and turn off the device.
when back online:
/sbin/ifconfig eth0 192.168.1.10/24
relogin and default routes:
ip route add default via 192.168.1.254 echo “nameserver 192.168.1.254” > /etc/resolv.conf
-bash-3.2# cd /tmp/.cemnt/mnt_sda3 bash-3.2# /sbin/swapon /dev/sda3 -bash-3.2# mount /dev/sda2 /mnt/ -bash-3.2# -bash-3.2# cd /mnt/
wget http://ftp.uni-erlangen.de/pub/mirrors/gentoo/releases/arm/autobuilds/20110520/armv5tel-softfloat-linux-gnueabi/stage3-armv5tel-20110520.tar.bz2 $ tar -xvjpf stage3-armv5tel-20110520.tar.bz2 -bash-3.2# mount -o bind /dev /mnt/dev -bash-3.2# mount -o bind /proc /mnt/proc -bash-3.2# mount -o bind /sys /mnt/sys -bash-3.2# mount /dev/sda1 /mnt/boot -bash-3.2# tar -xvjpf stage3-armv5tel-20110520.tar.bz2 -bash-3.2# cp /etc/resolv.conf /mnt/etc -bash-3.2# hostname DockStar -bash-3.2# /usr/sbin/chroot /mnt DockStar / # source /etc/profile DockStar / # env-update >>> Regenerating /etc/ld.so.cache... DockStar / # DockStar / # export PS1="(chroot) $PS1"
(chroot) DockStar / # mkdir /usr/local/portage (chroot) DockStar / # nano /etc/make.conf
make.conf
CFLAGS="-Os -march=armv5te -pipe -fomit-frame-pointer" CXXFLAGS="-std=gnu++0x -fvisibility-inlines-hidden ${CFLAGS}" # Use one of the CXXFLAGS below if an ebuild won't compile with the above CXXFLAGS #CXXFLAGS="-fvisibility-inlines-hidden ${CFLAGS}" #CXXFLAGS="${CFLAGS}" LDFLAGS="-Wl,-O1 -Wl,--enable-new-dtags -Wl,--sort-common -Wl,--as-needed" # WARNING: Changing your CHOST is not something that should be done lightly. # Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing. CHOST="armv5tel-softfloat-linux-gnueabi" PORTDIR_OVERLAY=/usr/local/portage
Edit /etc/conf.d/net and configure the network to use DHCP:
config_eth0=( "dhcp" ) If you want to use a static IP /etc/conf.d/net must look like this: config_eth0=( "123.456.789.123" ) routes_eth0=( "default via 456.789.123.456" ) Edit /etc/conf.d/hostname and set the hostname you want to use. Edit /etc/fstab, it should read like this: ... /dev/sda1 /boot ext2 noauto,noatime 1 2 #/dev/sda1 /boot vfat noauto 1 2 /dev/sda2 / ext3 noatime 0 1 /dev/sda3 none swap sw 0 0 ... Edit /etc/inittab, disable all terminals and enable the serial console: ... # TERMINALS #c1:12345:respawn:/sbin/agetty 38400 tty1 linux #c2:2345:respawn:/sbin/agetty 38400 tty2 linux #c3:2345:respawn:/sbin/agetty 38400 tty3 linux #c4:2345:respawn:/sbin/agetty 38400 tty4 linux #c5:2345:respawn:/sbin/agetty 38400 tty5 linux #c6:2345:respawn:/sbin/agetty 38400 tty6 linux # SERIAL CONSOLES s0:12345:respawn:/sbin/agetty 115200 ttyS0 vt100 #s0:12345:respawn:/sbin/agetty 9600 ttyS0 vt100 ... Edit /etc/conf.d/local.stop to make the LED orange on shutdown: ... # "/usr/local/bin/soundoff" here. echo default-on > /sys/class/leds/dockstar\:orange\:misc/trigger DockStar / # cp /usr/share/zoneinfo/UTC /etc/localtime Get the portage: DockStar / # emerge --sync ... DockStar / # eselect profile list ... USE="-perl" emerge -pv ntp rdate app-misc/screen u-boot-tools mtd-utils Install newer linux-headers, we are going to install a recent kernel: $ ACCEPT_KEYWORDS=~arm emerge linux-headers Enable necessary boot services and a password for root: $ ln -s /etc/init.d/net.lo /etc/init.d/net.eth0 $ rc-update add net.eth0 default * net.eth0 added to runlevel default $ rc-update add sshd default * sshd added to runlevel default $ rc-update add ntpd default * ntpd added to runlevel default $ passwd Edit /etc/conf.d/clock and set the timezone: ... TIMEZONE="UTC" ... edit /etc/init.d/udev to fix fsck issues since there is no RTC and no correct datetime at startup # we can speed up booting under these conditions: # * using devtmpfs so kernel creates device nodes for us # * only using kernel created device nodes at boot (in /etc/fstab and elsewhere) # ebegin "Waiting for uevents to be processed" udevadm settle --timeout=${udev_settle_timeout:-60} eend $? ebegin "Setting initial datetime due to missing RTC" # Take the newest time from the four times found through tune2fs to set the date. # This avoids a fsck if rdate or ntpd doesn't work. t=0 for i in 'Last write time:' 'Last mount time:' 'Filesystem created:' 'Last checked:' ; do tt=$(/bin/date -d "$(/sbin/tune2fs -l /dev/sda2 | /bin/grep "$i" | /bin/sed -e "s/$i \+//")" "+%s") if [ $tt -gt $t ]; then t=$tt fi done /bin/date -s @$t # Configure the network for ntp or rdate /sbin/ifconfig eth0 192.168.1.10 netmask 255.255.255.0 /sbin/route add default gw 192.168.1.254 #/usr/bin/rdate -s ip.timeserver # faster than NTP /usr/sbin/ntpdate -s -b -u 131.188.3.223 188.192.101.99 #/usr/sbin/ntpd -q -g # check /etc/ntp.conf eend $? udevadm control --property=do_not_run_plug_service= udevadm control --property=STARTUP= return 0 patch procps to avoid "unknow HZ value" in ps and top $ cd /usr/local/portage $ wget http://ahsoftware.de/dockstar/procps_ebuild.tar.bz2 $ tar -xvjpf procps_ebuild.tar.bz2 $ rm procps_ebuild.tar.bz2 $ cd sys-process/procps $ ebuild procps-3.2.8-r1.ebuild digest $ emerge -av procps Installation of the kernel (Linux) As kernel we are using the latest stable one and applying some patches. Depending on the time you read this you should change the version used in the URL for git clone to get the latest version. You might want to use screen for some of those steps below, if you want to turn your box off while the DockStar fetches or compiles the kernel. Again, go and drink a coffee or make your family happy after you've started this: $ mkdir /usr/src $ cd /usr/src $ git clone git://git.eu.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.38.y.git $ ln -s linux-2.6.38.y linux patches for the kernel (LEDs, MTD and to force the usage of the in-kernel commandline), apply them along with a ready to use kernel config: DockStar src # wget http://ahsoftware.de/dockstar/config-2.6.38-dockstar DockStar src # cp config-2.6.38-dockstar linux/.config DockStar src # cd linux DockStar linux # wget http://ahsoftware.de/dockstar/linux-2.6.38_patches_dockstar.tar.bz2 DockStar linux # tar xpjf linux-2.6.38_patches_dockstar.tar.bz2 DockStar linux # rm linux-2.6.38_patches_dockstar.tar.bz2 DockStar linux # git am 000* DockStar linux # rm 000* DockStar linux # git describe v2.6.38.2-3-gfddba4c DockStar linux # make oldconfig For not having to use the boot loader for changing the kernel command line, we are storing the command line in the kernel itself. If you want to use the netconsole you have to change the command line using "make menuconfig". This option can be found under "Boot options" and reads unmodified as: console=ttyS0,115200 root=/dev/sda2 rootdelay=5 With netconsole you should change it to something like this: console=ttyS0,115200 debug root=/dev/sda2 rootdelay=5 netconsole=@192.168.dockstar.ip/,@192.168.target.ip/ debug The documentation for the kernel parameter netconsole can be found in the file Documentation/networking/netconsole.txt. No other modifications are currently necessary, if you want to add some drivers for other USB-devices like WLAN-sticks or such, I suggest to do this after you've booted the new system. Now it's time to compile the kernel we want to use. And again, go and drink a coffee or make your family happy after you've started this: DockStar linux # make clean uImage modules modules_install Copy the kernel to the first partition (sda1, already mounted in a step above to /boot). If you have formatted the first partition as vfat, you have to skip the line where a symlink in /boot is created. This symlink is not really needed and just makes sure, that if someone (we don't) uses (partition1)/boot/uImage as filename in the boot loader to load the kernel it will be found. DockStar linux # ln -s . /boot/boot DockStar linux # cp /usr/src/linux/arch/arm/boot/uImage /boot If you later want to upgrade to a new version, the sequence would be: DockStar ~ # cd /usr/src/linux DockStar linux # git remote update DockStar linux # git rebase v2.6.38.n DockStar linux # make clean oldconfig uImage modules modules_install DockStar linux # mount /boot DockStar linux # mv /boot/uImage /boot/uImage.old DockStar linux # cp /usr/src/linux/arch/arm/boot/uImage /boot DockStar linux # umount /boot
First get the actual sources for U-Boot: DockStar linux # cd /usr/src DockStar src # git clone git://git.denx.de/u-boot.git patches are for a version of U-Boot which was current in February 2010 and don't apply cleanly to later versions. Reset the git tree to older version: DockStar src # cd u-boot DockStar u-boot # git reset --hard 77e7273c40315abd2f3c17ad8d46a78950e3e65f Apply some patches: DockStar u-boot # wget http://ahsoftware.de/dockstar/uboot_patches_dockstar.tar.bz2 DockStar u-boot # tar xpjf uboot_patches_dockstar.tar.bz2 DockStar u-boot # rm uboot_patches_dockstar.tar.bz2 DockStar u-boot # git am 00* DockStar u-boot # rm 00* Edit /usr/src/u-boot/include/configs/sheevaplug.h and change the following entries to reflect your MAC (found on the sticker at the bottom of the DockStar) and the IPs. 192.168.ip.netconsole is the IP of the box you want to use for netconsole. ... /* CHANGE THIS TO THE IPS YOU WANT TO USE! */ #define CONFIG_PREBOOT "setenv arcNumber 2097;setenv mainlineLinux yes;" \ "setenv ipaddr 192.168.ip.dockstar;setenv netmask 255.255.255.0;" \ "setenv ifnchostonline 'ping 192.168.ip.netconsole';" \ "setenv startnc 'setenv ncip 192.168.ip.netconsole;setenv stdin nc;setenv stdout nc;setenv stderr nc;version';" \ "run ifnchostonline startnc" ... /* CHANGE THIS TO THE MAC FOUND ON THE BOTTOM OF YOUR DOCKSTAR! */ #define CONFIG_ETHADDR 00:10:75:12:34:56 ... /* CHANGE THIS TO THE IPS YOU WANT TO USE! */ #define CONFIG_EXTRA_ENV_SETTINGS \ "x_bootargs=console=ttyS0,115200 netconsole=@192.168.ip.dockstar/,@192.168.ip.netconsole/ mtdparts="CONFIG_MTDPARTS \ Currently there exists a small problem when enabling netconsole in U-Boot, the netconsole from the kernel won't work. If the netconsole in U-Boot is not enabled, the netconsole from the kernel will work. So choose your poison. My preference is to leave the netconsole enabled in both, so I can use at least the shell from U-Boot without having to attach a serial cable to the device. Maybe someone will come up with a patch for U-Boot or the kernel later. If you don't want to use netconsole in U-Boot the entry for CONFIG_PREBOOT should just look like #define CONFIG_PREBOOT "setenv arcNumber 2097;setenv mainlineLinux yes" To disable netconsole in the kernel the first line of CONFIG_EXTRA_ENV_SETTINGS should look like "x_bootargs=console=ttyS0,115200 mtdparts="CONFIG_MTDPARTS \ In case you are wondering about the x_bootargs. Using my patches for the kernel they are not used and are just there if someone wants to use a vanilla kernel. This means to disable the netconsole in the kernel you have to change the commandline through menuconfig. If you have formated the first partition which contains the kernel with fat, you have to change the line with ext2load in that file to fatload, so it reads like "x_bootload_kernel=fatload usb 0:1 0x800000 /uImage\0" \ Now commit your changes and build U-Boot: DockStar u-boot # git commit -a -m "MyDockStar: My changes (MAC and IPs)" DockStar u-boot # git describe v2009.11-415-g388fcdc DockStar u-boot # ./mkDockStar.sh