Welcome! Log In Create A New Profile

Advanced

HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net

Posted by Vlad 
HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 06, 2011 05:55PM
In this HOWTO I'd like to explain how to compile a custom 2.6.38.8 kernel for the GoFlex Net. I did this on Kubuntu 11.04 but I guess that every other Debian based distro should be fine as well.

First we should install the necessary packages:
sudo apt-get install aptitude libncurses5 libncurses5-dev qt3-dev-tools libqt3-mt-dev build-essential fakeroot kernel-package libncurses5 libncurses5-dev patch
Now we want to setup the codesourcery compiler via setup_codesourcery.sh script by Matthias "Maddes" Buecher. I attached the script to this post, but you can find this script on many sites, for example here. We can simply get the script via wget
mkdir ~/Kernel
cd ~/Kernel
wget http://ftp.maddes.net/hardware/Linkstation/setup_codesourcery.sh
Now let's install the compiler
chmod +x setup_codesourcery.sh
sudo ./setup_codesourcery.sh
We also need a kernel patch for the GoFlex Net. I got one mine from varkey's page but I had to delete the last 7 lines since they were already in the kernel source. So just download the goflex-2.6.38.patch file I attached to this post and put it to ~/Kernel. What you also need is a kernel config file. To make things a bit easier I've already attached one (.config) for you. You must put it to ~/Kernel too.

Ok, let's get the kernel source and extract it
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.38.8.tar.bz2
tar xjvf linux-2.6.38.8.tar.bz2 
cd linux-2.6.38.8
The next step is to patch the kernel and copy the config file
patch -p1 < ../goflex-2.6.38.patch
cp ../.config .
After that we go to the crosscompile environment and import the config.
codesourcery-arm-2009q3.sh
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- oldconfig
At this stage you might be asked some questions about kernel options (probably not). It's safe to answer all questions by hitting Enter which means accepting the default setting.

Now you can perform the custom configuration of your kernel
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- xconfig
For the first time I suggest that you don't change anything, just to make sure that your custom kernel boots at all. Later you can recompile the kernel and change whatever you want.

Finally, let's build the kernel
make-kpkg --rootcmd fakeroot --arch armel --cross-compile arm-none-linux-gnueabi- --append-to-version=-goflex --revision=1.1 --initrd binary

On my laptop with C2D T5500 and 3GB RAM the build process takes about 40 Minutes. When finished, in ~/Kernel you will find a file called linux-image-2.6.38.8-goflex-ubit_1.1_armel.deb. Copy this to your GoFlex Net, for example to /root.
scp ~/Kernel/linux-image-2.6.38.8-goflex-ubit_1.1_armel.deb root@ip-of-the-goflex:/root
Now login to your GoFlex Net via ssh and install the kernel
ssh root@ip-of-the-goflex
-> Pass
cd /root
dpkg -i linux-image-2.6.38.8-goflex-ubit_1.1_armel.deb
The last step is to create uImage und uInitrd for uBoot/UBIT but also backup to the old ones
cd /boot
cp uImage uImage.old
cp uInitrd uInitrd.old
mkimage -A arm -O linux -T kernel  -C none -a 0x00008000 -e 0x00008000 -n Linux-2.6.38.8 -d /boot/vmlinuz-2.6.38.8-goflex-ubit /boot/uImage
mkimage -A arm -O linux -T ramdisk -C gzip -a 0 -e 0 -n Linux-2.6.38.8  -d /boot/initrd.img-2.6.38.8-goflex-ubit /boot/uInitrd

Done! Next time you reboot your GoFlex Net it should boot with the new kernel. If something goes wrong, just connect your USB/HDD with the rootfs to a Linux machine, mount the filesystem and do
cp /path-to-rootfs/boot/uImage.old /path-to-rootfs/boot/uImage
cp /path-to-rootfs/boot/uInitrd /path-to-rootfs/boot/uInitrd
This will give you the old kernel back

Finding the right boot partition

GoFlex Net has problems to boot from a USB flash drive when there are SATA hard drives attached. The solution you have to apply depends on whether you have Jeff's u-Boot bootloader or the UBIT bootloader.
  • If you initially installed Debian using Jeff's script then you have u-Boot.
  • If you initially installed Arch using instructions from the Arch Linux ARM site then you have UBIT
Independent of the solution you are going to use, it's mandatory to label your rootfs partition as "rootfs". To do this, connect your USB flash drive to a Linux box and issue
sudo tune2fs -L "rootfs" /dev/whatever
where /dev/whatever is the path to the partition containing the rootfs for GoFlex Net

Solution for uBOOT

On the GoFlex run
fw_setenv usb_init "run usb_scan; setenv usb_root LABEL=rootfs"
after that reboot and you're done. For more information on this solution check out this thread

Solution for UBIT aka hacked initrd

If you have UBIT you still may try the uBOOT solution but the chances are high that it simply won't work. In this case you should do the following.

On the GoFlex Net run
cd /boot
mkdir initrd.img-new          
cp initrd.img-2.6.38.8-goflex-ubit initrd.img-new/
cd initrd.img-new/
gzip -dc initrd.img-2.6.38.8-goflex-ubit | cpio -id
rm initrd.img-2.6.38.8-goflex-ubit
nano init
Find the section which looks like
if [ -n "${noresume}" ]; then
export noresume
unset resume
else
resume=${RESUME:-}
fi
and replace it by
if [ -n "${noresume}" ]; then
export noresume
unset resume
else
resume=${RESUME:-}
fi
ROOT="/dev/disk/by-label/rootfs"
Save your changes (Ctrl+W) and exit (Ctrl+X) nano. Now run
find ./ | cpio -H newc -o > initrd.img-2.6.38.8-goflex-ubit
gzip -9 initrd.img-2.6.38.8-goflex-ubit
mv initrd.img-2.6.38.8-goflex-ubit.gz ..//initrd.img-2.6.38.8-goflex-ubit_mod
cd ..
rm -r initrd.img-new
mkimage -A arm -O linux -T ramdisk -C gzip -a 0 -e 0 -n Linux-2.6.38.8  -d /boot/initrd.img-2.6.38.8-goflex-ubit_mod /uInitrd
The purpose of all this is to hardcode a rootfs partition. In this case we tell the kernel (via initramfs) that the rootfs partition is a partition with the label "rootfs". This is a very ugly hack but it works when everything doesn't.

Hacking kernel sources
In ~/Kernel you will also find a package containing kernel sources (linux-image-2.6.38.8-goflex-ubit_1.1_armel.deb) that might be necessary for compiling some modules/utilities on the GoFlex Net. For some reason this package contains a lot of X11 related dependencies which are definitely not needed for a headless server. I solved this by simply removing those by hand.
cd ~/Kernel
dpkg-deb -x linux-headers-2.6.38.8-goflex-ubit_1.1_armel.deb linux-headers-2.6.38.8-goflex-ubit_1.1_armel_hacked
dpkg-deb -e linux-headers-2.6.38.8-goflex-ubit_1.1_armel.deb linux-headers-2.6.38.8-goflex-ubit_1.1_armel_hacked/DEBIAN
nano linux-headers-2.6.38.8-goflex-ubit_1.1_armel/debian/control
replace
Depends: libaudio2, libc6 (>= 2.8), libfontconfig1 (>= 2.8.0), libfreetype6 (>= 2.2.1), libgcc1 (>= 1:4.1.1), libice6 (>= 1:1.0.0), libjpeg62 (>= 6b1), libpng12-0 (>= 1.2.13-4), libqt3-mt (>= 3:3.3.8-b), libsm6, libstdc++6 (>= 4.1.1), libx11-6, libxcursor1 (>> 1.1.2), libxext6, libxft2 (>> 2.1.1), libxi6, libxinerama1, libxrandr2, libxrender1, libxt6, zlib1g (>= 1:1.1.4)
by
Depends: libc6 (>= 2.8), libgcc1 (>= 1:4.1.1), libjpeg62 (>= 6b1), libpng12-0 (>= 1.2.13-4), libstdc++6 (>= 4.1.1), zlib1g (>= 1:1.1.4)
and do
dpkg-deb -b linux-headers-2.6.38.8-goflex-ubit_1.1_armel_hacked
After that you can install the modified package the usual way.
scp ~/Kernel/linux-headers-2.6.38.8-goflex-ubit_1.1_armel_hacked.deb root@ip-of-the-goflex:/root
ssh root@ip-of-the-goflex
cd /root
dpkg -i linux-headers-2.6.38.8-goflex-ubit_1.1_armel_hacked.deb



Edited 6 time(s). Last edit at 09/24/2011 08:22AM by Vlad.
Attachments:
open | download - .config (72.3 KB)
open | download - goflex-2.6.38.patch (8.8 KB)
open | download - setup_codesourcery.sh (3.8 KB)
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 07, 2011 12:48AM
Hi Vlad,
nice post! A few questions:

1. Does this kernel boot with UBIT or only UBOOT ?
2. Does this kernel also work with Dockstar ?
3. Does the kernel support the SATA ports ?
4. Does the kernel boot from SATA ?
5. Does the kernel also boot from Sheeva?
6. Does the kernel support WIFI ?

I think that all are options you can choose. Maybe someone already get this all to work and give some hints!

Greetings
Thomas
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 07, 2011 05:21AM
Hi squeezeplug,

1. I use it with UBIT but I can't think of any reason why it shouldn't work on uBOOT too.
2. If you use my kernel config without any changes, it will boot only on GoFlex (Net) and Dockstar.
3. Yes, full SATA support
4. Didn't try it out myself, but actually this should work too
5. Not by default. When you do the configuration part via
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- xconfig
just go to System type -> Marvell Kirkwood Implementations and select "Marvell SheevaPlug Reference Board" and "Marvell eSATA SheevaPlug Reference Board" Then it probably should work with Sheeva.
6. I guess so (Networking Support - > Networking Options -> Wireless is enabled), but it's a bit hard to say since I don't use WiFi on my GoFlex.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 07, 2011 06:00AM
Hi Vlad,

