WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Solved] Build Kernel Modul on 5.10.77  (Read 5790 times)

Offline michnixweiss

  • Newbie
  • *
  • Posts: 25
[Solved] Build Kernel Modul on 5.10.77
« on: January 20, 2022, 12:35:14 PM »
Hey everybody

I am using a Raspi Zero W with piCore 13.1.0 - 5.10.77 Kernel
I am trying to build a driver for a waveshare wm8960 sound hat. Therefor I did the following:
  • install needed extensions
Code: [Select]
tce-load -wi compiletc
tce-load -wi openssl-dev bc   #needed this cause getting failure later on
Code: [Select]
make mrproper
  • since there is only a .config for 5.10.16 I created one with
Code: [Select]
modprobe config
zcat /proc/config.gz > .config
  • then
Code: [Select]
make oldconfig
make prepare
make modules_prepare
so the Kernel src should be ready to start!?
  • downloaded the driver
Code: [Select]
git clone https://github.com/waveshare/WM8960-Audio-HAT
  • sadly the install Script is for raspbian and needs apt and dkms, so I modified the Makefile to
Code: [Select]
make -C /path/to/kernelsrc M=/path/to/driversrc modules
  • then run make in the drivers folder is working as expected and without an error
  • but when I try
Code: [Select]
insmod snd-soc-wm8960.ko
  • I got
Code: [Select]
invalid module format
I have done a lot of research and spend hours to get so far. Cause the wiki is kind of broken "User authentication is unavailable Permission denied" and like described here
 http://forum.tinycorelinux.net/index.php?topic=22019.0
Its realy an obstacle challenge to get into this forum...
So now I am a little frustrated.

What am I missing / doing wrong

Thanks a lot
« Last Edit: February 01, 2022, 04:44:10 PM by Rich »

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1063
Re: Build Kernel Modul on 5.10.77
« Reply #1 on: January 20, 2022, 01:26:38 PM »
Its not going to work right without System.map and Module_symvers

@Bela

Can you post these files for 5.10.77?

Once you have those files, prepare the kernel source with "make modules_prepare"    (mproper cleans the tree, If you run that, make sure you add the config, System.map and Modules.symvers after you run it)
« Last Edit: January 20, 2022, 01:29:06 PM by Paul_123 »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Build Kernel Modul on 5.10.77
« Reply #2 on: January 20, 2022, 01:34:38 PM »
Hi michnixweiss
Welcome to the forum.

With regards to the Wiki, see this:
http://forum.tinycorelinux.net/index.php/topic,25220.0.html

Offline michnixweiss

  • Newbie
  • *
  • Posts: 25
Re: Build Kernel Modul on 5.10.77
« Reply #3 on: January 21, 2022, 12:55:47 AM »
Hey @Rich,
Thx for the Link.
Hey @Paul_123,
Ok I will wait for the files. Is this dokumented somewhere, cause I only found the post from @Juanito to prepare the src
http://forum.tinycorelinux.net/index.php?topic=24946.0
and adopted it.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1063
Re: Build Kernel Modul on 5.10.77
« Reply #4 on: January 21, 2022, 03:37:43 AM »
Yes, that works.  Notice the files are copied after mproper.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Build Kernel Modul on 5.10.77
« Reply #5 on: January 21, 2022, 07:06:18 AM »
Hi michnixweiss
I cobbled together some instructions a while back:
http://forum.tinycorelinux.net/index.php/topic,24436.msg154978.html#msg154978
They include links to where the information came from.

Offline michnixweiss

  • Newbie
  • *
  • Posts: 25
Re: Build Kernel Modul on 5.10.77
« Reply #6 on: January 22, 2022, 04:54:34 AM »
Read the links and links in the posts. And its not clear for me...
  • In none of the posts I found something about the System.map
  • Im not sure about the correct order - I understand the previous posts as move modules.symvers into src folder and then run make modules_prepare
From the links I guess this is the right order (sry if this is a stupid question)
Code: [Select]
cd /path/to/kernelsrc
make mrproper
cp ../5.10.77-piCore_.config ./.config
make oldconfig
make prepare
make modules_prepare
cp ../5.10.16-piCore_Module.symvers ./Module.symvers
cd /driver/src
make
At which point do I have to copy the System.map and cp module.symvers befor or after modules_prepare?

Will some post the files here or upload them to http://www.tinycorelinux.net/13.x/armv6/releases/RPi/src/kernel/ ?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Build Kernel Modul on 5.10.77
« Reply #7 on: January 22, 2022, 12:03:30 PM »
Hi michnixweiss
Sorry, I don't know why System.map is necessary.

... Will some post the files here or upload them to ...
They will be uploaded to live with the other source files.

Offline Paul_123

  • Administrator
  • Hero Member
  • *****
  • Posts: 1063
Re: Build Kernel Modul on 5.10.77
« Reply #8 on: January 22, 2022, 04:06:19 PM »
Not sure Rich, but for sure only using the .config is not sufficient with arm.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Build Kernel Modul on 5.10.77
« Reply #9 on: January 22, 2022, 05:34:27 PM »
Hi Paul_123
This is the message someone trying to build igb drivers received when  Module.symvers  was missing:
Code: [Select]
----- Snip -----

  WARNING: Symbol version dump ./Module.symvers
           is missing; modules will have no dependencies and modversions.

 ----- Snip -----


Offline bmarkus

  • Administrator
  • Hero Member
  • *****
  • Posts: 7183
    • My Community Forum
Re: Build Kernel Modul on 5.10.77
« Reply #10 on: January 22, 2022, 09:21:59 PM »
.config, Module.symvers and System.map files uploaded to the server.
Béla
Ham Radio callsign: HA5DI

"Amateur Radio: The First Technology-Based Social Network."

Offline michnixweiss

  • Newbie
  • *
  • Posts: 25
Re: Build Kernel Modul on 5.10.77
« Reply #11 on: January 23, 2022, 12:34:14 AM »
Thanks a lot, I will try again with the files and post the result.

Offline michnixweiss

  • Newbie
  • *
  • Posts: 25
Re: Build Kernel Modul on 5.10.77
« Reply #12 on: January 23, 2022, 07:07:35 AM »
...ok, I got an other message, but its not working anyway.
Code: [Select]
tc@box:/mnt/mmcblk0p2/BUILD/WM8960-Audio-HAT sudo insmod snd-soc-wm8960.ko
insmod: can't insert 'snd-soc-wm8960.ko': unknown symbol in module, or unknown parameter
More Details
Code: [Select]
tc@box:/mnt/mmcblk0p2/BUILD/WM8960-Audio-HAT dmesg  tail
[ 8843.200270] snd_soc_wm8960: loading out-of-tree module taints kernel.
[ 8843.201066] snd_soc_wm8960: Unknown symbol snd_soc_component_read (err -2)
[ 8843.201119] snd_soc_wm8960: Unknown symbol snd_soc_put_enum_double (err -2)
[ 8843.201172] snd_soc_wm8960: Unknown symbol snd_soc_component_write (err -2)
[ 8843.201223] snd_soc_wm8960: Unknown symbol devm_snd_soc_register_component (err -2)
[ 8843.201285] snd_soc_wm8960: Unknown symbol __devm_regmap_init_i2c (err -2)
[ 8843.201326] snd_soc_wm8960: Unknown symbol snd_soc_get_enum_double (err -2)
[ 8843.202134] snd_soc_wm8960: Unknown symbol snd_soc_info_volsw (err -2)
[ 8843.202241] snd_soc_wm8960: Unknown symbol snd_soc_unregister_component (err -2)
[ 8843.202293] snd_soc_wm8960: Unknown symbol snd_soc_dapm_put_volsw (err -2)
[ 8843.202342] snd_soc_wm8960: Unknown symbol snd_soc_add_component_controls (err -2)
[ 8843.202392] snd_soc_wm8960: Unknown symbol snd_soc_dapm_add_routes (err -2)
[ 8843.202432] snd_soc_wm8960: Unknown symbol snd_soc_info_enum_double (err -2)
[ 8843.202478] snd_soc_wm8960: Unknown symbol snd_soc_get_volsw (err -2)
[ 8843.202515] snd_soc_wm8960: Unknown symbol snd_soc_put_volsw (err -2)
[ 8843.202553] snd_soc_wm8960: Unknown symbol snd_soc_component_update_bits (err -2)
[ 8843.202590] snd_soc_wm8960: Unknown symbol snd_soc_dapm_new_controls (err -2)
[ 8843.202662] snd_soc_wm8960: Unknown symbol snd_soc_dapm_get_volsw (err -2)
[ 8843.202717] snd_soc_wm8960: Unknown symbol snd_soc_params_to_bclk (err -2)
[ 8843.204619] snd_soc_wm8960: Unknown symbol snd_soc_component_read (err -2)
[ 8843.204663] snd_soc_wm8960: Unknown symbol snd_soc_put_enum_double (err -2)
[ 8843.204699] snd_soc_wm8960: Unknown symbol snd_soc_component_write (err -2)
[ 8843.204734] snd_soc_wm8960: Unknown symbol devm_snd_soc_register_component (err -2)
[ 8843.204779] snd_soc_wm8960: Unknown symbol __devm_regmap_init_i2c (err -2)
[ 8843.204806] snd_soc_wm8960: Unknown symbol snd_soc_get_enum_double (err -2)
[ 8843.204841] snd_soc_wm8960: Unknown symbol snd_soc_info_volsw (err -2)
[ 8843.204897] snd_soc_wm8960: Unknown symbol snd_soc_unregister_component (err -2)
[ 8843.204929] snd_soc_wm8960: Unknown symbol snd_soc_dapm_put_volsw (err -2)
[ 8843.204963] snd_soc_wm8960: Unknown symbol snd_soc_add_component_controls (err -2)
[ 8843.204997] snd_soc_wm8960: Unknown symbol snd_soc_dapm_add_routes (err -2)
[ 8843.205025] snd_soc_wm8960: Unknown symbol snd_soc_info_enum_double (err -2)
[ 8843.205056] snd_soc_wm8960: Unknown symbol snd_soc_get_volsw (err -2)
[ 8843.205084] snd_soc_wm8960: Unknown symbol snd_soc_put_volsw (err -2)
[ 8843.205109] snd_soc_wm8960: Unknown symbol snd_soc_component_update_bits (err -2)
[ 8843.205135] snd_soc_wm8960: Unknown symbol snd_soc_dapm_new_controls (err -2)
[ 8843.205184] snd_soc_wm8960: Unknown symbol snd_soc_dapm_get_volsw (err -2)
[ 8843.205220] snd_soc_wm8960: Unknown symbol snd_soc_params_to_bclk (err -2)
The command is modified, cause I cannot post $ and | in code tags ...!?
Is this a problem of the kernel source, my commands or driver?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11178
Re: Build Kernel Modul on 5.10.77
« Reply #13 on: January 23, 2022, 07:45:34 AM »
Hi michnixweiss
It looks like your new modules needs some dependencies loaded.

Place your driver where the system can find it:
Code: [Select]
sudo cp snd-soc-wm8960.ko /lib/modules/$KERNEL/kernelwhere  $KERNEL  is the result of  uname -r

Update the module dependencies:
Code: [Select]
sudo /sbin/depmod -a
Now try loading the module again:
Code: [Select]
sudo modprobe snd-soc-wm8960.ko

Offline michnixweiss

  • Newbie
  • *
  • Posts: 25
Re: Build Kernel Modul on 5.10.77
« Reply #14 on: January 23, 2022, 02:05:51 PM »
Hi Rich,

to get it persistent for future i created an extension
Code: [Select]
newTCZ/usr/local/lib/modules/5.10.77-piCore/kernel/sound/soc/bcm/snd-soc-wm8960-soundcard.ko
newTCZ/usr/local/lib/modules/5.10.77-piCore/kernel/sound/soc/codecs/snd-soc-wm8960.ko
mksquashfs newTCZ wm8960.tcz
mv wm8960.tcz /mnt/mmcblk0p2/tce/optional/
tce-load -i wm8960.tcz
Modified command cause I also cannot post   C o p y  or  c p
then tried your
Code: [Select]
sudo /sbin/depmod -a
which exits without any output
Modprobe also exits without output
Code: [Select]
sudo modprobe snd-soc-wm8960.ko
The same command with fullpath gives an output
Code: [Select]
sudo modprobe /usr/local/lib/modules/5.10.77-picore/kernel/sound/soc/codecs/snd-soc-wm8960.ko
modprobe: module /usr/local/lib/modules/5.10.77-picore/kernel/sound/soc/codecs/snd-soc-wm8960.ko not found in modules.dep
« Last Edit: January 23, 2022, 02:20:37 PM by michnixweiss »