├── AndroidLocator.c ├── EFIDroid.ini ├── EFIDroidUi.c ├── EFIDroidUi.dec ├── EFIDroidUi.dsc.inc ├── EFIDroidUi.h ├── EFIDroidUi.inf ├── Fastboot.c ├── FastbootCommands.c ├── FileExplorer.c ├── Include ├── Internal │ ├── AndroidLocator.h │ ├── Fastboot.h │ └── Loader.h └── Library │ ├── Cpio.h │ ├── Decompress.h │ ├── Fstab.h │ ├── MakeDosFs.h │ ├── Menu.h │ ├── UEFIRamdisk.h │ └── Util.h ├── Library ├── AromaLib │ ├── AromaLib.dec │ ├── AromaLib.inf │ ├── AromaLibPriv.dec │ ├── Include │ │ └── aroma_platform.h │ ├── aroma.c │ ├── fb_driver.c │ └── fb_driver.h ├── BootLib │ ├── BootLib.dec │ ├── BootLib.inf │ ├── BootLibPriv.dec │ ├── Include │ │ └── lib │ │ │ └── boot │ │ │ └── boot_platform.h │ └── platform.c ├── CpioLib │ ├── Cpio.c │ └── CpioLib.inf ├── DecompressLib │ ├── COPYING │ ├── DecompressLib.dec │ ├── DecompressLib.inf │ ├── decompress.c │ ├── decompress_bunzip2.c │ ├── decompress_inflate.c │ ├── decompress_unlz4.c │ ├── decompress_unlzma.c │ ├── decompress_unlzo.c │ ├── decompress_unxz.c │ ├── include │ │ ├── linux │ │ │ ├── decompress │ │ │ │ ├── bunzip2.h │ │ │ │ ├── generic.h │ │ │ │ ├── inflate.h │ │ │ │ ├── mm.h │ │ │ │ ├── unlz4.h │ │ │ │ ├── unlzma.h │ │ │ │ ├── unlzo.h │ │ │ │ └── unxz.h │ │ │ ├── lz4.h │ │ │ ├── lzo.h │ │ │ ├── unaligned │ │ │ │ ├── access_ok.h │ │ │ │ ├── be_byteshift.h │ │ │ │ ├── be_memmove.h │ │ │ │ ├── be_struct.h │ │ │ │ ├── generic.h │ │ │ │ ├── le_byteshift.h │ │ │ │ ├── le_memmove.h │ │ │ │ ├── le_struct.h │ │ │ │ ├── memmove.h │ │ │ │ └── packed_struct.h │ │ │ ├── xz.h │ │ │ ├── zconf.h │ │ │ ├── zlib.h │ │ │ └── zutil.h │ │ └── linuxcompat.h │ ├── lz4 │ │ ├── Makefile │ │ ├── lz4_compress.c │ │ ├── lz4_decompress.c │ │ ├── lz4defs.h │ │ └── lz4hc_compress.c │ ├── lzo │ │ ├── Makefile │ │ ├── lzo1x_compress.c │ │ ├── lzo1x_decompress_safe.c │ │ └── lzodefs.h │ ├── xz │ │ ├── Kconfig │ │ ├── Makefile │ │ ├── xz_crc32.c │ │ ├── xz_dec_bcj.c │ │ ├── xz_dec_lzma2.c │ │ ├── xz_dec_stream.c │ │ ├── xz_dec_syms.c │ │ ├── xz_lzma2.h │ │ ├── xz_private.h │ │ └── xz_stream.h │ └── zlib_inflate │ │ ├── Makefile │ │ ├── inffast.c │ │ ├── inffast.h │ │ ├── inffixed.h │ │ ├── inflate.c │ │ ├── inflate.h │ │ ├── inflate_syms.c │ │ ├── inftrees.c │ │ ├── inftrees.h │ │ ├── infutil.c │ │ └── infutil.h ├── Freetype2Lib.inf ├── FstabLib │ ├── Fstab.c │ ├── FstabLib.inf │ ├── FstabPriv.h │ └── LICENSE.txt ├── IniLib.inf ├── JpegLib.inf ├── MakeDosFsLib │ ├── MakeDosFsLib.inf │ ├── device_info.h │ ├── mkfs.fat.c │ └── msdos_fs.h ├── MenuLib │ ├── Menu.c │ ├── Menu.h │ └── MenuLib.inf ├── PngLib │ ├── PngLib.inf │ └── pnglibconf_uefi.h ├── SquirrelLib.inf ├── UEFIRamdiskLib │ ├── UEFIRamdisk.c │ └── UEFIRamdiskLib.inf ├── UtilLib │ ├── Util.c │ └── UtilLib.inf └── ZLib.inf ├── License.txt ├── LicenseExceptions.txt ├── Loader.c ├── Settings.c ├── fonts ├── Roboto-Medium.ttf └── Roboto-Regular.ttf └── icons ├── android.png ├── download_mode.png ├── efi_shell.png ├── fileexplorer.png ├── ic_arrow_forward_black_24px.svg ├── ic_fso_default.png ├── ic_fso_folder.png ├── ic_more_vert_white_24dp.png ├── ic_settings_black_24dp.png ├── power_off.png ├── reboot.png ├── reboot_bootloader.png ├── reboot_recovery.png ├── recovery_clockwork.png ├── recovery_cyanogen.png ├── recovery_lglaf.png ├── recovery_twrp.png ├── recovery_xiaomi.png ├── rom_aospa.png ├── rom_omni.png ├── sony.png ├── storage.png └── uefi.png /EFIDroid.ini: -------------------------------------------------------------------------------- 1 | [parseopts] 2 | extend = 1 3 | 4 | [uefird.fonts_roboto_regular] 5 | source = $(MODULE_DIR)/fonts 6 | destination = fonts 7 | 8 | [uefird.icons] 9 | source = $(MODULE_DIR)/icons 10 | destination = icons 11 | -------------------------------------------------------------------------------- /EFIDroidUi.dec: -------------------------------------------------------------------------------- 1 | [Defines] 2 | DEC_SPECIFICATION = 0x00010005 3 | PACKAGE_NAME = EFIDroidUi 4 | PACKAGE_GUID = 1db8bf12-1b3d-4d8d-99e8-23309e10d5ee 5 | PACKAGE_VERSION = 0.1 6 | 7 | [Includes] 8 | Include 9 | ../../EFIDroidModules/squirrel/include 10 | 11 | [Guids.common] 12 | gEFIDroidVariableGuid = { 0x7586a741, 0x84f7, 0x43d1, { 0x82, 0x05, 0xda, 0x70, 0x69, 0xeb, 0x05, 0x4d } } 13 | gEFIDroidVariableDataGuid = { 0x7586a741, 0x84f7, 0x43d1, { 0x82, 0x05, 0xda, 0x70, 0x69, 0xeb, 0x05, 0x4e } } 14 | -------------------------------------------------------------------------------- /EFIDroidUi.dsc.inc: -------------------------------------------------------------------------------- 1 | [LibraryClasses] 2 | Freetype2Lib|EFIDroidUEFIApps/EFIDroidUi/Library/Freetype2Lib.inf 3 | ZLib|EFIDroidUEFIApps/EFIDroidUi/Library/ZLib.inf 4 | PngLib|EFIDroidUEFIApps/EFIDroidUi/Library/PngLib/PngLib.inf 5 | JpegLib|EFIDroidUEFIApps/EFIDroidUi/Library/JpegLib.inf 6 | AromaLib|EFIDroidUEFIApps/EFIDroidUi/Library/AromaLib/AromaLib.inf 7 | SquirrelLib|EFIDroidUEFIApps/EFIDroidUi/Library/SquirrelLib.inf 8 | BootLib|EFIDroidUEFIApps/EFIDroidUi/Library/BootLib/BootLib.inf 9 | FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf 10 | 11 | CpioLib|EFIDroidUEFIApps/EFIDroidUi/Library/CpioLib/CpioLib.inf 12 | DecompressLib|EFIDroidUEFIApps/EFIDroidUi/Library/DecompressLib/DecompressLib.inf 13 | FstabLib|EFIDroidUEFIApps/EFIDroidUi/Library/FstabLib/FstabLib.inf 14 | IniLib|EFIDroidUEFIApps/EFIDroidUi/Library/IniLib.inf 15 | EFIDroidMenuLib|EFIDroidUEFIApps/EFIDroidUi/Library/MenuLib/MenuLib.inf 16 | UEFIRamdiskLib|EFIDroidUEFIApps/EFIDroidUi/Library/UEFIRamdiskLib/UEFIRamdiskLib.inf 17 | UtilLib|EFIDroidUEFIApps/EFIDroidUi/Library/UtilLib/UtilLib.inf 18 | MakeDosFsLib|EFIDroidUEFIApps/EFIDroidUi/Library/MakeDosFsLib/MakeDosFsLib.inf 19 | 20 | [PcdsFixedAtBuild] 21 | gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE 22 | 23 | [LibraryClasses.common.UEFI_APPLICATION] 24 | UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManagerLib.inf 25 | ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf 26 | 27 | [LibraryClasses.ARM] 28 | TimerLib|LittleKernelPkg/Library/LKTimerLib/LKTimerLib.inf 29 | 30 | !include StdLib/StdLibNoShell.inc 31 | -------------------------------------------------------------------------------- /EFIDroidUi.h: -------------------------------------------------------------------------------- 1 | #ifndef __EFIDROIDUI_H__ 2 | #define __EFIDROIDUI_H__ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | #include 37 | 38 | extern EFI_GUID gEFIDroidVariableGuid; 39 | extern EFI_GUID gEFIDroidVariableDataGuid; 40 | extern MENU_OPTION *mBootMenuMain; 41 | extern EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *gEfiDevicePathToTextProtocol; 42 | extern EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *gEfiDevicePathFromTextProtocol; 43 | extern lkapi_t *mLKApi; 44 | extern multiboot_handle_t *gFastbootMBHandle; 45 | 46 | #define STRING_LIST_SIGNATURE SIGNATURE_32 ('s', 't', 'r', 'l') 47 | typedef struct { 48 | UINTN Signature; 49 | LIST_ENTRY Link; 50 | 51 | CHAR16 *VariableName; 52 | } STRING_LIST_ITEM; 53 | 54 | EFI_STATUS 55 | MainMenuUpdateUi ( 56 | VOID 57 | ); 58 | 59 | EFI_STATUS 60 | FileExplorerCallback ( 61 | IN MENU_ENTRY* This 62 | ); 63 | 64 | VOID 65 | FileExplorerUpdate ( 66 | IN MENU_ENTRY* This 67 | ); 68 | 69 | EFI_STATUS 70 | SettingsMenuShow ( 71 | VOID 72 | ); 73 | 74 | VOID 75 | AddSystemToFastbootMenu ( 76 | MENU_ENTRY *Entry, 77 | multiboot_handle_t *mbhandle 78 | ); 79 | 80 | VOID 81 | FastbootAddInternalROM ( 82 | VOID 83 | ); 84 | 85 | #endif /* __EFIDROIDUI_H__ */ 86 | -------------------------------------------------------------------------------- /EFIDroidUi.inf: -------------------------------------------------------------------------------- 1 | [Defines] 2 | INF_VERSION = 0x00010006 3 | BASE_NAME = EFIDroidUi 4 | FILE_GUID = 1db8bf12-1b3d-4d8d-99e8-23309e10d5ee 5 | MODULE_TYPE = UEFI_APPLICATION 6 | VERSION_STRING = 0.1 7 | ENTRY_POINT = StdCEntryLib 8 | 9 | [Sources] 10 | EFIDroidUi.c 11 | FileExplorer.c 12 | Settings.c 13 | 14 | [Packages] 15 | StdLib/StdLib.dec 16 | MdePkg/MdePkg.dec 17 | MdeModulePkg/MdeModulePkg.dec 18 | LittleKernelPkg/LittleKernelPkg.dec 19 | EFIDroidUEFIApps/EFIDroidUi/EFIDroidUi.dec 20 | EFIDroidUEFIApps/EFIDroidUi/Library/AromaLib/AromaLib.dec 21 | EFIDroidUEFIApps/EFIDroidUi/Library/BootLib/BootLib.dec 22 | 23 | [LibraryClasses] 24 | LibC 25 | UefiBootManagerLib 26 | DebugLib 27 | DxeServicesTableLib 28 | HiiLib 29 | HobLib 30 | UefiLib 31 | LKApiLib 32 | UEFIRamdiskLib 33 | EFIDroidMenuLib 34 | CpioLib 35 | DecompressLib 36 | IniLib 37 | FileHandleLib 38 | FstabLib 39 | UtilLib 40 | MakeDosFsLib 41 | SquirrelLib 42 | StdCEntryLib 43 | UefiApplicationEntryPoint 44 | BootLib 45 | FdtLib 46 | 47 | # ARM support 48 | [Sources.ARM] 49 | AndroidLocator.c 50 | Loader.c 51 | Fastboot.c 52 | FastbootCommands.c 53 | 54 | [Packages.ARM] 55 | ArmPkg/ArmPkg.dec 56 | 57 | [LibraryClasses.ARM] 58 | CacheMaintenanceLib 59 | 60 | [Protocols] 61 | gEfiLoadedImageProtocolGuid 62 | gEfiDevicePathToTextProtocolGuid 63 | gEfiPartitionNameProtocolGuid 64 | gEfiBlockIoProtocolGuid 65 | gEfiRamDiskProtocolGuid 66 | gEfiDevicePathFromTextProtocolGuid 67 | 68 | [Guids] 69 | gEFIDroidVariableGuid 70 | gEfiFileSystemVolumeLabelInfoIdGuid 71 | -------------------------------------------------------------------------------- /Include/Internal/AndroidLocator.h: -------------------------------------------------------------------------------- 1 | #ifndef __INTERNAL_ANDROIDLOCATOR_H__ 2 | #define __INTERNAL_ANDROIDLOCATOR_H__ 3 | 4 | #define MENU_ANDROID_BOOT_ENTRY_SIGNATURE SIGNATURE_32 ('m', 'a', 'b', 'e') 5 | 6 | typedef struct { 7 | UINTN Signature; 8 | bootimg_context_t *context; 9 | multiboot_handle_t *mbhandle; 10 | BOOLEAN DisablePatching; 11 | BOOLEAN IsRecovery; 12 | LAST_BOOT_ENTRY LastBootEntry; 13 | } MENU_ENTRY_PDATA; 14 | 15 | #define RECOVERY_MENU_SIGNATURE SIGNATURE_32 ('r', 'e', 'c', 'm') 16 | 17 | typedef struct { 18 | UINTN Signature; 19 | LIST_ENTRY Link; 20 | 21 | MENU_OPTION *SubMenu; 22 | MENU_ENTRY *RootEntry; 23 | MENU_ENTRY *BaseEntry; 24 | MENU_ENTRY *NoPatchEntry; 25 | } RECOVERY_MENU; 26 | 27 | typedef struct { 28 | CHAR8 Name[30]; 29 | CHAR8 IconPath[30]; 30 | BOOLEAN IsRecovery; 31 | BOOLEAN IsDual; 32 | } IMGINFO_CACHE; 33 | 34 | EFI_STATUS 35 | AndroidLocatorInit ( 36 | VOID 37 | ); 38 | 39 | EFI_STATUS 40 | AndroidLocatorAddItems ( 41 | VOID 42 | ); 43 | 44 | EFI_STATUS 45 | AndroidLocatorHandleRecoveryMode ( 46 | LAST_BOOT_ENTRY *LastBootEntry 47 | ); 48 | 49 | FSTAB* 50 | AndroidLocatorGetMultibootFsTab ( 51 | VOID 52 | ); 53 | 54 | EFI_FILE_PROTOCOL* 55 | AndroidLocatorGetEspDir ( 56 | VOID 57 | ); 58 | 59 | CONST CHAR8* 60 | AndroidLocatorGetInternalROMName ( 61 | VOID 62 | ); 63 | 64 | CONST CHAR8* 65 | AndroidLocatorGetInternalROMIconPath ( 66 | VOID 67 | ); 68 | 69 | UINTN 70 | AndroidLocatorGetMenuIdFromLastBootEntry ( 71 | MENU_OPTION *Menu, 72 | LAST_BOOT_ENTRY *LastBootEntry 73 | ); 74 | 75 | #endif /* __INTERNAL_ANDROIDLOCATOR_H__ */ 76 | -------------------------------------------------------------------------------- /Include/Internal/Fastboot.h: -------------------------------------------------------------------------------- 1 | #ifndef __INTERNAL_FASTBOOT_H__ 2 | #define __INTERNAL_FASTBOOT_H__ 3 | 4 | #define FASTBOOT_COMMAND_MAX_LENGTH 64 5 | 6 | VOID 7 | FastbootInit ( 8 | VOID 9 | ); 10 | 11 | VOID 12 | FastbootInfo ( 13 | CONST CHAR8 *Reason 14 | ); 15 | 16 | VOID 17 | FastbootFail ( 18 | CONST CHAR8 *Reason 19 | ); 20 | 21 | VOID 22 | FastbootOkay ( 23 | CONST CHAR8 *Info 24 | ); 25 | 26 | VOID 27 | FastbootRegister ( 28 | CHAR8 *Prefix, 29 | VOID (*Handle)(CHAR8 *Arg, VOID *Data, UINT32 Size) 30 | ); 31 | 32 | VOID 33 | FastbootPublish ( 34 | CONST CHAR8 *Name, 35 | CONST CHAR8 *Value 36 | ); 37 | 38 | VOID 39 | FastbootCommandsAdd ( 40 | VOID 41 | ); 42 | 43 | VOID 44 | FastbootRequestStop ( 45 | VOID 46 | ); 47 | 48 | VOID 49 | FastbootStopNow ( 50 | VOID 51 | ); 52 | 53 | VOID 54 | FastbootSendString ( 55 | IN CONST CHAR8 *Data, 56 | IN UINTN Size 57 | ); 58 | 59 | VOID 60 | FastbootSendBuf ( 61 | IN CONST VOID *Data, 62 | IN UINTN Size 63 | ); 64 | 65 | #endif /* __INTERNAL_FASTBOOT_H__ */ 66 | -------------------------------------------------------------------------------- /Include/Internal/Loader.h: -------------------------------------------------------------------------------- 1 | #ifndef __INTERNAL_LOADER_H__ 2 | #define __INTERNAL_LOADER_H__ 3 | 4 | typedef enum { 5 | LAST_BOOT_TYPE_BLOCKIO = 0, 6 | LAST_BOOT_TYPE_FILE, 7 | LAST_BOOT_TYPE_MULTIBOOT, 8 | } LAST_BOOT_TYPE; 9 | 10 | typedef struct { 11 | // common 12 | LAST_BOOT_TYPE Type; 13 | CHAR8 TextDevicePath[200]; 14 | 15 | // blockio: unused 16 | // file: boot image file path 17 | // multiboot: multiboot.ini file path 18 | CHAR8 FilePathName[1024]; 19 | } LAST_BOOT_ENTRY; 20 | 21 | typedef struct { 22 | // ini values 23 | CHAR8 *Name; 24 | CHAR8 *Description; 25 | CHAR8 *ReplacementCmdline; 26 | LIST_ENTRY Partitions; 27 | 28 | // handles 29 | EFI_HANDLE DeviceHandle; 30 | EFI_FILE_PROTOCOL* ROMDirectory; 31 | 32 | // set by MultibootCallback 33 | CHAR8* MultibootConfig; 34 | } multiboot_handle_t; 35 | 36 | #define PARTITION_LIST_SIGNATURE SIGNATURE_32 ('m', 'b', 'p', 't') 37 | typedef struct { 38 | UINTN Signature; 39 | LIST_ENTRY Link; 40 | 41 | CHAR16 *Name; 42 | CHAR16 *Value; 43 | BOOLEAN IsFile; 44 | } PARTITION_LIST_ITEM; 45 | 46 | EFI_STATUS 47 | LoaderBootFromBlockIo ( 48 | IN EFI_BLOCK_IO_PROTOCOL *BlockIo, 49 | IN multiboot_handle_t *mbhandle, 50 | IN BOOLEAN DisablePatching, 51 | IN BOOLEAN IsRecovery, 52 | IN LAST_BOOT_ENTRY *LastBootEntry 53 | ); 54 | 55 | EFI_STATUS 56 | LoaderBootFromFile ( 57 | IN EFI_FILE_PROTOCOL *File, 58 | IN multiboot_handle_t *mbhandle, 59 | IN BOOLEAN DisablePatching, 60 | IN BOOLEAN IsRecovery, 61 | IN LAST_BOOT_ENTRY *LastBootEntry 62 | ); 63 | 64 | EFI_STATUS 65 | LoaderBootFromBuffer ( 66 | IN VOID *Buffer, 67 | IN UINTN Size, 68 | IN multiboot_handle_t *mbhandle, 69 | IN BOOLEAN DisablePatching, 70 | IN BOOLEAN IsRecovery, 71 | IN LAST_BOOT_ENTRY *LastBootEntry 72 | ); 73 | 74 | EFI_STATUS 75 | LoaderBootContext ( 76 | IN bootimg_context_t *context, 77 | IN multiboot_handle_t *mbhandle, 78 | IN BOOLEAN DisablePatching, 79 | IN BOOLEAN IsRecovery, 80 | IN LAST_BOOT_ENTRY *LastBootEntry 81 | ); 82 | 83 | EFI_STATUS 84 | LoaderGetDecompressedRamdisk ( 85 | IN bootimg_context_t *context, 86 | OUT CPIO_NEWC_HEADER **DecompressedRamdiskOut 87 | ); 88 | 89 | VOID 90 | custom_init_context ( 91 | IN bootimg_context_t *context 92 | ); 93 | 94 | INTN 95 | libboot_identify_blockio ( 96 | IN EFI_BLOCK_IO_PROTOCOL *BlockIo, 97 | IN bootimg_context_t *context 98 | ); 99 | 100 | INTN 101 | libboot_identify_file ( 102 | IN EFI_FILE_PROTOCOL *File, 103 | IN bootimg_context_t *context 104 | ); 105 | 106 | VOID 107 | LoaderAddPartitionItem ( 108 | multiboot_handle_t *mbhandle, 109 | CONST CHAR8 *Name, 110 | CONST CHAR8 *Value 111 | ); 112 | 113 | PARTITION_LIST_ITEM* 114 | LoaderGetPartitionItem ( 115 | multiboot_handle_t *mbhandle, 116 | CONST CHAR16 *Name 117 | ); 118 | 119 | VOID 120 | LoaderFreePartitionItems ( 121 | multiboot_handle_t *mbhandle 122 | ); 123 | 124 | #endif /* __INTERNAL_LOADER_H__ */ 125 | -------------------------------------------------------------------------------- /Include/Library/Cpio.h: -------------------------------------------------------------------------------- 1 | #ifndef CPIO_H 2 | #define CPIO_H 1 3 | 4 | #define CPIO_NEWC_MAGIC "070701" 5 | #define CPIO_TRAILER "TRAILER!!!" 6 | 7 | #define CPIO_MODE_REG 0100000 8 | #define CPIO_MODE_DIR 0040000 9 | 10 | typedef struct 11 | { 12 | CHAR8 c_magic[6]; 13 | CHAR8 c_ino[8]; 14 | CHAR8 c_mode[8]; 15 | CHAR8 c_uid[8]; 16 | CHAR8 c_gid[8]; 17 | CHAR8 c_nlink[8]; 18 | CHAR8 c_mtime[8]; 19 | CHAR8 c_filesize[8]; 20 | CHAR8 c_devmajor[8]; 21 | CHAR8 c_devminor[8]; 22 | CHAR8 c_rdevmajor[8]; 23 | CHAR8 c_rdevminor[8]; 24 | CHAR8 c_namesize[8]; 25 | CHAR8 c_check[8]; 26 | } PACKED CPIO_NEWC_HEADER; 27 | 28 | UINT32 CpioStrToUl (CHAR8 *in); 29 | VOID CpioUlToStr (CHAR8 *buf, UINT32 in); 30 | INT32 CpioIsValid (VOID *ptr); 31 | INT32 CpioHasNext (CPIO_NEWC_HEADER * hdr); 32 | UINTN CpioPredictObjSize (UINT32 namesize, 33 | UINT32 filesize); 34 | UINTN CpioGetObjSize (CPIO_NEWC_HEADER * hdr); 35 | EFI_STATUS 36 | CpioGetData ( 37 | CPIO_NEWC_HEADER *hdr, 38 | VOID **Ptr, 39 | UINTN *Size 40 | ); 41 | CPIO_NEWC_HEADER *CpioGetLast (CPIO_NEWC_HEADER * hdr); 42 | CPIO_NEWC_HEADER *CpioGetByName (CPIO_NEWC_HEADER * hdr, CONST CHAR8 *name); 43 | 44 | CPIO_NEWC_HEADER *CpioCreateObj (CPIO_NEWC_HEADER * hdr, 45 | CONST CHAR8 *name, CONST VOID *data, 46 | UINTN data_size, UINT32 mode); 47 | 48 | #endif /* ! CPIO_H */ 49 | -------------------------------------------------------------------------------- /Include/Library/Decompress.h: -------------------------------------------------------------------------------- 1 | #ifndef DECOMPRESS_GENERIC_H 2 | #define DECOMPRESS_GENERIC_H 3 | 4 | typedef int (*decompress_fn) (unsigned char *inbuf, long len, 5 | long (*fill)(void*, unsigned long), 6 | long (*flush)(void*, unsigned long), 7 | unsigned char *outbuf, 8 | long *posp, 9 | void(*error)(char *x)); 10 | 11 | /* inbuf - input buffer 12 | *len - len of pre-read data in inbuf 13 | *fill - function to fill inbuf when empty 14 | *flush - function to write out outbuf 15 | *outbuf - output buffer 16 | *posp - if non-null, input position (number of bytes read) will be 17 | * returned here 18 | * 19 | *If len != 0, inbuf should contain all the necessary input data, and fill 20 | *should be NULL 21 | *If len = 0, inbuf can be NULL, in which case the decompressor will allocate 22 | *the input buffer. If inbuf != NULL it must be at least XXX_IOBUF_SIZE bytes. 23 | *fill will be called (repeatedly...) to read data, at most XXX_IOBUF_SIZE 24 | *bytes should be read per call. Replace XXX with the appropriate decompressor 25 | *name, i.e. LZMA_IOBUF_SIZE. 26 | * 27 | *If flush = NULL, outbuf must be large enough to buffer all the expected 28 | *output. If flush != NULL, the output buffer will be allocated by the 29 | *decompressor (outbuf = NULL), and the flush function will be called to 30 | *flush the output buffer at the appropriate time (decompressor and stream 31 | *dependent). 32 | */ 33 | 34 | 35 | /* Utility routine to detect the decompression method */ 36 | decompress_fn decompress_method(const unsigned char *inbuf, long len, 37 | const char **name); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Include/Library/Fstab.h: -------------------------------------------------------------------------------- 1 | #ifndef FSTAB_H 2 | #define FSTAB_H 1 3 | 4 | /* 5 | * The entries must be kept in the same order as they were seen in the fstab. 6 | * Unless explicitly requested, a lookup on mount point should always 7 | * return the 1st one. 8 | */ 9 | struct fstab { 10 | int num_entries; 11 | struct fstab_rec *recs; 12 | char *fstab_filename; 13 | }; 14 | 15 | struct fstab_rec { 16 | char *blk_device; 17 | char *mount_point; 18 | char *fs_type; 19 | unsigned long flags; 20 | char *fs_options; 21 | int fs_mgr_flags; 22 | char *key_loc; 23 | char *verity_loc; 24 | long long length; 25 | char *label; 26 | int partnum; 27 | int swap_prio; 28 | unsigned int zram_size; 29 | unsigned int zram_streams; 30 | char* esp; 31 | }; 32 | 33 | typedef struct fstab FSTAB; 34 | typedef struct fstab_rec FSTAB_REC; 35 | 36 | struct fstab *FstabParse(CONST CHAR8 *data, UINTN datasize); 37 | void FsTabFree(struct fstab *fstab); 38 | 39 | int FstabIsMultiboot(struct fstab_rec *fstab); 40 | int FstabIsUEFI(struct fstab_rec *fstab); 41 | int FstabIsNVVARS(struct fstab_rec *fstab); 42 | FSTAB_REC* FstabGetESP(struct fstab *fstab); 43 | CHAR8* FstabGetPartitionName(FSTAB_REC* Rec); 44 | FSTAB_REC* FstabGetByPartitionName(FSTAB *fstab, CONST CHAR8* SearchName); 45 | 46 | #endif /* ! FSTAB_H */ 47 | -------------------------------------------------------------------------------- /Include/Library/MakeDosFs.h: -------------------------------------------------------------------------------- 1 | #ifndef MAKEDOSFS_H 2 | #define MAKEDOSFS_H 1 3 | 4 | #include 5 | #include 6 | 7 | EFI_STATUS 8 | MakeDosFs ( 9 | VOID* Buffer, 10 | UINT64 BufferSize 11 | ); 12 | 13 | #endif /* ! MAKEDOSFS_H */ 14 | -------------------------------------------------------------------------------- /Include/Library/Menu.h: -------------------------------------------------------------------------------- 1 | #ifndef MENU_H 2 | #define MENU_H 1 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #define MENU_SIGNATURE SIGNATURE_32 ('m', 'e', 'n', 'u') 10 | #define MENU_ENTRY_SIGNATURE SIGNATURE_32 ('e', 'n', 't', 'r') 11 | 12 | #define MENU_ITEM_FLAG_MASK_ICON_COLOR 0x1 /* mask icon with text color */ 13 | #define MENU_ITEM_FLAG_SEPARATOR 0x2 /* add separator below item */ 14 | #define MENU_ITEM_FLAG_SEPARATOR_ALIGN_TEXT 0x4 /* align the separator line with text position */ 15 | 16 | typedef struct _LIBAROMA_CANVAS * LIBAROMA_CANVASP; 17 | 18 | typedef struct _MENU_ENTRY MENU_ENTRY; 19 | struct _MENU_ENTRY { 20 | UINTN Signature; 21 | LIST_ENTRY Link; 22 | 23 | // UI 24 | CHAR8* Name; 25 | CHAR8* Description; 26 | LIBAROMA_STREAMP Icon; 27 | BOOLEAN ShowToggle; 28 | BOOLEAN ToggleEnabled; 29 | UINTN ItemHeight; 30 | BOOLEAN IsGroupItem; 31 | 32 | // selection 33 | BOOLEAN Hidden; 34 | BOOLEAN Selectable; 35 | VOID (*Update) (struct _MENU_ENTRY* This); 36 | 37 | // callback 38 | EFI_STATUS (*Callback) (struct _MENU_ENTRY* This); 39 | EFI_STATUS (*LongPressCallback) (struct _MENU_ENTRY* This); 40 | BOOLEAN ResetGop; 41 | BOOLEAN HideBootMessage; 42 | 43 | // Private 44 | VOID *Private; 45 | VOID (*FreeCallback)(struct _MENU_ENTRY* Entry); 46 | EFI_STATUS (*CloneCallback)(struct _MENU_ENTRY* BaseEntry, struct _MENU_ENTRY* Entry); 47 | }; 48 | 49 | typedef struct _MENU_OPTION MENU_OPTION; 50 | struct _MENU_OPTION { 51 | UINTN Signature; 52 | 53 | // entries 54 | LIST_ENTRY Head; 55 | 56 | // UI 57 | CHAR8 *Title; 58 | UINTN ListWidth; 59 | UINT32 BackgroundColor; 60 | UINT32 SelectionColor; 61 | UINT8 SelectionAlpha; 62 | UINT32 TextColor; 63 | UINT32 TextSelectionColor; 64 | BOOLEAN EnableShadow; 65 | BOOLEAN EnableScrollbar; 66 | UINT32 ItemFlags; 67 | LIBAROMA_STREAMP ActionIcon; 68 | 69 | // callback 70 | EFI_STATUS (*BackCallback) (struct _MENU_OPTION* This); 71 | EFI_STATUS (*ActionCallback) (struct _MENU_OPTION* This); 72 | 73 | // selection 74 | UINTN OptionNumber; 75 | INT32 Selection; 76 | BOOLEAN HideBackIcon; 77 | 78 | // private 79 | VOID *Private; 80 | 81 | // internal 82 | LIBAROMA_CANVASP cv; 83 | LIBAROMA_CANVASP cva; 84 | }; 85 | 86 | typedef struct _SCREENSHOT SCREENSHOT; 87 | struct _SCREENSHOT { 88 | struct _SCREENSHOT *Next; 89 | VOID *Data; 90 | UINTN Len; 91 | }; 92 | 93 | extern SCREENSHOT *gScreenShotList; 94 | 95 | EFI_STATUS 96 | MenuInit ( 97 | VOID 98 | ); 99 | 100 | VOID 101 | MenuEnter ( 102 | IN UINT16 TimeoutDefault, 103 | IN BOOLEAN ConnectAllHappened 104 | ); 105 | 106 | VOID 107 | MenuDeInit ( 108 | VOID 109 | ); 110 | 111 | MENU_OPTION* 112 | MenuCreate ( 113 | VOID 114 | ); 115 | 116 | VOID 117 | MenuFree ( 118 | MENU_OPTION *Menu 119 | ); 120 | 121 | MENU_ENTRY* 122 | MenuCreateEntry ( 123 | VOID 124 | ); 125 | 126 | MENU_ENTRY* 127 | MenuCreateGroupEntry ( 128 | VOID 129 | ); 130 | 131 | MENU_ENTRY* 132 | MenuCloneEntry ( 133 | MENU_ENTRY* BaseEntry 134 | ); 135 | 136 | MENU_OPTION* 137 | MenuClone ( 138 | MENU_OPTION *Menu 139 | ); 140 | 141 | VOID 142 | MenuFreeEntry ( 143 | MENU_ENTRY* Entry 144 | ); 145 | 146 | VOID 147 | MenuAddEntry ( 148 | MENU_OPTION *Menu, 149 | MENU_ENTRY *Entry 150 | ); 151 | 152 | VOID 153 | MenuRemoveEntry ( 154 | MENU_OPTION *Menu, 155 | MENU_ENTRY *Entry 156 | ); 157 | 158 | 159 | MENU_ENTRY * 160 | MenuGetEntryById ( 161 | MENU_OPTION *MenuOption, 162 | UINTN MenuNumber 163 | ); 164 | 165 | MENU_ENTRY * 166 | MenuGetEntryByUiId ( 167 | MENU_OPTION *Menu, 168 | UINTN MenuNumber 169 | ); 170 | 171 | VOID 172 | InvalidateMenu( 173 | MENU_OPTION *Menu 174 | ); 175 | 176 | VOID 177 | InvalidateActiveMenu( 178 | VOID 179 | ); 180 | 181 | VOID 182 | RenderBootScreen( 183 | MENU_ENTRY *Entry 184 | ); 185 | 186 | VOID 187 | MenuDrawDarkBackground ( 188 | VOID 189 | ); 190 | 191 | VOID MenuShowMessage( 192 | CONST CHAR8* Title, 193 | CONST CHAR8* Message 194 | ); 195 | 196 | INT32 MenuShowDialog( 197 | CONST CHAR8* Title, 198 | CONST CHAR8* Message, 199 | CONST CHAR8* Button1, 200 | CONST CHAR8* Button2 201 | ); 202 | 203 | VOID MenuShowProgressDialog( 204 | CONST CHAR8* Text, 205 | BOOLEAN ShowBackground 206 | ); 207 | 208 | EFI_STATUS 209 | MenuShowSelectionDialog ( 210 | MENU_OPTION* Menu 211 | ); 212 | 213 | VOID 214 | MenuPreBoot ( 215 | VOID 216 | ); 217 | 218 | VOID 219 | MenuPostBoot ( 220 | VOID 221 | ); 222 | 223 | VOID 224 | RenderActiveMenu( 225 | VOID 226 | ); 227 | 228 | VOID 229 | MenuStackPush ( 230 | MENU_OPTION *Menu 231 | ); 232 | 233 | MENU_OPTION* 234 | MenuStackPop ( 235 | VOID 236 | ); 237 | 238 | VOID 239 | MenuShowTutorial ( 240 | VOID 241 | ); 242 | 243 | #endif /* ! MENU_H */ 244 | -------------------------------------------------------------------------------- /Include/Library/UEFIRamdisk.h: -------------------------------------------------------------------------------- 1 | #ifndef UEFIRAMDISK_H 2 | #define UEFIRAMDISK_H 1 3 | 4 | EFI_STATUS 5 | EFIAPI 6 | UEFIRamdiskGetFile ( 7 | CONST CHAR8 *Path, 8 | VOID **Ptr, 9 | UINTN *Size 10 | ); 11 | 12 | #endif /* ! UEFIRAMDISK_H */ 13 | -------------------------------------------------------------------------------- /Include/Library/Util.h: -------------------------------------------------------------------------------- 1 | #ifndef UTIL_H 2 | #define UTIL_H 1 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | #include 9 | 10 | #ifndef LIBUTIL_NOAROMA 11 | #include 12 | #endif 13 | 14 | #ifdef MDE_CPU_ARM 15 | #include 16 | #endif 17 | 18 | #define ROUNDUP(a, b) (((a) + ((b)-1)) & ~((b)-1)) 19 | #define ROUNDDOWN(a, b) ((a) & ~((b)-1)) 20 | #define IS_DEVICE_PATH_NODE(node,type,subtype) (((node)->Type == (type)) && ((node)->SubType == (subtype))) 21 | 22 | #if defined (MDE_CPU_IA32) 23 | #define CACHE_LINE 32 24 | #elif defined (MDE_CPU_X64) 25 | #define CACHE_LINE 32 26 | #elif defined (MDE_CPU_ARM) 27 | #define CACHE_LINE ArmDataCacheLineLength() 28 | #else 29 | #error "Unsupported platform" 30 | #endif 31 | 32 | #define STACKBUF_DMA_ALIGN(var, size) \ 33 | UINT8 __##var[(size) + CACHE_LINE]; UINT8 *var = (UINT8 *)(ROUNDUP((UINTN)__##var, CACHE_LINE)) 34 | 35 | #define BASE64_ENCODED_SIZE(n) (ROUNDUP(4*((n)/3)+1, 4)+1) 36 | 37 | #define UtilBase64Encode __b64_ntop 38 | #define UtilBase64Decode __b64_pton 39 | 40 | INT32 __b64_ntop (UINT8 CONST *, UINTN, CHAR8 *, UINTN); 41 | INT32 __b64_pton (CHAR8 CONST *, UINT8 *, UINTN); 42 | 43 | typedef 44 | EFI_STATUS 45 | (EFIAPI *PROTOCOL_INSTANCE_CALLBACK)( 46 | IN EFI_HANDLE Handle, 47 | IN VOID *Instance, 48 | IN VOID *Context 49 | ); 50 | 51 | typedef 52 | RETURN_STATUS 53 | (EFIAPI *VARIABLE_ITERATION_CALLBACK)( 54 | IN VOID *Context, 55 | IN CHAR16 *VariableName, 56 | IN EFI_GUID *VendorGuid, 57 | IN UINT32 Attributes, 58 | IN UINTN DataSize, 59 | IN VOID *Data 60 | ); 61 | 62 | // so we don't need std headers 63 | typedef 64 | CHAR8* 65 | (*ini_reader)( 66 | CHAR8 *String, 67 | INT32 Size, 68 | VOID *Stream 69 | ); 70 | 71 | typedef 72 | INT32 73 | (*ini_handler)( 74 | VOID *User, 75 | CONST CHAR8 *Section, 76 | CONST CHAR8 *Name, 77 | CONST CHAR8 *Value 78 | ); 79 | 80 | typedef struct _SYSTEM_MEMORY_RESOURCE { 81 | LIST_ENTRY Link; // This attribute must be the first entry of this structure (to avoid pointer computation) 82 | EFI_PHYSICAL_ADDRESS PhysicalStart; 83 | UINT64 ResourceLength; 84 | } SYSTEM_MEMORY_RESOURCE; 85 | 86 | INT32 87 | ini_parse_stream ( 88 | ini_reader Reader, 89 | VOID *Stream, 90 | ini_handler Handler, 91 | VOID *User 92 | ); 93 | 94 | CHAR8* 95 | Unicode2Ascii ( 96 | CONST CHAR16* UnicodeStr 97 | ); 98 | 99 | CHAR16* 100 | Ascii2Unicode ( 101 | CONST CHAR8* AsciiStr 102 | ); 103 | 104 | CHAR8* 105 | AsciiStrDup ( 106 | IN CONST CHAR8* Str 107 | ); 108 | 109 | CHAR16* 110 | UnicodeStrDup ( 111 | IN CONST CHAR16* Str 112 | ); 113 | 114 | VOID 115 | PathToUnix( 116 | CHAR16* fname 117 | ); 118 | 119 | VOID 120 | PathToUefi( 121 | CHAR16* fname 122 | ); 123 | 124 | BOOLEAN 125 | NodeIsDir ( 126 | IN EFI_FILE_INFO *NodeInfo 127 | ); 128 | 129 | #ifndef LIBUTIL_NOAROMA 130 | LIBAROMA_STREAMP 131 | libaroma_stream_ramdisk( 132 | CONST CHAR8* Path 133 | ); 134 | #endif 135 | 136 | UINT32 137 | RangeOverlaps ( 138 | UINT32 x1, 139 | UINT32 x2, 140 | UINT32 y1, 141 | UINT32 y2 142 | ); 143 | 144 | UINT32 145 | RangeLenOverlaps ( 146 | UINT32 x, 147 | UINT32 xl, 148 | UINT32 y, 149 | UINT32 yl 150 | ); 151 | 152 | UINT32 153 | AlignMemoryRange ( 154 | IN UINT32 Addr, 155 | IN OUT UINTN *Size, 156 | OUT UINTN *AddrOffset, 157 | IN UINTN Alignment 158 | ); 159 | 160 | EFI_STATUS 161 | FreeAlignedMemoryRange ( 162 | IN UINT32 Address, 163 | IN OUT UINTN Size, 164 | IN UINTN Alignment 165 | ); 166 | 167 | EFI_STATUS 168 | VisitAllInstancesOfProtocol ( 169 | IN EFI_GUID *Id, 170 | IN PROTOCOL_INSTANCE_CALLBACK CallBackFunction, 171 | IN VOID *Context 172 | ); 173 | 174 | EFI_FILE_HANDLE 175 | UtilOpenRoot ( 176 | IN EFI_HANDLE DeviceHandle 177 | ); 178 | 179 | VOID * 180 | UtilFileInfo ( 181 | IN EFI_FILE_HANDLE FHand, 182 | IN EFI_GUID *InfoType 183 | ); 184 | 185 | CHAR16* 186 | UtilGetTypeFromName ( 187 | IN CHAR16 *FileName 188 | ); 189 | 190 | VOID 191 | UtilToLowerString ( 192 | IN CHAR16 *String 193 | ); 194 | 195 | VOID 196 | UtilAsciiToLowerString ( 197 | IN CHAR8 *String 198 | ); 199 | 200 | CHAR16* 201 | UtilGetExtensionLower ( 202 | IN UINT16 *FileName 203 | ); 204 | 205 | EFI_STATUS 206 | UtilIterateVariables ( 207 | IN VARIABLE_ITERATION_CALLBACK CallbackFunction, 208 | IN VOID *Context 209 | ); 210 | 211 | EFI_STATUS 212 | UtilSetEFIDroidVariable ( 213 | IN CONST CHAR8* Name, 214 | IN CONST CHAR8* Value 215 | ); 216 | 217 | CHAR8* 218 | UtilGetEFIDroidVariable ( 219 | IN CONST CHAR8* Name 220 | ); 221 | 222 | EFI_STATUS 223 | UtilSetEFIDroidDataVariable ( 224 | IN CONST CHAR16 *Name, 225 | IN CONST VOID *Value, 226 | IN UINTN Size 227 | ); 228 | 229 | VOID* 230 | UtilGetEFIDroidDataVariable ( 231 | IN CONST CHAR16* Name 232 | ); 233 | 234 | BOOLEAN 235 | UtilVariableExists ( 236 | IN CONST CHAR16 *Name, 237 | IN CONST EFI_GUID *Guid 238 | ); 239 | 240 | BOOLEAN 241 | SettingBoolGet ( 242 | CONST CHAR8* Name 243 | ); 244 | 245 | VOID 246 | SettingBoolSet ( 247 | CONST CHAR8* Name, 248 | BOOLEAN Value 249 | ); 250 | 251 | INT32 252 | IniParseEfiFile ( 253 | EFI_FILE_PROTOCOL *Filename, 254 | ini_handler Handler, 255 | VOID *User 256 | ); 257 | 258 | EFI_STATUS 259 | UtilReadFileToMemory ( 260 | EFI_FILE_PROTOCOL *File, 261 | VOID **OutBuffer, 262 | UINTN *OutSize 263 | ); 264 | 265 | #ifndef LIBUTIL_NOAROMA 266 | LIBAROMA_STREAMP 267 | libaroma_stream_efifile( 268 | EFI_FILE_PROTOCOL *File 269 | ); 270 | #endif 271 | 272 | EFI_STATUS 273 | UtilGetFvApplicationDevicePath ( 274 | EFI_GUID *FileGuid, 275 | OUT EFI_DEVICE_PATH_PROTOCOL **OutDevicePath 276 | ); 277 | 278 | EFI_STATUS 279 | UtilStartEfiApplication ( 280 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath, 281 | IN UINTN LoadOptionsSize, 282 | IN VOID* LoadOptions 283 | ); 284 | 285 | EFI_STATUS 286 | UtilShutdownUefiBootServices ( 287 | VOID 288 | ); 289 | 290 | EFI_STATUS 291 | UtilGetSystemMemoryResources ( 292 | IN LIST_ENTRY *ResourceList 293 | ); 294 | 295 | #endif /* ! UTIL_H */ 296 | -------------------------------------------------------------------------------- /Library/AromaLib/AromaLib.dec: -------------------------------------------------------------------------------- 1 | [Defines] 2 | DEC_SPECIFICATION = 0x00010005 3 | PACKAGE_NAME = AromaLib 4 | PACKAGE_GUID = ad838f5f-d760-41f3-837e-9d934a43c17b 5 | PACKAGE_VERSION = 0.1 6 | 7 | [Includes] 8 | ../../../../EFIDroidModules/libaroma/include 9 | ../../../../EFIDroidModules/libaroma/src 10 | ../../../../EFIDroidModules/libaroma/libs/freetype/include 11 | ../../../../EFIDroidModules/libaroma/libs/harfbuzz-ng/src 12 | ../../../../EFIDroidModules/libaroma/libs/zlib 13 | ../../../../EFIDroidModules/libaroma/libs/png 14 | ../../../../EFIDroidModules/libaroma/libs/jpeg 15 | -------------------------------------------------------------------------------- /Library/AromaLib/AromaLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = AromaLib 24 | FILE_GUID = ad838f5f-d760-41f3-837e-9d934a43c17b 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = AromaLib 28 | 29 | # 30 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 31 | # 32 | 33 | [Sources] 34 | aroma.c 35 | fb_driver.c 36 | EFIDroidModules/libaroma/src/aroma/version.c 37 | EFIDroidModules/libaroma/src/aroma/graph/artworker.c 38 | EFIDroidModules/libaroma/src/aroma/graph/canvas.c 39 | EFIDroidModules/libaroma/src/aroma/graph/fb.c 40 | EFIDroidModules/libaroma/src/aroma/graph/image.c 41 | EFIDroidModules/libaroma/src/aroma/graph/jpeg.c 42 | EFIDroidModules/libaroma/src/aroma/graph/png.c 43 | EFIDroidModules/libaroma/src/aroma/graph/svg.c 44 | EFIDroidModules/libaroma/src/aroma/graph/text.c 45 | EFIDroidModules/libaroma/src/aroma/graph/draw/blur.c 46 | EFIDroidModules/libaroma/src/aroma/graph/draw/commondraw.c 47 | EFIDroidModules/libaroma/src/aroma/graph/draw/filters.c 48 | EFIDroidModules/libaroma/src/aroma/graph/draw/gradient.c 49 | EFIDroidModules/libaroma/src/aroma/graph/draw/path.c 50 | EFIDroidModules/libaroma/src/aroma/graph/draw/scale.c 51 | EFIDroidModules/libaroma/src/aroma/graph/engine/alignblt.c 52 | EFIDroidModules/libaroma/src/aroma/graph/engine/alpha.c 53 | EFIDroidModules/libaroma/src/aroma/graph/engine/blt.c 54 | EFIDroidModules/libaroma/src/aroma/graph/engine/color.c 55 | EFIDroidModules/libaroma/src/aroma/graph/engine/dither.c 56 | 57 | EFIDroidModules/libaroma/src/aroma/utils/array.c 58 | EFIDroidModules/libaroma/src/aroma/utils/json.c 59 | EFIDroidModules/libaroma/src/aroma/utils/minutf8.c 60 | EFIDroidModules/libaroma/src/aroma/utils/motions.c 61 | #EFIDroidModules/libaroma/src/aroma/utils/runtime.c 62 | EFIDroidModules/libaroma/src/aroma/utils/stream.c 63 | EFIDroidModules/libaroma/src/aroma/utils/strings.c 64 | #EFIDroidModules/libaroma/src/aroma/utils/system.c 65 | EFIDroidModules/libaroma/src/aroma/utils/time.c 66 | #EFIDroidModules/libaroma/src/aroma/utils/zip.c 67 | 68 | EFIDroidModules/libaroma/libs/harfbuzz-ng/src/hb-ucdn/ucdn.c 69 | 70 | [Sources.ARM] 71 | EFIDroidModules/libaroma/src/aroma/arch/arm/memset32.S 72 | 73 | [Sources.X64] 74 | EFIDroidModules/libaroma/src/aroma/arch/x86_64/android_memset16.S 75 | EFIDroidModules/libaroma/src/aroma/arch/x86_64/android_memset32.S 76 | 77 | [Sources.IA32] 78 | EFIDroidModules/libaroma/src/aroma/arch/x86/android_memset16.S 79 | EFIDroidModules/libaroma/src/aroma/arch/x86/android_memset32.S 80 | 81 | [Packages] 82 | StdLib/StdLib.dec 83 | MdePkg/MdePkg.dec 84 | LittleKernelPkg/LittleKernelPkg.dec 85 | EFIDroidUEFIApps/EFIDroidUi/Library/AromaLib/AromaLib.dec 86 | EFIDroidUEFIApps/EFIDroidUi/Library/AromaLib/AromaLibPriv.dec 87 | 88 | [LibraryClasses] 89 | LibC 90 | LibStdio 91 | LibMath 92 | Freetype2Lib 93 | ZLib 94 | PngLib 95 | JpegLib 96 | 97 | [Depex] 98 | TRUE 99 | 100 | [Protocols] 101 | gEfiLKDisplayProtocolGuid 102 | 103 | [BuildOptions] 104 | GCC:*_*_*_CC_FLAGS = -DLIBAROMA_CONFIG_TEXT_NOHARFBUZZ=1 -DLIBAROMA_CONFIG_NOMINZIP=1 -DLIBAROMA_CONFIG_NOPNGWRITE=1 -DLIBAROMA_CONFIG_DEBUG=0 105 | GCC:*_*_*_PP_FLAGS = -DLIBAROMA_CONFIG_NO_UNWIND=1 106 | -------------------------------------------------------------------------------- /Library/AromaLib/AromaLibPriv.dec: -------------------------------------------------------------------------------- 1 | [Defines] 2 | DEC_SPECIFICATION = 0x00010005 3 | PACKAGE_NAME = AromaLib 4 | PACKAGE_GUID = ad838f5f-d760-41f3-837e-9d934a43c17c 5 | PACKAGE_VERSION = 0.1 6 | 7 | [Includes] 8 | Include 9 | -------------------------------------------------------------------------------- /Library/AromaLib/Include/aroma_platform.h: -------------------------------------------------------------------------------- 1 | /********************************************************************[libaroma]* 2 | * Copyright (C) 2011-2015 Ahmad Amarullah (http://amarullz.com/) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *______________________________________________________________________________ 16 | * 17 | * Filename : aroma_platform.h 18 | * Description : platform header 19 | * 20 | * + This is part of libaroma, an embedded ui toolkit. 21 | * + 06/04/15 - Author(s): Ahmad Amarullah 22 | * 23 | */ 24 | #ifndef __libaroma_aroma_internal_h__ 25 | #error "Include instead." 26 | #endif 27 | #ifndef __libaroma_platform_h__ 28 | #define __libaroma_platform_h__ 29 | 30 | #include /* open, close, unlink, usleep */ 31 | 32 | #define LIBAROMA_CONFIG_OS "uefi/edk2" 33 | 34 | /* 35 | * common platform wrapper 36 | */ 37 | #define libaroma_unlink(filename) unlink(filename) 38 | #define libaroma_sleep(ms) usleep(ms*1000) 39 | 40 | /* 41 | * get tick count 42 | */ 43 | static inline long libaroma_tick(){ 44 | return 0; 45 | } 46 | 47 | /* 48 | * MUTEX - NEED MULTICORE THREAD SAFE 49 | */ 50 | #define LIBAROMA_MUTEX int 51 | #define libaroma_mutex_init(x) (void)(x) 52 | #define libaroma_mutex_free(x) (void)(x) 53 | #define libaroma_mutex_lock(x) (void)(x) 54 | #define libaroma_mutex_unlock(x) (void)(x) 55 | 56 | /* 57 | * File Management 58 | */ 59 | int libaroma_filesize(const char * filename); 60 | int libaroma_filesize_fd(int fd); 61 | byte libaroma_file_exists(const char * filename); 62 | 63 | //extern float _strtof(const char *s, char **sp); 64 | //#define strtof _strtof 65 | double round(double); 66 | 67 | #endif /* __libaroma_platform_h__ */ 68 | 69 | -------------------------------------------------------------------------------- /Library/AromaLib/aroma.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | static LIBAROMA_CONFIG _libaroma_config; 5 | static byte _libaroma_config_ready=0; 6 | static FILE * _libaroma_debug_fp=NULL; 7 | static char _libaroma_debug_tag[256]="LIBAROMA()"; 8 | 9 | /* 10 | * Function : _libaroma_config_default 11 | * Return Value: void 12 | * Descriptions: set default runtime configuration 13 | */ 14 | void _libaroma_config_default() { 15 | /* 16 | if (LIBAROMA_FB_SHMEM_NAME){ 17 | snprintf(_libaroma_config.fb_shm_name,256,"%s",LIBAROMA_FB_SHMEM_NAME); 18 | } 19 | else{*/ 20 | _libaroma_config.fb_shm_name[0]=0; 21 | /*}*/ 22 | _libaroma_debug_fp=stdout; 23 | _libaroma_config.multicore_init_num = 8; /* activate core */ 24 | _libaroma_config.snapshoot_fb = 0; /* snapshoot after graph init */ 25 | _libaroma_config.runtime_monitor = LIBAROMA_START_UNSAFE; 26 | _libaroma_config_ready = 1; 27 | } /* End of libaroma_config_default */ 28 | 29 | /* 30 | * Function : libaroma_config 31 | * Return Value: LIBAROMA_CONFIGP 32 | * Descriptions: get runtime config 33 | */ 34 | LIBAROMA_CONFIGP libaroma_config(){ 35 | if (!_libaroma_config_ready){ 36 | _libaroma_config_default(); 37 | } 38 | return &_libaroma_config; 39 | } /* End of libaroma_config */ 40 | 41 | int libaroma_filesize(const char * filename) { 42 | return -1; 43 | } 44 | int libaroma_filesize_fd(int fd) { 45 | return -1; 46 | } 47 | byte libaroma_file_exists(const char * filename) { 48 | return 0; 49 | } 50 | 51 | /* 52 | * Function : libaroma_debug_output 53 | * Return Value: FILE * 54 | * Descriptions: get debug output fd 55 | */ 56 | FILE * libaroma_debug_output(){ 57 | if (!_libaroma_debug_fp){ 58 | _libaroma_debug_fp=stdout; 59 | } 60 | return _libaroma_debug_fp; 61 | } /* End of libaroma_debug_output */ 62 | 63 | /* 64 | * Function : libaroma_debug_tag 65 | * Return Value: char * 66 | * Descriptions: get debug tag 67 | */ 68 | char * libaroma_debug_tag(){ 69 | return _libaroma_debug_tag; 70 | } /* End of libaroma_debug_tag */ 71 | -------------------------------------------------------------------------------- /Library/AromaLib/fb_driver.h: -------------------------------------------------------------------------------- 1 | /********************************************************************[libaroma]* 2 | * Copyright (C) 2011-2015 Ahmad Amarullah (http://amarullz.com/) 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | *______________________________________________________________________________ 16 | * 17 | * Filename : fb_driver.h 18 | * Description : UEFI framebuffer driver header 19 | * 20 | * + This is part of libaroma, an embedded ui toolkit. 21 | * + 03/03/15 - Author(s): Ahmad Amarullah 22 | * 23 | */ 24 | #ifndef __libaroma_uefi_fb_driver_h__ 25 | #define __libaroma_uefi_fb_driver_h__ 26 | 27 | /* 28 | * headers 29 | */ 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | 39 | typedef struct _UEFIFBDR_INTERNAL UEFIFBDR_INTERNAL; 40 | typedef struct _UEFIFBDR_INTERNAL * UEFIFBDR_INTERNALP; 41 | 42 | /* 43 | * structure : internal framebuffer data 44 | */ 45 | struct _UEFIFBDR_INTERNAL{ 46 | EFI_GRAPHICS_OUTPUT_PROTOCOL *gop; 47 | EFI_LK_DISPLAY_PROTOCOL *lk_display; 48 | int fb_sz; /* framebuffer memory size */ 49 | voidp buffer; /* direct buffer */ 50 | int stride; /* stride size */ 51 | int line; /* line size */ 52 | byte depth; /* color depth */ 53 | byte pixsz; /* memory size per pixel */ 54 | byte rgb_pos[6]; /* framebuffer 32bit rgb position */ 55 | }; 56 | 57 | /* release function */ 58 | void UEFIFBDR_release(LIBAROMA_FBP me); 59 | 60 | /* flush function */ 61 | byte UEFIFBDR_flush(LIBAROMA_FBP me); 62 | 63 | /* start post */ 64 | byte UEFIFBDR_start_post(LIBAROMA_FBP me); 65 | 66 | /* end post */ 67 | byte UEFIFBDR_end_post(LIBAROMA_FBP me); 68 | 69 | 70 | #endif /* __libaroma_uefi_fb_driver_h__ */ 71 | -------------------------------------------------------------------------------- /Library/BootLib/BootLib.dec: -------------------------------------------------------------------------------- 1 | [Defines] 2 | DEC_SPECIFICATION = 0x00010005 3 | PACKAGE_NAME = AromaLib 4 | PACKAGE_GUID = a3eeaff4-2e29-4d82-9000-127e9601d229 5 | PACKAGE_VERSION = 0.1 6 | 7 | [Includes] 8 | ../../../../EFIDroidModules/libboot/include 9 | Include 10 | -------------------------------------------------------------------------------- /Library/BootLib/BootLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = BootLib 24 | FILE_GUID = a3eeaff4-2e29-4d82-9000-127e9601d229 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = BootLib 28 | 29 | # 30 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 31 | # 32 | 33 | [Sources] 34 | platform.c 35 | EFIDroidModules/libboot/boot.c 36 | EFIDroidModules/libboot/cmdline.c 37 | EFIDroidModules/libboot/qcdt.c 38 | 39 | EFIDroidModules/libboot/cksum/crc32.c 40 | 41 | EFIDroidModules/libboot/loaders/android.c 42 | EFIDroidModules/libboot/loaders/efi.c 43 | EFIDroidModules/libboot/loaders/elf.c 44 | EFIDroidModules/libboot/loaders/gzip.c 45 | EFIDroidModules/libboot/loaders/qcmbn.c 46 | EFIDroidModules/libboot/loaders/zimage.c 47 | 48 | EFIDroidModules/libboot/tagloaders/atags.c 49 | EFIDroidModules/libboot/tagloaders/fdt.c 50 | EFIDroidModules/libboot/tagloaders/qcdt.c 51 | 52 | [Packages] 53 | StdLib/StdLib.dec 54 | EmbeddedPkg/EmbeddedPkg.dec 55 | MdePkg/MdePkg.dec 56 | LittleKernelPkg/LittleKernelPkg.dec 57 | EFIDroidUEFIApps/EFIDroidUi/EFIDroidUi.dec 58 | EFIDroidUEFIApps/EFIDroidUi/Library/BootLib/BootLib.dec 59 | EFIDroidUEFIApps/EFIDroidUi/Library/BootLib/BootLibPriv.dec 60 | EFIDroidUEFIApps/EFIDroidUi/Library/AromaLib/AromaLib.dec 61 | 62 | [Packages.ARM] 63 | ArmPkg/ArmPkg.dec 64 | 65 | [Depex] 66 | TRUE 67 | -------------------------------------------------------------------------------- /Library/BootLib/BootLibPriv.dec: -------------------------------------------------------------------------------- 1 | [Defines] 2 | DEC_SPECIFICATION = 0x00010005 3 | PACKAGE_NAME = AromaLib 4 | PACKAGE_GUID = a3eeaff4-2e29-4d82-9000-127e9601d229 5 | PACKAGE_VERSION = 0.1 6 | 7 | [Includes] 8 | ../../../../EFIDroidModules/libboot/include_private 9 | -------------------------------------------------------------------------------- /Library/BootLib/Include/lib/boot/boot_platform.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016, The EFIDroid Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef LIB_BOOT_PLATFORM_H 18 | #define LIB_BOOT_PLATFORM_H 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #define LIBBOOT_FMT_UINTN "u" 27 | #define LIBBOOT_FMT_UINT32 "u" 28 | #define LIBBOOT_FMT_ADDR "x" 29 | #define LIBBOOT_FMT_INT "d" 30 | 31 | #define LIBBOOT_ASSERT ASSERT 32 | #define LIBBOOT_OFFSETOF(StrucName, Member) OFFSET_OF(StrucName, Member) 33 | 34 | #if !defined(MDEPKG_NDEBUG) 35 | #define LIBBOOT_DEBUG(fmt, ...) \ 36 | do { \ 37 | if (DebugPrintEnabled ()) { \ 38 | printf (fmt, ##__VA_ARGS__); \ 39 | } \ 40 | } while (FALSE) 41 | #else 42 | #define LIBBOOT_DEBUG(Expression) 43 | #endif 44 | 45 | #define LOGV(fmt, ...) LIBBOOT_DEBUG(fmt, ##__VA_ARGS__) 46 | #define LOGE(fmt, ...) printf(fmt, ##__VA_ARGS__) 47 | #define LOGI(fmt, ...) LIBBOOT_DEBUG(fmt, ##__VA_ARGS__) 48 | 49 | typedef UINTN boot_uintn_t; 50 | typedef INTN boot_intn_t; 51 | typedef UINT8 boot_uint8_t; 52 | typedef UINT16 boot_uint16_t; 53 | typedef UINT32 boot_uint32_t; 54 | typedef UINT64 boot_uint64_t; 55 | typedef INT8 boot_int8_t; 56 | typedef INT16 boot_int16_t; 57 | typedef INT32 boot_int32_t; 58 | typedef INT64 boot_int64_t; 59 | 60 | #endif // LIB_BOOT_PLATFORM_H 61 | -------------------------------------------------------------------------------- /Library/BootLib/platform.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2016, The EFIDroid Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | 31 | extern lkapi_t *mLKApi; 32 | 33 | static boot_uint32_t boot_get_hwid_zero(const char* name) { 34 | uint32_t data = 0; 35 | if(mLKApi) 36 | mLKApi->boot_get_hwid(name, &data); 37 | return data; 38 | }; 39 | 40 | boot_uint32_t libboot_qcdt_pmic_target(boot_uint8_t num_ent) { 41 | if(num_ent==0) 42 | return boot_get_hwid_zero("qcom,pmic_rev1"); 43 | if(num_ent==1) 44 | return boot_get_hwid_zero("qcom,pmic_rev2"); 45 | if(num_ent==2) 46 | return boot_get_hwid_zero("qcom,pmic_rev3"); 47 | if(num_ent==3) 48 | return boot_get_hwid_zero("qcom,pmic_rev4"); 49 | 50 | return 0; 51 | } 52 | 53 | boot_uint32_t libboot_qcdt_platform_id(void) { 54 | return boot_get_hwid_zero("qcom,platform_id"); 55 | } 56 | 57 | boot_uint32_t libboot_qcdt_hardware_id(void) { 58 | return boot_get_hwid_zero("qcom,platform_hw"); 59 | } 60 | 61 | boot_uint32_t libboot_qcdt_hardware_subtype(void) { 62 | return boot_get_hwid_zero("qcom,subtype"); 63 | } 64 | 65 | boot_uint32_t libboot_qcdt_soc_version(void) { 66 | return boot_get_hwid_zero("qcom,soc_rev"); 67 | } 68 | 69 | boot_uint32_t libboot_qcdt_target_id(void) { 70 | return boot_get_hwid_zero("qcom,variant_id"); 71 | } 72 | 73 | boot_uint32_t libboot_qcdt_foundry_id(void) { 74 | return boot_get_hwid_zero("qcom,foundry_id"); 75 | } 76 | 77 | boot_uint32_t libboot_qcdt_get_hlos_subtype(void) { 78 | return boot_get_hwid_zero("qcom,platform_subtype"); 79 | } 80 | 81 | boot_uintn_t libboot_platform_machtype(void) { 82 | return boot_get_hwid_zero("qcom,machtype"); 83 | } 84 | 85 | boot_uint32_t libboot_qcdt_get_lge_rev(void) { 86 | return boot_get_hwid_zero("lge,lge_rev"); 87 | } 88 | 89 | boot_uint32_t libboot_qcdt_get_oppo_id0(void) { 90 | return boot_get_hwid_zero("oppo,id0"); 91 | } 92 | 93 | boot_uint32_t libboot_qcdt_get_oppo_id1(void) { 94 | return boot_get_hwid_zero("oppo,id1"); 95 | } 96 | 97 | const char *libboot_qcdt_get_motorola_model(void) 98 | { 99 | return (char*)boot_get_hwid_zero("motorola,model"); 100 | } 101 | 102 | const char *libboot_qcdt_get_default_parser(void) { 103 | if(mLKApi) 104 | return mLKApi->boot_get_default_fdt_parser(); 105 | 106 | return NULL; 107 | } 108 | 109 | void libboot_platform_memmove(void* dst, const void* src, boot_uintn_t num) { 110 | CopyMem(dst, src, num); 111 | } 112 | 113 | int libboot_platform_memcmp(const void *s1, const void *s2, boot_uintn_t n) { 114 | return (int)CompareMem(s1, s2, n); 115 | } 116 | 117 | void *libboot_platform_memset(void *s, int c, boot_uintn_t n) { 118 | return SetMem(s, (UINTN)n, (UINT8)c); 119 | } 120 | 121 | void* libboot_platform_alloc(boot_uintn_t size) { 122 | void* mem = AllocatePool(size); 123 | if(!mem) 124 | libboot_format_error(LIBBOOT_ERROR_GROUP_COMMON, LIBBOOT_ERROR_COMMON_OUT_OF_MEMORY); 125 | return mem; 126 | } 127 | 128 | void libboot_platform_free(void *ptr) { 129 | if(ptr) 130 | FreePool(ptr); 131 | } 132 | 133 | int libboot_platform_format_string(char* buf, boot_uintn_t sz, const char* fmt, ...) { 134 | int rc; 135 | 136 | va_list args; 137 | va_start(args, fmt); 138 | rc = vsnprintf(buf, sz, fmt, args); 139 | va_end (args); 140 | 141 | return rc; 142 | } 143 | 144 | char* libboot_platform_strdup(const char *s) { 145 | return AllocateCopyPool(AsciiStrSize (s), s); 146 | } 147 | 148 | char* libboot_platform_strtok_r(char *str, const char *delim, char **saveptr) { 149 | return strtok_r(str, delim, saveptr); 150 | } 151 | 152 | char* libboot_platform_strchr(const char *s, int c) { 153 | return strchr(s, c); 154 | } 155 | 156 | int libboot_platform_strcmp(const char* str1, const char* str2) { 157 | return (int)AsciiStrCmp(str1, str2); 158 | } 159 | 160 | boot_uintn_t libboot_platform_strlen(const char* str) { 161 | return AsciiStrLen(str); 162 | } 163 | 164 | char *libboot_platform_strncpy(char *dest, const char *src, boot_uintn_t n) { 165 | return strncpy(dest, src, n); 166 | } 167 | 168 | typedef struct { 169 | void *pdata; 170 | libboot_platform_getmemory_callback_t cb; 171 | } lkapi_mmap_pdata_t; 172 | 173 | static void *lkapi_mmap_cb(void *_pdata, unsigned long long addr, unsigned long long size) { 174 | lkapi_mmap_pdata_t *pdata = _pdata; 175 | 176 | pdata->pdata = pdata->cb(pdata->pdata, (boot_uintn_t)addr, (boot_uintn_t)size); 177 | 178 | return pdata; 179 | } 180 | 181 | void* libboot_platform_getmemory(void *pdata, libboot_platform_getmemory_callback_t cb) { 182 | LIST_ENTRY *ResourceLink; 183 | LIST_ENTRY ResourceList; 184 | SYSTEM_MEMORY_RESOURCE *Resource; 185 | 186 | if(mLKApi) { 187 | lkapi_mmap_pdata_t lkapipdata = {pdata, cb}; 188 | mLKApi->boot_get_mmap(&lkapipdata, lkapi_mmap_cb); 189 | return lkapipdata.pdata; 190 | } 191 | 192 | UtilGetSystemMemoryResources (&ResourceList); 193 | ResourceLink = ResourceList.ForwardLink; 194 | while (ResourceLink != NULL && ResourceLink != &ResourceList) { 195 | Resource = (SYSTEM_MEMORY_RESOURCE*)ResourceLink; 196 | DEBUG ((EFI_D_INFO, "- [0x%08X,0x%08X]\n", 197 | (UINT32)Resource->PhysicalStart, 198 | (UINT32)Resource->PhysicalStart + (UINT32)Resource->ResourceLength)); 199 | pdata = cb(pdata, Resource->PhysicalStart, Resource->ResourceLength); 200 | ResourceLink = ResourceLink->ForwardLink; 201 | } 202 | 203 | return pdata; 204 | } 205 | 206 | void* libboot_platform_bootalloc(boot_uintn_t addr, boot_uintn_t sz) { 207 | DEBUG((EFI_D_INFO, "alloc: 0x%08x - 0x%08x ; 0x%08x\n", addr, addr+sz, sz)); 208 | UINTN AlignedSize = sz; 209 | UINTN AddrOffset = 0; 210 | EFI_PHYSICAL_ADDRESS AllocationAddress = AlignMemoryRange(addr, &AlignedSize, &AddrOffset, EFI_PAGE_SIZE); 211 | 212 | EFI_STATUS Status = gBS->AllocatePages (AllocateAddress, EfiBootServicesData, EFI_SIZE_TO_PAGES(AlignedSize), &AllocationAddress); 213 | if(EFI_ERROR(Status)) 214 | return NULL; 215 | 216 | return (VOID*)((UINTN)AllocationAddress)+AddrOffset; 217 | } 218 | 219 | void libboot_platform_bootfree(boot_uintn_t addr, boot_uintn_t sz) { 220 | if (addr && sz) 221 | FreeAlignedMemoryRange(addr, sz, EFI_PAGE_SIZE); 222 | } 223 | -------------------------------------------------------------------------------- /Library/CpioLib/Cpio.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | #define LIBUTIL_NOAROMA 8 | #include 9 | 10 | UINT32 11 | CpioStrToUl ( 12 | CHAR8 *in 13 | ) 14 | { 15 | CHAR8 buf[9]; 16 | CopyMem (buf, in, 8); 17 | buf[8] = 0; 18 | 19 | return AsciiStrHexToUintn (buf); 20 | } 21 | 22 | VOID 23 | CpioUlToStr ( 24 | CHAR8 *buf, 25 | UINT32 in 26 | ) 27 | { 28 | AsciiSPrint (buf, 9, "%08X", in); 29 | } 30 | 31 | INT32 32 | CpioIsValid ( 33 | VOID *ptr 34 | ) 35 | { 36 | return !AsciiStrnCmp (ptr, CPIO_NEWC_MAGIC, 6); 37 | } 38 | 39 | INT32 40 | CpioHasNext ( 41 | CPIO_NEWC_HEADER *hdr 42 | ) 43 | { 44 | return !!AsciiStrCmp ((CONST CHAR8 *) (hdr + 1), CPIO_TRAILER); 45 | } 46 | 47 | UINTN 48 | CpioPredictObjSize ( 49 | UINT32 namesize, 50 | UINT32 filesize 51 | ) 52 | { 53 | return ALIGN_VALUE (sizeof (CPIO_NEWC_HEADER) + namesize, 4) + ALIGN_VALUE (filesize, 4); 54 | } 55 | 56 | UINTN 57 | CpioGetObjSize ( 58 | CPIO_NEWC_HEADER *hdr 59 | ) 60 | { 61 | UINT32 namesize = CpioStrToUl (hdr->c_namesize); 62 | UINT32 filesize = CpioStrToUl (hdr->c_filesize); 63 | 64 | return CpioPredictObjSize (namesize, filesize); 65 | } 66 | 67 | EFI_STATUS 68 | CpioGetData ( 69 | CPIO_NEWC_HEADER *hdr, 70 | VOID **Ptr, 71 | UINTN *Size 72 | ) 73 | { 74 | UINT32 namesize = CpioStrToUl (hdr->c_namesize); 75 | UINT32 filesize = CpioStrToUl (hdr->c_filesize); 76 | 77 | if(!CpioIsValid (hdr)) 78 | return EFI_INVALID_PARAMETER; 79 | 80 | if (Ptr) 81 | *Ptr = ((CHAR8*)hdr) + ALIGN_VALUE (sizeof (CPIO_NEWC_HEADER) + namesize, 4); 82 | if (Size) 83 | *Size = filesize; 84 | 85 | return EFI_SUCCESS; 86 | } 87 | 88 | CPIO_NEWC_HEADER* 89 | CpioGetLast ( 90 | CPIO_NEWC_HEADER *hdr 91 | ) 92 | { 93 | while (CpioIsValid (hdr) && CpioHasNext (hdr)) { 94 | hdr = (CPIO_NEWC_HEADER *) (((CHAR8 *) hdr) + CpioGetObjSize (hdr)); 95 | } 96 | 97 | return hdr; 98 | } 99 | 100 | CPIO_NEWC_HEADER* 101 | CpioGetByName ( 102 | CPIO_NEWC_HEADER *hdr, 103 | CONST CHAR8 *name 104 | ) 105 | { 106 | while (CpioIsValid (hdr) && CpioHasNext (hdr)) { 107 | hdr = (CPIO_NEWC_HEADER *) (((CHAR8 *) hdr) + CpioGetObjSize (hdr)); 108 | CONST CHAR8 *nameptr = (CONST CHAR8 *) (hdr + 1); 109 | if (!AsciiStrCmp(nameptr, name)) 110 | return hdr; 111 | } 112 | 113 | return NULL; 114 | } 115 | 116 | CPIO_NEWC_HEADER* 117 | CpioCreateObj ( 118 | CPIO_NEWC_HEADER *hdr, 119 | CONST CHAR8 *name, 120 | CONST VOID *data, 121 | UINTN data_size, 122 | UINT32 mode 123 | ) 124 | { 125 | UINT32 namesize = AsciiStrLen (name) + 1; 126 | UINT32 namepad = ALIGN_VALUE (sizeof (*hdr) + namesize, 4) - (sizeof (*hdr) + namesize); 127 | CHAR8 *nameptr = (CHAR8 *) (hdr + 1); 128 | CHAR8 *dataptr = (CHAR8 *) (nameptr + namesize + namepad); 129 | CHAR8 intbuf[9]; 130 | 131 | // clear 132 | SetMem (hdr, sizeof (*hdr), '0'); 133 | 134 | // magic 135 | CopyMem (hdr->c_magic, CPIO_NEWC_MAGIC, 8); 136 | 137 | // namesize 138 | CpioUlToStr (intbuf, namesize); 139 | CopyMem (hdr->c_namesize, intbuf, 8); 140 | // name 141 | CopyMem (nameptr, name, namesize); 142 | 143 | // filesize 144 | CpioUlToStr (intbuf, data_size); 145 | CopyMem (hdr->c_filesize, intbuf, 8); 146 | // data 147 | if (data) { 148 | CopyMem (dataptr, data, data_size); 149 | } 150 | 151 | CHAR8 StrMode[] = { "00000000" }; 152 | AsciiSPrint(StrMode, sizeof(StrMode), "%08x", mode); 153 | UtilAsciiToLowerString(StrMode); 154 | 155 | // mode: -rwxr-x--- 156 | CopyMem (hdr->c_mode, StrMode, sizeof(StrMode)); 157 | 158 | return (CPIO_NEWC_HEADER *) (dataptr + ALIGN_VALUE (data_size, 4)); 159 | } 160 | -------------------------------------------------------------------------------- /Library/CpioLib/CpioLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = CpioLib 24 | FILE_GUID = add2c8c4-19b8-4d64-973c-9f936798d196 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = CpioLib 28 | 29 | # 30 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 31 | # 32 | 33 | [Sources] 34 | Cpio.c 35 | 36 | [Packages] 37 | MdePkg/MdePkg.dec 38 | MdeModulePkg/MdeModulePkg.dec 39 | EFIDroidUEFIApps/EFIDroidUi/EFIDroidUi.dec 40 | 41 | [Packages.ARM] 42 | ArmPkg/ArmPkg.dec 43 | 44 | [LibraryClasses] 45 | BaseLib 46 | UefiBootServicesTableLib 47 | UefiLib 48 | PrintLib 49 | 50 | [Depex] 51 | TRUE 52 | -------------------------------------------------------------------------------- /Library/DecompressLib/DecompressLib.dec: -------------------------------------------------------------------------------- 1 | [Defines] 2 | DEC_SPECIFICATION = 0x00010005 3 | PACKAGE_NAME = DecompressLibPkg 4 | PACKAGE_GUID = c2f7abb3-cac1-48bd-aee0-11bb8f9a5fef 5 | PACKAGE_VERSION = 0.5 6 | 7 | [Includes.common] 8 | include 9 | -------------------------------------------------------------------------------- /Library/DecompressLib/DecompressLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = DecompressLib 24 | FILE_GUID = 03836d99-52c1-41f6-8d62-4abf3f4e1dec 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = DecompressLib 28 | 29 | # 30 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 31 | # 32 | 33 | [Sources] 34 | decompress.c 35 | decompress_bunzip2.c 36 | decompress_inflate.c 37 | decompress_unlz4.c 38 | decompress_unlzma.c 39 | decompress_unlzo.c 40 | decompress_unxz.c 41 | 42 | zlib_inflate/inffast.c 43 | zlib_inflate/inflate.c 44 | zlib_inflate/infutil.c 45 | zlib_inflate/inftrees.c 46 | zlib_inflate/inflate_syms.c 47 | 48 | xz/xz_dec_syms.c 49 | xz/xz_dec_stream.c 50 | xz/xz_dec_lzma2.c 51 | xz/xz_dec_bcj.c 52 | xz/xz_crc32.c 53 | 54 | lz4/lz4_decompress.c 55 | 56 | lzo/lzo1x_decompress_safe.c 57 | 58 | [Packages] 59 | StdLib/StdLib.dec 60 | MdePkg/MdePkg.dec 61 | MdeModulePkg/MdeModulePkg.dec 62 | EFIDroidUEFIApps/EFIDroidUi/EFIDroidUi.dec 63 | EFIDroidUEFIApps/EFIDroidUi/Library/DecompressLib/DecompressLib.dec 64 | 65 | [LibraryClasses] 66 | BaseLib 67 | UefiBootServicesTableLib 68 | UefiLib 69 | PrintLib 70 | 71 | [Depex] 72 | TRUE 73 | 74 | [BuildOptions.ARM] 75 | GCC:*_*_*_CC_FLAGS = -DCONFIG_ARM=y -D__LITTLE_ENDIAN 76 | [BuildOptions.IA32] 77 | GCC:*_*_*_CC_FLAGS = -DCONFIG_X86=y -D__LITTLE_ENDIAN 78 | [BuildOptions.X64] 79 | GCC:*_*_*_CC_FLAGS = -DCONFIG_IA64=y -D__LITTLE_ENDIAN 80 | [BuildOptions] 81 | GCC:*_*_*_CC_FLAGS = -D__KERNEL__ -DCONFIG_DECOMPRESS_GZIP=y -DCONFIG_DECOMPRESS_BZIP2=y -DCONFIG_DECOMPRESS_LZMA=y -DCONFIG_DECOMPRESS_XZ=y -DCONFIG_DECOMPRESS_LZO=y -DCONFIG_DECOMPRESS_LZ4=y -DCONFIG_LZ4_DECOMPRESS=y -DCONFIG_LZO_DECOMPRESS=y -DCONFIG_ZLIB_INFLATE=y -DCONFIG_XZ_DEC=y -DCONFIG_XZ_DEC_BCJ=y -DXZ_INTERNAL_CRC32 -Wno-pointer-sign -Wno-unused-but-set-variable 82 | -------------------------------------------------------------------------------- /Library/DecompressLib/decompress.c: -------------------------------------------------------------------------------- 1 | /* 2 | * decompress.c 3 | * 4 | * Detect the decompression method based on magic number 5 | */ 6 | 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | //#include 17 | //#include 18 | //#include 19 | //#include 20 | #include 21 | 22 | #ifndef CONFIG_DECOMPRESS_GZIP 23 | # define gunzip NULL 24 | #endif 25 | #ifndef CONFIG_DECOMPRESS_BZIP2 26 | # define bunzip2 NULL 27 | #endif 28 | #ifndef CONFIG_DECOMPRESS_LZMA 29 | # define unlzma NULL 30 | #endif 31 | #ifndef CONFIG_DECOMPRESS_XZ 32 | # define unxz NULL 33 | #endif 34 | #ifndef CONFIG_DECOMPRESS_LZO 35 | # define unlzo NULL 36 | #endif 37 | #ifndef CONFIG_DECOMPRESS_LZ4 38 | # define unlz4 NULL 39 | #endif 40 | 41 | struct compress_format { 42 | unsigned char magic[2]; 43 | const char *name; 44 | decompress_fn decompressor; 45 | }; 46 | 47 | static const struct compress_format compressed_formats[] __initconst = { 48 | { {0x1f, 0x8b}, "gzip", gunzip }, 49 | { {0x1f, 0x9e}, "gzip", gunzip }, 50 | { {0x42, 0x5a}, "bzip2", bunzip2 }, 51 | { {0x5d, 0x00}, "lzma", unlzma }, 52 | { {0xfd, 0x37}, "xz", unxz }, 53 | { {0x89, 0x4c}, "lzo", unlzo }, 54 | { {0x02, 0x21}, "lz4", unlz4 }, 55 | { {0, 0}, NULL, NULL } 56 | }; 57 | 58 | decompress_fn __init decompress_method(const unsigned char *inbuf, long len, 59 | const char **name) 60 | { 61 | const struct compress_format *cf; 62 | 63 | if (len < 2) { 64 | if (name) 65 | *name = NULL; 66 | return NULL; /* Need at least this much... */ 67 | } 68 | 69 | pr_debug("Compressed data magic: %#.2x %#.2x\n", inbuf[0], inbuf[1]); 70 | 71 | for (cf = compressed_formats; cf->name; cf++) { 72 | if (!memcmp(inbuf, cf->magic, 2)) 73 | break; 74 | 75 | } 76 | if (name) 77 | *name = cf->name; 78 | return cf->decompressor; 79 | } 80 | -------------------------------------------------------------------------------- /Library/DecompressLib/decompress_inflate.c: -------------------------------------------------------------------------------- 1 | #ifdef GCCSTATIC 2 | #define PREBOOT 3 | /* Pre-boot environment: included */ 4 | 5 | /* prevent inclusion of _LINUX_KERNEL_H in pre-boot environment: lots 6 | * errors about console_printk etc... on ARM */ 7 | #define _LINUX_KERNEL_H 8 | 9 | #include "zlib_inflate/inftrees.c" 10 | #include "zlib_inflate/inffast.c" 11 | #include "zlib_inflate/inflate.c" 12 | 13 | #else /* GCCSTATIC */ 14 | /* initramfs et al: linked */ 15 | 16 | #include 17 | 18 | #include "zlib_inflate/inftrees.h" 19 | #include "zlib_inflate/inffast.h" 20 | #include "zlib_inflate/inflate.h" 21 | 22 | #include "zlib_inflate/infutil.h" 23 | #include 24 | 25 | #endif /* GCCSTATIC */ 26 | 27 | #include 28 | 29 | #define GZIP_IOBUF_SIZE (16*1024) 30 | 31 | static long INIT nofill(void *buffer, unsigned long len) 32 | { 33 | return -1; 34 | } 35 | 36 | /* Included from initramfs et al code */ 37 | GCCSTATIC int INIT __gunzip(unsigned char *buf, long len, 38 | long (*fill)(void*, unsigned long), 39 | long (*flush)(void*, unsigned long), 40 | unsigned char *out_buf, long out_len, 41 | long *pos, 42 | void(*error)(char *x)) { 43 | u8 *zbuf; 44 | struct z_stream_s *strm; 45 | int rc; 46 | 47 | rc = -1; 48 | if (flush) { 49 | out_len = 0x8000; /* 32 K */ 50 | out_buf = malloc(out_len); 51 | } else { 52 | if (!out_len) 53 | out_len = ((size_t)~0) - (size_t)out_buf; /* no limit */ 54 | } 55 | if (!out_buf) { 56 | error("Out of memory while allocating output buffer"); 57 | goto gunzip_nomem1; 58 | } 59 | 60 | if (buf) 61 | zbuf = buf; 62 | else { 63 | zbuf = malloc(GZIP_IOBUF_SIZE); 64 | len = 0; 65 | } 66 | if (!zbuf) { 67 | error("Out of memory while allocating input buffer"); 68 | goto gunzip_nomem2; 69 | } 70 | 71 | strm = malloc(sizeof(*strm)); 72 | if (strm == NULL) { 73 | error("Out of memory while allocating z_stream"); 74 | goto gunzip_nomem3; 75 | } 76 | 77 | strm->workspace = malloc(flush ? zlib_inflate_workspacesize() : 78 | sizeof(struct inflate_state)); 79 | if (strm->workspace == NULL) { 80 | error("Out of memory while allocating workspace"); 81 | goto gunzip_nomem4; 82 | } 83 | 84 | if (!fill) 85 | fill = nofill; 86 | 87 | if (len == 0) 88 | len = fill(zbuf, GZIP_IOBUF_SIZE); 89 | 90 | /* verify the gzip header */ 91 | if (len < 10 || 92 | zbuf[0] != 0x1f || zbuf[1] != 0x8b || zbuf[2] != 0x08) { 93 | if (pos) 94 | *pos = 0; 95 | error("Not a gzip file"); 96 | goto gunzip_5; 97 | } 98 | 99 | /* skip over gzip header (1f,8b,08... 10 bytes total + 100 | * possible asciz filename) 101 | */ 102 | strm->next_in = zbuf + 10; 103 | strm->avail_in = len - 10; 104 | /* skip over asciz filename */ 105 | if (zbuf[3] & 0x8) { 106 | do { 107 | /* 108 | * If the filename doesn't fit into the buffer, 109 | * the file is very probably corrupt. Don't try 110 | * to read more data. 111 | */ 112 | if (strm->avail_in == 0) { 113 | error("header error"); 114 | goto gunzip_5; 115 | } 116 | --strm->avail_in; 117 | } while (*strm->next_in++); 118 | } 119 | 120 | strm->next_out = out_buf; 121 | strm->avail_out = out_len; 122 | 123 | rc = zlib_inflateInit2(strm, -MAX_WBITS); 124 | 125 | if (!flush) { 126 | WS(strm)->inflate_state.wsize = 0; 127 | WS(strm)->inflate_state.window = NULL; 128 | } 129 | 130 | while (rc == Z_OK) { 131 | if (strm->avail_in == 0) { 132 | /* TODO: handle case where both pos and fill are set */ 133 | len = fill(zbuf, GZIP_IOBUF_SIZE); 134 | if (len < 0) { 135 | rc = -1; 136 | error("read error"); 137 | break; 138 | } 139 | strm->next_in = zbuf; 140 | strm->avail_in = len; 141 | } 142 | rc = zlib_inflate(strm, 0); 143 | 144 | /* Write any data generated */ 145 | if (flush && strm->next_out > out_buf) { 146 | long l = strm->next_out - out_buf; 147 | if (l != flush(out_buf, l)) { 148 | rc = -1; 149 | error("write error"); 150 | break; 151 | } 152 | strm->next_out = out_buf; 153 | strm->avail_out = out_len; 154 | } 155 | 156 | /* after Z_FINISH, only Z_STREAM_END is "we unpacked it all" */ 157 | if (rc == Z_STREAM_END) { 158 | rc = 0; 159 | break; 160 | } else if (rc != Z_OK) { 161 | error("uncompression error"); 162 | rc = -1; 163 | } 164 | } 165 | 166 | zlib_inflateEnd(strm); 167 | if (pos) 168 | /* add + 8 to skip over trailer */ 169 | *pos = strm->next_in - zbuf+8; 170 | 171 | gunzip_5: 172 | free(strm->workspace); 173 | gunzip_nomem4: 174 | free(strm); 175 | gunzip_nomem3: 176 | if (!buf) 177 | free(zbuf); 178 | gunzip_nomem2: 179 | if (flush) 180 | free(out_buf); 181 | gunzip_nomem1: 182 | return rc; /* returns Z_OK (0) if successful */ 183 | } 184 | 185 | #ifndef PREBOOT 186 | GCCSTATIC int INIT gunzip(unsigned char *buf, long len, 187 | long (*fill)(void*, unsigned long), 188 | long (*flush)(void*, unsigned long), 189 | unsigned char *out_buf, 190 | long *pos, 191 | void (*error)(char *x)) 192 | { 193 | return __gunzip(buf, len, fill, flush, out_buf, 0, pos, error); 194 | } 195 | #else 196 | GCCSTATIC int INIT __decompress(unsigned char *buf, long len, 197 | long (*fill)(void*, unsigned long), 198 | long (*flush)(void*, unsigned long), 199 | unsigned char *out_buf, long out_len, 200 | long *pos, 201 | void (*error)(char *x)) 202 | { 203 | return __gunzip(buf, len, fill, flush, out_buf, out_len, pos, error); 204 | } 205 | #endif 206 | -------------------------------------------------------------------------------- /Library/DecompressLib/decompress_unlz4.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Wrapper for decompressing LZ4-compressed kernel, initramfs, and initrd 3 | * 4 | * Copyright (C) 2013, LG Electronics, Kyungsik Lee 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | */ 10 | 11 | #ifdef GCCSTATIC 12 | #define PREBOOT 13 | #include "lz4/lz4_decompress.c" 14 | #else 15 | #include 16 | #endif 17 | //#include 18 | #include 19 | #include 20 | #include 21 | //#include 22 | 23 | //#include 24 | 25 | /* 26 | * Note: Uncompressed chunk size is used in the compressor side 27 | * (userspace side for compression). 28 | * It is hardcoded because there is not proper way to extract it 29 | * from the binary stream which is generated by the preliminary 30 | * version of LZ4 tool so far. 31 | */ 32 | #define LZ4_DEFAULT_UNCOMPRESSED_CHUNK_SIZE (8 << 20) 33 | #define ARCHIVE_MAGICNUMBER 0x184C2102 34 | 35 | GCCSTATIC inline int INIT unlz4(u8 *input, long in_len, 36 | long (*fill)(void *, unsigned long), 37 | long (*flush)(void *, unsigned long), 38 | u8 *output, long *posp, 39 | void (*error) (char *x)) 40 | { 41 | int ret = -1; 42 | size_t chunksize = 0; 43 | size_t uncomp_chunksize = LZ4_DEFAULT_UNCOMPRESSED_CHUNK_SIZE; 44 | u8 *inp; 45 | u8 *inp_start; 46 | u8 *outp; 47 | long size = in_len; 48 | #ifdef PREBOOT 49 | size_t out_len = get_unaligned_le32(input + in_len); 50 | #endif 51 | size_t dest_len; 52 | 53 | 54 | if (output) { 55 | outp = output; 56 | } else if (!flush) { 57 | error("NULL output pointer and no flush function provided"); 58 | goto exit_0; 59 | } else { 60 | outp = large_malloc(uncomp_chunksize); 61 | if (!outp) { 62 | error("Could not allocate output buffer"); 63 | goto exit_0; 64 | } 65 | } 66 | 67 | if (input && fill) { 68 | error("Both input pointer and fill function provided,"); 69 | goto exit_1; 70 | } else if (input) { 71 | inp = input; 72 | } else if (!fill) { 73 | error("NULL input pointer and missing fill function"); 74 | goto exit_1; 75 | } else { 76 | inp = large_malloc(lz4_compressbound(uncomp_chunksize)); 77 | if (!inp) { 78 | error("Could not allocate input buffer"); 79 | goto exit_1; 80 | } 81 | } 82 | inp_start = inp; 83 | 84 | if (posp) 85 | *posp = 0; 86 | 87 | if (fill) { 88 | size = fill(inp, 4); 89 | if (size < 4) { 90 | error("data corrupted"); 91 | goto exit_2; 92 | } 93 | } 94 | 95 | chunksize = get_unaligned_le32(inp); 96 | if (chunksize == ARCHIVE_MAGICNUMBER) { 97 | if (!fill) { 98 | inp += 4; 99 | size -= 4; 100 | } 101 | } else { 102 | error("invalid header"); 103 | goto exit_2; 104 | } 105 | 106 | if (posp) 107 | *posp += 4; 108 | 109 | for (;;) { 110 | 111 | if (fill) { 112 | size = fill(inp, 4); 113 | if (size == 0) 114 | break; 115 | if (size < 4) { 116 | error("data corrupted"); 117 | goto exit_2; 118 | } 119 | } 120 | 121 | chunksize = get_unaligned_le32(inp); 122 | if (chunksize == ARCHIVE_MAGICNUMBER) { 123 | if (!fill) { 124 | inp += 4; 125 | size -= 4; 126 | } 127 | if (posp) 128 | *posp += 4; 129 | continue; 130 | } 131 | 132 | 133 | if (posp) 134 | *posp += 4; 135 | 136 | if (!fill) { 137 | inp += 4; 138 | size -= 4; 139 | } else { 140 | if (chunksize > lz4_compressbound(uncomp_chunksize)) { 141 | error("chunk length is longer than allocated"); 142 | goto exit_2; 143 | } 144 | size = fill(inp, chunksize); 145 | if (size < chunksize) { 146 | error("data corrupted"); 147 | goto exit_2; 148 | } 149 | } 150 | #ifdef PREBOOT 151 | if (out_len >= uncomp_chunksize) { 152 | dest_len = uncomp_chunksize; 153 | out_len -= dest_len; 154 | } else 155 | dest_len = out_len; 156 | ret = lz4_decompress(inp, &chunksize, outp, dest_len); 157 | #else 158 | dest_len = uncomp_chunksize; 159 | ret = lz4_decompress_unknownoutputsize(inp, chunksize, outp, 160 | &dest_len); 161 | #endif 162 | if (ret < 0) { 163 | error("Decoding failed"); 164 | goto exit_2; 165 | } 166 | 167 | ret = -1; 168 | if (flush && flush(outp, dest_len) != dest_len) 169 | goto exit_2; 170 | if (output) 171 | outp += dest_len; 172 | if (posp) 173 | *posp += chunksize; 174 | 175 | if (!fill) { 176 | size -= chunksize; 177 | 178 | if (size == 0) 179 | break; 180 | else if (size < 0) { 181 | error("data corrupted"); 182 | goto exit_2; 183 | } 184 | inp += chunksize; 185 | } 186 | } 187 | 188 | ret = 0; 189 | exit_2: 190 | if (!input) 191 | large_free(inp_start); 192 | exit_1: 193 | if (!output) 194 | large_free(outp); 195 | exit_0: 196 | return ret; 197 | } 198 | 199 | #ifdef PREBOOT 200 | GCCSTATIC int INIT __decompress(unsigned char *buf, long in_len, 201 | long (*fill)(void*, unsigned long), 202 | long (*flush)(void*, unsigned long), 203 | unsigned char *output, long out_len, 204 | long *posp, 205 | void (*error)(char *x) 206 | ) 207 | { 208 | return unlz4(buf, in_len - 4, fill, flush, output, posp, error); 209 | } 210 | #endif 211 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/decompress/bunzip2.h: -------------------------------------------------------------------------------- 1 | #ifndef DECOMPRESS_BUNZIP2_H 2 | #define DECOMPRESS_BUNZIP2_H 3 | 4 | int bunzip2(unsigned char *inbuf, long len, 5 | long (*fill)(void*, unsigned long), 6 | long (*flush)(void*, unsigned long), 7 | unsigned char *output, 8 | long *pos, 9 | void(*error)(char *x)); 10 | #endif 11 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/decompress/generic.h: -------------------------------------------------------------------------------- 1 | #ifndef DECOMPRESS_GENERIC_H 2 | #define DECOMPRESS_GENERIC_H 3 | 4 | typedef int (*decompress_fn) (unsigned char *inbuf, long len, 5 | long (*fill)(void*, unsigned long), 6 | long (*flush)(void*, unsigned long), 7 | unsigned char *outbuf, 8 | long *posp, 9 | void(*error)(char *x)); 10 | 11 | /* inbuf - input buffer 12 | *len - len of pre-read data in inbuf 13 | *fill - function to fill inbuf when empty 14 | *flush - function to write out outbuf 15 | *outbuf - output buffer 16 | *posp - if non-null, input position (number of bytes read) will be 17 | * returned here 18 | * 19 | *If len != 0, inbuf should contain all the necessary input data, and fill 20 | *should be NULL 21 | *If len = 0, inbuf can be NULL, in which case the decompressor will allocate 22 | *the input buffer. If inbuf != NULL it must be at least XXX_IOBUF_SIZE bytes. 23 | *fill will be called (repeatedly...) to read data, at most XXX_IOBUF_SIZE 24 | *bytes should be read per call. Replace XXX with the appropriate decompressor 25 | *name, i.e. LZMA_IOBUF_SIZE. 26 | * 27 | *If flush = NULL, outbuf must be large enough to buffer all the expected 28 | *output. If flush != NULL, the output buffer will be allocated by the 29 | *decompressor (outbuf = NULL), and the flush function will be called to 30 | *flush the output buffer at the appropriate time (decompressor and stream 31 | *dependent). 32 | */ 33 | 34 | 35 | /* Utility routine to detect the decompression method */ 36 | decompress_fn decompress_method(const unsigned char *inbuf, long len, 37 | const char **name); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/decompress/inflate.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUX_DECOMPRESS_INFLATE_H 2 | #define LINUX_DECOMPRESS_INFLATE_H 3 | 4 | int gunzip(unsigned char *inbuf, long len, 5 | long (*fill)(void*, unsigned long), 6 | long (*flush)(void*, unsigned long), 7 | unsigned char *output, 8 | long *pos, 9 | void(*error_fn)(char *x)); 10 | #endif 11 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/decompress/mm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/compr_mm.h 3 | * 4 | * Memory management for pre-boot and ramdisk uncompressors 5 | * 6 | * Authors: Alain Knaff 7 | * 8 | */ 9 | 10 | #ifndef DECOMPR_MM_H 11 | #define DECOMPR_MM_H 12 | 13 | #ifdef GCCSTATIC 14 | 15 | /* Code active when included from pre-boot environment: */ 16 | 17 | /* 18 | * Some architectures want to ensure there is no local data in their 19 | * pre-boot environment, so that data can arbitrarily relocated (via 20 | * GOT references). This is achieved by defining STATIC_RW_DATA to 21 | * be null. 22 | */ 23 | #ifndef STATIC_RW_DATA 24 | #define STATIC_RW_DATA static 25 | #endif 26 | 27 | /* A trivial malloc implementation, adapted from 28 | * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994 29 | */ 30 | STATIC_RW_DATA unsigned long malloc_ptr; 31 | STATIC_RW_DATA int malloc_count; 32 | 33 | static void *malloc(int size) 34 | { 35 | void *p; 36 | 37 | if (size < 0) 38 | return NULL; 39 | if (!malloc_ptr) 40 | malloc_ptr = free_mem_ptr; 41 | 42 | malloc_ptr = (malloc_ptr + 3) & ~3; /* Align */ 43 | 44 | p = (void *)malloc_ptr; 45 | malloc_ptr += size; 46 | 47 | if (free_mem_end_ptr && malloc_ptr >= free_mem_end_ptr) 48 | return NULL; 49 | 50 | malloc_count++; 51 | return p; 52 | } 53 | 54 | static void free(void *where) 55 | { 56 | malloc_count--; 57 | if (!malloc_count) 58 | malloc_ptr = free_mem_ptr; 59 | } 60 | 61 | #define large_malloc(a) malloc(a) 62 | #define large_free(a) free(a) 63 | 64 | #define INIT 65 | 66 | #else /* GCCSTATIC */ 67 | 68 | /* Code active when compiled standalone for use when loading ramdisk: */ 69 | 70 | //#include 71 | //#include 72 | //#include 73 | //#include 74 | //#include 75 | #include 76 | 77 | /* Use defines rather than static inline in order to avoid spurious 78 | * warnings when not needed (indeed large_malloc / large_free are not 79 | * needed by inflate */ 80 | 81 | #define malloc(a) kmalloc(a, GFP_KERNEL) 82 | #define free(a) kfree(a) 83 | 84 | #define large_malloc(a) vmalloc(a) 85 | #define large_free(a) vfree(a) 86 | 87 | #define INIT __init 88 | #define GCCSTATIC 89 | 90 | //#include 91 | 92 | #endif /* GCCSTATIC */ 93 | 94 | #endif /* DECOMPR_MM_H */ 95 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/decompress/unlz4.h: -------------------------------------------------------------------------------- 1 | #ifndef DECOMPRESS_UNLZ4_H 2 | #define DECOMPRESS_UNLZ4_H 3 | 4 | int unlz4(unsigned char *inbuf, long len, 5 | long (*fill)(void*, unsigned long), 6 | long (*flush)(void*, unsigned long), 7 | unsigned char *output, 8 | long *pos, 9 | void(*error)(char *x)); 10 | #endif 11 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/decompress/unlzma.h: -------------------------------------------------------------------------------- 1 | #ifndef DECOMPRESS_UNLZMA_H 2 | #define DECOMPRESS_UNLZMA_H 3 | 4 | int unlzma(unsigned char *, long, 5 | long (*fill)(void*, unsigned long), 6 | long (*flush)(void*, unsigned long), 7 | unsigned char *output, 8 | long *posp, 9 | void(*error)(char *x) 10 | ); 11 | 12 | #endif 13 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/decompress/unlzo.h: -------------------------------------------------------------------------------- 1 | #ifndef DECOMPRESS_UNLZO_H 2 | #define DECOMPRESS_UNLZO_H 3 | 4 | int unlzo(unsigned char *inbuf, long len, 5 | long (*fill)(void*, unsigned long), 6 | long (*flush)(void*, unsigned long), 7 | unsigned char *output, 8 | long *pos, 9 | void(*error)(char *x)); 10 | #endif 11 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/decompress/unxz.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Wrapper for decompressing XZ-compressed kernel, initramfs, and initrd 3 | * 4 | * Author: Lasse Collin 5 | * 6 | * This file has been put into the public domain. 7 | * You can do whatever you want with this file. 8 | */ 9 | 10 | #ifndef DECOMPRESS_UNXZ_H 11 | #define DECOMPRESS_UNXZ_H 12 | 13 | int unxz(unsigned char *in, long in_size, 14 | long (*fill)(void *dest, unsigned long size), 15 | long (*flush)(void *src, unsigned long size), 16 | unsigned char *out, long *in_used, 17 | void (*error)(char *x)); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/lz4.h: -------------------------------------------------------------------------------- 1 | #ifndef __LZ4_H__ 2 | #define __LZ4_H__ 3 | /* 4 | * LZ4 Kernel Interface 5 | * 6 | * Copyright (C) 2013, LG Electronics, Kyungsik Lee 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License version 2 as 10 | * published by the Free Software Foundation. 11 | */ 12 | #define LZ4_MEM_COMPRESS (4096 * sizeof(unsigned char *)) 13 | #define LZ4HC_MEM_COMPRESS (65538 * sizeof(unsigned char *)) 14 | 15 | /* 16 | * lz4_compressbound() 17 | * Provides the maximum size that LZ4 may output in a "worst case" scenario 18 | * (input data not compressible) 19 | */ 20 | static inline size_t lz4_compressbound(size_t isize) 21 | { 22 | return isize + (isize / 255) + 16; 23 | } 24 | 25 | /* 26 | * lz4_compress() 27 | * src : source address of the original data 28 | * src_len : size of the original data 29 | * dst : output buffer address of the compressed data 30 | * This requires 'dst' of size LZ4_COMPRESSBOUND. 31 | * dst_len : is the output size, which is returned after compress done 32 | * workmem : address of the working memory. 33 | * This requires 'workmem' of size LZ4_MEM_COMPRESS. 34 | * return : Success if return 0 35 | * Error if return (< 0) 36 | * note : Destination buffer and workmem must be already allocated with 37 | * the defined size. 38 | */ 39 | int lz4_compress(const unsigned char *src, size_t src_len, 40 | unsigned char *dst, size_t *dst_len, void *wrkmem); 41 | 42 | /* 43 | * lz4hc_compress() 44 | * src : source address of the original data 45 | * src_len : size of the original data 46 | * dst : output buffer address of the compressed data 47 | * This requires 'dst' of size LZ4_COMPRESSBOUND. 48 | * dst_len : is the output size, which is returned after compress done 49 | * workmem : address of the working memory. 50 | * This requires 'workmem' of size LZ4HC_MEM_COMPRESS. 51 | * return : Success if return 0 52 | * Error if return (< 0) 53 | * note : Destination buffer and workmem must be already allocated with 54 | * the defined size. 55 | */ 56 | int lz4hc_compress(const unsigned char *src, size_t src_len, 57 | unsigned char *dst, size_t *dst_len, void *wrkmem); 58 | 59 | /* 60 | * lz4_decompress() 61 | * src : source address of the compressed data 62 | * src_len : is the input size, whcih is returned after decompress done 63 | * dest : output buffer address of the decompressed data 64 | * actual_dest_len: is the size of uncompressed data, supposing it's known 65 | * return : Success if return 0 66 | * Error if return (< 0) 67 | * note : Destination buffer must be already allocated. 68 | * slightly faster than lz4_decompress_unknownoutputsize() 69 | */ 70 | int lz4_decompress(const unsigned char *src, size_t *src_len, 71 | unsigned char *dest, size_t actual_dest_len); 72 | 73 | /* 74 | * lz4_decompress_unknownoutputsize() 75 | * src : source address of the compressed data 76 | * src_len : is the input size, therefore the compressed size 77 | * dest : output buffer address of the decompressed data 78 | * dest_len: is the max size of the destination buffer, which is 79 | * returned with actual size of decompressed data after 80 | * decompress done 81 | * return : Success if return 0 82 | * Error if return (< 0) 83 | * note : Destination buffer must be already allocated. 84 | */ 85 | int lz4_decompress_unknownoutputsize(const unsigned char *src, size_t src_len, 86 | unsigned char *dest, size_t *dest_len); 87 | #endif 88 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/lzo.h: -------------------------------------------------------------------------------- 1 | #ifndef __LZO_H__ 2 | #define __LZO_H__ 3 | /* 4 | * LZO Public Kernel Interface 5 | * A mini subset of the LZO real-time data compression library 6 | * 7 | * Copyright (C) 1996-2012 Markus F.X.J. Oberhumer 8 | * 9 | * The full LZO package can be found at: 10 | * http://www.oberhumer.com/opensource/lzo/ 11 | * 12 | * Changed for Linux kernel use by: 13 | * Nitin Gupta 14 | * Richard Purdie 15 | */ 16 | 17 | #define LZO1X_1_MEM_COMPRESS (8192 * sizeof(unsigned short)) 18 | #define LZO1X_MEM_COMPRESS LZO1X_1_MEM_COMPRESS 19 | 20 | #define lzo1x_worst_compress(x) ((x) + ((x) / 16) + 64 + 3) 21 | 22 | /* This requires 'wrkmem' of size LZO1X_1_MEM_COMPRESS */ 23 | int lzo1x_1_compress(const unsigned char *src, size_t src_len, 24 | unsigned char *dst, size_t *dst_len, void *wrkmem); 25 | 26 | /* safe decompression with overrun testing */ 27 | int lzo1x_decompress_safe(const unsigned char *src, size_t src_len, 28 | unsigned char *dst, size_t *dst_len); 29 | 30 | /* 31 | * Return values (< 0 = Error) 32 | */ 33 | #define LZO_E_OK 0 34 | #define LZO_E_ERROR (-1) 35 | #define LZO_E_OUT_OF_MEMORY (-2) 36 | #define LZO_E_NOT_COMPRESSIBLE (-3) 37 | #define LZO_E_INPUT_OVERRUN (-4) 38 | #define LZO_E_OUTPUT_OVERRUN (-5) 39 | #define LZO_E_LOOKBEHIND_OVERRUN (-6) 40 | #define LZO_E_EOF_NOT_FOUND (-7) 41 | #define LZO_E_INPUT_NOT_CONSUMED (-8) 42 | #define LZO_E_NOT_YET_IMPLEMENTED (-9) 43 | #define LZO_E_INVALID_ARGUMENT (-10) 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/unaligned/access_ok.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_ACCESS_OK_H 2 | #define _LINUX_UNALIGNED_ACCESS_OK_H 3 | 4 | //#include 5 | //#include 6 | 7 | static inline u16 get_unaligned_le16(const void *p) 8 | { 9 | return le16_to_cpup((__le16 *)p); 10 | } 11 | 12 | static inline u32 get_unaligned_le32(const void *p) 13 | { 14 | return le32_to_cpup((__le32 *)p); 15 | } 16 | 17 | static inline u64 get_unaligned_le64(const void *p) 18 | { 19 | return le64_to_cpup((__le64 *)p); 20 | } 21 | 22 | static inline u16 get_unaligned_be16(const void *p) 23 | { 24 | return be16_to_cpup((__be16 *)p); 25 | } 26 | 27 | static inline u32 get_unaligned_be32(const void *p) 28 | { 29 | return be32_to_cpup((__be32 *)p); 30 | } 31 | 32 | static inline u64 get_unaligned_be64(const void *p) 33 | { 34 | return be64_to_cpup((__be64 *)p); 35 | } 36 | 37 | static inline void put_unaligned_le16(u16 val, void *p) 38 | { 39 | *((__le16 *)p) = cpu_to_le16(val); 40 | } 41 | 42 | static inline void put_unaligned_le32(u32 val, void *p) 43 | { 44 | *((__le32 *)p) = cpu_to_le32(val); 45 | } 46 | 47 | static inline void put_unaligned_le64(u64 val, void *p) 48 | { 49 | *((__le64 *)p) = cpu_to_le64(val); 50 | } 51 | 52 | static inline void put_unaligned_be16(u16 val, void *p) 53 | { 54 | *((__be16 *)p) = cpu_to_be16(val); 55 | } 56 | 57 | static inline void put_unaligned_be32(u32 val, void *p) 58 | { 59 | *((__be32 *)p) = cpu_to_be32(val); 60 | } 61 | 62 | static inline void put_unaligned_be64(u64 val, void *p) 63 | { 64 | *((__be64 *)p) = cpu_to_be64(val); 65 | } 66 | 67 | #endif /* _LINUX_UNALIGNED_ACCESS_OK_H */ 68 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/unaligned/be_byteshift.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_BE_BYTESHIFT_H 2 | #define _LINUX_UNALIGNED_BE_BYTESHIFT_H 3 | 4 | //#include 5 | 6 | static inline u16 __get_unaligned_be16(const u8 *p) 7 | { 8 | return p[0] << 8 | p[1]; 9 | } 10 | 11 | static inline u32 __get_unaligned_be32(const u8 *p) 12 | { 13 | return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]; 14 | } 15 | 16 | static inline u64 __get_unaligned_be64(const u8 *p) 17 | { 18 | return (u64)__get_unaligned_be32(p) << 32 | 19 | __get_unaligned_be32(p + 4); 20 | } 21 | 22 | static inline void __put_unaligned_be16(u16 val, u8 *p) 23 | { 24 | *p++ = val >> 8; 25 | *p++ = val; 26 | } 27 | 28 | static inline void __put_unaligned_be32(u32 val, u8 *p) 29 | { 30 | __put_unaligned_be16(val >> 16, p); 31 | __put_unaligned_be16(val, p + 2); 32 | } 33 | 34 | static inline void __put_unaligned_be64(u64 val, u8 *p) 35 | { 36 | __put_unaligned_be32(val >> 32, p); 37 | __put_unaligned_be32(val, p + 4); 38 | } 39 | 40 | static inline u16 get_unaligned_be16(const void *p) 41 | { 42 | return __get_unaligned_be16((const u8 *)p); 43 | } 44 | 45 | static inline u32 get_unaligned_be32(const void *p) 46 | { 47 | return __get_unaligned_be32((const u8 *)p); 48 | } 49 | 50 | static inline u64 get_unaligned_be64(const void *p) 51 | { 52 | return __get_unaligned_be64((const u8 *)p); 53 | } 54 | 55 | static inline void put_unaligned_be16(u16 val, void *p) 56 | { 57 | __put_unaligned_be16(val, p); 58 | } 59 | 60 | static inline void put_unaligned_be32(u32 val, void *p) 61 | { 62 | __put_unaligned_be32(val, p); 63 | } 64 | 65 | static inline void put_unaligned_be64(u64 val, void *p) 66 | { 67 | __put_unaligned_be64(val, p); 68 | } 69 | 70 | #endif /* _LINUX_UNALIGNED_BE_BYTESHIFT_H */ 71 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/unaligned/be_memmove.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_BE_MEMMOVE_H 2 | #define _LINUX_UNALIGNED_BE_MEMMOVE_H 3 | 4 | #include 5 | 6 | static inline u16 get_unaligned_be16(const void *p) 7 | { 8 | return __get_unaligned_memmove16((const u8 *)p); 9 | } 10 | 11 | static inline u32 get_unaligned_be32(const void *p) 12 | { 13 | return __get_unaligned_memmove32((const u8 *)p); 14 | } 15 | 16 | static inline u64 get_unaligned_be64(const void *p) 17 | { 18 | return __get_unaligned_memmove64((const u8 *)p); 19 | } 20 | 21 | static inline void put_unaligned_be16(u16 val, void *p) 22 | { 23 | __put_unaligned_memmove16(val, p); 24 | } 25 | 26 | static inline void put_unaligned_be32(u32 val, void *p) 27 | { 28 | __put_unaligned_memmove32(val, p); 29 | } 30 | 31 | static inline void put_unaligned_be64(u64 val, void *p) 32 | { 33 | __put_unaligned_memmove64(val, p); 34 | } 35 | 36 | #endif /* _LINUX_UNALIGNED_LE_MEMMOVE_H */ 37 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/unaligned/be_struct.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_BE_STRUCT_H 2 | #define _LINUX_UNALIGNED_BE_STRUCT_H 3 | 4 | #include 5 | 6 | static inline u16 get_unaligned_be16(const void *p) 7 | { 8 | return __get_unaligned_cpu16((const u8 *)p); 9 | } 10 | 11 | static inline u32 get_unaligned_be32(const void *p) 12 | { 13 | return __get_unaligned_cpu32((const u8 *)p); 14 | } 15 | 16 | static inline u64 get_unaligned_be64(const void *p) 17 | { 18 | return __get_unaligned_cpu64((const u8 *)p); 19 | } 20 | 21 | static inline void put_unaligned_be16(u16 val, void *p) 22 | { 23 | __put_unaligned_cpu16(val, p); 24 | } 25 | 26 | static inline void put_unaligned_be32(u32 val, void *p) 27 | { 28 | __put_unaligned_cpu32(val, p); 29 | } 30 | 31 | static inline void put_unaligned_be64(u64 val, void *p) 32 | { 33 | __put_unaligned_cpu64(val, p); 34 | } 35 | 36 | #endif /* _LINUX_UNALIGNED_BE_STRUCT_H */ 37 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/unaligned/generic.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_GENERIC_H 2 | #define _LINUX_UNALIGNED_GENERIC_H 3 | 4 | /* 5 | * Cause a link-time error if we try an unaligned access other than 6 | * 1,2,4 or 8 bytes long 7 | */ 8 | extern void __bad_unaligned_access_size(void); 9 | 10 | #define __get_unaligned_le(ptr) ((__force typeof(*(ptr)))({ \ 11 | __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \ 12 | __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_le16((ptr)), \ 13 | __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_le32((ptr)), \ 14 | __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_le64((ptr)), \ 15 | __bad_unaligned_access_size())))); \ 16 | })) 17 | 18 | #define __get_unaligned_be(ptr) ((__force typeof(*(ptr)))({ \ 19 | __builtin_choose_expr(sizeof(*(ptr)) == 1, *(ptr), \ 20 | __builtin_choose_expr(sizeof(*(ptr)) == 2, get_unaligned_be16((ptr)), \ 21 | __builtin_choose_expr(sizeof(*(ptr)) == 4, get_unaligned_be32((ptr)), \ 22 | __builtin_choose_expr(sizeof(*(ptr)) == 8, get_unaligned_be64((ptr)), \ 23 | __bad_unaligned_access_size())))); \ 24 | })) 25 | 26 | #define __put_unaligned_le(val, ptr) ({ \ 27 | void *__gu_p = (ptr); \ 28 | switch (sizeof(*(ptr))) { \ 29 | case 1: \ 30 | *(u8 *)__gu_p = (__force u8)(val); \ 31 | break; \ 32 | case 2: \ 33 | put_unaligned_le16((__force u16)(val), __gu_p); \ 34 | break; \ 35 | case 4: \ 36 | put_unaligned_le32((__force u32)(val), __gu_p); \ 37 | break; \ 38 | case 8: \ 39 | put_unaligned_le64((__force u64)(val), __gu_p); \ 40 | break; \ 41 | default: \ 42 | __bad_unaligned_access_size(); \ 43 | break; \ 44 | } \ 45 | (void)0; }) 46 | 47 | #define __put_unaligned_be(val, ptr) ({ \ 48 | void *__gu_p = (ptr); \ 49 | switch (sizeof(*(ptr))) { \ 50 | case 1: \ 51 | *(u8 *)__gu_p = (__force u8)(val); \ 52 | break; \ 53 | case 2: \ 54 | put_unaligned_be16((__force u16)(val), __gu_p); \ 55 | break; \ 56 | case 4: \ 57 | put_unaligned_be32((__force u32)(val), __gu_p); \ 58 | break; \ 59 | case 8: \ 60 | put_unaligned_be64((__force u64)(val), __gu_p); \ 61 | break; \ 62 | default: \ 63 | __bad_unaligned_access_size(); \ 64 | break; \ 65 | } \ 66 | (void)0; }) 67 | 68 | #endif /* _LINUX_UNALIGNED_GENERIC_H */ 69 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/unaligned/le_byteshift.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_LE_BYTESHIFT_H 2 | #define _LINUX_UNALIGNED_LE_BYTESHIFT_H 3 | 4 | //#include 5 | 6 | static inline u16 __get_unaligned_le16(const u8 *p) 7 | { 8 | return p[0] | p[1] << 8; 9 | } 10 | 11 | static inline u32 __get_unaligned_le32(const u8 *p) 12 | { 13 | return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24; 14 | } 15 | 16 | static inline u64 __get_unaligned_le64(const u8 *p) 17 | { 18 | return (u64)__get_unaligned_le32(p + 4) << 32 | 19 | __get_unaligned_le32(p); 20 | } 21 | 22 | static inline void __put_unaligned_le16(u16 val, u8 *p) 23 | { 24 | *p++ = val; 25 | *p++ = val >> 8; 26 | } 27 | 28 | static inline void __put_unaligned_le32(u32 val, u8 *p) 29 | { 30 | __put_unaligned_le16(val >> 16, p + 2); 31 | __put_unaligned_le16(val, p); 32 | } 33 | 34 | static inline void __put_unaligned_le64(u64 val, u8 *p) 35 | { 36 | __put_unaligned_le32(val >> 32, p + 4); 37 | __put_unaligned_le32(val, p); 38 | } 39 | 40 | static inline u16 get_unaligned_le16(const void *p) 41 | { 42 | return __get_unaligned_le16((const u8 *)p); 43 | } 44 | 45 | static inline u32 get_unaligned_le32(const void *p) 46 | { 47 | return __get_unaligned_le32((const u8 *)p); 48 | } 49 | 50 | static inline u64 get_unaligned_le64(const void *p) 51 | { 52 | return __get_unaligned_le64((const u8 *)p); 53 | } 54 | 55 | static inline void put_unaligned_le16(u16 val, void *p) 56 | { 57 | __put_unaligned_le16(val, p); 58 | } 59 | 60 | static inline void put_unaligned_le32(u32 val, void *p) 61 | { 62 | __put_unaligned_le32(val, p); 63 | } 64 | 65 | static inline void put_unaligned_le64(u64 val, void *p) 66 | { 67 | __put_unaligned_le64(val, p); 68 | } 69 | 70 | #endif /* _LINUX_UNALIGNED_LE_BYTESHIFT_H */ 71 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/unaligned/le_memmove.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_LE_MEMMOVE_H 2 | #define _LINUX_UNALIGNED_LE_MEMMOVE_H 3 | 4 | #include 5 | 6 | static inline u16 get_unaligned_le16(const void *p) 7 | { 8 | return __get_unaligned_memmove16((const u8 *)p); 9 | } 10 | 11 | static inline u32 get_unaligned_le32(const void *p) 12 | { 13 | return __get_unaligned_memmove32((const u8 *)p); 14 | } 15 | 16 | static inline u64 get_unaligned_le64(const void *p) 17 | { 18 | return __get_unaligned_memmove64((const u8 *)p); 19 | } 20 | 21 | static inline void put_unaligned_le16(u16 val, void *p) 22 | { 23 | __put_unaligned_memmove16(val, p); 24 | } 25 | 26 | static inline void put_unaligned_le32(u32 val, void *p) 27 | { 28 | __put_unaligned_memmove32(val, p); 29 | } 30 | 31 | static inline void put_unaligned_le64(u64 val, void *p) 32 | { 33 | __put_unaligned_memmove64(val, p); 34 | } 35 | 36 | #endif /* _LINUX_UNALIGNED_LE_MEMMOVE_H */ 37 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/unaligned/le_struct.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_LE_STRUCT_H 2 | #define _LINUX_UNALIGNED_LE_STRUCT_H 3 | 4 | #include 5 | 6 | static inline u16 get_unaligned_le16(const void *p) 7 | { 8 | return __get_unaligned_cpu16((const u8 *)p); 9 | } 10 | 11 | static inline u32 get_unaligned_le32(const void *p) 12 | { 13 | return __get_unaligned_cpu32((const u8 *)p); 14 | } 15 | 16 | static inline u64 get_unaligned_le64(const void *p) 17 | { 18 | return __get_unaligned_cpu64((const u8 *)p); 19 | } 20 | 21 | static inline void put_unaligned_le16(u16 val, void *p) 22 | { 23 | __put_unaligned_cpu16(val, p); 24 | } 25 | 26 | static inline void put_unaligned_le32(u32 val, void *p) 27 | { 28 | __put_unaligned_cpu32(val, p); 29 | } 30 | 31 | static inline void put_unaligned_le64(u64 val, void *p) 32 | { 33 | __put_unaligned_cpu64(val, p); 34 | } 35 | 36 | #endif /* _LINUX_UNALIGNED_LE_STRUCT_H */ 37 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/unaligned/memmove.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_MEMMOVE_H 2 | #define _LINUX_UNALIGNED_MEMMOVE_H 3 | 4 | //#include 5 | //#include 6 | 7 | /* Use memmove here, so gcc does not insert a __builtin_memcpy. */ 8 | 9 | static inline u16 __get_unaligned_memmove16(const void *p) 10 | { 11 | u16 tmp; 12 | memmove(&tmp, p, 2); 13 | return tmp; 14 | } 15 | 16 | static inline u32 __get_unaligned_memmove32(const void *p) 17 | { 18 | u32 tmp; 19 | memmove(&tmp, p, 4); 20 | return tmp; 21 | } 22 | 23 | static inline u64 __get_unaligned_memmove64(const void *p) 24 | { 25 | u64 tmp; 26 | memmove(&tmp, p, 8); 27 | return tmp; 28 | } 29 | 30 | static inline void __put_unaligned_memmove16(u16 val, void *p) 31 | { 32 | memmove(p, &val, 2); 33 | } 34 | 35 | static inline void __put_unaligned_memmove32(u32 val, void *p) 36 | { 37 | memmove(p, &val, 4); 38 | } 39 | 40 | static inline void __put_unaligned_memmove64(u64 val, void *p) 41 | { 42 | memmove(p, &val, 8); 43 | } 44 | 45 | #endif /* _LINUX_UNALIGNED_MEMMOVE_H */ 46 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/unaligned/packed_struct.h: -------------------------------------------------------------------------------- 1 | #ifndef _LINUX_UNALIGNED_PACKED_STRUCT_H 2 | #define _LINUX_UNALIGNED_PACKED_STRUCT_H 3 | 4 | //#include 5 | 6 | struct __una_u16 { u16 x; } __packed; 7 | struct __una_u32 { u32 x; } __packed; 8 | struct __una_u64 { u64 x; } __packed; 9 | 10 | static inline u16 __get_unaligned_cpu16(const void *p) 11 | { 12 | const struct __una_u16 *ptr = (const struct __una_u16 *)p; 13 | return ptr->x; 14 | } 15 | 16 | static inline u32 __get_unaligned_cpu32(const void *p) 17 | { 18 | const struct __una_u32 *ptr = (const struct __una_u32 *)p; 19 | return ptr->x; 20 | } 21 | 22 | static inline u64 __get_unaligned_cpu64(const void *p) 23 | { 24 | const struct __una_u64 *ptr = (const struct __una_u64 *)p; 25 | return ptr->x; 26 | } 27 | 28 | static inline void __put_unaligned_cpu16(u16 val, void *p) 29 | { 30 | struct __una_u16 *ptr = (struct __una_u16 *)p; 31 | ptr->x = val; 32 | } 33 | 34 | static inline void __put_unaligned_cpu32(u32 val, void *p) 35 | { 36 | struct __una_u32 *ptr = (struct __una_u32 *)p; 37 | ptr->x = val; 38 | } 39 | 40 | static inline void __put_unaligned_cpu64(u64 val, void *p) 41 | { 42 | struct __una_u64 *ptr = (struct __una_u64 *)p; 43 | ptr->x = val; 44 | } 45 | 46 | #endif /* _LINUX_UNALIGNED_PACKED_STRUCT_H */ 47 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/zconf.h: -------------------------------------------------------------------------------- 1 | /* zconf.h -- configuration of the zlib compression library 2 | * Copyright (C) 1995-1998 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* @(#) $Id$ */ 7 | 8 | #ifndef _ZCONF_H 9 | #define _ZCONF_H 10 | 11 | /* The memory requirements for deflate are (in bytes): 12 | (1 << (windowBits+2)) + (1 << (memLevel+9)) 13 | that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) 14 | plus a few kilobytes for small objects. For example, if you want to reduce 15 | the default memory requirements from 256K to 128K, compile with 16 | make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" 17 | Of course this will generally degrade compression (there's no free lunch). 18 | 19 | The memory requirements for inflate are (in bytes) 1 << windowBits 20 | that is, 32K for windowBits=15 (default value) plus a few kilobytes 21 | for small objects. 22 | */ 23 | 24 | /* Maximum value for memLevel in deflateInit2 */ 25 | #ifndef MAX_MEM_LEVEL 26 | # define MAX_MEM_LEVEL 8 27 | #endif 28 | 29 | /* Maximum value for windowBits in deflateInit2 and inflateInit2. 30 | * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files 31 | * created by gzip. (Files created by minigzip can still be extracted by 32 | * gzip.) 33 | */ 34 | #ifndef MAX_WBITS 35 | # define MAX_WBITS 15 /* 32K LZ77 window */ 36 | #endif 37 | 38 | /* default windowBits for decompression. MAX_WBITS is for compression only */ 39 | #ifndef DEF_WBITS 40 | # define DEF_WBITS MAX_WBITS 41 | #endif 42 | 43 | /* default memLevel */ 44 | #if MAX_MEM_LEVEL >= 8 45 | # define DEF_MEM_LEVEL 8 46 | #else 47 | # define DEF_MEM_LEVEL MAX_MEM_LEVEL 48 | #endif 49 | 50 | /* Type declarations */ 51 | 52 | typedef unsigned char Byte; /* 8 bits */ 53 | typedef unsigned int uInt; /* 16 bits or more */ 54 | typedef unsigned long uLong; /* 32 bits or more */ 55 | typedef void *voidp; 56 | 57 | #endif /* _ZCONF_H */ 58 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linux/zutil.h: -------------------------------------------------------------------------------- 1 | /* zutil.h -- internal interface and configuration of the compression library 2 | * Copyright (C) 1995-1998 Jean-loup Gailly. 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | /* @(#) $Id: zutil.h,v 1.1 2000/01/01 03:32:23 davem Exp $ */ 12 | 13 | #ifndef _Z_UTIL_H 14 | #define _Z_UTIL_H 15 | 16 | #include 17 | #include 18 | //#include 19 | //#include 20 | 21 | typedef unsigned char uch; 22 | typedef unsigned short ush; 23 | typedef unsigned long ulg; 24 | 25 | /* common constants */ 26 | 27 | #define STORED_BLOCK 0 28 | #define STATIC_TREES 1 29 | #define DYN_TREES 2 30 | /* The three kinds of block type */ 31 | 32 | #define MIN_MATCH 3 33 | #define MAX_MATCH 258 34 | /* The minimum and maximum match lengths */ 35 | 36 | #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ 37 | 38 | /* target dependencies */ 39 | 40 | /* Common defaults */ 41 | 42 | #ifndef OS_CODE 43 | # define OS_CODE 0x03 /* assume Unix */ 44 | #endif 45 | 46 | /* functions */ 47 | 48 | typedef uLong (*check_func) (uLong check, const Byte *buf, 49 | uInt len); 50 | 51 | 52 | /* checksum functions */ 53 | 54 | #define BASE 65521L /* largest prime smaller than 65536 */ 55 | #define NMAX 5552 56 | /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ 57 | 58 | #define DO1(buf,i) {s1 += buf[i]; s2 += s1;} 59 | #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); 60 | #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); 61 | #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); 62 | #define DO16(buf) DO8(buf,0); DO8(buf,8); 63 | 64 | /* ========================================================================= */ 65 | /* 66 | Update a running Adler-32 checksum with the bytes buf[0..len-1] and 67 | return the updated checksum. If buf is NULL, this function returns 68 | the required initial value for the checksum. 69 | An Adler-32 checksum is almost as reliable as a CRC32 but can be computed 70 | much faster. Usage example: 71 | 72 | uLong adler = adler32(0L, NULL, 0); 73 | 74 | while (read_buffer(buffer, length) != EOF) { 75 | adler = adler32(adler, buffer, length); 76 | } 77 | if (adler != original_adler) error(); 78 | */ 79 | static inline uLong zlib_adler32(uLong adler, 80 | const Byte *buf, 81 | uInt len) 82 | { 83 | unsigned long s1 = adler & 0xffff; 84 | unsigned long s2 = (adler >> 16) & 0xffff; 85 | int k; 86 | 87 | if (buf == NULL) return 1L; 88 | 89 | while (len > 0) { 90 | k = len < NMAX ? len : NMAX; 91 | len -= k; 92 | while (k >= 16) { 93 | DO16(buf); 94 | buf += 16; 95 | k -= 16; 96 | } 97 | if (k != 0) do { 98 | s1 += *buf++; 99 | s2 += s1; 100 | } while (--k); 101 | s1 %= BASE; 102 | s2 %= BASE; 103 | } 104 | return (s2 << 16) | s1; 105 | } 106 | 107 | #endif /* _Z_UTIL_H */ 108 | -------------------------------------------------------------------------------- /Library/DecompressLib/include/linuxcompat.h: -------------------------------------------------------------------------------- 1 | #ifndef LINUXCOMPAT_H 2 | #define LINUXCOMPAT_H 3 | 4 | // UEFI includes 5 | #include 6 | #include 7 | 8 | // libc includes 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | // types 17 | typedef uint8_t u8; 18 | typedef uint16_t u16; 19 | typedef uint32_t u32; 20 | typedef uint64_t u64; 21 | typedef u16 __le16; 22 | typedef u16 __be16; 23 | typedef u32 __le32; 24 | typedef u32 __be32; 25 | typedef u64 __le64; 26 | typedef u64 __be64; 27 | 28 | // memory allocation 29 | #define kmalloc(x, y) malloc(x) 30 | #define kfree(x) free(x) 31 | #define vmalloc(x) malloc(x) 32 | #define vfree(x) free(x) 33 | 34 | // debug 35 | #define pr_debug(fmt, ...) DEBUG((EFI_D_INFO, fmt, __VA_ARGS__)) 36 | 37 | // attributes 38 | #define __initconst 39 | #define __init 40 | #define noinline 41 | #define __force 42 | #define __always_inline inline __attribute__((always_inline)) 43 | 44 | // module info 45 | #define EXPORT_SYMBOL(x) 46 | #define EXPORT_SYMBOL_GPL(x) 47 | #define MODULE_LICENSE(x) 48 | #define MODULE_DESCRIPTION(x) 49 | #define MODULE_VERSION(x) 50 | #define MODULE_AUTHOR(x) 51 | 52 | // compiletime checks 53 | #define unlikely(value) __builtin_expect((value), 0) 54 | #define likely(value) (value) 55 | #define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 56 | 57 | #define min_t(type, x, y) ({ \ 58 | type __min1 = (x); \ 59 | type __min2 = (y); \ 60 | __min1 < __min2 ? __min1: __min2; }) 61 | 62 | #define min(x, y) ({ \ 63 | typeof(x) _min1 = (x); \ 64 | typeof(y) _min2 = (y); \ 65 | (void) (&_min1 == &_min2); \ 66 | _min1 < _min2 ? _min1 : _min2; }) 67 | 68 | #if defined(__LITTLE_ENDIAN) 69 | static inline u32 le32_to_cpup(const __le32 *p) 70 | { 71 | return (__force u32)*p; 72 | } 73 | #else 74 | # error need to define endianess 75 | #endif 76 | 77 | #if defined(__LITTLE_ENDIAN) 78 | # ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 79 | # include 80 | # include 81 | # endif 82 | # include 83 | # define get_unaligned __get_unaligned_le 84 | # define put_unaligned __put_unaligned_le 85 | #elif defined(__BIG_ENDIAN) 86 | # ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS 87 | # include 88 | # include 89 | # endif 90 | # include 91 | # define get_unaligned __get_unaligned_be 92 | # define put_unaligned __put_unaligned_be 93 | #else 94 | # error need to define endianess 95 | #endif 96 | 97 | #endif // LINUXCOMPAT_H 98 | -------------------------------------------------------------------------------- /Library/DecompressLib/lz4/Makefile: -------------------------------------------------------------------------------- 1 | obj-$(CONFIG_LZ4_COMPRESS) += lz4_compress.o 2 | obj-$(CONFIG_LZ4HC_COMPRESS) += lz4hc_compress.o 3 | obj-$(CONFIG_LZ4_DECOMPRESS) += lz4_decompress.o 4 | -------------------------------------------------------------------------------- /Library/DecompressLib/lz4/lz4defs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * lz4defs.h -- architecture specific defines 3 | * 4 | * Copyright (C) 2013, LG Electronics, Kyungsik Lee 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License version 2 as 8 | * published by the Free Software Foundation. 9 | */ 10 | 11 | /* 12 | * Detects 64 bits mode 13 | */ 14 | #if (defined(__x86_64__) || defined(__x86_64) || defined(__amd64__) \ 15 | || defined(__ppc64__) || defined(__LP64__)) 16 | #define LZ4_ARCH64 1 17 | #else 18 | #define LZ4_ARCH64 0 19 | #endif 20 | 21 | /* 22 | * Architecture-specific macros 23 | */ 24 | #define BYTE u8 25 | typedef struct _U16_S { u16 v; } U16_S; 26 | typedef struct _U32_S { u32 v; } U32_S; 27 | typedef struct _U64_S { u64 v; } U64_S; 28 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) \ 29 | || defined(CONFIG_ARM) && __LINUX_ARM_ARCH__ >= 6 \ 30 | && defined(ARM_EFFICIENT_UNALIGNED_ACCESS) 31 | 32 | #define A16(x) (((U16_S *)(x))->v) 33 | #define A32(x) (((U32_S *)(x))->v) 34 | #define A64(x) (((U64_S *)(x))->v) 35 | 36 | #define PUT4(s, d) (A32(d) = A32(s)) 37 | #define PUT8(s, d) (A64(d) = A64(s)) 38 | #define LZ4_WRITE_LITTLEENDIAN_16(p, v) \ 39 | do { \ 40 | A16(p) = v; \ 41 | p += 2; \ 42 | } while (0) 43 | #else /* CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS */ 44 | 45 | #define A64(x) get_unaligned((u64 *)&(((U16_S *)(x))->v)) 46 | #define A32(x) get_unaligned((u32 *)&(((U16_S *)(x))->v)) 47 | #define A16(x) get_unaligned((u16 *)&(((U16_S *)(x))->v)) 48 | 49 | #define PUT4(s, d) \ 50 | put_unaligned(get_unaligned((const u32 *) s), (u32 *) d) 51 | #define PUT8(s, d) \ 52 | put_unaligned(get_unaligned((const u64 *) s), (u64 *) d) 53 | 54 | #define LZ4_WRITE_LITTLEENDIAN_16(p, v) \ 55 | do { \ 56 | put_unaligned(v, (u16 *)(p)); \ 57 | p += 2; \ 58 | } while (0) 59 | #endif 60 | 61 | #define COPYLENGTH 8 62 | #define ML_BITS 4 63 | #define ML_MASK ((1U << ML_BITS) - 1) 64 | #define RUN_BITS (8 - ML_BITS) 65 | #define RUN_MASK ((1U << RUN_BITS) - 1) 66 | #define MEMORY_USAGE 14 67 | #define MINMATCH 4 68 | #define SKIPSTRENGTH 6 69 | #define LASTLITERALS 5 70 | #define MFLIMIT (COPYLENGTH + MINMATCH) 71 | #define MINLENGTH (MFLIMIT + 1) 72 | #define MAXD_LOG 16 73 | #define MAXD (1 << MAXD_LOG) 74 | #define MAXD_MASK (u32)(MAXD - 1) 75 | #define MAX_DISTANCE (MAXD - 1) 76 | #define HASH_LOG (MAXD_LOG - 1) 77 | #define HASHTABLESIZE (1 << HASH_LOG) 78 | #define MAX_NB_ATTEMPTS 256 79 | #define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH) 80 | #define LZ4_64KLIMIT ((1<<16) + (MFLIMIT - 1)) 81 | #define HASHLOG64K ((MEMORY_USAGE - 2) + 1) 82 | #define HASH64KTABLESIZE (1U << HASHLOG64K) 83 | #define LZ4_HASH_VALUE(p) (((A32(p)) * 2654435761U) >> \ 84 | ((MINMATCH * 8) - (MEMORY_USAGE-2))) 85 | #define LZ4_HASH64K_VALUE(p) (((A32(p)) * 2654435761U) >> \ 86 | ((MINMATCH * 8) - HASHLOG64K)) 87 | #define HASH_VALUE(p) (((A32(p)) * 2654435761U) >> \ 88 | ((MINMATCH * 8) - HASH_LOG)) 89 | 90 | #if LZ4_ARCH64/* 64-bit */ 91 | #define STEPSIZE 8 92 | 93 | #define LZ4_COPYSTEP(s, d) \ 94 | do { \ 95 | PUT8(s, d); \ 96 | d += 8; \ 97 | s += 8; \ 98 | } while (0) 99 | 100 | #define LZ4_COPYPACKET(s, d) LZ4_COPYSTEP(s, d) 101 | 102 | #define LZ4_SECURECOPY(s, d, e) \ 103 | do { \ 104 | if (d < e) { \ 105 | LZ4_WILDCOPY(s, d, e); \ 106 | } \ 107 | } while (0) 108 | #define HTYPE u32 109 | 110 | #ifdef __BIG_ENDIAN 111 | #define LZ4_NBCOMMONBYTES(val) (__builtin_clzll(val) >> 3) 112 | #else 113 | #define LZ4_NBCOMMONBYTES(val) (__builtin_ctzll(val) >> 3) 114 | #endif 115 | 116 | #else /* 32-bit */ 117 | #define STEPSIZE 4 118 | 119 | #define LZ4_COPYSTEP(s, d) \ 120 | do { \ 121 | PUT4(s, d); \ 122 | d += 4; \ 123 | s += 4; \ 124 | } while (0) 125 | 126 | #define LZ4_COPYPACKET(s, d) \ 127 | do { \ 128 | LZ4_COPYSTEP(s, d); \ 129 | LZ4_COPYSTEP(s, d); \ 130 | } while (0) 131 | 132 | #define LZ4_SECURECOPY LZ4_WILDCOPY 133 | #define HTYPE const u8* 134 | 135 | #ifdef __BIG_ENDIAN 136 | #define LZ4_NBCOMMONBYTES(val) (__builtin_clz(val) >> 3) 137 | #else 138 | #define LZ4_NBCOMMONBYTES(val) (__builtin_ctz(val) >> 3) 139 | #endif 140 | 141 | #endif 142 | 143 | #define LZ4_READ_LITTLEENDIAN_16(d, s, p) \ 144 | (d = s - get_unaligned_le16(p)) 145 | 146 | #define LZ4_WILDCOPY(s, d, e) \ 147 | do { \ 148 | LZ4_COPYPACKET(s, d); \ 149 | } while (d < e) 150 | 151 | #define LZ4_BLINDCOPY(s, d, l) \ 152 | do { \ 153 | u8 *e = (d) + l; \ 154 | LZ4_WILDCOPY(s, d, e); \ 155 | d = e; \ 156 | } while (0) 157 | -------------------------------------------------------------------------------- /Library/DecompressLib/lzo/Makefile: -------------------------------------------------------------------------------- 1 | lzo_compress-objs := lzo1x_compress.o 2 | lzo_decompress-objs := lzo1x_decompress_safe.o 3 | 4 | obj-$(CONFIG_LZO_COMPRESS) += lzo_compress.o 5 | obj-$(CONFIG_LZO_DECOMPRESS) += lzo_decompress.o 6 | -------------------------------------------------------------------------------- /Library/DecompressLib/lzo/lzo1x_decompress_safe.c: -------------------------------------------------------------------------------- 1 | /* 2 | * LZO1X Decompressor from LZO 3 | * 4 | * Copyright (C) 1996-2012 Markus F.X.J. Oberhumer 5 | * 6 | * The full LZO package can be found at: 7 | * http://www.oberhumer.com/opensource/lzo/ 8 | * 9 | * Changed for Linux kernel use by: 10 | * Nitin Gupta 11 | * Richard Purdie 12 | */ 13 | 14 | #ifndef STATIC 15 | //#include 16 | //#include 17 | #endif 18 | //#include 19 | #include 20 | #include 21 | #include "lzodefs.h" 22 | 23 | #define HAVE_IP(x) ((size_t)(ip_end - ip) >= (size_t)(x)) 24 | #define HAVE_OP(x) ((size_t)(op_end - op) >= (size_t)(x)) 25 | #define NEED_IP(x) if (!HAVE_IP(x)) goto input_overrun 26 | #define NEED_OP(x) if (!HAVE_OP(x)) goto output_overrun 27 | #define TEST_LB(m_pos) if ((m_pos) < out) goto lookbehind_overrun 28 | 29 | /* This MAX_255_COUNT is the maximum number of times we can add 255 to a base 30 | * count without overflowing an integer. The multiply will overflow when 31 | * multiplying 255 by more than MAXINT/255. The sum will overflow earlier 32 | * depending on the base count. Since the base count is taken from a u8 33 | * and a few bits, it is safe to assume that it will always be lower than 34 | * or equal to 2*255, thus we can always prevent any overflow by accepting 35 | * two less 255 steps. See Documentation/lzo.txt for more information. 36 | */ 37 | #define MAX_255_COUNT ((((size_t)~0) / 255) - 2) 38 | 39 | int lzo1x_decompress_safe(const unsigned char *in, size_t in_len, 40 | unsigned char *out, size_t *out_len) 41 | { 42 | unsigned char *op; 43 | const unsigned char *ip; 44 | size_t t, next; 45 | size_t state = 0; 46 | const unsigned char *m_pos; 47 | const unsigned char * const ip_end = in + in_len; 48 | unsigned char * const op_end = out + *out_len; 49 | 50 | op = out; 51 | ip = in; 52 | 53 | if (unlikely(in_len < 3)) 54 | goto input_overrun; 55 | if (*ip > 17) { 56 | t = *ip++ - 17; 57 | if (t < 4) { 58 | next = t; 59 | goto match_next; 60 | } 61 | goto copy_literal_run; 62 | } 63 | 64 | for (;;) { 65 | t = *ip++; 66 | if (t < 16) { 67 | if (likely(state == 0)) { 68 | if (unlikely(t == 0)) { 69 | size_t offset; 70 | const unsigned char *ip_last = ip; 71 | 72 | while (unlikely(*ip == 0)) { 73 | ip++; 74 | NEED_IP(1); 75 | } 76 | offset = ip - ip_last; 77 | if (unlikely(offset > MAX_255_COUNT)) 78 | return LZO_E_ERROR; 79 | 80 | offset = (offset << 8) - offset; 81 | t += offset + 15 + *ip++; 82 | } 83 | t += 3; 84 | copy_literal_run: 85 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) 86 | if (likely(HAVE_IP(t + 15) && HAVE_OP(t + 15))) { 87 | const unsigned char *ie = ip + t; 88 | unsigned char *oe = op + t; 89 | do { 90 | COPY8(op, ip); 91 | op += 8; 92 | ip += 8; 93 | COPY8(op, ip); 94 | op += 8; 95 | ip += 8; 96 | } while (ip < ie); 97 | ip = ie; 98 | op = oe; 99 | } else 100 | #endif 101 | { 102 | NEED_OP(t); 103 | NEED_IP(t + 3); 104 | do { 105 | *op++ = *ip++; 106 | } while (--t > 0); 107 | } 108 | state = 4; 109 | continue; 110 | } else if (state != 4) { 111 | next = t & 3; 112 | m_pos = op - 1; 113 | m_pos -= t >> 2; 114 | m_pos -= *ip++ << 2; 115 | TEST_LB(m_pos); 116 | NEED_OP(2); 117 | op[0] = m_pos[0]; 118 | op[1] = m_pos[1]; 119 | op += 2; 120 | goto match_next; 121 | } else { 122 | next = t & 3; 123 | m_pos = op - (1 + M2_MAX_OFFSET); 124 | m_pos -= t >> 2; 125 | m_pos -= *ip++ << 2; 126 | t = 3; 127 | } 128 | } else if (t >= 64) { 129 | next = t & 3; 130 | m_pos = op - 1; 131 | m_pos -= (t >> 2) & 7; 132 | m_pos -= *ip++ << 3; 133 | t = (t >> 5) - 1 + (3 - 1); 134 | } else if (t >= 32) { 135 | t = (t & 31) + (3 - 1); 136 | if (unlikely(t == 2)) { 137 | size_t offset; 138 | const unsigned char *ip_last = ip; 139 | 140 | while (unlikely(*ip == 0)) { 141 | ip++; 142 | NEED_IP(1); 143 | } 144 | offset = ip - ip_last; 145 | if (unlikely(offset > MAX_255_COUNT)) 146 | return LZO_E_ERROR; 147 | 148 | offset = (offset << 8) - offset; 149 | t += offset + 31 + *ip++; 150 | NEED_IP(2); 151 | } 152 | m_pos = op - 1; 153 | next = get_unaligned_le16(ip); 154 | ip += 2; 155 | m_pos -= next >> 2; 156 | next &= 3; 157 | } else { 158 | m_pos = op; 159 | m_pos -= (t & 8) << 11; 160 | t = (t & 7) + (3 - 1); 161 | if (unlikely(t == 2)) { 162 | size_t offset; 163 | const unsigned char *ip_last = ip; 164 | 165 | while (unlikely(*ip == 0)) { 166 | ip++; 167 | NEED_IP(1); 168 | } 169 | offset = ip - ip_last; 170 | if (unlikely(offset > MAX_255_COUNT)) 171 | return LZO_E_ERROR; 172 | 173 | offset = (offset << 8) - offset; 174 | t += offset + 7 + *ip++; 175 | NEED_IP(2); 176 | } 177 | next = get_unaligned_le16(ip); 178 | ip += 2; 179 | m_pos -= next >> 2; 180 | next &= 3; 181 | if (m_pos == op) 182 | goto eof_found; 183 | m_pos -= 0x4000; 184 | } 185 | TEST_LB(m_pos); 186 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) 187 | if (op - m_pos >= 8) { 188 | unsigned char *oe = op + t; 189 | if (likely(HAVE_OP(t + 15))) { 190 | do { 191 | COPY8(op, m_pos); 192 | op += 8; 193 | m_pos += 8; 194 | COPY8(op, m_pos); 195 | op += 8; 196 | m_pos += 8; 197 | } while (op < oe); 198 | op = oe; 199 | if (HAVE_IP(6)) { 200 | state = next; 201 | COPY4(op, ip); 202 | op += next; 203 | ip += next; 204 | continue; 205 | } 206 | } else { 207 | NEED_OP(t); 208 | do { 209 | *op++ = *m_pos++; 210 | } while (op < oe); 211 | } 212 | } else 213 | #endif 214 | { 215 | unsigned char *oe = op + t; 216 | NEED_OP(t); 217 | op[0] = m_pos[0]; 218 | op[1] = m_pos[1]; 219 | op += 2; 220 | m_pos += 2; 221 | do { 222 | *op++ = *m_pos++; 223 | } while (op < oe); 224 | } 225 | match_next: 226 | state = next; 227 | t = next; 228 | #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS) 229 | if (likely(HAVE_IP(6) && HAVE_OP(4))) { 230 | COPY4(op, ip); 231 | op += t; 232 | ip += t; 233 | } else 234 | #endif 235 | { 236 | NEED_IP(t + 3); 237 | NEED_OP(t); 238 | while (t > 0) { 239 | *op++ = *ip++; 240 | t--; 241 | } 242 | } 243 | } 244 | 245 | eof_found: 246 | *out_len = op - out; 247 | return (t != 3 ? LZO_E_ERROR : 248 | ip == ip_end ? LZO_E_OK : 249 | ip < ip_end ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN); 250 | 251 | input_overrun: 252 | *out_len = op - out; 253 | return LZO_E_INPUT_OVERRUN; 254 | 255 | output_overrun: 256 | *out_len = op - out; 257 | return LZO_E_OUTPUT_OVERRUN; 258 | 259 | lookbehind_overrun: 260 | *out_len = op - out; 261 | return LZO_E_LOOKBEHIND_OVERRUN; 262 | } 263 | #ifndef GCCSTATIC 264 | EXPORT_SYMBOL_GPL(lzo1x_decompress_safe); 265 | 266 | MODULE_LICENSE("GPL"); 267 | MODULE_DESCRIPTION("LZO1X Decompressor"); 268 | 269 | #endif 270 | -------------------------------------------------------------------------------- /Library/DecompressLib/lzo/lzodefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | * lzodefs.h -- architecture, OS and compiler specific defines 3 | * 4 | * Copyright (C) 1996-2012 Markus F.X.J. Oberhumer 5 | * 6 | * The full LZO package can be found at: 7 | * http://www.oberhumer.com/opensource/lzo/ 8 | * 9 | * Changed for Linux kernel use by: 10 | * Nitin Gupta 11 | * Richard Purdie 12 | */ 13 | 14 | 15 | #define COPY4(dst, src) \ 16 | put_unaligned(get_unaligned((const u32 *)(src)), (u32 *)(dst)) 17 | #if defined(__x86_64__) 18 | #define COPY8(dst, src) \ 19 | put_unaligned(get_unaligned((const u64 *)(src)), (u64 *)(dst)) 20 | #else 21 | #define COPY8(dst, src) \ 22 | COPY4(dst, src); COPY4((dst) + 4, (src) + 4) 23 | #endif 24 | 25 | #if defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN) 26 | #error "conflicting endian definitions" 27 | #elif defined(__x86_64__) 28 | #define LZO_USE_CTZ64 1 29 | #define LZO_USE_CTZ32 1 30 | #elif defined(__i386__) || defined(__powerpc__) 31 | #define LZO_USE_CTZ32 1 32 | #elif defined(__arm__) && (__LINUX_ARM_ARCH__ >= 5) 33 | #define LZO_USE_CTZ32 1 34 | #endif 35 | 36 | #define M1_MAX_OFFSET 0x0400 37 | #define M2_MAX_OFFSET 0x0800 38 | #define M3_MAX_OFFSET 0x4000 39 | #define M4_MAX_OFFSET 0xbfff 40 | 41 | #define M1_MIN_LEN 2 42 | #define M1_MAX_LEN 2 43 | #define M2_MIN_LEN 3 44 | #define M2_MAX_LEN 8 45 | #define M3_MIN_LEN 3 46 | #define M3_MAX_LEN 33 47 | #define M4_MIN_LEN 3 48 | #define M4_MAX_LEN 9 49 | 50 | #define M1_MARKER 0 51 | #define M2_MARKER 64 52 | #define M3_MARKER 32 53 | #define M4_MARKER 16 54 | 55 | #define lzo_dict_t unsigned short 56 | #define D_BITS 13 57 | #define D_SIZE (1u << D_BITS) 58 | #define D_MASK (D_SIZE - 1) 59 | #define D_HIGH ((D_MASK >> 1) + 1) 60 | -------------------------------------------------------------------------------- /Library/DecompressLib/xz/Kconfig: -------------------------------------------------------------------------------- 1 | config XZ_DEC 2 | tristate "XZ decompression support" 3 | select CRC32 4 | help 5 | LZMA2 compression algorithm and BCJ filters are supported using 6 | the .xz file format as the container. For integrity checking, 7 | CRC32 is supported. See Documentation/xz.txt for more information. 8 | 9 | if XZ_DEC 10 | 11 | config XZ_DEC_X86 12 | bool "x86 BCJ filter decoder" if EXPERT 13 | default y 14 | select XZ_DEC_BCJ 15 | 16 | config XZ_DEC_POWERPC 17 | bool "PowerPC BCJ filter decoder" if EXPERT 18 | default y 19 | select XZ_DEC_BCJ 20 | 21 | config XZ_DEC_IA64 22 | bool "IA-64 BCJ filter decoder" if EXPERT 23 | default y 24 | select XZ_DEC_BCJ 25 | 26 | config XZ_DEC_ARM 27 | bool "ARM BCJ filter decoder" if EXPERT 28 | default y 29 | select XZ_DEC_BCJ 30 | 31 | config XZ_DEC_ARMTHUMB 32 | bool "ARM-Thumb BCJ filter decoder" if EXPERT 33 | default y 34 | select XZ_DEC_BCJ 35 | 36 | config XZ_DEC_SPARC 37 | bool "SPARC BCJ filter decoder" if EXPERT 38 | default y 39 | select XZ_DEC_BCJ 40 | 41 | endif 42 | 43 | config XZ_DEC_BCJ 44 | bool 45 | default n 46 | 47 | config XZ_DEC_TEST 48 | tristate "XZ decompressor tester" 49 | default n 50 | depends on XZ_DEC 51 | help 52 | This allows passing .xz files to the in-kernel XZ decoder via 53 | a character special file. It calculates CRC32 of the decompressed 54 | data and writes diagnostics to the system log. 55 | 56 | Unless you are developing the XZ decoder, you don't need this 57 | and should say N. 58 | -------------------------------------------------------------------------------- /Library/DecompressLib/xz/Makefile: -------------------------------------------------------------------------------- 1 | obj-$(CONFIG_XZ_DEC) += xz_dec.o 2 | xz_dec-y := xz_dec_syms.o xz_dec_stream.o xz_dec_lzma2.o 3 | xz_dec-$(CONFIG_XZ_DEC_BCJ) += xz_dec_bcj.o 4 | 5 | obj-$(CONFIG_XZ_DEC_TEST) += xz_dec_test.o 6 | -------------------------------------------------------------------------------- /Library/DecompressLib/xz/xz_crc32.c: -------------------------------------------------------------------------------- 1 | /* 2 | * CRC32 using the polynomial from IEEE-802.3 3 | * 4 | * Authors: Lasse Collin 5 | * Igor Pavlov 6 | * 7 | * This file has been put into the public domain. 8 | * You can do whatever you want with this file. 9 | */ 10 | 11 | /* 12 | * This is not the fastest implementation, but it is pretty compact. 13 | * The fastest versions of xz_crc32() on modern CPUs without hardware 14 | * accelerated CRC instruction are 3-5 times as fast as this version, 15 | * but they are bigger and use more memory for the lookup table. 16 | */ 17 | 18 | #include "xz_private.h" 19 | 20 | /* 21 | * STATIC_RW_DATA is used in the pre-boot environment on some architectures. 22 | * See for details. 23 | */ 24 | #ifndef STATIC_RW_DATA 25 | # define STATIC_RW_DATA static 26 | #endif 27 | 28 | STATIC_RW_DATA uint32_t xz_crc32_table[256]; 29 | 30 | XZ_EXTERN void xz_crc32_init(void) 31 | { 32 | const uint32_t poly = 0xEDB88320; 33 | 34 | uint32_t i; 35 | uint32_t j; 36 | uint32_t r; 37 | 38 | for (i = 0; i < 256; ++i) { 39 | r = i; 40 | for (j = 0; j < 8; ++j) 41 | r = (r >> 1) ^ (poly & ~((r & 1) - 1)); 42 | 43 | xz_crc32_table[i] = r; 44 | } 45 | 46 | return; 47 | } 48 | 49 | XZ_EXTERN uint32_t xz_crc32(const uint8_t *buf, size_t size, uint32_t crc) 50 | { 51 | crc = ~crc; 52 | 53 | while (size != 0) { 54 | crc = xz_crc32_table[*buf++ ^ (crc & 0xFF)] ^ (crc >> 8); 55 | --size; 56 | } 57 | 58 | return ~crc; 59 | } 60 | -------------------------------------------------------------------------------- /Library/DecompressLib/xz/xz_dec_syms.c: -------------------------------------------------------------------------------- 1 | /* 2 | * XZ decoder module information 3 | * 4 | * Author: Lasse Collin 5 | * 6 | * This file has been put into the public domain. 7 | * You can do whatever you want with this file. 8 | */ 9 | 10 | //#include 11 | #include 12 | 13 | EXPORT_SYMBOL(xz_dec_init); 14 | EXPORT_SYMBOL(xz_dec_reset); 15 | EXPORT_SYMBOL(xz_dec_run); 16 | EXPORT_SYMBOL(xz_dec_end); 17 | 18 | MODULE_DESCRIPTION("XZ decompressor"); 19 | MODULE_VERSION("1.0"); 20 | MODULE_AUTHOR("Lasse Collin and Igor Pavlov"); 21 | 22 | /* 23 | * This code is in the public domain, but in Linux it's simplest to just 24 | * say it's GPL and consider the authors as the copyright holders. 25 | */ 26 | MODULE_LICENSE("GPL"); 27 | -------------------------------------------------------------------------------- /Library/DecompressLib/xz/xz_lzma2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LZMA2 definitions 3 | * 4 | * Authors: Lasse Collin 5 | * Igor Pavlov 6 | * 7 | * This file has been put into the public domain. 8 | * You can do whatever you want with this file. 9 | */ 10 | 11 | #ifndef XZ_LZMA2_H 12 | #define XZ_LZMA2_H 13 | 14 | /* Range coder constants */ 15 | #define RC_SHIFT_BITS 8 16 | #define RC_TOP_BITS 24 17 | #define RC_TOP_VALUE (1 << RC_TOP_BITS) 18 | #define RC_BIT_MODEL_TOTAL_BITS 11 19 | #define RC_BIT_MODEL_TOTAL (1 << RC_BIT_MODEL_TOTAL_BITS) 20 | #define RC_MOVE_BITS 5 21 | 22 | /* 23 | * Maximum number of position states. A position state is the lowest pb 24 | * number of bits of the current uncompressed offset. In some places there 25 | * are different sets of probabilities for different position states. 26 | */ 27 | #define POS_STATES_MAX (1 << 4) 28 | 29 | /* 30 | * This enum is used to track which LZMA symbols have occurred most recently 31 | * and in which order. This information is used to predict the next symbol. 32 | * 33 | * Symbols: 34 | * - Literal: One 8-bit byte 35 | * - Match: Repeat a chunk of data at some distance 36 | * - Long repeat: Multi-byte match at a recently seen distance 37 | * - Short repeat: One-byte repeat at a recently seen distance 38 | * 39 | * The symbol names are in from STATE_oldest_older_previous. REP means 40 | * either short or long repeated match, and NONLIT means any non-literal. 41 | */ 42 | enum lzma_state { 43 | STATE_LIT_LIT, 44 | STATE_MATCH_LIT_LIT, 45 | STATE_REP_LIT_LIT, 46 | STATE_SHORTREP_LIT_LIT, 47 | STATE_MATCH_LIT, 48 | STATE_REP_LIT, 49 | STATE_SHORTREP_LIT, 50 | STATE_LIT_MATCH, 51 | STATE_LIT_LONGREP, 52 | STATE_LIT_SHORTREP, 53 | STATE_NONLIT_MATCH, 54 | STATE_NONLIT_REP 55 | }; 56 | 57 | /* Total number of states */ 58 | #define STATES 12 59 | 60 | /* The lowest 7 states indicate that the previous state was a literal. */ 61 | #define LIT_STATES 7 62 | 63 | /* Indicate that the latest symbol was a literal. */ 64 | static inline void lzma_state_literal(enum lzma_state *state) 65 | { 66 | if (*state <= STATE_SHORTREP_LIT_LIT) 67 | *state = STATE_LIT_LIT; 68 | else if (*state <= STATE_LIT_SHORTREP) 69 | *state -= 3; 70 | else 71 | *state -= 6; 72 | } 73 | 74 | /* Indicate that the latest symbol was a match. */ 75 | static inline void lzma_state_match(enum lzma_state *state) 76 | { 77 | *state = *state < LIT_STATES ? STATE_LIT_MATCH : STATE_NONLIT_MATCH; 78 | } 79 | 80 | /* Indicate that the latest state was a long repeated match. */ 81 | static inline void lzma_state_long_rep(enum lzma_state *state) 82 | { 83 | *state = *state < LIT_STATES ? STATE_LIT_LONGREP : STATE_NONLIT_REP; 84 | } 85 | 86 | /* Indicate that the latest symbol was a short match. */ 87 | static inline void lzma_state_short_rep(enum lzma_state *state) 88 | { 89 | *state = *state < LIT_STATES ? STATE_LIT_SHORTREP : STATE_NONLIT_REP; 90 | } 91 | 92 | /* Test if the previous symbol was a literal. */ 93 | static inline bool lzma_state_is_literal(enum lzma_state state) 94 | { 95 | return state < LIT_STATES; 96 | } 97 | 98 | /* Each literal coder is divided in three sections: 99 | * - 0x001-0x0FF: Without match byte 100 | * - 0x101-0x1FF: With match byte; match bit is 0 101 | * - 0x201-0x2FF: With match byte; match bit is 1 102 | * 103 | * Match byte is used when the previous LZMA symbol was something else than 104 | * a literal (that is, it was some kind of match). 105 | */ 106 | #define LITERAL_CODER_SIZE 0x300 107 | 108 | /* Maximum number of literal coders */ 109 | #define LITERAL_CODERS_MAX (1 << 4) 110 | 111 | /* Minimum length of a match is two bytes. */ 112 | #define MATCH_LEN_MIN 2 113 | 114 | /* Match length is encoded with 4, 5, or 10 bits. 115 | * 116 | * Length Bits 117 | * 2-9 4 = Choice=0 + 3 bits 118 | * 10-17 5 = Choice=1 + Choice2=0 + 3 bits 119 | * 18-273 10 = Choice=1 + Choice2=1 + 8 bits 120 | */ 121 | #define LEN_LOW_BITS 3 122 | #define LEN_LOW_SYMBOLS (1 << LEN_LOW_BITS) 123 | #define LEN_MID_BITS 3 124 | #define LEN_MID_SYMBOLS (1 << LEN_MID_BITS) 125 | #define LEN_HIGH_BITS 8 126 | #define LEN_HIGH_SYMBOLS (1 << LEN_HIGH_BITS) 127 | #define LEN_SYMBOLS (LEN_LOW_SYMBOLS + LEN_MID_SYMBOLS + LEN_HIGH_SYMBOLS) 128 | 129 | /* 130 | * Maximum length of a match is 273 which is a result of the encoding 131 | * described above. 132 | */ 133 | #define MATCH_LEN_MAX (MATCH_LEN_MIN + LEN_SYMBOLS - 1) 134 | 135 | /* 136 | * Different sets of probabilities are used for match distances that have 137 | * very short match length: Lengths of 2, 3, and 4 bytes have a separate 138 | * set of probabilities for each length. The matches with longer length 139 | * use a shared set of probabilities. 140 | */ 141 | #define DIST_STATES 4 142 | 143 | /* 144 | * Get the index of the appropriate probability array for decoding 145 | * the distance slot. 146 | */ 147 | static inline uint32_t lzma_get_dist_state(uint32_t len) 148 | { 149 | return len < DIST_STATES + MATCH_LEN_MIN 150 | ? len - MATCH_LEN_MIN : DIST_STATES - 1; 151 | } 152 | 153 | /* 154 | * The highest two bits of a 32-bit match distance are encoded using six bits. 155 | * This six-bit value is called a distance slot. This way encoding a 32-bit 156 | * value takes 6-36 bits, larger values taking more bits. 157 | */ 158 | #define DIST_SLOT_BITS 6 159 | #define DIST_SLOTS (1 << DIST_SLOT_BITS) 160 | 161 | /* Match distances up to 127 are fully encoded using probabilities. Since 162 | * the highest two bits (distance slot) are always encoded using six bits, 163 | * the distances 0-3 don't need any additional bits to encode, since the 164 | * distance slot itself is the same as the actual distance. DIST_MODEL_START 165 | * indicates the first distance slot where at least one additional bit is 166 | * needed. 167 | */ 168 | #define DIST_MODEL_START 4 169 | 170 | /* 171 | * Match distances greater than 127 are encoded in three pieces: 172 | * - distance slot: the highest two bits 173 | * - direct bits: 2-26 bits below the highest two bits 174 | * - alignment bits: four lowest bits 175 | * 176 | * Direct bits don't use any probabilities. 177 | * 178 | * The distance slot value of 14 is for distances 128-191. 179 | */ 180 | #define DIST_MODEL_END 14 181 | 182 | /* Distance slots that indicate a distance <= 127. */ 183 | #define FULL_DISTANCES_BITS (DIST_MODEL_END / 2) 184 | #define FULL_DISTANCES (1 << FULL_DISTANCES_BITS) 185 | 186 | /* 187 | * For match distances greater than 127, only the highest two bits and the 188 | * lowest four bits (alignment) is encoded using probabilities. 189 | */ 190 | #define ALIGN_BITS 4 191 | #define ALIGN_SIZE (1 << ALIGN_BITS) 192 | #define ALIGN_MASK (ALIGN_SIZE - 1) 193 | 194 | /* Total number of all probability variables */ 195 | #define PROBS_TOTAL (1846 + LITERAL_CODERS_MAX * LITERAL_CODER_SIZE) 196 | 197 | /* 198 | * LZMA remembers the four most recent match distances. Reusing these 199 | * distances tends to take less space than re-encoding the actual 200 | * distance value. 201 | */ 202 | #define REPS 4 203 | 204 | #endif 205 | -------------------------------------------------------------------------------- /Library/DecompressLib/xz/xz_private.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Private includes and definitions 3 | * 4 | * Author: Lasse Collin 5 | * 6 | * This file has been put into the public domain. 7 | * You can do whatever you want with this file. 8 | */ 9 | 10 | #ifndef XZ_PRIVATE_H 11 | #define XZ_PRIVATE_H 12 | 13 | #include 14 | 15 | #ifdef __KERNEL__ 16 | # include 17 | //# include 18 | //# include 19 | /* XZ_PREBOOT may be defined only via decompress_unxz.c. */ 20 | # ifndef XZ_PREBOOT 21 | //# include 22 | //# include 23 | //# include 24 | # ifdef CONFIG_XZ_DEC_X86 25 | # define XZ_DEC_X86 26 | # endif 27 | # ifdef CONFIG_XZ_DEC_POWERPC 28 | # define XZ_DEC_POWERPC 29 | # endif 30 | # ifdef CONFIG_XZ_DEC_IA64 31 | # define XZ_DEC_IA64 32 | # endif 33 | # ifdef CONFIG_XZ_DEC_ARM 34 | # define XZ_DEC_ARM 35 | # endif 36 | # ifdef CONFIG_XZ_DEC_ARMTHUMB 37 | # define XZ_DEC_ARMTHUMB 38 | # endif 39 | # ifdef CONFIG_XZ_DEC_SPARC 40 | # define XZ_DEC_SPARC 41 | # endif 42 | # define memeq(a, b, size) (memcmp(a, b, size) == 0) 43 | # define memzero(buf, size) memset(buf, 0, size) 44 | # endif 45 | # define get_le32(p) le32_to_cpup((const uint32_t *)(p)) 46 | #else 47 | /* 48 | * For userspace builds, use a separate header to define the required 49 | * macros and functions. This makes it easier to adapt the code into 50 | * different environments and avoids clutter in the Linux kernel tree. 51 | */ 52 | # include "xz_config.h" 53 | #endif 54 | 55 | /* If no specific decoding mode is requested, enable support for all modes. */ 56 | #if !defined(XZ_DEC_SINGLE) && !defined(XZ_DEC_PREALLOC) \ 57 | && !defined(XZ_DEC_DYNALLOC) 58 | # define XZ_DEC_SINGLE 59 | # define XZ_DEC_PREALLOC 60 | # define XZ_DEC_DYNALLOC 61 | #endif 62 | 63 | /* 64 | * The DEC_IS_foo(mode) macros are used in "if" statements. If only some 65 | * of the supported modes are enabled, these macros will evaluate to true or 66 | * false at compile time and thus allow the compiler to omit unneeded code. 67 | */ 68 | #ifdef XZ_DEC_SINGLE 69 | # define DEC_IS_SINGLE(mode) ((mode) == XZ_SINGLE) 70 | #else 71 | # define DEC_IS_SINGLE(mode) (false) 72 | #endif 73 | 74 | #ifdef XZ_DEC_PREALLOC 75 | # define DEC_IS_PREALLOC(mode) ((mode) == XZ_PREALLOC) 76 | #else 77 | # define DEC_IS_PREALLOC(mode) (false) 78 | #endif 79 | 80 | #ifdef XZ_DEC_DYNALLOC 81 | # define DEC_IS_DYNALLOC(mode) ((mode) == XZ_DYNALLOC) 82 | #else 83 | # define DEC_IS_DYNALLOC(mode) (false) 84 | #endif 85 | 86 | #if !defined(XZ_DEC_SINGLE) 87 | # define DEC_IS_MULTI(mode) (true) 88 | #elif defined(XZ_DEC_PREALLOC) || defined(XZ_DEC_DYNALLOC) 89 | # define DEC_IS_MULTI(mode) ((mode) != XZ_SINGLE) 90 | #else 91 | # define DEC_IS_MULTI(mode) (false) 92 | #endif 93 | 94 | /* 95 | * If any of the BCJ filter decoders are wanted, define XZ_DEC_BCJ. 96 | * XZ_DEC_BCJ is used to enable generic support for BCJ decoders. 97 | */ 98 | #ifndef XZ_DEC_BCJ 99 | # if defined(XZ_DEC_X86) || defined(XZ_DEC_POWERPC) \ 100 | || defined(XZ_DEC_IA64) || defined(XZ_DEC_ARM) \ 101 | || defined(XZ_DEC_ARM) || defined(XZ_DEC_ARMTHUMB) \ 102 | || defined(XZ_DEC_SPARC) 103 | # define XZ_DEC_BCJ 104 | # endif 105 | #endif 106 | 107 | /* 108 | * Allocate memory for LZMA2 decoder. xz_dec_lzma2_reset() must be used 109 | * before calling xz_dec_lzma2_run(). 110 | */ 111 | XZ_EXTERN struct xz_dec_lzma2 *xz_dec_lzma2_create(enum xz_mode mode, 112 | uint32_t dict_max); 113 | 114 | /* 115 | * Decode the LZMA2 properties (one byte) and reset the decoder. Return 116 | * XZ_OK on success, XZ_MEMLIMIT_ERROR if the preallocated dictionary is not 117 | * big enough, and XZ_OPTIONS_ERROR if props indicates something that this 118 | * decoder doesn't support. 119 | */ 120 | XZ_EXTERN enum xz_ret xz_dec_lzma2_reset(struct xz_dec_lzma2 *s, 121 | uint8_t props); 122 | 123 | /* Decode raw LZMA2 stream from b->in to b->out. */ 124 | XZ_EXTERN enum xz_ret xz_dec_lzma2_run(struct xz_dec_lzma2 *s, 125 | struct xz_buf *b); 126 | 127 | /* Free the memory allocated for the LZMA2 decoder. */ 128 | XZ_EXTERN void xz_dec_lzma2_end(struct xz_dec_lzma2 *s); 129 | 130 | #ifdef XZ_DEC_BCJ 131 | /* 132 | * Allocate memory for BCJ decoders. xz_dec_bcj_reset() must be used before 133 | * calling xz_dec_bcj_run(). 134 | */ 135 | XZ_EXTERN struct xz_dec_bcj *xz_dec_bcj_create(bool single_call); 136 | 137 | /* 138 | * Decode the Filter ID of a BCJ filter. This implementation doesn't 139 | * support custom start offsets, so no decoding of Filter Properties 140 | * is needed. Returns XZ_OK if the given Filter ID is supported. 141 | * Otherwise XZ_OPTIONS_ERROR is returned. 142 | */ 143 | XZ_EXTERN enum xz_ret xz_dec_bcj_reset(struct xz_dec_bcj *s, uint8_t id); 144 | 145 | /* 146 | * Decode raw BCJ + LZMA2 stream. This must be used only if there actually is 147 | * a BCJ filter in the chain. If the chain has only LZMA2, xz_dec_lzma2_run() 148 | * must be called directly. 149 | */ 150 | XZ_EXTERN enum xz_ret xz_dec_bcj_run(struct xz_dec_bcj *s, 151 | struct xz_dec_lzma2 *lzma2, 152 | struct xz_buf *b); 153 | 154 | /* Free the memory allocated for the BCJ filters. */ 155 | #define xz_dec_bcj_end(s) kfree(s) 156 | #endif 157 | 158 | #endif 159 | -------------------------------------------------------------------------------- /Library/DecompressLib/xz/xz_stream.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Definitions for handling the .xz file format 3 | * 4 | * Author: Lasse Collin 5 | * 6 | * This file has been put into the public domain. 7 | * You can do whatever you want with this file. 8 | */ 9 | 10 | #ifndef XZ_STREAM_H 11 | #define XZ_STREAM_H 12 | 13 | #if defined(__KERNEL__) && !XZ_INTERNAL_CRC32 14 | # include 15 | # undef crc32 16 | # define xz_crc32(buf, size, crc) \ 17 | (~crc32_le(~(uint32_t)(crc), buf, size)) 18 | #endif 19 | 20 | /* 21 | * See the .xz file format specification at 22 | * http://tukaani.org/xz/xz-file-format.txt 23 | * to understand the container format. 24 | */ 25 | 26 | #define STREAM_HEADER_SIZE 12 27 | 28 | #define HEADER_MAGIC "\3757zXZ" 29 | #define HEADER_MAGIC_SIZE 6 30 | 31 | #define FOOTER_MAGIC "YZ" 32 | #define FOOTER_MAGIC_SIZE 2 33 | 34 | /* 35 | * Variable-length integer can hold a 63-bit unsigned integer or a special 36 | * value indicating that the value is unknown. 37 | * 38 | * Experimental: vli_type can be defined to uint32_t to save a few bytes 39 | * in code size (no effect on speed). Doing so limits the uncompressed and 40 | * compressed size of the file to less than 256 MiB and may also weaken 41 | * error detection slightly. 42 | */ 43 | typedef uint64_t vli_type; 44 | 45 | #define VLI_MAX ((vli_type)-1 / 2) 46 | #define VLI_UNKNOWN ((vli_type)-1) 47 | 48 | /* Maximum encoded size of a VLI */ 49 | #define VLI_BYTES_MAX (sizeof(vli_type) * 8 / 7) 50 | 51 | /* Integrity Check types */ 52 | enum xz_check { 53 | XZ_CHECK_NONE = 0, 54 | XZ_CHECK_CRC32 = 1, 55 | XZ_CHECK_CRC64 = 4, 56 | XZ_CHECK_SHA256 = 10 57 | }; 58 | 59 | /* Maximum possible Check ID */ 60 | #define XZ_CHECK_MAX 15 61 | 62 | #endif 63 | -------------------------------------------------------------------------------- /Library/DecompressLib/zlib_inflate/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # This is a modified version of zlib, which does all memory 3 | # allocation ahead of time. 4 | # 5 | # This is only the decompression, see zlib_deflate for the 6 | # the compression 7 | # 8 | # Decompression needs to be serialized for each memory 9 | # allocation. 10 | # 11 | # (The upsides of the simplification is that you can't get in 12 | # any nasty situations wrt memory management, and that the 13 | # uncompression can be done without blocking on allocation). 14 | # 15 | 16 | obj-$(CONFIG_ZLIB_INFLATE) += zlib_inflate.o 17 | 18 | zlib_inflate-objs := inffast.o inflate.o infutil.o \ 19 | inftrees.o inflate_syms.o 20 | -------------------------------------------------------------------------------- /Library/DecompressLib/zlib_inflate/inffast.h: -------------------------------------------------------------------------------- 1 | /* inffast.h -- header to use inffast.c 2 | * Copyright (C) 1995-2003 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | void zlib_inflate_fast (z_streamp strm, unsigned start); 12 | -------------------------------------------------------------------------------- /Library/DecompressLib/zlib_inflate/inffixed.h: -------------------------------------------------------------------------------- 1 | /* inffixed.h -- table for decoding fixed codes 2 | * Generated automatically by makefixed(). 3 | */ 4 | 5 | /* WARNING: this file should *not* be used by applications. It 6 | is part of the implementation of the compression library and 7 | is subject to change. Applications should only use zlib.h. 8 | */ 9 | 10 | static const code lenfix[512] = { 11 | {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, 12 | {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, 13 | {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, 14 | {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, 15 | {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, 16 | {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, 17 | {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, 18 | {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, 19 | {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, 20 | {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, 21 | {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, 22 | {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, 23 | {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, 24 | {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, 25 | {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, 26 | {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, 27 | {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, 28 | {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, 29 | {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, 30 | {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, 31 | {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, 32 | {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, 33 | {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, 34 | {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, 35 | {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, 36 | {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, 37 | {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, 38 | {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, 39 | {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, 40 | {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, 41 | {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, 42 | {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, 43 | {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, 44 | {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, 45 | {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, 46 | {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, 47 | {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, 48 | {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, 49 | {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, 50 | {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, 51 | {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, 52 | {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, 53 | {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, 54 | {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, 55 | {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, 56 | {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, 57 | {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, 58 | {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, 59 | {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, 60 | {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, 61 | {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, 62 | {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, 63 | {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, 64 | {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, 65 | {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, 66 | {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, 67 | {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, 68 | {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, 69 | {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, 70 | {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, 71 | {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, 72 | {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, 73 | {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, 74 | {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, 75 | {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, 76 | {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, 77 | {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, 78 | {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, 79 | {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, 80 | {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, 81 | {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, 82 | {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, 83 | {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, 84 | {0,9,255} 85 | }; 86 | 87 | static const code distfix[32] = { 88 | {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, 89 | {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, 90 | {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, 91 | {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, 92 | {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, 93 | {22,5,193},{64,5,0} 94 | }; 95 | -------------------------------------------------------------------------------- /Library/DecompressLib/zlib_inflate/inflate.h: -------------------------------------------------------------------------------- 1 | #ifndef INFLATE_H 2 | #define INFLATE_H 3 | 4 | /* inflate.h -- internal inflate state definition 5 | * Copyright (C) 1995-2004 Mark Adler 6 | * For conditions of distribution and use, see copyright notice in zlib.h 7 | */ 8 | 9 | /* WARNING: this file should *not* be used by applications. It is 10 | part of the implementation of the compression library and is 11 | subject to change. Applications should only use zlib.h. 12 | */ 13 | 14 | /* Possible inflate modes between inflate() calls */ 15 | typedef enum { 16 | HEAD, /* i: waiting for magic header */ 17 | FLAGS, /* i: waiting for method and flags (gzip) */ 18 | TIME, /* i: waiting for modification time (gzip) */ 19 | OS, /* i: waiting for extra flags and operating system (gzip) */ 20 | EXLEN, /* i: waiting for extra length (gzip) */ 21 | EXTRA, /* i: waiting for extra bytes (gzip) */ 22 | NAME, /* i: waiting for end of file name (gzip) */ 23 | COMMENT, /* i: waiting for end of comment (gzip) */ 24 | HCRC, /* i: waiting for header crc (gzip) */ 25 | DICTID, /* i: waiting for dictionary check value */ 26 | DICT, /* waiting for inflateSetDictionary() call */ 27 | TYPE, /* i: waiting for type bits, including last-flag bit */ 28 | TYPEDO, /* i: same, but skip check to exit inflate on new block */ 29 | STORED, /* i: waiting for stored size (length and complement) */ 30 | COPY, /* i/o: waiting for input or output to copy stored block */ 31 | TABLE, /* i: waiting for dynamic block table lengths */ 32 | LENLENS, /* i: waiting for code length code lengths */ 33 | CODELENS, /* i: waiting for length/lit and distance code lengths */ 34 | LEN, /* i: waiting for length/lit code */ 35 | LENEXT, /* i: waiting for length extra bits */ 36 | DIST, /* i: waiting for distance code */ 37 | DISTEXT, /* i: waiting for distance extra bits */ 38 | MATCH, /* o: waiting for output space to copy string */ 39 | LIT, /* o: waiting for output space to write literal */ 40 | CHECK, /* i: waiting for 32-bit check value */ 41 | LENGTH, /* i: waiting for 32-bit length (gzip) */ 42 | DONE, /* finished check, done -- remain here until reset */ 43 | BAD, /* got a data error -- remain here until reset */ 44 | MEM, /* got an inflate() memory error -- remain here until reset */ 45 | SYNC /* looking for synchronization bytes to restart inflate() */ 46 | } inflate_mode; 47 | 48 | /* 49 | State transitions between above modes - 50 | 51 | (most modes can go to the BAD or MEM mode -- not shown for clarity) 52 | 53 | Process header: 54 | HEAD -> (gzip) or (zlib) 55 | (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME 56 | NAME -> COMMENT -> HCRC -> TYPE 57 | (zlib) -> DICTID or TYPE 58 | DICTID -> DICT -> TYPE 59 | Read deflate blocks: 60 | TYPE -> STORED or TABLE or LEN or CHECK 61 | STORED -> COPY -> TYPE 62 | TABLE -> LENLENS -> CODELENS -> LEN 63 | Read deflate codes: 64 | LEN -> LENEXT or LIT or TYPE 65 | LENEXT -> DIST -> DISTEXT -> MATCH -> LEN 66 | LIT -> LEN 67 | Process trailer: 68 | CHECK -> LENGTH -> DONE 69 | */ 70 | 71 | /* state maintained between inflate() calls. Approximately 7K bytes. */ 72 | struct inflate_state { 73 | inflate_mode mode; /* current inflate mode */ 74 | int last; /* true if processing last block */ 75 | int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ 76 | int havedict; /* true if dictionary provided */ 77 | int flags; /* gzip header method and flags (0 if zlib) */ 78 | unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ 79 | unsigned long check; /* protected copy of check value */ 80 | unsigned long total; /* protected copy of output count */ 81 | /* gz_headerp head; */ /* where to save gzip header information */ 82 | /* sliding window */ 83 | unsigned wbits; /* log base 2 of requested window size */ 84 | unsigned wsize; /* window size or zero if not using window */ 85 | unsigned whave; /* valid bytes in the window */ 86 | unsigned write; /* window write index */ 87 | unsigned char *window; /* allocated sliding window, if needed */ 88 | /* bit accumulator */ 89 | unsigned long hold; /* input bit accumulator */ 90 | unsigned bits; /* number of bits in "in" */ 91 | /* for string and stored block copying */ 92 | unsigned length; /* literal or length of data to copy */ 93 | unsigned offset; /* distance back to copy string from */ 94 | /* for table and code decoding */ 95 | unsigned extra; /* extra bits needed */ 96 | /* fixed and dynamic code tables */ 97 | code const *lencode; /* starting table for length/literal codes */ 98 | code const *distcode; /* starting table for distance codes */ 99 | unsigned lenbits; /* index bits for lencode */ 100 | unsigned distbits; /* index bits for distcode */ 101 | /* dynamic table building */ 102 | unsigned ncode; /* number of code length code lengths */ 103 | unsigned nlen; /* number of length code lengths */ 104 | unsigned ndist; /* number of distance code lengths */ 105 | unsigned have; /* number of code lengths in lens[] */ 106 | code *next; /* next available space in codes[] */ 107 | unsigned short lens[320]; /* temporary storage for code lengths */ 108 | unsigned short work[288]; /* work area for code table building */ 109 | code codes[ENOUGH]; /* space for code tables */ 110 | }; 111 | #endif 112 | -------------------------------------------------------------------------------- /Library/DecompressLib/zlib_inflate/inflate_syms.c: -------------------------------------------------------------------------------- 1 | /* 2 | * linux/lib/zlib_inflate/inflate_syms.c 3 | * 4 | * Exported symbols for the inflate functionality. 5 | * 6 | */ 7 | 8 | //#include 9 | //#include 10 | #include 11 | 12 | #include 13 | 14 | EXPORT_SYMBOL(zlib_inflate_workspacesize); 15 | EXPORT_SYMBOL(zlib_inflate); 16 | EXPORT_SYMBOL(zlib_inflateInit2); 17 | EXPORT_SYMBOL(zlib_inflateEnd); 18 | EXPORT_SYMBOL(zlib_inflateReset); 19 | EXPORT_SYMBOL(zlib_inflateIncomp); 20 | EXPORT_SYMBOL(zlib_inflate_blob); 21 | MODULE_LICENSE("GPL"); 22 | -------------------------------------------------------------------------------- /Library/DecompressLib/zlib_inflate/inftrees.h: -------------------------------------------------------------------------------- 1 | #ifndef INFTREES_H 2 | #define INFTREES_H 3 | 4 | /* inftrees.h -- header to use inftrees.c 5 | * Copyright (C) 1995-2005 Mark Adler 6 | * For conditions of distribution and use, see copyright notice in zlib.h 7 | */ 8 | 9 | /* WARNING: this file should *not* be used by applications. It is 10 | part of the implementation of the compression library and is 11 | subject to change. Applications should only use zlib.h. 12 | */ 13 | 14 | /* Structure for decoding tables. Each entry provides either the 15 | information needed to do the operation requested by the code that 16 | indexed that table entry, or it provides a pointer to another 17 | table that indexes more bits of the code. op indicates whether 18 | the entry is a pointer to another table, a literal, a length or 19 | distance, an end-of-block, or an invalid code. For a table 20 | pointer, the low four bits of op is the number of index bits of 21 | that table. For a length or distance, the low four bits of op 22 | is the number of extra bits to get after the code. bits is 23 | the number of bits in this code or part of the code to drop off 24 | of the bit buffer. val is the actual byte to output in the case 25 | of a literal, the base length or distance, or the offset from 26 | the current table to the next table. Each entry is four bytes. */ 27 | typedef struct { 28 | unsigned char op; /* operation, extra bits, table bits */ 29 | unsigned char bits; /* bits in this part of the code */ 30 | unsigned short val; /* offset in table or code value */ 31 | } code; 32 | 33 | /* op values as set by inflate_table(): 34 | 00000000 - literal 35 | 0000tttt - table link, tttt != 0 is the number of table index bits 36 | 0001eeee - length or distance, eeee is the number of extra bits 37 | 01100000 - end of block 38 | 01000000 - invalid code 39 | */ 40 | 41 | /* Maximum size of dynamic tree. The maximum found in a long but non- 42 | exhaustive search was 1444 code structures (852 for length/literals 43 | and 592 for distances, the latter actually the result of an 44 | exhaustive search). The true maximum is not known, but the value 45 | below is more than safe. */ 46 | #define ENOUGH 2048 47 | #define MAXD 592 48 | 49 | /* Type of code to build for inftable() */ 50 | typedef enum { 51 | CODES, 52 | LENS, 53 | DISTS 54 | } codetype; 55 | 56 | extern int zlib_inflate_table (codetype type, unsigned short *lens, 57 | unsigned codes, code **table, 58 | unsigned *bits, unsigned short *work); 59 | #endif 60 | -------------------------------------------------------------------------------- /Library/DecompressLib/zlib_inflate/infutil.c: -------------------------------------------------------------------------------- 1 | #include 2 | //#include 3 | //#include 4 | //#include 5 | #include 6 | 7 | /* Utility function: initialize zlib, unpack binary blob, clean up zlib, 8 | * return len or negative error code. 9 | */ 10 | int zlib_inflate_blob(void *gunzip_buf, unsigned int sz, 11 | const void *buf, unsigned int len) 12 | { 13 | const u8 *zbuf = buf; 14 | struct z_stream_s *strm; 15 | int rc; 16 | 17 | rc = -ENOMEM; 18 | strm = kmalloc(sizeof(*strm), GFP_KERNEL); 19 | if (strm == NULL) 20 | goto gunzip_nomem1; 21 | strm->workspace = kmalloc(zlib_inflate_workspacesize(), GFP_KERNEL); 22 | if (strm->workspace == NULL) 23 | goto gunzip_nomem2; 24 | 25 | /* gzip header (1f,8b,08... 10 bytes total + possible asciz filename) 26 | * expected to be stripped from input 27 | */ 28 | strm->next_in = zbuf; 29 | strm->avail_in = len; 30 | strm->next_out = gunzip_buf; 31 | strm->avail_out = sz; 32 | 33 | rc = zlib_inflateInit2(strm, -MAX_WBITS); 34 | if (rc == Z_OK) { 35 | rc = zlib_inflate(strm, Z_FINISH); 36 | /* after Z_FINISH, only Z_STREAM_END is "we unpacked it all" */ 37 | if (rc == Z_STREAM_END) 38 | rc = sz - strm->avail_out; 39 | else 40 | rc = -EINVAL; 41 | zlib_inflateEnd(strm); 42 | } else 43 | rc = -EINVAL; 44 | 45 | kfree(strm->workspace); 46 | gunzip_nomem2: 47 | kfree(strm); 48 | gunzip_nomem1: 49 | return rc; /* returns Z_OK (0) if successful */ 50 | } 51 | -------------------------------------------------------------------------------- /Library/DecompressLib/zlib_inflate/infutil.h: -------------------------------------------------------------------------------- 1 | /* infutil.h -- types and macros common to blocks and codes 2 | * Copyright (C) 1995-1998 Mark Adler 3 | * For conditions of distribution and use, see copyright notice in zlib.h 4 | */ 5 | 6 | /* WARNING: this file should *not* be used by applications. It is 7 | part of the implementation of the compression library and is 8 | subject to change. Applications should only use zlib.h. 9 | */ 10 | 11 | #ifndef _INFUTIL_H 12 | #define _INFUTIL_H 13 | 14 | #include 15 | 16 | /* memory allocation for inflation */ 17 | 18 | struct inflate_workspace { 19 | struct inflate_state inflate_state; 20 | unsigned char working_window[1 << MAX_WBITS]; 21 | }; 22 | 23 | #define WS(z) ((struct inflate_workspace *)(z->workspace)) 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /Library/Freetype2Lib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = Freetype2Lib 24 | FILE_GUID = 809d321a-2042-4f8d-b835-c6a137d3ceb3 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = Freetype2Lib 28 | 29 | # 30 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 31 | # 32 | 33 | [Sources] 34 | EFIDroidModules/libaroma/libs/freetype/src/base/ftbbox.c 35 | EFIDroidModules/libaroma/libs/freetype/src/base/ftbitmap.c 36 | EFIDroidModules/libaroma/libs/freetype/src/base/ftfstype.c 37 | EFIDroidModules/libaroma/libs/freetype/src/base/ftglyph.c 38 | EFIDroidModules/libaroma/libs/freetype/src/base/ftlcdfil.c 39 | EFIDroidModules/libaroma/libs/freetype/src/base/ftstroke.c 40 | EFIDroidModules/libaroma/libs/freetype/src/base/fttype1.c 41 | EFIDroidModules/libaroma/libs/freetype/src/base/ftbase.c 42 | EFIDroidModules/libaroma/libs/freetype/src/base/ftsystem.c 43 | EFIDroidModules/libaroma/libs/freetype/src/base/ftinit.c 44 | EFIDroidModules/libaroma/libs/freetype/src/base/ftgasp.c 45 | EFIDroidModules/libaroma/libs/freetype/src/raster/raster.c 46 | EFIDroidModules/libaroma/libs/freetype/src/sfnt/sfnt.c 47 | EFIDroidModules/libaroma/libs/freetype/src/smooth/smooth.c 48 | EFIDroidModules/libaroma/libs/freetype/src/autofit/autofit.c 49 | EFIDroidModules/libaroma/libs/freetype/src/truetype/truetype.c 50 | EFIDroidModules/libaroma/libs/freetype/src/cff/cff.c 51 | EFIDroidModules/libaroma/libs/freetype/src/cid/type1cid.c 52 | EFIDroidModules/libaroma/libs/freetype/src/bdf/bdf.c 53 | EFIDroidModules/libaroma/libs/freetype/src/type1/type1.c 54 | EFIDroidModules/libaroma/libs/freetype/src/type42/type42.c 55 | EFIDroidModules/libaroma/libs/freetype/src/winfonts/winfnt.c 56 | EFIDroidModules/libaroma/libs/freetype/src/pcf/pcf.c 57 | EFIDroidModules/libaroma/libs/freetype/src/pfr/pfr.c 58 | EFIDroidModules/libaroma/libs/freetype/src/psaux/psaux.c 59 | EFIDroidModules/libaroma/libs/freetype/src/psnames/psnames.c 60 | EFIDroidModules/libaroma/libs/freetype/src/pshinter/pshinter.c 61 | EFIDroidModules/libaroma/libs/freetype/src/gzip/ftgzip.c 62 | EFIDroidModules/libaroma/libs/freetype/src/lzw/ftlzw.c 63 | 64 | [Packages] 65 | StdLib/StdLib.dec 66 | MdePkg/MdePkg.dec 67 | EFIDroidUEFIApps/EFIDroidUi/Library/AromaLib/AromaLib.dec 68 | 69 | [LibraryClasses] 70 | LibC 71 | LibStdio 72 | 73 | [Depex] 74 | TRUE 75 | 76 | [BuildOptions] 77 | GCC:*_*_*_CC_FLAGS = -DFT2_BUILD_LIBRARY -DFT2_NO_HARFBUZZ -Wno-maybe-uninitialized -Wno-error 78 | -------------------------------------------------------------------------------- /Library/FstabLib/FstabLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = FstabLib 24 | FILE_GUID = e89a953b-7405-4e12-99ab-44036236654d 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = FstabLib 28 | 29 | # 30 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 31 | # 32 | 33 | [Sources] 34 | Fstab.c 35 | 36 | [Packages] 37 | MdePkg/MdePkg.dec 38 | MdeModulePkg/MdeModulePkg.dec 39 | EFIDroidUEFIApps/EFIDroidUi/EFIDroidUi.dec 40 | 41 | [LibraryClasses] 42 | BaseLib 43 | UefiBootServicesTableLib 44 | UefiLib 45 | PrintLib 46 | 47 | [Depex] 48 | TRUE 49 | -------------------------------------------------------------------------------- /Library/FstabLib/FstabPriv.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2012 The Android Open Source Project 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CORE_FS_MGR_PRIV_H 18 | #define __CORE_FS_MGR_PRIV_H 19 | 20 | /* fstab has the following format: 21 | * 22 | * Any line starting with a # is a comment and ignored 23 | * 24 | * Any blank line is ignored 25 | * 26 | * All other lines must be in this format: 27 | * 28 | * 29 | * is a comma separated list of flags that can be passed to the 30 | * mount command. The list includes noatime, nosuid, nodev, nodiratime, 31 | * ro, rw, remount, defaults. 32 | * 33 | * is a comma separated list of options accepted by the filesystem being 34 | * mounted. It is passed directly to mount without being parsed 35 | * 36 | * is a comma separated list of flags that control the operation of 37 | * the fs_mgr program. The list includes "wait", which will wait till 38 | * the file exists, and "check", which requests that the fs_mgr 39 | * run an fscheck program on the before mounting the filesystem. 40 | * If check is specifed on a read-only filesystem, it is ignored. 41 | * Also, "encryptable" means that filesystem can be encrypted. 42 | * The "encryptable" flag _MUST_ be followed by a = and a string which 43 | * is the location of the encryption keys. It can either be a path 44 | * to a file or partition which contains the keys, or the word "footer" 45 | * which means the keys are in the last 16 Kbytes of the partition 46 | * containing the filesystem. 47 | * 48 | * When the fs_mgr is requested to mount all filesystems, it will first mount all the 49 | * filesystems that do _NOT_ specify check (including filesystems that are read-only and 50 | * specify check, because check is ignored in that case) and then it will check and mount 51 | * filesystem marked with check. 52 | * 53 | */ 54 | 55 | #define MF_MULTIBOOT 0x4000 56 | #define MF_UEFI 0x8000 57 | #define MF_NVVARS 0x10000 58 | #define MF_ESP 0x20000 59 | 60 | #endif /* __CORE_FS_MGR_PRIV_H */ 61 | 62 | -------------------------------------------------------------------------------- /Library/FstabLib/LICENSE.txt: -------------------------------------------------------------------------------- 1 | 2 | The "inih" library is distributed under the New BSD license: 3 | 4 | Copyright (c) 2009, Ben Hoyt 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | * Redistributions of source code must retain the above copyright 10 | notice, this list of conditions and the following disclaimer. 11 | * Redistributions in binary form must reproduce the above copyright 12 | notice, this list of conditions and the following disclaimer in the 13 | documentation and/or other materials provided with the distribution. 14 | * Neither the name of Ben Hoyt nor the names of its contributors 15 | may be used to endorse or promote products derived from this software 16 | without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY BEN HOYT ''AS IS'' AND ANY 19 | EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL BEN HOYT BE LIABLE FOR ANY 22 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /Library/IniLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = IniLib 24 | FILE_GUID = 810d6b99-986f-49e1-ad3c-a48fba3658b2 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = IniLib 28 | 29 | # 30 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 31 | # 32 | 33 | [Sources] 34 | EFIDroidModules/inih/ini.c 35 | 36 | [Packages] 37 | StdLib/StdLib.dec 38 | MdePkg/MdePkg.dec 39 | MdeModulePkg/MdeModulePkg.dec 40 | EFIDroidUEFIApps/EFIDroidUi/EFIDroidUi.dec 41 | 42 | [LibraryClasses] 43 | LibC 44 | LibStdio 45 | 46 | [Depex] 47 | TRUE 48 | 49 | [BuildOptions] 50 | GCC:*_*_*_CC_FLAGS = -DNO_CTYPE_MACROS=1 -DINI_USE_STACK=0 51 | -------------------------------------------------------------------------------- /Library/JpegLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = JpegLib 24 | FILE_GUID = 5d1ea1fe-0126-4bba-b4be-fb35138c1272 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = JpegLib 28 | 29 | # 30 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 31 | # 32 | 33 | [Sources] 34 | EFIDroidModules/libaroma/libs/jpeg/jcapimin.c 35 | EFIDroidModules/libaroma/libs/jpeg/jcapistd.c 36 | EFIDroidModules/libaroma/libs/jpeg/jccoefct.c 37 | EFIDroidModules/libaroma/libs/jpeg/jccolor.c 38 | EFIDroidModules/libaroma/libs/jpeg/jcdctmgr.c 39 | EFIDroidModules/libaroma/libs/jpeg/jchuff.c 40 | EFIDroidModules/libaroma/libs/jpeg/jcinit.c 41 | EFIDroidModules/libaroma/libs/jpeg/jcmainct.c 42 | EFIDroidModules/libaroma/libs/jpeg/jcmarker.c 43 | EFIDroidModules/libaroma/libs/jpeg/jcmaster.c 44 | EFIDroidModules/libaroma/libs/jpeg/jcomapi.c 45 | EFIDroidModules/libaroma/libs/jpeg/jcparam.c 46 | EFIDroidModules/libaroma/libs/jpeg/jcphuff.c 47 | EFIDroidModules/libaroma/libs/jpeg/jcprepct.c 48 | EFIDroidModules/libaroma/libs/jpeg/jcsample.c 49 | EFIDroidModules/libaroma/libs/jpeg/jctrans.c 50 | EFIDroidModules/libaroma/libs/jpeg/jdapimin.c 51 | EFIDroidModules/libaroma/libs/jpeg/jdapistd.c 52 | EFIDroidModules/libaroma/libs/jpeg/jdatadst.c 53 | EFIDroidModules/libaroma/libs/jpeg/jdatasrc.c 54 | EFIDroidModules/libaroma/libs/jpeg/jdcoefct.c 55 | EFIDroidModules/libaroma/libs/jpeg/jdcolor.c 56 | EFIDroidModules/libaroma/libs/jpeg/jddctmgr.c 57 | EFIDroidModules/libaroma/libs/jpeg/jdhuff.c 58 | EFIDroidModules/libaroma/libs/jpeg/jdinput.c 59 | EFIDroidModules/libaroma/libs/jpeg/jdmainct.c 60 | EFIDroidModules/libaroma/libs/jpeg/jdmarker.c 61 | EFIDroidModules/libaroma/libs/jpeg/jdmaster.c 62 | EFIDroidModules/libaroma/libs/jpeg/jdmerge.c 63 | EFIDroidModules/libaroma/libs/jpeg/jdphuff.c 64 | EFIDroidModules/libaroma/libs/jpeg/jdpostct.c 65 | EFIDroidModules/libaroma/libs/jpeg/jdsample.c 66 | EFIDroidModules/libaroma/libs/jpeg/jdtrans.c 67 | EFIDroidModules/libaroma/libs/jpeg/jerror.c 68 | EFIDroidModules/libaroma/libs/jpeg/jfdctflt.c 69 | EFIDroidModules/libaroma/libs/jpeg/jfdctfst.c 70 | EFIDroidModules/libaroma/libs/jpeg/jfdctint.c 71 | EFIDroidModules/libaroma/libs/jpeg/jidctflt.c 72 | EFIDroidModules/libaroma/libs/jpeg/jidctfst.c 73 | EFIDroidModules/libaroma/libs/jpeg/jidctint.c 74 | EFIDroidModules/libaroma/libs/jpeg/jidctred.c 75 | EFIDroidModules/libaroma/libs/jpeg/jquant1.c 76 | EFIDroidModules/libaroma/libs/jpeg/jquant2.c 77 | EFIDroidModules/libaroma/libs/jpeg/jutils.c 78 | EFIDroidModules/libaroma/libs/jpeg/jmemmgr.c 79 | EFIDroidModules/libaroma/libs/jpeg/jmem-android.c 80 | 81 | [Packages] 82 | StdLib/StdLib.dec 83 | MdePkg/MdePkg.dec 84 | EFIDroidUEFIApps/EFIDroidUi/Library/AromaLib/AromaLib.dec 85 | 86 | [LibraryClasses] 87 | LibC 88 | LibStdio 89 | 90 | [Depex] 91 | TRUE 92 | 93 | [BuildOptions] 94 | GCC:*_*_*_CC_FLAGS = -Wno-unused-label -Wno-main -Wno-unused-variable -Wno-unused-but-set-variable -DAVOID_TABLES -DANDROID_TILE_BASED_DECODE 95 | -------------------------------------------------------------------------------- /Library/MakeDosFsLib/MakeDosFsLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = MakeDosFsLib 24 | FILE_GUID = e2b50f46-968b-4e55-b4f6-907609c45530 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = MakeDosFsLib 28 | 29 | # 30 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 31 | # 32 | 33 | [Sources] 34 | mkfs.fat.c 35 | 36 | [Packages] 37 | StdLib/StdLib.dec 38 | MdePkg/MdePkg.dec 39 | MdeModulePkg/MdeModulePkg.dec 40 | 41 | [LibraryClasses] 42 | BaseLib 43 | UefiBootServicesTableLib 44 | UefiLib 45 | PrintLib 46 | 47 | [Depex] 48 | TRUE 49 | -------------------------------------------------------------------------------- /Library/MakeDosFsLib/device_info.h: -------------------------------------------------------------------------------- 1 | #ifndef DEVICE_INFO_H 2 | #define DEVICE_INFO_H 3 | 4 | enum device_type { 5 | TYPE_UNKNOWN, /* type could not be determined */ 6 | TYPE_BAD, /* neither file nor block device */ 7 | TYPE_FILE, /* image file rather than device */ 8 | TYPE_VIRTUAL, /* block devices like LVM or RAID volumes */ 9 | TYPE_REMOVABLE, /* removable disk device */ 10 | TYPE_FIXED /* fixed disk device */ 11 | }; 12 | 13 | struct device_info { 14 | enum device_type type; 15 | 16 | /* 17 | * partition number if detected 18 | * 0 = whole disk device (including unpartitioned image file) 19 | * -1 = could not be determined 20 | */ 21 | int partition; 22 | 23 | /* 24 | * whether partitions or device mapper devices or any other kind of 25 | * children use this device 26 | * 1 = yes 27 | * 0 = no 28 | * -1 = could not be determined 29 | */ 30 | int has_children; 31 | 32 | /* 33 | * detected geometry, or -1 if unknown 34 | */ 35 | int geom_heads; 36 | int geom_sectors; 37 | long geom_start; 38 | 39 | /* 40 | * detected sector size or -1 if unknown 41 | */ 42 | int sector_size; 43 | 44 | /* 45 | * size in bytes, or -1 if unknown 46 | */ 47 | long long size; 48 | }; 49 | 50 | 51 | extern int device_info_verbose; 52 | 53 | int get_device_info(int fd, struct device_info *info); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /Library/MakeDosFsLib/msdos_fs.h: -------------------------------------------------------------------------------- 1 | /* msdos_fs.h - MS-DOS filesystem constants/structures 2 | 3 | This program is free software: you can redistribute it and/or modify 4 | it under the terms of the GNU General Public License as published by 5 | the Free Software Foundation, either version 3 of the License, or 6 | (at your option) any later version. 7 | 8 | This program is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | GNU General Public License for more details. 12 | 13 | You should have received a copy of the GNU General Public License 14 | along with this program. If not, see . 15 | 16 | The complete text of the GNU General Public License 17 | can be found in /usr/share/common-licenses/GPL-3 file. 18 | */ 19 | 20 | #ifndef _MSDOS_FS_H 21 | #define _MSDOS_FS_H 22 | 23 | #include 24 | 25 | #define SECTOR_SIZE 512 /* sector size (bytes) */ 26 | #define MSDOS_DPS (SECTOR_SIZE / sizeof(struct msdos_dir_entry)) 27 | #define MSDOS_DPS_BITS 4 /* log2(MSDOS_DPS) */ 28 | #define MSDOS_DIR_BITS 5 /* log2(sizeof(struct msdos_dir_entry)) */ 29 | 30 | #define ATTR_NONE 0 /* no attribute bits */ 31 | #define ATTR_RO 1 /* read-only */ 32 | #define ATTR_HIDDEN 2 /* hidden */ 33 | #define ATTR_SYS 4 /* system */ 34 | #define ATTR_VOLUME 8 /* volume label */ 35 | #define ATTR_DIR 16 /* directory */ 36 | #define ATTR_ARCH 32 /* archived */ 37 | 38 | /* attribute bits that are copied "as is" */ 39 | #define ATTR_UNUSED (ATTR_VOLUME | ATTR_ARCH | ATTR_SYS | ATTR_HIDDEN) 40 | 41 | #define DELETED_FLAG 0xe5 /* marks file as deleted when in name[0] */ 42 | #define IS_FREE(n) (!*(n) || *(n) == DELETED_FLAG) 43 | 44 | #define MSDOS_NAME 11 /* maximum name length */ 45 | #define MSDOS_DOT ". " /* ".", padded to MSDOS_NAME chars */ 46 | #define MSDOS_DOTDOT ".. " /* "..", padded to MSDOS_NAME chars */ 47 | 48 | struct msdos_dir_entry { 49 | uint8_t name[MSDOS_NAME]; /* name including extension */ 50 | uint8_t attr; /* attribute bits */ 51 | uint8_t lcase; /* Case for base and extension */ 52 | uint8_t ctime_cs; /* Creation time, centiseconds (0-199) */ 53 | uint16_t ctime; /* Creation time */ 54 | uint16_t cdate; /* Creation date */ 55 | uint16_t adate; /* Last access date */ 56 | uint16_t starthi; /* High 16 bits of cluster in FAT32 */ 57 | uint16_t time, date, start; /* time, date and first cluster */ 58 | uint32_t size; /* file size (in bytes) */ 59 | } __attribute__ ((packed)); 60 | 61 | #endif /* _MSDOS_FS_H */ 62 | -------------------------------------------------------------------------------- /Library/MenuLib/Menu.h: -------------------------------------------------------------------------------- 1 | #ifndef _EFIDROID_MENU_PRIVATE_H_ 2 | #define _EFIDROID_MENU_PRIVATE_H_ 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | #define SCROLL_INDICATOR_WIDTH libaroma_dp(5) 22 | 23 | #define MENU_STACK_SIGNATURE SIGNATURE_32 ('m', 's', 't', 'k') 24 | 25 | typedef struct { 26 | UINTN Signature; 27 | LIST_ENTRY Link; 28 | 29 | MENU_OPTION *Menu; 30 | } MENU_STACK; 31 | 32 | byte libaroma_fb_init(void); 33 | byte libaroma_fb_release(void); 34 | byte libaroma_font_init(void); 35 | byte libaroma_font_release(void); 36 | byte libaroma_lang_init(void); 37 | byte libaroma_lang_release(void); 38 | 39 | double round(double x); 40 | 41 | #endif // _EFIDROID_MENU_PRIVATE_H_ 42 | -------------------------------------------------------------------------------- /Library/MenuLib/MenuLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # Implementation for FrontPageLib library class interfaces. 3 | # using ARM Platform framework. 4 | # 5 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
6 | # Copyright (c) 2014, ARM Ltd. All rights reserved.
7 | # 8 | # This program and the accompanying materials 9 | # are licensed and made available under the terms and conditions of the BSD License 10 | # which accompanies this distribution. The full text of the license may be found at 11 | # http://opensource.org/licenses/bsd-license.php 12 | # 13 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 15 | # 16 | ## 17 | 18 | [Defines] 19 | INF_VERSION = 0x00010005 20 | BASE_NAME = EFIDroidMenuLib 21 | FILE_GUID = 1f4a0a7b-b387-4b86-acfc-20252882ded8 22 | MODULE_TYPE = UEFI_APPLICATION 23 | VERSION_STRING = 1.0 24 | LIBRARY_CLASS = EFIDroidMenuLib|UEFI_APPLICATION 25 | 26 | # 27 | # The following information is for reference only and not required by the build tools. 28 | # 29 | # VALID_ARCHITECTURES = ARM AARCH64 30 | # 31 | 32 | [Sources] 33 | Menu.c 34 | 35 | [Packages] 36 | StdLib/StdLib.dec 37 | ArmPkg/ArmPkg.dec 38 | ArmPlatformPkg/ArmPlatformPkg.dec 39 | MdePkg/MdePkg.dec 40 | MdeModulePkg/MdeModulePkg.dec 41 | IntelFrameworkModulePkg/IntelFrameworkModulePkg.dec 42 | LittleKernelPkg/LittleKernelPkg.dec 43 | EFIDroidUEFIApps/EFIDroidUi/EFIDroidUi.dec 44 | EFIDroidUEFIApps/EFIDroidUi/Library/AromaLib/AromaLib.dec 45 | 46 | [LibraryClasses] 47 | BaseLib 48 | BaseMemoryLib 49 | DebugLib 50 | DevicePathLib 51 | MemoryAllocationLib 52 | UefiBootServicesTableLib 53 | PcdLib 54 | LKApiLib 55 | AromaLib 56 | UEFIRamdiskLib 57 | -------------------------------------------------------------------------------- /Library/PngLib/PngLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = PngLib 24 | FILE_GUID = 25e87be2-c834-4c44-a391-6d3d70f82484 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = PngLib 28 | 29 | # 30 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 31 | # 32 | 33 | [Sources] 34 | EFIDroidModules/libaroma/libs/png/png.c 35 | EFIDroidModules/libaroma/libs/png/pngerror.c 36 | EFIDroidModules/libaroma/libs/png/pngget.c 37 | EFIDroidModules/libaroma/libs/png/pngmem.c 38 | EFIDroidModules/libaroma/libs/png/pngpread.c 39 | EFIDroidModules/libaroma/libs/png/pngread.c 40 | EFIDroidModules/libaroma/libs/png/pngrio.c 41 | EFIDroidModules/libaroma/libs/png/pngrtran.c 42 | EFIDroidModules/libaroma/libs/png/pngrutil.c 43 | EFIDroidModules/libaroma/libs/png/pngset.c 44 | EFIDroidModules/libaroma/libs/png/pngtrans.c 45 | EFIDroidModules/libaroma/libs/png/pngwio.c 46 | EFIDroidModules/libaroma/libs/png/pngwrite.c 47 | EFIDroidModules/libaroma/libs/png/pngwtran.c 48 | EFIDroidModules/libaroma/libs/png/pngwutil.c 49 | 50 | [Packages] 51 | StdLib/StdLib.dec 52 | MdePkg/MdePkg.dec 53 | EFIDroidUEFIApps/EFIDroidUi/Library/AromaLib/AromaLib.dec 54 | 55 | [LibraryClasses] 56 | LibC 57 | LibStdio 58 | 59 | [Depex] 60 | TRUE 61 | 62 | [BuildOptions] 63 | GCC:*_*_*_CC_FLAGS = -Wno-unused-variable -include pnglibconf_uefi.h 64 | -------------------------------------------------------------------------------- /Library/PngLib/pnglibconf_uefi.h: -------------------------------------------------------------------------------- 1 | #include "../../../../../modules/libaroma/libs/png/pnglibconf.h" 2 | 3 | #ifdef PNG_WARNINGS_SUPPORTED 4 | #undef PNG_WARNINGS_SUPPORTED 5 | #endif 6 | -------------------------------------------------------------------------------- /Library/SquirrelLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = SquirrelLib 24 | FILE_GUID = 1eb0fe05-41f0-4535-a581-b6f502387d46 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = SquirrelLib 28 | 29 | # 30 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 31 | # 32 | 33 | [Sources] 34 | EFIDroidModules/squirrel/squirrel/sqapi.cpp 35 | EFIDroidModules/squirrel/squirrel/sqbaselib.cpp 36 | EFIDroidModules/squirrel/squirrel/sqfuncstate.cpp 37 | EFIDroidModules/squirrel/squirrel/sqdebug.cpp 38 | EFIDroidModules/squirrel/squirrel/sqlexer.cpp 39 | EFIDroidModules/squirrel/squirrel/sqobject.cpp 40 | EFIDroidModules/squirrel/squirrel/sqcompiler.cpp 41 | EFIDroidModules/squirrel/squirrel/sqstate.cpp 42 | EFIDroidModules/squirrel/squirrel/sqtable.cpp 43 | EFIDroidModules/squirrel/squirrel/sqmem.cpp 44 | EFIDroidModules/squirrel/squirrel/sqvm.cpp 45 | EFIDroidModules/squirrel/squirrel/sqclass.cpp 46 | 47 | EFIDroidModules/squirrel/sqstdlib/sqstdblob.cpp 48 | EFIDroidModules/squirrel/sqstdlib/sqstdio.cpp 49 | EFIDroidModules/squirrel/sqstdlib/sqstdstream.cpp 50 | EFIDroidModules/squirrel/sqstdlib/sqstdmath.cpp 51 | EFIDroidModules/squirrel/sqstdlib/sqstdsystem.cpp 52 | EFIDroidModules/squirrel/sqstdlib/sqstdstring.cpp 53 | EFIDroidModules/squirrel/sqstdlib/sqstdaux.cpp 54 | EFIDroidModules/squirrel/sqstdlib/sqstdrex.cpp 55 | 56 | [Packages] 57 | StdLib/StdLib.dec 58 | MdePkg/MdePkg.dec 59 | EFIDroidUEFIApps/EFIDroidUi/EFIDroidUi.dec 60 | 61 | [LibraryClasses] 62 | LibC 63 | LibStdio 64 | LibTime 65 | 66 | [Depex] 67 | TRUE 68 | 69 | [BuildOptions] 70 | GCC:*_*_*_CC_FLAGS = -Wno-error 71 | -------------------------------------------------------------------------------- /Library/UEFIRamdiskLib/UEFIRamdisk.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | 12 | #define LIBUTIL_NOAROMA 13 | #include 14 | 15 | #define RD_FILENAME L"EFIDroidRamdisk.cpio" 16 | 17 | STATIC CPIO_NEWC_HEADER *gRamdisk = NULL; 18 | STATIC UINTN gRamdiskSize = 0; 19 | 20 | STATIC 21 | VOID 22 | StripFileName ( 23 | CHAR16* Path 24 | ) 25 | { 26 | INT32 LastSlash = -1; 27 | INT32 Index; 28 | 29 | for(Index=0; Path[Index]; Index++) { 30 | if(Path[Index] == '\\') 31 | LastSlash = Index; 32 | } 33 | 34 | if(LastSlash>=0) 35 | Path[LastSlash] = 0; 36 | } 37 | 38 | 39 | EFI_STATUS 40 | EFIAPI 41 | UEFIRamdiskGetFile ( 42 | CONST CHAR8 *Path, 43 | VOID **Ptr, 44 | UINTN *Size 45 | ) 46 | { 47 | if (gRamdisk==NULL) 48 | return EFI_UNSUPPORTED; 49 | 50 | CPIO_NEWC_HEADER* CpioFile = CpioGetByName(gRamdisk, Path); 51 | if (!CpioFile) 52 | return EFI_NOT_FOUND; 53 | 54 | return CpioGetData(CpioFile, Ptr, Size); 55 | } 56 | 57 | EFI_STATUS 58 | EFIAPI 59 | UEFIRamdiskLibConstructor ( 60 | VOID 61 | ) 62 | { 63 | EFI_STATUS Status; 64 | EFI_LOADED_IMAGE_PROTOCOL *LoadedImage; 65 | EFI_DEVICE_PATH_PROTOCOL *DevicePathNode; 66 | CHAR16 *EfiFilePath = NULL; 67 | CHAR16 *RamdiskFilePath = NULL; 68 | EFI_FILE_HANDLE Root = NULL; 69 | EFI_FILE_HANDLE File = NULL; 70 | UINT64 FileSize = 0; 71 | CPIO_NEWC_HEADER *Ramdisk = NULL; 72 | UINTN RamdiskSize; 73 | 74 | // get ramdisk 75 | Status = GetSectionFromAnyFv (PcdGetPtr(PcdUEFIRamdisk), EFI_SECTION_RAW, 0, (VOID **) &Ramdisk, &RamdiskSize); 76 | if (!EFI_ERROR (Status)) { 77 | // validate header 78 | if(!CpioIsValid (Ramdisk)) 79 | return EFI_UNSUPPORTED; 80 | 81 | gRamdisk = Ramdisk; 82 | gRamdiskSize = RamdiskSize; 83 | 84 | return EFI_SUCCESS; 85 | } 86 | 87 | // get loaded image protocol 88 | Status = gBS->HandleProtocol ( 89 | gImageHandle, 90 | &gEfiLoadedImageProtocolGuid, 91 | (VOID **)&LoadedImage 92 | ); 93 | if (EFI_ERROR (Status)) { 94 | return Status; 95 | } 96 | 97 | // get file path 98 | EfiFilePath = NULL; 99 | DevicePathNode = LoadedImage->FilePath; 100 | while (!IsDevicePathEnd (DevicePathNode)) { 101 | if (DevicePathType (DevicePathNode) != MEDIA_DEVICE_PATH || 102 | DevicePathSubType (DevicePathNode) != MEDIA_FILEPATH_DP) { 103 | goto NEXT; 104 | } 105 | 106 | EfiFilePath = UnicodeStrDup(((FILEPATH_DEVICE_PATH *) DevicePathNode)->PathName); 107 | break; 108 | 109 | NEXT: 110 | DevicePathNode = NextDevicePathNode (DevicePathNode); 111 | } 112 | 113 | if (EfiFilePath==NULL) { 114 | return EFI_UNSUPPORTED; 115 | } 116 | 117 | // convert to dirname 118 | StripFileName(EfiFilePath); 119 | 120 | // get root file 121 | Root = UtilOpenRoot(LoadedImage->DeviceHandle); 122 | if (Root==NULL) { 123 | Status = EFI_UNSUPPORTED; 124 | goto Done; 125 | } 126 | 127 | // build ramdisk path 128 | UINTN RamdiskFilePathSize = StrSize(EfiFilePath) + 1 + StrSize(RD_FILENAME) + 1; 129 | RamdiskFilePath = AllocateZeroPool(RamdiskFilePathSize); 130 | if (RamdiskFilePath==NULL) { 131 | Status = EFI_OUT_OF_RESOURCES; 132 | goto Done; 133 | } 134 | UnicodeSPrint(RamdiskFilePath, RamdiskFilePathSize, L"%s\\%s", EfiFilePath, RD_FILENAME); 135 | 136 | // open ramdisk file 137 | Status = Root->Open ( 138 | Root, 139 | &File, 140 | RamdiskFilePath, 141 | EFI_FILE_MODE_READ, 142 | 0 143 | ); 144 | if (EFI_ERROR (Status)) { 145 | goto Done; 146 | } 147 | 148 | // get file size 149 | Status = FileHandleGetSize(File, &FileSize); 150 | if (EFI_ERROR (Status)) { 151 | goto Done; 152 | } 153 | 154 | // allocate ramdisk memory 155 | Ramdisk = AllocatePool(FileSize); 156 | if (Ramdisk==NULL) { 157 | Status = EFI_OUT_OF_RESOURCES; 158 | goto Done; 159 | } 160 | 161 | // read ramdisk data 162 | UINTN BytesRead = FileSize; 163 | Status = File->Read(File, &BytesRead, Ramdisk); 164 | if (EFI_ERROR (Status)) { 165 | goto Done; 166 | } 167 | 168 | // validate header 169 | if(!CpioIsValid (Ramdisk)) { 170 | Status = EFI_UNSUPPORTED; 171 | goto Done; 172 | } 173 | 174 | gRamdisk = Ramdisk; 175 | gRamdiskSize = FileSize; 176 | Status = EFI_SUCCESS; 177 | 178 | Done: 179 | if(EfiFilePath) 180 | FreePool(EfiFilePath); 181 | if(RamdiskFilePath) 182 | FreePool(RamdiskFilePath); 183 | FileHandleClose(File); 184 | FileHandleClose(Root); 185 | 186 | if(EFI_ERROR(Status)) { 187 | if(Ramdisk) 188 | FreePool(Ramdisk); 189 | } 190 | 191 | return Status; 192 | } 193 | -------------------------------------------------------------------------------- /Library/UEFIRamdiskLib/UEFIRamdiskLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = UEFIRamdiskLib 24 | FILE_GUID = 22775a90-5389-4c8a-af56-cc15f7ff3178 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = UEFIRamdiskLib 28 | CONSTRUCTOR = UEFIRamdiskLibConstructor 29 | 30 | # 31 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 32 | # 33 | 34 | [Sources] 35 | UEFIRamdisk.c 36 | 37 | [Packages] 38 | MdePkg/MdePkg.dec 39 | LittleKernelPkg/LittleKernelPkg.dec 40 | EFIDroidUEFIApps/EFIDroidUi/EFIDroidUi.dec 41 | 42 | [Packages.ARM] 43 | ArmPkg/ArmPkg.dec 44 | 45 | [LibraryClasses] 46 | CpioLib 47 | DxeServicesLib 48 | 49 | [FixedPcd] 50 | gLittleKernelTokenSpaceGuid.PcdUEFIRamdisk 51 | -------------------------------------------------------------------------------- /Library/UtilLib/UtilLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = UtilLib 24 | FILE_GUID = e67d19f4-1fd2-4746-b71f-edce32e9ffed 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = UtilLib 28 | 29 | # 30 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 31 | # 32 | 33 | [Sources] 34 | Util.c 35 | 36 | [Packages] 37 | StdLib/StdLib.dec 38 | MdePkg/MdePkg.dec 39 | MdeModulePkg/MdeModulePkg.dec 40 | EFIDroidUEFIApps/EFIDroidUi/EFIDroidUi.dec 41 | EFIDroidUEFIApps/EFIDroidUi/Library/AromaLib/AromaLib.dec 42 | 43 | [Packages.ARM] 44 | ArmPkg/ArmPkg.dec 45 | 46 | [LibraryClasses] 47 | BaseLib 48 | UefiBootServicesTableLib 49 | UefiLib 50 | PrintLib 51 | FileHandleLib 52 | BsdSocketLib 53 | 54 | [Depex] 55 | TRUE 56 | 57 | [Guids] 58 | gEFIDroidVariableGuid 59 | gEFIDroidVariableDataGuid 60 | -------------------------------------------------------------------------------- /Library/ZLib.inf: -------------------------------------------------------------------------------- 1 | ## @file 2 | # NULL instance of Timer Library as a template. 3 | # 4 | # A non-functional instance of the Timer Library that can be used as a template 5 | # for the implementation of a functional timer library instance. This library instance can 6 | # also be used to test build DXE, Runtime, DXE SAL, and DXE SMM modules that require timer 7 | # services as well as EBC modules that require timer services. 8 | # 9 | # Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
10 | # 11 | # This program and the accompanying materials 12 | # are licensed and made available under the terms and conditions of the BSD License 13 | # which accompanies this distribution. The full text of the license may be found at 14 | # http://opensource.org/licenses/bsd-license.php. 15 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 16 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 17 | # 18 | # 19 | ## 20 | 21 | [Defines] 22 | INF_VERSION = 0x00010005 23 | BASE_NAME = ZLib 24 | FILE_GUID = 6f78b341-9e0d-4dab-82d2-a44ee4620fd9 25 | MODULE_TYPE = BASE 26 | VERSION_STRING = 1.0 27 | LIBRARY_CLASS = ZLib 28 | 29 | # 30 | # VALID_ARCHITECTURES = IA32 X64 IPF EBC 31 | # 32 | 33 | [Sources] 34 | EFIDroidModules/libaroma/libs/zlib/src/adler32.c 35 | EFIDroidModules/libaroma/libs/zlib/src/compress.c 36 | EFIDroidModules/libaroma/libs/zlib/src/crc32.c 37 | EFIDroidModules/libaroma/libs/zlib/src/deflate.c 38 | EFIDroidModules/libaroma/libs/zlib/src/gzclose.c 39 | EFIDroidModules/libaroma/libs/zlib/src/gzlib.c 40 | EFIDroidModules/libaroma/libs/zlib/src/gzread.c 41 | EFIDroidModules/libaroma/libs/zlib/src/gzwrite.c 42 | EFIDroidModules/libaroma/libs/zlib/src/infback.c 43 | EFIDroidModules/libaroma/libs/zlib/src/inflate.c 44 | EFIDroidModules/libaroma/libs/zlib/src/inftrees.c 45 | EFIDroidModules/libaroma/libs/zlib/src/inffast.c 46 | EFIDroidModules/libaroma/libs/zlib/src/trees.c 47 | EFIDroidModules/libaroma/libs/zlib/src/uncompr.c 48 | EFIDroidModules/libaroma/libs/zlib/src/zutil.c 49 | 50 | [Packages] 51 | StdLib/StdLib.dec 52 | MdePkg/MdePkg.dec 53 | 54 | [LibraryClasses] 55 | LibC 56 | LibStdio 57 | 58 | [Depex] 59 | TRUE 60 | -------------------------------------------------------------------------------- /License.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011-2012, ARM Limited. All rights reserved. 2 | Copyright (c) 2015, The EFIDroid Project. All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | 8 | * Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | * Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in 12 | the documentation and/or other materials provided with the 13 | distribution. 14 | 15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 18 | FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 19 | COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 21 | BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 | LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 25 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | POSSIBILITY OF SUCH DAMAGE. 27 | -------------------------------------------------------------------------------- /LicenseExceptions.txt: -------------------------------------------------------------------------------- 1 | License.txt holds the license for EFIDroid's contributions in this project. 2 | It uses some 3rd Party code with different licenses though. 3 | 4 | These may be incompatible with this project's license and you have to remove/replace them 5 | if you want to use it as a closed source application. 6 | 7 | List of directories containing 3rd Party code and the sites where you can find their original source code: 8 | Library/DecompressLib: https://github.com/torvalds/linux 9 | Library/FstabLib: https://github.com/CyanogenMod/android_system_core/tree/cm-13.0/fs_mgr 10 | Library/MakeDosFsLib: https://github.com/dosfstools/dosfstools 11 | -------------------------------------------------------------------------------- /Settings.c: -------------------------------------------------------------------------------- 1 | #include "EFIDroidUi.h" 2 | 3 | STATIC 4 | EFI_STATUS 5 | SettingsMenuBackCallback ( 6 | MENU_OPTION* This 7 | ) 8 | { 9 | MenuStackPop(); 10 | MenuFree(This); 11 | return EFI_SUCCESS; 12 | } 13 | 14 | STATIC 15 | EFI_STATUS 16 | ShowFileExplorerCallback ( 17 | MENU_ENTRY* This 18 | ) 19 | { 20 | SettingBoolSet("ui-show-file-explorer", !This->ToggleEnabled); 21 | This->ToggleEnabled = SettingBoolGet("ui-show-file-explorer"); 22 | InvalidateActiveMenu(); 23 | MainMenuUpdateUi(); 24 | return EFI_SUCCESS; 25 | } 26 | 27 | STATIC 28 | EFI_STATUS 29 | ShowUEFIOptionsCallback ( 30 | MENU_ENTRY* This 31 | ) 32 | { 33 | SettingBoolSet("ui-show-uefi-options", !This->ToggleEnabled); 34 | This->ToggleEnabled = SettingBoolGet("ui-show-uefi-options"); 35 | InvalidateActiveMenu(); 36 | MainMenuUpdateUi(); 37 | return EFI_SUCCESS; 38 | } 39 | 40 | STATIC 41 | EFI_STATUS 42 | ShowFastbootCallback ( 43 | MENU_ENTRY* This 44 | ) 45 | { 46 | SettingBoolSet("ui-show-fastboot", !This->ToggleEnabled); 47 | This->ToggleEnabled = SettingBoolGet("ui-show-fastboot"); 48 | InvalidateActiveMenu(); 49 | MainMenuUpdateUi(); 50 | return EFI_SUCCESS; 51 | } 52 | 53 | STATIC 54 | EFI_STATUS 55 | AutoselectLastBootCallback ( 56 | MENU_ENTRY* This 57 | ) 58 | { 59 | SettingBoolSet("ui-autoselect-last-boot", !This->ToggleEnabled); 60 | This->ToggleEnabled = SettingBoolGet("ui-autoselect-last-boot"); 61 | InvalidateActiveMenu(); 62 | return EFI_SUCCESS; 63 | } 64 | 65 | STATIC 66 | EFI_STATUS 67 | ShowPermissiveCallback ( 68 | MENU_ENTRY* This 69 | ) 70 | { 71 | SettingBoolSet("boot-force-permissive", !This->ToggleEnabled); 72 | This->ToggleEnabled = SettingBoolGet("boot-force-permissive"); 73 | InvalidateActiveMenu(); 74 | MainMenuUpdateUi(); 75 | return EFI_SUCCESS; 76 | } 77 | 78 | EFI_STATUS 79 | SettingsMenuShow ( 80 | VOID 81 | ) 82 | { 83 | MENU_ENTRY *Entry; 84 | MENU_OPTION* Menu; 85 | 86 | // create menu 87 | Menu = MenuCreate(); 88 | Menu->Title = AsciiStrDup("Settings"); 89 | Menu->BackCallback = SettingsMenuBackCallback; 90 | 91 | // UEFI options 92 | Entry = MenuCreateEntry(); 93 | Entry->Name = AsciiStrDup("Show UEFI boot options"); 94 | Entry->ShowToggle = TRUE; 95 | Entry->ToggleEnabled = SettingBoolGet("ui-show-uefi-options"); 96 | Entry->HideBootMessage = TRUE; 97 | Entry->Callback = ShowUEFIOptionsCallback; 98 | MenuAddEntry(Menu, Entry); 99 | 100 | // file explorer 101 | Entry = MenuCreateEntry(); 102 | Entry->Name = AsciiStrDup("Show File Explorer"); 103 | Entry->ShowToggle = TRUE; 104 | Entry->ToggleEnabled = SettingBoolGet("ui-show-file-explorer"); 105 | Entry->HideBootMessage = TRUE; 106 | Entry->Callback = ShowFileExplorerCallback; 107 | MenuAddEntry(Menu, Entry); 108 | 109 | // fastboot 110 | Entry = MenuCreateEntry(); 111 | Entry->Name = AsciiStrDup("Show Fastboot"); 112 | Entry->ShowToggle = TRUE; 113 | Entry->ToggleEnabled = SettingBoolGet("ui-show-fastboot"); 114 | Entry->HideBootMessage = TRUE; 115 | Entry->Callback = ShowFastbootCallback; 116 | MenuAddEntry(Menu, Entry); 117 | 118 | // autoselect last booted entry 119 | Entry = MenuCreateEntry(); 120 | Entry->Name = AsciiStrDup("Autoselect last booted OS"); 121 | Entry->ShowToggle = TRUE; 122 | Entry->ToggleEnabled = SettingBoolGet("ui-autoselect-last-boot"); 123 | Entry->HideBootMessage = TRUE; 124 | Entry->Callback = AutoselectLastBootCallback; 125 | MenuAddEntry(Menu, Entry); 126 | 127 | // selinux 128 | Entry = MenuCreateEntry(); 129 | Entry->Name = AsciiStrDup("Force selinux to permissive"); 130 | Entry->ShowToggle = TRUE; 131 | Entry->ToggleEnabled = SettingBoolGet("boot-force-permissive"); 132 | Entry->HideBootMessage = TRUE; 133 | Entry->Callback = ShowPermissiveCallback; 134 | MenuAddEntry(Menu, Entry); 135 | 136 | MenuStackPush(Menu); 137 | return EFI_SUCCESS; 138 | } 139 | -------------------------------------------------------------------------------- /fonts/Roboto-Medium.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/fonts/Roboto-Medium.ttf -------------------------------------------------------------------------------- /fonts/Roboto-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/fonts/Roboto-Regular.ttf -------------------------------------------------------------------------------- /icons/android.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/android.png -------------------------------------------------------------------------------- /icons/download_mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/download_mode.png -------------------------------------------------------------------------------- /icons/efi_shell.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/efi_shell.png -------------------------------------------------------------------------------- /icons/fileexplorer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/fileexplorer.png -------------------------------------------------------------------------------- /icons/ic_arrow_forward_black_24px.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /icons/ic_fso_default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/ic_fso_default.png -------------------------------------------------------------------------------- /icons/ic_fso_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/ic_fso_folder.png -------------------------------------------------------------------------------- /icons/ic_more_vert_white_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/ic_more_vert_white_24dp.png -------------------------------------------------------------------------------- /icons/ic_settings_black_24dp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/ic_settings_black_24dp.png -------------------------------------------------------------------------------- /icons/power_off.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/power_off.png -------------------------------------------------------------------------------- /icons/reboot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/reboot.png -------------------------------------------------------------------------------- /icons/reboot_bootloader.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/reboot_bootloader.png -------------------------------------------------------------------------------- /icons/reboot_recovery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/reboot_recovery.png -------------------------------------------------------------------------------- /icons/recovery_clockwork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/recovery_clockwork.png -------------------------------------------------------------------------------- /icons/recovery_cyanogen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/recovery_cyanogen.png -------------------------------------------------------------------------------- /icons/recovery_lglaf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/recovery_lglaf.png -------------------------------------------------------------------------------- /icons/recovery_twrp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/recovery_twrp.png -------------------------------------------------------------------------------- /icons/recovery_xiaomi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/recovery_xiaomi.png -------------------------------------------------------------------------------- /icons/rom_aospa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/rom_aospa.png -------------------------------------------------------------------------------- /icons/rom_omni.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/rom_omni.png -------------------------------------------------------------------------------- /icons/sony.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/sony.png -------------------------------------------------------------------------------- /icons/storage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/storage.png -------------------------------------------------------------------------------- /icons/uefi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/efidroid/uefi_apps_EFIDroidUi/c45178271e06b7b6d8ff1663e00d9b978cea477c/icons/uefi.png --------------------------------------------------------------------------------