very helpful informations! Good to hear it works with UBIT. I like UBIT very much, because we have a way back to the original Pogo system and UBIT allways boots (no trouble with USB-Sticks).

A friend of mine and I, we are working on a kernel supporting all this stuff. We only have some problems to boot with UBIT and from Sheeva. Maybe we can learn some things out of your config. My friend also added some patches according to sound problems with usb soundcards. The WIFI thing already works great.

Wouldn't it be great to have a kernel running on all devices (Dockstar, Goflex, Sheeva) and supporting WIFI?!

Greetings,
Thomas



Edited 1 time(s). Last edit at 09/07/2011 06:01AM by squeezeplug.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 07, 2011 11:45AM
^ You can try this Kernel and see -- http://www.varkey.in/files/kernel-goflex-dockstar-2.6.38.8-varkey.deb

Has support for Dockstar, GoFlex, Sheeva and Realtek and few other wifi drivers inbuilt! :)
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 07, 2011 12:33PM
Hi varkey,
sounds good, I'll give that I try later. Could you eventually send me your kernel config, so I could see what's the difference between ours and your's. Maybe we could merge things together to get a kernel supporting all things inclusive the sound patch ?!

That would be great!

Greetings,
Thomas



Edited 1 time(s). Last edit at 09/07/2011 12:35PM by squeezeplug.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 07, 2011 12:59PM
Hi varkey,
I get the following:
root@squeezeplug:/# wget http://www.varkey.in/files/kernel-goflex-dockstar-2.6.38.8-varkey.deb
--2011-09-07 17:52:08--  http://www.varkey.in/files/kernel-goflex-dockstar-2.6.38.8-varkey.deb
Resolving www.varkey.in... 66.7.207.80
Connecting to www.varkey.in|66.7.207.80|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 10102906 (9.6M) [text/plain]
Saving to: `kernel-goflex-dockstar-2.6.38.8-varkey.deb'

100%[======================================>] 10,102,906   389K/s   in 27s

2011-09-07 17:52:35 (369 KB/s) - `kernel-goflex-dockstar-2.6.38.8-varkey.deb' saved [10102906/10102906]

root@squeezeplug:/# dpkg -i kernel-goflex-dockstar-2.6.38.8-varkey.deb
Selecting previously deselected package linux-image-2.6.38.8-varkey.
(Reading database ... 10925 files and directories currently installed.)
Unpacking linux-image-2.6.38.8-varkey (from kernel-goflex-dockstar-2.6.38.8-varkey.deb) ...
Done.
Setting up linux-image-2.6.38.8-varkey (1.0) ...

 Hmm. There is a symbolic link /lib/modules/2.6.38.8-varkey/build
 However, I can not read it: No such file or directory
 Therefore, I am deleting /lib/modules/2.6.38.8-varkey/build


 Hmm. The package shipped with a symbolic link /lib/modules/2.6.38.8-varkey/source
 However, I can not read the target: No such file or directory
 Therefore, I am deleting /lib/modules/2.6.38.8-varkey/source

Running depmod.
Examining /etc/kernel/postinst.d.
root@squeezeplug:/# cd /boot/
root@squeezeplug:/boot# /usr/bin/mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-2.6.37.6 -d /boot/vmlinuz-2.6.37.6-goflex /boot/uImage
-bash: /usr/bin/mkimage: No such file or directory

any idea?
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 07, 2011 01:34PM
You are missing mkimage.
apt-get install uboot-mkimage uboot-envtools
cd /boot/
/usr/bin/mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-2.6.37.6 -d /boot/vmlinuz-2.6.37.6-goflex /boot/uImage

As far as the kernel config is concerned you may try to get it via
zcat /proc/config.gz > .config



Edited 1 time(s). Last edit at 09/07/2011 01:35PM by Vlad.
I've trying to build a custom ubit kernel using these instructions however I'm getting this error running one of the mkimage commands on the goflex after installing the .deb package.

# mkimage -A arm -O linux -T ramdisk -C gzip -a 0 -e 0 -n Linux-2.6.38 -d /boot/initrd.img-2.6.38-goflex-ubit_mod /boot/uInitrd
mkimage: Can't open  /boot/initrd.img-2.6.38-goflex-ubit_mod: No such file or directory

The file /boot/initrd.img-2.6.38-goflex-ubit_mod does not get built/included in the .deb.

# dpkg -c linux-image-2.6.38.8-goflex-ubit_1.1_armel.deb | grep goflex-ubit_mod

Shows the file is not in the package and I get no errors from the .deb build.

What am I missing?

Thanks,

