VAR-SOM-MX6 Yocto Fido R2 Customize linux-variscite

From Variscite Wiki
VAR-SOM-MX6 - Customize linux-variscite

Introduction

We deliver a complete Linux in source code adopted to our development platforms. Our customers may require additional changes. Yocto is not the best environment to do Linux kernel development. We recommend to start with building the Linux out of Yocto tree and using NFS development environment to test the changes. Once you have the changes ready create a patch and copy it to the linux-variscite in the Yocto source code. Rebuild your Yocto and you will have a complete Yocto with your Linux kernel changes.

Linux out of tree and NFS

Please start with:

Linux Changes

Make your kernel changes and test them. Most of the changes will be in Linux kernel configuration. For example:

Add a printer gadget
$ make -j4 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- menuconfig

Add module.png

Changes made:

 diff .config arch/arm/configs/imx_v7_var_defconfig 
3359c3359
< CONFIG_USB_G_PRINTER=m
---
> # CONFIG_USB_G_PRINTER is not set

Create a new config file

$ cp .config arch/arm/configs/imx_v7_var_custom_defconfig 
$ git status
On branch imx_3.14.38_6qp_ga_var01
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	arch/arm/configs/imx_v7_var_custom_defconfig

nothing added to commit but untracked files present (use "git add" to track)
$ git add arch/arm/configs/imx_v7_var_custom_defconfig
$ git commit -a -m "Custom"
$ git format-patch e07c324139f484b2050da7cf47ec8951b23e2679..550359cea510133050e904c8b8191587d173abc9

Copy patch file to Yocto

$ mkdir ~/var-som-mx6-yocto-fido/sources/meta-variscite-mx6/recipes-kernel/linux/linux-variscite
$ cp 0001-Custom.patch ~/var-som-mx6-yocto-fido/sources/meta-variscite-mx6/recipes-kernel/linux/linux-variscite/0001-custom.patch 

Yocto changes

Patch in meta-variscite linux-variscite_3.14.38.bb:

diff --git a/recipes-kernel/linux/linux-variscite_3.14.38.bb b/recipes-kernel/linux/linux-variscite_3.14.38.bb
index f58a8fd..70ddb59 100755
--- a/recipes-kernel/linux/linux-variscite_3.14.38.bb
+++ b/recipes-kernel/linux/linux-variscite_3.14.38.bb
@@ -17,10 +17,12 @@ SRCBRANCH = "imx_3.14.38_6qp_ga_var01"
 LOCALVERSION = "-6QP"
 SRCREV = "5b280915311efd196a81a8792e7f952172f6373c"
 KERNEL_SRC ?= "git://github.com/varigit/linux-2.6-imx.git;protocol=git"
-SRC_URI = "${KERNEL_SRC};branch=${SRCBRANCH}"
+SRC_URI = "${KERNEL_SRC};branch=${SRCBRANCH} \
+          file://0001-custom.patch \
+          "
 #LOCALVERSION = "-1.1.0"
 
-FSL_KERNEL_DEFCONFIG = "imx_v7_var_defconfig"
+FSL_KERNEL_DEFCONFIG = "imx_v7_var_custom_defconfig"
 
 KERNEL_IMAGETYPE = "uImage"
 
@@ -28,14 +30,14 @@ KERNEL_EXTRA_ARGS += "LOADADDR=${UBOOT_ENTRYPOINT}"
 
 do_configure_prepend() {
    # copy latest defconfig for imx_v7_var_defoonfig to use
-   cp ${S}/arch/arm/configs/imx_v7_var_defconfig ${B}/.config
-   cp ${S}/arch/arm/configs/imx_v7_var_defconfig ${B}/../defconfig
+   cp ${S}/arch/arm/configs/${FSL_KERNEL_DEFCONFIG} ${B}/.config
+   cp ${S}/arch/arm/configs/${FSL_KERNEL_DEFCONFIG} ${B}/../defconfig
 }
 
 
 # Copy the config file required by ti-compat-wirless-wl18xx
 do_deploy_append () {
-   cp ${S}/arch/arm/configs/imx_v7_var_defconfig ${S}/.config
+   cp ${S}/arch/arm/configs/${FSL_KERNEL_DEFCONFIG} ${S}/.config
 }
 

Build and run the system

On target:

root@var-som-mx6:~# find /lib/modules/ -name *.ko | grep print
/lib/modules/3.14.38-6QP+g5b28091/kernel/drivers/usb/gadget/g_printer.ko