# Module Modification



## Unee0x (Mar 10, 2018)

I’ve made some adjustments to the asmc dev/module to include support for the MacBook Pro 12,1.
From what I can see, make and make install run successfully;
However, when I ./asmc.ko the kernel panics and system pauses for about a minute. Afterwards, the module works.
Also, if I try to load this module adding kld_list=“/boot/modules/asmc.ko” to the /etc/rc.conf file the system takes longer to finish booting, but when it does the module still works.

What is causing the system to panic?
How can I debug this situation?


----------



## Phishfry (Mar 10, 2018)

You need to load the kernel module with kldload(8)
It shows status of the module loading. `kldload asmc`
Then when it is working good I would add an entry in my /boot/loader.conf
asmc_load="YES"

That is the procedure for dynamically loading a module.
https://www.freebsd.org/cgi/man.cgi?query=asmc&sektion=4

So I would copy the original /boot/kernel/asmc.ko to /boot/kernel/asmc.ko.orig and then replace with your modded module then do kldload testing. Also note the -v flag for more verbosity.


----------



## Unee0x (Mar 10, 2018)

Thanks
Although I didn’t mention it in my post, I did use kldload ./asmc.ko. However, did not use the -v flag and renaming the original .
Going to try it again and will reach out if I run into a cliff.


----------



## ShelLuser (Mar 10, 2018)

One small comment: I suggest you don't place it in /boot/kernel but use /boot/modules instead. This allows you to keep your modules separated from the official stuff which is part of the kernel. The advantage of this depends, but if you normally lock your kernel (see chflags(1)) then this can help you to still being able to access your 3rd party modules.


----------

