Difference between revisions of "Compiling a 2.6 kernel"

From Nuclear Physics Group Documentation Pages
Jump to navigationJump to search
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Making a custom 2.6 kernel for the TS-7260 ==
+
== Making a custom 2.6 kernel for the TS-7260 or TS-7390 ==
 +
 
 +
You can get the source of the kernel from embeddedarm and then unpack it on a Linux station using tar.
  
 
<code> curl -O ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7200-linux/sources/tskernel-2.6.21-ts-src.tar.gz </code><br>
 
<code> curl -O ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7200-linux/sources/tskernel-2.6.21-ts-src.tar.gz </code><br>
 
<code> tar -zxvf tskernel-2.6.21-ts-src.tar.gz </code><br>
 
<code> tar -zxvf tskernel-2.6.21-ts-src.tar.gz </code><br>
 
<code> cd linux-2.6.21-ts </code><br>
 
<code> cd linux-2.6.21-ts </code><br>
edit the Makefile:
+
edit the Makefile to reflect the type of kernel:
 
* ARCH            ?= arm
 
* ARCH            ?= arm
* CROSS_COMPILE  ?= /usr/local/arm-linux-gnu/bin/arm-linux-gnu-
+
* CROSS_COMPILE  ?= /usr/local/arm-linux-gnu/bin/arm-linux-gnu-                     # For "normal" arm, using etch 
 +
* CROSS_COMPILE  ?= /usr/local/arm-linux-gnueabi/bin/arm-linux-gnueabi-      # For an eabi compiled kernel.
 +
 
 +
You now want to pre-load the configuration for the board you are making the kernel for. Use the ts72xx_defconfig for TS-7260 board or ts7350_defconfig for the TS-73xx boards. Note that the latter needs to be found on the embedded website (can't remember where.) These config files are in arch/arm/configs.
 +
 
 
  <code> make ts72xx_defconfig </code><br>
 
  <code> make ts72xx_defconfig </code><br>
  
If you want, you can edit the default options:<br>
+
If you want, you can edit the default options. For instance, enabling usb serial conversion as a module, so that you can modprobe ftdi_sio and get usb/serial support. 'MAKE SURE YOU REMOVE DEBUGGING HEADER SUPPORT!' Otherwise, your kernel will be huge and/or your modules won't work on other systems.<br>
  <code> make menuconfig </code> <br>
+
  <code> make menuconfig </code>  
then make the kernel
+
Note the special options under "Sytem Type" --> "Cirrus EP93xx Implementation Options" where you can select the type of board. Also check the "Kernel Features", where you can select for ARM EABI, and "Allow old ABI binaries to run with this kernel". (For TS-7390 with Lenny EABI, you clearly need both.)
 +
 
 +
For the EABI version of Lenny (Debian 5), you need to hack the kernel to make sure the frame buffer works. Details are here:  (http://www.mail-archive.com/debian-arm@lists.debian.org/msg09750.html)
 +
In short, the ioctl call to change the mode of the framebuffer fails, since the device can handle only one mode.
 +
The hack with preloading the lib.so worked. The other "fix" would be to change the kernel fb code to always return 0, which would work better with the startx scripts. I am trying this now.
 +
 +
Then make the kernel and the modules
 
  <code>make</code>
 
  <code>make</code>
 
  <code>make zImag </code>
 
  <code>make zImag </code>
Line 18: Line 30:
 
You can now copy all the modules to TARGET_DIR with:
 
You can now copy all the modules to TARGET_DIR with:
 
  <code>make modules_install INSTALL_MOD_PATH=TARGETDIR</code>
 
  <code>make modules_install INSTALL_MOD_PATH=TARGETDIR</code>
 +
Where TARGETDIR is the '''root of the filesystem''' where you want to install the modules. You can put the kernel in the right place for the TS-7390, assuming the chip is in your system at /dev/sdb
 +
<code>dd if=arch/arm/boot/zImage of=/dev/sdb2 </code>
 +
 +
If you were just compiling the kernel so you can get the ftdi_sio module, you'll find it in drivers/usb/serial/ftdi_sio.ko
 +
 +
== Local lore ==
 +
 +
There are several kernel trees that were build in ~maurik/kernels/.

Latest revision as of 16:34, 6 January 2010

Making a custom 2.6 kernel for the TS-7260 or TS-7390

You can get the source of the kernel from embeddedarm and then unpack it on a Linux station using tar.

curl -O ftp://ftp.embeddedarm.com/ts-arm-sbc/ts-7200-linux/sources/tskernel-2.6.21-ts-src.tar.gz
tar -zxvf tskernel-2.6.21-ts-src.tar.gz
cd linux-2.6.21-ts
edit the Makefile to reflect the type of kernel:

  • ARCH ?= arm
  • CROSS_COMPILE ?= /usr/local/arm-linux-gnu/bin/arm-linux-gnu- # For "normal" arm, using etch
  • CROSS_COMPILE ?= /usr/local/arm-linux-gnueabi/bin/arm-linux-gnueabi- # For an eabi compiled kernel.

You now want to pre-load the configuration for the board you are making the kernel for. Use the ts72xx_defconfig for TS-7260 board or ts7350_defconfig for the TS-73xx boards. Note that the latter needs to be found on the embedded website (can't remember where.) These config files are in arch/arm/configs.

 make ts72xx_defconfig 

If you want, you can edit the default options. For instance, enabling usb serial conversion as a module, so that you can modprobe ftdi_sio and get usb/serial support. 'MAKE SURE YOU REMOVE DEBUGGING HEADER SUPPORT!' Otherwise, your kernel will be huge and/or your modules won't work on other systems.

 make menuconfig  

Note the special options under "Sytem Type" --> "Cirrus EP93xx Implementation Options" where you can select the type of board. Also check the "Kernel Features", where you can select for ARM EABI, and "Allow old ABI binaries to run with this kernel". (For TS-7390 with Lenny EABI, you clearly need both.)

For the EABI version of Lenny (Debian 5), you need to hack the kernel to make sure the frame buffer works. Details are here: (http://www.mail-archive.com/debian-arm@lists.debian.org/msg09750.html) In short, the ioctl call to change the mode of the framebuffer fails, since the device can handle only one mode. The hack with preloading the lib.so worked. The other "fix" would be to change the kernel fb code to always return 0, which would work better with the startx scripts. I am trying this now.

Then make the kernel and the modules

make
make zImag 
make modules 

The final product is found in "arch/arm/boot" and is called "zImage". You can now copy all the modules to TARGET_DIR with:

make modules_install INSTALL_MOD_PATH=TARGETDIR

Where TARGETDIR is the root of the filesystem where you want to install the modules. You can put the kernel in the right place for the TS-7390, assuming the chip is in your system at /dev/sdb

dd if=arch/arm/boot/zImage of=/dev/sdb2 

If you were just compiling the kernel so you can get the ftdi_sio module, you'll find it in drivers/usb/serial/ftdi_sio.ko

Local lore

There are several kernel trees that were build in ~maurik/kernels/.