2009-03-02 13:12:46 +01:00
|
|
|
#!/bin/sh
|
2010-03-18 03:36:52 +01:00
|
|
|
|
|
|
|
## @file
|
|
|
|
#
|
2016-11-11 09:21:35 +01:00
|
|
|
# Post build script that will be automatically run after build.
|
2010-03-18 03:36:52 +01:00
|
|
|
#
|
2016-04-06 09:39:17 +02:00
|
|
|
# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
2010-03-18 03:36:52 +01:00
|
|
|
#
|
|
|
|
# This program and the accompanying materials
|
|
|
|
# are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
# which accompanies this distribution. The full text of the license may be found at
|
|
|
|
# http://opensource.org/licenses/bsd-license.php
|
|
|
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
#
|
|
|
|
##
|
2010-03-10 02:23:13 +01:00
|
|
|
|
2010-10-16 20:50:33 +02:00
|
|
|
if [ -z "$EDK_TOOLS_PATH" ]
|
|
|
|
then
|
2009-09-17 04:16:30 +02:00
|
|
|
export BASETOOLS_DIR=$WORKSPACE/Conf/BaseToolsSource/Source/C/bin
|
2010-10-16 20:50:33 +02:00
|
|
|
else
|
|
|
|
export BASETOOLS_DIR=$EDK_TOOLS_PATH/Source/C/bin
|
|
|
|
fi
|
|
|
|
|
2009-06-22 05:01:53 +02:00
|
|
|
export BOOTSECTOR_BIN_DIR=$WORKSPACE/DuetPkg/BootSector/bin
|
2009-03-02 09:37:23 +01:00
|
|
|
export PROCESSOR=""
|
2016-11-11 09:21:35 +01:00
|
|
|
export TOOLTAG=""
|
2009-03-02 09:37:23 +01:00
|
|
|
|
2016-11-11 09:21:35 +01:00
|
|
|
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
|
2009-03-02 09:37:23 +01:00
|
|
|
|
2016-11-11 09:21:35 +01:00
|
|
|
if [ "$PROCESSOR" = "" -o "$TOOLTAG" = "" ]; then
|
|
|
|
echo Usage: This script will be run automatically after build.
|
|
|
|
return 1
|
|
|
|
fi
|
2010-06-10 10:54:18 +02:00
|
|
|
|
|
|
|
export BUILD_DIR=$WORKSPACE/Build/DuetPkg$PROCESSOR/DEBUG_$TOOLTAG
|
2010-03-18 03:36:52 +01:00
|
|
|
|
2016-11-11 09:21:35 +01:00
|
|
|
#
|
|
|
|
# Store environment variables used by CreateBootDisk.sh
|
|
|
|
#
|
|
|
|
echo export TOOLCHAIN=$TOOLTAG> $WORKSPACE/DuetPkg/SetEnv_$PROCESSOR.sh
|
|
|
|
chmod +x $WORKSPACE/DuetPkg/SetEnv_$PROCESSOR.sh
|
2010-03-18 03:36:52 +01:00
|
|
|
|
2009-03-02 13:12:46 +01:00
|
|
|
#
|
|
|
|
# Boot sector module could only be built under IA32 tool chain
|
|
|
|
#
|
2009-03-02 09:37:23 +01:00
|
|
|
|
|
|
|
echo Compressing DUETEFIMainFv.FV ...
|
2009-05-06 11:03:11 +02:00
|
|
|
$BASETOOLS_DIR/LzmaCompress -e -o $BUILD_DIR/FV/DUETEFIMAINFV.z $BUILD_DIR/FV/DUETEFIMAINFV.Fv
|
2009-03-02 09:37:23 +01:00
|
|
|
|
|
|
|
echo Compressing DxeMain.efi ...
|
2009-05-06 11:03:11 +02:00
|
|
|
$BASETOOLS_DIR/LzmaCompress -e -o $BUILD_DIR/FV/DxeMain.z $BUILD_DIR/$PROCESSOR/DxeCore.efi
|
2009-03-02 09:37:23 +01:00
|
|
|
|
|
|
|
echo Compressing DxeIpl.efi ...
|
2016-11-11 09:08:35 +01:00
|
|
|
$BASETOOLS_DIR/LzmaCompress -e -o $BUILD_DIR/FV/DxeIpl.z $BUILD_DIR/$PROCESSOR/DxeIpl.efi
|
2009-03-02 09:37:23 +01:00
|
|
|
|
|
|
|
echo Generate Loader Image ...
|
|
|
|
|
|
|
|
if [ $PROCESSOR = IA32 ]
|
|
|
|
then
|
2016-11-11 09:08:35 +01:00
|
|
|
$BASETOOLS_DIR/GenFw --rebase 0x10000 -o $BUILD_DIR/$PROCESSOR/EfiLoader.efi $BUILD_DIR/$PROCESSOR/EfiLoader.efi
|
|
|
|
$BASETOOLS_DIR/EfiLdrImage -o $BUILD_DIR/FV/Efildr32 $BUILD_DIR/$PROCESSOR/EfiLoader.efi $BUILD_DIR/FV/DxeIpl.z $BUILD_DIR/FV/DxeMain.z $BUILD_DIR/FV/DUETEFIMAINFV.z
|
|
|
|
cat $BOOTSECTOR_BIN_DIR/Start.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr
|
|
|
|
#
|
|
|
|
# It is safe to use "bcat" to cat following binary file, if bcat command is avaiable for your system
|
|
|
|
#
|
|
|
|
#bcat -o $BUILD_DIR/FV/Efildr.bcat $BOOTSECTOR_BIN_DIR/start.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
|
|
|
|
cat $BOOTSECTOR_BIN_DIR/Start16.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr16
|
|
|
|
#bcat -o $BUILD_DIR/FV/Efildr16.bcat $BOOTSECTOR_BIN_DIR/start16.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
|
|
|
|
cat $BOOTSECTOR_BIN_DIR/Start32.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr20
|
|
|
|
#bcat -o $BUILD_DIR/FV/Efildr20.bcat $BOOTSECTOR_BIN_DIR/start32.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
|
|
|
|
echo Done!
|
2009-03-02 09:37:23 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $PROCESSOR = X64 ]
|
|
|
|
then
|
2016-11-11 09:08:35 +01:00
|
|
|
$BASETOOLS_DIR/GenFw --rebase 0x10000 -o $BUILD_DIR/$PROCESSOR/EfiLoader.efi $BUILD_DIR/$PROCESSOR/EfiLoader.efi
|
|
|
|
$BASETOOLS_DIR/EfiLdrImage -o $BUILD_DIR/FV/Efildr64 $BUILD_DIR/$PROCESSOR/EfiLoader.efi $BUILD_DIR/FV/DxeIpl.z $BUILD_DIR/FV/DxeMain.z $BUILD_DIR/FV/DUETEFIMAINFV.z
|
|
|
|
cat $BOOTSECTOR_BIN_DIR/Start64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/EfildrPure
|
|
|
|
#bcat -o $BUILD_DIR/FV/EfildrPure $BOOTSECTOR_BIN_DIR/start64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
|
|
|
|
$BASETOOLS_DIR/GenPage $BUILD_DIR/FV/EfildrPure -o $BUILD_DIR/FV/Efildr
|
|
|
|
cat $BOOTSECTOR_BIN_DIR/St16_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr16Pure
|
|
|
|
#bcat -o $BUILD_DIR/FV/Efildr16Pure $BOOTSECTOR_BIN_DIR/st16_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
|
|
|
|
$BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr16Pure -o $BUILD_DIR/FV/Efildr16
|
|
|
|
cat $BOOTSECTOR_BIN_DIR/St32_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr20Pure
|
|
|
|
#bcat -o $BUILD_DIR/FV/Efildr20Pure $BOOTSECTOR_BIN_DIR/st32_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
|
|
|
|
$BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr20Pure -o $BUILD_DIR/FV/Efildr20
|
|
|
|
|
|
|
|
echo Done!
|
2009-03-02 09:37:23 +01:00
|
|
|
fi
|
|
|
|
|
2009-04-16 04:36:20 +02:00
|
|
|
|