Compiling Linux

From Platformx Wiki

Prerequisites: Linux 2.6.14 compiles with the 3.4.1 tool chain. It failed with 3.3.2. This is the opposite of the Blob.
The 2.6.14 kernel on the 3.3.2 tool-chain fails with the error: arm-linux-ld:arch/arm/kernel/vmlinux.lds:811: parse error in make zImage


  • Get the Linux 2.6.14 source from kernel.org (http://ftp.kernel.org/) and untar it.
    http://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.14.tar.gz http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.14.tar.gz
    tar xzpf linux-2.6.14.tar.gz
    cd linux-2.6.14
    
  • Apply the Stargate 2 / Intel Mote 2 patch found in the release. See Downloads.
    patch -p1 < patch-2.6.14-px2_05
    chmod 755 scripts/platx_config
    
  • If you do not have the arm cross compiler already installed, you can download a binary for the arm-linux-gcc cross compiler (arm-linux-gcc-3.4.1.tar.bz2) from handhelds.org (http://www.handhelds.org/) http://www.handhelds.org/download/projects/toolchain/
    Before building the kernel you will need to add /usr/local/arm/3.4.1/bin/ to your path if it is not already there.
    bzip2 -d arm-linux-gcc-3.4.1.tar.bz2
    tar xvf arm-linux-gcc-3.4.1.tar 
    
    export PATH=$PATH:/usr/local/arm/3.4.1/bin/
    
  • Build the kernel. (Note - There should be an underscore between "CROSS" and "COMPILE" below.) (Note - the Stargate 2 and Intel Mote 2 builds have not yet been differentiated.)
    export ARCH=arm
    export CROSS_COMPILE=arm-linux-
    make stargate2_defconfig
    make oldconfig
    make zImage
    
  • Build the modules. Modules are a mechanism used to differentiate the Intel Mote 2 and Stargate 2 platforms. Drivers that are not needed by the Mote are compiled as modules. They include wired Ethernet, PC card (PCMCIA and CF), SD card, Bluetooth, and USB host. That is not to say that this is the only way to differential the two platforms. In addition, other functionality may also be compiled into modules.
    make modules
    make modules_install
    
    The make modules_install copies the modules into the modules directory of the kernel root directory. From this directory the modules are picked up by the file system build tools. (You can change where the modules go by editing the INSTALL_MOD_PATH in the Makefile.)