wiki:ventana/third_party_linux

Version 6 (modified by Tim Harvey, 5 years ago) ( diff )

add -O 64bit option to mkfs.ext4 to disable 64bit ext which isn't supported on the older U-Boot 2015 still used on many ventana boards

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

  • Freescale Vendor Kernels with patches for Gateworks Ventana: These kernels contain many patches from Freescale to support hardware features that are not yet in Mainline linux:
    • gateworks_3.10.17_1.0.0_ga - latest vendor kernel supporting device-tree (recommended)
    • gateworks_3.0.35_4.0.0 - latest non device-tree vendor kernel
    • gateworks_jb4.3_1.0.0-ga - latest Android Jellybean vendor kernel
  • Mainline linux kernel with patches for Gateworks Ventana: Missing some Freescale hardware support such as Video input/output, codec support and crypto support:
    • gateworks_3.15
    • gateworks_3.14
    • gateworks_3.13
    • gateworks_3.12

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
  • Notes:
    • you can download a pre-built OpenWrt toolchain for Ventana here
    • if you are using the 3.0.35 non-device-tree kernel do not include dtbs in the make targets above

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
  • Notes:
    • the transform argument to tar above renames paths and the example above places the kernel and dtbs in the /boot directory where the default Ventana bootloader expects to find them on the first partition of type ext2/3/4

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.

Third-party sources:

  • Linaro - Linaro has several root filesystems including server, nano, developer, core, and ALIP. Each root filesystem will have different things installed for different purposes. Choose carefully which will work for you.

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 -O ^64bit -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:

  • some root filesystems may require you to manually add a user before booting (ie Ubuntu Core)
  • the default Ventana bootloader expects to find the uImage and dtbs in the /boot directory on the first partition of type ext2/3/4
Note: See TracWiki for help on using the wiki.