ee8f05925692bb776c80be80296c712a87d978d0
[platform/upstream/gummiboot.git] / test / test-create-disk.sh
1 #!/bin/bash -e
2
3 # create GPT table with EFI System Partition
4 rm -f test-disk.img
5 dd if=/dev/null of=test-disk.img bs=1M seek=512 count=1
6 parted --script test-disk.img "mklabel gpt" "mkpart ESP fat32 1M 512M" "set 1 boot on" "print"
7
8 # create FAT32 file system
9 LOOP=$(losetup --show -f -P test-disk.img)
10 mkfs.vfat -F32 $LOOP
11 mkdir -p mnt
12 mount $LOOP mnt
13
14 # install gummiboot
15 mkdir -p mnt/EFI/Boot
16 cp gummibootx64.efi mnt/EFI/Boot/bootx64.efi
17
18 [ -e /boot/shellx64.efi ] && cp /boot/shellx64.efi mnt/
19
20 # install entries
21 mkdir -p mnt/loader/entries
22 echo -e "timeout 3\n" > mnt/loader/loader.conf
23 echo -e "title Test\nefi /test\n" > mnt/loader/entries/test.conf
24 echo -e "title Test2\nlinux /test2\noptions option=yes word number=1000 more\n" > mnt/loader/entries/test2.conf
25 echo -e "title Test3\nlinux /test3\n" > mnt/loader/entries/test3.conf
26 echo -e "title Test4\nlinux /test4\n" > mnt/loader/entries/test4.conf
27 echo -e "title Test5\nefi /test5\n" > mnt/loader/entries/test5.conf
28 echo -e "title Test6\nlinux /test6\n" > mnt/loader/entries/test6.conf
29
30 sync
31 umount mnt
32 rmdir mnt
33 losetup -d $LOOP