18 lines
586 B
Bash
18 lines
586 B
Bash
# Partition DISK: GPT, 512M EFI + rest ext4 root. Mounts root at /mnt, ESP at /mnt/boot.
|
|
# Sourced by run.sh (DISK comes from system.conf).
|
|
|
|
part() { case "$DISK" in *nvme*|*mmcblk*) echo "${DISK}p$1" ;; *) echo "${DISK}$1" ;; esac; }
|
|
EFI="$(part 1)"; ROOT="$(part 2)"
|
|
|
|
info "partitioning $DISK"
|
|
sgdisk --zap-all "$DISK"
|
|
sgdisk -n1:0:+512M -t1:ef00 -c1:EFI "$DISK"
|
|
sgdisk -n2:0:0 -t2:8300 -c2:root "$DISK"
|
|
partprobe "$DISK"; sleep 1
|
|
|
|
mkfs.fat -F32 "$EFI"
|
|
mkfs.ext4 -F "$ROOT"
|
|
|
|
mount "$ROOT" /mnt
|
|
mount --mkdir "$EFI" /mnt/boot # ESP at /boot so the kernel + initramfs land on it
|