Twitter E-mail RSS
formats

Building a kernel 3.12-rc2 for the imx23-olinuxino

This build contain patches for i2c support on imx233-olinuxino boards  and audio driver for i.MX23 SoC.

Hardware requirements

SD card with two partition:

  • boot partition for kernel, and –
  • rootfs partition with your prefered linux distribution.

See Make bootable SD-Card for instructions how to make card with two partition.

Getting the code

$: git clone -b 3.12-rc2  https://github.com/koliqi/imx23-olinuxino

This package contain:

Freescale imx-bootlets and utility elftosb2, patches for imx-bootlets.

Freescale imx-bootlets and utility elftosb2 are from Freescale package L2.6.31_10.05.02_ER_source.
Utility elftosb2 is distributed in binary form. Sources can be found at the following link:
http://repository.timesys.com/buildsources/e/elftosb/elftosb-10.12.01/

I. Building a kernel from sources

Switch into directory kernel and download kernel sources:

$: cd imx23-olinuxino/kernel
$: wget https://www.kernel.org/pub/linux/kernel/v3.x/testing/linux-3.12-rc2.tar.bz2
$: tar xvjf linux-3.12-rc2.tar.bz2
$: mv linux-3.12-rc2  linux-mainline

Switch into directory linux-mainline to apply  audio and i2c patches.

$: cd linux-mainline
$: patch -p1 <../0001-ARM-imx23-olinuxino-Add-i2c-support.patch
$: patch -p1 <../ASoC_driver_for_i.MX233.patch
$: patch -p1 <../101-soc-audio-dts.patch

Configure kernel

Start from supplied default mxs_defconfig configuration:

$: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- mxs_defconfig
$: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- menuconfig

Select Boot options —> and select following options:

[*] Use appended device tree blob to zImage (EXPERIMENTAL)
[*] Supplement the appended DTB with traditional ATAG information
(console=ttyAMA0,115200 root=/dev/mmcblk0p2 rw rootwait) Default kernel command string

Activate sound driver:

-> Device Drivers
<*> Sound card support  —>
<*>   Advanced Linux Sound Architecture  —>
<*>   ALSA for SoC audio support  —>
<*>   SoC Audio for Freescale i.MX23 built-in codec

Activate other drivers as needed. Save and exit from menuconfig application.

Compile kernel

$: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- zImage modules

Kernel is ready at arch/arm/boot/zImage.

Create device tree blob .dtb file:

$: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- imx23-olinuxino.dtb

Join zImage and imx23-olinuxino.dtb into a new file zImage_dtb:

$: cat arch/arm/boot/zImage arch/arm/boot/dts/imx23-olinuxino.dtb > arch/arm/boot/zImage_dtb

If you want to repeat this procedure, start with clean-up:

$: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- distclean
$: make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- clean

II. Bootlets

The iMX23 SoC contains a built-in ROM firmware capable of loading and executing binary images in special format from different locations including MMC/SD card and NAND flash. Binary image is called a boot stream (.bs). Boot stream consists of a series of smaller bootable images (bootlets) such clock bootlet, power bootlet etc. Linking bootlets with kernel and converting from elf format to raw boot stream is done with utility elftobs. In this package, utility elftobs2 is located in directory elftosb-0.3.

Switch into directory boot/elftosb-0.3 and make symbolic link into compilers default PATH:

$: sudo ln -s `pwd`/elftosb2 /usr/sbin/

Check with locate:

$: locate elftosb2

elftosb2 should be located at /usr/sbin/elftosb2.

Next, switch into directory boot and untar archive imx-bootlets-src-10.05.02.tar.gz

$: tar xvzf imx-bootlets-src-10.05.02.tar.gz

then switch into directory boot/imx-bootlets-src-10.05.02 and apply patches:

$: patch -p1 <../imx23_olinuxino_bootlets.patch

This patched package require zImage in this directory. We have created zImage_dtb instead, so make symbolic link as:

$: ln -s ../../kernel/linux-mainline/arch/arm/boot/zImage_dtb  ./zImage

Make boot stream file:

$: make CROSS_COMPILE=arm-linux-gnueabi- clean
$: make CROSS_COMPILE=arm-linux-gnueabi-

Final response would be:
To install bootstream onto SD/MMC card, type: sudo dd if=sd_mmc_bootstream.raw of=/dev/sdXY
where X is the correct letter for your sd or mmc device (to check, do a ls /dev/sd*) and Y is the partition number

If SD device is /dev/sdb1, then writing bootstream file in card is done by:

$: sudo dd if=sd_mmc_bootstream.raw of=/dev/sdb1

Card is ready.

Home imx23-olinuxino kernel 3.x Building a kernel 3.12-rc2 for the imx23-olinuxino