Created
March 21, 2023 13:19
-
-
Save mouseos/04cb95de5e5af43e1bef43396108b7d0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ディスクイメージファイルのパス | |
img_path="gpt.img" | |
echo "Creating empty image file" | |
dd if=/dev/zero of=$img_path bs=1G count=1 | |
echo "Creating gpt table" | |
parted -s gpt.img mklabel gpt | |
echo "=========== Create partitions ==========" | |
echo "Creating loader1" | |
echo "n | |
1 | |
64 | |
8063 | |
w" | fdisk $img_path | |
echo "Creating reserved1" | |
echo "n | |
2 | |
8064 | |
8191 | |
w" | fdisk $img_path | |
echo "Creating reserved2" | |
echo "n | |
3 | |
8192 | |
16383 | |
w" | fdisk $img_path | |
echo "Creating loader2" | |
echo "n | |
4 | |
16384 | |
24575 | |
w" | fdisk $img_path | |
echo "Creating atf" | |
echo "n | |
5 | |
24576 | |
32767 | |
w" | fdisk $img_path | |
echo "Creating atf" | |
echo "n | |
6 | |
32768 | |
262143 | |
w" | fdisk $img_path | |
echo "=========== Set partition name ==========" | |
sgdisk -c 1:"loader1" ${img_path} | |
sgdisk -c 2:"reserved1" ${img_path} | |
sgdisk -c 3:"reserved2" ${img_path} | |
sgdisk -c 4:"loader2" ${img_path} | |
sgdisk -c 5:"atf" ${img_path} | |
sgdisk -c 6:"efi esp" -t 6:ef00 ${img_path} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment