diff --git a/bin/install-pinephone b/bin/install-pinephone
index 8cdc198b3d526792bed8cdf490fb226adffd9f30..1c2b3a8f9a1c7c96cfc4196caf3aa692ae086ffd 100755
--- a/bin/install-pinephone
+++ b/bin/install-pinephone
@@ -21,27 +21,73 @@ readonly nix=(nix --log-format bar-with-logs)
 readonly system_installable="path:$MACHINES_PATH#nixosConfigurations.$machine.config.system.build.toplevel"
 readonly nixos_config_path=$($nix build --json --no-link $system_installable | jq --raw-output ".[0].outputs.out")
 
-readonly bootloader_partition="/dev/disk/by-partuuid/cfb21b5c-a580-de40-940f-b9644b4466e1"
 
-readonly luks_partition="/dev/disk/by-partuuid/b6713f6b-6674-7c43-a4e2-9c7ce73b1fcf"
+# NOTE: Update if required
+readonly target_disk="/dev/disk/by-id/usb-Generic_MassStorageClass_000000001538-0:1"
 
+# NOTE: Update for each new installation
+readonly uboot_partition_uuid="2a81eeb1-c06d-4742-a32c-8cfdc33e21ee"
+readonly misc_partition_uuid="5a7fa69c-9394-8144-a74c-6726048b129d"
+readonly persist_partition_uuid="5553f4ad-53e1-2645-94ba-2afc60c12d39"
+readonly bootloader_partition_uuid="cfb21b5c-a580-de40-940f-b9644b4466e1"
+readonly luks_partition_uuid="b6713f6b-6674-7c43-a4e2-9c7ce73b1fcf"
+
+# NOTE: Update for each new installation
 readonly luks_uuid="f3ace1e6-9f25-45d1-8988-3e9a2565f82c"
+readonly btrfs_uuid="d577f109-a0c0-4c96-9e9d-263e10dac085"
+
+
+# Derived paths
+readonly uboot_partition="/dev/disk/by-partuuid/$uboot_partition_uuid"
+readonly bootloader_partition="/dev/disk/by-partuuid/$bootloader_partition_uuid"
+readonly luks_partition="/dev/disk/by-partuuid/$luks_partition_uuid"
+
+
+sudo nix shell nixpkgs#vboot_reference -c cgpt create -p 20480 $(realpath $target_disk)
+
+sudo sfdisk $target_disk --append <<EOF
+  unit: sectors
+  sector-size: 512
+
+  start=20514, size=2048, type=EF32A33B-A409-486C-9141-9FFB711F6266, uuid=$misc_partition_uuid, name="misc"
+  start=22562, size=32768, type=EBC597D0-2053-4B15-8B64-E0AAC75F4DB1, uuid=$persist_partition_uuid, name="persist"
+  start=55330, size=262144, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=$bootloader_partition_uuid, name="boot", attrs="LegacyBIOSBootable"
+  start=317474, type=CA7D7CCB-63ED-4C53-861C-1742536059CC, uuid=$luks_partition_uuid, name="luks"
+EOF
+# start=16, size=20480, type=8DA63339-0007-60C0-C436-083AC8230908, uuid=$uboot_partition_uuid, name="uboot"
+
+
+nix shell nixpkgs#busybox -c partprobe
+
+
+readonly uboot_installable="path:$MACHINES_PATH#nixosConfigurations.$machine.config.system.build.u-boot"
+readonly uboot=$($nix build --json --no-link $uboot_installable | jq --raw-output ".[0].outputs.out")
+
+#sudo dd if=$uboot/u-boot-sunxi-with-spl.bin of=$uboot_partition bs=16M conv=fsync oflag=direct status=progress
+sudo dd if=$uboot/u-boot-sunxi-with-spl.bin of=$target_disk bs=1024 seek=8 conv=fsync status=progress
 
 
 readonly boot_partition_installable="path:$MACHINES_PATH#nixosConfigurations.$machine.config.system.build.boot-partition"
 
 readonly boot_partition_image=$($nix build --json --no-link $boot_partition_installable | jq --raw-output ".[0].outputs.out")
 
+udevadm settle --exit-if-exists=$bootloader_partition
+if [[ ! -e $bootloader_partition ]]
+then
+  print "Failed to create bootloader partition ($bootloader_partition)?" >&2
+  exit 1
+fi
+
 sudo dd if="$boot_partition_image/mobile-nixos-boot.img" of="$bootloader_partition" bs=16M conv=fsync oflag=direct status=progress
 
 sudo cryptsetup luksFormat --type luks2 --uuid "${luks_uuid}" "${luks_partition}"
 
 sudo cryptsetup open --allow-discards --persistent "${luks_partition}" cryptvol_$machine
 
-sudo mkfs.btrfs --uuid d577f109-a0c0-4c96-9e9d-263e10dac085 -L btrfs_$machine /dev/mapper/cryptvol_$machine
+sudo mkfs.btrfs --uuid $btrfs_uuid -L btrfs_$machine /dev/mapper/cryptvol_$machine
 
 mount_point=/mnt/mnt
-sudo mount /dev/mapper/cryptvol_$machine $mount_point
+sudo mount -t btrfs /dev/mapper/cryptvol_$machine $mount_point
 sudo btrfs subvolume create $mount_point/$machine
 sudo btrfs subvolume create $mount_point/$machine/nix