ยง2023-09-29

  1. Prerequisites
  1. Partition Table

The desired partition tables looks like this:

Area Name Size From (sector #) To (sector #) device
Bootloader1 / MBR 512B 0 0 -
U-Boot 959.5K 1 1919 /dev/block/bootloader
U-Boot Environment 64KB 1920 2047 /dev/block/env
FAT32 for boot 128MB 2048 264191 /dev/mmcblk0p1
swap 4GB todo todo /dev/mmcblk0p2
BTRFS root - todo remaining blocks /dev/mmcblk0p3

Option 1 - Extract from Image

In this section, the desired partition table is acquired by using an available ubuntu boot image. This has the advantage of not needing to build U-Boot.

Download an ubuntu image to extract the bootloader from.

user $wget http://de.eu.odroid.in/ubuntu_18.04lts/N2/ubuntu-18.04.2-4.9-minimal-odroid-n2-20190329.img.xz

Extract the image.

user $xz -d ubuntu-18.04.2-4.9-minimal-odroid-n2-20190329.img.xz

Copy the first MBs which contain the partition table and the bootloader to the sd-card.

user $dd if=ubuntu-18.04.2-4.9-minimal-odroid-n2-20190329.img of=/dev/mmcblk0 bs=1M count=150 status=progress

150+0 records in
150+0 records out
157286400 bytes (157 MB, 150 MiB) copied, 0,241063 s, 652 MB/s