Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: Rebuild of existing kernel module
#1
Little bit out off topic

I have an existing kernel module that I want to patch. It concerns the pcm1794a codec (max sample rate from 192kHz to 384kHz).
Rebuilding the kernel with all modules, including the patched one, works fine and if I install the alternative kernel it also works great.

I would really like to only install this patched module (don't mind if the entire kernel and all modules are build also) to the current kernel tree, but that gives the following result:

Code:
$ sudo modprobe snd-soc-pcm1794a
 modprobe: ERROR: could not insert 'snd_soc_pcm1794a': Exec format error
$dmesg
[  261.823205] snd_soc_pcm1794a: disagrees about version of symbol module_layout

I have no clue of about how to fix this.
Any help would be greatly appreciated.


The followed build steps are used:

Code:
sudo apt install git bc bison flex libssl-dev make
sudo wget https://raw.githubusercontent.com/RPi-Distro/rpi-source/master/rpi-source -O /usr/local/bin/rpi-source && sudo chmod +x /usr/local/bin/rpi-source
/usr/local/bin/rpi-source -q --tag-update
cd linux
KERNEL=kernel7l
make bcm2711_defconfig
make -j4 SUBDIRS=sound/soc/codecs modules
sudo mv /lib/modules/5.4.61-v7l+/kernel/sound/soc/codecs/snd-soc-pcm1794a.ko /lib/modules/5.4.61-v7l+/kernel/sound/soc/codecs/snd-soc-pcm1794a.ko.org
sudo cp ~/distr/lib/modules/5.4.61-v7l+/kernel/sound/soc/codecs/snd-soc-pcm1794a.ko /lib/modules/5.4.61-v7l+/kernel/sound/soc/codecs
sudo depmod

output from modinfo and file:

orginal:

Code:
$ modinfo snd-soc-pcm1794a
filename:       /lib/modules/5.4.61-v7l+/kernel/sound/soc/codecs/snd-soc-pcm1794a.ko
license:        GPL v2
author:         Florian Meier <florian.meier@koalo.de>
description:    ASoC PCM1794A codec driver
srcversion:     EFA9CD3DD0D6BA9E5094846
alias:          of:N*T*Cti,pcm1794aC*
alias:          of:N*T*Cti,pcm1794a
depends:        snd-soc-core
intree:         Y
name:           snd_soc_pcm1794a
vermagic:       5.4.61-v7l+ SMP mod_unload modversions ARMv7 p2v8

Code:
$ file snd-soc-pcm1794a.ko
/home/pi/snd-soc-pcm1794a.ko: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), BuildID[sha1]=8c3f58317069cac3e4019bf5aa37b06cbac18cf2, not stripped


after build:
Code:
$ modinfo snd-soc-pcm1794a.ko
filename:       /home/pi/distr/lib/modules/5.4.61-v7l+/kernel/sound/soc/codecs/snd-soc-pcm1794a.ko
license:        GPL v2
author:         Florian Meier <florian.meier@koalo.de>
description:    ASoC PCM1794A codec driver
srcversion:     EFA9CD3DD0D6BA9E5094846
alias:          of:N*T*Cti,pcm1794aC*
alias:          of:N*T*Cti,pcm1794a
depends:        snd-soc-core
intree:         Y
name:           snd_soc_pcm1794a
vermagic:       5.4.61-v7l+ SMP mod_unload modversions ARMv7 p2v8

Code:
$ file snd-soc-pcm1794a.ko
snd-soc-pcm1794a.ko: ELF 32-bit LSB relocatable, ARM, EABI5 version 1 (SYSV), BuildID[sha1]=ead94a9e462ec72d7687e838bb2abd7fab3c62f4, not stripped
Reply
#2
@bitlab

https://unix.stackexchange.com/questions...ule-layout

ETA: cool project!
Reply
#3
The dreaded module_layout mismatch error :-0

I could never figure out how to avoid this when compiling kernel module directly on the Pi. The dev's I talked to about it said they always cross-compile on another box like an Ubuntu Desktop and the procedure they use avoids this error.

In any case, I still think it must be possible to get the module_layout to match when compiling on the Pi.

Send me an email and I'll reply with the procedure I used that almost worked. Email is just easier for me. Maybe it will give you some insight on what could be done to get it to work. If we get a working procedure then we can include the patched PCM1794A codec and any other models that could benefit from patching. I could also compile the Allo ASIX module on my end instead of relying on their dev to do so even though that has not been a problem.

-Tim
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#4
@Tim Curtis and @TheOldPresbyope thanks for helping behind the scenes.

We have a working procedure for building modules which can be used in running kernels.

In case you are interested in the rpi-dac 384kHz patch you can find prebuilds and a build instruction at https://github.com/bitkeeper/dddac1794bu...794_384kHz .
Reply
#5
Nice :-)

I'll try to test it out today.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#6
Thanks for the build instructions. I might have to see about trying them to open higher bit depths and multichannel on the HDMI output when I get some time/energy.
Reply


Forum Jump: