Anonymous user
UEFI: Difference between revisions
→Emulation with QEMU and OVMF
[unchecked revision] | [unchecked revision] |
Line 254:
====Linux, root not required====
This approach uses '''parted''', '''mformat''', and '''mcopy''' and can be performed with user privileges. First, use parted to create primary and secondary GPT headers, and a single EFI partition spanning the same range as the approach above.
<source lang="bash">
$ parted /path/to/uefi.img -s -a minimal mklabel gpt
$ parted /path/to/uefi.img -s -a minimal mkpart EFI FAT16 2048s 93716s
$ parted /path/to/uefi.img -s -a minimal toggle 1 boot
</source>
Now create a new temporary image file that will contain the EFI partition data and use mformat to format it with FAT16.
<source lang="bash">
</source>
Use mcopy to copy any UEFI applications you want to test to the file system.
<source lang="bash">
$ mcopy -i /tmp/part.img /path/to/main.efi
$ ...
</source>
Finally, write the partition image into the main disk image.
<source lang="bash">
$ dd if=/tmp/part.img of=/path/to/uefi.img bs=512 count=91669 seek=2048 conv=notrunc
▲ dd if=/dev/zero of=$(TEMP_IMG) bs=512 count=$(FAT_SECTORS)
▲ mformat -i $(TEMP_IMG) -h 32 -t 32 -n 64 -c 1 ::
</source>
''uefi.img'' is now a disk image containing primary and secondary GPT tables, containing a single partition of type EFI, containing a FAT16 file system, containing one or more UEFI applications.
====FreeBSD, root required====
|