@echo off\r
@REM ## @file\r
@REM #\r
-@REM # Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
+@REM # Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
@REM #\r
@REM # This program and the accompanying materials\r
@REM # are licensed and made available under the terms and conditions of the BSD License\r
\r
@REM Set up environment at first.\r
\r
-set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32\r
+set BASETOOLS_DIR=%EDK_TOOLS_BIN%\r
set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin\r
set DISK_LABEL=DUET\r
set PROCESSOR=""\r
set STEP=1\r
-call %WORKSPACE%\DuetPkg\GetVariables.bat\r
-\r
-echo on\r
\r
if "%1"=="" goto Help\r
if "%2"=="" goto Help\r
if "%TARGET_ARCH%"=="IA32" set PROCESSOR=IA32\r
if "%TARGET_ARCH%"=="X64" set PROCESSOR=X64\r
if %PROCESSOR%=="" goto WrongArch\r
+call %WORKSPACE%\DuetPkg\SetEnv_%PROCESSOR%.bat\r
set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\%TARGET%_%TOOL_CHAIN_TAG%\r
\r
if "%1"=="floppy" goto CreateFloppy\r
"$*" = "--help" \
]
then
- echo "Usage: CreateBootDisk [usb|floppy|ide|file] MediaPath DevicePath [FAT12|FAT16|FAT32] [IA32|X64] [GCC44|UNIXGCC]"
+ echo "Usage: CreateBootDisk [usb|floppy|ide|file] MediaPath DevicePath [FAT12|FAT16|FAT32] [IA32|X64]"
echo "e.g. : CreateBootDisk floppy /media/floppy0 /dev/fd0 FAT12 IA32"
PROCESS_MARK=FALSE
fi
return 1
esac
-if [ -z "$6" ]
-then
- TOOLCHAIN=GCC44
-else
- TOOLCHAIN=$6
-fi
-
+. $WORKSPACE/DuetPkg/SetEnv_$PROCESSOR.sh
export BUILD_DIR=$WORKSPACE/Build/DuetPkg$PROCESSOR/DEBUG_$TOOLCHAIN
BUILD_TARGETS = DEBUG\r
SKUID_IDENTIFIER = DEFAULT\r
FLASH_DEFINITION = DuetPkg/DuetPkg.fdf\r
+!if $(TOOL_CHAIN_TAG) == GCC47 || $(TOOL_CHAIN_TAG) == GCC48 || $(TOOL_CHAIN_TAG) == GCC49 || $(TOOL_CHAIN_TAG) == GCC5\r
+ POSTBUILD = DuetPkg/PostBuild.sh\r
+!else\r
+ POSTBUILD = DuetPkg/PostBuild.bat\r
+!endif\r
\r
################################################################################\r
#\r
BUILD_TARGETS = DEBUG\r
SKUID_IDENTIFIER = DEFAULT\r
FLASH_DEFINITION = DuetPkg/DuetPkg.fdf\r
+!if $(TOOL_CHAIN_TAG) == GCC47 || $(TOOL_CHAIN_TAG) == GCC48 || $(TOOL_CHAIN_TAG) == GCC49 || $(TOOL_CHAIN_TAG) == GCC5\r
+ POSTBUILD = DuetPkg/PostBuild.sh\r
+!else\r
+ POSTBUILD = DuetPkg/PostBuild.bat\r
+!endif\r
\r
################################################################################\r
#\r
+++ /dev/null
-@echo off\r
-@REM ## @file\r
-@REM #\r
-@REM # Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
-@REM #\r
-@REM # This program and the accompanying materials\r
-@REM # are licensed and made available under the terms and conditions of the BSD License\r
-@REM # which accompanies this distribution. The full text of the license may be found at\r
-@REM # http://opensource.org/licenses/bsd-license.php\r
-@REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-@REM #\r
-@REM #\r
-@REM ##\r
-\r
-\r
-@REM Read the variables from Conf/target.txt\r
-@REM Because we can't add '=' as a delimiter in 'for', each variable is read in 2 parts:\r
-@REM First we read the "= xyz" part of the variable assignation which we use, along with\r
-@REM the original equal sign for our first assignation. Then we trim any left whitespaces.\r
-@REM NB: default token delimiters for "for /f" are tab and space.\r
-\r
-set CONFIG_FILE=%WORKSPACE%\Conf\target.txt\r
-\r
-for /f "tokens=1*" %%i in ('type %CONFIG_FILE% ^| find "TOOL_CHAIN_TAG" ^| find /V "#"') do @set TOOL_CHAIN_TAG%%j\r
-for /f "tokens=*" %%i in ("%TOOL_CHAIN_TAG%") do @set TOOL_CHAIN_TAG=%%i\r
-\r
-for /f "tokens=1*" %%i in ('type %CONFIG_FILE% ^| find "TARGET" ^| find /V "#" ^| find /V "TARGET_ARCH"') do @set TARGET%%j\r
-for /f "tokens=*" %%i in ("%TARGET%") do @set TARGET=%%i\r
-\r
-for /f "tokens=1*" %%i in ('type %CONFIG_FILE% ^| find "TARGET_ARCH" ^|find /V "#"') do @set TARGET_ARCH%%j\r
-for /f "tokens=*" %%i in ("%TARGET_ARCH%") do @set TARGET_ARCH=%%i\r
-\r
-\r
-REM Set defaults if above variables are undefined in target.txt\r
-\r
-if "%TOOL_CHAIN_TAG%%"=="" @set TOOL_CHAIN_TAG=MYTOOLS\r
-if "%TARGET%"=="" @set TARGET=DEBUG\r
-if "%TARGET_ARCH%"=="" @set TARGET_ARCH=IA32\r
@echo off\r
@REM ## @file\r
@REM #\r
-@REM # Currently, Build system does not provide post build mechanism for module\r
-@REM # and platform building, so just use a bat file to do post build commands.\r
-@REM # Originally, following post building command is for EfiLoader module.\r
+@REM # Post build script that will be automatically run after build.\r
@REM #\r
-@REM # Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>\r
+@REM # Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
@REM #\r
@REM # This program and the accompanying materials\r
@REM # are licensed and made available under the terms and conditions of the BSD License\r
@REM #\r
@REM ##\r
\r
-set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32\r
+set BASETOOLS_DIR=%EDK_TOOLS_BIN%\r
set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin\r
-set PROCESSOR=""\r
-call %WORKSPACE%\DuetPkg\GetVariables.bat\r
\r
-if NOT "%1"=="" @set TARGET_ARCH=%1\r
-if "%TARGET_ARCH%"=="IA32" set PROCESSOR=IA32\r
-if "%TARGET_ARCH%"=="X64" set PROCESSOR=X64\r
-if %PROCESSOR%=="" goto WrongArch\r
+:SetDefault\r
+set TARGET_ARCH=\r
+set TARGET=\r
+set TOOL_CHAIN_TAG=\r
\r
+:ParseParamsLoop\r
+if "%1"=="" goto EndPParseParamsLoop\r
+if /I "%1"=="-p" goto ParseParamsLoopNext\r
+if /I "%1"=="-a" set TARGET_ARCH=%2& goto ParseParamsLoopNext\r
+if /I "%1"=="-b" set TARGET=%2& goto ParseParamsLoopNext\r
+if /I "%1"=="-t" set TOOL_CHAIN_TAG=%2& goto ParseParamsLoopNext\r
+if /I "%1"=="-h" goto Help\r
+\r
+:ParseParamsLoopNext\r
+shift\r
+shift\r
+goto ParseParamsLoop\r
+\r
+:EndPParseParamsLoop\r
+if "%TARGET_ARCH%"=="" goto Help\r
+if "%TARGET%"=="" goto Help\r
+if "%TOOL_CHAIN_TAG%"=="" goto Help\r
+\r
+set PROCESSOR=%TARGET_ARCH%\r
set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\%TARGET%_%TOOL_CHAIN_TAG%\r
\r
+@REM Store environment variables used by CreateBootDisk.bat\r
+echo set TARGET=%TARGET%> %WORKSPACE%\DuetPkg\SetEnv_%PROCESSOR%.bat\r
+echo set TOOL_CHAIN_TAG=%TOOL_CHAIN_TAG%>> %WORKSPACE%\DuetPkg\SetEnv_%PROCESSOR%.bat\r
\r
echo Compressing DUETEFIMainFv.FV ...\r
%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DUETEFIMAINFV.z %BUILD_DIR%\FV\DUETEFIMAINFV.Fv\r
%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\Efildr20Pure -o %BUILD_DIR%\FV\Efildr20\r
goto end\r
\r
-\r
-:WrongArch\r
-echo Error! Wrong architecture.\r
-goto Help\r
-\r
:Help\r
-echo Usage: "PostBuild [IA32|X64]"\r
-:end
\ No newline at end of file
+echo Usage: This script will be run automatically after build.\r
+:end\r
## @file
#
-# Currently, Build system does not provide post build mechanism for module
-# and platform building, so just use a sh file to do post build commands.
-# Originally, following post building command is for EfiLoader module.
+# Post build script that will be automatically run after build.
#
# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
#
export BOOTSECTOR_BIN_DIR=$WORKSPACE/DuetPkg/BootSector/bin
export PROCESSOR=""
-if [ \
- -z "$1" -o \
- "$1" = "-?" -o \
- "$1" = "-h" -o \
- "$1" = "--help" \
- ]
-then
- echo Error! Please specific the architecture.
- echo Usage: "./PostBuild.sh [IA32|X64] [UNIXGCC|GCC44]"
+export TOOLTAG=""
+
+while [ $# -gt 0 ]; do
+ if [ "$1" = "-a" ]; then
+ export PROCESSOR=$2
+ elif [ "$1" = "-t" ]; then
+ export TOOLTAG=$2
+ elif [ "$1" = "-h" ]; then
+ echo Usage: This script will be run automatically after build.
+ return 1
+ fi
+ shift
+ shift
+done
+
+if [ "$PROCESSOR" = "" -o "$TOOLTAG" = "" ]; then
+ echo Usage: This script will be run automatically after build.
+ return 1
fi
-case "$1" in
- IA32)
- export PROCESSOR=IA32
- ;;
- X64)
- export PROCESSOR=X64
- ;;
- *)
- echo Invalid Architecture string, should be only IA32 or X64
- return 1
-esac
-
-case "$2" in
- UNIXGCC)
- export TOOLTAG=UNIXGCC
- ;;
- GCC4*)
- export TOOLTAG=$2
- ;;
- *)
- echo Invalid tool tag, should be only UNIXGCC or GCC4\*
- return 1
-esac
-
export BUILD_DIR=$WORKSPACE/Build/DuetPkg$PROCESSOR/DEBUG_$TOOLTAG
+#
+# Store environment variables used by CreateBootDisk.sh
+#
+echo export TOOLCHAIN=$TOOLTAG> $WORKSPACE/DuetPkg/SetEnv_$PROCESSOR.sh
+chmod +x $WORKSPACE/DuetPkg/SetEnv_$PROCESSOR.sh
#
# Boot sector module could only be built under IA32 tool chain
========================================\r
1. Tools preparation\r
\r
-To build DUET image, following tools are required:\r
+ To build DUET image, Visual Studio is required:\r
+ 1). Base on below link to create Visual Studio build environment.\r
+ https://github.com/tianocore/tianocore.github.io/wiki/Windows-systems\r
\r
- 1). *Visual Studio 2005*\r
- Assume installed at <VS_PATH>,\r
- e.g.: C:\Program Files\Microsoft Visual Studio .NET 2003\.\r
- 2). WinDDK\r
- Assume installed at <WIN_DDK_PATH>, e.g.: C:\WINDDK\3790.1830\.\r
-\r
-2. Build steps\r
-\r
-2.1 Build Duet Platform module\r
+2. Build Duet Platform module\r
\r
1). run cmd.exe to open command line window.\r
2). enter workspace root directory such as c:\edk2_tree\r
- 2). run "edksetup.bat"\r
- 3). run "build -p DuetPkg\DuetPkg.dsc -a IA32" for IA32 architecture platform or\r
- "build -p DuetPkg\DuetPkg.dsc -a X64" for X64 architecture platform.\r
+ 3). set the environment variable EDK_TOOLS_BIN to point at the BaseTools binaries directory\r
+ i.e., "set EDK_TOOLS_BIN=c:\edk2-BaseTools-win32"\r
+ 4). run "edksetup.bat"\r
+ 5). run "build -p DuetPkg\DuetPkgIa32.dsc -a IA32 -t VS2015x86" for IA32 architecture platform (using 64-bit VS2015 for example) or\r
+ "build -p DuetPkg\DuetPkgX64.dsc -a X64 -t VS2015x86" for X64 architecture platform.\r
+\r
+ NOTE: The post build script 'PostBuild.sh' will be automatically called after the build command.\r
\r
-2.2 Execute post build actions\r
- 1). enter <Workspace>\DuetPkg directory.\r
- 2). run "PostBuild.bat IA32" for IA32 architecture platform or\r
- "PostBuild.bat X64" for X64 architecture platform.\r
\r
Create bootable disk\r
======================\r
======================================\r
1. Tools preparation\r
\r
- To build DUET image, GCC44 is required:\r
- 1). Base on below link to create GCC44 build environment.\r
- http://tianocore.sourceforge.net/wiki/Using_EDK_II_with_Native_GCC\r
+ To build DUET image, GCC installation (4.4+) is required:\r
+ 1). Base on below link to create GCC build environment.\r
+ https://github.com/tianocore/tianocore.github.io/wiki/Using-EDK-II-with-Native-GCC\r
\r
-2. Build steps\r
-\r
-2.1 Build Duet Platform module\r
+2. Build Duet Platform module\r
\r
1). Open the terminal.\r
2). enter workspace root directory such as /edk2_tree\r
3). run ". edksetup.sh BaseTools"\r
- 4). run "build -p DuetPkg/DuetPkg.dsc -a IA32 -t GCC44" for IA32 architecture platform or\r
- "build -p DuetPkg/DuetPkg.dsc -a X64 -t GCC44" for X64 architecture platform.\r
-\r
-2.2 Execute post build actions\r
- 1). enter /edk2_tree/DuetPkg directory.\r
- 2). run "./PostBuild.sh IA32 GCC44" for IA32 architecture platform or\r
- "./PostBuild.sh X64 GCC44" for X64 architecture platform.\r
+ 4). run "build -p DuetPkg/DuetPkgIa32.dsc -a IA32 -t GCC49" for IA32 architecture platform (using GCC 4.9 for example) or\r
+ "build -p DuetPkg/DuetPkgX64.dsc -a X64 -t GCC49" for X64 architecture platform.\r
\r
- NOTE: After post build action, you should check the size of EfiLdr at $WORKSPACE/Build/DuetPkg/DEBUG_GCC44 directory, it must less than 470k.\r
- If not, you should manually remove some unnecessary drivers at DuetPkg.fdf file.\r
+ NOTE: The post build script 'PostBuild.sh' will be automatically called after the build command.\r
+ After post build action, you should check the size of EfiLdr at $WORKSPACE/Build/DuetPkgIA32(DuetPkgX64)/DEBUG_GCC49 directory, it must less than 470k.\r
+ If not, you should manually remove some unnecessary drivers at DuetPkg.fdf file.\r
\r
3. Create bootable disk\r
The following steps are same for IA32 architecture platform or X64 architecture platform.\r
- Now only support floopy.\r
\r
- 3.1 Create floppy boot disk\r
- 1). enter /edk2_tree/DuetPkg directory.\r
- 2). Insert a floppy disk to drive\r
- 3). run "CreateBootDisk.sh" to build floppy drive\r
- such as "./CreateBootDisk.sh floppy /media/floppy0 /dev/fd0 FAT12 IA32"\r
+3.1 Create floppy boot disk\r
+ 1). enter /edk2_tree/DuetPkg directory.\r
+ 2). Insert a floppy disk to drive\r
+ 3). run "CreateBootDisk.sh" to build floppy drive\r
+ such as "./CreateBootDisk.sh floppy /media/floppy0 /dev/fd0 FAT12 IA32"\r
+\r
+3.2 Create usb boot disk\r
+ 1). enter /edk2_tree/DuetPkg directory.\r
+ 2). Plugin usb disk\r
+ 3). run "CreateBootDisk.sh" to build usb drive\r
+ such as "./CreateBootDisk.sh usb /media/usb0 /dev/sdb0 FAT16 IA32"\r
+ 4). UnPlug usb disk and plugin it again.\r
+ 5). run "./CreateBootDisk.sh usb /media/usb0 /dev/sdb0 FAT16 IA32 step2"\r
#
echo Running edk2 build for DuetPkg$Processor
build -p $WORKSPACE/DuetPkg/DuetPkg$Processor.dsc -a $PROCESSOR -t $TARGET_TOOLS -n 3 $*
-echo Running DuetPkg/PostBuild.sh
-$WORKSPACE/DuetPkg/PostBuild.sh $PROCESSOR $TARGET_TOOLS
echo Running DuetPkg/CreateBootDisk.sh
-$WORKSPACE/DuetPkg/CreateBootDisk.sh file $FLOPPY_IMAGE /dev/null FAT12 $PROCESSOR $TARGET_TOOLS
+$WORKSPACE/DuetPkg/CreateBootDisk.sh file $FLOPPY_IMAGE /dev/null FAT12 $PROCESSOR
exit $?
#
echo Running edk2 build for DuetPkg$PROCESSOR
build -p $WORKSPACE/DuetPkg/DuetPkg$PROCESSOR.dsc -a $PROCESSOR -t $TARGET_TOOLS -n 3 $*
-echo Running DuetPkg/PostBuild.sh
-$WORKSPACE/DuetPkg/PostBuild.sh $PROCESSOR $TARGET_TOOLS
echo Running DuetPkg/CreateBootDisk.sh
-$WORKSPACE/DuetPkg/CreateBootDisk.sh file $FLOPPY_IMAGE /dev/null FAT12 $PROCESSOR $TARGET_TOOLS
+$WORKSPACE/DuetPkg/CreateBootDisk.sh file $FLOPPY_IMAGE /dev/null FAT12 $PROCESSOR
exit $?