]>
Commit | Line | Data |
---|---|---|
1 | #!/bin/sh | |
2 | ||
3 | ## @file | |
4 | # | |
5 | # Post build script that will be automatically run after build. | |
6 | # | |
7 | # Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR> | |
8 | # | |
9 | # This program and the accompanying materials | |
10 | # are licensed and made available under the terms and conditions of the BSD License | |
11 | # which accompanies this distribution. The full text of the license may be found at | |
12 | # http://opensource.org/licenses/bsd-license.php | |
13 | # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, | |
14 | # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. | |
15 | # | |
16 | ## | |
17 | ||
18 | if [ -z "$EDK_TOOLS_PATH" ] | |
19 | then | |
20 | export BASETOOLS_DIR=$WORKSPACE/Conf/BaseToolsSource/Source/C/bin | |
21 | else | |
22 | export BASETOOLS_DIR=$EDK_TOOLS_PATH/Source/C/bin | |
23 | fi | |
24 | ||
25 | export BOOTSECTOR_BIN_DIR=$WORKSPACE/DuetPkg/BootSector/bin | |
26 | export PROCESSOR="" | |
27 | export TOOLTAG="" | |
28 | ||
29 | while [ $# -gt 0 ]; do | |
30 | if [ "$1" = "-a" ]; then | |
31 | export PROCESSOR=$2 | |
32 | elif [ "$1" = "-t" ]; then | |
33 | export TOOLTAG=$2 | |
34 | elif [ "$1" = "-h" ]; then | |
35 | echo Usage: This script will be run automatically after build. | |
36 | return 1 | |
37 | fi | |
38 | shift | |
39 | shift | |
40 | done | |
41 | ||
42 | if [ "$PROCESSOR" = "" -o "$TOOLTAG" = "" ]; then | |
43 | echo Usage: This script will be run automatically after build. | |
44 | return 1 | |
45 | fi | |
46 | ||
47 | export BUILD_DIR=$WORKSPACE/Build/DuetPkg$PROCESSOR/DEBUG_$TOOLTAG | |
48 | ||
49 | # | |
50 | # Store environment variables used by CreateBootDisk.sh | |
51 | # | |
52 | echo export TOOLCHAIN=$TOOLTAG> $WORKSPACE/DuetPkg/SetEnv_$PROCESSOR.sh | |
53 | chmod +x $WORKSPACE/DuetPkg/SetEnv_$PROCESSOR.sh | |
54 | ||
55 | # | |
56 | # Boot sector module could only be built under IA32 tool chain | |
57 | # | |
58 | ||
59 | echo Compressing DUETEFIMainFv.FV ... | |
60 | $BASETOOLS_DIR/LzmaCompress -e -o $BUILD_DIR/FV/DUETEFIMAINFV.z $BUILD_DIR/FV/DUETEFIMAINFV.Fv | |
61 | ||
62 | echo Compressing DxeMain.efi ... | |
63 | $BASETOOLS_DIR/LzmaCompress -e -o $BUILD_DIR/FV/DxeMain.z $BUILD_DIR/$PROCESSOR/DxeCore.efi | |
64 | ||
65 | echo Compressing DxeIpl.efi ... | |
66 | $BASETOOLS_DIR/LzmaCompress -e -o $BUILD_DIR/FV/DxeIpl.z $BUILD_DIR/$PROCESSOR/DxeIpl.efi | |
67 | ||
68 | echo Generate Loader Image ... | |
69 | ||
70 | if [ $PROCESSOR = IA32 ] | |
71 | then | |
72 | $BASETOOLS_DIR/GenFw --rebase 0x10000 -o $BUILD_DIR/$PROCESSOR/EfiLoader.efi $BUILD_DIR/$PROCESSOR/EfiLoader.efi | |
73 | $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 | |
74 | cat $BOOTSECTOR_BIN_DIR/Start.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr | |
75 | # | |
76 | # It is safe to use "bcat" to cat following binary file, if bcat command is avaiable for your system | |
77 | # | |
78 | #bcat -o $BUILD_DIR/FV/Efildr.bcat $BOOTSECTOR_BIN_DIR/start.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 | |
79 | cat $BOOTSECTOR_BIN_DIR/Start16.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr16 | |
80 | #bcat -o $BUILD_DIR/FV/Efildr16.bcat $BOOTSECTOR_BIN_DIR/start16.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 | |
81 | cat $BOOTSECTOR_BIN_DIR/Start32.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr20 | |
82 | #bcat -o $BUILD_DIR/FV/Efildr20.bcat $BOOTSECTOR_BIN_DIR/start32.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 | |
83 | echo Done! | |
84 | fi | |
85 | ||
86 | if [ $PROCESSOR = X64 ] | |
87 | then | |
88 | $BASETOOLS_DIR/GenFw --rebase 0x10000 -o $BUILD_DIR/$PROCESSOR/EfiLoader.efi $BUILD_DIR/$PROCESSOR/EfiLoader.efi | |
89 | $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 | |
90 | cat $BOOTSECTOR_BIN_DIR/Start64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/EfildrPure | |
91 | #bcat -o $BUILD_DIR/FV/EfildrPure $BOOTSECTOR_BIN_DIR/start64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 | |
92 | $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/EfildrPure -o $BUILD_DIR/FV/Efildr | |
93 | cat $BOOTSECTOR_BIN_DIR/St16_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr16Pure | |
94 | #bcat -o $BUILD_DIR/FV/Efildr16Pure $BOOTSECTOR_BIN_DIR/st16_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 | |
95 | $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr16Pure -o $BUILD_DIR/FV/Efildr16 | |
96 | cat $BOOTSECTOR_BIN_DIR/St32_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr20Pure | |
97 | #bcat -o $BUILD_DIR/FV/Efildr20Pure $BOOTSECTOR_BIN_DIR/st32_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 | |
98 | $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr20Pure -o $BUILD_DIR/FV/Efildr20 | |
99 | ||
100 | echo Done! | |
101 | fi | |
102 | ||
103 |