Ralphy
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 08, 2011 05:48PM
Sorry, there was a typo in the Howto. You should run
# mkimage -A arm -O linux -T ramdisk -C gzip -a 0 -e 0 -n Linux-2.6.38 -d /boot/initrd.img-2.6.38-goflex-ubit /boot/uInitrd
instead. Just look at
ls -al /boot
no initrd.img-2.6.38-goflex-ubit_mod but a initrd.img-2.6.38-goflex-ubit ;)
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 06:22AM
Hi Vlad,
if you run the scipt for setting up the crosscompiler on Ubuntu 11.4 you will get an error, because aptitude is missing. Maybe you should include aptitude in the list of the necessary packages.

I can't test the rest, because www.kernel.org is down the last hours.

Greetings,
Thomas
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 07:06AM
Thanks for pointing that out. I've just updated the HOWTO accordingly.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 08:10AM
Oh yeah, kernel.org was hacked a little while ago. The kernel tree is being maintained at github for the time being:
https://github.com/torvalds/linux
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 12:29PM
H Vlad,
Ralphy and me build a kernel with your config. On DS the kernel works well. On GF the systems hangs with an error. I've attached the output!

Do you have an idea?

Thanks and Greetings,
Thomas
Attachments:
open | download - VLAD_UBIT.log (13.6 KB)
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 01:20PM
squeezeplug Wrote:
-------------------------------------------------------
> H Vlad,
> Ralphy and me build a kernel with your config. On
> DS the kernel works well. On GF the systems hangs
> with an error. I've attached the output!
>
> Do you have an idea?
>
> Thanks and Greetings,
> Thomas

Looks like the kernel can't find your rootfs. Actually, I had a similar issue and even posted a solution in one of my earlier
posts (by the way a quite informative one), but because some people argued that they didn't experience this kind of problems, I left it out here. Anyway, I've updated the guide once again, covering that final step ("Hacking initrd"). Hope it helps.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 03:52PM
Hi Vlad,
thanks for that! Are you sure this should work? I tried it from my working DS, because I can't do it on a non working GF.

The kernel boots fine with Jeff's bootloader and I think I can live with that.

My other problem is the SheevaPlug device. I like to use the same image with the same kernel on Sheeva, but I got lost. Have you done this? Do you know the UBoot environment parameters to boot a DS Image (ported to MMC) on Sheeva?

Greetings,
Thomas
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 03:52PM
Look here for a much cleaner solution:
http://forum.doozan.com/read.php?2,5552,5552

You don't need to modify with the init script from the initrd image. The init script does this already by default if you just simply pass the kernel the root locaton using a label. For your example above, you just need to pass the kernel "root=LABEL=rootfs".
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 04:47PM
kraqh3d Wrote:
-------------------------------------------------------
> Look here for a much cleaner solution:
> http://forum.doozan.com/read.php?2,5552,5552
>
> You don't need to modify with the init script from
> the initrd image. The init script does this
> already by default if you just simply pass the
> kernel the root locaton using a label. For your
> example above, you just need to pass the kernel
> "root=LABEL=rootfs".

While I agree that my workaround is nothing more than an ugly hack, I must also warn, that the "cleaner solution" doesn't work with UBIT, only uBOOT. I've just did a little experiment:
  • Took my GoFlex Net with UBIT v0.6
  • Took Jeffs' 2.6.37 kernel and unmodified initrd from my custom kernel
  • Changed the firmware environment as described
#fw_setenv usb_init "run usb_scan; setenv usb_root LABEL=rootfs" 
#fw_printenv | grep usb_init
usb_init=run usb_scan; setenv usb_root LABEL=rootfs
  • The rootfs partition is of course labeled "rootfs"
  • Booted without any harddrives attached.
Check out the kernel parameters:
cat /proc/cmdline
console=ttyS0,115200 mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data) root=/dev/sda1 rootdelay=10 netconsole=@10.0.10.6/eth0,@10.10.10.4/
    Now reboot with both HDDs attached and watch the boot process via netconsole
....
Registering the dns_resolver key type
registered taskstats version 1
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
Freeing init memory: 164K
scsi 2:0:0:0: Direct-Access     SanDisk  Cruzer           7.01 PQ: 0 ANSI: 0 CCS
sd 2:0:0:0: [sdc] 7905279 512-byte logical blocks: (4.04 GB/3.76 GiB)
sd 2:0:0:0: [sdc] Write Protect is off
sd 2:0:0:0: [sdc] Assuming drive cache: write through
sd 2:0:0:0: Attached scsi generic sg2 type 0
sd 2:0:0:0: [sdc] Assuming drive cache: write through
 sdc: sdc1 sdc2
sd 2:0:0:0: [sdc] Assuming drive cache: write through
sd 2:0:0:0: [sdc] Attached SCSI removable disk
at this point the kernel simply freezes. Now take my custom vanilla kernel instead:
....
Registering the dns_resolver key type
registered taskstats version 1
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
Waiting 10sec before mounting root device...
scsi 2:0:0:0: Direct-Access     SanDisk  Cruzer           1.10 PQ: 0 ANSI: 2
sd 2:0:0:0: Attached scsi generic sg2 type 0
sd 2:0:0:0: [sdc] 31266816 512-byte logical blocks: (16.0 GB/14.9 GiB)
sd 2:0:0:0: [sdc] Write Protect is off
sd 2:0:0:0: [sdc] Assuming drive cache: write through
sd 2:0:0:0: [sdc] Assuming drive cache: write through
 sdc: unknown partition table
sd 2:0:0:0: [sdc] Assuming drive cache: write through
sd 2:0:0:0: [sdc] Attached SCSI removable disk
scsi 3:0:0:0: Direct-Access     SanDisk  Cruzer           7.01 PQ: 0 ANSI: 0 CCS
sd 3:0:0:0: Attached scsi generic sg3 type 0
sd 3:0:0:0: [sdd] 7905279 512-byte logical blocks: (4.04 GB/3.76 GiB)
sd 3:0:0:0: [sdd] Write Protect is off
sd 3:0:0:0: [sdd] Assuming drive cache: write through
sd 3:0:0:0: [sdd] Assuming drive cache: write through
 sdd: sdd1 sdd2
sd 3:0:0:0: [sdd] Assuming drive cache: write through
sd 3:0:0:0: [sdd] Attached SCSI removable disk
Unable to handle kernel NULL pointer dereference at virtual address 000001bc
pgd = c0004000
[000001bc] *pgd=00000000
Internal error: Oops: 5 [#1]
last sysfs file: 
Modules linked in:
CPU: 0    Not tainted  (2.6.38.8-goflex-ubit #5)
PC is at blkdev_get+0x20c/0x294
LR is at blkdev_get+0x20c/0x294
pc : [<c00c3d80>]    lr : [<c00c3d80>]    psr: 60000013
sp : c7827e30  ip : 00000001  fp : 00000000
r10: 00000000  r9 : c7402390  r8 : fffffffa
r7 : 00000083  r6 : c04e0368  r5 : c7402380  r4 : c7402540
r3 : 00000000  r2 : 00000000  r1 : c7402564  r0 : c06963f8
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: 0005397f  Table: 00004000  DAC: 00000017
Process swapper (pid: 1, stack limit = 0xc7826270)
Stack: (0xc7827e30 to 0xc7828000)
7e20:                                     00000003 c7402564 c7827e44 00000004
7e40: 00000000 00800011 c7405600 00000001 00000000 c7402380 00000083 c04e0368
7e60: 00008000 c04e0368 00008000 00000000 00000000 c00c3ee8 c7b0a0a0 00000083
7e80: 00008000 c009f0a4 c058012c c058012c 00000000 0000000a c7b08ac0 c7b0a110
7ea0: 00000000 c7b08aa0 c7b08aa0 c7b0a0a0 c04e0368 c7b08ac0 00008000 00000000
7ec0: c7b08b00 c00ef864 c00f1110 00008000 c7b08ac0 c009dfa8 c04e0368 00008000
7ee0: c04e0368 c7b08b00 00000000 c7b08ac0 00008000 c009e104 00000020 c7b08ac0
7f00: 00000000 00008000 00000000 c00b3f18 0000000a c00832cc 00000000 0000000a
7f20: c78180a0 c7405600 c7815000 c044bc15 00000000 00008000 c044bc15 00000000
7f40: 00000000 c00b4008 00000000 c044bc15 00000000 00000000 c7b08ac0 c7b08b00
7f60: c78110f8 c7811000 c7811000 00008000 c0025394 c0008b60 00000000 c7811000
7f80: c7811000 c0008de4 c04dc1f0 5c2d2f7c c002c900 00000013 00000080 c00253f4
7fa0: 00000080 c7811000 00000013 00800011 c00253a9 c002c908 00000013 00000000
7fc0: 00000000 c0008f9c 00000000 00000000 c04fbb20 c0009120 fffffffe c7401ee8
7fe0: ffffff9c c04fbac0 c0008334 c000843c 00000000 c002c908 08e75e16 2ced0aac
[<c00c3d80>] (blkdev_get+0x20c/0x294) from [<c00c3ee8>] (blkdev_get_by_path+0x28/0x64)
[<c00c3ee8>] (blkdev_get_by_path+0x28/0x64) from [<c009f0a4>] (mount_bdev+0x30/0x188)
A kernel panic, which, however, doesn't make much difference. I really think that this has something to do with UBIT because all the people from the thread you linked seem to use uBOOT.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 04:56PM
squeezeplug Wrote:
-------------------------------------------------------
> Hi Vlad,
> thanks for that! Are you sure this should work? I
> tried it from my working DS, because I can't do it
> on a non working GF.

It works on my GoFlex Net, that's all I can say. By the way, if you followed my guide, you should still have your old uImage and uInitrd named uImage.old and uInitrd.old. If you rename them to uImage and uInitrd your GoFlex should boot as it did before.

>
> The kernel boots fine with Jeff's bootloader and I
> think I can live with that.
>
Dockstar doesn't really need UBIT. Jeff's uBoot is fine.

> My other problem is the SheevaPlug device. I like
> to use the same image with the same kernel on
> Sheeva, but I got lost. Have you done this? Do you
> know the UBoot environment parameters to boot a DS
> Image (ported to MMC) on Sheeva?

Unfortunately, I have no SheevaPlug, so I can't really help you here.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 05:32PM
It will work. This is one of the purposes of using an initrd. Post the full environment. It likely needs to be added someplace else so it doesn't get over written by the uboot script. And try it with the uboot scripts. Just break into the boot sequence and force everything to occur manually.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 05:46PM
Here you are. But frankly speaking I don't see much purpose in applying the other solution apart from the aesthetic reasons. Debian can only modify your initrd but not the uInitrd. Thus it definitely won't get overwritten. Moreover, I wouldn't suggest that newbies mess with the environment variables. An ugly initrd is a much lesser evil than a hosed bootloader environment.

ethact=egiga0
bootdelay=3
baudrate=115200
mainlineLinux=yes
console=ttyS0,115200
led_init=green blinking
led_exit=green off
led_error=orange blinking
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
mtdids=nand0=orion_nand
partition=nand0,2
stdin=serial
stdout=serial
stderr=serial
rescue_installed=0
rescue_set_bootargs=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts $rescue_custom_params
rescue_bootcmd=if test $rescue_installed -eq 1; then run rescue_set_bootargs; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000; else run pogo_bootcmd; fi
pogo_bootcmd=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi
force_rescue=0
force_rescue_bootcmd=if test $force_rescue -eq 1 || ext2load usb 0:1 0x1700000 /rescueme 1 || fatload usb 0:1 0x1700000 /rescueme.txt 1; then run rescue_bootcmd; fi
ubifs_mtd=3
ubifs_set_bootargs=setenv bootargs console=$console ubi.mtd=$ubifs_mtd root=ubi0:rootfs rootfstype=ubifs $mtdparts $ubifs_custom_params
ubifs_bootcmd=run ubifs_set_bootargs; if ubi part data && ubifsmount rootfs && ubifsload 0x800000 /boot/uImage && ubifsload 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; fi
usb_scan=usb_scan_done=0;for scan in $usb_scan_list; do run usb_scan_$scan; if test $usb_scan_done -eq 0 && ext2load usb $usb 0x800000 /boot/uImage 1; then usb_scan_done=1; echo "Found bootable drive on usb $usb"; setenv usb_device $usb; setenv usb_root /dev/$dev; fi; done
usb_scan_list=1 2 3 4
usb_scan_1=usb=0:1 dev=sda1
usb_scan_2=usb=1:1 dev=sdb1
usb_scan_3=usb=2:1 dev=sdc1
usb_scan_4=usb=3:1 dev=sdd1
usb_device=0:1
usb_root=/dev/sda1
usb_rootfstype=ext2
usb_rootdelay=10
usb_set_bootargs=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts $usb_custom_params
usb_bootcmd=run usb_init; run usb_set_bootargs; run usb_boot
usb_boot=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage; if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
bootcmd=usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run rescue_bootcmd; run pogo_bootcmd; reset
ethaddr=**********************
arcNumber=3089
ipaddr=10.0.10.6
ncip=10.10.10.5
ncipk=10.10.10.4
serverip=10.10.10.3
preboot=run nc_test nc_start
nc_test=ping $ncip
nc_start=setenv stdin nc; setenv stdout nc; setenv stderr nc; version
hd_args_0=boot_dev='ide 0:1'; dev_args='root=LABEL=rootfs'
hd_args_1=boot_dev='ide 1:1'; dev_args='root=LABEL=rootfs'
usb_args_0=boot_dev='usb 0:1'; dev_args='root=LABEL=rootfs rootdelay=10'
usb_args_1=boot_dev='usb 1:1'; dev_args='root=LABEL=rootfs rootdelay=10'
usb_args_2=boot_dev='usb 2:1'; dev_args='root=LABEL=rootfs rootdelay=10'
usb_args_3=boot_dev='usb 3:1'; dev_args='root=LABEL=rootfs rootdelay=10'
usb_init=run usb_scan
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 06:16PM
Strange. It looks like it should work. Mind trying a manual boot?

usb start
run usb_scan
setenv usb_root LABEL=rootfs
run usb_set_bootargs
printenv usb_set_bootargs
run usb_boot

The hd_args and usb_args seem like attempts to do the same thing, but I dont see them being referenced anywhere.

Booting from a label or uuid is the better way to go. You're doing that by force the init script to look for a particular hard coded label. But the init script will do that on it's own if passed a label or uuid.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 07:44PM
Strange indeed. hd_args and usb_args come from my previous attempts to make it work. At the beginning I also wanted to go the clean way, but after everything else failed, a hacked initrd was the only thing left.

I've just tried to pass
#fw_setenv usb_bootcmd "run usb_init; run usb_set_bootargs; usb_root=LABEL=rootfs; run usb_boot"
which is like the closest point you can get.

This gave me some interesting results. First I've tried the usual way: rootfs on a USB flash drive + 2 data HDDs -> no luck. Then I removed the HDDs and connected a USB hub with 4 USB flash drives. To my surprise, this time LABEL=rootfs worked!

cat /proc/cmdline
console=ttyS0,115200 mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data) root=/dev/sdd1 rootdelay=10 netconsole=@10.0.10.6/eth0,@10.10.10.4/

This means, the option is applied but somehow the presence of HDDs seems to confuse UBIT that much, that it fails to provide a proper USB boot. To me this looks pretty much like a UBIT bug, but I'm not sure.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 09, 2011 08:59PM
That's not going to work because "run usb_set_bootargs" sets the bootargs variable which references "root=$usb_root". Altering usb_root after that does nothing at all to change your kernel boot parameters. It's already been defined according to usb_root=/dev/$dev at the end of usb_scan.

This is the relevant bit from my environment:

usb_scan=usb_scan_done=0;for scan in $usb_scan_list; do run usb_scan_$scan; if test $usb_scan_done -eq 0 && ext2load usb $usb 0x800000 /boot/uImage 1; then usb_scan_done=1; echo "Found bootable drive on usb $usb"; setenv usb_device $usb; setenv usb_root /dev/$dev; fi; done
usb_scan_list=1 2 3 4
usb_scan_1=usb=0:1 dev=sda1
usb_scan_2=usb=1:1 dev=sdb1
usb_scan_3=usb=2:1 dev=sdc1
usb_scan_4=usb=3:1 dev=sdd1
usb_device=0:1
usb_rootdelay=10
usb_set_bootargs=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts $usb_custom_params
usb_bootcmd=run usb_init; run usb_set_bootargs; run usb_boot
usb_boot=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage; if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
bootcmd=usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run rescue_bootcmd; run pogo_bootcmd; reset
usb_rootfstype=ext3
usb_root=/dev/sda1
usb_init=run usb_scan; setenv usb_root LABEL=ROOTFS

cat /proc/cmdline
console=ttyS0,115200 root=LABEL=ROOTFS rootdelay=10 rootfstype=ext3 mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)

