# Rebuild only ports with kernel modules



## pacija (Sep 12, 2013)

I am using 9-STABLE on my laptop, and I get to rebuild world and kernel quite often (at least once a month). As far as I know, there is no need to rebuild all the ports after an update within the same branch, but ports that install kernel modules often do (such as VirtualBox).

Is there a way to list only ports that install kernel modules so I can rebuild only them?


----------



## bkouhi (Sep 12, 2013)

Fortunately, yes. Add this line into /etc/make.conf:


```
PORTS_MODULES= editors/virtualbox-ose sysutils/lsof sysutils/acpi_call multimedia/webcamd
```

From make.conf(5)():


```
PORTS_MODULES
             Set this to the list of ports you wish to rebuild every
             time the kernel is built.
```


----------



## pacija (Sep 13, 2013)

Thank you for pointing me to this useful information. However, this does not answer my original question: how do I know which ports to list as PORTS_MODULES?


----------



## cpm@ (Sep 13, 2013)

Try:

```
% find /usr/ports/ -type f -name pkg-plist -exec grep -El '^@cwd[[:space:]]+/' \{} \; | sed -E 's|^/usr/ports/||1' | sed -E 's|/pkg-plist$||1'
```

Note that this works with ports that have included a pkg-plist file. Also, some of these would have to be hand checked because it returns a lots of false positives.

http://lists.freebsd.org/pipermail/freebsd-ports/2007-June/042066.html.


----------



## DutchDaemon (Sep 13, 2013)

You can also run `pkg which $file` on any $file that lives under /boot/modules/ (or `pkg_info -W $file` if you're behind the times).


----------



## cpm@ (Sep 13, 2013)

DutchDaemon said:
			
		

> You can also run `pkg which $file` on any $file that lives under /boot/modules/.



@DutchDaemon's case is much more practical


----------



## pacija (Sep 15, 2013)

In /boot/modules/ I have those files:

linker.hints
nvidia.ko
vboxdrv.ko
vboxnetadp.ko
vboxnetflt.ko

How come nothing related to fuse is present there, when I have fusefs-kmod installed, and that should be kernel module for fuse?


----------



## DutchDaemon (Sep 15, 2013)

If I read the Makefile correctly, the kernel module is placed in /usr/local/modules/ for some reason. I can see the point from a base OS standpoint (it's a third-party add-on), but not from a booting into the system standpoint (where /boot should be the starting point). Then again, FUSE is probably loadable on a running system? Anyway, it is what it is.


----------



## ondra_knezour (Sep 15, 2013)

`pkg_info -aL | grep \\.ko$` may give some insight about the .ko files installed by any port.


----------

