0

I am new to linux development and I want to develop a linux module, but I am running into an issue. Some header files, notably <linux/init.h>, are missing (/not found)

I am currently using Visual Studio 2022 on my Windows desktop and am building my project through SSH on my Raspberry Pi 5.

I successfully connected my Raspberry Pi 5 to Visual Studio and see that most header files are being synced (ie: kernel.h and module.h).

Also double checked at C:\Users\op\AppData\Local\Microsoft\Linux\HeaderCache\1.0.

That being said, as mentioned above, I am missing init.h

After looking at other prior posts from different people, I have double checked that linux-headers-generic is installed, which it is:

op@raspberrypi:~ $ sudo apt-get install linux-headers-generic Reading package lists... Done Building dependency tree... Done Reading state information... Done Note, selecting 'linux-headers-arm64' instead of 'linux-headers-generic' linux-headers-arm64 is already the newest version (6.1.90-1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 

and

op@raspberrypi:~ $ sudo apt-get -y install linux-headers-$(uname -r) Reading package lists... Done Building dependency tree... Done Reading state information... Done linux-headers-6.6.28+rpt-rpi-2712 is already the newest version (1:6.6.28-1+rpt1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 

So I am kind of lost at this point, any help is appreciated.

EDIT:

When running find, the init.h header is found...

op@raspberrypi:~ $ sudo find /usr -name init.h /usr/src/linux-headers-6.6.28+rpt-common-rpi/include/trace/stages/init.h /usr/src/linux-headers-6.6.28+rpt-common-rpi/include/linux/init.h /usr/src/linux-headers-6.6.28+rpt-common-rpi/include/linux/sched/init.h /usr/src/linux-headers-6.1.0-rpi4-common-rpi/include/trace/stages/init.h /usr/src/linux-headers-6.1.0-rpi4-common-rpi/include/linux/init.h /usr/src/linux-headers-6.1.0-rpi4-common-rpi/include/linux/sched/init.h /usr/src/linux-headers-6.1.0-21-common/include/trace/stages/init.h /usr/src/linux-headers-6.1.0-21-common/include/linux/init.h /usr/src/linux-headers-6.1.0-21-common/include/linux/sched/init.h /usr/src/linux-headers-6.1.0-21-common/arch/x86/include/asm/init.h 

Which does correspond to my kernel version:

op@raspberrypi:~ $ uname -r 6.6.28+rpt-rpi-2712 
2
  • In what sense exactly are they "missing (/not found)"? If you are trying to make Intellisense aware of kernel headers, there's some information here: An IntelliSense Bug When Coding Linux Kernel ModuleCommentedMay 11, 2024 at 20:26
  • @steeldriver What I meant is that intellisense is not aware of it, nor does it compile when I try to. The solution you linked is in regards to Visual Studio Code, whereas I am using Visual Studio. I suppose I could try it out, however I would of preferred staying with Visual Studio...CommentedMay 12, 2024 at 1:09

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.