diff --git a/utils/OLVASSEL.md b/utils/OLVASSEL.md index c097486..ff27697 100644 --- a/utils/OLVASSEL.md +++ b/utils/OLVASSEL.md @@ -1,11 +1,40 @@ POSIX-UEFI Segédeszközök ======================== -Ezek kis parancsok, amik besegítenek az UEFI toolchain-edbe. A POSIX-UEFI által lefordított .efi kimeneti fájlokat konvertálják -olyan különböző formátumú fájlokká, amiket az UEFI firmware használ. +Ezek kis parancsok, amik besegítenek az UEFI toolchain-edbe (csak libc-t használnak, nincs szükség EFI hedörökre). A POSIX-UEFI +által lefordított .efi kimeneti fájlokat konvertálják olyan különböző formátumú fájlokká, amiket az UEFI firmware használ. * __efirom__ - ez PCI Option ROM képet készít +``` +POSIX-UEFI utils - efirom by Michael Brown GPL -* __efiffs__ - ez DXE UEFI eszközmeghajtó képet (bővebb infó [ebben a wikiben](https://github.com/pbatard/efifs/wiki/Adding-a-driver-to-a-UEFI-firmware#adding-the-module-to-the-firmware) található arról, hogy kell a firmwarehez adni). +./efirom [--vendor=VVVV] [--device=DDDD] bementifájl kimentifájl +``` -* __efidsk__ - indítható lemezképet készít EFI Rendszer Partícióval egy könyvtár tartalmából +* __efiffs__ - ez DXE UEFI eszközmeghajtó képet készít (bővebb infó [ebben a wikiben](https://github.com/pbatard/efifs/wiki/Adding-a-driver-to-a-UEFI-firmware#adding-the-module-to-the-firmware) található arról, hogy hogyan kell a firmwarehez adni). +``` +POSIX-UEFI utils - efiffs by bztsrc@gitlab MIT + +./efiffs [-g ] [-n ] [-v ] [-t ] [-p ] bemenet [kimenet] + + -g a GUID megadása (alapértelmezetten véletlenszám) + -n az eszközmeghajtó neve (pl 'FAT') + -v az eszközmeghajtó verziója (pl '1.0') + -t az ffs típusa (alapértelmezetten 7, EFI_FV_FILETYPE_DRIVER) + -p a pe szekció típusa (alapértelmezetten 16, EFI_SECTION_PE32) + bemenet a bemeneti .efi fájl neve + kimenet a kimeneti fájl neve (alapértelmezetten a bemeneti névből generált) +``` + +* __efidsk__ - indítható lemezképet készít EFI Rendszer Partícióval egy könyvtár tartalmából. A POSIX-EFI-vel lefordított +programodat `EFI/BOOT/BOOTX64.EFI` néven kell bemásolni a könyvtárba, hogy magától elinduljon. +``` +POSIX-UEFI utils - efidsk by bztsrc@gitlab MIT + +./efidsk [-p] [-s ] bekönyvtár kimenet + + -p csak a partíciót mentse, GPT nélkül + -s a partíció méretének megadása megabájtban (alapértelmezetten 33M) + bekönvtár ennek a könyvtárnak a tartalmából generálja + kimenet kimenti lemezképfájl neve +``` diff --git a/utils/README.md b/utils/README.md index 2f65717..73b4b88 100644 --- a/utils/README.md +++ b/utils/README.md @@ -1,11 +1,40 @@ POSIX-UEFI Utilities ==================== -These are small portable commands to help you with the UEFI toolchain. They convert the .efi output that you've compiled -with POSIX-UEFI into different file formats required by the UEFI firmware. +These are small portable commands to help you with the UEFI toolchain (libc only, no EFI headers needed). They convert the .efi +output that you've compiled with POSIX-UEFI into different file formats required by the UEFI firmware. * __efirom__ - creates a PCI Option ROM image +``` +POSIX-UEFI utils - efirom by Michael Brown GPL + +./efirom [--vendor=VVVV] [--device=DDDD] infile outfile +``` * __efiffs__ - creates a DXE UEFI driver image (see [this wiki](https://github.com/pbatard/efifs/wiki/Adding-a-driver-to-a-UEFI-firmware#adding-the-module-to-the-firmware) on how to add it to a firmware). +``` +POSIX-UEFI utils - efiffs by bztsrc@gitlab MIT + +./efiffs [-g ] [-n ] [-v ] [-t ] [-p ] infile [outfile] + + -g specify the GUID (defaults to random) + -n specify the driver's name (eg 'FAT') + -v specify the driver's version (eg '1.0') + -t specify the ffs type (defaults to 7, EFI_FV_FILETYPE_DRIVER) + -p specify the pe section type (defaults to 16, EFI_SECTION_PE32) + infile input .efi file + outfile output file name (default generated from infile) +``` + +* __efidsk__ - creates a bootable disk image with EFI System Partition from the contents of a directory. Copy the POSIX-UEFI +compiled file under the given directory as `EFI/BOOT/BOOTX64.EFI` to get it automatically booted. +``` +POSIX-UEFI utils - efidsk by bztsrc@gitlab MIT + +./efidsk [-p] [-s ] indir outfile -* __efidsk__ - creates a bootable disk image with EFI System Partition from the contents of a directory + -p save only the partition image without GPT + -s set the size of partition in megabytes (defaults to 33M) + indir use the contents of this directory + outfile output image file name +``` diff --git a/utils/efiffs.c b/utils/efiffs.c index 2031a30..5fcb8ab 100644 --- a/utils/efiffs.c +++ b/utils/efiffs.c @@ -254,7 +254,7 @@ int main(int argc, char **argv) out = (char*)malloc(i + 5); if(!out) { fprintf(stderr, "efiffs: unable to allocate memory\r\n"); return 2; } strcpy(out, in); - strcpy(strcmp(out + i + 4, ".efi") ? out + i - 4 : out + i, ".ffs"); + strcpy(!strcmp(out + i - 4, ".efi") ? out + i - 4 : out + i, ".ffs"); } f = fopen(out, "wb"); if(!f) { diff --git a/utils/efirom.c b/utils/efirom.c index 499a5d1..cef1e5f 100644 --- a/utils/efirom.c +++ b/utils/efirom.c @@ -37,6 +37,17 @@ #define eprintf(...) fprintf ( stderr, __VA_ARGS__ ) +/** + * Print help + * + * @v program_name Program name + */ +static void print_help ( const char *program_name ) { + eprintf ( "POSIX-UEFI utils - efirom by Michael Brown GPL\r\n\r\n" ); + eprintf ( "%s [--vendor=VVVV] [--device=DDDD] " + "infile outfile\n", program_name ); +} + #define EFI_SIGNATURE_16(A,B) ((A) | (B<<8)) #define EFI_SIGNATURE_32(A,B,C,D) (EFI_SIGNATURE_16(A,B) | (EFI_SIGNATURE_16(C,D) << 16)) #define EFI_SIGNATURE_64(A,B,C,D,E,F,G,H) (EFI_SIGNATURE_32(A,B,C,D) | ((UINT64)(EFI_SIGNATURE_32(E,F,G,H)) << 32)) @@ -1152,17 +1163,6 @@ static void make_efi_rom ( FILE *pe, FILE *rom, struct options *opts ) { } } -/** - * Print help - * - * @v program_name Program name - */ -static void print_help ( const char *program_name ) { - eprintf ( "POSIX-UEFI utils - efirom by Michael Brown GPL\r\n\r\n" ); - eprintf ( "%s [--vendor=VVVV] [--device=DDDD] " - "infile outfile\n", program_name ); -} - /** * Parse command-line options *