Update SmmBase Communicate Thunk behaivor to be compatible with Framework implemenation.
[mirror_edk2.git] / DuetPkg / PostBuild.sh
CommitLineData
71bd6db1 1#!/bin/sh
e4c0074b 2\r
3## @file\r
4#\r
5# Currently, Build system does not provide post build mechanism for module \r
6# and platform building, so just use a sh file to do post build commands.\r
7# Originally, following post building command is for EfiLoader module.\r
8#\r
c4ae2792 9# Copyright (c) 2010 Intel Corporation. All rights reserved.<BR>\r
e4c0074b 10#\r
11# This program and the accompanying materials\r
12# are licensed and made available under the terms and conditions of the BSD License\r
13# which accompanies this distribution. The full text of the license may be found at\r
14# http://opensource.org/licenses/bsd-license.php\r
15# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
16# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
17#\r
18##\r
19
71bd6db1 20
fe9591c5 21
f89afddb 22export BUILD_DIR=$WORKSPACE/Build/DuetPkg/DEBUG_UNIXGCC
df6434f2 23export BASETOOLS_DIR=$WORKSPACE/Conf/BaseToolsSource/Source/C/bin
e88f3056 24export BOOTSECTOR_BIN_DIR=$WORKSPACE/DuetPkg/BootSector/bin
f89afddb 25export PROCESSOR=""
26if [ \
27 -z "$1" -o \
28 "$1" = "-?" -o \
29 "$1" = "-h" -o \
30 "$1" = "--help" \
31 ]
32then
33 echo Error! Please specific the architecture.
71bd6db1 34 echo Usage: "./PostBuild.sh [IA32|X64]"
f89afddb 35fi
36
71bd6db1 37case "$1" in
38 IA32)
39 export PROCESSOR=IA32
40 ;;
41 X64)
42 export PROCESSOR=X64
43 ;;
44 *)
45 echo Invalid Architecture string, should be only IA32 or X64
f8b30ae5 46 return 1
71bd6db1 47esac
f89afddb 48
71bd6db1 49#
50# Boot sector module could only be built under IA32 tool chain
51#
f89afddb 52
53echo Compressing DUETEFIMainFv.FV ...
11d909a4 54$BASETOOLS_DIR/LzmaCompress -e -o $BUILD_DIR/FV/DUETEFIMAINFV.z $BUILD_DIR/FV/DUETEFIMAINFV.Fv
f89afddb 55
56echo Compressing DxeMain.efi ...
11d909a4 57$BASETOOLS_DIR/LzmaCompress -e -o $BUILD_DIR/FV/DxeMain.z $BUILD_DIR/$PROCESSOR/DxeCore.efi
f89afddb 58
59echo Compressing DxeIpl.efi ...
11d909a4 60$BASETOOLS_DIR/LzmaCompress -e -o $BUILD_DIR/FV/DxeIpl.z $BUILD_DIR/$PROCESSOR/DxeIpl.efi
f89afddb 61
62echo Generate Loader Image ...
63
64if [ $PROCESSOR = IA32 ]
65then
66 $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
df6434f2 67 cat $BOOTSECTOR_BIN_DIR/start.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr
fe9591c5 68 #
69 # It is safe to use "bcat" to cat following binary file, if bcat command is avaiable for your system
70 #
df6434f2 71 #bcat -o $BUILD_DIR/FV/Efildr.bcat $BOOTSECTOR_BIN_DIR/start.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
72 cat $BOOTSECTOR_BIN_DIR/start16.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr16
73 #bcat -o $BUILD_DIR/FV/Efildr16.bcat $BOOTSECTOR_BIN_DIR/start16.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
74 cat $BOOTSECTOR_BIN_DIR/start32.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr20
75 #bcat -o $BUILD_DIR/FV/Efildr20.bcat $BOOTSECTOR_BIN_DIR/start32.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
f89afddb 76 echo Done!
77fi
78
79if [ $PROCESSOR = X64 ]
80then
81 $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
9e8c32c6 82 cat $BOOTSECTOR_BIN_DIR/Start64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/EfildrPure
df6434f2 83 #bcat -o $BUILD_DIR/FV/EfildrPure $BOOTSECTOR_BIN_DIR/start64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
f89afddb 84 $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/EfildrPure -o $BUILD_DIR/FV/Efildr
9e8c32c6 85 cat $BOOTSECTOR_BIN_DIR/St16_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr16Pure
e88f3056 86 #bcat -o $BUILD_DIR/FV/Efildr16Pure $BOOTSECTOR_BIN_DIR/st16_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
f89afddb 87 $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr16Pure -o $BUILD_DIR/FV/Efildr16
9e8c32c6 88 cat $BOOTSECTOR_BIN_DIR/St32_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr20Pure
e88f3056 89 #bcat -o $BUILD_DIR/FV/Efildr20Pure $BOOTSECTOR_BIN_DIR/st32_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
f89afddb 90 $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr20Pure -o $BUILD_DIR/FV/Efildr20
91
92 echo Done!
93fi
94
f8b30ae5 95