Welcome! Log In Create A New Profile

Advanced

How to install Debian wheezy to a GoFlex Net

Posted by plasticassius 
How to install Debian wheezy to a GoFlex Net
October 26, 2014 02:18PM
I recently set up a GFN device; while it's working great for me now, I had some seriously frustrating problems getting it there. If I had come across this forum earlier, I might have been able to install with the instructions from http://projects.doozan.com/uboot/ or http://projects.doozan.com/debian/ but, I had already broken my Pogoplug installation through failed attempts to install OpenWrt.

Since it took me a long time to get my device set up, I wrote this summary to try and help other first timers to get started. I don't have any new development to offer, but I do have a few hints that should be useful for someone doing this for the first time:

******** Do not use flash memory to set up the GFN. ********

I am absolutely serious here! This was *by far* my biggest source of frustration and waste of time! Do not use USB flash memory! Do not use SD or micro SD memory! Do not use SD to USB adapters! Do not use SD to SATA adapters!

I tried to use each of those things and they *all* failed to work. Not only did they fail to work, they wasted a lot of my time because they seemed to work only to cause baffling and difficult to reproduce problems. While it may be possible to find brands of flash memory that work better than others, I don't see why it's worth it to try. Using flash memory to set up the GFN is a collosal waste of time. Now, I'm not a flash memory hater; I use it quite a bit. It's just that I had too many problems with it while setting up the GFN, and there's no need to use it.

That said, it turns out that after I got my GFN set up, I decided to run my Debian installation off a USB flash drive rather than off the hard drive. The reason for that is I wanted my hard drive to spin down while I wasn't using it. When the Debian installaton was booted from the hard drive, it would repeatedly spin down only to spin up again right away. Anyway, I don't have any problems now even though I boot from the USB flash memory, and I've been running this way for months now.

My best guess at why flash memory has these odd problems is that while I was setting up the GFN, I had the base open so that I could connect to the serial port. Since the base was open, the circuit board wasn't enclosed in it's shield, and produced enough interference to cause failures in the flash memory. Now that I have the GFN set up and the base closed, there isn't enough interference to make the flash memory fail. I can't say for sure that's the reason, but it makes sense to me for now.

******** Get a serial cable.

Unless you already have one, the first thing to do is order a USB To TTL UART converter cable. They are very cheap, and it's really not worth the effort to work without one. Some of the significant advantages are that you may be able to recover a bricked device and you can set one up in the first place without ever learning how to boot or use pogoplug software. Here is varkey's description of how to connect to the GoFlex Net serial port including a picture of the connector:

http://varkey.in/seagate-goflex-net-serial-connection/

You can follow that description exactly; however, there are many devices to choose from. I happened to have one with connectors that are too big to fit on the GoFlex Net so I removed the plastic from them, crunched them with some pliers, and wrapped them with tape. Eventually I found that they were too hard to work with so I soldered a connector (from a dead DVD player) that mates perfectly with the one in the GFN. Now my cable works every time.

While you're at it, get a power and data extension cable. Your hard drive will likely not fit into the device's socket, but you can attach it with an extension cable. Also, the GFN does not provide +12V to the drive, and since most drives require it, you can provide it by connecting the +12V wire from the power supply to the +12V wire on the extension cable.

******** Get kwboot.

The precompiled binary linked in davygravy's post worked for me:

http://forum.doozan.com/read.php?3,7852

I never figured out how to set permissions properly to get cu working. For kwboot, I just added myself to the dialout group (then logout and login again):

sudo usermod -a -G dialout $USER

kwboot works great as a simple terminal program:

kwboot -t /dev/ttyUSB0

and, will also load an alternate uboot via the UART:

kwboot -t /dev/ttyUSB0 -b uboot.goflexnet-IDEpatched-netconsoleON.kwb -p

This is handy for uboot testing and also provides a debricking method in the event of uboot problems. Definitely try testing any new uboot this way before flashing it.

******** Update U-Boot:

Since it's probably the safest way to go, I recommend that you follow instructions at

http://forum.doozan.com/read.php?3,12381

Definitely read and understand the entire post; however, it requires having a running linux system on the device already. I didn't have that benefit since I managed to mess up while installing OpenWrt. Installing uboot is the most sensitive step in the whole process as it has the potential to brick your device; so go carefully and slowly. I found that uboot.2014.07-tld-1.goflexnet.mtd0.kwb works well for me. To test it I used

kwboot -t /dev/ttyUSB0 -b uboot.2014.07-tld-1.goflexnet.mtd0.kwb -p

This downloaded and ran so I felt comfortable flashing it. I used some of the procedure at

http://wiki.openwrt.org/toh/seagate/goflexnet

to install uboot. And, I'll describe what I did. You can use tftp as described to get the uboot image to the device. Alternatively, you can transfer it with xmodem: Run

kwboot -t /dev/ttyUSB0

now, boot the device and stop it by hitting any key. Use the uboot command

print

to display all variables, and save away a copy of them from the terminal. I particular, you'll need ethaddr which stores the MAC address. While it should be possible to read the MAC address from the label on the device, mine was illegible. Type uboot command

loadx 0x6400000

then Ctrl-\c to exit kwboot. Now send the binary by xmodem:

sx -vv uboot.2014.07-tld-1.goflexnet.mtd0.kwb < /dev/ttyUSB0 > /dev/ttyUSB0

once it's transferred, return to kwboot:

kwboot -t /dev/ttyUSB0

Now hold your breath, erase the old uboot and write the new one:

nand erase 0x0 0x100000
nand write.e 0x6400000 0x0 0x80000

