freebsd kernel module writing

Hello, I am a newbie in FreeBSD. I installed FreeBSD-11.0-RELEASE-amd64 on VMware. I want to write first FreeBSD kernel module. I find this link: How to write a FreeBSD Kernel Module
and now I have some errors in my file, first.c.
cc first.c:
Code:
in file included from first.c:3:
/usr/include/sys/kernel.h:404:2: error: type name requires a specifier or qualifier
TAILQ_ENTRY(intr_config_hook) ich_links;
/usr/include/sys/kernel.h:404:14: error: a parameter list without types is only allowed in a function definition
TAILQ_ENTRY(intr_config_hook) ich_links;
first.c:4:10: fatal error: 'sys/system.h' file not found
#include<sys/system.h>
4 errors generated.

And when I use command: make
Code:
cd: /usr/src/sys/x86/include: NO such file or directory
*** Error code 2
make: stopped in /usr/home/code/kernel/hmw
Thanks.
 
Looks like the sources in /usr/src/ are not complete. How did you fetch the source code?
 
Hello and thanks.
I installed kernel sources by:
svnlite co https://svn.freebsd.org/base/releng/11.0 /usr/src

I use amd64, and why it checks x86 directory?
Code:
/usr/src/sys/x86/include: NO such file or directory
 
I am confused!
Yesterday I saw a list of .h include files in /usr/src by:
ls /usr/src
and Today when I want to see them, it doesn't show and just I see:
Code:
.svn          UPDATING          crypto          sys
What is problem?
How can I complete the sources?
I think that kernel.h and system.h files aren't in that directory!
 
Last edited by a moderator:
You're missing a lot:
Code:
root@molly:~ # ll /usr/src/
total 846
-rw-r--r--    1 root  wheel     115 Feb  5 20:03 .arcconfig
-rw-r--r--    1 root  wheel     418 Feb  5 20:03 .arclint
drwxr-xr-x    4 root  wheel       8 Feb  5 20:02 .svn/
-rw-r--r--    1 root  wheel    6197 Feb  5 20:03 COPYRIGHT
-rw-r--r--    1 root  wheel     739 Feb  5 20:03 LOCKS
-rw-r--r--    1 root  wheel    5596 Feb  5 20:03 MAINTAINERS
-rw-r--r--    1 root  wheel   21967 Feb  5 20:03 Makefile
-rw-r--r--    1 root  wheel   84163 Feb  5 20:03 Makefile.inc1
-rw-r--r--    1 root  wheel    6209 Feb  5 20:03 Makefile.libcompat
-rw-r--r--    1 root  wheel  392182 Feb  5 20:02 ObsoleteFiles.inc
-rw-r--r--    1 root  wheel    2678 Feb  5 20:03 README
-rw-r--r--    1 root  wheel   68247 Feb  5 20:03 UPDATING
drwxr-xr-x   42 root  wheel      44 Feb  5 20:02 bin/
drwxr-xr-x    9 root  wheel      11 Feb  5 20:02 cddl/
drwxr-xr-x   89 root  wheel      89 Feb  5 20:03 contrib/
drwxr-xr-x    5 root  wheel       6 Feb  5 20:03 crypto/
drwxr-xr-x   27 root  wheel      97 Feb  5 20:02 etc/
drwxr-xr-x    5 root  wheel       9 Feb  5 20:03 gnu/
drwxr-xr-x    8 root  wheel     106 Feb  5 20:03 include/
drwxr-xr-x    8 root  wheel      11 Feb  5 20:03 kerberos5/
drwxr-xr-x  113 root  wheel     115 Feb  5 20:02 lib/
drwxr-xr-x   37 root  wheel      42 Feb  5 20:02 libexec/
drwxr-xr-x   15 root  wheel      25 Feb  5 20:03 release/
drwxr-xr-x    4 root  wheel       6 Feb  5 20:03 rescue/
drwxr-xr-x   91 root  wheel      99 Feb  5 20:02 sbin/
drwxr-xr-x    7 root  wheel       9 Feb  5 20:02 secure/
drwxr-xr-x   28 root  wheel      30 Feb  5 20:03 share/
drwxr-xr-x   56 root  wheel      57 Feb  5 20:02 sys/
drwxr-xr-x    3 root  wheel       6 Feb  5 20:03 targets/
drwxr-xr-x    5 root  wheel       9 Feb  5 20:03 tests/
drwxr-xr-x   15 root  wheel      19 Feb  5 20:03 tools/
drwxr-xr-x  280 root  wheel     287 Feb  5 20:03 usr.bin/
drwxr-xr-x  225 root  wheel     234 Feb  5 20:03 usr.sbin/

rm -rf /usr/src/* && svnlite co https://svn.freebsd.org/base/releng/11.0 /usr/src/
 
You're missing a lot:
Code:
root@molly:~ # ll /usr/src/
total 846
-rw-r--r--    1 root  wheel     115 Feb  5 20:03 .arcconfig
-rw-r--r--    1 root  wheel     418 Feb  5 20:03 .arclint
drwxr-xr-x    4 root  wheel       8 Feb  5 20:02 .svn/
-rw-r--r--    1 root  wheel    6197 Feb  5 20:03 COPYRIGHT
-rw-r--r--    1 root  wheel     739 Feb  5 20:03 LOCKS
-rw-r--r--    1 root  wheel    5596 Feb  5 20:03 MAINTAINERS
-rw-r--r--    1 root  wheel   21967 Feb  5 20:03 Makefile
-rw-r--r--    1 root  wheel   84163 Feb  5 20:03 Makefile.inc1
-rw-r--r--    1 root  wheel    6209 Feb  5 20:03 Makefile.libcompat
-rw-r--r--    1 root  wheel  392182 Feb  5 20:02 ObsoleteFiles.inc
-rw-r--r--    1 root  wheel    2678 Feb  5 20:03 README
-rw-r--r--    1 root  wheel   68247 Feb  5 20:03 UPDATING
drwxr-xr-x   42 root  wheel      44 Feb  5 20:02 bin/
drwxr-xr-x    9 root  wheel      11 Feb  5 20:02 cddl/
drwxr-xr-x   89 root  wheel      89 Feb  5 20:03 contrib/
drwxr-xr-x    5 root  wheel       6 Feb  5 20:03 crypto/
drwxr-xr-x   27 root  wheel      97 Feb  5 20:02 etc/
drwxr-xr-x    5 root  wheel       9 Feb  5 20:03 gnu/
drwxr-xr-x    8 root  wheel     106 Feb  5 20:03 include/
drwxr-xr-x    8 root  wheel      11 Feb  5 20:03 kerberos5/
drwxr-xr-x  113 root  wheel     115 Feb  5 20:02 lib/
drwxr-xr-x   37 root  wheel      42 Feb  5 20:02 libexec/
drwxr-xr-x   15 root  wheel      25 Feb  5 20:03 release/
drwxr-xr-x    4 root  wheel       6 Feb  5 20:03 rescue/
drwxr-xr-x   91 root  wheel      99 Feb  5 20:02 sbin/
drwxr-xr-x    7 root  wheel       9 Feb  5 20:02 secure/
drwxr-xr-x   28 root  wheel      30 Feb  5 20:03 share/
drwxr-xr-x   56 root  wheel      57 Feb  5 20:02 sys/
drwxr-xr-x    3 root  wheel       6 Feb  5 20:03 targets/
drwxr-xr-x    5 root  wheel       9 Feb  5 20:03 tests/
drwxr-xr-x   15 root  wheel      19 Feb  5 20:03 tools/
drwxr-xr-x  280 root  wheel     287 Feb  5 20:03 usr.bin/
drwxr-xr-x  225 root  wheel     234 Feb  5 20:03 usr.sbin/

rm -rf /usr/src/* && svnlite co https://svn.freebsd.org/base/releng/11.0 /usr/src/


After command:
svnlite co https://svn.freebsd.org/base/releng/11.0 /usr/src/
I get:
Code:
svn: E120106: ra_serf: The server sent a truncated HTTP response body.
And now:
Code:
# ll /usr/src/
total 62
drwxr-xr-x        4   root     wheel         8 Feb      7    10:15   .svn/
-rw-r--r--        1   root     wheel         68125 Feb      7    10:16   UPDATING
drwxr-xr-x        5   root     wheel         6 Feb      7    10:35 crypto/
drwxr-xr-x       14   root     wheel         14 Feb      7    10:30  sys/
And after svn cleanup && svn up
Code:
svn: E120106: ra_serf: The server sent a truncated HTTP response
What may make this problem?
 
That error often indicates an issue on the server or with the connection. I was going to suggest to select a specific SVN mirror but noticed that this process is automated. How did you set up the network connection in VMWare? Any chance that it might affect the HTTPS connection?

You could try to use svn:// instead of https:// to see if that makes a difference.
 
That error often indicates an issue on the server or with the connection. I was going to suggest to select a specific SVN mirror but noticed that this process is automated. How did you set up the network connection in VMWare? Any chance that it might affect the HTTPS connection?

You could try to use svn:// instead of https:// to see if that makes a difference.

I am a beginner, Is there any image file or iso file of freebsd11 with these packages (completed freebsd with necessary package)?
I tested many ways! But, no success!
 
I am a beginner, Is there any image file or iso file of freebsd11 with these packages (completed freebsd with necessary package)?
Most definitely, just check the FreeBSD download page.

Select your architecture and you'll be presented with several images to download. What I usually use on VirtuaBox (comparable to VMWare I suppose) is the 'Boot only' ISO, but you'll probably don't want this: it starts a base system and downloads the whole thing from the Net.

disc1.iso should be all you need. It contains the base system, which includes the source code.
 
Most definitely, just check the FreeBSD download page.

Select your architecture and you'll be presented with several images to download. What I usually use on VirtuaBox (comparable to VMWare I suppose) is the 'Boot only' ISO, but you'll probably don't want this: it starts a base system and downloads the whole thing from the Net.

disc1.iso should be all you need. It contains the base system, which includes the source code.
But, I am using that (disc1.iso)!
should I select special option in install steps?
 
Back
Top