Make t1ny usable

t1ny is a Thinkpad X13s. It's the first aarch64 system I've attempted installing Arch on and it's proving to be a bit challenging.

Installation

Flash archlinuxarm-2022.09.11-aarch64.iso to USB media. When booting choose the "copy to RAM" boot option, because the other one won't work. This might be the regression mentioned in the README.

Following My install process should work. Note that you may need to continually run grub-install until efivar shows a boot entry for it.

Booting

I had to manually modify grub.cfg to add the devicetree line, manually add the initrd directive that was somehow missed by grub-mkconfig, and add a bunch of kernel command line parameters:

menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-749e3a8b-0091-4389-9a95-9b18684ef6db' {
  load_video
  set gfxpayload=keep
  insmod gzio
  insmod part_gpt
  insmod ext2
  search --no-floppy --fs-uuid --set=root $bootVolUuid
  echo    'Loading devicetree ...'
  devicetree      /sc8280xp-lenovo-thinkpad-x13s.dtb
  echo    'Loading Linux Image ...'
  linux   /Image root=/dev/mapper/luke--t1ny-root rw efi=novamap pd_ignore_unused clk_ignore_unused loglevel=3 quiet
  echo    'Loading initial ramdisk ...'
  initrd  /initramfs-linux.img
}

To have grub-mkconfig generate a bootable configuration out of the box, we need to patch:

  • /usr/bin/grub-mkconfig to expose a new user-configurable GRUB_DEVICE_TREE variable.
  • /etc/grub.d/10_linux to correctly write out menu entries containing a devicetree.
  • /etc/default/grub to set GRUB_DEVICE_TREE.
diff --unified a/usr/bin/grub-mkconfig b/usr/bin/grub-mkconfig
--- a/usr/bin/grub-mkconfig 2022-10-08 01:48:28.000000000 +0100
+++ b/usr/bin/grub-mkconfig 2022-10-11 18:48:24.458687471 +0100
@@ -225,6 +225,7 @@
   GRUB_DISTRIBUTOR \
   GRUB_CMDLINE_LINUX \
   GRUB_CMDLINE_LINUX_DEFAULT \
+  GRUB_DEVICE_TREE \
   GRUB_CMDLINE_LINUX_RECOVERY \
   GRUB_CMDLINE_XEN \
   GRUB_CMDLINE_XEN_DEFAULT \
diff --unified a/etc/grub.d/10_linux b/etc/grub.d/10_linux
--- a/etc/grub.d/10_linux 2022-10-08 01:48:28.000000000 +0100
+++ b/etc/grub.d/10_linux 2022-10-11 18:48:04.631684177 +0100
@@ -146,6 +146,13 @@
     fi
     printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
   fi
+  if [ "x$GRUB_DEVICE_TREE" != "x" ]; then
+    message="$(gettext_printf "Loading device tree %s ..." ${GRUB_DEVICE_TREE})"
+    sed "s/^/$submenu_indentation/" << EOF
+    echo '$(echo "$message" | grub_quote)'
+    devicetree ${rel_dirname}/${GRUB_DEVICE_TREE}
+EOF
+  fi
   message="$(gettext_printf "Loading Linux %s ..." ${version})"
   sed "s/^/$submenu_indentation/" << EOF
   echo '$(echo "$message" | grub_quote)'
--- a/etc/default/grub 2022-10-11 19:06:49.019450952 +0100
+++ b/etc/default/grub 2022-10-10 12:18:18.037430205 +0100
@@ -3,9 +3,12 @@
 GRUB_DEFAULT=0
 GRUB_TIMEOUT=5
 GRUB_DISTRIBUTOR="Arch"
-GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet"
+GRUB_CMDLINE_LINUX_DEFAULT="efi=noruntime,novamap pd_ignore_unused clk_ignore_unused"
 GRUB_CMDLINE_LINUX=""

+# FIXME: very non-standard but I Don't see a better way
+GRUB_DEVICE_TREE=sc8280xp-lenovo-thinkpad-x13s.dtb
+
 # Preload both GPT and MBR modules so that they are not missed
 GRUB_PRELOAD_MODULES="part_gpt part_msdos"

Get $bootVolUuid with lsblk -o NAME,MOUNTPOINT,UUID.

Bubblewrap

Errors like the following because SECCOMP isn't enabled in the current linux-x13s kernels:

bwrap: prctl(PR_SET_SECCOMP): Invalid argument

Apply the following patch to the package and run makepkg:

diff --git a/linux-x13s/PKGBUILD b/linux-x13s/PKGBUILD
index 1229f42..58bc971 100644
--- a/linux-x13s/PKGBUILD
+++ b/linux-x13s/PKGBUILD
@@ -22,7 +22,7 @@ source=("https://github.com/steev/linux/archive/refs/tags/lenovo-x13s-6.0.0-rc6.
         '60-linux.hook'
         '90-linux.hook')
 md5sums=('0aed18ba0e17901d995b45c19c166251'
-         'abcf226d29db62cadce342bd4dc5b974'
+         '327b438643b89438ea519889540f4487'
          '61c5ff73c136ed07a7aadbf58db3d96a'
          '584777ae88bce2c5659960151b64c7d8'
          '41cb5fef62715ead2dd109dbea8413d6'
diff --git a/linux-x13s/config b/linux-x13s/config
index b0c8d0d..e66ada2 100644
--- a/linux-x13s/config
+++ b/linux-x13s/config
@@ -761,7 +761,8 @@ CONFIG_HAVE_CMPXCHG_DOUBLE=y
 CONFIG_ARCH_WANT_COMPAT_IPC_PARSE_VERSION=y
 CONFIG_HAVE_ARCH_SECCOMP=y
 CONFIG_HAVE_ARCH_SECCOMP_FILTER=y
-# CONFIG_SECCOMP is not set
+CONFIG_SECCOMP=y
+CONFIG_SECCOMP_CACHE_DEBUG=n
 CONFIG_HAVE_ARCH_STACKLEAK=y
 CONFIG_HAVE_STACKPROTECTOR=y
 CONFIG_STACKPROTECTOR=y
@@ -2778,7 +2779,7 @@ CONFIG_MD_MULTIPATH=m
 CONFIG_MD_FAULTY=m
 CONFIG_MD_CLUSTER=m
 CONFIG_BCACHE=m
-# CONFIG_BCACHE_DEBUG is not set
+CONFIG_BCACHE_DEBUG=n
 # CONFIG_BCACHE_CLOSURES_DEBUG is not set
 # CONFIG_BCACHE_ASYNC_REGISTRATION is not set
 CONFIG_BLK_DEV_DM_BUILTIN=y

Backup the stock kernel, just in case:

sudo cp /boot/Image /boot/Image-stock
sudo cp /boot/Image.gz /boot/Image-stock.gz

Then install:

sudo pacman -U linux-x13s*-6.0rc6-0-aarch64.pkg.tar.xz

Bitwarden Desktop

The aarch64 build of Bitwarden Desktop is ancient and it's no longer possible to login with it.

JetBrains Toolbox

Available for Apple Silicon Macs (which are aarch64), but not available for Linux. Install IDEs via AUR instead:

  • Runtime: jre11-openjdk-11.0.16.1.u1-2 to provide java-runtime
    • Most apps still need their own patched runtimes.
  • AppCode: lol
  • CLion: clion clion-jre
  • DataGrip: datagrip datagrip-jre
  • GoLand: goland goland-jre
    • Needs aarch64 architecture marked as supported
  • IDEA: intellij-idea-ultimate-edition intellij-idea-ultimate-edition-jre
  • MPS: jetbrains-mps
    • Orphaned, out of date
  • PhpStorm: phpstorm phpstorm-jre
    • Needs aarch64 architecture marked as supported
  • Pycharm: pycharm-professional
    • pydevd extension doesn't build properly; missing -m64 option in GCC.
  • Rider: rider
    • Crashes without a patched runtime; maybe it's better to install the patched ones for each IDE?
  • RubyMine: rubymine
    • Fails to build because of missing JRE VM options file.
  • WebStorm: webstorm webstorm-jre

Hardware support

  • Audio
  • Bluetooth
  • EFI
    • Can be written to eventually, but it's very flakey.
  • GPU
  • Hardware clock
  • Webcam

Backlinks