Utilite Linux Kernel 3.10

From Utilite Wiki

Jump to: navigation, search

Contents

Overview

The Linux kernel for Utilite provides support for on-board peripherals and abstracts the functionality provided by the hardware.

Kernel boot process

Default boot process

The Utilite U-Boot scans the various boot devices and loads the kernel from the first valid boot device. The boot device is valid when:

  • physically present
  • boot partition formatted with vfat
  • has zImage-cm-fx6 and a DTB file that meets the board configuration
  • or boot.scr in the root of the boot partition

Default boot device layout

The Utilite default boot device layout:

  • /boot/zImage-cm-fx6 - Linux kernel zImage
  • /boot/imx6dl-sbc-fx6.dtb - SBC-FX6/DL board device tree blob (Evaluation Board)
  • /boot/imx6dl-sbc-fx6m.dtb - SBC-FX6m/DL board device tree blob (Utilite)
  • /boot/imx6q-sbc-fx6.dtb - SBC-FX6/Q board device tree blob (Evaluation Board)
  • /boot/imx6q-sbc-fx6m.dtb - SBC-FX6m/Q board device tree blob (Utilite)
  • /boot/boot.scr - Optional U-Boot boot script that selects correct kernel boot parameters and loads the kernel
  • / - Root file system formatted with ext2/ext3/ext4

Boot device scan order

The U-Boot boot script will attempt to boot from the various boot devices according to the following order:

  1. Micro-SD card
  2. Internal SATA storage (if available)

Building kernel for Utilite

Cross-Compiler

There are several options for cross-compilation toolchain setup. You can either compile your cross-compiler or use an already built cross-compiler. The cross-compiler should support the ARM embedded-application binary interface ("EABI")

  • Pre-built toolchain:
  • Tools for creating cross-compilers:
    • Crosstool-ng: Builds a cross-compiler from source. Non-distribution specific.
    • Crossdev: Gentoo's cross-compiler builder. Needs Gentoo.

Getting kernel sources

The instructions below assume that the /home/development/Utilite/kernel directory has been created for Utilite kernel development.

Git clone

Clone the imx Linux git treethis way:

  • Install git version control system.
  • Create a clone of the Utilite Linux kernel tree
cd /home/development/Utilite/kernel
git clone git://git.freescale.com/imx/linux-2.6-imx.git .
git checkout -b development rel_imx_3.10.17_1.0.2_ga

CM-FX6 Patches

mkdir /tmp/cm-fx6
wget --output-document /tmp/cm-fx6/3.10.17-ga.tar.bz2 \
http://compulab.co.il/utilite-computer/download/utilite/unofficial_unsupported/armhf/3.10.17_1.0.2_ga/3.10.17-ga.tar.bz2
  • Unpack the downloaded archive:
tar -C /tmp/cm-fx6 -xvf  /tmp/cm-fx6/3.10.17-ga.tar.bz2
  • Apply the patches:
git am /tmp/cm-fx6/*.patch

Building the kernel

export ARCH=arm
export CROSS_COMPILE=arm-none-linux-eabi-
make cm_fx6_defconfig
make menuconfig
make zImage modules dtbs && INSTALL_MOD_PATH=/home/development/Utilite/rootfs make modules_install

In the example above:

  • Linux kernel image (zImage) will be created in /home/development/Utilite/kernel/arch/arm/boot
  • device tree blobs will be created in /home/development/Utilite/kernel/arch/arm/boot/dts
  • loadable kernel modules will be installed into the /home/development/Utilite/rootfs/lib/modules directory.

When the Utilite is booted with the kernel image created as described above and with networked root filesystem at /home/development/Utilite/rootfs/, the system will be able to load the kernel modules properly, thus avoiding module version problems.

zImage, DTB files and modules locations

  • In the example above, the Linux kernel image (zImage) will be created in /home/development/Utilite/kernel/arch/arm/boot
# ls -al /home/development/Utilite/kernel/arch/arm/boot/zImage
  • DTB files
# ls -al /home/development/Utilite/kernel/arch/arm/boot/dtb/*fx6*.dtb
  • The loadable kernel modules will be installed into the /home/development/Utilite/rootfs/lib/modules directory.
# ls -al /home/development/Utilite/rootfs/lib/modules

Kernel Version

  • In the example above, the Linux kernel release version number will be saved in /home/development/Utilite/kernel/include/config/kernel.release
# cat /home/development/Utilite/kernel/include/config/kernel.release

Prepare kernel and modules tarball

  • In the example below, the Linux kernel and modules are packed into the tar archive for deploying onto the Utilite.
# mkdir -p /home/development/Utilite/rootfs/boot
# cp -v /home/development/Utilite/kernel/arch/arm/boot/zImage /home/development/Utilite/rootfs/boot/zImage-cm-fx6
# cp -v /home/development/Utilite/kernel/arch/arm/boot/dtb/*fx6*.dtb /home/development/Utilite/rootfs/boot/
# tar -C /home/development/Utilite/rootfs -czvf /home/development/Utilite/linux-image-utilite.tar.gz .

Deploying the Utilite kernel and modules

Boot up the Utilite computer. Copy the previously created linux-image-utilite.tar.gz to /root directory of the Utilite.

Mount boot partition

  • Use the below command to mount the boot partition for installing the Utilite Linux kernel binary:
# boot_partition=`cat /proc/cmdline | awk '{ for (i=1;i<=NF;i++) { if($i~/^root=/) { print substr($i,6,length($i)-6)"1" } } }'`
# mount $boot_partition /boot

Back up old kernel

  • It is essential to backup the old (known to work) kernel binary.
# mkdir /boot/`uname -r`
# mv /boot/uImage-cm-fx6 /boot/zImage-cm-fx6 /boot/*.dtb /boot/`uname -r`/

Installing kernel and modules

Assuming that the linux-image-utilite.tar.gz tar ball has been copied to the Utilite /root directory.

  • Extract and install the Linux kernel binary:
# tar -C / -xvf /root/linux-image-utilite.tar.gz

U-Boot Environment

Common parameters

setenv loadaddr 0x10800000
setenv dtbaddr  0x15000000
setenv bootm_low 0x15000000
setenv zimage zImage-cm-fx6
  • SB-FX6 (Evaluation Board)

In order to boot up an SB-FX6 make use of the imx6q-sbc-fx6.dtb blob file.

setenv dtb imx6q-sbc-fx6.dtb

In order to boot up an SB-FX6m make use of the imx6q-sbc-fx6m.dtb blob file.

  • SB-FX6m (Utilite)
setenv dtb imx6q-sbc-fx6m.dtb

SATA Boot Parameters

setenv satadev 0
setenv bootargs console=ttymxc3,115200 root=/dev/sda2 rootfstype=ext4 rw rootwait ip=dhcp

sata init
fatload sata ${satadev} ${loadaddr} ${zimage}
fatload sata ${satadev} ${dtbaddr} ${dtb}
bootz ${loadaddr} - ${dtbaddr}

MMC Boot Parameters

setenv mmcdev 2
setenv bootargs console=ttymxc3,115200 root=/dev/mmcblk0p2 rootfstype=ext4 rw rootwait ip=dhcp

mmc dev ${mmcdev}
fatload mmc ${mmcdev} ${loadaddr} ${zimage}
fatload mmc ${mmcdev} ${dtbaddr} ${dtb}
bootz ${loadaddr} - ${dtbaddr}

NFS Boot Parameters

setenv nfsserver <nfs server ip address>
setenv tftpserver <tftp server ip address>
setenv bootargs console=ttymxc3,115200 root=/dev/nfs rw ip=dhcp nfsroot=${nfsserver}:${nfsroot}

dhcp
tftpboot ${loadaddr} ${tftpserver}:${zimage}
tftpboot ${dtbaddr} ${tftpserver}:${dtb}
bootz ${loadaddr} - ${dtbaddr}
Personal tools