Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: michnixweiss on January 20, 2022, 03: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
tce-load -wi compiletc
tce-load -wi openssl-dev bc #needed this cause getting failure later on
- downloaded this Kernel Source http://www.tinycorelinux.net/13.x/armv6/releases/RPi/src/kernel/linux-rpi-5.10.77.tar.xz (http://www.tinycorelinux.net/13.x/armv6/releases/RPi/src/kernel/linux-rpi-5.10.77.tar.xz)
- prepared it with
make mrproper
- since there is only a .config for 5.10.16 I created one with
modprobe config
zcat /proc/config.gz > .config
make oldconfig
make prepare
make modules_prepare
so the Kernel src should be ready to start!?
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
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
insmod snd-soc-wm8960.ko
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 (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
-
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)
-
Hi michnixweiss
Welcome to the forum.
With regards to the Wiki, see this:
http://forum.tinycorelinux.net/index.php/topic,25220.0.html
-
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 (http://forum.tinycorelinux.net/index.php?topic=24946.0)
and adopted it.
-
Yes, that works. Notice the files are copied after mproper.
-
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.
-
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)
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/ (http://www.tinycorelinux.net/13.x/armv6/releases/RPi/src/kernel/) ?
-
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.
-
Not sure Rich, but for sure only using the .config is not sufficient with arm.
-
Hi Paul_123
This is the message someone trying to build igb drivers received when Module.symvers was missing:
----- Snip -----
WARNING: Symbol version dump ./Module.symvers
is missing; modules will have no dependencies and modversions.
----- Snip -----
-
.config, Module.symvers and System.map files uploaded to the server.
-
Thanks a lot, I will try again with the files and post the result.
-
...ok, I got an other message, but its not working anyway.
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
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?
-
Hi michnixweiss
It looks like your new modules needs some dependencies loaded.
Place your driver where the system can find it:
sudo cp snd-soc-wm8960.ko /lib/modules/$KERNEL/kernel
where $KERNEL is the result of uname -r
Update the module dependencies:
sudo /sbin/depmod -a
Now try loading the module again:
sudo modprobe snd-soc-wm8960.ko
-
Hi Rich,
to get it persistent for future i created an extension
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
sudo /sbin/depmod -a
which exits without any output
Modprobe also exits without output
sudo modprobe snd-soc-wm8960.ko
The same command with fullpath gives an output
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
-
Hi michnixweiss
... sudo /sbin/depmod -a
which exits without any output
Modprobe also exits without output ...
No output means no error.
If you want to confirm it's loaded, see if it shows up in this command:
lsmod
to get it persistent for future i created an extension ...
Kudos on figuring out how to package it.
-
Hi michnixweiss
... ----- Snip -----
tce-load -i wm8960.tcz
----- Snip -----
sudo /sbin/depmod -a
...
Just one more thing. Since you packaged the modules, you don't need to depmod. When you load your extension,
tce-load checks the extension for modules and runs depmod for you.
-
Many thanks @Rich,
I build my extension with the files needed (I think so).
Now so far:
aplay -l
card 0: wm8960soundcard [wm8960-soundcard], device 0: bcm2835-i2s-wm8960-hifi wm8960-hifi-0 [bcm2835-i2s-wm8960-hifi wm8960-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
aplay -D hw:0,0 piano2.wav
No error message, but I am getting no sound from the speaker nor the headphone...
The only thing unknown so far is where to but the asound.state so that alsa is loading it. But this is not the main problem I think!?
Can I ask this here or open a new thread for alsa?
-
Hi michnixweiss
My guess is some path(s) is/are muted.
This is a post I wrote on setting up ALSA:
http://forum.tinycorelinux.net/index.php/topic,22145.msg138620.html#msg138620
Make sure your driver is loaded first. Then, follow the instructions in the post. The extensions must be loaded in
the order listed. Rearrange their order in your onboot.lst and reboot. Then continue from step 4.
If you still get no audio, start the alsamixergui and try some of the controls.
-
Have you done everything shown on their github site. While you cannot use the provided install and service files, you should do everything they do manually.
https://github.com/waveshare/WM8960-Audio-HAT
1) Driver built - This appears to be ok
2) dtbo installed in /mnt/mmcblk0p1/overlays
3) in the boot config.txt did you add dtoverlay=wm8960-soundcard
4) Assume you have also enabled both i2c and i2s interfaces.
5) Add the asound.conf to /etc (Also add etc/asound.conf to /opt/.filetool.lst)
6) Copy the provided asound.state to /var/lib/asla/asound.state (Make sure to add this file to the backup list too)
Then during boot, you will need to wait for the card to be recognized first
Then restore the asound state.
Let me know if you need more direction, but just follow what they do on github. And convert what they to do tinycore methodology.
-
Thx @Rich.
Thx @Paul_123, I figured it out before reading your post.
Your point 6 was my problem. Like written before it was not clear for me where to put the asound.state and unmute with alsamixer does not do the trick.
Trial and error brings it up
sudo alsactl restore
alsactl: load_state:1683: Cannot open /var/lib/alsa/asound.state for reading: No such file or directory
For me the documentation is a bit confusing. For example: the link in the post of @Rich to alsa - which is not so old - isn't correct anymore.
There is no alsa-config.tcz (anymore). Comparing the alsa.tcz.list and alsa-config.tcz.list (from 4.x) with the alsa.tcz.list (from 13.x) seems for me, that its in one extension now. Also the described path usr/local/etc/alsa/asound.state seems to be the wrong for now.
And it is really annoying that I cannot post some things - tried to quote the "echo..." part. Is it a bug or because I am a newbie?
-
Hi michnixweiss
I think the ARM version may have been configure differently. The .info file for TC13 x86_64 still lists asound.state
being saved in /usr/local/etc/alsa/asound.state:
http://tinycorelinux.net/13.x/x86_64/tcz/alsa.tcz.info
... And it is really annoying that I cannot post some things - tried to quote the "echo..." part. Is it a bug or because I am a newbie?
It's the forum. Sometimes it doesn't like certain words or punctuation. The other day I couldn't write /etc/hosts , today
it's perfectly fine with it.
-
Last point (I hope) to the sound HAT:
How do I restore the asound.state at reboot?
I stored the working var/lib/alsa/asound.state with /opt/.filetool.lst
I tried in bootlocal.sh
/usr/local/sbin/alsactl restore
and
/usr/local/sbin/alsactl -f /home/tc/asound.state restore
/usr/local/bin/speaker-test [-Ddefault:1] -c2 -t wav -l1 #to proof its working
which didn't work,
so I tried the same with /usr/bin/sudo in ~/.X.d/alsa
which didn't work either...
-
bootlocal.sh will run way too soon. You need to wait for the kernel to recognize the card first. Then use alsactl to restore.
-
bootlocal.sh will run way too soon. You need to wait for the kernel to recognize the card first. Then use alsactl to restore.
Thanks for the hint, but I got a "wifi autoconnect" in it which is working fine
/usr/local/bin/wifi.sh -a 2>&1 > /tmp/wifi.log
Is it because its a HAT and wifi onboard or does the wifi.sh wait for the wlan to be ready?
From the corebook the .X.d is described as the "final part of the boot process" so shouldn't this had to work?
To make it easy I would create a start script which checks via lsmod if the wm8960 is loaded or is there an other way!?
-
Use a while loop. Look at /proc/asound Or just run aplay -L. And watch for your card.
Some cards are really picky at boot. I will often, wait for the card, then load the state twice
-
Hi michnixweiss
Assuming your card is wm8960soundcard , something like this should work:
while true
do
s_leep 1
aplay -l | grep -q wm8960soundcard
[ $? == 0 ] && break
done
/usr/local/sbin/alsactl restore
Remove the underscore from s_leep. Sorry, forum error.
Place it in its own script (init8960.sh for example) and launch it in the background.
-
Thx a lot for the help. Works like a charm now.
Main problem was in front of the RPi...
I started a daemon in the bootlocal.sh without init script and forgot the "&" at the end of the line...
How can I Set this to SOLVED?
-
Hi michnixweiss
... How can I Set this to SOLVED?
Easy, just ask. :)
-
how to find wm8960.tcz . The software list does not exist。
Hi michnixweiss
... ----- Snip -----
tce-load -i wm8960.tcz
----- Snip -----
sudo /sbin/depmod -a
...
Just one more thing. Since you packaged the modules, you don't need to depmod. When you load your extension,
tce-load checks the extension for modules and runs depmod for you.
-
Hi chinatefl
After michnixweiss compiled the driver, he packaged it as a .tcz for
personal use as shown here:
https://forum.tinycorelinux.net/index.php/topic,25499.msg163412.html#msg163412