-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
73 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
Version 2, December 2004 | ||
|
||
Copyright (C) 2004 Sam Hocevar <[email protected]> | ||
|
||
Everyone is permitted to copy and distribute verbatim or modified | ||
copies of this license document, and changing it is allowed as long | ||
as the name is changed. | ||
|
||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
|
||
0. You just DO WHAT THE FUCK YOU WANT TO. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Copyright © 2022 luthor112 | ||
|
||
This work is free. You can redistribute it and/or modify it under the | ||
terms of the Do What The Fuck You Want To Public License, Version 2, | ||
as published by Sam Hocevar. See the COPYING file for more details. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,14 @@ | ||
# qefi | ||
Quick POSIX-UEFI environment and test script | ||
|
||
Based on: | ||
- [POSIX-UEFI on GitLab](https://gitlab.com/bztsrc/posix-uefi) | ||
- [UEFI on OSDev](https://wiki.osdev.org/UEFI) | ||
- [POSIX-UEFI on OSDev](https://wiki.osdev.org/POSIX-UEFI) | ||
|
||
Commands: | ||
- `qefi setup` installs needed dependencies | ||
- `qefi new NAME` creates a new environment in the NAME directory | ||
- `qefi build` runs `make`... | ||
- `qefi image` builds a disk image containing the built binary | ||
- `qefi run` runs QEMU and drops you into the EFI Shell |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
case "$1" in | ||
setup) | ||
sudo apt-get -y update | ||
sudo apt-get -y install build-essential make git qemu-system-x86-64 ovmf mtools | ||
git clone https://gitlab.com/bztsrc/posix-uefi.git ~/posix-uefi | ||
;; | ||
new) | ||
mkdir $2 | ||
ln -s ~/posix-uefi/uefi $2/uefi | ||
|
||
echo "TARGET = $2.efi" > $2/Makefile | ||
echo "include uefi/Makefile" >> $2/Makefile | ||
|
||
echo '#include <uefi.h>' > $2/main.c | ||
echo '' >> $2/main.c | ||
echo 'int main (int argc, char **argv)' >> $2/main.c | ||
echo '{' >> $2/main.c | ||
echo ' printf("Hello, world!\n");' >> $2/main.c | ||
echo ' return 0;' >> $2/main.c | ||
echo '}' >> $2/main.c | ||
;; | ||
build) | ||
make | ||
;; | ||
image) | ||
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=part.img bs=512 count=91669 | ||
mformat -i part.img -h 32 -t 32 -n 64 -c 1 | ||
mcopy -i part.img *.efi :: | ||
|
||
dd if=part.img of=uefi.img bs=512 count=91669 seek=2048 conv=notrunc | ||
;; | ||
run) | ||
sudo qemu-system-x86_64 -cpu qemu64 -drive if=pflash,format=raw,unit=0,file=/usr/share/OVMF/OVMF_CODE.fd,readonly=on -drive if=pflash,format=raw,unit=1,file=/usr/share/OVMF/OVMF_VARS.fd -net none -nographic -drive file=uefi.img,if=ide | ||
;; | ||
esac | ||
echo "Done." |