28 lines
698 B
Bash
28 lines
698 B
Bash
#!/bin/bash
|
|
|
|
set -euxo pipefail
|
|
|
|
ARCH=$(uname -m)
|
|
DEST=${2:-/tmp/esp.img}
|
|
OS=${1:-sles}
|
|
|
|
BOOTEFI=BOOTX64.efi
|
|
GRUBEFI=grubx64.efi
|
|
|
|
dd bs=1024 count=6400 if=/dev/zero of=$DEST
|
|
mkfs.msdos -F 12 -n 'ESP_IMAGE' $DEST
|
|
|
|
mkdir -p /boot/efi/EFI/BOOT
|
|
cp -L /usr/lib64/efi/shim.efi /boot/efi/EFI/BOOT/$BOOTEFI
|
|
mkdir -p /boot/efi/EFI/$OS
|
|
#cp /usr/share/grub2/x86_64-efi/grub.efi /boot/efi/EFI/$OS/$GRUBEFI
|
|
cp /usr/share/grub2/x86_64-efi/grub.efi /boot/efi/EFI/$OS/grub.efi
|
|
|
|
mmd -i $DEST EFI
|
|
mmd -i $DEST EFI/BOOT
|
|
mcopy -i $DEST -v /boot/efi/EFI/BOOT/$BOOTEFI ::EFI/BOOT
|
|
#mcopy -i $DEST -v /boot/efi/EFI/$OS/$GRUBEFI ::EFI/BOOT
|
|
mcopy -i $DEST -v /boot/efi/EFI/$OS/grub.efi ::EFI/BOOT
|
|
mdir -i $DEST ::EFI/BOOT;
|
|
|