Hello, My name is john. I'm currently building cross-compile environment with visual studio code.
With Variscite's document and NXP's i.MX Porting Guide, I successfully built user-space application cross-compile environment with visual studio code.
The following links are what I referred.
Variscite's document
NXP's document (2.1.1 How to build and load Kernel in standalone environment)
https://www.nxp.com/docs/en/user-guide/IMX_PORTING_GUIDE.pdf
I want to build device driver with the same method, but I have difficulties about setting kernel headers.
When I bitbake, I added the following to my recipe to include kernel source to sdk which generated by populate_sdk.
TOOLCHAIN_TARGET_TASK_append = " kernel-devsrc"
I made dummy device driver 'dummy.c' in https://github.com/PacktPublishing/Mastering-Embedded-Linux-Programming-Second-Edition/blob/master/C...
With dummy.c, I run 'make' and VScode show me lots of errors. I think I have to match kernel header carefully, but I don't know how to do.
The following figure is errors which VScode shows to me.
The following figure is my c_cpp_properties.json in VScode and my SDK's location is '/opt/fsl-imx-wayland/4.14-sumo/sysroots/aarch64-poky-linux/*'.
The following figure is my Makefile in VScode.
Thanks for your help.
@hello-world123
Hello,
VSCode can be used for development of relatively simple applications.
Hardly it is suitable for Linux driver design, since this area is very kernel / version
sensitive. I think it makes sense to rely on standard approaches here.
Regards,
Yuri.
Is there a manual for cross compiling?
@bladerunner1010
Hello,
usually driver sources are provided with instructions how to compile them.
Regards,
Yuri.
Hi, @Yuri . Thank you for your reply.
Your saying is that typical way to develop device driver is like this?
1. Edit/add device driver code and Makefile of kernel source in Yocto build directory with editor like vim.
2. Bitbake to build.
3. Test the device driver
If so, I think it's quite inefficient ways for developing.
According to your mention, am I understand right?
Thanks in advance.
@hello-world123
Hello,
It would be better to build toolchain, build / load Kernel in standalone environment,
as mentioned in "IMX_PORTING_GUIDE.pdf", unpack driver package with sources
and follow driver's documentation. Yocto approach is not used here.
Regards,
Yuri.