10 files changed, 46 insertions, 10 deletions
@@ -1,6 +1,8 @@ # Fedora KIWI image descriptions, modified to build & launch for Surface Pro 12" Gen 1 + + It is the fork of the original [KIWI image descriptions](https://forge.fedoraproject.org/releng/kiwi-descriptions), modified for launching Fedora Linux Rawhide Live ISO on Surface Pro 12" Gen 1 (and further installing it on the device). I bought this device as I viewed it as a great Linux GNOME tablet, but after several days, many hours of work of trying to do so, I must say that installing a distribution here (and then having it work fine) is a huge pain in the ass. @@ -24,18 +26,19 @@ To build this on Fedora Linux: []$ sudo dnf --assumeyes install kiwi kiwi-systemdeps distribution-gpg-keys # Run the image build []$ sudo ./kiwi-build --kiwi-file=Fedora.kiwi --image-type=<image_type> --image-profile=<image_profile> --output-dir ./outdir -# An example for Workstation Live CD ISO +# An example for Workstation Live CD ISO, takes around 16 minutes []$ sudo ./kiwi-build --kiwi-file=Fedora.kiwi --image-type=iso --image-profile=Workstation-Live --output-dir ./outdir ``` ## What is left out (for now) -* Live CD has to run in RAM, so `rd.live.ram=1` is set for cmdline. Otherwise, at least on my ancient flash drive, it fails to load multiple necessary services, including `polkit`. +* Live CD has to run in RAM, so `rd.live.ram=1` is set for cmdline. Otherwise, at least on my ancient flash drive, it fails to load multiple necessary services, including `polkit`. So, ~5 minutes of loading on USB 2 drive, while screen is not backlit, is to be expected. * No rescue vmlinuz. * No secure boot possible for this ISO for now, as the platform used is `efi` and not `uefi`. -* No GRUB auto hidden menu. Trying to have the menu hidden results in system leads to restart after trying to boot it. +* No GRUB auto hidden menu. Trying to have the menu hidden results in system restarting after trying to boot it. * `wireupcameras.service` (which enables tablet's cameras to be used) fails on installed system (not in Live CD though), as no `/dev/media*` gets initialized. -* No hardware video decoding for now, as the iris video codec (`qcvss8380_pa.mbn`) is Windows-only (as far as I researched), but you can copy one to `/lib/firmware/qcom/x1p42100/Microsoft/Surface12/`, if you have Windows ARM64 partition. +* No hardware video encoding/decoding for now, as the iris video codec (`qcvss8380_pa.mbn`) is Windows-only (as far as I researched), but you can copy one from `/path/to/mounted/windows/drive/Windows/System32/DriverStore/FileRepository/qcdx8380.inf_arm64_*/qcvss8380_pa.mbn` to `/lib/firmware/qcom/x1p42100/Microsoft/Surface12/`, if you keep Windows ARM64 partition. +* Suspend on Snapdragon X is still very unstable. No deep sleep is available, so `mem_sleep_default=s2idle` was set. Even that leads to compromises as suspending via GNOME results in hard freeze, so the default power button behavior was changed to `interactive` and should not be changed back to `suspend`. ## Image variants diff --git a/components/liveinstall.xml b/components/liveinstall.xml index 55ae4eb..c04ca7f 100644 --- a/components/liveinstall.xml +++ b/components/liveinstall.xml @@ -10,7 +10,7 @@ publisher="Fedora Project" volid="Fedora_Linux" application_id="Fedora_Linux" primary="true" flags="dmsquash" filesystem="erofs" erofscompression="lzma,level=6" mediacheck="true" firmware="efi" efiparttable="gpt" efifatimagesize="30" - kernelcmdline="quiet rhgb clk_ignore_unused pd_ignore_unused systemd.tpm2_wait=0 rd.live.ram=1" + kernelcmdline="quiet rhgb mem_sleep_default=s2idle clk_ignore_unused pd_ignore_unused systemd.tpm2_wait=0 rd.live.ram=1" fscreateoptions="-Efragments -C 1048576" > <bootloader name="grub2" grub_template="grub-arm.cfg.iso-template" console="console" timeout="10"/> @@ -620,7 +620,23 @@ install -Dm644 /tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/systemd/system /etc/systemd/system/wireupcameras.service systemctl enable wireupcameras.service -restorecon -Rv /usr /lib /etc/systemd/system /etc/udev/rules.d +# 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'. +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 +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 #====================================== # Set the WSL name for ELN diff --git a/docs/FedoraOnSurface.jpg b/docs/FedoraOnSurface.jpg Binary files differnew file mode 100644 index 0000000..6b37f3c --- /dev/null +++ b/docs/FedoraOnSurface.jpg diff --git a/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/dconf/db/local.d/00-power-button b/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/dconf/db/local.d/00-power-button new file mode 100644 index 0000000..1b69eab --- /dev/null +++ b/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/dconf/db/local.d/00-power-button @@ -0,0 +1,2 @@ +[org/gnome/settings-daemon/plugins/power] +power-button-action='interactive' diff --git a/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/dconf/profile/user b/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/dconf/profile/user new file mode 100644 index 0000000..aca0641 --- /dev/null +++ b/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/dconf/profile/user @@ -0,0 +1,2 @@ +user-db:user +system-db:local diff --git a/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/kernel/cmdline b/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/kernel/cmdline index 9479627..5b92d02 100644 --- a/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/kernel/cmdline +++ b/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/kernel/cmdline @@ -1 +1 @@ -rootflags=subvol=root clk_ignore_unused pd_ignore_unused systemd.tpm2_wait=0 rhgb quiet +rootflags=subvol=root mem_sleep_default=s2idle clk_ignore_unused pd_ignore_unused systemd.tpm2_wait=0 rhgb quiet diff --git a/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/systemd/logind.conf.d/60-surface-power-key.conf b/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/systemd/logind.conf.d/60-surface-power-key.conf new file mode 100644 index 0000000..c6fc547 --- /dev/null +++ b/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/systemd/logind.conf.d/60-surface-power-key.conf @@ -0,0 +1,2 @@ +HandlePowerKey=suspend +HandlePowerKeyLongPress=poweroff diff --git a/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/systemd/system/wireupcameras.service b/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/systemd/system/wireupcameras.service index 538d79a..31eff6c 100644 --- a/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/systemd/system/wireupcameras.service +++ b/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/etc/systemd/system/wireupcameras.service @@ -1,8 +1,5 @@ [Unit] Description=Wire up Surface Pro rear camera (media-ctl pipeline) -After=dev-media0.device -Wants=dev-media0.device -DefaultDependencies=no [Service] Type=oneshot diff --git a/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/usr/local/bin/wireupcameras.sh b/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/usr/local/bin/wireupcameras.sh index 2e8f2d3..833a422 100644 --- a/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/usr/local/bin/wireupcameras.sh +++ b/root/tmp/SayaAndy/surface-pro-12-inch-linux-fedora/usr/local/bin/wireupcameras.sh @@ -1,6 +1,20 @@ #!/bin/bash set -e +# Wait for /dev/media0 to appear (MSM VFE driver may need firmware to probe) +# Timeout after 10 seconds to avoid infinite hangs on systems without camera hardware +MAX_WAIT=10 +WAIT_COUNT=0 +while [ ! -e /dev/media0 ] && [ $WAIT_COUNT -lt $MAX_WAIT ]; do + sleep 1 + WAIT_COUNT=$((WAIT_COUNT + 1)) +done + +if [ ! -e /dev/media0 ]; then + echo "wireupcameras: /dev/media0 not found after ${MAX_WAIT}s, skipping" >&2 + exit 0 +fi + SENSOR="ov13858 1-0010" # Tell each pad in the path what format to expect |