Breath again; if everything worked properly, you now have the new uboot installed. Again, remember that this has the potential to brick your device. So, be sure you understand what to do before you start. Also, I would highly recommend you read and understand the original articles I referenced here in addition to my summary.

******** Update U-Boot variables:

If you updated U-Boot you will need to update it's variables as well. Here is a print of mine except for ethaddr:

arcNumber=3089
baudrate=115200
bootargs_root=/dev/sda
bootargs_set=setenv bootargs console=$console root=$bootargs_root rootdelay=10 rootfstype=ext4 $mtdparts
bootcmd=run bootcmd_usb; run bootcmd_sata
bootcmd_rescue=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000
bootcmd_sata=run bootargs_set; ide reset; ext4load ide 0 0x800000 /boot/uImage; if ext4load ide 0 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
bootcmd_tftp=tftp 0x800000 uImage; tftp 0x1100000 uInitrd; run bootargs_set; bootm 0x800000 0x1100000
bootcmd_usb=run bootcmd_usb_if bootcmd_usb_do; usb stop
bootcmd_usb_do=setenv bootargs_root LABEL=rootfs; run bootargs_set; bootm 0x800000 0x1100000
bootcmd_usb_if=usb start && ext4load usb 0 0x800000 /boot/uImage && ext4load usb 0 0x1100000 /boot/uInitrd
bootdelay=3
console=ttyS0,115200
ethact=egiga0
led_error=orange blinking
led_exit=green off
led_init=green blinking
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
partition=nand0,2
stderr=serial
stdin=serial
stdout=serial

It turns out that there is not much of a buffer when typing into the serial port, so only paste one line at a time. After installing U-Boot, I was able to get to this set of variables by typing

setenv ethaddr XX:XX:XX:XX:XX:XX
setenv arcNumber 3089
setenv machid

setenv bootcmd_pogo
setenv set_bootargs_usb
setenv usb_boot
setenv usb_device
setenv usb_init
setenv usb_load_uimage
setenv usb_root
setenv usb_rootdelay
setenv usb_rootfstype

setenv bootargs_root '/dev/sda'
setenv bootargs_set 'setenv bootargs console=$console root=$bootargs_root rootdelay=10 rootfstype=ext4 $mtdparts'
setenv bootcmd 'run bootcmd_usb; run bootcmd_sata'
setenv bootcmd_rescue 'setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000'
setenv bootcmd_sata 'run bootargs_set; ide reset; ext4load ide 0 0x800000 /boot/uImage; if ext4load ide 0 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi'
setenv bootcmd_tftp 'tftp 0x800000 uImage; tftp 0x1100000 uInitrd; run bootargs_set; bootm 0x800000 0x1100000'
setenv bootcmd_usb 'run bootcmd_usb_if bootcmd_usb_do; usb stop'
setenv bootcmd_usb_do 'setenv bootargs_root LABEL=rootfs; run bootargs_set; bootm 0x800000 0x1100000'
setenv bootcmd_usb_if 'usb start && ext4load usb 0 0x800000 /boot/uImage && ext4load usb 0 0x1100000 /boot/uInitrd'

saveenv

This deserves some explanation: Set ethaddr to the MAC address value saved from before. Settings for arcNumber and machid are nicely described at

http://forum.doozan.com/read.php?3,12381

I also cleared variables for pogo and USB booting since I changed those functions significantly.

As you probably noticed, I decided to use only ext4 filesystems, but ext2 or ext3 might work as well.

My hard drive posed an additional point of confusion: It came with a docking station that consisted of a SATA to USB3 adapter. I partitioned and set it up via the USB3 interface, and then used the SATA interface to attach to my GoFlexNet. It took me quite a while to figure out that that as a SATA device it reported 512 byte logical sectors and 4096 byte logical sectors as a USB3 device. Since partition tables store offsets in terms of logical sectors, my partition tables were invalid when I switched interfaces. To handle this, I *did not* partition the hard drive, and made the whole drive an ext4 filesystem.

After getting my device to boot from SATA, I found that when the hard drive was the rootfs, it would constantly spin up and spin down. Since I wanted to be able to leave my device idle for long periods of time, I needed to boot from a USB flash device. It turns out that this works: Partition the USB device and label the partition rootfs for the kernel.

******** Install Linux:

Following bodhi's instructions at

http://forum.doozan.com/read.php?2,12096

download Debian-3.16.0-kirkwood-tld-2-rootfs-bodhi.tar.bz2 or other rootfs. You can download newer kernels from here such as linux-3.16.0-kirkwood-tld-3-bodhi.tar.bz2, but you need to get the Debian distribution working first.

Create a filesystem to load the distribution into:

sudo mkfs.ext4 -L rootfs /dev/sdc

The label rootfs is referenced through the U-boot variables and is needed when booting from USB in order for the kernel to identify the boot device.

Extract the distribution into the filesystem:

sudo tar -xjf Debian-3.16.0-kirkwood-tld-2-rootfs-bodhi.tar.bz2

After booting, login as root (password root). At this point it's good to change the password, and I like to remove the login message and change the host name in /etc/hostname:

passwd
rm /etc/motd

If there is no swap partition, a swap file can help:

fallocate -l 64K /swap
chmod 0600 /swap
mkswap /swap

Along with changing the filesystem of /dev/root to ext4, add the SATA drive and swap file mount lines to /etc/fstab:

/dev/sda /mnt ext4 noatime,errors=remount-ro 0 0
/swap swap swap defaults 0 0

Now, set the timezone:

dpkg-reconfigure tzdata

Change repositories in /etc/apt/sources.list according to https://www.debian.org/mirror/list:

apt-get update
apt-get upgrade

Follow the instructions to update to the appropriate kernel and reboot:

sync
reboot
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: