# Values of sp11.conf, rendered by scripts/30-build-support-rpm.sh, which also packs the sources. %global grub_font_file sp11-console.pf2 %global grub_font_size 32 %global grub_font_name SP11 Console %global audio_topology X1E80100-Microsoft-Surface-Pro-11-tplg.bin %global ucm_regex Microsoft Corporation.*Surface.*Microsoft Surface Pro( with 5G)?, 11th Edition %global debug_package %{nil} %global __os_install_post %{nil} %global __strip /bin/true %global _build_id_links none %undefine _missing_build_ids_terminate_build Name: sp11-surface-support Version: 4.7 Release: 1%{?dist} Summary: Surface Pro 11 device support: firmware, audio, Bluetooth, boot policy License: GPL-3.0-or-later AND BSD-3-Clause AND LicenseRef-Fedora-Firmware AND Bitstream-Vera ExclusiveArch: aarch64 AutoReqProv: no # The payload's files, sp11.env and sp11-modem.env, and the font's build helper of scripts/. Source0: %{name}-%{version}.tar.gz # linux-firmware's Surface Pro 11 topology, for a system whose qcom-firmware predates it. Source1: %{audio_topology} # The GRUB console font is built from DejaVu Sans Mono; the topology is packed as linux-firmware's package packs it. BuildRequires: grub2-tools-extra BuildRequires: dejavu-sans-mono-fonts BuildRequires: python3 BuildRequires: xz Requires: bluez Requires: alsa-ucm # sp11-wifi-board copies the Wi-Fi board file out of this package's board-2.bin. Requires: atheros-firmware Requires: dracut # The dracut policy in 90-sp11.conf installs this package's Adreno microcode into the initramfs. Requires: qcom-firmware # The DSP firmware: sp11-firmware-extract.service runs Fedora's tool, which copies it from the Windows partition. A # weak dependency, as rpm alone (the pipeline's checks, the live root) installs no package from a repository. Recommends: qcom-firmware-extract Requires: systemd Requires: systemd-udev Requires: grub2-tools-minimal Requires: grub2-tools Requires: grub2-efi-aa64-modules Requires: util-linux Requires: kmod Requires: iproute # sp11-secureboot-theme, which draws the menu shown while Secure Boot is on, is Python; so is the GNSS feed of # sp11-surface-modem. Requires: python3 %description Device support for Microsoft Surface Pro 11 (X1E80100, OLED), the same package for every SKU; the model with 5G takes sp11-surface-modem as well: a unit that runs Fedora's qcom-firmware-extract, which copies the DSP firmware from Windows, and links that give that firmware the names the Denali device tree requests, an ALSA UCM profile (alsa-ucm-conf's, with the amplifier gain held at mainline's limit) for Fedora's AudioReach topology and that topology for a system whose qcom-firmware predates it, a correction filter for the speakers that PipeWire runs in their sink, a udev rule that holds the LPASS clock votes of the speakers' bus, WCN7850 Wi-Fi board data, Wi-Fi address rule, Bluetooth public-address service, kernel-install boot policy plugin (Denali DTB, GRUB resolution, kernel arguments), dracut policy, scmi-cpufreq loading, a GRUB menu entry that chainloads the Windows Boot Manager, the tool, kernel-install plugin and GRUB block that start a kernel's signed boot image while Secure Boot is on (the sp11-kernel-secureboot packages carry the images), a dnf repository override that keeps Fedora's stock kernel packages (which lack the SP11 patch set) off the system and lets the SP11 kernel's Copr projects offer theirs, and the first-boot finalizer. Inputs: 5d2d71717c422ed34a55e9c5318fc254905ed469e9a2b63fb00a0d0d2ec0e938 %package -n sp11-surface-modem # The model with 5G: its files are no part of the package every SKU takes (up to 4.4 step 30 built one package per # SKU under one name). The name stays clear of sp11-surface-support-*, which the pipeline's lookups match. Summary: Surface Pro 11 with 5G: the modem's device tree, ModemManager policy and GNSS feed License: GPL-3.0-or-later AutoReqProv: no # Installing this package brings sp11-surface-support along, and an upgrade moves both. Requires: sp11-surface-support = %{version}-%{release} # GeoClue reads the GNSS feed, semodule loads the feed's policy module. Requires: geoclue2 Requires: policycoreutils %description -n sp11-surface-modem For the Microsoft Surface Pro 11 with 5G only: the file that makes sp11-surface-support select the device tree with the modem, a udev rule that keeps the modem's QMI port from ModemManager, a GNSS feed that passes the modem's positions to GeoClue, and a drop-in that makes ModemManager keep the modem across a system sleep. Installing it installs sp11-surface-support as well. %prep %setup -q %build # The GRUB console font: gfxterm draws with a fixed-size PF2, and Fedora's stock unicode.pf2 (8x16 ASCII cell) is # unreadable on the 2880x1920 panel. gfxterm's cell is as high as the font's tallest glyph, with the baseline at # the font's ascent; grub2-mkfont takes ascent and descent from the whole face's extremes, which puts the baseline # below the cell's line box. The first run yields the cell, the second is built with the ascent and descent that # fit it; the check refuses a font whose menu glyphs leave the cell. DejaVu is Bitstream-Vera licensed: a derived # font must not carry "Bitstream" or "Vera" in its name. ttf=/usr/share/fonts/dejavu-sans-mono-fonts/DejaVuSansMono.ttf grub2-mkfont -s %{grub_font_size} -n "%{grub_font_name}" -o font-probe.pf2 $ttf metrics=$(python3 -I grub-font-cell.py metrics font-probe.pf2) set -- $metrics grub2-mkfont -s %{grub_font_size} -n "%{grub_font_name}" --asce "$1" --desc "$2" -o %{grub_font_file} $ttf python3 -I grub-font-cell.py check %{grub_font_file} # xz as Fedora's linux-firmware packs it (the kernel's decompressor takes CRC32 only), which gives the package's # file byte for byte. xz --check=crc32 -c %{SOURCE1} > %{audio_topology}.xz %install R=%{buildroot} # Qualcomm platform firmware: Fedora's qcom-firmware-extract copies it from the Windows partition into # /usr/lib/firmware/updates/qcom/x1e80100/microsoft/Denali/, xz-compressed under Windows' names. The Denali tree # requests the DSPs' device-tree images as adsp_dtb.mbn and cdsp_dtb.mbn, so two links give them those names. A # unit runs the tool at a start while the firmware is missing. install -d $R/usr/lib/firmware/updates/qcom/x1e80100/microsoft/Denali $R/usr/lib/systemd/system/multi-user.target.wants ln -s adsp_dtbs.elf.xz $R/usr/lib/firmware/updates/qcom/x1e80100/microsoft/Denali/adsp_dtb.mbn.xz ln -s cdsp_dtbs.elf.xz $R/usr/lib/firmware/updates/qcom/x1e80100/microsoft/Denali/cdsp_dtb.mbn.xz install -m 0644 sp11-firmware-extract.service $R/usr/lib/systemd/system/sp11-firmware-extract.service ln -s ../sp11-firmware-extract.service $R/usr/lib/systemd/system/multi-user.target.wants/sp11-firmware-extract.service # Audio: upstream's Surface Pro 11 UCM profile for Fedora's topology, with the amplifier gain held at mainline's # limit (Fedora's topology has no speaker protection, the SP11 kernel no limit), the matcher that selects it, and # the topology itself (sp11-ucm-apply; docs/hardware.md, Audio); the speakers' correction filter, which PipeWire # runs inside their sink; the rule that holds the LPASS core clock votes of the speakers' SoundWire bus. for f in SP11 SP11-HiFi SP11-SpeakerSeq SP11-DefaultEnableSeq; do install -D -m 0644 sp11-ucm-$f.conf $R/usr/share/alsa/ucm2/Qualcomm/x1e80100/$f.conf done install -D -m 0644 sp11-ucm-matcher.conf $R/usr/share/sp11/ucm/x1e80100.conf install -D -m 0644 %{audio_topology}.xz $R/usr/share/sp11/audio/%{audio_topology}.xz install -D -m 0644 sp11-wireplumber-speakers.conf $R/usr/share/wireplumber/wireplumber.conf.d/51-sp11-speakers.conf install -D -m 0644 78-sp11-speakers.rules $R/usr/lib/udev/rules.d/78-sp11-speakers.rules # Wi-Fi: the helper that writes the board file on the device from Fedora's board-2.bin, which has no entry for # this device (the trigger below runs it; up to 4.6 the package shipped the file; docs/hardware.md, Wi-Fi), and # the interface's address: the chip reports a placeholder that changes at every start, and udev gives the # interface the address the firmware holds (docs/hardware.md, Wi-Fi address). install -D -m 0755 sp11-wifi-board $R/usr/libexec/sp11/sp11-wifi-board install -m 0755 sp11-wifi-apply $R/usr/libexec/sp11/sp11-wifi-apply install -D -m 0644 99-sp11-wifi-address.rules $R/usr/lib/udev/rules.d/99-sp11-wifi-address.rules # Bluetooth public address: the helper that sends the kernel's management command once the controller's setup has # ended, and the udev-triggered service that calls it with the address (docs/hardware.md, Bluetooth address). install -m 0755 sp11-bt-set-addr sp11-bt-apply $R/usr/libexec/sp11/ install -D -m 0644 sp11-bluetooth-address@.service $R/usr/lib/systemd/system/sp11-bluetooth-address@.service install -D -m 0644 99-sp11-bluetooth-address.rules $R/usr/lib/udev/rules.d/99-sp11-bluetooth-address.rules install -D -m 0644 %{grub_font_file} $R/usr/share/sp11/fonts/%{grub_font_file} # Boot policy: kernel-install plugin, first-boot finalizer, dracut policy, UCM apply helper. Fedora's stock kernels # lack the SP11 patch set: no configured repository may offer them (local SP11 kernel RPMs stay installable, which # a global excludepkgs would block too), but for the SP11 kernel's own Copr projects (3.24). Anaconda's BTRFS # bootloader fix rewrites /etc/default/grub and every boot entry's options after the kernel-install plugin has # run; the first boot puts the policy back. install -m 0755 sp11-ucm-apply sp11-grub-modules sp11-grub-defaults sp11-first-boot sp11-bt-import-pairings sp11-diag \ $R/usr/libexec/sp11/ install -D -m 0644 90-sp11-kernel.repo $R/usr/share/dnf5/repos.override.d/90-sp11-kernel.repo install -D -m 0644 91-sp11-kernel-copr.repo $R/usr/share/dnf5/repos.override.d/91-sp11-kernel-copr.repo install -D -m 0755 29_sp11_windows $R/etc/grub.d/29_sp11_windows install -m 0644 sp11-first-boot.service $R/usr/lib/systemd/system/sp11-first-boot.service ln -s ../sp11-first-boot.service $R/usr/lib/systemd/system/multi-user.target.wants/sp11-first-boot.service install -D -m 0755 15-sp11-surface.install $R/usr/lib/kernel/install.d/15-sp11-surface.install # Secure Boot (docs/secure-boot.md): the tool that keeps the signed boot images' copies on the ESP and their GRUB # entries, the tool that draws the menu shown then, the kernel-install plugin and the unit that run the first, and # the generator whose block makes grub.cfg read those entries while Secure Boot is on. Without a signed boot image # (scripts/25-build-secureboot-rpms.sh) none of it does anything; with Secure Boot off the menu is Fedora's. install -m 0755 sp11-secureboot sp11-secureboot-theme $R/usr/libexec/sp11/ install -D -m 0755 96-sp11-secureboot.install $R/usr/lib/kernel/install.d/96-sp11-secureboot.install install -D -m 0755 09_sp11_secureboot $R/etc/grub.d/09_sp11_secureboot install -m 0644 sp11-secureboot.service $R/usr/lib/systemd/system/sp11-secureboot.service ln -s ../sp11-secureboot.service $R/usr/lib/systemd/system/multi-user.target.wants/sp11-secureboot.service install -D -m 0644 sp11-tpm2-setup-early.conf $R/usr/lib/systemd/system/systemd-tpm2-setup-early.service.d/sp11-initrd-only.conf install -D -m 0644 sp11-pcrphase-shutdown.conf $R/usr/lib/systemd/system/systemd-pcrphase.service.d/sp11-shutdown-measurement.conf install -D -m 0644 sp11-pcrphase-final.conf $R/usr/lib/systemd/system/systemd-pcrphase-sysinit.service.d/sp11-final-measurement.conf install -D -m 0644 90-sp11.conf $R/usr/lib/dracut/dracut.conf.d/90-sp11.conf install -D -m 0644 sp11-scmi-cpufreq.conf $R/usr/lib/modules-load.d/sp11-scmi-cpufreq.conf install -D -m 0644 sp11.env $R/etc/sp11/sp11.env # The modem of the model with 5G, the files of sp11-surface-modem (docs/modem.md): the file that selects the device # tree with the modem (sp11-grub-defaults reads it after sp11.env); ModemManager kept off the modem's QMI port, # which never answers (a request queued there blocks suspend; ModemManager's probe of it costs 45 s at start and at # shutdown), and the GNSS feed for GeoClue: the service, its socket (started by the rule when the modem appears), # the sleep hook, GeoClue's drop-in and the policy module that runs the feed in its own domain and lets GeoClue # connect to it; and ModemManager's quick suspend/resume, which keeps the modem across a sleep (the kernel keeps # it powered from 7.2.11 revision 9). install -m 0644 sp11-modem.env $R/etc/sp11/sp11-modem.env install -D -m 0644 77-sp11-modem.rules $R/usr/lib/udev/rules.d/77-sp11-modem.rules install -m 0755 sp11-gnss $R/usr/libexec/sp11/sp11-gnss install -m 0644 sp11-gnss.socket sp11-gnss.service $R/usr/lib/systemd/system/ install -D -m 0755 sp11-gnss-sleep $R/usr/lib/systemd/system-sleep/sp11-gnss install -D -m 0644 sp11-gnss-geoclue.conf $R/etc/geoclue/conf.d/90-sp11-gnss.conf install -D -m 0644 sp11-gnss.cil $R/usr/share/selinux/packages/sp11-gnss.cil install -D -m 0644 sp11-quick-suspend-resume.conf $R/usr/lib/systemd/system/ModemManager.service.d/sp11-quick-suspend-resume.conf %check # `bash -n A B C` parses only A (B and C become positional parameters): every script on its own. for f in 15-sp11-surface.install 96-sp11-secureboot.install sp11-first-boot sp11-grub-modules sp11-grub-defaults \ sp11-bt-import-pairings sp11-diag sp11-bt-apply sp11-wifi-apply sp11-ucm-apply sp11-secureboot sp11-gnss-sleep; do bash -n $f done for f in 29_sp11_windows 09_sp11_secureboot; do sh -n $f done for f in sp11-bt-set-addr sp11-secureboot-theme sp11-gnss sp11-wifi-board; do python3 -I -c 'import ast, sys; ast.parse(open(sys.argv[1]).read())' $f done grep -qF 'Regex "%{ucm_regex}"' sp11-ucm-matcher.conf # The GNSS feed's policy module (sp11-gnss.cil): the feed's own domain and GeoClue's access to its socket. rpm # labels the feed before the module is loaded, so it is relabelled here. The socket takes the feed's domain when it # starts listening, so it is restarted, but only while the feed is not running: the restart would close GeoClue's # connection, which GeoClue 2.8 does not survive (docs/gnss.md); a feed running now has its new socket after a boot. %post -n sp11-surface-modem if [ -d /etc/selinux/targeted ] && [ -x /usr/sbin/semodule ]; then /usr/sbin/semodule -i /usr/share/selinux/packages/sp11-gnss.cil >/dev/null 2>&1 || : /usr/sbin/restorecon /usr/libexec/sp11/sp11-gnss >/dev/null 2>&1 || : fi systemctl -q is-active sp11-gnss.service 2>/dev/null || systemctl try-restart sp11-gnss.socket >/dev/null 2>&1 || : %posttrans -n sp11-surface-modem # The device tree with the modem (sp11-modem.env): into /etc/default/grub and the boot entries of the kernels # already installed, on an installed system only, as sp11-surface-support applies its policy. if [ -f /boot/grub2/grub.cfg ]; then /usr/libexec/sp11/sp11-grub-defaults || : fi %postun -n sp11-surface-modem # After an upgrade or a downgrade rpm labelled the other version's feed with this module's contexts. An older # module lacks the feed's types (3.22's does): after a downgrade to 3.22 the feed read as unlabeled_t. Relabel the # feed and restart its socket as after an install. On erase the module goes, and with sp11-modem.env gone the # system returns to the device tree without the modem. if [ $1 -eq 0 ]; then [ -x /usr/sbin/semodule ] && /usr/sbin/semodule -r sp11-gnss >/dev/null 2>&1 || : if [ -f /boot/grub2/grub.cfg ] && [ -x /usr/libexec/sp11/sp11-grub-defaults ]; then /usr/libexec/sp11/sp11-grub-defaults || : fi else [ -x /usr/sbin/restorecon ] && /usr/sbin/restorecon /usr/libexec/sp11/sp11-gnss >/dev/null 2>&1 || : systemctl -q is-active sp11-gnss.service 2>/dev/null \ || systemctl try-restart sp11-gnss.socket >/dev/null 2>&1 || : fi # systemd's RPM file triggers reload units and udev rules; both triggers below also # run when this package is installed while their target is present. %posttrans # Apply the /etc/default/grub policy and regenerate the GRUB menu on an installed system (the live root has # no grub.cfg), so an upgrade that changes the policy takes effect without a reboot. Without the helper an # upgrade would regenerate the menu from the previous policy: on an installed system nothing else runs it # (the kernel-install plugin only on a kernel install, sp11-first-boot only once). if [ -f /boot/grub2/grub.cfg ]; then /usr/libexec/sp11/sp11-grub-defaults || : /usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg >/dev/null 2>&1 || : fi # The signed boot images' copies on the ESP and their GRUB entries, after the menu: grub2-mkconfig rewrites the # options of every boot entry, and the signed entries take theirs from there. Nothing to do, and nothing done, # without an sp11-kernel-secureboot package. /usr/libexec/sp11/sp11-secureboot sync >/dev/null 2>&1 || : # The DSP firmware comes from Fedora's qcom-firmware-extract, which copies it from the Windows partition. Without it # the DSPs (audio, battery, USB-C data) stay off once an initramfs is built. if [ ! -e /usr/lib/firmware/updates/qcom/x1e80100/microsoft/Denali/qcadsp8380.mbn.xz ]; then echo "sp11-surface-support: no DSP firmware yet; sp11-firmware-extract.service copies it from Windows at the next start" >&2 fi # The model with 5G (the firmware's SKU, as SP11_SKU_5G_REGEX of sp11.conf reads it) takes sp11-surface-modem. if [ ! -e /etc/sp11/sp11-modem.env ]; then case "$(cat /sys/class/dmi/id/product_sku 2>/dev/null)" in Surface_Pro_with_5G_11th_Edition*) echo "sp11-surface-support: this is the model with 5G; 'dnf install sp11-surface-modem' sets up its modem" >&2 ;; esac # Up to 4.4 the package built for the 5G SKU carried the modem's files and loaded their policy module. They are # sp11-surface-modem's now; without that package the module goes. if [ -x /usr/sbin/semodule ] && /usr/sbin/semodule -l 2>/dev/null | grep -qx sp11-gnss; then /usr/sbin/semodule -r sp11-gnss >/dev/null 2>&1 || : fi fi # On erase the copies on the ESP and the entries file go with the tool that keeps them. %preun if [ $1 -eq 0 ]; then /usr/libexec/sp11/sp11-secureboot remove >/dev/null 2>&1 || : fi %triggerin -- alsa-ucm /usr/libexec/sp11/sp11-ucm-apply || : %triggerin -- grub2-efi-aa64-modules /usr/libexec/sp11/sp11-grub-modules || : # The Wi-Fi board file, when this package or Fedora's firmware package is installed or updated. %triggerin -- atheros-firmware /usr/libexec/sp11/sp11-wifi-board || : %files %defattr(-,root,root,-) /usr/lib/firmware/updates/qcom/x1e80100/microsoft/Denali/adsp_dtb.mbn.xz /usr/lib/firmware/updates/qcom/x1e80100/microsoft/Denali/cdsp_dtb.mbn.xz # Written by sp11-wifi-board: kept across an upgrade, removed with the package, its content not verified. %ghost %attr(0644,root,root) /usr/lib/firmware/ath12k/WCN7850/hw2.0/board.bin /usr/share/alsa/ucm2/Qualcomm/x1e80100/SP11.conf /usr/share/alsa/ucm2/Qualcomm/x1e80100/SP11-HiFi.conf /usr/share/alsa/ucm2/Qualcomm/x1e80100/SP11-SpeakerSeq.conf /usr/share/alsa/ucm2/Qualcomm/x1e80100/SP11-DefaultEnableSeq.conf /usr/share/wireplumber/wireplumber.conf.d/51-sp11-speakers.conf /usr/share/sp11/ /usr/libexec/sp11/ %exclude /usr/libexec/sp11/sp11-gnss /usr/lib/systemd/system/sp11-bluetooth-address@.service /usr/lib/systemd/system/sp11-first-boot.service /usr/lib/systemd/system/multi-user.target.wants/sp11-first-boot.service /usr/lib/systemd/system/sp11-firmware-extract.service /usr/lib/systemd/system/multi-user.target.wants/sp11-firmware-extract.service /usr/lib/systemd/system/sp11-secureboot.service /usr/lib/systemd/system/multi-user.target.wants/sp11-secureboot.service %dir /usr/lib/systemd/system/systemd-tpm2-setup-early.service.d /usr/lib/systemd/system/systemd-tpm2-setup-early.service.d/sp11-initrd-only.conf %dir /usr/lib/systemd/system/systemd-pcrphase.service.d /usr/lib/systemd/system/systemd-pcrphase.service.d/sp11-shutdown-measurement.conf %dir /usr/lib/systemd/system/systemd-pcrphase-sysinit.service.d /usr/lib/systemd/system/systemd-pcrphase-sysinit.service.d/sp11-final-measurement.conf /usr/lib/udev/rules.d/99-sp11-bluetooth-address.rules /usr/lib/udev/rules.d/99-sp11-wifi-address.rules /usr/lib/udev/rules.d/78-sp11-speakers.rules /usr/lib/kernel/install.d/15-sp11-surface.install /usr/lib/kernel/install.d/96-sp11-secureboot.install /etc/grub.d/29_sp11_windows /etc/grub.d/09_sp11_secureboot /usr/lib/dracut/dracut.conf.d/90-sp11.conf /usr/lib/modules-load.d/sp11-scmi-cpufreq.conf /usr/share/dnf5/repos.override.d/90-sp11-kernel.repo /usr/share/dnf5/repos.override.d/91-sp11-kernel-copr.repo %dir /etc/sp11 /etc/sp11/sp11.env %files -n sp11-surface-modem %defattr(-,root,root,-) /etc/sp11/sp11-modem.env /usr/lib/udev/rules.d/77-sp11-modem.rules /usr/libexec/sp11/sp11-gnss /usr/lib/systemd/system/sp11-gnss.socket /usr/lib/systemd/system/sp11-gnss.service /usr/lib/systemd/system-sleep/sp11-gnss /etc/geoclue/conf.d/90-sp11-gnss.conf /usr/share/selinux/packages/sp11-gnss.cil %dir /usr/lib/systemd/system/ModemManager.service.d /usr/lib/systemd/system/ModemManager.service.d/sp11-quick-suspend-resume.conf %changelog * Sun Sep 13 2026 SP11 build - 4.7-1 - Surface Pro 11 support payload