4

I am trying to compile a new Linux kernel obtained from https://github.com/qoriq-open-source/linux (version 4.9) for T1042D4RDB-64B embedded board using Yocto. It's currently using 4.1.35-rt41.

I followed these steps:

  1. bitbake virtual/kernel -c cleansstate

  2. bitbake virtual/kernel -c patch

  3. replacing git folder with my new kernels source code (https://github.com/qoriq-open-source/linux)

  4. make ARCH=powerpc menuconfig

  5. bitbake virtual/kernel

Result is

The new kernel has compiled successfully but uImage does not contain the drivers I need. There are only 4 drivers in the new kernel (deploy/images/t1042d4rdb-64b/rootfs.tar.gz) which is "hid", "input", "misc" and "staging" like this.

There are lots of driver folders in Linux kernel 4.9 such as gpio,gpu,bluetooth, connector and so on..

Question is

How can I import the drivers I need to new uImage and put them into the board ? Or how can I compile this kernel and select the desired modules/drivers? I want a rich kernel like my Ubuntu kernel.

Jainil
  • 1,488
  • 1
  • 21
  • 26
Yusuf Altıparmak
  • 456
  • 1
  • 6
  • 16
  • Which layer do you use for your board support? In `meta-freescale` latest branch, there is already a [linux-qoriq_4.19.bb](https://github.com/Freescale/meta-freescale/blob/warrior/recipes-kernel/linux/linux-qoriq_4.19.bb) recipe selected from [qoriq-base.inc](https://github.com/Freescale/meta-freescale/blob/master/conf/machine/include/qoriq-base.inc) – Nayfe Nov 13 '19 at 15:14
  • @Nayfe in my 'meta-freescale', it's linux-qoriq_4.1.bb. I am using NXP SDK v 2.0 -1703. Should I change that bitbake file to 4.19? – Yusuf Altıparmak Nov 13 '19 at 17:58

2 Answers2

7

Kernel Configuration:

The driver selection happens when compiling the kernel via the .config file. You can configure the kernel (including the drivers used) via menuconfig:

bitbake -c menuconfig virtual/kernel

Now, you need to convince bitbake to use those working changes. To do so you need to force compile the kernel:

bitbake -f -c compile virtual/kernel

Finally, you can compile the image and flash it on the target.

This though, does not make the changes permanent. To make the changes permanent you need a custom layer and a bbappend file. It's quite easy to do this with the devtool. The yocto mega manual explains the procedure in some detail. Here I'll just explain the very basic steps. Running

devtool modify virtual/kernel

will add a temporary working copy inside build/workspace/sources/linux-mainline (provided the kernel you use is called kernel-mainline) on a local branch. Here you can make all the changes you want and try them on the your hardware. Once you're happy and want to add those changes to your recipe you need to commit those. Finally running

devtool finish linux-mainline <path-to-your-layer> 

will automatically generate a .bbappend and a defconfig (.config) file and put it inside your layer. If you want to patch some drivers etc. you probably want to take a look at the kernel-dev section of the manual.

Kernel Version selection:

I'm not quite sure about this one, but it should work like this: You need a recipe for the kernel already available as a recipe any layer known to bitbake. If you're not sure take a look at the openembedded layer index and search for the kernel version you want to use, download the recipe and put it inside your layer. Lastly you need to tell bitbake to use this version. This can be done inside the build/local.conf configuration file:

PREFERED_VERSION_linux-mainline = "5.3.11"

I have never tried the last one and have no clue if it works or what other dependencies this could break.

Stanislav
  • 155
  • 2
  • 9
  • Thanks for the clear answer. I am actually trying to embed 'amdgpu' driver which is available after kernel version 4.2. The SDK I use which is https://www.nxp.com/docs/en/supporting-information/QORIQ-SDK-2.0-IC-REV0.pdf provides kernel version 4.1.x and does not contain amdgpu folder on 'drivers' section. Do you have any suggestion for me ? – Yusuf Altıparmak Nov 14 '19 at 16:19
  • In my sdk, they arranged a spesific linux version from http://git.freescale.com/git/cgit.cgi/ppc/sdk/linux.git/ branc = sdkv2.0.x and declaring this in a spesific layer and in a spesific .bb file. Layer name is meta-freescale/recipes-kernel/linux/linux-qoriq_4.1.bb. Does changing the 'SRC_URI' from http://git.freescale.com/git/cgit.cgi/ppc/sdk/linux.git/ to another higher linux distribution can solve this problem ? – Yusuf Altıparmak Nov 14 '19 at 16:23
  • I was trying to use this recipe https://github.com/Freescale/meta-freescale/blob/master/recipes-kernel/linux/linux-qoriq_4.19.bb but dealing with a couple of problems because it is not compatible with my SDK. – Yusuf Altıparmak Nov 14 '19 at 16:25
  • I found another kernel image seems compatible with my SDK and has kernel version 4.4. https://github.com/qoriq-open-source/linux/tree/linux-v4.4-1703. I'll try your steps. – Yusuf Altıparmak Nov 15 '19 at 12:52
  • 1
    If you can't find a BSP for your board with the kernel you want you use I'm afraid you're out of luck. Adding another/new kernel to a existing BSP is not trivial since many distributors and hardware manufacturers add custom patches which may not work without modifications. – Stanislav Nov 15 '19 at 14:27
  • You are right. I have been dealing couple of errors since trying to use another kernel on my bsp. All i need is importing amdgpu driver but i do not see any other option except inserting a new kernel with higher level. – Yusuf Altıparmak Nov 15 '19 at 15:49
  • I succesfully managed to change linux version. It's compiling all the drivers with representing .o files. But there are still some problems like, it does not deploy all the .ko files I selected from menuconfig. – Yusuf Altıparmak Nov 19 '19 at 19:48
1

I found the solution by upgrading Yocto version from 2.0 to 2.7. The version I used was newly designed for my board(t1042d4rdb-64b) including linux kernel 4.19.xxx. Installation instructions can be found here https://source.codeaurora.org/external/qoriq/qoriq-components/yocto-sdk/tree/readme?h=yocto_2.7

Yusuf Altıparmak
  • 456
  • 1
  • 6
  • 16