Mainline kernel 4.13.2 customization for Colibri iMX6DL module

Hello,

I will dedicate this thread to attempt to build mainline 4.13.2 kernel for Colibri iMX6DL 512MB V1.1A, and include it in YOCTO build, so I can have Morty with 4.13.2 as final result. So, questions will follow as I progress to the target/final result.

I decided to start playing with TORADEX dts definitions, since, as suggested, they are embedded in the kernel mainline.

And, yes, they are:

user@localhost linux-4.13.2]$ find . -name imx6dl-colibri*
./arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
[user@localhost linux-4.13.2]$ 

In oredr to set the following: make menuconfig for Colibri iMX6, I need to have another file, called: colibri-imx6-defconfig. So, before I compile dts within 4.13.2, I would like to do: make arch=ARM colibri-imx6-defconfig .

But, interestingly enough, I am not finding this file in 4.13.2 internal structures?!

[user@localhost linux-4.13.2]$ find . -name colibri*
./drivers/input/touchscreen/colibri-vf50-ts.c
./Documentation/devicetree/bindings/input/touchscreen/colibri-vf50-ts.txt
./arch/arm/configs/colibri_pxa300_defconfig
./arch/arm/configs/colibri_pxa270_defconfig
./arch/arm/mach-pxa/colibri-pxa320.c
./arch/arm/mach-pxa/colibri-evalboard.c
./arch/arm/mach-pxa/colibri-pxa3xx.c
./arch/arm/mach-pxa/colibri-pxa300.c
./arch/arm/mach-pxa/colibri-pxa270.c
./arch/arm/mach-pxa/colibri-pxa270-income.c
./arch/arm/mach-pxa/colibri.h
[user@localhost linux-4.13.2]$ 

The question is: why? Having the ./arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts really does not imply having that one: root/arch/arm/configs/colibri_imx6_defconfig , does it???

Or should I use: root/arch/arm/configs/imx_v6_v7_defconfig??? Actually, what is the difference between these two deconfigs: colibri_imx6_defconfig and imx_v6_v7_defconfig?!

The another questions (as process continues) might follow on this thread.

Thank you,
nobody

The question is: why? Having the ./arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts really does not imply having that one: root/arch/arm/configs/colibri_imx6_defconfig , does it???

No, mainline long since abandoned per board default configurations in favor of more generic SoC group specific ones.

Or should I use: root/arch/arm/configs/imx_v6_v7_defconfig??? Actually, what is the difference between these two deconfigs: colibri_imx6_defconfig and imx_v6_v7_defconfig?!

Yes, imx_v6_v7_defconfig is usually what is used and our downstream one is simply more specific. You may of course fine tune this as to your specific requirements and personal taste.

What is the reason for this error??? I am using TORADEX native arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts .

The question is what exactly do you mean by Toradex native? Please note that you may not mix and match device trees of downstream and mainline Linux kernel versions.

How about just doing the following like the rest of the world?

[user@host linux-stable.git]$ make ARCH=arm CROSS_COMPILE=~/gcc-linaro-7.1.1-2017.08- imx_v6_v7_defconfig
[user@host linux-stable.git]$ make ARCH=arm CROSS_COMPILE=~/gcc-linaro-7.1.1-2017.08-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf- imx6dl-colibri-eval-v3.dtb

Another problem as I proceed (CLI transcript follows):

user@localhost linux-4.13.2]$ which dtc
~/toradex/Qt5-plus-x11/oe-core/build/tmp-glibc/sysroots/x86_64-linux/usr/bin/dtc
[user@localhost linux-4.13.2]$ env | grep C
ARCH=arm
HISTCONTROL=ignoredups
COLORTERM=truecolor
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
XDG_CURRENT_DESKTOP=GNOME
CROSS_COMPILE=arm-angstrom-linux-gnueabi-
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/1787,unix/unix:/tmp/.ICE-unix/1787
BASH_FUNC_module%%=() {  eval `/usr/bin/modulecmd bash $*`
BASH_FUNC_scl%%=() {  local CMD=$1;
 if [ "$CMD" = "load" -o "$CMD" = "unload" ]; then
[user@localhost linux-4.13.2]$ dtc -I dts -O dtb arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
Error: arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts:46.1-9 syntax error
FATAL ERROR: Unable to parse input tree
[user@localhost linux-4.13.2]$

Error: arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts:46.1-9 syntax error

What is the reason for this error??? I am using TORADEX native arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts .

Yet another question (following the resolution of 46.1-9 syntax error), belonging to this topic?! Where should I store the output: imx6dl-colibri-eval-v3.dtb? In which 4.13.2/…/ directory, so it can be picked by kernel source make command?

Thank you,
nobody

Device trees shipped with kernel can’t be build like that. you really should use in kernel make scripts to build them.
Here you can see what’s happening during in-kernel build:

make -f ./scripts/Makefile.build obj=arch/arm/boot/dts MACHINE= arch/arm/boot/dts/imx6dl-colibri-eval-v3.dtb
  mkdir -p arch/arm/boot/dts/ ; 
arm-linux-gnueabihf-gcc -E -Wp,-MD,arch/arm/boot/dts/.imx6dl-colibri-eval-v3.dtb.d.pre.tmp -nostdinc -I./scripts/dtc/include-prefixes -undef -D__DTS__ -x assembler-with-cpp -o arch/arm/boot/dts/.imx6dl-colibri-eval-v3.dtb.dts.tmp arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts ;
./scripts/dtc/dtc -O dtb -o arch/arm/boot/dts/imx6dl-colibri-eval-v3.dtb -b 0 -iarch/arm/boot/dts/ -i./scripts/dtc/include-prefixes -Wno-unit_address_vs_reg -Wno-simple_bus_reg -Wno-unit_address_format -Wno-pci_bridge -Wno-pci_device_bus_num -Wno-pci_device_reg  -d arch/arm/boot/dts/.imx6dl-colibri-eval-v3.dtb.d.dtc.tmp arch/arm/boot/dts/.imx6dl-colibri-eval-v3.dtb.dts.tmp ; 
cat arch/arm/boot/dts/.imx6dl-colibri-eval-v3.dtb.d.pre.tmp arch/arm/boot/dts/.imx6dl-colibri-eval-v3.dtb.d.dtc.tmp > arch/arm/boot/dts/.imx6dl-colibri-eval-v3.dtb.d

What about this (CLI transcript follows):

user@localhost kernel.org]$ ls -al
total 98236
drwxrwxr-x.  4 user user      4096 Sep 21 07:53 .
drwxrwxr-x. 16 user user      4096 Sep 14 11:55 ..
drwxrwxr-x. 25 user user      4096 Sep 21 10:53 linux-4.13.2
-rw-rw-r--.  1 user user 100574388 Sep 14 11:55 linux-4.13.2.tar.xz
drwxrwxr-x. 24 user user      4096 Sep 21 08:34 linux-toradex
[user@localhost kernel.org]$ cp linux-toradex/arch/arm/configs/colibri_imx6_defconfig linux-4.13.2/arch/arm/configs/colibri_imx6_defconfig 
[user@localhost kernel.org]$ cd -
/home/user/projects/kernel.org/linux-4.13.2
[user@localhost linux-4.13.2]$ ls -al arch/arm/configs/colibri_imx6_defconfig
-rw-rw-r--. 1 user user 8968 Sep 21 11:05 arch/arm/configs/colibri_imx6_defconfig
[user@localhost linux-4.13.2]$ env | grep C
ARCH=arm
HISTCONTROL=ignoredups
COLORTERM=truecolor
SSH_AUTH_SOCK=/run/user/1000/keyring/ssh
XDG_CURRENT_DESKTOP=GNOME
CROSS_COMPILE=arm-angstrom-linux-gnueabi-
GJS_DEBUG_TOPICS=JS ERROR;JS LOG
SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/1787,unix/unix:/tmp/.ICE-unix/1787
BASH_FUNC_module%%=() {  eval `/usr/bin/modulecmd bash $*`
BASH_FUNC_scl%%=() {  local CMD=$1;
 if [ "$CMD" = "load" -o "$CMD" = "unload" ]; then
[user@localhost linux-4.13.2]$ make distclean
  CLEAN   .
  CLEAN   arch/arm/kernel
  CLEAN   arch/arm/vdso
  CLEAN   crypto
  CLEAN   drivers/tty/vt
  CLEAN   drivers/video/logo
  CLEAN   kernel
  CLEAN   lib
  CLEAN   usr
  CLEAN   arch/arm/boot/compressed
  CLEAN   arch/arm/boot/dts
  CLEAN   arch/arm/boot
  CLEAN   .tmp_versions
  CLEAN   scripts/basic
  CLEAN   scripts/dtc
  CLEAN   scripts/genksyms
  CLEAN   scripts/kconfig
  CLEAN   scripts/mod
  CLEAN   scripts
  CLEAN   include/config include/generated arch/arm/include/generated
  CLEAN   .config .config.old .version Module.symvers
[user@localhost linux-4.13.2]$ make colibri_imx6_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
[user@localhost linux-4.13.2]$ ls -al arch/arm/boot/dts/*.dtb
ls: cannot access 'arch/arm/boot/dts/*.dtb': No such file or directory
[user@localhost linux-4.13.2]$ make dtbs
scripts/kconfig/conf  --silentoldconfig Kconfig
  SYSHDR  arch/arm/include/generated/uapi/asm/unistd-common.h
  SYSHDR  arch/arm/include/generated/uapi/asm/unistd-oabi.h
  SYSHDR  arch/arm/include/generated/uapi/asm/unistd-eabi.h
  CHK     include/config/kernel.release
  UPD     include/config/kernel.release
  WRAP    arch/arm/include/generated/uapi/asm/bitsperlong.h
  WRAP    arch/arm/include/generated/uapi/asm/errno.h

  [snap]

  WRAP    arch/arm/include/generated/asm/trace_clock.h
  WRAP    arch/arm/include/generated/asm/unaligned.h
  CHK     include/generated/uapi/linux/version.h
  UPD     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  UPD     include/generated/utsrelease.h
  HOSTCC  scripts/basic/bin2c
  SYSNR   arch/arm/include/generated/asm/unistd-nr.h
  GEN     arch/arm/include/generated/asm/mach-types.h
  SYSTBL  arch/arm/include/generated/calls-oabi.S
  SYSTBL  arch/arm/include/generated/calls-eabi.S
  CC      kernel/bounds.s
  CHK     include/generated/bounds.h
  UPD     include/generated/bounds.h
  CHK     include/generated/timeconst.h
  UPD     include/generated/timeconst.h
  CC      arch/arm/kernel/asm-offsets.s
  CHK     include/generated/asm-offsets.h
  UPD     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  HOSTCC  scripts/dtc/dtc.o
  HOSTCC  scripts/dtc/flattree.o

  [snap]

  HOSTCC  scripts/asn1_compiler
  DTC     arch/arm/boot/dts/imx6dl-apf6dev.dtb
  DTC     arch/arm/boot/dts/imx6dl-aristainetos_4.dtb
  DTC     arch/arm/boot/dts/imx6dl-aristainetos_7.dtb
  DTC     arch/arm/boot/dts/imx6dl-aristainetos2_4.dtb
  DTC     arch/arm/boot/dts/imx6dl-aristainetos2_7.dtb
  DTC     arch/arm/boot/dts/imx6dl-colibri-eval-v3.dtb
  DTC     arch/arm/boot/dts/imx6dl-cubox-i.dtb
  DTC     arch/arm/boot/dts/imx6dl-dfi-fs700-m60.dtb

  [snap]

  DTC     arch/arm/boot/dts/imx6qp-nitrogen6_som2.dtb
  DTC     arch/arm/boot/dts/imx6qp-sabreauto.dtb
  DTC     arch/arm/boot/dts/imx6qp-sabresd.dtb
  DTC     arch/arm/boot/dts/imx6qp-zii-rdu2.dtb
[user@localhost linux-4.13.2]$  

And then… CLI follows (I like practical execution, I do not like to guess):

[user@localhost linux-4.13.2]$ ls -al arch/arm/boot/dts/imx6dl-colibri*
-rw-rw-r--. 1 user user 44739 Sep 21 11:11 arch/arm/boot/dts/imx6dl-colibri-eval-v3.dtb
-rw-rw-r--. 1 user user  5693 Sep 21 10:39 arch/arm/boot/dts/imx6dl-colibri-eval-v3.dts
[user@localhost linux-4.13.2]$ 

Now I can proceed to do make, since I have arch/arm/boot/dts/imx6dl-colibri-eval-v3.dtb in the correct place in the kernekl tree, and did the correct downstream make colibri_imx6_defconfig, am I correct? :wink:

Thank you,
nobody

It’s better to use defconfig form the kernel you’re compiling (which is, as Marcel wrote, imx_v6_v7_defconfig in mainline, kernel is evolving and configs sometimes change names/locations). Building the device tree is not a prerequisite for building kernel. You can also follow Marcel’s instructions and build just the device tree you want istead of all of them.

Dominik,

I have terrible problems with your services. It is again waiting moderation.

For me, if I do NOT make specific kernel 4.13.2 to Morty, all this dicussion does not have any value for me. I already said that I would like to replace 4.1.2 kernel with 4.13.2 on Colibri Evaluation Board V3.2 .

So, I MUST compile DTS file prior kernel, since after I recompile this kernel, I would like to include it into the YOCTO Morty release.

Thank you,
nobody

Actually, since colibri_imx6_defconfig file and arch/arm/boot/dts/imx6dl-colibri-eval-v3.dtb worked (at least for me), the kernel 4.13.2 cross compilation (for only 10 minutes in total) and imx6dl-colibri-eval-v3.dtb compilation worked, what should I do the next?

I also verified/inspected vmlinuz elf binary with readelf -a -W vmlinuz, and yes, the target architecture is correct (armv7).

I have here several possibilities how I can proceed, but only one is important/makes sense. How should I include new kernel into YOCTO build, then rebuild the whole story again, this time with 4.13.2 instead 4.1.41?

Should I find old kernel 4.1.41 recipe, and write using it as template the new recipe for 4.13.2? And where is the recipe location for the current kernel 4.1.41? In which directory it lives (after repo sync command: High performance, low power Embedded Computing Systems | Toradex Developer Center)?

So, maybe, I can follow these recipes, and try to write my own recipes for kernel.org/4.13.2 (excellent exercise)? Please, advice?

Thank you,
nobody

Kernel recipes for imx6 can be found here linux « recipes-kernel - meta-toradex-nxp.git - Toradex BSP layer, recipes for NXP based modules
You can create a 4.13.2 recipe based on them.
Here you can find our mainline/longterm configuration for TK1, it may be helpfull:
meta-toradex-tegra.git - Toradex BSP layer, recipes for NVIDIA Tegra based modules

Please note that mainline code is out of our control, so support for colibri imx6 is best effort. We provide no guarantees and limited support.

Dominik,

Copy that. This, what I am trying to do is just an exercise. I do understand that some features might not work, via the system/application API discrepancies. It might not work at all. And, sure, nobody to be blamed, from TORADEX side. All blame on me.

I will need here some hands, especially from Max.tx. As Max is probably most knowledgeable about what I’ll try to do.

Since I need to read a bit bitbake manual, in order to get the idea, it’ll take more time. I am working on it as we speak.

(Jede Tag habe ich merere probleme und herausanforderungen mit meiner schlehter Deutsche Sprache, und mit diese bitbake scripten, aber keine Zeit jetzt fur zuruck zu machen, nur musse ich vorwarts drucken/musse ich funktionieren - whatever does not kill, rather strengthens) :wink:

I’ll come later, when I’ll have the first clumsy cut of the 4.13.2.bb script for this purpose/review… Bang!

nobody

And here is my first cut of the linux-generic_4.13.2.bb file. There will be also the directory linux-generic_4.13.2/ :

[user@localhost linux]$ pwd
/home/user/toradex/Qt5-plus-x11/oe-core/layers/meta-toradex-nxp/recipes-kernel/linux
[user@localhost linux]$ ls -al linux-generic*
-rw-rw-r--. 1 user user 1772 Sep 22 10:36 linux-generic_4.13.2.bb

linux-generic-4.13.2:
total 32
drwxrwxr-x.  2 user user 4096 Sep 21 14:41 .
drwxrwxr-x. 12 user user 4096 Sep 22 10:36 ..
-rw-rw-r--.  1 user user 8968 Sep 21 14:40 colibri_imx6_defconfig
-rw-rw-r--.  1 user user 8968 Sep 21 14:41 defconfig
[user@localhost linux]$ 

And the linux-generic_4.13.2.bb file looks like:

SUMMARY = "Mainline Linux kernel LTSI - to do: make for ARM architecture"
SECTION = "kernel"
LICENCE = "GPLv2"

## LIC_FILES_CHKSUM = "file//COPYING;md5=xxxx"

inherit kernel
require recipes-kernel/linux/linux-yocto.inc
require recipes-kernel/linux/linux-dtb.inc

SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git;protocol=git;bareclone=1"

## This will be actually copied as defconfig: colibri_imx6_defconfig
SRC_URI += "file://defconfig"

PR = "r0"
PV = "${LINUX_VERSION}"

## DEPENDS += "lzop-native bc-native"
## COMPATIBLE_MACHINE = "(mx7|mx6)"

Here, I would like max.tx to inspect my creation (nobody, you’ve created a monster ;-] ) and point to me errors, missing parts… Or how it will look with necessary corrections?!

Few questions:

[1] LIC_FILES_CHKSUM → I do not have any, and do not know how to generate/find it?

[2] How to make YOCTO to compile the complete .dts Device Tree in arch/arm/boot/dts with command make dtbs (or this will be done automatically)?

[3] How to ensure that bitbake exactly picks my creation and creates by for me wanted 4.13.2 in Deploy/images?

Thank you,
nobody

Copy that. This, what I am trying to do is just an exercise.

Please note that we only have very limited resources available to assist such hobby projects.

1 LIC_FILES_CHKSUM → I do not have any, and do not know how to generate/find it?

Please have a look at the manual.

2 How to make YOCTO to compile the complete .dts Device Tree in arch/arm/boot/dts with command make dtbs (or this will be done automatically)?

Yes, if done properly it will be done automatically.

[3] How to ensure that bitbake exactly picks my creation and creates by for me wanted 4.13.2 in Deploy/images?

Please have a look at @dominik.tx previous suggestion e.g. here.

Please note that we only have very limited resources available to assist such hobby projects.

I would like to thank you for your answers. I have very tough set of tests… In order to understand the supplier environment. Here I will stop asking. TORADEX will be removed from my list of potential suppliers.

I could NOT allow such answers to the multi-million project. We here need to develop and support the customers with very stringent requirements. Such peculiar answers are NO GO.

I will continue with Yocto Project support and with other iMX6/iMX7 suppliers (since I need to start investing a precious Time into 'em) equipment testing.

In my business World, Professionalism is THE IMPERATIVE. Sorry for being brutally honest… :frowning:

Good Luck,
nobody