Skip to content

Lenovo T14s: firmware installed, but not available early in initramfs #258

@gagath

Description

@gagath

While the firmware-qcom-soc package is installed in the image, the firmware files will only be able to be accessed by the kernel when the root file system is mounted:

debian@debian:/boot$ cat initrd.img-6.19.0-g904982138f20 | zstd -d | cpio -i -t | grep firmware 
usr/lib/modules/6.19.0-g904982138f20/kernel/drivers/firmware
usr/lib/modules/6.19.0-g904982138f20/kernel/drivers/firmware/samsung
usr/lib/modules/6.19.0-g904982138f20/kernel/drivers/firmware/samsung/acpm-protocol.ko
usr/lib/udev/rules.d/50-firmware.rules
124580 blocks

By chance, the root file system is mounted before the kernel tries to load the firmware when running the sdcard.img on a USB stick on the Lenovo T14s. However, when booting from NVME after an install, the firmware is not available and numerous issues appear:

  • Missing sound
  • No battery status report
  • and probably other undiscovered issues

To fix the issue, I was able to create the following /etc/initramfs-tools/hooks/lenovo-t14s.hook file to include the missing firmware in the initramfs:

#!/bin/sh

PREREQ=""
prereqs()
{
	echo "$PREREQ"
}

case $1 in
prereqs)
	prereqs
	exit 0
	;;
esac

. /usr/share/initramfs-tools/hook-functions
# Begin real processing below this line

# Add missing firmware required for battery management and GPU support
for f in /usr/lib/firmware/qcom/x1e80100/LENOVO/21N1/*
do
	copy_file firmware "$f"
done
copy_file firmware /usr/lib/firmware/qcom/gen70500_sqe.fw
copy_file firmware /usr/lib/firmware/qcom/gen70500_gmu.bin

After reconfiguring the kernel image, the initramfs now contains the missing firmware and the kernel can find and load it on the next boot:

debian@debian:/boot$ cat /mnt/initrd.img-6.19.0-g904982138f20 | zstd -d | cpio -i -t | grep firmware
usr/lib/firmware
usr/lib/firmware/qcom
usr/lib/firmware/qcom/gen70500_gmu.bin
usr/lib/firmware/qcom/gen70500_sqe.fw
usr/lib/firmware/qcom/x1e80100
usr/lib/firmware/qcom/x1e80100/LENOVO
usr/lib/firmware/qcom/x1e80100/LENOVO/21N1
usr/lib/firmware/qcom/x1e80100/LENOVO/21N1/X1E80100-LENOVO-Thinkpad-T14s-tplg.bin
usr/lib/firmware/qcom/x1e80100/LENOVO/21N1/adsp_dtbs.elf
usr/lib/firmware/qcom/x1e80100/LENOVO/21N1/adspr.jsn
usr/lib/firmware/qcom/x1e80100/LENOVO/21N1/adsps.jsn
usr/lib/firmware/qcom/x1e80100/LENOVO/21N1/adspua.jsn
usr/lib/firmware/qcom/x1e80100/LENOVO/21N1/battmgr.jsn
usr/lib/firmware/qcom/x1e80100/LENOVO/21N1/cdsp_dtbs.elf
usr/lib/firmware/qcom/x1e80100/LENOVO/21N1/cdspr.jsn
usr/lib/firmware/qcom/x1e80100/LENOVO/21N1/qcadsp8380.mbn
usr/lib/firmware/qcom/x1e80100/LENOVO/21N1/qccdsp8380.mbn
usr/lib/firmware/qcom/x1e80100/LENOVO/21N1/qcdxkmsuc8380.mbn
usr/lib/firmware/qcom/x1e80100/LENOVO/21N1/qcvss8380.mbn
usr/lib/modules/6.19.0-g904982138f20/kernel/drivers/firmware
usr/lib/modules/6.19.0-g904982138f20/kernel/drivers/firmware/samsung
usr/lib/modules/6.19.0-g904982138f20/kernel/drivers/firmware/samsung/acpm-protocol.ko
usr/lib/udev/rules.d/50-firmware.rules
234705 blocks

All of this was already investigated and solved by the Ubuntu folks when they created the X1E image, yet we seem to manually rediscover all of this when trying to make the images work on the T14s. Other known issues that I did not encounter yet was missing modules in the initramfs. There are probably many other quirks that were found and fixed in the X1E image, so I wonder how we should proceed?

Metadata

Metadata

Assignees

Labels

kernelKernel related

Type

No fields configured for Bug.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions