Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 880A1C3DA7F for ; Tue, 30 Jul 2024 21:48:33 +0000 (UTC) Subject: Kernel development: integrating device driver in Kernel (Patch) To: yocto@lists.yoctoproject.org From: gavrosc@yahoo.com X-Originating-Location: =?UTF-8?B?VmFlc3RyYSBGcm9lbHVuZGEsIFbDpHN0cmEgR8O2dGFsYW5kIENvdW50eSwgU0U=?= (83.253.125.5) X-Originating-Platform: Linux Firefox 128 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Tue, 30 Jul 2024 14:48:26 -0700 Message-ID: Content-Type: multipart/alternative; boundary="VYZPC0Lqp23nNgmujnZm" List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 30 Jul 2024 21:48:33 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/yocto/message/63616 --VYZPC0Lqp23nNgmujnZm Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable hi i am using ubuntu 22.04.4 LTS, bitbake 2.8.0, poky scarthgap branch and bea= glebone black. I am trying to create my first device driver and integrate i= t in the kernel (with patch). I am executing the following steps and the result is either that the image = is built but doesnt contain the driver or an error is generated during comp= iling. The steps are: 1. i am creating a folder with name tabdriver in the path /poky/build/tmp/w= ork-shared/beaglebone-yocto/kernel-source/drivers/char/ 2. I am creating Kconfig, Makefile and tabdriver.c files in this folder. Kconfig =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D config TAB_DRIVER tristate "CG Hello World Driver" help CG help =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Makefile =3D=3D=3D=3D=3D=3D=3D obj-$(CONFIG_TAB_DRIVER) :=3D tabdriver.o =3D=3D=3D=3D=3D=3D=3D 3. in Kconfig which is located in the folder poky/build/tmp/work-shared/bea= glebone-yocto/kernel-source/drivers/char, the following line is added: source "drivers/char/tabdriver/Kconfig" 4. in Makefile which is located in the folder poky/build/tmp/work-shared/be= aglebone-yocto/kernel-source/drivers/char, the following line is added: obj-$(CONFIG_TAB_DRIVER) +=3D tabdriver/ 5. A patch is created by using git git format-patch HEAD~1 which contains t= he changes in the file files above 6. The patch is copied in the location poky/meta-mylayer/recipes-kernel/lin= ux/linux-yocto 7. The file linux-yocto_6.6.bbappend which is located in the location poky/= meta-mylayer/recipes-kernel/linux has the content =3D=3D=3D=3D=3D=3D FILESEXTRAPATHS:prepend :=3D "${THISDIR}/${PN}:" SRC_URI +=3D "file://0001-tab-char-driver.patch" =3D=3D=3D=3D=3D=3D 8. Run bitbake -c cleansstate virtual/kernel 9. Run bitbake -c menuconfig virtual/kernel 10. The new driver is appearing in menu config and i am activating it 11. =C2=A0Run bitbake -c diffconfig virtual/kernel 12. Build image bitbake core-image-full-cmdline Are the steps that i am following correct? is there any debug procedure i can follow? Br Christos --VYZPC0Lqp23nNgmujnZm Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
hi
i am using ubuntu 22.04.4 LTS, bitbake 2.8.0, poky scarthgap branch an= d beaglebone black. I am trying to create my first device driver and integr= ate it in the kernel (with patch).
 
I am executing the following steps and the result is either that the i= mage is built but doesnt contain the driver or an error is generated during= compiling.
The steps are:
      1. i am creating a folder with name tab= driver in the path /poky/build/tmp/work-shared/beaglebone-yocto/kernel-sour= ce/drivers/char/
      2. I am creating Kconfig, Makefile and = tabdriver.c files in this folder.
 
Kconfig
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
config TAB_DRIVER
    tristate "CG Hello World Driver"<= br />    help
       CG help
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
 
Makefile
=3D=3D=3D=3D=3D=3D=3D
obj-$(CONFIG_TAB_DRIVER) :=3D tabdriver.o
=3D=3D=3D=3D=3D=3D=3D
 
      3. in Kconfig which is located in the f= older poky/build/tmp/work-shared/beaglebone-yocto/kernel-source/drivers/cha= r, the following line is added:
          source "drivers= /char/tabdriver/Kconfig"
 
      4. in Makefile which is located in the = folder poky/build/tmp/work-shared/beaglebone-yocto/kernel-source/drivers/ch= ar, the following line is added:
           obj-$(CON= FIG_TAB_DRIVER) +=3D tabdriver/
 
 
      5. A patch is created by using git git = format-patch HEAD~1 which contains the changes in the file files above
 
      6. The patch is copied in the location = poky/meta-mylayer/recipes-kernel/linux/linux-yocto
      7. The file linux-yocto_6.6.bbappend wh= ich is located in the location poky/meta-mylayer/recipes-kernel/linux has t= he content
 
=3D=3D=3D=3D=3D=3D
FILESEXTRAPATHS:prepend :=3D "${THISDIR}/${PN}:"
SRC_URI +=3D "file://0001-tab-char-driver.patch"
=3D=3D=3D=3D=3D=3D
 
      8. Run bitbake -c cleansstate virtual/k= ernel
      9. Run bitbake -c menuconfig virtual/ke= rnel
      10. The new driver is appearing in menu= config and i am activating it
      11.  Run bitbake -c diffconfig vir= tual/kernel
      12. Build image bitbake core-image-full= -cmdline
 
 
Are the steps that i am following correct?
is there any debug procedure i can follow?
 
Br
Christos
 
 
 
 
--VYZPC0Lqp23nNgmujnZm--