diff options
author | Malte Voos <git@mal.tc> | 2025-02-17 23:56:27 +0100 |
---|---|---|
committer | Malte Voos <git@mal.tc> | 2025-02-17 23:56:27 +0100 |
commit | e1bbd03df6324936fb63e676f562e47e51b0a837 (patch) | |
tree | d8318f478b0a873f6442201a776c5e308fc290aa | |
parent | c3a8e89a4bfab3c64c94fc6df42e94b231be4bff (diff) | |
download | reMder-e1bbd03df6324936fb63e676f562e47e51b0a837.tar.gz reMder-e1bbd03df6324936fb63e676f562e47e51b0a837.zip |
foo
-rw-r--r-- | flake.lock | 8 | ||||
-rw-r--r-- | flake.nix | 2 | ||||
-rw-r--r-- | server.nix | 66 |
3 files changed, 32 insertions, 44 deletions
diff --git a/flake.lock b/flake.lock index e1d7304..019dbe7 100644 --- a/flake.lock +++ b/flake.lock @@ -20,16 +20,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1711748091, - "narHash": "sha256-JjGxrXJyQoQTYv/kCNyq+a6AKPctvlbsEFojoj2OKoo=", + "lastModified": 1739203112, + "narHash": "sha256-ZzJKCz8lnE4CZvIhlVGrC/1pIfjz1HimOAk3Pe4ev1Q=", "owner": "malte-v", "repo": "nixpkgs", - "rev": "ef137b1e9b6af4ee876ebfb9f89c7a85f6a105a1", + "rev": "784f0cc1d9bff0aea7d52771223f68082da8dbe4", "type": "github" }, "original": { "owner": "malte-v", - "ref": "libguestfs-appliance-fix", + "ref": "raspi3", "repo": "nixpkgs", "type": "github" } diff --git a/flake.nix b/flake.nix index 27a4a38..ef3a18c 100644 --- a/flake.nix +++ b/flake.nix @@ -1,6 +1,6 @@ { inputs = { - nixpkgs.url = "github:malte-v/nixpkgs/libguestfs-appliance-fix"; + nixpkgs.url = "github:malte-v/nixpkgs/raspi3"; flake-utils.url = "github:numtide/flake-utils"; }; outputs = { self, nixpkgs, flake-utils }: diff --git a/server.nix b/server.nix index 906e2c6..b0d4e61 100644 --- a/server.nix +++ b/server.nix @@ -1,13 +1,13 @@ -{ lib, fetchurl, writeText, libguestfs-with-appliance, pkgsCross, qemu +{ fetchurl, writeText, libguestfs-with-appliance, pkgsCross, qemu , runCommand, cpio, writeShellApplication, sshPassword, sshPort, httpPort }: let - updateName = "remarkable-ct-prototype-image-3.16.1.0-ferrari-public"; + updateName = "remarkable-production-memfault-image-3.14.1.9-rm2-public"; updateArchive = fetchurl { url = # TODO: this is not an official source. might be worth authenticating the updates "https://storage.googleapis.com/remarkable-versions/${updateName}.swu"; - hash = "sha256-cwx2qcvxZBX0wAprYKls8P+gthwJJQTceVIO+qdPm/w="; + hash = "sha256-8zlAGdv+w2KO7BruRQLQC9ivGSHtK82e36ASIeRF3zI="; }; xochitlConfig = writeText "xochitl.conf" '' @@ -36,24 +36,24 @@ let ExecStart=/usr/bin/xochitl --system Restart=always # required to make xochitl run - # Environment=LD_PRELOAD=/usr/lib/libfakefbdev.so # TODO uncomment? + Environment=LD_PRELOAD=/usr/lib/libfakefbdev.so [Install] WantedBy=multi-user.target ''; - fakefbdev = pkgsCross.aarch64-multiplatform.gcc11Stdenv.mkDerivation { + fakefbdev = pkgsCross.armv7l-hf-multiplatform.gcc11Stdenv.mkDerivation { name = "fakefbdev"; src = ./fakefbdev; installFlags = [ "DESTDIR=${placeholder "out"}" ]; }; - kernel = pkgsCross.aarch64-multiplatform.linux; + kernel = pkgsCross.armv7l-hf-multiplatform.linux_5_4; rootfsImage = runCommand "rm-rootfs.ext4" { nativeBuildInputs = [ cpio ]; } '' cpio -i --file ${updateArchive} - gzip -dc ${updateName}.ext4.verity.gz > $out + gzip -dc ${updateName}.ext4.gz > $out ''; diskImage = runCommand "rm-disk.qcow2" { @@ -64,17 +64,16 @@ let guestfish --rw --blocksize=512 --add $out <<EOF run - # not the original partition table of the RMPP + # not the original partition table of the RM2 part-init /dev/sda gpt part-add /dev/sda p 2048 2099199 part-add /dev/sda p 2099200 10487807 part-add /dev/sda p 10487808 12584959 part-add /dev/sda p 12584960 16775167 - mkfs ext4 /dev/sda1 + mkfs vfat /dev/sda1 upload ${rootfsImage} /dev/sda2 resize2fs /dev/sda2 - mkswap /dev/sda3 mkfs ext4 /dev/sda4 mount /dev/sda2 / @@ -82,18 +81,9 @@ let copy-in ${kernel}/lib/modules /lib download /etc/fstab fstab - ! sed -i 's#mmcblk0p1#vda1#' fstab - ! sed -i 's#/dev/mapper/home-encrypted-disk#/dev/vda4#' fstab + ! sed -i 's#mmcblk2#vda#' fstab upload fstab /etc/fstab - download /etc/passwd passwd - ! sed -i 's#/usr/sbin/rmdevlogin#/bin/sh#' passwd - upload passwd /etc/passwd - - download /etc/shadow shadow - ! sed -i 's/root:!:/root::/' shadow - upload shadow /etc/shadow - upload ${ifnameUdevRule} /etc/udev/rules.d/70-persistent-net.rules # download /lib/systemd/system/dhcpcd.service dhcpcd.service @@ -103,23 +93,23 @@ let upload ${xochitlService} /lib/systemd/system/xochitl.service # delete stuff which hinders boot - rm /lib/systemd/system/rm-sync.service + # rm /lib/systemd/system/rm-sync.service rm /lib/systemd/system/xochitl.service.d/xochitl-service-override.conf - rm /lib/systemd/system/wpa_supplicant.service - rm /lib/systemd/system/dropbear-wlan.socket - rm /lib/systemd/system/keystore.service - rm /lib/systemd/system/swapcryptor.service - rm /lib/systemd/system/homecryptor.service - rm /lib/systemd/system/growpart-home.service - rm /lib/systemd/system/memfault-attributes.service - rm /lib/systemd/system/swupdate.service - rm /lib/systemd/system/swupdate.socket - rm /lib/systemd/system/usb-ether-once.service - rm /lib/systemd/system/marker-manager.service - rm /lib/systemd/system/rm-sanity.timer - - # upload ${fakefbdev}/lib/libfakefbdev.so /usr/lib/libfakefbdev.so - # chmod 0755 /usr/lib/libfakefbdev.so + # rm /lib/systemd/system/wpa_supplicant.service + # rm /lib/systemd/system/dropbear-wlan.socket + # rm /lib/systemd/system/keystore.service + # rm /lib/systemd/system/swapcryptor.service + # rm /lib/systemd/system/homecryptor.service + # rm /lib/systemd/system/growpart-home.service + # rm /lib/systemd/system/memfault-attributes.service + # rm /lib/systemd/system/swupdate.service + # rm /lib/systemd/system/swupdate.socket + # rm /lib/systemd/system/usb-ether-once.service + # rm /lib/systemd/system/marker-manager.service + # rm /lib/systemd/system/rm-sanity.timer + + upload ${fakefbdev}/lib/libfakefbdev.so /usr/lib/libfakefbdev.so + chmod 0755 /usr/lib/libfakefbdev.so mount /dev/sda4 /home cp-a /etc/skel /home/root @@ -140,11 +130,9 @@ in writeShellApplication { qemu-img create -b ${diskImage} -F qcow2 -f qcow2 ./reMder.qcow2 qemu-system-aarch64 \ - -enable-kvm \ -machine virt \ - -cpu host \ -m 2048 \ - -kernel ${kernel}/Image \ + -kernel ${kernel}/zImage \ -drive if=none,file=./reMder.qcow2,format=qcow2,id=hd \ -device virtio-blk-device,drive=hd \ -netdev user,hostfwd=tcp::${toString sshPort}-:22,hostfwd=tcp::${ |