blog: nixos pinephone: mention 'dd' flags

This commit is contained in:
colin 2022-05-28 13:05:26 -07:00
parent 10ab675a94
commit 5332cda66f
1 changed files with 24 additions and 13 deletions

View File

@ -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 <wifiname> <password>`)
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 <wifiname>`)
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.