-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upload Main Code
- Loading branch information
0 parents
commit 6855439
Showing
10 changed files
with
507 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,5 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
*.c linguist-language=C | ||
*.h linguist-language=C |
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,56 @@ | ||
# Prerequisites | ||
*.d | ||
|
||
# Object files | ||
*.o | ||
*.ko | ||
*.obj | ||
*.elf | ||
|
||
# Linker output | ||
*.ilk | ||
*.map | ||
*.exp | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
|
||
# Shared objects (inc. Windows DLLs) | ||
*.dll | ||
*.so | ||
*.so.* | ||
*.dylib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
*.i*86 | ||
*.x86_64 | ||
*.hex | ||
*.efi | ||
|
||
# Debug files | ||
*.dSYM/ | ||
*.su | ||
*.idb | ||
*.pdb | ||
|
||
# Kernel Module Compile Results | ||
*.mod* | ||
*.cmd | ||
.tmp_versions/ | ||
modules.order | ||
Module.symvers | ||
Mkfile.old | ||
dkms.conf | ||
|
||
# Miscellaneous | ||
*.cod |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 unknown | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,22 @@ | ||
# UefiDiskAccess | ||
Simple Demo of Accessing Disks with Block I/O Protocol | ||
|
||
## Introduction | ||
This project is a simple demo of accessing disks using Block I/O Protocol in UEFI Environment. | ||
|
||
## Requirement | ||
To run this project, a working computer with UEFI firmware is required. | ||
|
||
## Build | ||
If it is your first time to build this project, you should run `build_prep.bat` to prepare for compilation. <br> | ||
The required compiler for this project is Win64 LLVM. You may download it from [GitHub](https://github.com/llvm/llvm-project/releases). <br> | ||
The required library for this project is TianoCore EDK II. You may download it from [GitHub](https://github.com/tianocore/edk2/releases). <br> | ||
You are required to pre-compile the EDK II library. The method to compile is unofficial. You may use the script from [EDK II Library](https://github.com/MickeyMeowMeowHouse/EDK-II-Library) to build EDK II library. For detailed steps to pre-compile, consult that repository to proceed. | ||
|
||
## Test | ||
Setup a USB flash stick with GUID Partition Table (GPT). Construct a partition and format it into FAT32 file system. <br> | ||
Copy the compiled `bootx64.efi` to `\EFI\BOOT\bootx64.efi` in your flash stick. <br> | ||
Enter your firmware settings. Set the device option prior to the operating system. Disable Secure Boot unless you can sign the executable. | ||
|
||
## License | ||
This repository is under the MIT license. |
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,22 @@ | ||
@echo off | ||
|
||
title Project: UefiDiskAccess, Preparation, UEFI (AMD64 Architecture) | ||
echo Project: UefiDiskAccess | ||
echo Platform: Unified Extensible Firmware Interface | ||
echo Preset: Directory Build | ||
echo Powered by [email protected] | ||
pause. | ||
|
||
echo Starting Compilation Preparations | ||
mkdir ..\bin | ||
|
||
echo Making Directories for UefiDiskAccess Checked Build, 64-Bit UEFI | ||
mkdir ..\bin\compchk_uefix64 | ||
mkdir ..\bin\compchk_uefix64\Intermediate | ||
|
||
echo Making Directories for UefiDiskAccess Free Build, 64-Bit UEFI | ||
mkdir ..\bin\compfre_uefix64 | ||
mkdir ..\bin\compfre_uefix64\Intermediate | ||
|
||
echo Preparation Completed! | ||
pause. |
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 @@ | ||
@echo off | ||
|
||
title Project: UefiDiskAccess, Cleanup, UEFI (AMD64 Architecture) | ||
echo Project: UefiDiskAccess | ||
echo Platform: Unified Extensible Firmware Interface | ||
echo Preset: Cleanup | ||
echo Powered by [email protected] | ||
|
||
del ..\bin\compchk_uefix64 /q /s | ||
del ..\bin\compfre_uefix64 /q /s | ||
|
||
echo Completed! | ||
pause. |
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,24 @@ | ||
@echo off | ||
set edkpath=C:\UefiDKII | ||
set mdepath=C:\UefiDKII\MdePkg | ||
set libpath=C:\UefiDKII\Bin\MdePkg | ||
set binpath=..\bin\compchk_uefix64 | ||
set objpath=..\bin\compchk_uefix64\Intermediate | ||
|
||
title Compiling UefiDiskAccess, Checked Build, UEFI (AMD64 Architecture) | ||
echo Project: UefiDiskAccess | ||
echo Platform: Unified Extensible Firmware Interface | ||
echo Preset: Debug/Checked Build | ||
echo Powered by [email protected] | ||
clang-cl --version | ||
lld-link --version | ||
pause | ||
|
||
echo ============Start Compiling============ | ||
clang-cl ..\src\efimain.c /I"%mdepath%\Include" /I"%mdepath%\Include\X64" /D"_EFI_BOOT" /Zi /W3 /WX /Ot /Fa"%objpath%\efimain.cod" /Fo"%objpath%\efimain.obj" /GS- /Gr /TC /c -Wno-int-to-pointer-cast -Wno-incompatible-pointer-types | ||
|
||
echo ============Start Linking============ | ||
lld-link "%objpath%\efimain.obj" /NODEFAULTLIB /LIBPATH:"%libpath%\compchk_uefix64" "BaseLib.lib" "BaseDebugPrintErrorLevelLib.lib" "BaseMemoryLib.lib" "BasePrintLib.lib" "UefiLib.lib" "UefiDebugLibConOut.lib" "UefiMemoryAllocationLib.lib" "UefiDevicePathLib.Lib" "UefiBootServicesTableLib.Lib" "UefiRuntimeServicesTableLib.Lib" /OUT:"%binpath%\bootx64.efi" /SUBSYSTEM:EFI_APPLICATION /ENTRY:"EfiMain" /DEBUG /PDB:"%objpath%\bootx64.pdb" /Machine:X64 | ||
|
||
echo Completed! | ||
pause. |
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,24 @@ | ||
@echo off | ||
set edkpath=C:\UefiDKII | ||
set mdepath=C:\UefiDKII\MdePkg | ||
set libpath=C:\UefiDKII\Bin\MdePkg | ||
set binpath=..\bin\compfre_uefix64 | ||
set objpath=..\bin\compfre_uefix64\Intermediate | ||
|
||
title Compiling UefiDiskAccess, Free Build, UEFI (AMD64 Architecture) | ||
echo Project: UefiDiskAccess | ||
echo Platform: Unified Extensible Firmware Interface | ||
echo Preset: Release/Free Build | ||
echo Powered by [email protected] | ||
clang-cl --version | ||
lld-link --version | ||
pause | ||
|
||
echo ============Start Compiling============ | ||
clang-cl ..\src\efimain.c /I"%mdepath%\Include" /I"%mdepath%\Include\X64" /D"_EFI_BOOT" /Zi /W3 /WX /O2 /Fa"%objpath%\efimain.cod" /Fo"%objpath%\efimain.obj" /GS- /Gr /TC /c -Wno-int-to-pointer-cast -Wno-incompatible-pointer-types | ||
|
||
echo ============Start Linking============ | ||
lld-link "%objpath%\efimain.obj" /NODEFAULTLIB /LIBPATH:"%libpath%\compfre_uefix64" "BaseLib.lib" "BaseDebugPrintErrorLevelLib.lib" "BaseMemoryLib.lib" "BasePrintLib.lib" "UefiLib.lib" "UefiDebugLibConOut.lib" "UefiMemoryAllocationLib.lib" "UefiDevicePathLib.Lib" "UefiBootServicesTableLib.Lib" "UefiRuntimeServicesTableLib.Lib" /OUT:"%binpath%\bootx64.efi" /OPT:REF /SUBSYSTEM:EFI_APPLICATION /ENTRY:"EfiMain" /DEBUG /PDB:"%objpath%\bootx64.pdb" /Machine:X64 | ||
|
||
echo Completed! | ||
pause. |
Oops, something went wrong.