首页 > 解决方案 > 如何在 respberry pi 上使用来自 x86 chroot 的 alsa

问题描述

我设法在我的树莓派 3b 拉伸上使用 qemu i386 static 和 binfmt 在 chroot 中设置 x86 debian 拉伸,现在我想在 chroot(不想要脉冲音频)环境中使用 alsa 但是继续

$ aplay -l
Unsupported ioctl: cmd=0x81785501
aplay: device_list:270: no soundcards found...

声卡似乎在 chroot 中可见

$cat /proc/asound/cards
 0 [ALSA           ]: bcm2835 - bcm2835 ALSA
                      bcm2835 ALSA

声卡在常规 pi 环境中正常运行并按预期返回列表

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

chroot 中的用户与普通用户同名,并且是所有组的一部分,并且在环境之间安装了以下文件夹:

sys
proc
/dev
/dev/pts
/dev/shm
/home/user

下面是 chroot 中 aplay - l 的 strace,并不是说我已经修剪了相当多的 cacheflush 和 rt_sigprocmask

1739  execve("/usr/bin/aplay", ["aplay", "-l"], [/* 11 vars */] <unfinished ...>
1739  uname({sysname="Linux", nodename="raspberrypi", ...}) = 0
1739  brk(NULL)                         = 0x63207000
1739  brk(0x63207d58)                   = 0x63207d58
1739  set_tls(0x632074c0, 0x602b162c, 0, 0x602c4f8c, 0x4) = 0
1739  set_tid_address(0x63207068)       = 1739
1739  set_robust_list(0x63207070, 12)   = 0
1739  ugetrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
1739  readlink("/proc/self/exe", "/usr/bin/qemu-i386-static", 4096) = 25
1739  brk(0x63228d58)                   = 0x63228d58
1739  brk(0x63229000)                   = 0x63229000
1739  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1739  clone(child_stack=0xb6fdbde8, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0xb6fdc318, tls=0xb6fdc770, child_tidptr=0xb6fdc318) = 1741
1741  set_robust_list(0xb6fdc320, 12 <unfinished ...>
1741  <... set_robust_list resumed> )   = 0
1741  nanosleep({tv_sec=0, tv_nsec=10000000},  <unfinished ...>
1739  gettimeofday({tv_sec=1582165215, tv_usec=910982}, NULL) = 0
1739  prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
1739  gettimeofday({tv_sec=1582165215, tv_usec=911591}, NULL) = 0
1739  open("/etc/qemu-binfmt/i386", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1739  uname({sysname="Linux", nodename="raspberrypi", ...}) = 0
1739  madvise(0x602dd740, 16771264, MADV_HUGEPAGE) = -1 EINVAL (Invalid argument)
1739  open("/proc/sys/vm/mmap_min_addr", O_RDONLY|O_LARGEFILE) = 4
1739  fstat64(4, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
1739  read(4, "4096\n", 1024)           = 5
1739  close(4)                          = 0
1739  gettid()                          = 1739
1739  fstat64(3, {st_mode=S_IFREG|0755, st_size=62916, ...}) = 0
1739  geteuid32()                       = 1000
1739  getegid32()                       = 1000
1739  read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0!\222\0\0004\0\0\0"..., 1024) = 1024
1739  close(3)                          = 0
1739  brk(0x6324b000)                   = 0x6324b000
1739  open("/lib/ld-linux.so.2", O_RDONLY|O_LARGEFILE) = 3
1739  read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0 \n\0\0004\0\0\0"..., 1024) = 1024
1739  close(3)                          = 0
1739  getuid32()                        = 1000
1739  geteuid32()                       = 1000
1739  getgid32()                        = 1000
1739  getegid32()                       = 1000
1741  <... nanosleep resumed> 0xb6fdbc7c) = 0
1741  futex(0x612e3648, FUTEX_WAIT, 4294967295, NULL <unfinished ...>
1739  uname({sysname="Linux", nodename="raspberrypi", ...}) = 0
1739  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1739  access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
1739  openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
1739  fstat64(3, {st_mode=S_IFREG|0644, st_size=24702, ...}) = 0
1739  close(3)                          = 0
1739  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1739  openat(AT_FDCWD, "/lib/i386-linux-gnu/librt.so.1", O_RDONLY|O_CLOEXEC) = 3
1739  read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@\30\0\0004\0\0\0"..., 512) = 512
1739  fstat64(3, {st_mode=S_IFREG|0644, st_size=30692, ...}) = 0
1739  close(3)                          = 0
1739  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1739  openat(AT_FDCWD, "/usr/lib/i386-linux-gnu/libasound.so.2", O_RDONLY|O_CLOEXEC) = 3
1739  read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\260\341\1\0004\0\0\0"..., 512) = 512
1739  fstat64(3, {st_mode=S_IFREG|0644, st_size=1189404, ...}) = 0
1739  close(3)                          = 0
1739  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1739  openat(AT_FDCWD, "/lib/i386-linux-gnu/libm.so.6", O_RDONLY|O_CLOEXEC) = 3
1739  read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340F\0\0004\0\0\0"..., 512) = 512
1739  fstat64(3, {st_mode=S_IFREG|0644, st_size=341556, ...}) = 0
1739  close(3)                          = 0
1739  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1739  openat(AT_FDCWD, "/lib/i386-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 3
1739  read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0000\n\0\0004\0\0\0"..., 512) = 512
1739  fstat64(3, {st_mode=S_IFREG|0644, st_size=13860, ...}) = 0
1739  close(3)                          = 0
1739  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1739  openat(AT_FDCWD, "/lib/i386-linux-gnu/libpthread.so.0", O_RDONLY|O_CLOEXEC) = 3
1739  read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\340O\0\0004\0\0\0"..., 512) = 512
1739  fstat64(3, {st_mode=S_IFREG|0755, st_size=132328, ...}) = 0
1739  close(3)                          = 0
1739  access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
1739  openat(AT_FDCWD, "/lib/i386-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
1739  read(3, "\177ELF\1\1\1\3\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0\0\204\1\0004\0\0\0"..., 512) = 512
1739  fstat64(3, {st_mode=S_IFREG|0755, st_size=1791908, ...}) = 0
1739  close(3)                          = 0
1739  munmap(0x40839000, 28672)         = 0
1739  set_tid_address(0x40b9e768)       = 1739
1739  prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0
1739  uname({sysname="Linux", nodename="raspberrypi", ...}) = 0
1739  munmap(0xb5f8d000, 135168)        = 0
1739  ioctl(0, TCGETS, {B38400 opost isig icanon echo ...}) = 0
1739  openat(AT_FDCWD, "/dev/snd/controlC0", O_RDONLY|O_CLOEXEC) = 3
1739  fcntl64(3, F_SETFD, FD_CLOEXEC)   = 0
1739  write(2, "Unsupported ioctl: cmd=0x8178550"..., 34) = 34
1739  close(3)                          = 0
1739  openat(AT_FDCWD, "/dev/aloadC0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1739  openat(AT_FDCWD, "/dev/snd/controlC1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1739  openat(AT_FDCWD, "/dev/aloadC1", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
1739  write(2, "aplay: device_list:270: ", 24) = 24
1739  write(2, "no soundcards found...", 22) = 22
1739  write(2, "\n", 1)                 = 1
1739  futex(0x4096e0ac, FUTEX_WAKE_PRIVATE, 2147483647) = 0
1739  exit_group(0)                     = ?

我不确定是什么阻止了我使用声卡,有人可以给我一些指示如何让它运行,或者如果不可能,为什么它不可能?

标签: raspberry-piqemualsachrooti386

解决方案


推荐阅读