1900美元赏金,用于修复联想拯救者Pro 7 16IAX10H型号在Linux上的扬声器问题。
$1900 Bug Bounty to Fix the Lenovo Legion Pro 7 16IAX10H's Speakers on Linux

原始链接: https://github.com/nadimkobeissi/16iax10h-linux-sound-saga

## 联想拯救者Pro 7i Gen 10 (16IAX10H) Linux 音频修复 – 摘要 本指南详细介绍了一种在Linux下解决联想拯救者Pro 7i Gen 10 (16IAX10H)音频问题的解决方法,尤其是在内核6.17.8下,直到内核集成永久修复为止。该过程涉及多个步骤:安装AW88399固件,修补Linux内核源代码,配置和编译自定义内核,安装NVIDIA DKMS驱动程序,生成新的initramfs,并更新引导加载程序。 关键步骤包括启用与AW88399编解码器和SOF(Sound Open Firmware)相关的特定内核配置选项,以及将`snd_intel_dspcfg.dsp_driver=3`添加到启动参数中。还需要一个修补后的ALSA UCM2配置文件才能正确控制音量。 这是一个复杂的过程,需要具备技术熟练度。目前该修复归功于Lyapsus的大量工作,Nadim Kobeissi和Gergo K.也做出了贡献。作者提供此修复程序“按原样”且不提供任何保证,并免除因使用该修复程序而引起任何问题的责任。

## 联想拯救者Pro 7 扬声器漏洞赏金:摘要 针对联想拯救者Pro 7 16IAX10H 笔记本电脑在Linux下运行时的扬声器问题,成功申领了1900美元的漏洞赏金。修复主要由Lyapsus完成,Nadim Kobeissi提供支持,涉及内核级驱动程序工作和编解码器调整。 此次讨论引发了关于漏洞修复可行商业模式的争论,评论者质疑为什么专有软件公司不提供类似的赏金计划。人们对这些计划的成本、在没有源代码访问权限的情况下进行修补的复杂性以及质量控制的挑战表示担忧。 许多人指出,虽然赏金可能有效,但通常只会吸引到最低可行的补丁,并且很难建立稳定的收入来源。其他人建议采取替代方法,例如聘请外部顾问或通过非营利组织资助开源开发。该讨论还涉及逆向工程的困难以及潜在的法律问题。最终,这次成功表明了社区驱动解决方案的力量以及补偿熟练开发人员解决特定硬件兼容性问题的价值。
相关文章

原文

This guide explains how to get audio working correctly on the Lenovo Legion Pro 7i Gen 10 (16IAX10H).

Since this solution is still very new, it will take some time for all components to be properly integrated into the Linux kernel. Until that happens, you can follow the steps below, which have been rigorously tested and are confirmed to work.

This guide is currently for Linux kernel version 6.17.8. It will be updated for future kernel versions as they are released, until the fix is fully integrated into the kernel.

Step 1: Install the AW88399 Firmware

Copy the aw88399_acf.bin file provided in this repository to /lib/firmware/aw88399_acf.bin.

If you prefer to obtain your own copy of this firmware blob, follow these instructions.

Step 2: Download the Linux Kernel 6.17.8 Sources

Download the kernel sources by clicking here.

Step 3: Patch the Linux Kernel Sources

Copy the 16iax10h-audio-linux-6.17.8.patch file from this repository into the root of your Linux kernel source directory. Then run:

patch -p1 < 16iax10h-audio-linux-6.17.8.patch

The patch should apply successfully to 10 files without any errors.

Step 4: Configure the Kernel

For the fix to work, the following kernel configuration options must be enabled:

CONFIG_SND_HDA_SCODEC_AW88399=m
CONFIG_SND_HDA_SCODEC_AW88399_I2C=m
CONFIG_SND_SOC_AW88399=m
CONFIG_SND_SOC_SOF_INTEL_TOPLEVEL=y
CONFIG_SND_SOC_SOF_INTEL_COMMON=m
CONFIG_SND_SOC_SOF_INTEL_MTL=m
CONFIG_SND_SOC_SOF_INTEL_LNL=m

Configure the rest of the kernel as appropriate for your machine.

Step 5: Compile and Install the Kernel

make -j24
make -j24 modules
sudo make -j24 modules_install
sudo cp -f arch/x86/boot/bzImage /boot/vmlinuz-linux-16iax10h-audio

Step 6: Install NVidia DKMS Drivers

To ensure proper graphics integration, you'll need to install the NVidia DKMS drivers for your custom kernel.

Install the NVidia DKMS package and headers:

sudo pacman -S nvidia-open-dkms

The DKMS system will automatically build the NVidia kernel modules for your custom kernel. After installation, reboot to load the new drivers.

In case you later need to recompile and reinstall the driver, use the dkms utility:

