From 5332cda66ff74baafca8cb22bccd3058bcc2846c Mon Sep 17 00:00:00 2001 From: colin Date: Sat, 28 May 2022 13:05:26 -0700 Subject: [PATCH] blog: nixos pinephone: mention 'dd' flags --- .../blog/2022-05-20-mobile-nixos-pinephone.md | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/content/blog/2022-05-20-mobile-nixos-pinephone.md b/content/blog/2022-05-20-mobile-nixos-pinephone.md index 3908f54..4e617c9 100644 --- a/content/blog/2022-05-20-mobile-nixos-pinephone.md +++ b/content/blog/2022-05-20-mobile-nixos-pinephone.md @@ -11,14 +11,16 @@ step 2: convert to a flake step 3: install jumpdrive to a sd card -step 4: build and flash a minimal mobile-nixos +step 4: build a minimal mobile-nixos + +step 5: flash the image. oflag=direct is less likely to result in corruption ```sh -$ sudo umount /dev/sdb* ; sudo dd if=/nix/store/l9na29kg38crkzhjf6ms3vviqhi2cbc5-pine64-pinephone_full-disk-image.img of=/dev/sdb bs=1M status=progress +$ sudo umount /dev/sdb* ; sudo dd if=/nix/store/qalvicwwl80sfjx0rxmyi85wg30x257f-pine64-pinephone_full-disk-image.img of=/dev/sdb bs=1M status=progress conv=sync oflag=direct; ``` -step 5: add gnome and re-flash; connect to wifi (`nmcli connect wifi `) +validate with `sudo fsck -f /dev/sdb4`. you might see a single, inconsequential error about `Padding at end of inode bitmap is not set.` -step 6: ssh into the machine. resize the parts, and clone/rebuild config (better to do this from PC?) +step 6: resize the rootfs: RESIZE THE PARTITION USING CFDISK. `parted` and the like mess with the bootloader. mobile-nixos is switching from u-boot to towboot, so at some point this won't be problematic. you can resize the filesystem using resize2fs, @@ -27,21 +29,30 @@ or just skip that and the phone will do that the next time you boot. ```sh $ sudo cfdisk /dev/sdb scroll to /dev/sdb4 -resize -leave at default (28.8 GB) -write -quite +> Resize + leave at default (28.8G) +> Write + type "yes" +> Quite ``` -then disconnect the device and boot it +step 7: poweroff, remove SD card, boot phone. +step 8: add gnome and re-flash; connect to wifi (`nmcli device wifi connect `) + +step 9: ssh into the machine. clone/rebuild config: ``` -$ git clone https://git.uninsane.org/colin/nix-files.git -$ sudo rm /etc/nixos && mv nix-files /etc/nixos -$ cd /etc/nixos -$ sudo nixos-rebuild --flake "./#moby" switch # XXX: check /etc/fstab for compatibility first? +~$ git clone https://git.uninsane.org/colin/nix-files.git +~$ sudo rmdir /etc/nixos && sudo mv nix-files /etc/nixos +~$ cd /etc/nixos +/etc/nixos$ sudo git config --global --add safe.directory /etc/nixos +/etc/nixos$ sudo nixos-rebuild --flake "./#moby" switch # XXX: check /etc/fstab for compatibility first? ``` +if everything goes right, the build shouldn't take more than 5-10 minutes. +`sudo reboot now` and you should be right back to where you were. +you're set! + # Troubleshooting unbootable; unflashable (e.g. eMMC not exposed over USB)... tend to be power related issues.