Skip to content

Instantly share code, notes, and snippets.

@thefloweringash
Created September 3, 2020 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thefloweringash/d22d7e1b0aedf7bb32dd9280da45f900 to your computer and use it in GitHub Desktop.
Save thefloweringash/d22d7e1b0aedf7bb32dd9280da45f900 to your computer and use it in GitHub Desktop.
Rock64 partition layout
label: gpt
unit: sectors
first-lba: 64
/dev/mmcblk0p1 : start= 64, size= 16320, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, name="idbloader"
/dev/mmcblk0p2 : start= 16384, size= 8192, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, name="u-boot"
/dev/mmcblk0p3 : start= 24576, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, attrs="LegacyBIOSBootable"
@thefloweringash
Copy link
Author

Untested method to mutate the nixos installer image into a bootable rock64 image:

  1. Find the start offset of the built image, currently this seems to be configured to 30M.
$ sfdisk -d $extract_image
label: dos
label-id: 0x2178694e
device: /tmp/img.dd
unit: sectors

/tmp/img.dd1 : start=       16384, size=       61440, type=b
/tmp/img.dd2 : start=       77824, size=     5424960, type=83, bootable
  1. Update the partition layout above to match the start of p3 to the installer image, replace 24576 with the discovered value, in this case 77824.

  2. Apply new partition layout

$ sfdisk /dev/mmcblk0 < rockchip-partition-layout.sfdisk
  1. Install u-boot
$ nix-build -A ubootRock64
$ dd if=result/idbloader.img of=/dev/mmcblk0p1
$ dd if=result/u-boot.itb    of=/dev/mmcblk0p2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment