]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/PostBuild.sh
It is safe to use bcat command to cat binary files, if bcat is avaiable, so add bcat...
[mirror_edk2.git] / DuetPkg / PostBuild.sh
1 #!/bin/sh
2
3 #
4 # Currently, Build system does not provide post build mechanism for module
5 # and platform building, so just use a sh file to do post build commands.
6 # Originally, following post building command is for EfiLoader module.
7 #
8
9 export BUILD_DIR=$WORKSPACE/Build/DuetPkg/DEBUG_UNIXGCC
10 export BASETOOLS_DIR=$WORKSPACE/Conf/BaseToolsSource/Source/C/bin
11 export PROCESSOR=""
12 if [ \
13 -z "$1" -o \
14 "$1" = "-?" -o \
15 "$1" = "-h" -o \
16 "$1" = "--help" \
17 ]
18 then
19 echo Error! Please specific the architecture.
20 echo Usage: "./PostBuild.sh [IA32|X64]"
21 fi
22
23 case "$1" in
24 IA32)
25 export PROCESSOR=IA32
26 ;;
27 X64)
28 export PROCESSOR=X64
29 ;;
30 *)
31 echo Invalid Architecture string, should be only IA32 or X64
32 esac
33
34 #
35 # Boot sector module could only be built under IA32 tool chain
36 #
37 export OUTPUT_DIR=$BUILD_DIR/IA32/DuetPkg/BootSector/BootSector/OUTPUT
38
39 echo Compressing DUETEFIMainFv.FV ...
40 $BASETOOLS_DIR/TianoCompress -e -o $BUILD_DIR/FV/DUETEFIMAINFV.z $BUILD_DIR/FV/DUETEFIMAINFV.Fv
41
42 echo Compressing DxeMain.efi ...
43 $BASETOOLS_DIR/TianoCompress -e -o $BUILD_DIR/FV/DxeMain.z $BUILD_DIR/$PROCESSOR/DxeCore.efi
44
45 echo Compressing DxeIpl.efi ...
46 $BASETOOLS_DIR/TianoCompress -e -o $BUILD_DIR/FV/DxeIpl.z $BUILD_DIR/$PROCESSOR/DxeIpl.efi
47
48 echo Generate Loader Image ...
49
50 if [ $PROCESSOR = IA32 ]
51 then
52 $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
53 cat $OUTPUT_DIR/start.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr
54 #
55 # It is safe to use "bcat" to cat following binary file, if bcat command is avaiable for your system
56 #
57 #bcat -o $BUILD_DIR/FV/Efildr.bcat $OUTPUT_DIR/start.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
58 cat $OUTPUT_DIR/start16.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr16
59 #bcat -o $BUILD_DIR/FV/Efildr16.bcat $OUTPUT_DIR/start16.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
60 cat $OUTPUT_DIR/start32.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr20
61 #bcat -o $BUILD_DIR/FV/Efildr20.bcat $OUTPUT_DIR/start32.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
62 echo Done!
63 fi
64
65 if [ $PROCESSOR = X64 ]
66 then
67 $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
68 cat $OUTPUT_DIR/start64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/EfildrPure
69 #bcat -o $BUILD_DIR/FV/EfildrPure $OUTPUT_DIR/start64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
70 $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/EfildrPure -o $BUILD_DIR/FV/Efildr
71 cat $OUTPUT_DIR/st16_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr16Pure
72 #bcat -o $BUILD_DIR/FV/Efildr16Pure $OUTPUT_DIR/st16_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
73 $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr16Pure -o $BUILD_DIR/FV/Efildr16
74 cat $OUTPUT_DIR/st32_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr20Pure
75 #bcat -o $BUILD_DIR/FV/Efildr20Pure $OUTPUT_DIR/st32_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
76 $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr20Pure -o $BUILD_DIR/FV/Efildr20
77
78 echo Done!
79 fi
80