Browse Source

prepared docu for efi-installation

toastie89 1 year ago
parent
commit
9c33b450aa
4 changed files with 39 additions and 2 deletions
  1. 5 1
      README.md
  2. 1 0
      bootstrap-bookworm.sh
  3. 2 1
      config.sh.template
  4. 31 0
      uefi-parted.sh

+ 5 - 1
README.md

@@ -31,4 +31,8 @@ qemu-img create -f qcow2 -o size=20G $img  # create image
 qemu-nbd -c /dev/nbd0 $img  # create device from image
 qemu-nbd -d /dev/nbd0       # release device
 ```
-Set `disk=/dev/nbd0` as installation target
+Set `disk=/dev/nbd0` as installation target
+
+#### 2. EFI installion with encrypted data partition
+- Adapt and run [uefi-parted.sh](uefi-parted.sh) prior `bootstrap-bookworm.sh install`
+- Set `partition=efi` in config.sh

+ 1 - 0
bootstrap-bookworm.sh

@@ -27,6 +27,7 @@
 # Variables
 mnt="/mnt/root"  # mountpoint for the new root filesystem
 hostname="somehost.example.com"
+partition="single-mbr"
 disk="/dev/vda"  # lsblk --list
 disk1=$disk"1"
 netDev="eth0"    # ip link

+ 2 - 1
config.sh.template

@@ -1,8 +1,9 @@
 # Variables
 mnt="/mnt/root"  # mountpoint for the new root filesystem
 hostname="somehost.example.com"
+partition="single-mbr"       # set "efi" to skip partitioning and install grub-efi 
 disk="/dev/vda"              # find with: lsblk --list
-disk1=$disk"1"               # "p1" for nbd mounts
+disk1=$disk"1"               # "p1" for nbd or nvme mounts
 netDev="eth0"                # find with: ip link
 netAddress="203.0.113.66/24" # "" blank for dhcp on e*
 netGateway="203.0.113.1"

+ 31 - 0
uefi-parted.sh

@@ -0,0 +1,31 @@
+# Prepare nvme disk with the layout:
+# - 301 MB partition for EFI
+# - 50  GB root partition for the OS (includes /boot)
+# - Remaining disk left to create a luks container
+
+
+disk="/dev/nvme0n1"
+
+# Cleanup existing partition tables
+#dd if=/dev/zero of=$disk bs=512 count=34
+
+# Prepare partition tables and partitions
+# -parted does not accept blanks in partition names
+parted $disk --script                                \
+  mklabel gpt                                        \
+  mkpart EFI_system_partition  fat32    1MiB 301MiB  \
+  set  1 esp  on                                     \
+  set  1 boot on                                     \
+  align-check optimal 1                              \
+  mkpart Linux_system_parition  ext4  301MiB   50GiB \
+  align-check optimal 2                              \
+  mkpart Data_partion                  50GiB   100%  \
+  align-check optimal 3                              \
+  unit MiB                                           \
+  print
+
+# Make file systems
+mkfs.fat  -F 32 -n EFIBOOT $disk"p1" && fsck $disk"p1"
+mkfs.ext4 $disk"p2" && fsck $disk"p2"
+
+