Use com as postfix as MSFT does.
[mirror_edk2.git] / DuetPkg / PostBuild.sh
CommitLineData
f89afddb 1#\r
2# Currently, Build system does not provide post build mechanism for module \r
3# and platform building, so just use a sh file to do post build commands.\r
4# Originally, following post building command is for EfiLoader module.\r
5#
6export BUILD_DIR=$WORKSPACE/Build/DuetPkg/DEBUG_UNIXGCC
7export BASETOOLS_DIR=$WORKSPACE/Conf/BaseToolsSource/Source/C/bin
8export PROCESSOR=""
9if [ \
10 -z "$1" -o \
11 "$1" = "-?" -o \
12 "$1" = "-h" -o \
13 "$1" = "--help" \
14 ]
15then
16 echo Error! Please specific the architecture.
17 echo Usage: ". PostBuild.sh [IA32|X64]"
18fi
19
20if [ "$1" = IA32 ]
21then
22 export PROCESSOR=IA32
23fi
24
25if [ "$1" = X64 ]
26then
27 export PROCESSOR=X64
28fi
29
30export OUTPUT_DIR=$BUILD_DIR/$PROCESSOR/DuetPkg/BootSector/BootSector/OUTPUT
31
32echo Compressing DUETEFIMainFv.FV ...
33$BASETOOLS_DIR/TianoCompress -e -o $BUILD_DIR/FV/DUETEFIMAINFV.z $BUILD_DIR/FV/DUETEFIMAINFV.Fv
34
35echo Compressing DxeMain.efi ...
36$BASETOOLS_DIR/TianoCompress -e -o $BUILD_DIR/FV/DxeMain.z $BUILD_DIR/$PROCESSOR/DxeCore.efi
37
38echo Compressing DxeIpl.efi ...
39$BASETOOLS_DIR/TianoCompress -e -o $BUILD_DIR/FV/DxeIpl.z $BUILD_DIR/$PROCESSOR/DxeIpl.efi
40
41echo Generate Loader Image ...
42
43if [ $PROCESSOR = IA32 ]
44then
45 $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
46 mkdir -p $BUILD_DIR/FV/Efildr
47 mkdir -p $BUILD_DIR/FV/Efildr16
48 mkdir -p $BUILD_DIR/FV/Efildr20
49
3ef254bb 50 cp $OUTPUT_DIR/start.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 $BUILD_DIR/FV/Efildr
51 cp $OUTPUT_DIR/start16.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 $BUILD_DIR/FV/Efildr16
52 cp $OUTPUT_DIR/start32.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 $BUILD_DIR/FV/Efildr20
f89afddb 53 echo Done!
54fi
55
56if [ $PROCESSOR = X64 ]
57then
58 $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
59 mkdir -p $BUILD_DIR/FV/EfildrPure
60 mkdir -p $BUILD_DIR/FV/Efildr16Pure
61 mkdir -p $BUILD_DIR/FV/Efildr20Pure
62
3ef254bb 63 cp $OUTPUT_DIR/start64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 $BUILD_DIR/FV/EfildrPure
f89afddb 64 $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/EfildrPure -o $BUILD_DIR/FV/Efildr
3ef254bb 65 cp $OUTPUT_DIR/st16_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 $BUILD_DIR/FV/Efildr16Pure
f89afddb 66 $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr16Pure -o $BUILD_DIR/FV/Efildr16
3ef254bb 67 cp $OUTPUT_DIR/st32_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 $BUILD_DIR/FV/Efildr20Pure
f89afddb 68 $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr20Pure -o $BUILD_DIR/FV/Efildr20
69
70 echo Done!
71fi
72