Jump to content
  • 0

How to cross compile zybo z7-20 hdmi TX LKM driver using petalinux 2022.2?


ying_311

Question

Hello

I was trying to cross compile a digilent_hdmi.c driver as LKM with petalinux 2022.2. Due to some reason, I have to maintain the HW design done in Vivado 2022.2. For that I cannot change the petalinux version from 2022.2 to 2022.1.

I have used the zynq template to create the petalinux project (because for 2022.2, there are no BSP). 

AFAIK, to cross compile, I need all the resources in "kernel-build-articfacts". I can generate the "kernel-build-articfacts" & "kernel-source" at "/build/tmp/work-shared/zynq-generic/" by doing following change in "project-spec/meta-user/conf/petalinuxbsp.conf

RM_WORK_EXCLUDE += "linux-xlnx"

By default this "kernel-build-artifacts" supposed to contain the Makefile for including the "/path/to/kernel-source". So there I added a Makefile with a include call to "/path/to/kernel-source".

Then I tried to cross compile the driver with following Makefile script from the driver location.

export ARCH:=arm
export CROSS_COMPILE:=arm-linux-gnueabihf-

CC=$(CROSS_COMPILE)gcc

SRC := $(shell pwd)

# Just the idea of the object module.
# There are lot
obj-m = test_module.o

KVERSION =/path/to/kernel-build-artifacts

all:
	$(MAKE) -C $(KVERSION) M=$(SRC) O=$(O) modules

clean:
	find . -name "*.ko" -type f -delete
	find . -name "*.o" -type f -delete
	find . -name "*.order" -type f -delete
	find . -name "*.cmd" -type f -delete
	find . -name "*.mod*" -type f -delete
	rm -f Module.symvers

But then I got following error

make -C /path/to/kernel-build-artifacts M=/path/to/git-cloned/driver/git_gpu_drm_xlnx_hdmi/drm O= modules
make[1]: Entering directory '/path/to/kernel-build-artifacts'

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.

/path/to/kernel-source/Makefile:658: include/config/auto.conf: No such file or directory
make[1]: *** [/path/to/kernel-source/Makefile:737: include/config/auto.conf] Error 1
make[1]: Leaving directory '/path/to/kernel-build-artifacts'
make: *** [Makefile:145: all] Error 2

We also tried running the following command to fix the kernel config

make oldconfig && make prepare

But this command gives us too many option to set. So we stopped to do that.

 

So now my questions are,

1. How can I preserve all the resources in "kernel-build-articfacts" for petalinux version 2022.2?

2. What is the standard way of cross compiling digilent hdmi TX LKM driver for Zybo Z7-20 using petalinux 2022.2?

 

Thanks in advance!

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...