Yanyg - Software Engineer

Thinkpad X1 Carbon 2022 Gen 10安装LINUX系统记录

目录

入手 Thinkpad Carbon 2022 Gen 10, 安装了Debian 11.6. 结果WIFI, 声卡, 触控板蓝牙无法使用, 显卡有部分异常. 解决过程记录如下.

1. 安装

参见 Blog Debian Install and Init .

2. WIFI

WIFI 硬件是 Intel AX211 6E 模块. Debian 11.6 内核版本 5.10.0-20-amd64 尚不支持. 直接编译 6.3 内核.

使用 5.10.0 config 文件做为初始配置, 为支持 touchpad 打开 i2c_hid_acpi 配置. 编译/安装即可.

系统启动过程会报 WIFI firmware 缺失, 从 linux-firmware 下载, 并安装即可.

$ sudo dmesg | grep -i "iwlwifi.*firmware"
[    4.763720] iwlwifi 0000:00:14.3: loaded firmware version 74.fe17486e.0 so-a0-gf-a0-74.ucode op_mode iwlmvm
$ git config --get remote.origin.url
git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
$ git log -1
commit 457391b0380335d5e9a5babdec90ac53928b23b4 (HEAD, tag: v6.3)
Author: Linus Torvalds <[email protected]>
Date:   Sun Apr 23 12:02:52 2023 -0700

    Linux 6.3
$ cp /boot/config-5.10.0-20-amd64 .config
$ make menuconfig
$ grep I2C_HID_ACPI .config
CONFIG_I2C_HID_ACPI=m

构建, 安装 modules, 并自己生成 initrd:

$ uname -a
Linux tp-2023 6.3.0 #1 SMP PREEMPT_DYNAMIC Mon May  1 13:09:40 CST 2023 x86_64 GNU/Linux

$ ls -lhrt /boot/
total 109M
drwx------ 6 root root 4.0K Jan  1  1970 efi
-rw-r--r-- 1 root root 6.7M Dec 14 04:46 vmlinuz-5.10.0-20-amd64
-rw-r--r-- 1 root root   83 Dec 14 04:46 System.map-5.10.0-20-amd64
-rw-r--r-- 1 root root 231K Dec 14 04:46 config-5.10.0-20-amd64
-rw-r--r-- 1 root root  41M May  2 22:08 initrd.img-5.10.0-20-amd64
-rw-r--r-- 1 root root 252K May  2 22:14 config-6.3.0
-rw-r--r-- 1 root root 5.6M May  2 22:14 System.map-6.3.0
-rw-r--r-- 1 root root 7.2M May  2 22:14 vmlinuz-6.3.0
-rw-r--r-- 1 root root  49M May  6 00:27 initrd.img-6.3.0
drwxr-xr-x 5 root root 4.0K May  6 00:27 grub

## part of /boot/grub/grub.cfg:
menuentry 'Debian GNU/Linux' --class debian --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-5fb313ec-dfab-4bb2-b302-c8f599ae2875' {
        load_video
        insmod gzio
        if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
        insmod part_gpt
        insmod ext2
        search --no-floppy --fs-uuid --set=root 5fb313ec-dfab-4bb2-b302-c8f599ae2875
        echo    'Loading Linux 6.3.0 ...'
        linux   /boot/vmlinuz-6.3.0 root=UUID=5fb313ec-dfab-4bb2-b302-c8f599ae2875 ro i915.enable_psr=0 i915.enable_guc=2
        echo    'Loading initial ramdisk ...'
        initrd  /boot/initrd.img-6.3.0
}

现在系统有网络了, 可以安装一些软件包. /etc/apt/sources.list 配置如下:

$ cat /etc/apt/sources.list
deb https://mirrors.aliyun.com/debian bullseye main contrib non-free
deb-src https://mirrors.aliyun.com/debian bullseye main contrib non-free

deb https://mirrors.aliyun.com/debian-security/ bullseye-security main contrib non-free
deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main contrib non-free

deb https://mirrors.aliyun.com/debian bullseye-backports main contrib non-free
deb-src https://mirrors.aliyun.com/debian bullseye-backports main contrib non-free

deb https://mirrors.aliyun.com/debian bullseye-updates main contrib non-free
deb-src https://mirrors.aliyun.com/debian bullseye-updates main contrib non-free

3. Touchpad 配置

Touchpad 打开 I2C_HID_ACPI 构建即可. 在上面的配置中, 已经打开了.

4. 声卡配置

特化模块参数即可:

$ cat /etc/modprobe.d/sof-fix.conf
options snd-intel-dspcfg dsp_driver=1

5. 蓝牙配置

缺少 firmware, 根据提示复制. firmware 在 linux-firmware 仓库.

$ sudo dmesg | grep -i "Blue.*firmware"
[    5.742076] Bluetooth: hci0: Found device firmware: intel/ibt-0040-0041.sfi

