# Building driver module in a RSS enabled custom kernel doesn't seems to enable RSS



## Rajesh (Mar 16, 2020)

Hi,

I installed 12.0 Release and built a custom kernel (just added options  RSS and PCBGROUP in GENERIC) and installed with a different name (INSTKERNNAME).  

After booting to the new kernel, I tried to build my network driver which expect opt_rss.h to define RSS. But it doesn't set that.

`# cat /usr/obj/root/freebsd_12/amd64.amd64/sys/modules/netgbe/opt_rss.h
# << file exists, but doesn't have any lines >>`

But, when I checked the GENERIC path for an other inbuilt module, RSS is set.

`# cat /usr/obj/root/freebsd_12/amd64.amd64/sys/GENERIC/modules/root/freebsd_12/sys/modules/ix/opt_rss.h
#define RSS 1  << RSS is set>>
#`

Any thought, what am i doing wrong?


----------



## George (Mar 16, 2020)

It might be one of those files that only exist while the kernel is build. If you build your module seperately (not part of buildkernel), these files don't exist (or are empty).

I used to download them from here, and add them to SOURCES= in my Makefile. But I can't locate opt_rss.h 

12.0 is end of life, thus unsupported. Release Information


----------



## Rajesh (Mar 16, 2020)

Elazar said:


> I used to download them from here, and add them to SOURCES= in my Makefile. But I can't locate opt_rss.h
> 
> 12.0 is end of life, thus unsupported. Release Information



Yeah, I have to update my box to 12.1 Release. I will update it.

This opt_rss.h file is a generated file during build based on the options we provide in the kernel config file. I have specified "options RSS" in my kernel config, so it gets generated with "RSS" defined.

`# cat /usr/obj/root/freebsd_12/amd64.amd64/sys/GENERIC/opt_rss.h
#define RSS 1 << Looks, this opt_rss.h is generic for the particular installation>>`

So, my doubt is how to use this header while I build my modules after I boot into the custom kernel?


----------



## George (Mar 16, 2020)

Maybe this? In make.conf()

```
NO_KERNELCLEAN
           (bool) Set this to skip running "${MAKE} clean" during
           "${MAKE} buildkernel".
```

Then search the work directory. Just a guess.


----------



## Rajesh (Mar 19, 2020)

Thanks Elazar for your response.  After building the custom kernel and booting to it, I am just building the module (by running make from the corresponding module directory).  

This will not clean the OBJ directory (/usr/obj/root/freebsd_12/amd64.amd64/sys/CUSTOM_KERN) of the running custom installation, rather create another directory seperate in the OBJ directory for the module (/usr/obj/root/freebsd_12/amd64.amd64/sys/modules/netgbe) with the necessary header and object files.  The header file in the modules OBJ directory doesn't seem to reflect the custom kernel config. 

I tried updating to 12.1 Release as well, but still the same behavior.  Also, I tried copying the header file (from custom kernel OBJ directory) to my modules OBJ directory, but that doesn't help. 

So, putting the question other way.  Is there any way we can build a module alone with the custom kernel config? Just booting to custom kernel installation and building the module doesn't seem to help.


----------



## George (Mar 19, 2020)

> Also, I tried copying the header file (from custom kernel OBJ directory) to my modules OBJ directory, but that doesn't help.


So you found the opt_rss.h file?
Did you just copy it, or also add it to SOURCES+= ?

I suggest you write to the mailing lists, e.g. freebsd-drivers.


----------



## Rajesh (Mar 20, 2020)

Elazar said:


> So you found the opt_rss.h file?
> Did you just copy it, or also add it to SOURCES+= ?



Yeah, I saw the file well before. I tried both copying and adding it as a source in the makefile. It didn't help. 

I will post a mail thread as said. Thanks for all your inputs Elazar.


----------

