Recommended workflow for audio codec driver development in BBB.

Hello.

I am hacking on the driver for the tlv320aic3x audio codec. I’m cross-compiling the kernel using the scripts at https://github.com/RobertCNelson/bb-kernel.

What I’m doing is editing the code in KERNEL/sound/soc/codecs/tlv320aic3x.c, running tools/rebuild.sh and then copying KERNEL/sound/soc/codecs/snd-soc-tlv320aic3x.ko to my BBB in /lib/modules/4.4.9-bone-rt-r10/kernel/sound/soc/codecs. This works and the module loads and runs fine. However, running tools/rebuild.sh sometimes takes a really long time. Is there a quicker way to compile and load a module, can anyone suggest a better workflow?

Thanks!

Use a faster build host.. :wink:

Regards,

I've always felt like it should be possible to just rebuild the module. Is it possible to cd to some subdir and hit "make"? Something to avoid all the work the script repeats?

Thanks.

Sure you can, just run the "make -jx LOCALVERSION=xxx ARCH=xxx CROSS_COMPILE=xxx modules" command that is displayed in the script.

Regards,
John

Sure you can, just run the "make -jx LOCALVERSION=xxx ARCH=xxx CROSS_COMPILE=xxx modules" command that is displayed in the script.

That target implies all the modules. I'd like to avoid all the dependency checking for all the other modules. Nevertheless, I'll try that, see if it saves time.

Thanks!

I think you want an “out of tree” module:

https://www.kernel.org/doc/Documentation/kbuild/modules.txt

Note that it says this is the way a kernel module is initially developed.

Greg

I modified the file you are building and the build takes all of about 2 seconds. How much more time do you want to save?

Regards,
John

Thanks everyone for the replies :slight_smile:

john3909 wrote:

I modified the file you are building and the build takes all of about 2 seconds. How much more time do you want to save?

When I edit the file and then run scripts/rebuild.sh, it opens Menuconfig, I close it and then it starts issuing many CC commands that take about 2 minutes to complete.

If I run the following instead, it takes a little longer than a minute

make -j4 ARCH=arm LOCALVERSION=-bone-rt-r10 CROSS_COMPILE="ccache /home/rvg/Desktop/bb-kernel/dl/gcc-linaro-5.3-2016.02-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-" modules

My machine is not (so) slow, it’s a dual core i7 (4 cores seen by the kernel), about 5 years old, with 8GB ram.

What did you run that took 2 seconds?

Greg wrote:

I think you want an “out of tree” module:

https://www.kernel.org/doc/Documentation/kbuild/modules.txt

Thanks! I’ll try that!

OK, so on my stopwatch, it takes 9.88 seconds.

john:~/Download/GIT/ti-linux-kernel-dev/KERNEL$ touch sound/soc/codecs/tlv320aic3x.c
john:~/Download/GIT/ti-linux-kernel-dev/KERNEL$ time make -j8 ARCH=arm LOCALVERSION=-ti-r33 CROSS_COMPILE="/home/john/Download/GIT/ti-linux-kernel-dev/dl/gcc-linaro-4.9-2015.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-" modules
CHK include/config/kernel.release
CHK include/generated/uapi/linux/version.h
CHK include/generated/utsrelease.h
make[1]: `include/generated/mach-types.h’ is up to date.
CHK include/generated/bounds.h
CHK include/generated/asm-offsets.h
CALL scripts/checksyscalls.sh
CC [M] sound/soc/codecs/tlv320aic3x.o
LD [M] sound/soc/codecs/snd-soc-tlv320aic3x.o
Building modules, stage 2.
MODPOST 1940 modules
LD [M] sound/soc/codecs/snd-soc-tlv320aic3x.ko

real 0m9.879s
user 0m29.488s
sys 0m6.005s

Regards,
John