How to build module for current kernel

This forum is for discussion about general software issues.

How to build module for current kernel

Postby keithspg » Wed Nov 18, 2020 9:46 pm

I previously knew how to do this. I created a PKGBUILD for the module and was able to build and install it. That was with kernel 4.19.x. Since the upgrade to 5.4, I cannot build it. I have tried modifying my PKGBUILD and get nowhere. I tried adding this module to the arch kernel package and building it and I have tried with the RPi official kernel.

I have edited the Makefile with the proper folders but, when I try to build it with my PKGBUILD and files, I get this:
$this->bbcode_second_pass_code('', 'sudo make
make -C /usr/lib/modules/5.4.75-1-ARCH/build SUBDIRS=/Rune_dev/RuneOS/packages/test/src/MODULE KBUILD_VERBOSE=1 modules
make[1]: Entering directory '/usr/lib/modules/5.4.75-1-ARCH/build'
make -f ./Makefile syncconfig
make -f ./scripts/Makefile.build obj=scripts/basic
rm -f .tmp_quiet_recordmcount
make -f ./scripts/Makefile.build obj=scripts/kconfig syncconfig
scripts/kconfig/conf --syncconfig Kconfig
drivers/ras/Kconfig:34: can't open file "arch/x86/ras/Kconfig"
make[3]: *** [scripts/kconfig/Makefile:73: syncconfig] Error 1
make[2]: *** [Makefile:590: syncconfig] Error 2
make[1]: *** [Makefile:696: include/config/auto.conf.cmd] Error 2
make[1]: Leaving directory '/usr/lib/modules/5.4.75-1-ARCH/build'
make: *** [Makefile:13: all] Error 2
')

Interesting that it calls out x86 when I am specifically building this on arm. How do I set that?

When I try to build it in the RPi kernel tree, I get absolutely nothing. No *.ko is built and it is never mentioned as it builds the modules in the sound/soc/bcm folder. I added the definition to the .config file in the root directory. I added the definition to Kconfig and the Makefile in the sound/soc/bcm folder.


$this->bbcode_second_pass_code('', 'make clean
make -C . M=sound/soc/bcm/
')
makes all the modules except the one I added.
What am I missing?
keithspg
 
Posts: 221
Joined: Mon Feb 23, 2015 4:14 pm

Re: How to build module for current kernel

Postby keithspg » Thu Nov 19, 2020 7:04 pm

I may be on it. I was able to copy the module files to a separate directory and found some errors by trying this:
$this->bbcode_second_pass_code('', 'make -C /lib/modules/`uname -r`/build M=$PWD')
now, I put the fixed module in the tree and tried this:
$this->bbcode_second_pass_code('', 'make -C . M=sound/soc/bcm')
and it actually created the module.
Now to see if it will build with the kernel and also if it actually works
keithspg
 
Posts: 221
Joined: Mon Feb 23, 2015 4:14 pm

Re: How to build module for current kernel

Postby graysky » Thu Nov 19, 2020 7:06 pm

First of all why are you running make as root? Don't do that. Secondly, I recommend you make a PKGBUILD for you module or use dkms. You can use some packages for the AUR as a module.
graysky
Developer
 
Posts: 1728
Joined: Sun Jun 26, 2011 6:56 am
Location: /run/user/1000


Return to General

Who is online

Users browsing this forum: No registered users and 3 guests