Skip to content

Commit

Permalink
MdeModulePkg/BrotliCustomDecompressLib: Make brotli a submodule
Browse files Browse the repository at this point in the history
Use submodule way to access brotli in MdeModulePkg based on
brotli version 666c328.
The newly added BrotliDecUefiSupport.h/.c are used by directory
'brotli'.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2559

Cc: Liming Gao <liming.gao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Signed-off-by: Shenglei Zhang <shenglei.zhang@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
  • Loading branch information
shenglei10 authored and mergify[bot] committed Apr 16, 2020
1 parent 8c654bb commit 58802e0
Show file tree
Hide file tree
Showing 36 changed files with 151 additions and 12,449 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "MdeModulePkg/Universal/RegularExpressionDxe/oniguruma"]
path = MdeModulePkg/Universal/RegularExpressionDxe/oniguruma
url = https://github.com/kkos/oniguruma
[submodule "MdeModulePkg/Library/BrotliCustomDecompressLib/brotli"]
path = MdeModulePkg/Library/BrotliCustomDecompressLib/brotli
url = https://github.com/google/brotli
2 changes: 2 additions & 0 deletions .pytool/CISettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ def GetRequiredSubmodules(self):
"UnitTestFrameworkPkg/Library/CmockaLib/cmocka", False))
rs.append(RequiredSubmodule(
"MdeModulePkg/Universal/RegularExpressionDxe/oniguruma", False))
rs.append(RequiredSubmodule(
"MdeModulePkg/Library/BrotliCustomDecompressLib/brotli", False))
return rs

def GetName(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# It is based on the Brotli v0.5.2.
# Brotli was released on the website https://github.com/google/brotli.
#
# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
Expand All @@ -29,27 +29,35 @@

[Sources]
GuidedSectionExtraction.c
BrotliDecUefiSupport.c
BrotliDecUefiSupport.h
BrotliDecompress.c
BrotliDecompressLibInternal.h
common/dictionary.c
common/transform.c
dec/bit_reader.c
dec/decode.c
dec/huffman.c
dec/state.c
brotli/decode.h
brotli/port.h
brotli/types.h
common/constants.h
common/context.h
common/dictionary.h
common/platform.h
common/transform.h
common/version.h
dec/bit_reader.h
dec/huffman.h
dec/state.h
dec/prefix.h
# Wrapper header files start #
stddef.h
stdint.h
stdlib.h
string.h
# Wrapper header files end #
brotli/c/common/dictionary.c
brotli/c/common/transform.c
brotli/c/dec/bit_reader.c
brotli/c/dec/decode.c
brotli/c/dec/huffman.c
brotli/c/dec/state.c
brotli/c/include/brotli/decode.h
brotli/c/include/brotli/port.h
brotli/c/include/brotli/types.h
brotli/c/common/constants.h
brotli/c/common/context.h
brotli/c/common/dictionary.h
brotli/c/common/platform.h
brotli/c/common/transform.h
brotli/c/common/version.h
brotli/c/dec/bit_reader.h
brotli/c/dec/huffman.h
brotli/c/dec/state.h
brotli/c/dec/prefix.h

[Packages]
MdePkg/MdePkg.dec
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/** @file
Implements for functions declared in BrotliDecUefiSupport.h
Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
#include <BrotliDecUefiSupport.h>

/**
Dummy malloc function for compiler.
**/
VOID *
BrDummyMalloc (
IN size_t Size
)
{
ASSERT (FALSE);
return NULL;
}

/**
Dummy free function for compiler.
**/
VOID
BrDummyFree (
IN VOID * Ptr
)
{
ASSERT (FALSE);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/** @file
BROTLI UEFI header file for definitions
Allows BROTLI code to build under UEFI (edk2) build environment
Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/

#ifndef __BROTLI_DECOMPRESS_UEFI_SUP_H__
#define __BROTLI_DECOMPRESS_UEFI_SUP_H__

#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#define memcpy CopyMem
#define memmove CopyMem
#define memset(dest,ch,count) SetMem(dest,(UINTN)(count),(UINT8)(ch))
#define malloc BrDummyMalloc
#define free BrDummyFree

typedef INT8 int8_t;
typedef INT16 int16_t;
typedef INT32 int32_t;
typedef INT64 int64_t;
typedef UINT8 uint8_t;
typedef UINT16 uint16_t;
typedef UINT32 uint32_t;
typedef UINT64 uint64_t;
typedef UINTN size_t;

VOID *
BrDummyMalloc (
IN size_t Size
);

VOID
BrDummyFree (
IN VOID * Ptr
);

#endif
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Allows BROTLI code to build under UEFI (edk2) build environment
Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2017 - 2020, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
Expand All @@ -12,12 +12,9 @@
#define __BROTLI_DECOMPRESS_INTERNAL_H__

#include <PiPei.h>
#include <Library/BaseLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/DebugLib.h>
#include <Library/ExtractGuidedSectionLib.h>
#include <brotli/types.h>
#include <brotli/decode.h>
#include <brotli/c/include/brotli/types.h>
#include <brotli/c/include/brotli/decode.h>

typedef struct
{
Expand All @@ -30,20 +27,6 @@ typedef struct
#define BROTLI_DECODE_MAX 8
#define BROTLI_SCRATCH_MAX 16

#define memcpy CopyMem
#define memmove CopyMem
#define memset(dest,ch,count) SetMem(dest,(UINTN)(count),(UINT8)(ch))

VOID *
BrDummyMalloc (
IN size_t Size
);

VOID
BrDummyFree (
IN VOID * Ptr
);

EFI_STATUS
EFIAPI
BrotliUefiDecompressGetInfo (
Expand Down
19 changes: 0 additions & 19 deletions MdeModulePkg/Library/BrotliCustomDecompressLib/LICENSE

This file was deleted.

26 changes: 0 additions & 26 deletions MdeModulePkg/Library/BrotliCustomDecompressLib/README.md

This file was deleted.

2 changes: 0 additions & 2 deletions MdeModulePkg/Library/BrotliCustomDecompressLib/ReadMe.txt

This file was deleted.

1 change: 1 addition & 0 deletions MdeModulePkg/Library/BrotliCustomDecompressLib/brotli
Submodule brotli added at 666c32

0 comments on commit 58802e0

Please sign in to comment.