9 | | When choosing a kernel source you need to determine what support you are interested in. Gateworks recommends using our Gateworks downstream vendor kernel if you are needing full hardware support as the mainline Linux kernel is still lacking certain IMX6 support. |
10 | | |
11 | | == Newport Kernel == |
12 | | |
13 | | It is highly recommended to visit the [wiki:newport/bsp#kernel Newport BSP page kernel section] for more information about the Newport kernel. |
14 | | |
15 | | === Gateworks downstream vendor kernel === |
16 | | Gateworks maintains a downstream Linux kernel that contains patches from Freescale and Gateworks to add support for Ventana including some items that have not made it into mainline Linux yet. |
| 9 | When choosing a kernel source you need to determine what support you are interested in. |
| 10 | |
| 11 | === Mainline upstream Linux kernel |
| 12 | Gateworks usually recommends using the mainline or upstream Linux kernel because it has the most up-to-date features and bug-fixes that have been accepted and peer reviewed from the widest array of kernel developers around the world. |
| 13 | |
| 14 | The 'mainline' Linux kernel is the one officially released by Linus Torvalds and has an approximate release cycle of every 6 months. |
| 15 | |
| 16 | Resources: |
| 17 | * [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git Linux git] |
| 18 | * https://www.kernel.org |
| 19 | |
| 20 | See also: |
| 21 | * [wiki:ventana/#mainline-linux Gateworks mainline linux details and patches] |
| 22 | * http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git - source |
| 23 | * https://www.kernel.org/ - source archives |
| 24 | * http://kernelnewbies.org/LinuxVersions - Linux version info |
| 25 | |
| 26 | |
| 27 | === Stable Kernel |
| 28 | The Stable Kernel adds backported bugfixes on top of previous mainline Linux kernel releases. A variant of this is the Long Term Support (LTS) kernel versions that are supported by the community for typically 4 years. |
| 29 | |
| 30 | Resources: |
| 31 | * [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/ Linux Stable Git] |
| 32 | |
| 33 | |
| 34 | === Gateworks Newport kernel (OcteonTX) |
| 35 | Gateworks maintains a kernel for the OcteonTX tailored (Newport product family) based off a mainline Linux kernel with additional patches that may not be available in the mainline kernel yet. |
| 36 | |
| 37 | Resources: |
| 38 | * [https://github.com/Gateworks/linux-newport linux-newport Git] |
| 39 | * [http://trac.gateworks.com/wiki/newport/bsp#kernel Newport Kernel wiki section] |
| 40 | |
| 41 | |
| 42 | === Gateworks Ventana downstream vendor kernel (IMX6) |
| 43 | Gateworks maintains a downstream IMX6 Linux kernel that contains patches from Freescale and Gateworks to add support for Ventana including some items that have not made it into mainline Linux yet. |
28 | | |
29 | | === Mainline upstream linux kernel === |
30 | | The mainline Linux kernel is missing the following support (which is present in the Gateworks vendor kernel): |
31 | | * IMX6 video capture (this is slowly being worked on but not yet present as of 4.2) |
32 | | * adv7393 analog video output (GW54xx) |
33 | | * HW crypto support |
34 | | * IMX6 GPU driver (there is work ongoing on an open-source reverse engineered Vivante driver called [https://github.com/laanwj/etna_viv etna_viv]) |
35 | | * VPU support (technically, the upstream coda driver does support the chips-and-media VPU but not in a way that gstreamer can utilize it) |
36 | | |
37 | | See also: |
38 | | * [wiki:ventana/#mainline-linux Gateworks mainline linux details and patches] |
39 | | * http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git - source |
40 | | * https://www.kernel.org/ - source archives |
41 | | * http://kernelnewbies.org/LinuxVersions - Linux version info |
127 | | * for mainline '''Linux v4.1''' for example (which is missing video capture support for IMX6/Ventana): |
128 | | {{{#!bash |
129 | | git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git |
130 | | cd linux |
131 | | git checkout v4.1 |
132 | | }}} |
133 | | |
134 | | 4. Setup shell env for building: |
135 | | * Note that the paths here are dependent on the toolchain you installed. The following is for the pre-built Gateworks OpenWrt 14.08 BSP toolchain: |
| 158 | |
| 159 | 4. Setup shell environment for building which depends on the toolchain you are using. This includes the following env variables used by the kernel build system: |
| 160 | * ARCH - the architecture to build (arm for 32bit ARM such as Ventana IMX6, arm64 for 64bit ARMv8 such as Newport CN80xx) |
| 161 | * CROSS_COMPILE - the prefix the toolchain you are using has prior to the gcc executables (everything before the 'gcc'). |
| 162 | * PATH - make sure the directory where the toolchains compiler (${CROSS_COMPILE}gcc) executable exists. Typically you will prepend this to the default PATH |
| 163 | * INSTALL_MOD_PATH - where to install kernel modules too if using the 'modules_install' build target (in our examples we install to ./install) |
| 164 | * INSTALL_HDR_PATH - where to install header files if using the 'headers_install' build target (in our examples we install to ./install) |
| 165 | * LOADADDR - where to relocate/uncompress the kernel to when using the uImage target |
| 166 | * Examples: |
| 167 | - using the pre-built Gateworks OpenWrt 14.08 BSP toolchain: |
178 | | 6. Build kernel: |
179 | | {{{#!bash |
180 | | LOADADDR=0x10008000 make uImage modules dtbs modules_install |
181 | | }}} |
182 | | * the default make target will build zImage, modules, and dtbs - we want uImage, modules and dtbs |
183 | | * when building a multi-arch kernel, the build system needs to know the load address to put in the u-boot image header which you provide via the LOADADDR env var. For IMX6 its 0x10008000 |
184 | | * the firmware_install make target can also be specified if you need specific firmware to be placed in $INSTALL_MOD_PATH/lib/firmware |
185 | | * The uImage make target builds a U-Boot image of the kernel |
186 | | * The dtbs make target builds the device-tree binaries needed to boot the Ventana kernel (not used for non device-tree kernels) |
187 | | * The modules_install make target installs the kernel modules to the INSTALL_MOD_PATH directory |
188 | | * After building and copying the uImage and dtbs to install/boot, you can copy or extract the contents of the install directory to your Linux root filesystem taking care to make the user and group root |
189 | | * headers will be in the install dir |
190 | | |
191 | | 6. Copy additional artifacts: |
192 | | {{{#!bash |
193 | | mkdir $INSTALL_MOD_PATH/boot |
194 | | cp arch/arm/boot/uImage arch/arm/boot/dts/imx6*gw*.dtb $INSTALL_MOD_PATH/boot |
195 | | }}} |
196 | | |
197 | | If you wish to make a tarball of this kernel relative to the root fs: |
198 | | {{{#!bash |
199 | | tar -C $INSTALL_MOD_PATH --owner=0 --group=0 -cvzf linux-4.1.tar.gz . |
200 | | }}} |
201 | | |
202 | | If you need kernel headers for development you can build them via: |
203 | | {{{#!bash |
204 | | make headers_install |
205 | | }}} |
206 | | * headers will be in INSTALL_HDR_PATH which we set to the install subdir above |
207 | | |
208 | | If you wish to add additional drivers from a newer kernel (for example, you are using the 3.14.x Gateworks downstream vendor kernel but wish to have updated wireless drivers) see [#backports below]. |
| 212 | 6. Build kernel targets. What targets you build depends on the product family and the bootloader or boot method you are using. Some common examples are: |
| 213 | * Image - uncompressed kernel (use this for Newport/CN80XX arm64 targets) |
| 214 | * uImage - compressed kernel wrapped in a U-Boot image header (use this for Ventana/IMX6) which requires the $LOADADDR env variable to tell U-Boot where to uncompress the kernel to |
| 215 | * modules - for building loadable kernel modules (*.ko) |
| 216 | * modules_install - for installing the loadable kernel modules to $INSTALL_MOD_PATH |
| 217 | * headers_install - for installing kernel header files to $INSTALL_HDR_PATH |
| 218 | * dtbs - for building device-tree blobs (*.dtb) from kernel source tree (Ventana/IMX6; for Newport we use out-of-kernel tree device-tree) |
| 219 | * Examples: |
| 220 | - Newport/CN80XX: |
| 221 | {{{#!bash |
| 222 | make Image modules modules_install headers_install |
| 223 | }}} |
| 224 | - Ventana/IMX6: |
| 225 | {{{#!bash |
| 226 | make uImage dtbs modules modules_install headers_install |
| 227 | }}} |
| 228 | |
| 229 | 6. Copy artifacts (depends on target): |
| 230 | * kernel images (Image/uImage) will be in arch/$ARCH/boot |
| 231 | * dtbs will be in arch/$ARCH/boot/dts |
| 232 | * modules will be in $INSTALL_MOD_PATH. You can create a tarball via: |
| 233 | {{{#!bash |
| 234 | tar -C $INSTALL_MOD_PATH --owner=0 --group=0 -cvJf modules.tar.xz . |
| 235 | }}} |
| 236 | |
278 | | == Updating the kernel dtbs and modules on a running target == |
279 | | If you want to update the kernel, dtbs, and modules on a running target using the tarball created after building the kernel (see above), you can do this by booting and using: |
| 301 | == Installing or Updating the kernel artifacts |
| 302 | Installation of a newly build kernel and other artifacts (headers, modules, dtbs) depends on the target platform and how you are booting it. |
| 303 | |
| 304 | Kernel modules are located in a directory structure /lib/modules/(kernel_version) which matches the structure used when you install the modules with the 'modules install' build target. If you created a tarball of the kernel modules you can install those on your target as such: |