RadxaOS-SDK/rsdk

add snd-usb-audio to kernel

Closed this issue · 7 comments

please add snd-usb-audio to the kernel

I believe it's just pipewire that may be needed, though I'm unclear. Added all the usual audio "stuff" to devenv.local.nix to see if this will ultimately bring it into the build, am trying now....

Include necessary packages

packages = with pkgs; [
pipewire
pwvucontrol
pavucontrol
pulseaudio
alsa-tools
alsa-lib
alsa-plugins
alsa-utils
];

the above attempt got me further, the device appears in lsusb where it didn't before, but snd-usb-audio.ko is not in the kernel, and it's not clear to how i can modify, ideally with devenv.local.nix, please advise.

pipewire is already the default audio server for our Debian 12 systems.

Please check if CONFIG_SND_USB_AUDIO is already enabled in your system with grep CONFIG_SND_USB_AUDIO /boot/config*.

it is not present. I'm not so familiar with .nix build management, I've tried numerous variations of something like this to patch from devenv.local.nix:

{ config, pkgs, ... }:

let

  inherit (config.boot) kernelPatches;
  inherit (config.boot.kernel) features randstructSeed;
  inherit (config.boot.kernelPackages) kernel;

in

{
  # Kernel Configuration
  kernelPatches = [
    {
      name = "enable-usb-audio";
      patch = null;
      extraConfig = ''
        CONFIG_SND_USB_AUDIO=y
      '';
    }
  ];

  ## Override rsdk defaults here
  #env = {
  #  RSDK_OPTION_REPO_SUFFIX = "-test";
  #  RSDK_OPTION_DISTRO_MIRROR = "http://apt.vamrs.org";
  #  RSDK_OPTION_RADXA_MIRROR = "http://apt.vamrs.org/rbuild-";
  #};
    
  # Include necessary packages
  packages = with pkgs; [
    pipewire
    pwvucontrol
    pavucontrol
    pulseaudio
    alsa-tools
    alsa-lib
    alsa-plugins
    alsa-utils
  ];

}

but I'm getting errors, no matter how I try to express a config,boot,boot.kernelPatches, etc.

Please excuse my ignorance with .nix and rsdk methods:

  1. Can you provide further guidance, example, and/or links to help understand the configuration of devenv.local.nix?
  2. rsdk is very cool for building a .img to put on sdcard, but unclear to me how to get to something like a buildroot level or makemenuconfig sort of thing. When I go to "/usr/src/linux-headers-6.1.68-2-stable" and try to make menuconfig, I get:
radxa@radxa-zero2-pro:/usr/src/linux-headers-6.1.68-2-stable$ sudo make menuconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/confdata.o
  HOSTCC  scripts/kconfig/expr.o
  HOSTCC  scripts/kconfig/lexer.lex.o
  HOSTCC  scripts/kconfig/menu.o
  HOSTCC  scripts/kconfig/parser.tab.o
  HOSTCC  scripts/kconfig/preprocess.o
  HOSTCC  scripts/kconfig/symbol.o
  HOSTCC  scripts/kconfig/util.o
  UPD     scripts/kconfig/mconf-cfg
  HOSTCC  scripts/kconfig/mconf.o
  HOSTCC  scripts/kconfig/lxdialog/checklist.o
  HOSTCC  scripts/kconfig/lxdialog/inputbox.o
  HOSTCC  scripts/kconfig/lxdialog/menubox.o
  HOSTCC  scripts/kconfig/lxdialog/textbox.o
  HOSTCC  scripts/kconfig/lxdialog/util.o
  HOSTCC  scripts/kconfig/lxdialog/yesno.o
  HOSTLD  scripts/kconfig/mconf
can't find file Kconfig
make[1]: *** [scripts/kconfig/Makefile:48: menuconfig] Error 1
make: *** [Makefile:704: menuconfig] Error 2
radxa@radxa-zero2-pro:/usr/src/linux-headers-6.1.68-2-stable$ 

At the moment, I'm rebuilding the linux modules directly on the radxa zero 2 pro, having extracted linux 6.1, copying over the .config and adding usb audio to do a depmod and modprob for snd-usb-audio. I assume there's a much more suitable workflow for such things?

You are getting ahead of yourself. There is no need to tweak rsdk if your change is kernel related.

Please use bsp to build the latest ZERO 2 kernel from source: ./bsp linux stable

You can then install the generated kernel package on your system with sudo dpkg -i linux-image*.deb.

I followed your suggestion, but there were errors that I didn't capture, and on reboot it didn't take the downgrade. It stayed 6.1.2.68-2-stable

note:
rsdk kernel = 6.1.2.68-2-stable
bsp kernel = 6.1.2.68-1-stable

Prior to your response, I had tried taking the .config modifying it, downloading 6.1.2.68-2-stable source and modifying the .config to include all the necessary configs, got ever closer with audio, timers and midi, but gave up because it was late, and I didn't feel like digging through linux usb audio documentation, amlogic datasheets and schematics to better understand the configs and dependencies needed.

Last attempt, I tried by downloading debian from the radxa website, and applying everything from the bsp's kernel build, and I did capture errors (below). Nevertheless it did take the new kernel on reboot, and after installing some typical audio stuff that was not present (pipewire, pavucontrol, etc), I was able to hear sound via youtoube. Minor concern, hardly worth mention at this time: the "test" functionality in System Settings->Audio says "no such driver".

update-radxa-deb-from-website-to-6.1.68-2-stable.log

Anyways, I hope this helps.

You only need to install linux-image-6.1.68-1-stable_6.1.68-1_arm64.deb. As mentioned in our documentation it is the real package.

The overlay package is in the apt repository. You can fix with sudo apt update && sudo apt install --fix-broken.