Setting up cross compilation toolchain to compile kernel and vivi for mini 2440

To compile kernel and vivi for our target device (mini2440) we need to  set up a cross compilation environment on our host system.The trick is that we generate binaries for the target(mini2440) on our host system.

So frst we need some packages installed in our system they are

sudo apt-get install build-essential make ncurses gcc g++ libncurses5 libncueses5-dev

After that we need to download some packages

ARM Linux gcc   –  http://www.friendlyarm.net/dl.php?file=arm-linux-gcc-4.3.2.tgz

Cross compiler toolchain   –  http://ftp.arm.linux.org.uk/pub/armlinux/toolchain/cross-2.95.3.tar.bz2

Linux kernel source   –  http://www.friendlyarm.net/dl.php?file=linux-2.6.32.2-mini2440_20110413.tgz

Vivi source  –  http://www.friendlyarm.net/dl.php?file=bootloader_20090728.zip

Now setup cross compiler toolchain and Arm gcc on our system

Configuring cross compiler

tar -xvf cross-2.95.3.tar.bz2
sudo mkdir -p /usr/local/arm
sudo mv 2.95.3/ -v /usr/local/arm/
ls /usr/local/arm/
export PATH=/usr/local/arm/2.95.3/bin:$PATH
echo $PATH

Configuring Arm gcc

tar -xvf arm-linux-gcc-4.3.2.tgz
sudo mv ./usr/local/arm/ /usr/local/arm/
sudo mv /usr/local/arm/arm/4.3.2/ /usr/local/arm/
export PATH=/usr/local/arm/4.3.2/bin:$PATH
echo $PATH

On doing echo $PATH we can see if path variable is set or not

Now compile vivi to generate binary

extract vivi
cd bootloader_20090728/vivi/
cp smdk2440 ./.config
make menuconfig

You may get a error like this

error-Preparing scripts: functionsYour lxdialog utility does not exist

To fix this error we need to give permission to lxdialog

cd scripts/lxdialog/
sudo chmod +x lxdialog
make menuconfig
Load an Alternate config file
make vivi
sudo ../../usbpush/usbpush/usbpush ./vivi

The vivi binary will be generated now on the folder ,Now using usb push utility we can push it to mini2440

Next compiling Linux kernel

cd linux-2.6.32.2/
cp config_mini2440_n35 ./.config
cat .config |grep CPU_S3C2440

Check whether the out put is Y

make menuconfig

An error may occur like this

error –include/linux/compiler-gcc.h:86: linux/compiler-gcc2.h: No such file or directory

make mrproper
make menuconfig

check - system type-->sc32440 machines-->Friendlyarm mini2440 dev board
make
make zImage

make mrproper will eliminate that error and will build necessary dependencies.If everything goes correct you will get an output like this

The zImage is available in this path arch/arm/boot/zImage

Using usbpush push it to mini2440

sudo ../usbpush/usbpush/usbpush arch/arm/boot/zImage

Upgrading the kernel to 2.6.39 in Debian 6

Some applications require a newer kernel version to make them work better . But the current stable kernel is 2.6.32.

First of all;
1. backup your /boot!

cp /boot /root -R

2. Make changes to your sources.list .

vim /etc/apt/sources.list

3. Add the line below to the bottom of the file.

deb http://backports.debian.org/debian-backports squeeze-backports main

4. Update your repositories

apt-get update

5. Install  the backport and the kernel. (note: the linux headers and other dependencies will be installed aswell)

apt-get install -t squeeze-backports linux-image-2.6.39-bpo.2-amd64

The install will update the grub config aswell, and will put the 2.6.39 kernel at the top (so it will boot first). If all goes well you should reboot the server and the kernel will be loaded.

If the server doesnt reboot and gives you the grub shell . You can try to boot from a live disk, and copy the files from your backup back to /boot of your install.