Skip to content

Commit

Permalink
fixed spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
shadlyd15 committed May 7, 2022
1 parent 5304b25 commit ac81c1c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,44 +19,44 @@
## Compile and install GNU-EFI Library
Go to gnu-efi source folder
```bash
make
make install
make
make install
```
[Here](compile_guide.md) is a guide you can follow for more details on how to compile and run gnu-efi applications.

## Compile NesUEFI
Change the following macros in makefile to locate GNU-EFI **libraries** and **headers** installed on the previous step.

```makefile
INCDIR = /usr/local/include
LIBDIR = /usr/local/lib
EFILIB = /usr/local/lib
INCDIR = /usr/local/include
LIBDIR = /usr/local/lib
EFILIB = /usr/local/lib
```

# NesUEFI on qemu :

### Locate OVMF in Makefile:
To run the compiled application in qemu we need OVMF for UEFI emulation. OVMF is a port of Intel's tianocore firmware to the qemu virtual machine.
```makefile
OVMF_DIR = ../OVMF
OVMF_DIR = ../OVMF
```
Change **OVMF_DIR** directory in the makefile.

### Create Image
Add your roms here in the makefile to write it to your image. For example : test_1.nes, test_2.nes
```makefile
mcopy -i $(IMAGE).img splash.bmp ::
# Add your roms here
mcopy -i $(IMAGE).img test_1.nes ::
mcopy -i $(IMAGE).img test_2.nes ::
mcopy -i $(IMAGE).img splash.bmp ::
# Add your roms here
mcopy -i $(IMAGE).img test_1.nes ::
mcopy -i $(IMAGE).img test_2.nes ::
```
```bash
make img
make img
```

### Run
```bash
make run
make run
```
# NesUEFI on real hardware
**Do at your own risk. Under no circumstances shall the author be liable for any damage.**
Expand Down
44 changes: 22 additions & 22 deletions compile_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
Download gnu-efi from here : [https://sourceforge.net/projects/gnu-efi/](https://sourceforge.net/projects/gnu-efi/)
- **gcc-3.0 or newer**
```bash
gcc --version
gcc --version
```
- A version of **objcopy** that supports EFI applications :
```bash
objcopy --help
objcopy --help
```
Check if supported target contains elf64-x86-64 elf32-i386 elf32-x86-64

Expand All @@ -19,46 +19,46 @@ Check if supported target contains elf64-x86-64 elf32-i386 elf32-x86-64
## Compile and install GNU-EFI Library:
Go to gnu-efi source folder
```bash
make
make install
make
make install
```
## Compile GNU-EFI application :
Use this makefile to easily compile and run gnu-efi application. It will recursively compile all c files in the sub-directories.
Change the following macros to locate the libraries and headers installed on the previous step.

```makefile
IMAGE = uefi_app
TARGET = main.efi
IMAGE = uefi_app
TARGET = main.efi

INCDIR = /usr/local/include
LIBDIR = /usr/local/lib
EFILIB = /usr/local/lib
INCDIR = /usr/local/include
LIBDIR = /usr/local/lib
EFILIB = /usr/local/lib
```
## Run on qemu :
### Locate OVMF in Makefile:
To run the compiled application in qemu we need OVMF for UEFI emulation. OVMF is a port of Intel's tianocore firmware to the qemu virtual machine. Download it from here.
```makefile
OVMF_DIR = ../OVMF
OVMF_DIR = ../OVMF
```
Change the OVMF directory in the makefile.

### Create Image :
```bash
make img
make img
```
It will do the following tasks :
```bash
# Create a new image file that will contain the GNU-EFI application.
dd if=/dev/zero of=$(IMAGE).img bs=512 count=93750
# mformat to format it with FAT16.
mformat -i $(IMAGE).img -h 32 -t 32 -n 64 -c 1 ::
# Create directory
mmd -i $(IMAGE).img ::/EFI
mmd -i $(IMAGE).img ::/EFI/BOOT
# Copy image
mcopy -i $(IMAGE).img $(TARGET) ::/EFI/BOOT
# Copy the nsh script to load efi application automatically from fs0
mcopy -i $(IMAGE).img startup.nsh ::
# Create a new image file that will contain the GNU-EFI application.
dd if=/dev/zero of=$(IMAGE).img bs=512 count=93750
# mformat to format it with FAT16.
mformat -i $(IMAGE).img -h 32 -t 32 -n 64 -c 1 ::
# Create directory
mmd -i $(IMAGE).img ::/EFI
mmd -i $(IMAGE).img ::/EFI/BOOT
# Copy image
mcopy -i $(IMAGE).img $(TARGET) ::/EFI/BOOT
# Copy the nsh script to load efi application automatically from fs0
mcopy -i $(IMAGE).img startup.nsh ::
```
### Run :
```bash
Expand Down

0 comments on commit ac81c1c

Please sign in to comment.