Changes between Initial Version and Version 1 of ventana/third_party_linux


Ignore:
Timestamp:
10/22/2017 05:28:45 AM (7 years ago)
Author:
trac
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • ventana/third_party_linux

    v1 v1  
     1{{{#!html
     2          <div id="wikipage" class="trac-content"><p>
     3</p><div class="wiki-toc">
     4<ol>
     5  <li>
     6    <a href="#ThirdPartyLinux">Third Party Linux</a>
     7    <ol>
     8      <li>
     9        <a href="#BuildingGateworksVentanakernel">Building Gateworks Ventana kernel</a>
     10        <ol>
     11          <li>
     12            <a href="#Sources">Sources</a>
     13          </li>
     14          <li>
     15            <a href="#Building">Building</a>
     16          </li>
     17        </ol>
     18      </li>
     19      <li>
     20        <a href="#RootfilesystemSources">Root filesystem Sources</a>
     21      </li>
     22      <li>
     23        <a href="#CreatingabootableblockdevicemSATAUSBuSD">Creating a bootable block device (mSATA/USB/uSD)</a>
     24      </li>
     25    </ol>
     26  </li>
     27</ol>
     28</div><p>
     29</p>
     30<h1 id="ThirdPartyLinux">Third Party Linux</h1>
     31<p>
     32While 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.
     33</p>
     34<h2 id="BuildingGateworksVentanakernel">Building Gateworks Ventana kernel</h2>
     35<h3 id="Sources">Sources</h3>
     36<p>
     37Gateworks has several kernel tree's to choose from hosted on Github <a class="ext-link" href="https://github.com/Gateworks/linux-imx6/branches"><span class="icon">​</span>here</a>
     38</p>
     39<ul><li>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:
     40<ul><li><strong>gateworks_3.10.17_1.0.0_ga - latest vendor kernel supporting device-tree (recommended)</strong>
     41</li><li>gateworks_3.0.35_4.0.0 - latest non device-tree vendor kernel
     42</li><li>gateworks_jb4.3_1.0.0-ga - latest Android Jellybean vendor kernel
     43</li></ul></li><li>Mainline linux kernel with patches for Gateworks Ventana: Missing some Freescale hardware support such as Video input/output, codec support and crypto support:
     44<ul><li>gateworks_3.15
     45</li><li>gateworks_3.14
     46</li><li>gateworks_3.13
     47</li><li>gateworks_3.12
     48</li></ul></li></ul><p>
     49Checking out source (for example, the gateworks_3.10.17_1.0.0_ga kernel):
     50</p>
     51<pre class="wiki">git clone https://github.com/Gateworks/linux-imx6.git gateworks_3.10.17_1.0.0_ga
     52cd gateworks_3.10.17_1.0.0_ga
     53</pre><h3 id="Building">Building</h3>
     54<p>
     55To build a kernel using an external toolchain (for example, an <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> toolchain built in /usr/src/openwrt-gw-trunk):
     56</p>
     57<pre class="wiki"># setup toolchain
     58export STAGING_DIR=/usr/src/openwrt/gw-trunk/trunk/staging_dir
     59export TOOLCHAIN=toolchain-arm_cortex-a9+neon_gcc-4.8-linaro_uClibc-0.9.33.2_eabi
     60export PATH=$PATH:$STAGING_DIR/$TOOLCHAIN/bin/
     61# set LOADADDR (necessary to make a uImage)
     62export LOADADDR=10008000
     63# use the Gateworks kernel config (optional)
     64ARCH=arm make gwventana_defconfig
     65# alter kenrel configuration (optional)
     66ARCH=arm make menuconfig
     67# build standard targets (uImage modules dtbs)
     68CROSS_COMPILE=arm-openwrt-linux- ARCH=arm make uImage modules dtbs
     69</pre><ul><li>Notes:
     70<ul><li>you can download a pre-built <a class="wiki" href="/wiki/OpenWrt">OpenWrt</a> toolchain for Ventana <a class="ext-link" href="http://dev.gateworks.com/openwrt/14.08/imx6/OpenWrt-Toolchain-imx6-for-arm_cortex-a9+neon-gcc-4.8-linaro_uClibc-0.9.33.2_eabi.tar.bz2"><span class="icon">​</span>here</a>
     71</li><li>if you are using the 3.0.35 non-device-tree kernel do not include <strong>dtbs</strong> in the make targets above
     72</li></ul></li></ul><p>
     73To create a tarball of uImage, modules and dtbs (suitable to un-tar on top of a rootfs):
     74</p>
     75<pre class="wiki">KERNEL_VER=$(cat include/config/kernel.release)
     76TARBALL=linux-$KERNEL_VER.tar
     77# create tarball containing kernel modules
     78find -name *.ko | xargs tar --transform "s,^.,/lib/modules/$KERNEL_VER," --show-transformed-names -cvf $TARBALL
     79# add modules database for depmod
     80tar --transform "s,^.,/lib/modules/$KERNEL_VER," --show-transformed-names -rvf $TARBALL ./modules.order ./modules.builtin
     81# add uImage (to /boot)
     82tar --transform "s,^arch/arm/boot,/boot," --show-transformed-names -rvf $TARBALL arch/arm/boot/uImage
     83# add dtbs (if using a device-tree kerhttps://github.com/Gateworks/linux-imx6.gitnel) to /boot)
     84tar --transform "s,^arch/arm/boot/dts,/boot," --show-transformed-names -rvf $TARBALL arch/arm/boot/dts/imx6*gw*.dtb
     85# gzip it
     86gzip -f $TARBALL
     87</pre><ul><li>Notes:
     88<ul><li>the <strong>transform</strong> 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
     89</li></ul></li></ul><h2 id="RootfilesystemSources">Root filesystem Sources</h2>
     90<p>
     91There 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.
     92</p>
     93<p>
     94Some popular third-party sources:
     95</p>
     96<ul><li><a class="ext-link" href="http://cdimage.ubuntu.com/ubuntu-core/releases/"><span class="icon">​</span>Ubuntu Core</a> - this is a minimal filesystem that you can build off of at runtime by adding packages from various repositories:
     97</li><li><a class="ext-link" href="https://releases.linaro.org/"><span class="icon">​</span>Linaro</a> - 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.
     98</li></ul><p>
     99Note that Gateworks has a pre-built disk image of Ubuntu for Ventana. See <a class="ext-link" href="http://trac.gateworks.com/wiki/ventana/ubuntu"><span class="icon">​</span>here</a> for details about it and more details on building Ubuntu root filesystems
     100</p>
     101<h2 id="CreatingabootableblockdevicemSATAUSBuSD">Creating a bootable block device (mSATA/USB/uSD)</h2>
     102<p>
     103The following procedure will for virtually all Linux distributions:
     104</p>
     105<ol><li>Download Root Filesystem (see above)
     106</li><li>Download or build Ventana rootfs containing a Kernel, device-tree dtbs, and kernel modules:
     107<ul><li>pre-built root filesystems:
     108<ul><li><a class="wiki" href="/wiki/Yocto/Building#yocto_prebuilt_binaries">Yocto BSP (Video in/out support)</a>
     109</li><li><a class="ext-link" href="http://dev.gateworks.com/openwrt/latest/imx6/openwrt-imx6-ventana-rootfs.tar.gz"><span class="icon">​</span>OpenWrt</a>
     110</li></ul></li></ul></li><li>Create image on block storage device.  For example, using /dev/sdc:
     111<pre class="wiki">DEVICE=/dev/sdc
     112# unmount all auto-mounted partitions for this device
     113sudo umount ${DEVICE}?
     114# partition disk - single ext partition
     115printf ",,L,,\n" | sudo sfdisk ${DEVICE}
     116sudo mkfs.ext4 -L UBUNTU ${DEVICE}1
     117# mount partition
     118sudo udisks --mount ${DEVICE}1
     119# untar the root filesystem downloaded (modify --strip-components parameter to strip subdirs as necessary depending on archive)
     120sudo tar --strip-components=1 --numeric-owner -xvzf linaro-raring-alip-20130826-474.tar.gz -C /media/UBUNTU/
     121# untar the Ventana kernel, modules, device-tree from Gateworks kernel archive
     122sudo tar --numeric-owner -C /media/UBUNTU/ -xvzf rootfs.tar.gz ./boot
     123sudo tar --numeric-owner -C /media/UBUNTU/ -xvzf rootfs.tar.gz ./lib/modules/
     124# unmount the disk
     125sudo umount ${DEVICE}1
     126</pre></li></ol><p>
     127Notes:
     128</p>
     129<ul><li>some root filesystems may require you to manually add a user before booting (ie Ubuntu Core)
     130</li><li>the default Ventana bootloader expects to find the uImage and dtbs in the /boot directory on the first partition of type ext2/3/4
     131</li></ul
     132}}}