You'll notice my usb_root variable is near the bottom. My initial attempts of just trying to change usb_root didn't work. I had to experiment with serial access, where I stopped the boot sequence and ran through the process manually. I found that you have to correct usb_root after usb_scan but before usb_set_bootags, or change the entire process which didn't seem worth it.

It's very strange that removing the hard drives makes it work for you. I can't see how that would make a difference.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 10, 2011 03:39AM
I went even further and removed all occurences of LABEL=root from the bootloader environment

ethact=egiga0
bootdelay=3
baudrate=115200
mainlineLinux=yes
console=ttyS0,115200
led_init=green blinking
led_exit=green off
led_error=orange blinking
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
mtdids=nand0=orion_nand
partition=nand0,2
stdin=serial
stdout=serial
stderr=serial
rescue_installed=0
rescue_set_bootargs=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts $rescue_custom_params
rescue_bootcmd=if test $rescue_installed -eq 1; then run rescue_set_bootargs; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000; else run pogo_bootcmd; fi
pogo_bootcmd=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi
force_rescue=0
force_rescue_bootcmd=if test $force_rescue -eq 1 || ext2load usb 0:1 0x1700000 /rescueme 1 || fatload usb 0:1 0x1700000 /rescueme.txt 1; then run rescue_bootcmd; fi
ubifs_mtd=3
ubifs_set_bootargs=setenv bootargs console=$console ubi.mtd=$ubifs_mtd root=ubi0:rootfs rootfstype=ubifs $mtdparts $ubifs_custom_params
ubifs_bootcmd=run ubifs_set_bootargs; if ubi part data && ubifsmount rootfs && ubifsload 0x800000 /boot/uImage && ubifsload 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; fi
usb_scan=usb_scan_done=0;for scan in $usb_scan_list; do run usb_scan_$scan; if test $usb_scan_done -eq 0 && ext2load usb $usb 0x800000 /boot/uImage 1; then usb_scan_done=1; echo "Found bootable drive on usb $usb"; setenv usb_device $usb; setenv usb_root /dev/$dev; fi; done
usb_scan_list=1 2 3 4
usb_scan_1=usb=0:1 dev=sda1
usb_scan_2=usb=1:1 dev=sdb1
usb_scan_3=usb=2:1 dev=sdc1
usb_scan_4=usb=3:1 dev=sdd1
usb_device=0:1
usb_root=/dev/sda1
usb_rootfstype=ext2
usb_rootdelay=10
usb_set_bootargs=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts $usb_custom_params
usb_boot=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage; if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
bootcmd=usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run rescue_bootcmd; run pogo_bootcmd; reset
ethaddr=*******************
arcNumber=3089
ipaddr=10.0.10.6
ncip=10.10.10.5
ncipk=10.10.10.4
serverip=10.10.10.3
preboot=run nc_test nc_start
nc_test=ping $ncip
nc_start=setenv stdin nc; setenv stdout nc; setenv stderr nc; version
usb_init=run usb_scan
usb_bootcmd=run usb_init; run usb_set_bootargs; run usb_boot

