GoFlex Net + UBIT v0.6 + SATA kernel + Debian Squeeze + hacked Debian initrd June 12, 2011 12:30PM |
Registered: 12 years ago Posts: 128 |
mkdir -p /media/flash mount -t jffs2 /dev/mtdblock2 /media/flash/ cd /media/flash/ wget http://jeff.doozan.com/debian/goflex/v0.6/uInitrd wget http://jeff.doozan.com/debian/goflex/v0.6/ubit_start chmod +x ubit_start ./ubit_start uboot_install goflexnet chain_install goflexnet exit umount /media/flash/The most important thing is actually that "uboot_install goflexnet" and "chain_install goflexnet" don't report any errors, otherwise your bootloader won't work properly which effectively means a bricked device. Another thing is that ubit_start often complain about being unable to delete "/tmp/". This error can apparently be fixed by removing "&> /dev/null" in the definition of the unique_tmpdir () function in the script itself.
addr_kern=0x680000 addr_rd=0x1100000 arcNumber=3089 baudrate=115200 bootcmd=run usb_boot; run fast_boot; run hd_boot; run ubi_boot bootdelay=3 boot_kern=run set_bootargs; bootm $addr_kern boot_rd=run set_bootargs; bootm $addr_kern $addr_rd chain=nand read.e 0x800000 0x480000 0x80000; go 0x800200 console=ttyS0,115200 ethact=egiga0 ethaddr=AA:BB:CC:DD:EE:FF ext2_boot=run ext2_rd boot_rd; run boot_kern ext2_kern=ext2load $boot_dev $addr_kern /boot/uImage ext2_rd=ext2load $boot_dev $addr_rd /uInitrd fast_boot=run fast_rd ubi_args ubi_fallback fast_rd=ubifsmount fast; ubifsload $addr_rd /uInitrd fat_boot=run fat_rd boot_rd fat_kern=fatload $boot_dev $addr_kern /boot/uImage fat_rd=fatload $boot_dev $addr_rd /uInitrd hd_args_0=boot_dev='ide 0:1'; dev_args='root=/dev/sda1' hd_args_1=boot_dev='ide 1:1'; dev_args='root=/dev/sdb1' hd_boot=run ide_start; for scan in 0 1; do run hd_args_$scan ext2_kern ext2_boot; run ext2_rd ubi_fallback; run fat_kern fat_boot; run fat_rd ubi_fallback; done ide_start=ide reset ipaddr=10.0.10.6 led_error=orange blinking led_exit=green off led_init=green blinking mtdids=nand0=orion_nand mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data) ncip=10.10.10.5 ncipk=10.10.10.4 nc_start=setenv stdin nc; setenv stdout nc; setenv stderr nc; version nc_test=ping $ncip preboot=run nc_test nc_start rescue=dev_args='ubi.mtd=root rootfstype=preboot';run silent_hd ubi_fallback; run fast_rd ubi_fallback; run ubi_rd ubi_fallback serverip=10.10.10.3 set_bootargs=setenv bootargs console=$console $mtdparts $dev_args $rd_args netconsole=@$ipaddr/eth0,@$ncipk/ silent_boot=run silent_rd ubi_args ubi_fallback silent_rd=ubifsmount silent; ubifsload $addr_rd /uInitrd ubi_args=dev_args='ubi.mtd=root' ubi_boot=run ubi_rd ubi_args ubi_fallback ubi_fallback=run ubi_kern boot_rd ubi_kern=ubifsmount boot; ubifsload $addr_kern /boot/uImage ubi_rd=ubifsmount ramdisk; ubifsload $addr_rd /uInitrd ubi_start=ubi part root usb_args_0=boot_dev='usb 0:1'; dev_args='root=/dev/sda1 rootdelay=10' usb_args_1=boot_dev='usb 1:1'; dev_args='root=/dev/sdb1 rootdelay=10' usb_args_2=boot_dev='usb 2:1'; dev_args='root=/dev/sdc1 rootdelay=10' usb_args_3=boot_dev='usb 3:1'; dev_args='root=/dev/sdd1 rootdelay=10' usb_boot=run usb_start; for scan in 0 1 2 3; do run usb_args_$scan ext2_kern ext2_boot; run ext2_rd ubi_fallback; run fat_kern fat_boot; run fat_rd ubi_fallback;done usb_rootfstype=ext2 usb_start=usb start
ifconfig eth0:0 10.10.10.5 ifconfig eth0:1 10.10.10.4 ifconfig eth0:2 10.10.10.2After that open a few terminal windows and run
nc -lu 10.10.10.5 6666to monitor and control the UBIT and
nc -lu 10.10.10.4 6666to see the kernel log. What you'll also need is a usb flash with one ext2 partition. On that partition you should create a boot folder and put uImage to it. Also you should put uInitrd
/boot/uImage /uInitrdNow connect the flash drive to your GoFlex and turn it on. Via netconsole you should be able to see how UBIT finds your usb flash and loads the kernel and the ramdisk. When in the kernel log you see something like
sshd (1141): /proc/1141/oom_adj is deprecated, please use /proc/1141/oom_score_adj instead.then you should be able to ssh into the GoFlex. Use the web interface of your router to find out, which IP GoFlex is currently using. You should login as "root" and use the password "root". Once you have ssh access to the initramfs, you can easily recover by for example installing PlugBox on the ext2 partition of your usb flash. In fact, even if you want to install Debian, you should start with plugbox first, as debootstrap doesn't work properly when executed under initramfs. All you need to do to install PlugBox is to issue
on /dev/sda1 sh wget http://archlinuxarm.org/os/ArchLinuxARM-armv5te-latest.tar.gz -O rootfs.tar.gz tar -xzvf rootfs.tar.gzIf you now reboot, the probability is high, that you will boot into initramfs once again, because as I've alredy mentioned, the current UBIT ramdisk seems to have problems mounting the correct rootfs. To fix that, connect the usb flash to your PC and remove uInitrd from the root of the partition. Thus UBIT won't find any ram disk to load and the kernel will automatically mount /dev/sda1 as rootfs. Of course, this works only as long as you have no HDD connected to your system.
cp /goflex.debian-squeeze.sh /tmp/ cd /tmp chmod +x goflex.debian-squeeze.sh ./goflex.debian-squeeze.sh
nameserver 192.168.1.1Another strange problem I run into was that my time and date were completely wrong. I fixed that by issuing
date -s "11 Jun 2011 20:00:00"which set the current date.
cd /media/debian-partitition tar --one-file-system -cpf ~/GoFlex-Debian.tar *you should also backup the PlugBox partition
cd /media/plugbox-partitition tar --one-file-system -cpf ~/GoFlex-PlugBox.tar *or at least save a copy of /boot/uInit and uInitrd from that partition. Now use Gparted or whatever you want to delete all the partitions on the usb flash and divide it into two partitions: a large ext3 and a small swap (256-512mb). Put your debian tar on the ext3 partition by issuing sth like
cd /media/debian-ext3 tar -xf ~/GoFlex-Debian.tar *Don't forget to put /boot/uInit and uInitrd you've saved from the PlugBox partition to the new Debian partition, otherwise it won't boot. Unmount the flash drive, connect to the GoFlex and turn it on. If everything works out, Debian should boot nicely.
fw_setenv arcNumber "3089"Now we still have the problem (as described at the beginning of the posting), that as soon as GoFlex boots with a HDD connected, the probability is high that it won't boot properly. To fix this we really should use a ramdisk, since the kernel alone is not intellegent enough to mount the right rootfs. Debian's initrd is capable of mounting a rootfs by UUID or label but unfortunately I wasn't able to make UBIT hand over the label instead of the device name. No matter what I tried, as boot parameters kenel always had root=/dev/sda1 and not root=LABEL=rootfs as I intended to. So I decided to hack the initrd, by making it always mount the partition with the label "rootfs" as rootfs. Here's how you can do it from Debian
apt-get install nano cd /boot mkdir initrd.img-new cp initrd.img-2.6.32-5-kirkwood initrd.img-new/ cd initrd.img-new/ gzip -dc initrd.img-2.6.32-5-kirkwood | cpio -id rm initrd.img-2.6.32-5-kirkwood nano initin nano find the part which looks like
if [ -n "${noresume}" ]; then export noresume unset resume else resume=${RESUME:-} fiand add the following line
ROOT="/dev/disk/by-label/rootfs"Save your changes (Ctrl-W) and exit (Ctrl-X) nano. Use
find ./ | cpio -H newc -o > new-initrd gzip new-initrd mv new-initrd.gz initrd.img mkimage -A arm -O linux -T ramdisk -C gzip -a 0 -e 0 -n "clever-initrd" -d initrd.img /uInitrdto create a new uInitrd and put it into the root of rootfs. This way your GoFlex should always boot correctly, no matter whether HDDs are present or not. Just don't forget to label the rootfs partition on your usb flash as "rootfs"
Re: GoFlex Net + UBIT v0.6 + SATA kernel + Debian Squeeze + hacked Debian initrd June 15, 2011 06:31AM |
Registered: 13 years ago Posts: 1 |
Adeon
Re: GoFlex Net + UBIT v0.6 + SATA kernel + Debian Squeeze + hacked Debian initrd June 22, 2011 01:37AM |
Re: GoFlex Net + UBIT v0.6 + SATA kernel + Debian Squeeze + hacked Debian initrd July 04, 2011 09:34AM |
Registered: 13 years ago Posts: 161 |
Re: GoFlex Net + UBIT v0.6 + SATA kernel + Debian Squeeze + hacked Debian initrd July 08, 2011 09:46AM |
Registered: 13 years ago Posts: 7 |
Re: GoFlex Net + UBIT v0.6 + SATA kernel + Debian Squeeze + hacked Debian initrd July 08, 2011 01:01PM |
Registered: 13 years ago Posts: 161 |
U-Boot 2010.09 (Oct 23 2010 - 11:49:22) Marvell-Dockstar/Pogoplug by Jeff Doozan
root@debian:~# cat /proc/cmdline console=ttyS0,115200 root=LABEL=ROOTFS rootdelay=10 rootfstype=ext3 mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)