-
Notifications
You must be signed in to change notification settings - Fork 243
/
Copy pathbuildUEFI64
executable file
·37 lines (35 loc) · 1.77 KB
/
buildUEFI64
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
set -x
# Build a custom UEFI linux based PBA image
## define releases for tools
. conf
VERSIONINFO=`git describe --dirty` || VERSIONINFO=tarball
BUILDTYPE=UEFI64
BUILDIMG=${BUILDTYPE}-${VERSIONINFO}.img
## check that everything is available
[ -f scratch/${SYSLINUX}/efi64/efi/syslinux.efi ] || { echo " prereqs are not available "; exit 1; }
[ -f scratch/${SYSLINUX}/efi64/com32/elflink/ldlinux/ldlinux.e64 ] || { echo " prereqs are not available "; exit 1; }
[ -f scratch/buildroot/64bit/images/bzImage ] || { echo " prereqs are not available "; exit 1; }
[ -f scratch/buildroot/64bit/images/rootfs.cpio.xz ] || { echo " prereqs are not available "; exit 1; }
[ -f scratch/buildroot/64bit/target/sbin/linuxpba ] || { echo " prereqs are not available "; exit 1; }
[ -f scratch/buildroot/64bit/target/sbin/sedutil-cli ] || { echo " prereqs are not available "; exit 1; }
[ -f buildroot/syslinux.cfg ] || { echo " prereqs are not available "; exit 1; }
# Start fresh
sudo rm -rf ${BUILDTYPE} ; mkdir ${BUILDTYPE} ; cd ${BUILDTYPE}
# make an image file
dd if=/dev/zero of=${BUILDIMG} bs=1M count=32
(echo "n";echo "";echo "";echo "";echo "ef00";echo w;echo Y) | gdisk ${BUILDIMG}
LOOPDEV=`sudo losetup --show -f -o 1048576 ${BUILDIMG}`
sudo mkfs.vfat $LOOPDEV -n ${BUILDTYPE}
sudo mkdir image
sudo mount $LOOPDEV image
sudo chmod 777 image
sudo mkdir -p image/EFI/boot
sudo cp ../scratch/${SYSLINUX}/efi64/efi/syslinux.efi image/EFI/boot/bootx64.efi
sudo cp ../scratch/${SYSLINUX}/efi64/com32/elflink/ldlinux/ldlinux.e64 image/EFI/boot/
sudo cp ../scratch/buildroot/64bit/images/bzImage image/EFI/boot/
sudo cp ../scratch/buildroot/64bit/images/rootfs.cpio.xz image/EFI/boot/
sudo cp ../buildroot/syslinux.cfg image/EFI/boot/
sudo umount image
sudo losetup -d $LOOPDEV
gzip ${BUILDIMG}