sudo dkms build nvidia/580.105.08 --force
sudo dkms install nvidia/580.105.08 --force

You may need to replace 580.105.08 with the actual NVidia driver version.

Step 7: Generate the initramfs

The process differs between distributions, as some use dracut while others use mkinitcpio. Instructions for common distributions are provided below.

First, create a new preset file for your custom kernel:

sudo cp /etc/mkinitcpio.d/linux.preset /etc/mkinitcpio.d/linux-16iax10h-audio.preset

Edit /etc/mkinitcpio.d/linux-16iax10h-audio.preset to look like this:

# mkinitcpio preset file for the 'linux-16iax10h-audio' package

ALL_kver="/boot/vmlinuz-linux-16iax10h-audio"
PRESETS=('default')
default_image="/boot/initramfs-linux-16iax10h-audio.img"

Then generate the initramfs:

sudo mkinitcpio -p linux-16iax10h-audio

Finally, update your bootloader configuration. For GRUB, run:

sudo grub-mkconfig -o /boot/grub/grub.cfg

For systemd-boot, create a new boot entry in /boot/loader/entries/arch-16iax10h-audio.conf:

title   Arch Linux (16IAX10H Audio)
linux   /vmlinuz-linux-16iax10h-audio
initrd  /initramfs-linux-16iax10h-audio.img
options root=PARTUUID=your-root-partition-uuid rw snd_intel_dspcfg.dsp_driver=3

Replace your-root-partition-uuid with your actual root partition UUID (find it by running blkid).

Note: You must include snd_intel_dspcfg.dsp_driver=3 in your kernel boot parameters.

First, generate the initramfs for your custom kernel:

sudo dracut --force /boot/initramfs-linux-16iax10h-audio.img --kver $(cat include/config/kernel.release)

Then update your bootloader configuration. For GRUB, run:

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

For systemd-boot, create a new boot entry in /boot/loader/entries/fedora-16iax10h-audio.conf:

title   Fedora Linux (16IAX10H Audio)
linux   /vmlinuz-linux-16iax10h-audio
initrd  /initramfs-linux-16iax10h-audio.img
options root=UUID=your-root-partition-uuid rw snd_intel_dspcfg.dsp_driver=3

Replace your-root-partition-uuid with your actual root partition UUID (find it by running blkid).

Note: You must include snd_intel_dspcfg.dsp_driver=3 in your kernel boot parameters.

Step 8: Reboot into the Patched Kernel

Reboot into the patched kernel. After rebooting, run uname -a to verify that you're running the correct kernel.

Step 9: Install the Patched ALSA UCM2 Configuration

This step is necessary for proper volume control.

Copy the HiFi-analog.conf file from this repository to /usr/share/alsa/ucm2/HDA/HiFi-analog.conf, overwriting the existing file:

sudo cp -f HiFi-analog.conf /usr/share/alsa/ucm2/HDA/HiFi-analog.conf

First, identify your sound card ID by running:

You should get something like this:

0: hw:0
  LENOVO-83F5-LegionPro716IAX10H-LNVNB161216

Then, run the commands below, If you got hw:1 above, change hw:0 to hw:1 and -c 0 to -c 1:

alsaucm -c hw:0 reset
alsaucm -c hw:0 reload
amixer sset -c 0 Master 100%
amixer sset -c 0 Headphone 100%
amixer sset -c 0 Speaker 100%

Note: The last three commands are for speaker calibration, not for setting your volume to maximum. They must be run for the speakers to function properly, but they do not control your actual volume level.

Step 10: Enjoy Working Audio!

That's it! Your audio should now work correctly and permanently. This fix will persist across reboots with no additional steps required.

I, Nadim Kobeissi, attest that all components of the fix provided here have been tested and work without any apparent harmful effects. The fix components are provided in good faith. However, I (as well as the main fix authors) disclaim all responsibility for any use of this fix and guide:

THE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.

Fixing this issue required weeks of intensive work from multiple people.

Approximately 95% of the engineering work was done by Lyapsus. Lyapsus improved an incomplete kernel driver, wrote new kernel codecs and side-codecs, and contributed much more. I want to emphasize his incredible kindness and dedication to solving this issue. He is the primary force behind this fix, and without him, it would never have been possible.

I (Nadim Kobeissi) conducted the initial investigation that identified the missing components needed for audio to work on the 16IAX10H on Linux. Building on what I learned from Lyapsus's work, I helped debug and clean up his kernel code, tested it, and made minor improvements. I also contributed the solution to the volume control issue documented in Step 8, and wrote this guide.

Gergo K. showed me how to extract the AW88399 firmware from the Windows driver package and install it on Linux, as documented in Step 1.

Sincere thanks to everyone who pledged a reward for solving this problem. The reward goes to Lyapsus.

联系我们 contact @ memedata.com