aboutsummaryrefslogtreecommitdiffci
path: root/config.sh
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'config.sh')
-rwxr-xr-xconfig.sh107
1 files changed, 82 insertions, 25 deletions
diff --git a/config.sh b/config.sh
index 690cb48..f232f48 100755
--- a/config.sh
+++ b/config.sh
@@ -436,10 +436,13 @@ fi
# Surface Pro 12" customizations
#--------------------------------------
+install -Dm644 /tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/yum.repos.d/kernel-sp12in.repo \
+ /etc/yum.repos.d/kernel-sp12in.repo
+
# Device tree. kernel-surface compiles the patched dts in-tree and installs the
-# result twice: into its own module tree (dtb/qcom, from dtbs_install) and
-# version-independently into /usr/lib/surface-dtb. The latter is the master copy
-# 60-surface-dtb.install re-stages into each new kernel's module tree on update,
+# result twice: into its own module tree (dtb/qcom, from dtbs_install) and into
+# /usr/lib/surface-dtb/<kver>/. The latter is the master copy
+# 60-surface-dtb.install re-stages into a kernel that shipped without one,
# which is the only reason the image no longer carries a prebuilt blob of its
# own -- the description installs kernel-surface by name and <ignore>s Fedora's
# kernel packages, so the package is always there.
@@ -453,9 +456,12 @@ fi
# module-tree copy, anything keyed off /usr/lib/modules/$kver/dtb (including the
# anaconda post-script) finds nothing and silently does nothing.
dtb_name=x1p42100-microsoft-sp12in.dtb
-dtb_src="/usr/lib/surface-dtb/$dtb_name"
-if [[ ! -f "$dtb_src" ]]; then
- printf 'Error: %s is missing, so kernel-surface (built from ../kernel-surface) is not installed.\n' "$dtb_src" >&2
+# One directory per kernel version under /usr/lib/surface-dtb: kernel-surface is
+# installonly, so nothing it owns can be version-unqualified. Only one release is
+# ever installed at this point in the build, but glob anyway rather than assume.
+dtb_src=$(ls -1 /usr/lib/surface-dtb/*/"$dtb_name" 2>/dev/null | sort -V | tail -n1)
+if [[ -z "$dtb_src" ]]; then
+ printf 'Error: no %s under /usr/lib/surface-dtb/, so kernel-surface (built from ../kernel-surface) is not installed.\n' "$dtb_name" >&2
exit 1
fi
install -Dm644 "$dtb_src" "/usr/lib/modules/$kver/dtb/qcom/$dtb_name"
@@ -638,33 +644,84 @@ install -Dm644 /tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/systemd/system
# hexagonrpc.service in through the drop-in above.
systemctl enable hexagonrpc.service
-# Rear camera pipeline (msm/camss) needs /dev/media0, which only exists once the
-# real silicon probes on the booted system -- install the wiring but do not run
-# it here, there is no camera hardware in the KIWI build chroot.
+# Fedora's SELinux policy has no qipcrtr_socket permissions for
+# iiosensorproxy_t; the libssc backend needs them to probe the QRTR bus, and
+# without them the daemon exits with "No sensors or missing kernel drivers".
+# Compile and install the local module that grants them (see the .te for
+# details). checkmodule/semodule_package come from checkpolicy; it stays
+# installed because removing it takes policycoreutils-python-utils
+# (semanage, audit2allow) with it.
+dnf install -y checkpolicy
+install -Dm644 /tmp/SayaAndy/surface-pro-12-inch-linux-fedora/usr/local/share/selinux/iio-qipcrtr.te \
+ /usr/local/share/selinux/iio-qipcrtr.te
+checkmodule -M -m -o /usr/local/share/selinux/iio-qipcrtr.mod \
+ /usr/local/share/selinux/iio-qipcrtr.te
+semodule_package -o /usr/local/share/selinux/iio-qipcrtr.pp \
+ -m /usr/local/share/selinux/iio-qipcrtr.mod
+semodule -i /usr/local/share/selinux/iio-qipcrtr.pp
+
+# Cameras (msm/camss). Nothing has to be wired up at boot. libcamera's "simple"
+# pipeline handler claims qcom-camss and builds the media graph itself in
+# configure(), including flipping the csiphy -> msm_csid0 link between the rear
+# ov13858 and the front ov02c10, so a media-ctl unit only fights it: pinning
+# csid0 to the rear sensor at boot leaves the front camera disconnected until
+# something re-links it, and the formats such a unit has to guess are what made
+# the old wireupcameras.service die with "Unable to setup formats: Invalid
+# argument (22)" on every boot.
+#
+# v4l-utils stays, for inspecting the graph by hand -- media-ctl -p, and
+# v4l2-ctl --stream-mmap on the RDI node to check the sensor below libcamera.
dnf install -y v4l-utils
-install -Dm755 /tmp/SayaAndy/surface-pro-12-inch-linux-fedora/usr/local/bin/wireupcameras.sh \
- /usr/local/bin/wireupcameras.sh
-install -Dm644 /tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/systemd/system/wireupcameras.service \
- /etc/systemd/system/wireupcameras.service
-systemctl enable wireupcameras.service
-# Suspend on Snapdragon is still very unstable. This is the reason why
-# 'mem_sleep_default=s2idle' is set explicitly in the cmdline as 'deep' mode
-# does not function at all.
-# Even then, suspending via gnome settings daemon results in hard freeze.
-# This is why:
-# logind behavior is kept intact with suspend behavior.
-# gnome default power button behavior was replaced with 'interactive'.
+# The front ov02c10 needs a libcamera that knows its analogue gain model and
+# black level; upstream libcamera has neither, and there is no plugin mechanism
+# for them, but kernel-sp12in repo offers libcamera with supported models.
+# Pulled in by name because it would otherwise only arrive as a dependency,
+# which makes it easy to lose without noticing.
+dnf install -y libcamera libcamera-ipa
+
+libcamera_nevra=$(rpm -q libcamera)
+case "${libcamera_nevra}" in
+ *.sp12in*) printf 'Using %s\n' "${libcamera_nevra}" ;;
+ *)
+ printf 'Error: %s is Fedora'"'"'s libcamera, not the sp12in rebuild.\n' \
+ "${libcamera_nevra}" >&2
+ printf 'Fedora has probably bumped the release past the rebuild; rebase\n' >&2
+ printf 'patches/ in ../libcamera and tag a new release suffix.\n' >&2
+ exit 1
+ ;;
+esac
+
+# Hardware video decode needs firmware this image is not allowed to carry. The
+# qcom/vpu/vpu30_p1_s7.mbn in linux-firmware is the same codec signed with
+# Qualcomm's SecTools test keys, which a retail Surface's TrustZone rejects, and
+# the production-signed build exists only inside Microsoft's Surface driver
+# package, under terms that grant no redistribution right.
+#
+# So the image ships the means rather than the blob: a script that copies it out
+# of a Windows install the owner already has a licence for, and a unit that runs
+# that once on a dual-boot machine. Where Windows is gone, the script says which
+# driver pack to download and how to point it at one.
+dnf install -y msitools
+install -Dm755 /tmp/SayaAndy/surface-pro-12-inch-linux-fedora/usr/local/bin/surface-video-firmware.sh \
+ /usr/local/bin/surface-video-firmware.sh
+install -Dm644 /tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/systemd/system/surface-video-firmware.service \
+ /etc/systemd/system/surface-video-firmware.service
+systemctl enable surface-video-firmware.service
+
install -Dm644 /tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/systemd/logind.conf.d/60-surface-power-key.conf \
- /etc/systemd/login.conf.d/60-surface-power-key.conf
-install -Dm644 /tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/dconf/db/local.d/00-power-button \
- /etc/dconf/db/local.d/00-power-button
+ /etc/systemd/logind.conf.d/60-surface-power-key.conf
+
+# Ambient light sensor seems to go nuts after I fixed iio-sensor-proxy. Turning
+# it off for now.
+install -Dm644 /tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/dconf/db/local.d/00-als \
+ /etc/dconf/db/local.d/00-als
install -Dm644 /tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/dconf/profile/user \
/etc/dconf/profile/user
dconf update
-restorecon -Rv /usr /lib /etc/systemd /etc/dconf /etc/udev/rules.d
+restorecon -Rv /usr /lib /etc/systemd /etc/dconf /etc/udev/rules.d /etc/yum.repos.d
#======================================
# Set the WSL name for ELN