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