6. 显卡配置

特化模块参数即可 i915.enable_psr=0 i915.enable_guc=2:

$ cat /boot/grub/grub.cfg | grep i915
        linux   /boot/vmlinuz-6.3.0 root=UUID=5fb313ec-dfab-4bb2-b302-c8f599ae2875 ro i915.enable_psr=0 i915.enable_guc=2

7. Enjoy Your Thinkpad

8. Thinkpad Carbon 2022 Gen 10 Config

Type 21CBA002CD
Memory 16GB
CPU i5 * 12 cores
Storage NVMe SSD 512 GB

8.1. CPU

$ lscpu
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   39 bits physical, 48 bits virtual
CPU(s):                          16
On-line CPU(s) list:             0-15
Thread(s) per core:              1
Core(s) per socket:              12
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           154
Model name:                      12th Gen Intel(R) Core(TM) i5-1240P
Stepping:                        3
CPU MHz:                         554.162
CPU max MHz:                     4400.0000
CPU min MHz:                     400.0000
BogoMIPS:                        4224.00
Virtualization:                  VT-x
L1d cache:                       288 KiB
L1i cache:                       192 KiB
L2 cache:                        7.5 MiB
NUMA node0 CPU(s):               0-15
Vulnerability Itlb multihit:     Not affected
Vulnerability L1tf:              Not affected
Vulnerability Mds:               Not affected
Vulnerability Meltdown:          Not affected
Vulnerability Mmio stale data:   Not affected
Vulnerability Retbleed:          Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Enhanced / Automatic IBRS, IBPB conditional, RSB filling, PBRSB-eIBRS SW sequence
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Not affected
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rd
                                 tscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monit
                                 or ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand l
                                 ahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsb
                                 ase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_det
                                 ect avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid
                                 movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities

8.2. dmidecode

Handle 0x001B, DMI type 1, 27 bytes
System Information
        Manufacturer: LENOVO
        Product Name: 21CBA002CD
        Version: ThinkPad X1 Carbon Gen 10
        Serial Number: XXXXXXXX(Masked)
        UUID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx(Masked)
        Wake-up Type: Power Switch
        SKU Number: LENOVO_MT_21CB_BU_Think_FM_ThinkPad X1 Carbon Gen 10
        Family: ThinkPad X1 Carbon Gen 10

8.3. Storage

$ sudo nvme list /dev/nvme0
Node             SN                   Model                                    Namespace Usage                      Format           FW Rev
---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1     S64KXXXXXXXXXX       SAMSUNG MZVL2512HCJQ-00BL7               1         138.33  GB / 512.11  GB    512   B +  0 B   CL2QGXA7

Notes: SN is Masked.

$ sudo nvme smart-log /dev/nvme0
Smart Log for NVME device:nvme0 namespace-id:ffffffff
critical_warning                        : 0
temperature                             : 33 C
available_spare                         : 100%
available_spare_threshold               : 10%
percentage_used                         : 0%
endurance group critical warning summary: 0
data_units_read                         : 1,725,063
data_units_written                      : 735,747
host_read_commands                      : 6,116,882
host_write_commands                     : 4,400,572
controller_busy_time                    : 25
power_cycles                            : 102
power_on_hours                          : 9
unsafe_shutdowns                        : 22
media_errors                            : 0
num_err_log_entries                     : 0
Warning Temperature Time                : 0
Critical Composite Temperature Time     : 0
Temperature Sensor 1           : 33 C
Temperature Sensor 2           : 28 C
Thermal Management T1 Trans Count       : 0
Thermal Management T2 Trans Count       : 0
Thermal Management T1 Total Time        : 0
Thermal Management T2 Total Time        : 0

8.4. WIFI

$ sudo lspci -v | grep -iA12 net
00:14.3 Network controller: Intel Corporation Device 51f0 (rev 01)
        Subsystem: Intel Corporation Device 0090
        Flags: bus master, fast devsel, latency 0, IRQ 16, IOMMU group 12
        Memory at 603e1dc000 (64-bit, non-prefetchable) [size=16K]
        Capabilities: [c8] Power Management version 3
        Capabilities: [d0] MSI: Enable- Count=1/1 Maskable- 64bit+
        Capabilities: [40] Express Root Complex Integrated Endpoint, MSI 00
        Capabilities: [80] MSI-X: Enable+ Count=16 Masked-
        Capabilities: [100] Latency Tolerance Reporting
        Capabilities: [164] Vendor Specific Information: ID=0010 Rev=0 Len=014 <?>
        Kernel driver in use: iwlwifi
        Kernel modules: iwlwifi
$ sudo dmesg | grep -i "iwlwifi.*intel"
[    4.909231] iwlwifi 0000:00:14.3: Detected Intel(R) Wi-Fi 6E AX211 160MHz, REV=0x370