2009-03-02 13:12:46 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
#
|
|
|
|
# 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.
|
2009-03-02 09:37:23 +01:00
|
|
|
#
|
2009-03-16 05:59:21 +01:00
|
|
|
|
2009-03-02 09:37:23 +01:00
|
|
|
export BUILD_DIR=$WORKSPACE/Build/DuetPkg/DEBUG_UNIXGCC
|
|
|
|
export BASETOOLS_DIR=$WORKSPACE/Conf/BaseToolsSource/Source/C/bin
|
|
|
|
export PROCESSOR=""
|
|
|
|
if [ \
|
|
|
|
-z "$1" -o \
|
|
|
|
"$1" = "-?" -o \
|
|
|
|
"$1" = "-h" -o \
|
|
|
|
"$1" = "--help" \
|
|
|
|
]
|
|
|
|
then
|
|
|
|
echo Error! Please specific the architecture.
|
2009-03-02 13:12:46 +01:00
|
|
|
echo Usage: "./PostBuild.sh [IA32|X64]"
|
2009-03-02 09:37:23 +01:00
|
|
|
fi
|
|
|
|
|
2009-03-02 13:12:46 +01:00
|
|
|
case "$1" in
|
|
|
|
IA32)
|
|
|
|
export PROCESSOR=IA32
|
|
|
|
;;
|
|
|
|
X64)
|
|
|
|
export PROCESSOR=X64
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo Invalid Architecture string, should be only IA32 or X64
|
2009-04-16 04:36:20 +02:00
|
|
|
return 1
|
2009-03-02 13:12:46 +01:00
|
|
|
esac
|
2009-03-02 09:37:23 +01:00
|
|
|
|
2009-03-02 13:12:46 +01:00
|
|
|
#
|
|
|
|
# Boot sector module could only be built under IA32 tool chain
|
|
|
|
#
|
|
|
|
export OUTPUT_DIR=$BUILD_DIR/IA32/DuetPkg/BootSector/BootSector/OUTPUT
|
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 ...
|
2009-05-06 11:03:11 +02: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
|
|
|
|
$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
|
2009-03-02 13:12:46 +01:00
|
|
|
cat $OUTPUT_DIR/start.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr
|
2009-03-16 05:59:21 +01:00
|
|
|
#
|
|
|
|
# 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 $OUTPUT_DIR/start.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
|
2009-03-02 13:12:46 +01:00
|
|
|
cat $OUTPUT_DIR/start16.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr16
|
2009-03-16 05:59:21 +01:00
|
|
|
#bcat -o $BUILD_DIR/FV/Efildr16.bcat $OUTPUT_DIR/start16.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
|
2009-03-02 13:12:46 +01:00
|
|
|
cat $OUTPUT_DIR/start32.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr20
|
2009-03-16 05:59:21 +01:00
|
|
|
#bcat -o $BUILD_DIR/FV/Efildr20.bcat $OUTPUT_DIR/start32.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
|
2009-03-02 09:37:23 +01:00
|
|
|
echo Done!
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $PROCESSOR = X64 ]
|
|
|
|
then
|
|
|
|
$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
|
2009-03-02 13:12:46 +01:00
|
|
|
cat $OUTPUT_DIR/start64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/EfildrPure
|
2009-03-16 05:59:21 +01:00
|
|
|
#bcat -o $BUILD_DIR/FV/EfildrPure $OUTPUT_DIR/start64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
|
2009-03-02 09:37:23 +01:00
|
|
|
$BASETOOLS_DIR/GenPage $BUILD_DIR/FV/EfildrPure -o $BUILD_DIR/FV/Efildr
|
2009-03-02 13:12:46 +01:00
|
|
|
cat $OUTPUT_DIR/st16_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr16Pure
|
2009-03-16 05:59:21 +01:00
|
|
|
#bcat -o $BUILD_DIR/FV/Efildr16Pure $OUTPUT_DIR/st16_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
|
2009-03-02 09:37:23 +01:00
|
|
|
$BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr16Pure -o $BUILD_DIR/FV/Efildr16
|
2009-03-02 13:12:46 +01:00
|
|
|
cat $OUTPUT_DIR/st32_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr20Pure
|
2009-03-16 05:59:21 +01:00
|
|
|
#bcat -o $BUILD_DIR/FV/Efildr20Pure $OUTPUT_DIR/st32_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
|
2009-03-02 09:37:23 +01:00
|
|
|
$BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr20Pure -o $BUILD_DIR/FV/Efildr20
|
|
|
|
|
|
|
|
echo Done!
|
|
|
|
fi
|
|
|
|
|
2009-04-16 04:36:20 +02:00
|
|
|
|