Compiling the Linux kernel

Installing the source code management system.

user@ubuntu:~$ sudo apt-get install git-core stgit uboot-mkimage

Create a directory for the Linux source code:

user@ubuntu:~$ mkdir ~/src
user@ubuntu:~$ cd ~/src

Download archive with patch files and get the corresponding version of the Linux kernel. In this case the patches for version v2.6.34.9 from branch 2.6.34.y.

Download the source code using git:

user@ubuntu:~/src$ git clone https://git.kernel.org/pub/scm/linux/kernel/git/longterm/linux-2.6.34.y.git

Change to directory linux-2.6.34.y

user@ubuntu:~/src$ cd linux-2.6.34.y

Create local branch named v2.6.34.9 with the source code of version 2.6.34.9:

user@ubuntu:~/src/linux-2.6.34.y$ git checkout -b v2.6.34.9 v2.6.34.9

The source code of Linux kernel version 2.6.34.9 is now in directory /home/user/src/linux-2.6.34.y.

Copy the archive with the patches to a local directory, e.g. to ~/src/BSP/Linux/linux/src. Extract the archive there using tar.

The directory with the patches is on the supplied DVD, and on the TQ product page

user@ubuntu:~$ cd ~/src/BSP/Linux/linux/src
user@ubuntu:~/src/BSP/Linux/linux/src$ tar -xvf patches-tqma35_v2.6.34.9.tar

Apply the patches to the downloaded Linux kernel sources:

user@ubuntu:~/src/linux-2.6.34.y$ stg init
user@ubuntu:~/src/linux-2.6.34.y$ stg import -t -s ~/src/BSP/Linux/linux/src/patches-tqma35_v2.6.34.9/series

Set variables for cross compilation:

user@ubuntu:~/src/linux-2.6.34.y$ export ARCH=arm
user@ubuntu:~/src/linux-2.6.34.y$ export CROSS_COMPILE=/opt/freescale/usr/local/gcc-4.4.4-glibc-2.11.1-multilib-1.0/arm-fsl-linux-gnueabi/bin/arm-none-linux-gnueabi-

For the current user the environment variables can be stored permanently in the file ~/.bashrc, or system-wide in the file /etc/bash.bashrc.

Configue and build:

user@ubuntu:~/src/linux-2.6.34.y$ make tqma35_defconfig
user@ubuntu:~/src/linux-2.6.34.y$ make uImage

The kernel image uImage in directory arch/arm/boot has to be copied or linked to the TFTP root directory. Depending on the configuration of the TFTP server it is e.g. /tftpboot. Starting from the kernel source directory copy the uImage to the tftpboot directory with the command:

user@ubuntu:~/src/linux-2.6.34.y$ sudo cp arch/arm/boot/uImage /tftpboot

Or: With the following command a symbolic link in the TFTP root directory can be created:

user@ubuntu:~/src/linux-2.6.34.y$ sudo ln -s  ~/src/linux-2.6.34.y/arch/arm/boot/uImage /tftpboot/uImage
  • Last modified: 2022/08/04 15:02