{{{#!html

  1. Third Party Linux
    1. Building Gateworks Ventana kernel
      1. Sources
      2. Building
    2. Root filesystem Sources
    3. Creating a bootable block device (mSATA/USB/uSD)

Third Party Linux

While Gateworks cannot fully support all Linux distros, it is relatively simple to overlay a Gateworks Ventana kernel onto any non-Gateworks third party Linux distro rootfs image.

Building Gateworks Ventana kernel

Sources

Gateworks has several kernel tree's to choose from hosted on Github here

Checking out source (for example, the gateworks_3.10.17_1.0.0_ga kernel):

git clone https://github.com/Gateworks/linux-imx6.git gateworks_3.10.17_1.0.0_ga
cd gateworks_3.10.17_1.0.0_ga

Building

To build a kernel using an external toolchain (for example, an OpenWrt toolchain built in /usr/src/openwrt-gw-trunk):

# setup toolchain
export STAGING_DIR=/usr/src/openwrt/gw-trunk/trunk/staging_dir
export TOOLCHAIN=toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_uClibc-0.9.33.2_eabi
export PATH=$PATH:$STAGING_DIR/$TOOLCHAIN/bin/
# set LOADADDR (necessary to make a uImage)
export LOADADDR=10008000
# use the Gateworks kernel config (optional)
ARCH=arm make gwventana_defconfig
# alter kenrel configuration (optional)
ARCH=arm make menuconfig
# build standard targets (uImage modules dtbs)
CROSS_COMPILE=arm-openwrt-linux- ARCH=arm make uImage modules dtbs

To create a tarball of uImage, modules and dtbs (suitable to un-tar on top of a rootfs):

KERNEL_VER=$(cat include/config/kernel.release)
TARBALL=linux-$KERNEL_VER.tar
# create tarball containing kernel modules
find -name *.ko | xargs tar --transform "s,^.,/lib/modules/$KERNEL_VER," --show-transformed-names -cvf $TARBALL
# add modules database for depmod
tar --transform "s,^.,/lib/modules/$KERNEL_VER," --show-transformed-names -rvf $TARBALL ./modules.order ./modules.builtin
# add uImage (to /boot)
tar --transform "s,^arch/arm/boot,/boot," --show-transformed-names -rvf $TARBALL arch/arm/boot/uImage
# add dtbs (if using a device-tree kerhttps://github.com/Gateworks/linux-imx6.gitnel) to /boot)
tar --transform "s,^arch/arm/boot/dts,/boot," --show-transformed-names -rvf $TARBALL arch/arm/boot/dts/imx6*gw*.dtb
# gzip it
gzip -f $TARBALL

Root filesystem Sources

There are several sources of pre-built root filesystems that are compatible with Ventana. As Ventana uses an i.MX6 SoC, you need to use something that is compatible with an ARMv7 instruction set. Many pre-built distributions will reference 'armhf' which means 'ARM hard-float' which is appropriate for the i.MX6 as it has hardware floating-point.

Some popular third-party sources:

Note that Gateworks has a pre-built disk image of Ubuntu for Ventana. See here for details about it and more details on building Ubuntu root filesystems

Creating a bootable block device (mSATA/USB/uSD)

The following procedure will for virtually all Linux distributions:

  1. Download Root Filesystem (see above)
  2. Download or build Ventana rootfs containing a Kernel, device-tree dtbs, and kernel modules:
  3. Create image on block storage device. For example, using /dev/sdc:
    DEVICE=/dev/sdc
    # unmount all auto-mounted partitions for this device
    sudo umount ${DEVICE}?
    # partition disk - single ext partition
    printf ",,L,,\n" | sudo sfdisk ${DEVICE}
    sudo mkfs.ext4 -L UBUNTU ${DEVICE}1
    # mount partition
    sudo udisks --mount ${DEVICE}1
    # untar the root filesystem downloaded (modify --strip-components parameter to strip subdirs as necessary depending on archive)
    sudo tar --strip-components=1 --numeric-owner -xvzf linaro-raring-alip-20130826-474.tar.gz -C /media/UBUNTU/
    # untar the Ventana kernel, modules, device-tree from Gateworks kernel archive
    sudo tar --numeric-owner -C /media/UBUNTU/ -xvzf rootfs.tar.gz ./boot
    sudo tar --numeric-owner -C /media/UBUNTU/ -xvzf rootfs.tar.gz ./lib/modules/
    # unmount the disk
    sudo umount ${DEVICE}1
    

Notes: