UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 55997

PetaLinux - How do I add kernel modules to my PetaLinux root file system?

Description

I have kernel modules that I would like to include in my Linux root file system. How do I have the PetaLinux build process incorporate this code?

Solution

To have the PetaLinux build tools incorporate kernel modules, follow this general flow:

For PetaLinux 2013.10 and later:
 
Build-time Compiled Modules
 
  1. Use the petalinux-create -t modules to create a module project.
    The new module will be located in ${PETALINUX}/components/modules/<MODULE>/.
  2. Place the modules source code into ${PETALINUX_PROJECT}/components/modules/<MODULE>/
  3. Modify the makefile located inside ${PETALINUX_PROJECT}/components/modules/<MODULE>/ as required.

Pre-built Kernel Modules
 
Ensure that the kernel module has been compiled for your PetaLinux target architecture (for example, MicroBlaze, ARM, etc.).
 
  1. Use petalinux-create -t modules to create a module project.
    The new module will be located in ${PETALINUX_PROJECT}/components/modules/<MODULE>/.
  2. Place the pre-built kernel modules into ${PETALINUX_PROJECT}/components/modules/<MODULE>/
  3. Modify the makefile located in ${PETALINUX_PROJECT}/components/modules/<MODULE>/.
    • Ensure that the all: and clean: sections of the makefile are empty.
    • Update the install: section to copy the pre-built binaries into ${PETALINUX_PROJECT}/build/linux/rootfs/targetroot/.
An example of the modifications is as follows:

{{{
APP=myapp
all:

clean:

install: $(APP)
        $(TARGETINST) -d $(APP)-prebuilt /bin/$(APP) }}}

 
For PetaLinux 2013.04 and earlier:
 

Build-time Compiled Modules

  1. Use the petalinux-new-module to create a module project.
    The new module will be located in ${PETALINUX}/software/user-modules/<MODULE>/.
  2. Place the modules source code into ${PETALINUX}/software/user-modules/<MODULE>/
  3. Modify the makefile located in ${PETALINUX}/software/user-apps/<APP>/ as needed.


Pre-built Kernel Modules

Ensure that the kernel modules have been compiled for your PetaLinux target architecture (e.g., MicroBlaze, ARM, etc.).

  1. Use petalinux-new-module to create a module project.
    The new module will be located in ${PETALINUX}/software/user-modules/<MODULE>/.
  2. Place the pre-built kernel modules into ${PETALINUX}/software/user-modules/<MODULE>/
  3. Modify the makefile located inside ${PETALINUX}/software/user-apps/<APP>/.
    • Ensure that the all:, install: and clean: sections of the makefile are empty.
    • Update the romfs: section to copy the pre-built binaries into ${PETALINUX}/software/petalinux-dist/romfs/.

An example of the modifications is as follows:

{{{
APP=myapp
all:

clean:

romfs:
$(ROMFSINST) -d $(APP) /lib/modules/<KERNELRELEASE>/extra/
}}}

AR# 55997
Date Created 05/14/2013
Last Updated 03/30/2015
Status Active
Type General Article
Devices
  • SoC
  • XA Zynq-7000
  • Zynq-7000
  • More
  • Zynq-7000Q
  • FPGA Device Families
  • Artix-7
  • Kintex-7
  • Spartan-6
  • Virtex-6
  • Virtex-7
  • Less
Tools
  • PetaLinux
  • PetaLinux - 2012.12
  • PetaLinux - 2013.04
  • More
  • PetaLinux - 2014.2
  • PetaLinux - 2013.10
  • Less