then I repeated the same test with a USB hub and 4 flash drives but no HDDs. Surprisingly it still works. But as soon as you connect the hard drives is doesn't. I guess that's because UBIT by default searches for partitions labeled "rootfs" without really respecting the environment options. Still this fails when hard drives are attached.

Thus, at the moment I see no alternative to initrd hack when using GoFlex Net and UBIT v0.6



Edited 1 time(s). Last edit at 10/06/2011 04:17PM by Vlad.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 10, 2011 06:12AM
Hi Vlad,

I decided to use Jeff's bootloader and maybe to install the rescue-system on NAND. I think that's a good setup as well.

The SATA ports are working from this setup.

I tried to boot from SATA, but that don't work for me. Do you have any idea?

Thanks a lot,
Greetings,
Thomas
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 10, 2011 06:36AM
Well, I've just updated my howto once again to incorporate both solutions. Hopefully everybody is happy now ;)

@squeezeplug
If you have Jeff's bootloader I'd rather wait for kraqh3d to answer you questions concerning SATA boot.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 10, 2011 10:12AM
I've got nothing. I don't have a GoFlex Net to experiment on myself. Can you explain the entire boot process using UBIT? I've been reading the Arch forums and UBIT doesn't seem to anything more than a one time installer for a version of UBoot. I haven't pulled down and unpacked the ramdisk image though to look at the scripts referenced by the Arch instructions.

The only difference between Jeff's Uboot and the UBIT installed Uboot, as far as I understand, is that the UBIT installed one allows booting from SATA. Jeff's UBoot does not because I don't think it can sense the SATA ports. The booting issues arise because Linux udev will identify the SATA disks when the initrd is loaded. The SATA ports will get identified as /dev/sda1 and /dev/sda2, while Jeff's Uboot thinks /dev/sda1 is the first USB port where your root file system is locationed. Setting the root as a LABEL for Uboot works around the identification mismatch. But if you want to boot from SATA, I think UBIT is the only option.

But I have no idea why the UBIT Uboot doesn't pass the root correctly. The boot loader's job is to load the kernel and an initrd into memory, and then execute the kernel with some parameters. UBIT should work the same as Lilo, Grub, Grub2, and Jeff's Uboot. The loaded initrd is then supposed to handle converting the root as UUID or LABEL into a device using the udev symlink. (It's in the init script.) The UBIT Uboot shouldn't be searching for anything. After loading, and after the boot delay countdown expires, its supposed to execute bootcmd.



Edited 1 time(s). Last edit at 09/10/2011 10:14AM by kraqh3d.
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 10, 2011 10:43AM
Hi,
thanks Vlad and kraqh3d for all your informations, but now I'm a little bit confused.

What I understood is: Booting from SATA is only possible with UBIT. What about this:

http://www.varkey.in/tag/goflex-net/

Does this modification work?

fw_setenv sata_boot 'ide reset; mw 0x800000 0 1; ext2load ide 0:1 0x800000 /boot/uImage; if ext2load ide 0:1 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi'
fw_setenv sata_bootcmd 'run usb_set_bootargs; run sata_boot'
fw_setenv bootcmd 'usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run sata_bootcmd; run rescue_bootcmd; run pogo_bootcmd; reset'

I can boot fine from my USB-attached SATA drive, but in a SATA-Port it fails booting.

If an expert like to take a look at my GoFlex Net we could arrange that.

Greetings,
Thomas
Re: HOWTO: Build a custom 2.6.38.8 kernel for Goflex Net
September 10, 2011 10:46AM
Quote
squeezeplug
I tried to boot from SATA, but that don't work for me. Do you have any idea?

If you are using Jeff's uBoot, by default it will not boot from a SATA drive even if you have installed a kernel which supports the SATA ports.

You need to change the uBoot settings so that it can initialize the SATA ports and load the Kernel and Initrd from the SATA disk. These are the changes that I made

fw_setenv sata_boot 'ide reset; mw 0x800000 0 1; ext2load ide 0:1 0x800000 /boot/uImage; if ext2load ide 0:1 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi'
fw_setenv sata_bootcmd 'run usb_set_bootargs; run sata_boot'
fw_setenv bootcmd 'usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run sata_bootcmd; run rescue_bootcmd; run pogo_bootcmd; reset'

Edit : Booting from SATA is very much possible with Jeff's uBoot, and UBIT is *NOT* necessary. I have done it as described in my blog

http://www.varkey.in/2011/06/boot-debian-from-sata-seagate-goflex-net/

Note that you need to connect the hard disk to the *right* SATA port



Edited 1 time(s). Last edit at 09/10/2011 10:49AM by varkey.
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: