mirror of
https://github.com/LongSoft/UEFITool.git
synced 2024-11-22 07:58:22 +08:00
934ce1f3f8
As the first step towards automated parsing, this change set replaces outdated BootGuard-related parsers with shiny new KaitaiStruct-based ones. It also does the following: - improves Intel FIT definitions by using the relevant specification - adds sha1, sha384, sha512 and sm3 digest implementations - updates LZMA SDK to v22.01 - moves GUIDs out of include files to prevent multiple instantiations - enforces C++11 - adds Kaitai-based parsers for Intel FIT, BootGuard v1 and BootGuard v2 structures - makes many small refactorings here, there and everywhere
42 lines
1.1 KiB
Bash
Executable File
42 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
UTARGET=$(uname)
|
|
|
|
# Determine platform
|
|
if [ "$UTARGET" = "Darwin" ]; then
|
|
export UPLATFORM="mac"
|
|
elif [ "$UTARGET" = "Linux" ]; then
|
|
export UPLATFORM="linux_$(uname -m)"
|
|
elif [ "${UTARGET/MINGW32/}" != "$UTARGET" ]; then
|
|
export UPLATFORM="win32"
|
|
else
|
|
# Fallback to something...
|
|
export UPLATFORM="$UTARGET"
|
|
fi
|
|
|
|
# Generate
|
|
echo "Attempting to to generate parsers from Kaitai KSY files on ${UPLATFORM}..."
|
|
kaitai-struct-compiler --target cpp_stl --outdir common/generated common/ksy/* || exit 1
|
|
|
|
# Show generated files
|
|
find -E common/generated \
|
|
-regex '.*\.(cpp|h)' \
|
|
-print || exit 1
|
|
|
|
# Replace global includes for kaitai with local ones (<> -> "")
|
|
find -E common/generated \
|
|
-regex '.*\.(cpp|h)' \
|
|
-exec sed -i '' '/^#include <kaitai/s/[<>]/\"/g' {} + || exit 1
|
|
|
|
# Add .. to the include path for kaitai includes
|
|
find -E common/generated \
|
|
-regex '.*\.(cpp|h)' \
|
|
-exec sed -i '' '/^#include \"kaitai\//s/kaitai\//..\/kaitai\//g' {} + || exit 1
|
|
|
|
# Suppress "p__root - unused parameter" warning
|
|
find -E common/generated \
|
|
-regex '.*\.(cpp)' \
|
|
-exec sed -i '' '/^ m__root = this;/s/;/; (void)p__root;/g' {} + || exit 1
|
|
|
|
exit 0
|