Skip to content

Instantly share code, notes, and snippets.

@AmaanC
Created May 18, 2018 10:33
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AmaanC/aa7145e631e9f20e35f9b133386d11c8 to your computer and use it in GitHub Desktop.
Save AmaanC/aa7145e631e9f20e35f9b133386d11c8 to your computer and use it in GitHub Desktop.
UEFI application image using objcopy
#!/bin/bash
dd if=/dev/zero of=uefi.img bs=512 count=93750
parted uefi.img -s -a minimal mklabel gpt
parted uefi.img -s -a minimal mkpart EFI FAT16 2048s 93716s
parted uefi.img -s -a minimal toggle 1 boot
dd if=/dev/zero of=/tmp/part.img bs=512 count=91669
mformat -i /tmp/part.img -h 32 -t 32 -n 64 -c 1
mmd -i /tmp/part.img ::/EFI
mmd -i /tmp/part.img ::/EFI/BOOT
# NOTE: Replace the following path!
mcopy -i /tmp/part.img /home/amaan/code/uefi/gnu-efi-3.0.8/x86_64/apps/BOOTX64.EFI ::/EFI/BOOT
dd if=/tmp/part.img of=uefi.img bs=512 count=91669 seek=2048 conv=notrunc
diff --git a/bfd/config.bfd b/bfd/config.bfd
index bbd4194153..8d0d4cb680 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -664,6 +664,10 @@ case "${targ}" in
x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia)
targ_defvec=x86_64_elf64_vec
targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec l1om_elf64_vec k1om_elf64_vec"
+ case "${targ}" in
+ x86_64-*-rtems*)
+ targ_selvecs="${targ_selvecs} x86_64_pei_vec"
+ esac
want64=true
;;
x86_64-*-dragonfly*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment