developer.shyd.de. studying my hobby

11Mar/118

Dockstar: Crosscompile a newer Kernel, set up Toolchain

linux

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading ... Loading ...
Some days ago I wanted to test the performance of a partition with XFS as its filesystem. But I wasn't able to mount it. After a look into the kernelconfig of gorgone's heavykernel I noticed that he obviously didn't build it with XFS-support.
I do want to make the test and take a look at kernelbuilding things anyway. Well, I don't want to keep it back, so I decided to verbalize the steps I took.
In this guide you will learn how to set up the crosscompile toolchain to let a more powerful CPU do the job. If you prefer doing the whole thing on the dockstar it will take you several hours.
Further more we will go through the build process until we have a deb-file with the built kernel.

1. The CodeSourcery's Toolchain

There already is a great HowTo how to set this up here: http://general.nas-central.org
I stripped it a bit as follows. If you have debian running on the machine you want to use for the build process download and run this script to install the toolchain:

wget http://dev.shyd.de/dockstar/setup_codesourcery.sh
chmod +x setup_codesourcery.sh
./setup_codesourcery.sh

Just to know, you don't have to type this now:
When you want to enter the toolchain, type

codesourcery-arm-2009q3.sh

To get back to the normal environment just exit:

exit

That's it.

2. The Kernel

2.1 Get the Sources

First of all you have to decide which kernel you want to compile, take a look at http://kernel.org and download the sources. For example 2.6.37:

cd /usr/src
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.37.tar.bz2
tar xjvf linux-2.6.37.tar.bz2
cd linux-2.6.37

2.2 Edit the Configuration

If you already have a proper .config just copy it into the current folder.
Then run

# Accept default options for any new kernel configs
yes "" | make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- oldconfig

Then make your changes in the new .config. It is that long that I prefer doing this with WinSCP or any other remote editor than using vim.
In newer kernel there is no need to add a special patch for the dockstar LED.
Once you are done run:

# Add new config
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- oldconfig

# enter the toolchain
codesourcery-arm-2009q3.sh

# run the final build process
# you may want to edit --append-to-version and --revision
# try out the effects :)
make-kpkg --rootcmd fakeroot --arch armel  --cross-compile arm-none-linux-gnueabi- --append-to-version=-dockstar --revision=1.1 --initrd kernel_image

Lean back, this is going to take some time.

2.3 Install the new Kernel

If everything works fine, you should have a deb-file in /usr/src. Copy this to your dockstar and install it.
I don't have to say that you should backup your data first.
Change the names to your compiled kernel:

dpkg -i linux-image-2.6.37-dockstar_1.1_armel.deb
cd /boot

# Create the images for uBoot
/usr/bin/mkimage -A arm -O linux -T kernel  -C none -a 0x00008000 -e 0x00008000 -n Linux-2.6.37 -d /boot/vmlinuz-2.6.37-dockstar /boot/uImage

/usr/bin/mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs -d /boot/initrd.img-2.6.37-dockstar /boot/uInitrd

To tell the kernel your device is a dockstar, change its machine ID in case you haven't done before:

# view current ID
fw_printenv arcNumber

# set to dockstar's ID
fw_setenv arcNumber 2998

But remember to change it back to 2097 (sheevaplug's ID) if you downgrade to a kernel that doesn't support the dockstar.

If you didn't edit the files for LED support, do it:
Add to

/etc/rc.local
echo default-on > /sys/class/leds/dockstar\:green\:health/trigger
echo none       > /sys/class/leds/dockstar\:orange\:misc/trigger

and in

/etc/init.d/halt 

find

log_action_msg "Will now halt"
halt -d -f $netdown $poweroff $hddown

add after

echo none > /sys/class/leds/dockstar\:green\:health/trigger

to set it off, when the system halts.

Now reboot and prey that everything works flawlessly.

3. References

http://general.nas-central.org/wiki/Setting_up_the_codesourcery_toolchain_for_X86_to_ARM9_cross_compiling
http://forum.doozan.com/read.php?2,524

Tagged as: , , , | 1,690 views Leave a comment
Comments (8) Trackbacks (0)
  1. Thanks for the guide. My first kernel for the dockstar is compiling right now. I wonder how long it takes. Lol :P

  2. I followed your instruction step-by-step but I keep getting Errors when starting to compile the kernel in the toolchain:

    dpkg-architecture: warning: Specified GNU system type arm-linux-gnueabi does not match gcc system type x86_64-linux-gnu.

    Since I dont know how to configure the .config I used the one from the default install from Jeff Dozans Script with this command:

    # Get the config from your current Dockstar kernel
    scp root@YOUR.DOCKSTAR.IP.ADDRESS:/boot/config-2.6.32-5-kirkwood .config

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

    Any suggestions?


Leave a comment

(required)

 
http://dev.shyd.de/wp-content/plugins/wp-monalisa/icons/wpml_bye.gif 
http://dev.shyd.de/wp-content/plugins/wp-monalisa/icons/wpml_good.gif 
http://dev.shyd.de/wp-content/plugins/wp-monalisa/icons/wpml_negative.gif 
http://dev.shyd.de/wp-content/plugins/wp-monalisa/icons/wpml_scratch.gif 
http://dev.shyd.de/wp-content/plugins/wp-monalisa/icons/wpml_wacko.gif 
http://dev.shyd.de/wp-content/plugins/wp-monalisa/icons/wpml_yahoo.gif 
http://dev.shyd.de/wp-content/plugins/wp-monalisa/icons/wpml_cool.gif 
more...
 

No trackbacks yet.