AR# 68441

2016.4 PetaLinux: Migrating modules from 2016.3 PetaLinux project to 2016.4 PetaLinux yocto based project

Description

How do I migrate a 2016.3 PetaLinux project module to a 2016.4 PetaLinux project?

Solution

  1. In the 2016.4 PetaLinux project, create the template modules using the following command:
petalinux-create -t modules -n new-module
  1. Remove the existing source code and Makefiles in the "<2016.4-plnx-proj-root>/project-spec/meta-user/recipe-module/new-module/new-module" directory and copy your module source code and Makefiles.
  2. Edit the "<2016.4-plnx-proj-root>/project-spec/meta-user/recipe-modules/new-module/new-module.bb" file as shown below:

a) Remove the entire contents of the file and add the following:

SUMMARY = "Example new-module module "

SECTION = "PETALINUX/modules"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = file://COPYING;md5=12f884d2ae1ff87c09e5b7ccc2c4ca7e
SRC_URI = "file://Makefile \
           file://<MODULENAME>.c \
        "
S = "${WORKDIR}"


b)

inherit module
EXTRA_OEMAKE = 'KERNEL_SRC="${STAGING_KERNEL_DIR}" \
                O=${STAGING_KERNEL_BUILDDIR} \
                '
  1. Replace the <MODULENAME>.c in the "<2016.4-plnx-proj-root>/project-spec/meta-user/recipe-modules/new-module/new-module.bb" with your source file name.
  2. Edit the "<2016.4-plnx-proj-root>/project-spec/meta-user/recipe-modules/new-module/new-module/Makefile" file as shown below:


Remove the entire contents of the file and then add the following text:

obj-m += <MODULENAME>.o

all:
                make -C $(KERNEL_SRC) M=$(CURDIR)
modules_install:
                make -C $(KERNEL_SRC) M=$(CURDIR) modules_install
clean:
                make -C $(KERNEL_SRC) M=$(CURDIR) clean
AR# 68441
Date 05/18/2018
Status Active
Type General Article
Devices
Tools
Boards & Kits