initial commit Clover sources 5061 and modules from EDK2 latest with legacy codes from UDK2018

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2019-09-03 12:58:42 +03:00
parent aa95346efe
commit 7c0aa811ec
8533 changed files with 2839811 additions and 0 deletions

69
.gitignore vendored Normal file
View File

@ -0,0 +1,69 @@
# OS X temporary files that should never be committed
.DS_Store
*.swp
*.lock
*~
# /CloverPackage/
/CloverPackage/sym/
/CloverPackage/CloverV2/BootSectors/boot0af
/CloverPackage/CloverV2/BootSectors/boot0ss
/CloverPackage/CloverV2/BootSectors/boot0md
/CloverPackage/CloverV2/BootSectors/boot1h
/CloverPackage/CloverV2/BootSectors/boot1h2
/CloverPackage/CloverV2/BootSectors/boot1f32alt
/CloverPackage/CloverV2/BootSectors/boot1f32
/CloverPackage/CloverV2/BootSectors/boot1x
/CloverPackage/CloverV2/BootSectors/boot1xalt
/CloverPackage/CloverV2/BootSectors/Description.txt
/CloverPackage/CloverV2/BootSectors/Installation.txt
/CloverPackage/CloverV2/Bootloaders/ia32/
/CloverPackage/CloverV2/Bootloaders/x64/
/CloverPackage/CloverV2/EFI/BOOT/BOOTIA32.efi
/CloverPackage/CloverV2/EFI/BOOT/BOOTX64.efi
/CloverPackage/CloverV2/EFI/CLOVER/CLOVERX64.efi
/CloverPackage/CloverV2/EFI/CLOVER/CLOVERIA32.efi
/CloverPackage/CloverV2/EFI/CLOVER/drivers/
/CloverPackage/CloverV2/EFI/CLOVER/drivers32/
/CloverPackage/CloverV2/EFI/CLOVER/drivers32UEFI/
/CloverPackage/CloverV2/EFI/CLOVER/drivers64/
/CloverPackage/CloverV2/EFI/CLOVER/drivers64UEFI/
/CloverPackage/CloverV2/EFI/CLOVER/tools/bdmesg.efi
/CloverPackage/CloverV2/EFI/CLOVER/tools/bdmesg-32.efi
/CloverPackage/CloverV2/EFI/CLOVER/tools/Shell64U.efi
/CloverPackage/CloverV2/drivers-Off/drivers32/
/CloverPackage/CloverV2/drivers-Off/drivers32UEFI/
/CloverPackage/CloverV2/drivers-Off/drivers64/
/CloverPackage/CloverV2/drivers-Off/drivers64UEFI/
# /FileSystems/HFSPlus/
/FileSystems/HFSPlus/Ia32/
/FileSystems/HFSPlus/X64/
# /
/Version.h
/vers.txt
# /rEFIt_UEFI/
/rEFIt_UEFI/Version.h
# XCode files/directories
*~.nib
DerivedData/
build/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
xcuserdata/
# Translation files
CloverUpdater.strings
CloverPackage/CloverUpdater/src/*.lproj
CloverPrefpane.strings
CloverPackage/CloverPrefpane/src/*.lproj

20
BaseTools/.gitignore vendored Normal file
View File

@ -0,0 +1,20 @@
*.d
*.o
*.obj
*.pdb
*.ilk
*.exe
*.pyc
Source/C/VfrCompile/EfiVfrParser.cpp
Source/C/VfrCompile/EfiVfrParser.h
Source/C/VfrCompile/Pccts/antlr/antlr
Source/C/VfrCompile/Pccts/dlg/dlg
Source/C/VfrCompile/VfrLexer.cpp
Source/C/VfrCompile/VfrLexer.h
Source/C/VfrCompile/VfrParser.dlg
Source/C/VfrCompile/VfrSyntax.cpp
Source/C/VfrCompile/VfrTokens.h
Source/C/bin/
Source/C/libs/
Bin/Win32
Lib

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
PYTHONPATH="`dirname $0`/../../Source/Python" \
python "`dirname $0`/../../Source/Python"/`basename $0`/`basename $0`.py $*

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python"
exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python"
exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python"
exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,17 @@
#!/usr/bin/env bash
#
# This script will exec LzmaCompress tool with --f86 option that enables converter for x86 code.
#
# Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
for arg; do
case $arg in
-e|-d)
set -- "$@" --f86
break
;;
esac
exec LzmaCompress "$@"

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
#exec `dirname $0`/../../../../C/bin/`basename $0` $*
TOOL_BASENAME=`basename $0`
if [ -n "$WORKSPACE" -a -e $WORKSPACE/Conf/BaseToolsCBinaries ]
then
exec $WORKSPACE/Conf/BaseToolsCBinaries/$TOOL_BASENAME
elif [ -n "$WORKSPACE" -a -e $EDK_TOOLS_PATH/Source/C ]
then
if [ ! -e $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME ]
then
echo BaseTools C Tool binary was not found \($TOOL_BASENAME\)
echo You may need to run:
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec $EDK_TOOLS_PATH/Source/C/bin/$TOOL_BASENAME $*
fi
elif [ -e `dirname $0`/../../Source/C/bin/$TOOL_BASENAME ]
then
exec `dirname $0`/../../Source/C/bin/$TOOL_BASENAME $*
else
echo Unable to find the real \'$TOOL_BASENAME\' to run
echo This message was printed by
echo " $0"
exit -1
fi

View File

@ -0,0 +1,5 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
PYTHONPATH="`dirname $0`/../../Source/Python" \
python "`dirname $0`/../../Source/Python"/`basename $0`/`basename $0`.py $*

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python"
exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
exe=$(basename "$full_cmd")
export PYTHONPATH="$dir/../../Source/Python"
exec "${python_exe:-python}" "$dir/../../Source/Python/$exe/$exe.py" "$@"

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,87 @@
#!/usr/bin/env python
#
# Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#
# ARMCC tools do not support cygwin paths. Ths script converts cygwin paths to DOS paths
# in any arguments.
#
# armcc_wrapper.py ToolToExec [command line to convert]
#
# anything with the / will be converted via cygpath cygwin call or manually.
# -I/cygpath/c/example is a special case as you can not pass -I to cygpath
#
# ExceptionList if a tool takes an argument with a / add it to the exception list
#
from __future__ import print_function
import sys
import os
import subprocess
import pipes
#
# Convert using cygpath command line tool
# Currently not used, but just in case we need it in the future
#
def ConvertCygPathToDosViacygpath(CygPath):
p = subprocess.Popen("cygpath -m " + pipes.quote(CygPath), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
return p.stdout.read().strip()
#
#
#
def ConvertCygPathToDos(CygPath):
if CygPath.find("/cygdrive/") == 0:
# convert /cygdrive/c/Xyz to c:/Xyz
DosPath = CygPath[10] + ':' + CygPath[11:]
else:
DosPath = CygPath
# pipes.quote will add the extra \\ for us.
return DosPath.replace('/', '\\')
# we receive our options as a list, but we will be passing them to the shell as a line
# this means we have to requote things as they will get one round of unquoting.
# we can't set "shell=False" because we are running commands from the PATH and
# if you don't use the shell you don't get a PATH search.
def main(argv):
# use 1st argument as name of tool to call
Command = pipes.quote(sys.argv[1]);
ExceptionList = ["/interwork"]
for arg in argv:
if arg.find('/') == -1:
# if we don't need to convert just add to the command line
Command = Command + ' ' + pipes.quote(arg)
elif arg in ExceptionList:
# if it is in the list, then don't do a cygpath
# assembler stuff after --apcs has the /.
Command = Command + ' ' + pipes.quote(arg)
else:
if ((arg[0] == '-') and (arg[1] == 'I' or arg[1] == 'i')):
CygPath = arg[0] + arg[1] + ConvertCygPathToDos(arg[2:])
else:
CygPath = ConvertCygPathToDos(arg)
Command = Command + ' ' + pipes.quote(CygPath)
# call the real tool with the converted paths
return subprocess.call(Command, shell=True)
if __name__ == "__main__":
try:
ret = main(sys.argv[2:])
except:
print("exiting: exception from " + sys.argv[0])
ret = 2
sys.exit(ret)

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python"
exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" -m $cmd.$cmd "$@"

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,34 @@
#!/usr/bin/env bash
#
# This script will exec Brotli tool with -e/-d options.
#
# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
QLT="-q 9 -w 22"
ARGS=
while test $# -gt 0
do
case $1 in
-e)
;;
-d)
ARGS+="$1 "
;;
-o|-g)
ARGS+="$1 $2 "
shift
;;
-q)
QLT="$1 $2 "
shift
;;
*)
ARGS+="$1 "
;;
esac
shift
done
exec Brotli $QLT $ARGS

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" -m $cmd.EccMain "$@"

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" "$dir/../../Source/Python/AutoGen/$cmd.py" "$@"

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" -m $cmd.$cmd "$@"

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" "$dir/../../Source/Python/Capsule/$cmd.py" "$@"

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
#
# This script will exec LzmaCompress tool with --f86 option that enables converter for x86 code.
#
# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
# Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
for arg; do
case $arg in
-e|-d)
set -- "$@" --f86
break
;;
esac
done
exec LzmaCompress "$@"

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" "$dir/../../Source/Python/Rsa2048Sha256Sign/$cmd.py" "$@"

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
exe=$(basename "$full_cmd")
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" "$dir/../../Source/Python/$exe/$exe.py" "$@"

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,29 @@
#!/usr/bin/env bash
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ]
then
exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd"
elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ]
then
if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ]
then
echo "BaseTools C Tool binary was not found ($cmd)"
echo "You may need to run:"
echo " make -C $EDK_TOOLS_PATH/Source/C"
else
exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@"
fi
elif [ -e "$dir/../../Source/C/bin/$cmd" ]
then
exec "$dir/../../Source/C/bin/$cmd" "$@"
else
echo "Unable to find the real '$cmd' to run"
echo "This message was printed by"
echo " $0"
exit 127
fi

View File

@ -0,0 +1,14 @@
#!/usr/bin/env bash
#python `dirname $0`/RunToolFromSource.py `basename $0` $*
# If a ${PYTHON_COMMAND} command is available, use it in preference to python
if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
python_exe=${PYTHON_COMMAND}
fi
full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
dir=$(dirname "$full_cmd")
cmd=${full_cmd##*/}
export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
exec "${python_exe:-python}" "$dir/../../Source/Python/$cmd/$cmd.py" "$@"

View File

@ -0,0 +1,4 @@
@setlocal
@set ToolName=%~n0%
@set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python
@%PYTHON_COMMAND% -m %ToolName%.%ToolName% %*

View File

@ -0,0 +1,55 @@
@REM @file
@REM This script will exec Brotli tool with -e/-d options.
@REM
@REM Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
@REM SPDX-License-Identifier: BSD-2-Clause-Patent
@REM
@echo off
@setlocal
set QLT=-q 9 -w 22
set ARGS=
:Begin
if "%1"=="" goto End
if "%1"=="-d" (
set ARGS=%ARGS% %1
shift
goto Begin
)
if "%1"=="-e" (
shift
goto Begin
)
if "%1"=="-g" (
set ARGS=%ARGS% %1 %2
shift
shift
goto Begin
)
if "%1"=="-o" (
set ARGS=%ARGS% %1 %2
shift
shift
goto Begin
)
if "%1"=="-q" (
set QLT=%1 %2
shift
shift
goto Begin
)
set ARGS=%ARGS% %1
shift
goto Begin
:End
Brotli %QLT% %ARGS%
@echo on

View File

@ -0,0 +1,4 @@
@setlocal
@set ToolName=%~n0%
@set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python
@%PYTHON_COMMAND% -m %ToolName%.EccMain %*

View File

@ -0,0 +1,3 @@
@setlocal
@set ToolName=%~n0%
@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\AutoGen\%ToolName%.py %*

View File

@ -0,0 +1,4 @@
@setlocal
@set ToolName=%~n0%
@set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python
@%PYTHON_COMMAND% -m %ToolName%.%ToolName% %*

View File

@ -0,0 +1,3 @@
@setlocal
@set ToolName=%~n0%
@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -0,0 +1 @@
@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\Capsule\GenerateCapsule.py %*

View File

@ -0,0 +1,3 @@
@setlocal
@set ToolName=%~n0%
@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -0,0 +1,3 @@
@setlocal
@set ToolName=%~n0%
@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -0,0 +1 @@
@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py %*

View File

@ -0,0 +1,3 @@
@setlocal
@set ToolName=%~n0%
@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -0,0 +1,3 @@
@setlocal
@set ToolName=%~n0%
@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -0,0 +1,3 @@
@setlocal
@set ToolName=%~n0%
@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -0,0 +1,3 @@
@setlocal
@set ToolName=%~n0%
@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

View File

@ -0,0 +1,3 @@
@setlocal
@set ToolName=%~n0%
@%PYTHON_COMMAND% %BASE_TOOLS_PATH%\Source\Python\%ToolName%\%ToolName%.py %*

269
BaseTools/BuildEnv Normal file
View File

@ -0,0 +1,269 @@
## @file
# Setup the environment for unix-like systems running a bash-like shell.
# This file must be "sourced" not merely executed. For example: ". edksetup.sh"
#
# Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2016, Linaro Ltd. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
SetWorkspace() {
#
# If WORKSPACE is already set, then we can return right now
#
if [ -n "$WORKSPACE" ]
then
return 0
fi
#
# Set $WORKSPACE
#
export WORKSPACE=`pwd`
return 0
}
RestorePreviousConfiguration() {
#
# Restore previous configuration
#
if [ -z "$CONF_PATH" ]
then
export CONF_PATH=$WORKSPACE/Conf
if [ ! -d $WORKSPACE/Conf ] && [ -n "$PACKAGES_PATH" ]
then
PATH_LIST=${PACKAGES_PATH//:/ }
for DIR in $PATH_LIST
do
if [ -d $DIR/Conf ]
then
export CONF_PATH=$DIR/Conf
break
fi
done
fi
fi
PREVIOUS_CONF_FILE=$CONF_PATH/BuildEnv.sh
if [ -e $PREVIOUS_CONF_FILE ]
then
echo Loading previous configuration from $PREVIOUS_CONF_FILE
. $PREVIOUS_CONF_FILE
fi
}
GenerateShellCodeToSetVariable() {
VARIABLE=$1
OUTPUT_FILE=$2
VAR_VALUE="echo \${${VARIABLE}}"
VAR_VALUE=`eval $VAR_VALUE`
echo "if [ -z \"\$${VARIABLE}\" ]" >> $OUTPUT_FILE
echo "then" >> $OUTPUT_FILE
echo " export ${VARIABLE}=${VAR_VALUE}" >> $OUTPUT_FILE
echo "fi" >> $OUTPUT_FILE
}
GenerateShellCodeToUpdatePath() {
OUTPUT_FILE=$1
echo "if [ -e $EDK_TOOLS_PATH_BIN ]" >> $OUTPUT_FILE
echo "then" >> $OUTPUT_FILE
echo " if [ "\${PATH/$EDK_TOOLS_PATH_BIN/}" == "\$PATH" ]" >> $OUTPUT_FILE
echo " then" >> $OUTPUT_FILE
echo " export PATH=$EDK_TOOLS_PATH_BIN:\$PATH" >> $OUTPUT_FILE
echo " fi" >> $OUTPUT_FILE
echo "fi" >> $OUTPUT_FILE
}
StoreCurrentConfiguration() {
#
# Write configuration to a shell script to allow for configuration to be
# easily reloaded.
#
OUTPUT_FILE=$CONF_PATH/BuildEnv.sh
#echo Storing current configuration into $OUTPUT_FILE
echo "# Auto-generated by ${BASH_SOURCE[0]}" >| $OUTPUT_FILE
GenerateShellCodeToSetVariable WORKSPACE $OUTPUT_FILE
GenerateShellCodeToSetVariable EDK_TOOLS_PATH $OUTPUT_FILE
GenerateShellCodeToUpdatePath $OUTPUT_FILE
}
SetEdkToolsPath() {
#
# If EDK_TOOLS_PATH is already set, then we can return right now
#
if [ -n "$EDK_TOOLS_PATH" ]
then
return 0
fi
#
# Try $CONF_PATH/EdkTools
#
if [ -e $CONF_PATH/EdkTools ]
then
export EDK_TOOLS_PATH=$CONF_PATH/EdkTools
return 0
fi
#
# Try $CONF_PATH/BaseToolsSource
#
if [ -e $CONF_PATH/BaseToolsSource ]
then
export EDK_TOOLS_PATH=$CONF_PATH/BaseToolsSource
return 0
fi
#
# Try $WORKSPACE/BaseTools
#
if [ -e $WORKSPACE/BaseTools ]
then
export EDK_TOOLS_PATH=$WORKSPACE/BaseTools
return 0
fi
#
# Try $PACKAGES_PATH
#
if [ -n "$PACKAGES_PATH"]
then
PATH_LIST=${PACKAGES_PATH//:/ }
for DIR in $PATH_LIST
do
if [ -d $DIR/BaseTools ]
then
export EDK_TOOLS_PATH=$DIR/BaseTools
return 0
fi
done
fi
echo "Unable to determine EDK_TOOLS_PATH"
echo
echo "You may need to download the 'BaseTools' from buildtools.tianocore.org."
echo "After downloading, either create a symbolic link to the source at"
echo "\$WORKSPACE/Conf/BaseToolsSource, or set the EDK_TOOLS_PATH environment"
echo "variable."
}
GetBaseToolsBinSubDir() {
#
# Figure out a uniq directory name from the uname command
#
UNAME_DIRNAME=`uname -sm`
UNAME_DIRNAME=${UNAME_DIRNAME// /-}
UNAME_DIRNAME=${UNAME_DIRNAME//\//-}
echo $UNAME_DIRNAME
}
GetEdkToolsPathBinDirectory() {
#
# Figure out a uniq directory name from the uname command
#
BIN_SUB_DIR=`GetBaseToolsBinSubDir`
if [ -e $EDK_TOOLS_PATH/BinWrappers/$BIN_SUB_DIR ]
then
EDK_TOOLS_PATH_BIN=$EDK_TOOLS_PATH/BinWrappers/$BIN_SUB_DIR
else
EDK_TOOLS_PATH_BIN=$EDK_TOOLS_PATH/Bin/$BIN_SUB_DIR
fi
echo $EDK_TOOLS_PATH_BIN
}
AddDirToStartOfPath() {
DIRNAME=$1
PATH=$DIRNAME:$DIRNAME:$DIRNAME:$PATH
PATH=${PATH//$DIRNAME:/}
PATH=$DIRNAME:$PATH
export PATH
}
AddEdkToolsToPath() {
#
# If EDK_TOOLS_PATH is not set, then we cannot update PATH
#
if [ -z "$EDK_TOOLS_PATH" ]
then
return 1
fi
EDK_TOOLS_PATH_BIN=`GetEdkToolsPathBinDirectory`
AddDirToStartOfPath $EDK_TOOLS_PATH/BinWrappers/PosixLike
AddDirToStartOfPath $EDK_TOOLS_PATH_BIN
}
CopySingleTemplateFile() {
SRC_FILENAME=Conf/$1.template
DST_FILENAME=$CONF_PATH/$1.txt
if [ -e $DST_FILENAME ]
then
[ $RECONFIG != TRUE ] && return
fi
echo "Copying \$EDK_TOOLS_PATH/$SRC_FILENAME"
echo " to $DST_FILENAME"
SRC_FILENAME=$EDK_TOOLS_PATH/$SRC_FILENAME
cp $SRC_FILENAME $DST_FILENAME
}
CopyTemplateFiles() {
CopySingleTemplateFile build_rule
CopySingleTemplateFile tools_def
CopySingleTemplateFile target
}
ScriptMain() {
SetWorkspace
if [ -z $WORKSPACE ]
then
echo "Failure setting WORKSPACE"
return 1
fi
RestorePreviousConfiguration
SetEdkToolsPath
if [ -z $EDK_TOOLS_PATH ]
then
return 1
fi
AddEdkToolsToPath
if [ $? -ne 0 ]
then
echo "Failure adding EDK Tools into PATH!"
return 1
fi
StoreCurrentConfiguration
echo WORKSPACE: $WORKSPACE
echo EDK_TOOLS_PATH: $EDK_TOOLS_PATH
echo CONF_PATH: $CONF_PATH
CopyTemplateFiles
}
#
# Run the main function
#
ScriptMain

View File

@ -0,0 +1,16 @@
Some changes are necessary to compile EDK2 BaseTools in Mavericks with XCode 5 DP:
1. BaseTools/Source/C/VfrCompile/VrfFormPkg.cpp
[code]IN UINT32 BufferSize = 4096[/code]
to
[code]IN UINT32 BufferSize[/code]
2. BaseTools/Source/C/VfrCompile/VrfFormPkg.h
[code]CFormPkg (IN UINT32 BufferSize);[/code]
to
[code]CFormPkg (IN UINT32 BufferSize = 4096);[/code]
3. BaseTools/Source/C/Makefiles/header.makefile
[code]CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -Werror -c -g[/code]
to
[code]CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -nostdlib -Wall -Werror -c -g -Wno-tautological-compare -Wno-self-assign -Wno-deprecated-declarations[/code]
PS: Thanks pene for the support. :P

View File

@ -0,0 +1,15 @@
;@file
; Example ini file used for UPT.
;
; Copyright (c) 2011 - 2019, Intel Corporation. All rights reserved.<BR>
; SPDX-License-Identifier: BSD-2-Clause-Patent
;
[DistributionHeader]
Name =
GUID =
Version =
Vendor =
Copyright =
License =
Abstract =
XmlSpecification = 1.1

View File

@ -0,0 +1,9 @@
This directory contains the template files for the next generation of the
EDK II Build infrastructure. These files will be copied into the WORKSPACE's
Conf directory if and only if the target files do not exist.
These files may be updated frequently.
The XMLSchema directory contains the EDK II Packaging XML definitions. The
schema may change in the future. It differs somewhat from the early versions
of the XML Schema.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,642 @@
#
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
## Syntax
#
# "*" is used to indicate that the source files will be processed at the same time.
# "?" is used to indicate that the source files will be processed one by one.
#
# "[" <File-Type>[.<Build-Type>][.<Arch>][, <File-Type>[.<Build-Type>][.<Arch>]] "]" <EOL>
# <InputFile[.<ToolChainFamily>]> <EOL>
# (?|*).<File-Extension> [(\n|,) (?|*).<File-Extension>]
#
# <OutputFile[.<ToolChainFamily>]> <EOL>
# <FileFullPath>
#
# <ExtraDependency>
# <FileFullPath>
#
# <Command[.<ToolChainFamily>]> <EOL>
# <Command1>
# [<Command2>]
#
# <Build-Type> is the MODULE_TYPE in EDK2 or COMPONENT_TYPE in EDK.
# Missing <InputFile> will cause an exception and break build.
# Missing <Command> will cause that related build target won't be generated but
# won't break build.
#
## Placeholders for string substitution
#
# ${src} Source file(s) to be built (full path)
# ${s_path} Source file directory (absolute path)
# ${s_dir} Source file relative directory within a module
# (Note: ${s_dir} is always equals to "." if source file is given in absolute path.)
# ${s_name} Source file name without path
# ${s_base} Source file name without extension and path
# ${s_ext} Source file extension
#
# ${dst} Destination file(s) built from ${src} (full path)
# ${d_path} Destination file directory (absolute path)
# ${d_name} Destination file name without path
# ${d_base} Destination file name without extension and path
# ${d_ext} Destination file extension
#
# (+) Directory separator
#
## Macro
# $(WORKSPACE) Workspace directory
# $(OUTPUT_DIR) Directory for intermediate files for building a module
# $(DEBUG_DIR) Directory for files used to debug a module
# $(BUILD_DIR) All files for building a platform will be put in this directory
# $(BIN_DIR) Common directory for executable files
# $(FV_DIR) Directory to store flash image files
# $(INC) Search path of current module
# $(NASM_INC) Search nasm file path of current module
# $(INC_LIST) A file containing search paths of current module
# $(LIBS) Static library files of current module
# $(<tool>_FLAGS) Tools flags of current module
# $(MODULE_NAME) Current module name
# $(MODULE_NAME_GUID) Current module name with module FILE_GUID if same $(MODULE_NAME) exists
# in different modules, otherwise its value is same as $(MODULE_NAME)
# $(MODULE_TYPE) Current module type
# $(MODULE_GUID) Current module guid
# $(ARCH) Architecture of current module
# $(TOOLCHAIN) Toolchain used to build current module
# $(TARGET) Target of current module (DEBUG/RELEASE)
# $(<tool>) Path of tool
# $(EDK_TOOLS_PATH) Path of build tools
# $(<FILE_TYPES>) File list of each file type
# (Note: The macro name is derived from file type name. For example,
# C-Code-File will have C_CODE_FILES macro.)
# $(<FILE_TYPES_LIST>) Macro point to a file containing list of files of a file type
# (
# Note: The macro and file name are derived from file type name.
# For example, C-Code-File will have C_CODE_FILES_LIST macro pointing
# to $(OUTPUT_DIR)/c_code_files.lst. The list file and macro name
# will be generated only when this macro is used in command line.
# This is intended to get over the long command line limitation.
# )
#
# $(CP) copy command
# $(MV) move command
# $(RM) delete command
# $(MD) create dir command
# $(RD) remove dir command
#
## Reserved File-Type
#
# Don't change following names of file types and their associated files,
# which are also used in tools' code
#
# C-Code-File
# C-Header-File
# Dynamic-Library-File
# Static-Library-File
# Visual-Form-Representation-File
# Unicode-Text-File
#
## Build Rule Version Number
# build_rule_version=0.1
#
[C-Code-File]
<InputFile>
?.c
?.C
?.cc
?.CC
?.cpp
?.Cpp
?.CPP
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
<Command.MSFT, Command.INTEL>
"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
<Command.GCC, Command.RVCT>
# For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
"$(CC)" $(CC_FLAGS) -c -o ${dst} $(INC) ${src}
<Command.XCODE>
"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
[C-Code-File.BASE.AARCH64,C-Code-File.SEC.AARCH64,C-Code-File.PEI_CORE.AARCH64,C-Code-File.PEIM.AARCH64,C-Code-File.BASE.ARM,C-Code-File.SEC.ARM,C-Code-File.PEI_CORE.ARM,C-Code-File.PEIM.ARM]
<InputFile>
?.c
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
<Command.GCC, Command.RVCT>
"$(CC)" $(CC_FLAGS) $(CC_XIPFLAGS) -c -o ${dst} $(INC) ${src}
[C-Header-File]
<InputFile>
*.h, *.H
<OutputFile>
<Command>
[Assembly-Code-File.COMMON.COMMON]
<InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
?.asm, ?.Asm, ?.ASM
<InputFile.GCC>
?.S, ?.s
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
<Command.MSFT, Command.INTEL>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii
<Command.GCC, Command.RVCT>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
# For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
"$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
[Assembly-Code-File.COMMON.ARM,Assembly-Code-File.COMMON.AARCH64]
# Remove --convert-hex for ARM as it breaks MSFT assemblers
<InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
?.asm, ?.Asm, ?.ASM
<InputFile.GCC>
?.S, ?.s
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
<Command.INTEL>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii
<Command.MSFT>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii
<Command.GCC, Command.RVCT>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
# For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
"$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
[Nasm-Assembly-Code-File.COMMON.COMMON]
<InputFile>
?.nasm
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
<Command>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(NASM)" -I${s_path}(+) $(NASM_INC) $(NASM_FLAGS) -o $dst ${d_path}(+)${s_base}.iii
[Device-Tree-Source-File]
<InputFile>
?.dts
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dtb
<Command.GCC>
"$(DTCPP)" $(DTCPP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
"$(DTC)" $(DTC_FLAGS) -I dts -O dtb -o ${dst} ${d_path}(+)${s_base}.i
[Visual-Form-Representation-File]
<InputFile>
?.vfr
?.Vfr
?.VFR
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(DEBUG_DIR)(+)${s_dir}(+)${s_base}.c
<Command>
"$(VFRPP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_base}.i
"$(VFR)" $(VFR_FLAGS) --string-db $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_base}.i
[Object-File]
<InputFile>
*.obj
*.o
<OutputFile>
$(OUTPUT_DIR)(+)$(MODULE_NAME).lib
<Command.MSFT, Command.INTEL>
"$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} @$(OBJECT_FILES_LIST)
<Command.GCC>
$(RM) ${dst}
"$(SLINK)" cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST)
<Command.RVCT>
"$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST)
<Command.RVCTCYGWIN>
# $(OBJECT_FILES_LIST) has wrong paths for cygwin
"$(SLINK)" $(SLINK_FLAGS) ${dst} $(OBJECT_FILES)
<Command.XCODE>
"$(SLINK)" $(SLINK_FLAGS) ${dst} -filelist $(OBJECT_FILES_LIST)
[Static-Library-File]
<InputFile>
*.lib
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(DEBUG_DIR)(+)$(MODULE_NAME).dll
<Command.MSFT, Command.INTEL>
"$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK2_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
"$(DLINK)" /OUT:${dst} $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
<Command.GCC>
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(CC_FLAGS) $(DLINK2_FLAGS)
"$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
<Command.RVCT>
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
<Command.RVCTCYGWIN>
#$(STATIC_LIBRARY_FILES_LIST) has wrong paths for cygwin
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)
<Command.XCODE>
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
[Static-Library-File.SEC.AARCH64, Static-Library-File.PEI_CORE.AARCH64, Static-Library-File.PEIM.AARCH64,Static-Library-File.SEC.ARM, Static-Library-File.PEI_CORE.ARM, Static-Library-File.PEIM.ARM]
<InputFile>
*.lib
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(DEBUG_DIR)(+)$(MODULE_NAME).dll
<Command.GCC>
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) $(DLINK_XIPFLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(CC_FLAGS) $(CC_XIPFLAGS) $(DLINK2_FLAGS)
"$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
[Static-Library-File.USER_DEFINED, Static-Library-File.HOST_APPLICATION]
<InputFile>
*.lib
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(DEBUG_DIR)(+)$(MODULE_NAME)
<Command.MSFT, Command.INTEL>
"$(DLINK)" $(DLINK_FLAGS) $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST)
<Command.GCC>
"$(DLINK)" $(DLINK_FLAGS) -Wl,--start-group,@$(STATIC_LIBRARY_FILES_LIST),--end-group $(DLINK2_FLAGS)
<Command.RVCT>
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
<Command.RVCTCYGWIN>
#$(STATIC_LIBRARY_FILES_LIST) has the wrong paths for cygwin
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)
<Command.XCODE>
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
[Dynamic-Library-File]
<InputFile>
?.dll
<OutputFile>
$(OUTPUT_DIR)(+)$(MODULE_NAME).efi
<Command.MSFT, Command.INTEL, Command.RVCT>
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
$(CP) ${dst} $(DEBUG_DIR)
$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
-$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR)
<Command.GCC>
$(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
$(OBJCOPY) --strip-unneeded -R .eh_frame ${src}
#
#The below 2 lines are only needed for UNIXGCC tool chain, which generates PE image directly
#
-$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}
-$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug $(BIN_DIR)(+)$(MODULE_NAME_GUID).debug
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
$(CP) ${dst} $(DEBUG_DIR)
$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
<Command.XCODE>
# tool to convert Mach-O to PE/COFF
"$(MTOC)" -subsystem $(MODULE_TYPE) $(MTOC_FLAGS) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff
# create symbol file for GDB debug
-$(DSYMUTIL) ${src}
"$(GENFW)" -e $(MODULE_TYPE) -o ${dst} $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)
$(CP) ${dst} $(DEBUG_DIR)
$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
[Dependency-Expression-File]
<InputFile>
?.dxs, ?.Dxs, ?.DXS
<OutputFile>
$(OUTPUT_DIR)(+)$(MODULE_NAME).depex
<ExtraDependency>
$(MAKE_FILE)
<Command>
"$(PP)" $(APP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
Trim --source-code -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
GenDepex -t $(MODULE_TYPE) -o ${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
[Acpi-Source-Language-File]
<InputFile>
?.asl, ?.Asl, ?.ASL
<OutputFile>
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.aml
<ExtraDependency>
$(MAKE_FILE)
<Command.MSFT, Command.INTEL>
Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
"$(ASLPP)" $(ASLPP_FLAGS) $(INC) /I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
"$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii
<Command.GCC>
Trim --asl-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i -i $(INC_LIST) ${src}
"$(ASLPP)" $(ASLPP_FLAGS) $(INC) -I${s_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
Trim --source-code -l -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii
"$(ASL)" $(ASL_FLAGS) $(ASL_OUTFLAGS)${dst} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iiii
[C-Code-File.AcpiTable]
<InputFile>
?.c
<OutputFile>
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.acpi
<ExtraDependency>
$(MAKE_FILE)
<Command.MSFT, Command.INTEL>
"$(ASLCC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASLCC_FLAGS) $(INC) ${src}
"$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
<Command.GCC>
"$(ASLCC)" -c -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
"$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
[Acpi-Table-Code-File]
<InputFile>
?.aslc, ?.act
<OutputFile>
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.acpi
<ExtraDependency>
$(MAKE_FILE)
<Command.MSFT, Command.INTEL>
"$(ASLCC)" /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASLCC_FLAGS) $(INC) ${src}
"$(ASLDLINK)" /OUT:$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
<Command.GCC>
"$(ASLCC)" -c -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(CC_FLAGS) $(ASLCC_FLAGS) $(INC) ${src}
"$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(GENFW_FLAGS)
<Command.XCODE>
"$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASLCC_FLAGS) $(INC) ${src}
"$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(MTOC)" -subsystem $(MODULE_TYPE) $(MTOC_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.pecoff
"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.pecoff $(GENFW_FLAGS)
[Masm16-Code-File]
<InputFile>
?.asm16, ?.Asm16, ?.ASM16, ?.s16, ?.S16
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(OUTPUT_DIR)(+)${s_base}.com
<Command.MSFT, Command.INTEL>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code --convert-hex --trim-long -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
cd $(OUTPUT_DIR)(+)${s_dir}
"$(ASM16)" /nologo /c /omf $(INC) /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${d_path}(+)${s_base}.iii
"$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,
<Command.GCC>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) --start-group $(DLINK_SPATH) $(LIBS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj --end-group
<Command.XCODE>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
"$(SLINK)" $(SLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.slib $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
otool -t $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.slib | hex2bin.py ${dst}
[Nasm-to-Binary-Code-File]
<InputFile>
?.nasmb
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(OUTPUT_DIR)(+)${s_base}.bin
<Command>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(NASM)" -I${s_path}(+) -l ${d_path}(+)${s_base}.lst $(NASMB_FLAGS) -o $dst ${d_path}(+)${s_base}.iii
# copy the output file with .com postfix that be same to the output file of .asm16
$(CP) ${dst} $(OUTPUT_DIR)(+)${s_base}.com
[Microcode-File.USER_DEFINED, Microcode-File.Microcode]
<InputFile>
?.txt, ?.TXT, ?.Txt, ?.mut, ?.inc
<OutputFile>
$(OUTPUT_DIR)(+)${s_base}.mcb
<Command>
"$(GENFW)" -o ${dst} -m ${src} $(GENFW_FLAGS)
[Microcode-Binary-File]
<InputFile>
*.mcb
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(OUTPUT_DIR)(+)$(MODULE_NAME).bin
<Command>
"$(GENFW)" -o ${dst} -j $(MICROCODE_BINARY_FILES) $(GENFW_FLAGS)
-$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).bin
[EFI-Image-File]
<InputFile>
?.efi, ?.Efi, ?.EFI
<OutputFile>
<Command>
[Unicode-Text-File]
<InputFile>
*.uni, *.Uni, *.UNI
<OutputFile>
$(DEBUG_DIR)(+)AutoGen.c
$(DEBUG_DIR)(+)$(MODULE_NAME)StrDefs.h
$(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk
<Command>
[Image-Definition-File]
<InputFile>
*.idf, *.Idf, *.IDF
<OutputFile>
$(DEBUG_DIR)(+)AutoGen.c
$(DEBUG_DIR)(+)$(MODULE_NAME)ImgDefs.h
$(OUTPUT_DIR)(+)$(MODULE_NAME)Idf.hpk
<Command>
[Efi-Image.UEFI_OPTIONROM]
<InputFile>
?.efi, ?.EFI, ?.Efi
<OutputFile>
$(BIN_DIR)(+)$(MODULE_NAME_GUID).rom
<Command>
$(OPTROM) -i $(PCI_DEVICE_ID) -f $(PCI_VENDOR_ID) -l $(PCI_CLASS_CODE) -r $(PCI_REVISION) -o $dst $(OPTROM_FLAGS) $src
[Unicode-Text-File.UEFI_HII]
<InputFile>
*.uni, *.Uni, *.UNI
<OutputFile>
$(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk
$(DEBUG_DIR)(+)$(MODULE_NAME)StrDefs.h
<Command>
[Image-Definition-File.UEFI_HII]
<InputFile>
*.idf, *.Idf, *.IDF
<OutputFile>
$(DEBUG_DIR)(+)$(MODULE_NAME)ImgDefs.h
$(OUTPUT_DIR)(+)$(MODULE_NAME)Idf.hpk
<Command>
[Visual-Form-Representation-File.UEFI_HII]
<InputFile>
?.vfr
?.Vfr
?.VFR
<ExtraDependency>
$(MAKE_FILE)
<OutputFile>
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.hpk
<Command>
"$(VFRPP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
"$(VFR)" $(VFR_FLAGS) --create-ifr-package --string-db $(OUTPUT_DIR)(+)$(MODULE_NAME)StrDefs.hpk --output-directory $(OUTPUT_DIR)(+)${s_dir} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
[Hii-Binary-Package.UEFI_HII]
<InputFile>
*.hpk
<OutputFile.MSFT, OutputFile.INTEL, OutputFile.GCC>
$(OUTPUT_DIR)(+)$(MODULE_NAME)hii.lib
<OutputFile.XCODE, OutputFile.RVCT>
$(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc
<Command.MSFT, Command.INTEL>
"$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiipackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
"$(RC)" /Fo${dst} $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc
<Command.GCC>
"$(GENFW)" -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES) $(GENFW_FLAGS)
"$(RC)" $(RC_FLAGS) $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc ${dst}
<Command.XCODE, Command.RVCT>
GenFw -o $(OUTPUT_DIR)(+)$(MODULE_NAME)hii.rc -g $(MODULE_GUID) --hiibinpackage $(HII_BINARY_PACKAGES)

13
BaseTools/Conf/diff.order Normal file
View File

@ -0,0 +1,13 @@
#
# Copyright (c) 2019, Linaro Ltd. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
*.dec
*.dsc.inc
*.dsc
*.fdf
*.inf
*.h
*.vfr
*.c

View File

@ -0,0 +1,19 @@
#
# Copyright (c) 2019, Linaro Ltd. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
*.efi -diff
*.EFI -diff
*.bin -diff
*.BIN -diff
*.raw -diff
*.RAW -diff
*.bmp -diff
*.BMP -diff
*.dec diff=ini
*.dsc diff=ini
*.dsc.inc diff=ini
*.fdf diff=ini
*.fdf.inc diff=ini
*.inf diff=ini

View File

@ -0,0 +1,70 @@
#
# Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#
# ALL Paths are Relative to WORKSPACE
# Separate multiple LIST entries with a SINGLE SPACE character, do not use comma characters.
# Un-set an option by either commenting out the line, or not setting a value.
#
# PROPERTY Type Use Description
# ---------------- -------- -------- -----------------------------------------------------------
# ACTIVE_PLATFORM Filename Recommended Specify the WORKSPACE relative Path and Filename
# of the platform description file that will be used for the
# build. This line is required if and only if the current
# working directory does not contain one or more description
# files.
ACTIVE_PLATFORM = EmulatorPkg/EmulatorPkg.dsc
# TARGET List Optional Zero or more of the following: DEBUG, RELEASE, NOOPT
# UserDefined; separated by a space character.
# If the line is missing or no value is specified, all
# valid targets specified in the platform description file
# will attempt to be built. The following line will build
# DEBUG platform target.
TARGET = DEBUG
# TARGET_ARCH List Optional What kind of architecture is the binary being target for.
# One, or more, of the following, IA32, IPF, X64, EBC, ARM
# or AArch64.
# Multiple values can be specified on a single line, using
# space characters to separate the values. These are used
# during the parsing of a platform description file,
# restricting the build output target(s.)
# The Build Target ARCH is determined by (precedence high to low):
# Command-line: -a ARCH option
# target.txt: TARGET_ARCH values
# DSC file: [Defines] SUPPORTED_ARCHITECTURES tag
# If not specified, then all valid architectures specified
# in the platform file, for which tools are available, will be
# built.
TARGET_ARCH = IA32
# TOOL_DEFINITION_FILE Filename Optional Specify the name of the filename to use for specifying
# the tools to use for the build. If not specified,
# WORKSPACE/Conf/tools_def.txt will be used for the build.
TOOL_CHAIN_CONF = Conf/tools_def.txt
# TAGNAME List Optional Specify the name(s) of the tools_def.txt TagName to use.
# If not specified, all applicable TagName tools will be
# used for the build. The list uses space character separation.
TOOL_CHAIN_TAG = VS2015x86
# MAX_CONCURRENT_THREAD_NUMBER NUMBER Optional The number of concurrent threads. If not specified or set
# to zero, tool automatically detect number of processor
# threads. Recommend to set this value to one less than the
# number of your computer cores or CPUs. When value set to 1,
# means disable multi-thread build, value set to more than 1,
# means user specify the thread number to build. Not specify
# the default value in this file.
# MAX_CONCURRENT_THREAD_NUMBER = 1
# BUILD_RULE_CONF Filename Optional Specify the file name to use for the build rules that are followed
# when generating Makefiles. If not specified, the file:
# WORKSPACE/Conf/build_rule.txt will be used
BUILD_RULE_CONF = Conf/build_rule.txt

File diff suppressed because it is too large Load Diff

27
BaseTools/GNUmakefile Normal file
View File

@ -0,0 +1,27 @@
## @file
# GNU/Linux makefile for Base Tools project build.
#
# Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
all: subdirs
LANGUAGES = C Python
SOURCE_SUBDIRS := $(patsubst %,Source/%,$(sort $(LANGUAGES)))
SUBDIRS := $(SOURCE_SUBDIRS) Tests
CLEAN_SUBDIRS := $(patsubst %,%-clean,$(sort $(SUBDIRS)))
.PHONY: subdirs $(SUBDIRS)
subdirs: $(SUBDIRS)
$(SUBDIRS):
$(MAKE) -C $@
Tests: $(SOURCE_SUBDIRS)
.PHONY: $(CLEAN_SUBDIRS)
$(CLEAN_SUBDIRS):
-$(MAKE) -C $(@:-clean=) clean
clean: $(CLEAN_SUBDIRS)

34
BaseTools/Makefile Normal file
View File

@ -0,0 +1,34 @@
## @file
# Windows makefile for Base Tools project build.
#
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
!IFNDEF BASE_TOOLS_PATH
!ERROR "BASE_TOOLS_PATH is not set! Please run toolsetup.bat first!"
!ENDIF
SUBDIRS = $(BASE_TOOLS_PATH)\Source\C $(BASE_TOOLS_PATH)\Source\Python
all: c
c :
@if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $(BASE_TOOLS_PATH)\Source\C
@if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $(BASE_TOOLS_PATH)\Source\C
subdirs: $(SUBDIRS)
@if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $**
@if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py all $**
.PHONY: clean
clean:
@if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS)
@if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py clean $(SUBDIRS)
.PHONY: cleanall
cleanall:
@if defined PYTHON_COMMAND $(PYTHON_COMMAND) $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py cleanall $(SUBDIRS)
@if not defined PYTHON_COMMAND $(PYTHON_HOME)\python.exe $(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py cleanall $(SUBDIRS)

47
BaseTools/ReadMe.txt Normal file
View File

@ -0,0 +1,47 @@
This directory contains the next generation of EDK II build tools and template files.
Templates are located in the Conf directory, while the tools executables for
Microsoft Windows 32-bit Operating Systems are located in the Bin\Win32 directory, other
directory contains tools source.
1. Build step to generate the binary tools.
=== Windows/Visual Studio Notes ===
To build the BaseTools, you should run the standard vsvars32.bat script
from your preferred Visual Studio installation or you can run get_vsvars.bat
to use latest automatically detected version.
In addition to this, you should set the following environment variables:
* EDK_TOOLS_PATH - Path to the BaseTools sub directory under the edk2 tree
* BASE_TOOLS_PATH - The directory where the BaseTools source is located.
(It is the same directory where this README.txt is located.)
After this, you can run the toolsetup.bat file, which is in the same
directory as this file. It should setup the remainder of the environment,
and build the tools if necessary.
Please also refer to the 'BuildNotes.txt' file for more information on
building under Windows.
=== Unix-like operating systems ===
To build on Unix-like operating systems, you only need to type 'make' in
the base directory of the project.
=== Ubuntu Notes ===
On Ubuntu, the following command should install all the necessary build
packages to build all the C BaseTools:
sudo apt-get install build-essential uuid-dev
=== Python sqlite3 module ===
On Windows, the cx_freeze will not copy the sqlite3.dll to the frozen
binary directory (the same directory as build.exe and GenFds.exe).
Please copy it manually from <PythonHome>\DLLs.
The Python distributed with most recent Linux will have sqlite3 module
built in. If not, please install sqlit3 package separately.
26-OCT-2011

View File

@ -0,0 +1,220 @@
## @file
# Convert a binary file to a VOID* PCD value or DSC file VOID* PCD statement.
#
# Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
'''
BinToPcd
'''
from __future__ import print_function
import sys
import argparse
import re
import xdrlib
#
# Globals for help information
#
__prog__ = 'BinToPcd'
__copyright__ = 'Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.'
__description__ = 'Convert one or more binary files to a VOID* PCD value or DSC file VOID* PCD statement.\n'
if __name__ == '__main__':
def ValidateUnsignedInteger (Argument):
try:
Value = int (Argument, 0)
except:
Message = '{Argument} is not a valid integer value.'.format (Argument = Argument)
raise argparse.ArgumentTypeError (Message)
if Value < 0:
Message = '{Argument} is a negative value.'.format (Argument = Argument)
raise argparse.ArgumentTypeError (Message)
return Value
def ValidatePcdName (Argument):
if re.split ('[a-zA-Z\_][a-zA-Z0-9\_]*\.[a-zA-Z\_][a-zA-Z0-9\_]*', Argument) != ['', '']:
Message = '{Argument} is not in the form <PcdTokenSpaceGuidCName>.<PcdCName>'.format (Argument = Argument)
raise argparse.ArgumentTypeError (Message)
return Argument
def ValidateGuidName (Argument):
if re.split ('[a-zA-Z\_][a-zA-Z0-9\_]*', Argument) != ['', '']:
Message = '{Argument} is not a valid GUID C name'.format (Argument = Argument)
raise argparse.ArgumentTypeError (Message)
return Argument
def ByteArray (Buffer, Xdr = False):
if Xdr:
#
# If Xdr flag is set then encode data using the Variable-Length Opaque
# Data format of RFC 4506 External Data Representation Standard (XDR).
#
XdrEncoder = xdrlib.Packer ()
for Item in Buffer:
XdrEncoder.pack_bytes (Item)
Buffer = bytearray (XdrEncoder.get_buffer ())
else:
#
# If Xdr flag is not set, then concatenate all the data
#
Buffer = bytearray (b''.join (Buffer))
#
# Return a PCD value of the form '{0x01, 0x02, ...}' along with the PCD length in bytes
#
return '{' + (', '.join (['0x{Byte:02X}'.format (Byte = Item) for Item in Buffer])) + '}', len (Buffer)
#
# Create command line argument parser object
#
parser = argparse.ArgumentParser (prog = __prog__,
description = __description__ + __copyright__,
conflict_handler = 'resolve')
parser.add_argument ("-i", "--input", dest = 'InputFile', type = argparse.FileType ('rb'), action='append', required = True,
help = "Input binary filename. Multiple input files are combined into a single PCD.")
parser.add_argument ("-o", "--output", dest = 'OutputFile', type = argparse.FileType ('w'),
help = "Output filename for PCD value or PCD statement")
parser.add_argument ("-p", "--pcd", dest = 'PcdName', type = ValidatePcdName,
help = "Name of the PCD in the form <PcdTokenSpaceGuidCName>.<PcdCName>")
parser.add_argument ("-t", "--type", dest = 'PcdType', default = None, choices = ['VPD', 'HII'],
help = "PCD statement type (HII or VPD). Default is standard.")
parser.add_argument ("-m", "--max-size", dest = 'MaxSize', type = ValidateUnsignedInteger,
help = "Maximum size of the PCD. Ignored with --type HII.")
parser.add_argument ("-f", "--offset", dest = 'Offset', type = ValidateUnsignedInteger,
help = "VPD offset if --type is VPD. UEFI Variable offset if --type is HII. Must be 8-byte aligned.")
parser.add_argument ("-n", "--variable-name", dest = 'VariableName',
help = "UEFI variable name. Only used with --type HII.")
parser.add_argument ("-g", "--variable-guid", type = ValidateGuidName, dest = 'VariableGuid',
help = "UEFI variable GUID C name. Only used with --type HII.")
parser.add_argument ("-x", "--xdr", dest = 'Xdr', action = "store_true",
help = "Encode PCD using the Variable-Length Opaque Data format of RFC 4506 External Data Representation Standard (XDR)")
parser.add_argument ("-v", "--verbose", dest = 'Verbose', action = "store_true",
help = "Increase output messages")
parser.add_argument ("-q", "--quiet", dest = 'Quiet', action = "store_true",
help = "Reduce output messages")
parser.add_argument ("--debug", dest = 'Debug', type = int, metavar = '[0-9]', choices = range (0, 10), default = 0,
help = "Set debug level")
#
# Parse command line arguments
#
args = parser.parse_args ()
#
# Read all binary input files
#
Buffer = []
for File in args.InputFile:
try:
Buffer.append (File.read ())
File.close ()
except:
print ('BinToPcd: error: can not read binary input file {File}'.format (File = File))
sys.exit (1)
#
# Convert PCD to an encoded string of hex values and determine the size of
# the encoded PCD in bytes.
#
PcdValue, PcdSize = ByteArray (Buffer, args.Xdr)
#
# Convert binary buffer to a DSC file PCD statement
#
if args.PcdName is None:
#
# If PcdName is None, then only a PCD value is being requested.
#
Pcd = PcdValue
if args.Verbose:
print ('BinToPcd: Convert binary file to PCD Value')
elif args.PcdType is None:
#
# If --type is neither VPD nor HII, then use PCD statement syntax that is
# compatible with [PcdsFixedAtBuild], [PcdsPatchableInModule],
# [PcdsDynamicDefault], and [PcdsDynamicExDefault].
#
if args.MaxSize is None:
#
# If --max-size is not provided, then do not generate the syntax that
# includes the maximum size.
#
Pcd = ' {Name}|{Value}'.format (Name = args.PcdName, Value = PcdValue)
elif args.MaxSize < PcdSize:
print ('BinToPcd: error: argument --max-size is smaller than input file.')
sys.exit (1)
else:
Pcd = ' {Name}|{Value}|VOID*|{Size}'.format (Name = args.PcdName, Value = PcdValue, Size = args.MaxSize)
if args.Verbose:
print ('BinToPcd: Convert binary file to PCD statement compatible with PCD sections:')
print (' [PcdsFixedAtBuild]')
print (' [PcdsPatchableInModule]')
print (' [PcdsDynamicDefault]')
print (' [PcdsDynamicExDefault]')
elif args.PcdType == 'VPD':
if args.MaxSize is None:
#
# If --max-size is not provided, then set maximum size to the size of the
# binary input file
#
args.MaxSize = PcdSize
if args.MaxSize < PcdSize:
print ('BinToPcd: error: argument --max-size is smaller than input file.')
sys.exit (1)
if args.Offset is None:
#
# if --offset is not provided, then set offset field to '*' so build
# tools will compute offset of PCD in VPD region.
#
Pcd = ' {Name}|*|{Size}|{Value}'.format (Name = args.PcdName, Size = args.MaxSize, Value = PcdValue)
else:
#
# --offset value must be 8-byte aligned
#
if (args.Offset % 8) != 0:
print ('BinToPcd: error: argument --offset must be 8-byte aligned.')
sys.exit (1)
#
# Use the --offset value provided.
#
Pcd = ' {Name}|{Offset}|{Size}|{Value}'.format (Name = args.PcdName, Offset = args.Offset, Size = args.MaxSize, Value = PcdValue)
if args.Verbose:
print ('BinToPcd: Convert binary file to PCD statement compatible with PCD sections')
print (' [PcdsDynamicVpd]')
print (' [PcdsDynamicExVpd]')
elif args.PcdType == 'HII':
if args.VariableGuid is None or args.VariableName is None:
print ('BinToPcd: error: arguments --variable-guid and --variable-name are required for --type HII.')
sys.exit (1)
if args.Offset is None:
#
# Use UEFI Variable offset of 0 if --offset is not provided
#
args.Offset = 0
#
# --offset value must be 8-byte aligned
#
if (args.Offset % 8) != 0:
print ('BinToPcd: error: argument --offset must be 8-byte aligned.')
sys.exit (1)
Pcd = ' {Name}|L"{VarName}"|{VarGuid}|{Offset}|{Value}'.format (Name = args.PcdName, VarName = args.VariableName, VarGuid = args.VariableGuid, Offset = args.Offset, Value = PcdValue)
if args.Verbose:
print ('BinToPcd: Convert binary file to PCD statement compatible with PCD sections')
print (' [PcdsDynamicHii]')
print (' [PcdsDynamicExHii]')
#
# Write PCD value or PCD statement to the output file
#
try:
args.OutputFile.write (Pcd)
args.OutputFile.close ()
except:
#
# If output file is not specified or it can not be written, then write the
# PCD value or PCD statement to the console
#
print (Pcd)

View File

@ -0,0 +1,687 @@
#!/usr/bin/python
## @file
# Firmware Configuration Editor (FCE) from https://firmware.intel.com/develop
# can parse BIOS image and generate Firmware Configuration file.
# This script bases on Firmware Configuration file, and generate the structure
# PCD setting in DEC/DSC/INF files.
#
# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
'''
ConvertFceToStructurePcd
'''
import re
import os
import datetime
import argparse
#
# Globals for help information
#
__prog__ = 'ConvertFceToStructurePcd'
__version__ = '%s Version %s' % (__prog__, '0.1 ')
__copyright__ = 'Copyright (c) 2018, Intel Corporation. All rights reserved.'
__description__ = 'Generate Structure PCD in DEC/DSC/INF based on Firmware Configuration.\n'
dscstatement='''[Defines]
VPD_TOOL_GUID = 8C3D856A-9BE6-468E-850A-24F7A8D38E08
[SkuIds]
0|DEFAULT # The entry: 0|DEFAULT is reserved and always required.
[DefaultStores]
0|STANDARD # UEFI Standard default 0|STANDARD is reserved.
1|MANUFACTURING # UEFI Manufacturing default 1|MANUFACTURING is reserved.
[PcdsDynamicExVpd.common.DEFAULT]
gEfiMdeModulePkgTokenSpaceGuid.PcdNvStoreDefaultValueBuffer|*
'''
decstatement = '''[Guids]
gStructPcdTokenSpaceGuid = {0x3f1406f4, 0x2b, 0x487a, {0x8b, 0x69, 0x74, 0x29, 0x1b, 0x36, 0x16, 0xf4}}
[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx]
'''
infstatement = '''[Pcd]
'''
SECTION='PcdsDynamicHii'
PCD_NAME='gStructPcdTokenSpaceGuid.Pcd'
WARNING=[]
ERRORMSG=[]
class parser_lst(object):
def __init__(self,filelist):
self._ignore=['BOOLEAN', 'UINT8', 'UINT16', 'UINT32', 'UINT64']
self.file=filelist
self.text=self.megre_lst()[0]
self.content=self.megre_lst()[1]
def megre_lst(self):
alltext=''
content={}
for file in self.file:
with open(file,'r') as f:
read =f.read()
alltext += read
content[file]=read
return alltext,content
def struct_lst(self):#{struct:lst file}
structs_file={}
name_format = re.compile(r'(?<!typedef)\s+struct (\w+) {.*?;', re.S)
for i in list(self.content.keys()):
structs= name_format.findall(self.content[i])
if structs:
for j in structs:
if j not in self._ignore:
structs_file[j]=i
else:
print("%s"%structs)
return structs_file
def struct(self):#struct:{offset:name}
unit_num = re.compile('(\d+)')
offset1_re = re.compile('(\d+)\[')
pcdname_num_re = re.compile('\w+\[(\S+)\]')
pcdname_re = re.compile('\](.*)\<')
pcdname2_re = re.compile('(\w+)\[')
uint_re = re.compile('\<(\S+)\>')
name_format = re.compile(r'(?<!typedef)\s+struct (\w+) {.*?;', re.S)
name=name_format.findall(self.text)
info={}
unparse=[]
if name:
tmp_n = [n for n in name if n not in self._ignore]
name = list(set(tmp_n))
name.sort(key = tmp_n.index)
name.reverse()
#name=list(set(name).difference(set(self._ignore)))
for struct in name:
s_re = re.compile(r'struct %s :(.*?)};'% struct, re.S)
content = s_re.search(self.text)
if content:
tmp_dict = {}
text = content.group().split('+')
for line in text[1:]:
offset = offset1_re.findall(line)
t_name = pcdname_re.findall(line)
uint = uint_re.findall(line)
if offset and uint:
offset = offset[0]
uint = uint[0]
if t_name:
t_name = t_name[0].strip()
if (' ' in t_name) or ("=" in t_name) or (";" in t_name) or("\\" in name) or (t_name ==''):
WARNING.append("Warning:Invalid Pcd name '%s' for Offset %s in struct %s" % (t_name,offset, struct))
else:
if '[' in t_name:
if uint in ['UINT8', 'UINT16', 'UINT32', 'UINT64']:
offset = int(offset, 10)
tmp_name = pcdname2_re.findall(t_name)[0] + '[0]'
tmp_dict[offset] = tmp_name
pcdname_num = int(pcdname_num_re.findall(t_name)[0],10)
uint = int(unit_num.findall(uint)[0],10)
bit = uint // 8
for i in range(1, pcdname_num):
offset += bit
tmp_name = pcdname2_re.findall(t_name)[0] + '[%s]' % i
tmp_dict[offset] = tmp_name
else:
tmp_name = pcdname2_re.findall(t_name)[0]
pcdname_num = pcdname_num_re.findall(t_name)[0]
line = [offset,tmp_name,pcdname_num,uint]
line.append(struct)
unparse.append(line)
else:
if uint not in ['UINT8', 'UINT16', 'UINT32', 'UINT64']:
line = [offset, t_name, 0, uint]
line.append(struct)
unparse.append(line)
else:
offset = int(offset,10)
tmp_dict[offset] = t_name
info[struct] = tmp_dict
if len(unparse) != 0:
for u in unparse:
if u[3] in list(info.keys()):
unpar = self.nameISstruct(u,info[u[3]])
info[u[4]]= dict(list(info[u[4]].items())+list(unpar[u[4]].items()))
else:
print("ERROR: No struct name found in %s" % self.file)
ERRORMSG.append("ERROR: No struct name found in %s" % self.file)
return info
def nameISstruct(self,line,key_dict):
dict={}
dict2={}
s_re = re.compile(r'struct %s :(.*?)};' % line[3], re.S)
size_re = re.compile(r'mTotalSize \[(\S+)\]')
content = s_re.search(self.text)
if content:
s_size = size_re.findall(content.group())[0]
else:
s_size = '0'
print("ERROR: Struct %s not define mTotalSize in lst file" %line[3])
ERRORMSG.append("ERROR: Struct %s not define mTotalSize in lst file" %line[3])
size = int(line[0], 10)
if line[2] != 0:
for j in range(0, int(line[2], 10)):
for k in list(key_dict.keys()):
offset = size + k
name ='%s.%s' %((line[1]+'[%s]'%j),key_dict[k])
dict[offset] = name
size = int(s_size,16)+size
elif line[2] == 0:
for k in list(key_dict.keys()):
offset = size + k
name = '%s.%s' % (line[1], key_dict[k])
dict[offset] = name
dict2[line[4]] = dict
return dict2
def efivarstore_parser(self):
efivarstore_format = re.compile(r'efivarstore.*?;', re.S)
struct_re = re.compile(r'efivarstore(.*?),',re.S)
name_re = re.compile(r'name=(\w+)')
efivarstore_dict={}
efitxt = efivarstore_format.findall(self.text)
for i in efitxt:
struct = struct_re.findall(i.replace(' ',''))
name = name_re.findall(i.replace(' ',''))
if struct and name:
efivarstore_dict[name[0]]=struct[0]
else:
print("ERROR: Can't find Struct or name in lst file, please check have this format:efivarstore XXXX, name=xxxx")
ERRORMSG.append("ERROR: Can't find Struct or name in lst file, please check have this format:efivarstore XXXX, name=xxxx")
return efivarstore_dict
class Config(object):
def __init__(self,Config):
self.config=Config
#Parser .config file,return list[offset,name,guid,value,help]
def config_parser(self):
ids_re =re.compile('_ID:(\d+)',re.S)
id_re= re.compile('\s+')
info = []
info_dict={}
with open(self.config, 'r') as text:
read = text.read()
if 'DEFAULT_ID:' in read:
all_txt = read.split('FCEKEY DEFAULT')
for i in all_txt[1:]:
part = [] #save all infomation for DEFAULT_ID
str_id=''
ids = ids_re.findall(i.replace(' ',''))
for m in ids:
str_id +=m+'_'
str_id=str_id[:-1]
part.append(ids)
section = i.split('\nQ') #split with '\nQ ' to get every block
part +=self.section_parser(section)
info_dict[str_id] = self.section_parser(section)
info.append(part)
else:
part = []
id=('0','0')
str_id='0_0'
part.append(id)
section = read.split('\nQ')
part +=self.section_parser(section)
info_dict[str_id] = self.section_parser(section)
info.append(part)
return info_dict
def eval_id(self,id):
id = id.split("_")
default_id=id[0:len(id)//2]
platform_id=id[len(id)//2:]
text=''
for i in range(len(default_id)):
text +="%s.common.%s.%s,"%(SECTION,self.id_name(platform_id[i],'PLATFORM'),self.id_name(default_id[i],'DEFAULT'))
return '\n[%s]\n'%text[:-1]
def id_name(self,ID, flag):
platform_dict = {'0': 'DEFAULT'}
default_dict = {'0': 'STANDARD', '1': 'MANUFACTURING'}
if flag == "PLATFORM":
try:
value = platform_dict[ID]
except KeyError:
value = 'SKUID%s' % ID
elif flag == 'DEFAULT':
try:
value = default_dict[ID]
except KeyError:
value = 'DEFAULTID%s' % ID
else:
value = None
return value
def section_parser(self,section):
offset_re = re.compile(r'offset=(\w+)')
name_re = re.compile(r'name=(\S+)')
guid_re = re.compile(r'guid=(\S+)')
# help_re = re.compile(r'help = (.*)')
attribute_re=re.compile(r'attribute=(\w+)')
value_re = re.compile(r'(//.*)')
part = []
for x in section[1:]:
line=x.split('\n')[0]
line=value_re.sub('',line) #delete \\... in "Q...." line
list1=line.split(' ')
value=self.value_parser(list1)
offset = offset_re.findall(x.replace(' ',''))
name = name_re.findall(x.replace(' ',''))
guid = guid_re.findall(x.replace(' ',''))
attribute =attribute_re.findall(x.replace(' ',''))
if offset and name and guid and value and attribute:
if attribute[0] in ['0x3','0x7']:
offset = int(offset[0], 16)
#help = help_re.findall(x)
text = offset, name[0], guid[0], value, attribute[0]
part.append(text)
return(part)
def value_parser(self, list1):
list1 = [t for t in list1 if t != ''] # remove '' form list
first_num = int(list1[0], 16)
if list1[first_num + 1] == 'STRING': # parser STRING
if list1[-1] == '""':
value = "{0x0, 0x0}"
else:
value = 'L%s' % list1[-1]
elif list1[first_num + 1] == 'ORDERED_LIST': # parser ORDERED_LIST
value_total = int(list1[first_num + 2])
list2 = list1[-value_total:]
tmp = []
line = ''
for i in list2:
if len(i) % 2 == 0 and len(i) != 2:
for m in range(0, len(i) // 2):
tmp.append('0x%02x' % (int('0x%s' % i, 16) >> m * 8 & 0xff))
else:
tmp.append('0x%s' % i)
for i in tmp:
line += '%s,' % i
value = '{%s}' % line[:-1]
else:
value = "0x%01x" % int(list1[-1], 16)
return value
#parser Guid file, get guid name form guid value
class GUID(object):
def __init__(self,path):
self.path = path
self.guidfile = self.gfile()
self.guiddict = self.guid_dict()
def gfile(self):
for root, dir, file in os.walk(self.path, topdown=True, followlinks=False):
if 'FV' in dir:
gfile = os.path.join(root,'Fv','Guid.xref')
if os.path.isfile(gfile):
return gfile
else:
print("ERROR: Guid.xref file not found")
ERRORMSG.append("ERROR: Guid.xref file not found")
exit()
def guid_dict(self):
guiddict={}
with open(self.guidfile,'r') as file:
lines = file.readlines()
guidinfo=lines
for line in guidinfo:
list=line.strip().split(' ')
if list:
if len(list)>1:
guiddict[list[0].upper()]=list[1]
elif list[0] != ''and len(list)==1:
print("Error: line %s can't be parser in %s"%(line.strip(),self.guidfile))
ERRORMSG.append("Error: line %s can't be parser in %s"%(line.strip(),self.guidfile))
else:
print("ERROR: No data in %s" %self.guidfile)
ERRORMSG.append("ERROR: No data in %s" %self.guidfile)
return guiddict
def guid_parser(self,guid):
if guid.upper() in self.guiddict:
return self.guiddict[guid.upper()]
else:
print("ERROR: GUID %s not found in file %s"%(guid, self.guidfile))
ERRORMSG.append("ERROR: GUID %s not found in file %s"%(guid, self.guidfile))
return guid
class PATH(object):
def __init__(self,path):
self.path=path
self.rootdir=self.get_root_dir()
self.usefuldir=[]
self.lstinf = {}
for path in self.rootdir:
for o_root, o_dir, o_file in os.walk(os.path.join(path, "OUTPUT"), topdown=True, followlinks=False):
for INF in o_file:
if os.path.splitext(INF)[1] == '.inf':
for l_root, l_dir, l_file in os.walk(os.path.join(path, "DEBUG"), topdown=True,
followlinks=False):
for LST in l_file:
if os.path.splitext(LST)[1] == '.lst':
self.lstinf[os.path.join(l_root, LST)] = os.path.join(o_root, INF)
self.usefuldir.append(path)
def get_root_dir(self):
rootdir=[]
for root,dir,file in os.walk(self.path,topdown=True,followlinks=False):
if "OUTPUT" in root:
updir=root.split("OUTPUT",1)[0]
rootdir.append(updir)
rootdir=list(set(rootdir))
return rootdir
def lst_inf(self):
return self.lstinf
def package(self):
package={}
package_re=re.compile(r'Packages\.\w+]\n(.*)',re.S)
for i in list(self.lstinf.values()):
with open(i,'r') as inf:
read=inf.read()
section=read.split('[')
for j in section:
p=package_re.findall(j)
if p:
package[i]=p[0].rstrip()
return package
def header(self,struct):
header={}
head_re = re.compile('typedef.*} %s;[\n]+(.*?)(?:typedef|formset)'%struct,re.M|re.S)
head_re2 = re.compile(r'#line[\s\d]+"(\S+h)"')
for i in list(self.lstinf.keys()):
with open(i,'r') as lst:
read = lst.read()
h = head_re.findall(read)
if h:
head=head_re2.findall(h[0])
if head:
format = head[0].replace('\\\\','/').replace('\\','/')
name =format.split('/')[-1]
head = self.makefile(name).replace('\\','/')
header[struct] = head
return header
def makefile(self,filename):
re_format = re.compile(r'DEBUG_DIR.*(?:\S+Pkg)\\(.*\\%s)'%filename)
for i in self.usefuldir:
with open(os.path.join(i,'Makefile'),'r') as make:
read = make.read()
dir = re_format.findall(read)
if dir:
return dir[0]
class mainprocess(object):
def __init__(self,InputPath,Config,OutputPath):
self.init = 0xFCD00000
self.inputpath = os.path.abspath(InputPath)
self.outputpath = os.path.abspath(OutputPath)
self.LST = PATH(self.inputpath)
self.lst_dict = self.LST.lst_inf()
self.Config = Config
self.attribute_dict = {'0x3': 'NV, BS', '0x7': 'NV, BS, RT'}
self.guid = GUID(self.inputpath)
self.header={}
def main(self):
conf=Config(self.Config)
config_dict=conf.config_parser() #get {'0_0':[offset,name,guid,value,attribute]...,'1_0':....}
lst=parser_lst(list(self.lst_dict.keys()))
efi_dict=lst.efivarstore_parser() #get {name:struct} form lst file
keys=sorted(config_dict.keys())
all_struct=lst.struct()
stru_lst=lst.struct_lst()
title_list=[]
info_list=[]
header_list=[]
inf_list =[]
for i in stru_lst:
tmp = self.LST.header(i)
self.header.update(tmp)
for id_key in keys:
tmp_id=[id_key] #['0_0',[(struct,[name...]),(struct,[name...])]]
tmp_info={} #{name:struct}
for section in config_dict[id_key]:
c_offset,c_name,c_guid,c_value,c_attribute = section
if c_name in efi_dict:
struct = efi_dict[c_name]
title='%s%s|L"%s"|%s|0x00||%s\n'%(PCD_NAME,c_name,c_name,self.guid.guid_parser(c_guid),self.attribute_dict[c_attribute])
if struct in all_struct:
lstfile = stru_lst[struct]
struct_dict=all_struct[struct]
try:
title2 = '%s%s|{0}|%s|0xFCD00000{\n <HeaderFiles>\n %s\n <Packages>\n%s\n}\n' % (PCD_NAME, c_name, struct, self.header[struct], self.LST.package()[self.lst_dict[lstfile]])
except KeyError:
WARNING.append("Warning: No <HeaderFiles> for struct %s"%struct)
title2 = '%s%s|{0}|%s|0xFCD00000{\n <HeaderFiles>\n %s\n <Packages>\n%s\n}\n' % (PCD_NAME, c_name, struct, '', self.LST.package()[self.lst_dict[lstfile]])
header_list.append(title2)
else:
struct_dict ={}
print("ERROR: Struct %s can't found in lst file" %struct)
ERRORMSG.append("ERROR: Struct %s can't found in lst file" %struct)
if c_offset in struct_dict:
offset_name=struct_dict[c_offset]
info = "%s%s.%s|%s\n"%(PCD_NAME,c_name,offset_name,c_value)
inf = "%s%s\n"%(PCD_NAME,c_name)
inf_list.append(inf)
tmp_info[info]=title
else:
print("ERROR: Can't find offset %s with struct name %s"%(c_offset,struct))
ERRORMSG.append("ERROR: Can't find offset %s with name %s"%(c_offset,struct))
else:
print("ERROR: Can't find name %s in lst file"%(c_name))
ERRORMSG.append("ERROR: Can't find name %s in lst file"%(c_name))
tmp_id.append(list(self.reverse_dict(tmp_info).items()))
id,tmp_title_list,tmp_info_list = self.read_list(tmp_id)
title_list +=tmp_title_list
info_list.append(tmp_info_list)
inf_list = self.del_repeat(inf_list)
header_list = self.plus(self.del_repeat(header_list))
title_all=list(set(title_list))
info_list = self.remove_bracket(self.del_repeat(info_list))
for i in range(len(info_list)-1,-1,-1):
if len(info_list[i]) == 0:
info_list.remove(info_list[i])
for i in (inf_list, title_all, header_list):
i.sort()
return keys,title_all,info_list,header_list,inf_list
def remove_bracket(self,List):
for i in List:
for j in i:
tmp = j.split("|")
if (('L"' in j) and ("[" in j)) or (tmp[1].strip() == '{0x0, 0x0}'):
tmp[0] = tmp[0][:tmp[0].index('[')]
List[List.index(i)][i.index(j)] = "|".join(tmp)
else:
List[List.index(i)][i.index(j)] = j
for i in List:
if type(i) == type([0,0]):
i.sort()
return List
def write_all(self):
title_flag=1
info_flag=1
if not os.path.isdir(self.outputpath):
os.makedirs(self.outputpath)
decwrite = write2file(os.path.join(self.outputpath,'StructurePcd.dec'))
dscwrite = write2file(os.path.join(self.outputpath,'StructurePcd.dsc'))
infwrite = write2file(os.path.join(self.outputpath, 'StructurePcd.inf'))
conf = Config(self.Config)
ids,title,info,header,inf=self.main()
decwrite.add2file(decstatement)
decwrite.add2file(header)
infwrite.add2file(infstatement)
infwrite.add2file(inf)
dscwrite.add2file(dscstatement)
for id in ids:
dscwrite.add2file(conf.eval_id(id))
if title_flag:
dscwrite.add2file(title)
title_flag=0
if len(info) == 1:
dscwrite.add2file(info)
elif len(info) == 2:
if info_flag:
dscwrite.add2file(info[0])
info_flag =0
else:
dscwrite.add2file(info[1])
def del_repeat(self,List):
if len(List) == 1 or len(List) == 0:
return List
else:
if type(List[0]) != type('xxx'):
alist=[]
for i in range(len(List)):
if i == 0:
alist.append(List[0])
else:
plist = []
for j in range(i):
plist += List[j]
alist.append(self.__del(list(set(plist)), List[i]))
return alist
else:
return list(set(List))
def __del(self,list1,list2):
return list(set(list2).difference(set(list1)))
def reverse_dict(self,dict):
data={}
for i in list(dict.items()):
if i[1] not in list(data.keys()):
data[i[1]]=[i[0]]
else:
data[i[1]].append(i[0])
return data
def read_list(self,list):
title_list=[]
info_list=[]
for i in list[1]:
title_list.append(i[0])
for j in i[1]:
info_list.append(j)
return list[0],title_list,info_list
def plus(self,list):
nums=[]
for i in list:
if type(i) != type([0]):
self.init += 1
num = "0x%01x" % self.init
j=i.replace('0xFCD00000',num.upper())
nums.append(j)
return nums
class write2file(object):
def __init__(self,Output):
self.output=Output
self.text=''
if os.path.exists(self.output):
os.remove(self.output)
def add2file(self,content):
self.text = ''
with open(self.output,'a+') as file:
file.write(self.__gen(content))
def __gen(self,content):
if type(content) == type(''):
return content
elif type(content) == type([0,0])or type(content) == type((0,0)):
return self.__readlist(content)
elif type(content) == type({0:0}):
return self.__readdict(content)
def __readlist(self,list):
for i in list:
if type(i) == type([0,0])or type(i) == type((0,0)):
self.__readlist(i)
elif type(i) == type('') :
self.text +=i
return self.text
def __readdict(self,dict):
content=list(dict.items())
return self.__readlist(content)
def stamp():
return datetime.datetime.now()
def dtime(start,end,id=None):
if id:
pass
print("%s time:%s" % (id,str(end - start)))
else:
print("Total time:%s" %str(end-start)[:-7])
def main():
start = stamp()
parser = argparse.ArgumentParser(prog = __prog__,
description = __description__ + __copyright__,
conflict_handler = 'resolve')
parser.add_argument('-v', '--version', action = 'version',version = __version__, help="show program's version number and exit")
parser.add_argument('-p', '--path', metavar='PATH', dest='path', help="platform build output directory")
parser.add_argument('-c', '--config',metavar='FILENAME', dest='config', help="firmware configuration file")
parser.add_argument('-o', '--outputdir', metavar='PATH', dest='output', help="output directoy")
options = parser.parse_args()
if options.config:
if options.path:
if options.output:
run = mainprocess(options.path, options.config, options.output)
print("Running...")
run.write_all()
if WARNING:
warning = list(set(WARNING))
for j in warning:
print(j)
if ERRORMSG:
ERROR = list(set(ERRORMSG))
with open("ERROR.log", 'w+') as error:
for i in ERROR:
error.write(i + '\n')
print("Some error find, error log in ERROR.log")
print('Finished, Output files in directory %s'%os.path.abspath(options.output))
else:
print('Error command, no output path, use -h for help')
else:
print('Error command, no build path input, use -h for help')
else:
print('Error command, no output file, use -h for help')
end = stamp()
dtime(start, end)
if __name__ == '__main__':
main()

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,125 @@
## @file
# Check a patch for various format issues
#
# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
from __future__ import print_function
VersionNumber = '0.1'
__copyright__ = "Copyright (c) 2015, Intel Corporation All rights reserved."
import argparse
import codecs
import os
import sys
class ConvertOneArg:
"""Converts utf-16 to utf-8 for one command line argument.
This could be a single file, or a directory.
"""
def __init__(self, utf8, source):
self.utf8 = utf8
self.source = source
self.ok = True
if not os.path.exists(source):
self.ok = False
elif os.path.isdir(source):
for (root, dirs, files) in os.walk(source):
files = filter(lambda a: a.endswith('.uni'), files)
for filename in files:
path = os.path.join(root, filename)
self.ok &= self.convert_one_file(path)
if not self.ok:
break
if not self.ok:
break
else:
self.ok &= self.convert_one_file(source)
def convert_one_file(self, source):
if self.utf8:
new_enc, old_enc = 'utf-8', 'utf-16'
else:
new_enc, old_enc = 'utf-16', 'utf-8'
#
# Read file
#
f = open(source, mode='rb')
file_content = f.read()
f.close()
#
# Detect UTF-16 Byte Order Mark at beginning of file.
#
bom = (file_content.startswith(codecs.BOM_UTF16_BE) or
file_content.startswith(codecs.BOM_UTF16_LE))
if bom != self.utf8:
print("%s: already %s" % (source, new_enc))
return True
#
# Decode old string data
#
str_content = file_content.decode(old_enc, 'ignore')
#
# Encode new string data
#
new_content = str_content.encode(new_enc, 'ignore')
#
# Write converted data back to file
#
f = open(source, mode='wb')
f.write(new_content)
f.close()
print(source + ": converted, size", len(file_content), '=>', len(new_content))
return True
class ConvertUniApp:
"""Converts .uni files between utf-16 and utf-8."""
def __init__(self):
self.parse_options()
sources = self.args.source
self.ok = True
for patch in sources:
self.process_one_arg(patch)
if self.ok:
self.retval = 0
else:
self.retval = -1
def process_one_arg(self, arg):
self.ok &= ConvertOneArg(self.utf8, arg).ok
def parse_options(self):
parser = argparse.ArgumentParser(description=__copyright__)
parser.add_argument('--version', action='version',
version='%(prog)s ' + VersionNumber)
parser.add_argument('source', nargs='+',
help='[uni file | directory]')
group = parser.add_mutually_exclusive_group()
group.add_argument("--utf-8",
action="store_true",
help="Convert from utf-16 to utf-8 [default]")
group.add_argument("--utf-16",
action="store_true",
help="Convert from utf-8 to utf-16")
self.args = parser.parse_args()
self.utf8 = not self.args.utf_16
if __name__ == "__main__":
sys.exit(ConvertUniApp().retval)

View File

@ -0,0 +1,198 @@
## @file
# Detect unreferenced PCD and GUID/Protocols/PPIs.
#
# Copyright (c) 2019, Intel Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
'''
DetectNotUsedItem
'''
import re
import os
import sys
import argparse
#
# Globals for help information
#
__prog__ = 'DetectNotUsedItem'
__version__ = '%s Version %s' % (__prog__, '0.1')
__copyright__ = 'Copyright (c) 2019, Intel Corporation. All rights reserved.'
__description__ = "Detect unreferenced PCD and GUID/Protocols/PPIs.\n"
SectionList = ["LibraryClasses", "Guids", "Ppis", "Protocols", "Pcd"]
class PROCESS(object):
def __init__(self, DecPath, InfDirs):
self.Dec = DecPath
self.InfPath = InfDirs
self.Log = []
def ParserDscFdfInfFile(self):
AllContentList = []
for File in self.SearchbyExt([".dsc", ".fdf", ".inf"]):
AllContentList += self.ParseDscFdfInfContent(File)
return AllContentList
# Search File by extension name
def SearchbyExt(self, ExtList):
FileList = []
for path in self.InfPath:
if type(ExtList) == type(''):
for root, _, files in os.walk(path, topdown=True, followlinks=False):
for filename in files:
if filename.endswith(ExtList):
FileList.append(os.path.join(root, filename))
elif type(ExtList) == type([]):
for root, _, files in os.walk(path, topdown=True, followlinks=False):
for filename in files:
for Ext in ExtList:
if filename.endswith(Ext):
FileList.append(os.path.join(root, filename))
return FileList
# Parse DEC file to get Line number and Name
# return section name, the Item Name and comments line number
def ParseDecContent(self):
SectionRE = re.compile(r'\[(.*)\]')
Flag = False
Comments = {}
Comment_Line = []
ItemName = {}
with open(self.Dec, 'r') as F:
for Index, content in enumerate(F):
NotComment = not content.strip().startswith("#")
Section = SectionRE.findall(content)
if Section and NotComment:
Flag = self.IsNeedParseSection(Section[0])
if Flag:
Comment_Line.append(Index)
if NotComment:
if content != "\n" and content != "\r\n":
ItemName[Index] = content.split('=')[0].split('|')[0].split('#')[0].strip()
Comments[Index] = Comment_Line
Comment_Line = []
return ItemName, Comments
def IsNeedParseSection(self, SectionName):
for item in SectionList:
if item in SectionName:
return True
return False
# Parse DSC, FDF, INF File, remove comments, return Lines list
def ParseDscFdfInfContent(self, File):
with open(File, 'r') as F:
lines = F.readlines()
for Index in range(len(lines) - 1, -1, -1):
if lines[Index].strip().startswith("#") or lines[Index] == "\n" or lines[Index] == "\r\n":
lines.remove(lines[Index])
elif "#" in lines[Index]:
lines[Index] = lines[Index].split("#")[0].strip()
else:
lines[Index] = lines[Index].strip()
return lines
def DetectNotUsedItem(self):
NotUsedItem = {}
DecItem, DecComments = self.ParseDecContent()
InfDscFdfContent = self.ParserDscFdfInfFile()
for LineNum in list(DecItem.keys()):
DecItemName = DecItem[LineNum]
Match_reg = re.compile("(?<![a-zA-Z0-9_-])%s(?![a-zA-Z0-9_-])" % DecItemName)
MatchFlag = False
for Line in InfDscFdfContent:
if Match_reg.search(Line):
MatchFlag = True
break
if not MatchFlag:
NotUsedItem[LineNum] = DecItemName
self.Display(NotUsedItem)
return NotUsedItem, DecComments
def Display(self, UnuseDict):
print("DEC File:\n%s\n%s%s" % (self.Dec, "{:<15}".format("Line Number"), "{:<0}".format("Unused Item")))
self.Log.append(
"DEC File:\n%s\n%s%s\n" % (self.Dec, "{:<15}".format("Line Number"), "{:<0}".format("Unused Item")))
for num in list(sorted(UnuseDict.keys())):
ItemName = UnuseDict[num]
print("%s%s%s" % (" " * 3, "{:<12}".format(num + 1), "{:<1}".format(ItemName)))
self.Log.append(("%s%s%s\n" % (" " * 3, "{:<12}".format(num + 1), "{:<1}".format(ItemName))))
def Clean(self, UnUseDict, Comments):
removednum = []
for num in list(UnUseDict.keys()):
if num in list(Comments.keys()):
removednum += Comments[num]
with open(self.Dec, 'r') as Dec:
lines = Dec.readlines()
try:
with open(self.Dec, 'w+') as T:
for linenum in range(len(lines)):
if linenum in removednum:
continue
else:
T.write(lines[linenum])
print("DEC File has been clean: %s" % (self.Dec))
except Exception as err:
print(err)
class Main(object):
def mainprocess(self, Dec, Dirs, Isclean, LogPath):
for dir in Dirs:
if not os.path.exists(dir):
print("Error: Invalid path for '--dirs': %s" % dir)
sys.exit(1)
Pa = PROCESS(Dec, Dirs)
unuse, comment = Pa.DetectNotUsedItem()
if Isclean:
Pa.Clean(unuse, comment)
self.Logging(Pa.Log, LogPath)
def Logging(self, content, LogPath):
if LogPath:
try:
if os.path.isdir(LogPath):
FilePath = os.path.dirname(LogPath)
if not os.path.exists(FilePath):
os.makedirs(FilePath)
with open(LogPath, 'w+') as log:
for line in content:
log.write(line)
print("Log save to file: %s" % LogPath)
except Exception as e:
print("Save log Error: %s" % e)
def main():
parser = argparse.ArgumentParser(prog=__prog__,
description=__description__ + __copyright__,
conflict_handler='resolve')
parser.add_argument('-i', '--input', metavar="", dest='InputDec', help="Input DEC file name.")
parser.add_argument('--dirs', metavar="", action='append', dest='Dirs',
help="The package directory. To specify more directories, please repeat this option.")
parser.add_argument('--clean', action='store_true', default=False, dest='Clean',
help="Clean the unreferenced items from DEC file.")
parser.add_argument('--log', metavar="", dest="Logfile", default=False,
help="Put log in specified file as well as on console.")
options = parser.parse_args()
if options.InputDec:
if not (os.path.exists(options.InputDec) and options.InputDec.endswith(".dec")):
print("Error: Invalid DEC file input: %s" % options.InputDec)
if options.Dirs:
M = Main()
M.mainprocess(options.InputDec, options.Dirs, options.Clean, options.Logfile)
else:
print("Error: the following argument is required:'--dirs'.")
else:
print("Error: the following argument is required:'-i/--input'.")
if __name__ == '__main__':
main()

View File

@ -0,0 +1,106 @@
# @file FormatDosFiles.py
# This script format the source files to follow dos style.
# It supports Python2.x and Python3.x both.
#
# Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#
# Import Modules
#
from __future__ import print_function
import argparse
import os
import os.path
import re
import sys
import copy
__prog__ = 'FormatDosFiles'
__version__ = '%s Version %s' % (__prog__, '0.10 ')
__copyright__ = 'Copyright (c) 2018-2019, Intel Corporation. All rights reserved.'
__description__ = 'Convert source files to meet the EDKII C Coding Standards Specification.\n'
DEFAULT_EXT_LIST = ['.h', '.c', '.nasm', '.nasmb', '.asm', '.S', '.inf', '.dec', '.dsc', '.fdf', '.uni', '.asl', '.aslc', '.vfr', '.idf', '.txt', '.bat', '.py']
#For working in python2 and python3 environment, re pattern should use binary string, which is bytes type in python3.
#Because in python3,read from file in binary mode will return bytes type,and in python3 bytes type can not be mixed with str type.
def FormatFile(FilePath, Args):
with open(FilePath, 'rb') as Fd:
Content = Fd.read()
# Convert the line endings to CRLF
Content = re.sub(br'([^\r])\n', br'\1\r\n', Content)
Content = re.sub(br'^\n', br'\r\n', Content, flags=re.MULTILINE)
# Add a new empty line if the file is not end with one
Content = re.sub(br'([^\r\n])$', br'\1\r\n', Content)
# Remove trailing white spaces
Content = re.sub(br'[ \t]+(\r\n)', br'\1', Content, flags=re.MULTILINE)
# Replace '\t' with two spaces
Content = re.sub(b'\t', b' ', Content)
with open(FilePath, 'wb') as Fd:
Fd.write(Content)
if not Args.Quiet:
print(FilePath)
def FormatFilesInDir(DirPath, ExtList, Args):
FileList = []
ExcludeDir = DirPath
for DirPath, DirNames, FileNames in os.walk(DirPath):
if Args.Exclude:
DirNames[:] = [d for d in DirNames if d not in Args.Exclude]
FileNames[:] = [f for f in FileNames if f not in Args.Exclude]
Continue = False
for Path in Args.Exclude:
if not os.path.isdir(Path) and not os.path.isfile(Path):
Path = os.path.join(ExcludeDir, Path)
if os.path.isdir(Path) and Path.endswith(DirPath):
DirNames[:] = []
Continue = True
elif os.path.isfile(Path):
FilePaths = FileNames
for ItemPath in FilePaths:
FilePath = os.path.join(DirPath, ItemPath)
if Path.endswith(FilePath):
FileNames.remove(ItemPath)
if Continue:
continue
for FileName in [f for f in FileNames if any(f.endswith(ext) for ext in ExtList)]:
FileList.append(os.path.join(DirPath, FileName))
for File in FileList:
FormatFile(File, Args)
if __name__ == "__main__":
parser = argparse.ArgumentParser(prog=__prog__, description=__description__ + __copyright__, conflict_handler = 'resolve')
parser.add_argument('Path', nargs='+',
help='the path for files to be converted.It could be directory or file path.')
parser.add_argument('--version', action='version', version=__version__)
parser.add_argument('--append-extensions', dest='AppendExt', nargs='+',
help='append file extensions filter to default extensions. (Example: .txt .c .h)')
parser.add_argument('--override-extensions', dest='OverrideExt', nargs='+',
help='override file extensions filter on default extensions. (Example: .txt .c .h)')
parser.add_argument('-v', '--verbose', dest='Verbose', action='store_true',
help='increase output messages')
parser.add_argument('-q', '--quiet', dest='Quiet', action='store_true',
help='reduce output messages')
parser.add_argument('--debug', dest='Debug', type=int, metavar='[0-9]', choices=range(0, 10), default=0,
help='set debug level')
parser.add_argument('--exclude', dest='Exclude', nargs='+', help="directory name or file name which will be excluded")
args = parser.parse_args()
DefaultExt = copy.copy(DEFAULT_EXT_LIST)
if args.OverrideExt is not None:
DefaultExt = args.OverrideExt
if args.AppendExt is not None:
DefaultExt = list(set(DefaultExt + args.AppendExt))
for Path in args.Path:
if not os.path.exists(Path):
print("not exists path: {0}".format(Path))
sys.exit(1)
if os.path.isdir(Path):
FormatFilesInDir(Path, DefaultExt, args)
elif os.path.isfile(Path):
FormatFile(Path, args)

View File

@ -0,0 +1,79 @@
/** @file
Unified linker script for GCC based builds
Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2015, Linaro Ltd. All rights reserved.<BR>
(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
**/
SECTIONS {
/*
* The PE/COFF binary consists of DOS and PE/COFF headers, and a sequence of
* section headers adding up to PECOFF_HEADER_SIZE bytes (which differs
* between 32-bit and 64-bit builds). The actual start of the .text section
* will be rounded up based on its actual alignment.
*/
. = PECOFF_HEADER_SIZE;
.text : ALIGN(CONSTANT(COMMONPAGESIZE)) {
*(.text .text.* .stub .gnu.linkonce.t.*)
*(.rodata .rodata.* .gnu.linkonce.r.*)
*(.got .got.*)
/*
* The contents of AutoGen.c files are mostly constant from the POV of the
* program, but most of it ends up in .data or .bss by default since few of
* the variable definitions that get emitted are declared as CONST.
* Unfortunately, we cannot pull it into the .text section entirely, since
* patchable PCDs are also emitted here, but we can at least move all of the
* emitted GUIDs here.
*/
*:AutoGen.obj(.data.g*Guid)
}
/*
* The alignment of the .data section should be less than or equal to the
* alignment of the .text section. This ensures that the relative offset
* between these sections is the same in the ELF and the PE/COFF versions of
* this binary.
*/
.data ALIGN(ALIGNOF(.text)) : ALIGN(CONSTANT(COMMONPAGESIZE)) {
*(.data .data.* .gnu.linkonce.d.*)
*(.bss .bss.*)
}
.eh_frame ALIGN(CONSTANT(COMMONPAGESIZE)) : {
KEEP (*(.eh_frame))
}
.rela (INFO) : {
*(.rela .rela.*)
}
.hii : ALIGN(CONSTANT(COMMONPAGESIZE)) {
KEEP (*(.hii))
}
/*
* Retain the GNU build id but in a non-allocatable section so GenFw
* does not copy it into the PE/COFF image.
*/
.build-id (INFO) : { *(.note.gnu.build-id) }
/DISCARD/ : {
*(.note.GNU-stack)
*(.gnu_debuglink)
*(.interp)
*(.dynsym)
*(.dynstr)
*(.dynamic)
*(.hash .gnu.hash)
*(.comment)
*(COMMON)
}
}

View File

@ -0,0 +1,190 @@
## @file
# Retrieves the people to request review from on submission of a commit.
#
# Copyright (c) 2019, Linaro Ltd. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
from __future__ import print_function
from collections import defaultdict
from collections import OrderedDict
import argparse
import os
import re
import SetupGit
EXPRESSIONS = {
'exclude': re.compile(r'^X:\s*(?P<exclude>.*?)\r*$'),
'file': re.compile(r'^F:\s*(?P<file>.*?)\r*$'),
'list': re.compile(r'^L:\s*(?P<list>.*?)\r*$'),
'maintainer': re.compile(r'^M:\s*(?P<maintainer>.*<.*?>)\r*$'),
'reviewer': re.compile(r'^R:\s*(?P<reviewer>.*?)\r*$'),
'status': re.compile(r'^S:\s*(?P<status>.*?)\r*$'),
'tree': re.compile(r'^T:\s*(?P<tree>.*?)\r*$'),
'webpage': re.compile(r'^W:\s*(?P<webpage>.*?)\r*$')
}
def printsection(section):
"""Prints out the dictionary describing a Maintainers.txt section."""
print('===')
for key in section.keys():
print("Key: %s" % key)
for item in section[key]:
print(' %s' % item)
def pattern_to_regex(pattern):
"""Takes a string containing regular UNIX path wildcards
and returns a string suitable for matching with regex."""
pattern = pattern.replace('.', r'\.')
pattern = pattern.replace('?', r'.')
pattern = pattern.replace('*', r'.*')
if pattern.endswith('/'):
pattern += r'.*'
elif pattern.endswith('.*'):
pattern = pattern[:-2]
pattern += r'(?!.*?/.*?)'
return pattern
def path_in_section(path, section):
"""Returns True of False indicating whether the path is covered by
the current section."""
if not 'file' in section:
return False
for pattern in section['file']:
regex = pattern_to_regex(pattern)
match = re.match(regex, path)
if match:
# Check if there is an exclude pattern that applies
for pattern in section['exclude']:
regex = pattern_to_regex(pattern)
match = re.match(regex, path)
if match:
return False
return True
return False
def get_section_maintainers(path, section):
"""Returns a list with email addresses to any M: and R: entries
matching the provided path in the provided section."""
maintainers = []
lists = []
if path_in_section(path, section):
for address in section['maintainer'], section['reviewer']:
# Convert to list if necessary
if isinstance(address, list):
maintainers += address
else:
lists += [address]
for address in section['list']:
# Convert to list if necessary
if isinstance(address, list):
lists += address
else:
lists += [address]
return maintainers, lists
def get_maintainers(path, sections, level=0):
"""For 'path', iterates over all sections, returning maintainers
for matching ones."""
maintainers = []
lists = []
for section in sections:
tmp_maint, tmp_lists = get_section_maintainers(path, section)
if tmp_maint:
maintainers += tmp_maint
if tmp_lists:
lists += tmp_lists
if not maintainers:
# If no match found, look for match for (nonexistent) file
# REPO.working_dir/<default>
print('"%s": no maintainers found, looking for default' % path)
if level == 0:
maintainers = get_maintainers('<default>', sections, level=level + 1)
else:
print("No <default> maintainers set for project.")
if not maintainers:
return None
return maintainers + lists
def parse_maintainers_line(line):
"""Parse one line of Maintainers.txt, returning any match group and its key."""
for key, expression in EXPRESSIONS.items():
match = expression.match(line)
if match:
return key, match.group(key)
return None, None
def parse_maintainers_file(filename):
"""Parse the Maintainers.txt from top-level of repo and
return a list containing dictionaries of all sections."""
with open(filename, 'r') as text:
line = text.readline()
sectionlist = []
section = defaultdict(list)
while line:
key, value = parse_maintainers_line(line)
if key and value:
section[key].append(value)
line = text.readline()
# If end of section (end of file, or non-tag line encountered)...
if not key or not value or not line:
# ...if non-empty, append section to list.
if section:
sectionlist.append(section.copy())
section.clear()
return sectionlist
def get_modified_files(repo, args):
"""Returns a list of the files modified by the commit specified in 'args'."""
commit = repo.commit(args.commit)
return commit.stats.files
if __name__ == '__main__':
PARSER = argparse.ArgumentParser(
description='Retrieves information on who to cc for review on a given commit')
PARSER.add_argument('commit',
action="store",
help='git revision to examine (default: HEAD)',
nargs='?',
default='HEAD')
PARSER.add_argument('-l', '--lookup',
help='Find section matches for path LOOKUP',
required=False)
ARGS = PARSER.parse_args()
REPO = SetupGit.locate_repo()
CONFIG_FILE = os.path.join(REPO.working_dir, 'Maintainers.txt')
SECTIONS = parse_maintainers_file(CONFIG_FILE)
if ARGS.lookup:
FILES = [ARGS.lookup]
else:
FILES = get_modified_files(REPO, ARGS)
ADDRESSES = []
for file in FILES:
print(file)
addresslist = get_maintainers(file, SECTIONS)
if addresslist:
ADDRESSES += addresslist
for address in list(OrderedDict.fromkeys(ADDRESSES)):
print(' %s' % address)

Some files were not shown because too many files have changed in this diff Show More