klu2 | 71bd6db | 2009-03-02 12:12:46 +0000 | [diff] [blame] | 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. |
gikidy | f89afdd | 2009-03-02 08:37:23 +0000 | [diff] [blame] | 7 | # |
klu2 | fe9591c | 2009-03-16 04:59:21 +0000 | [diff] [blame] | 8 | |
gikidy | f89afdd | 2009-03-02 08:37:23 +0000 | [diff] [blame] | 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. |
klu2 | 71bd6db | 2009-03-02 12:12:46 +0000 | [diff] [blame] | 20 | echo Usage: "./PostBuild.sh [IA32|X64]" |
gikidy | f89afdd | 2009-03-02 08:37:23 +0000 | [diff] [blame] | 21 | fi |
| 22 | |
klu2 | 71bd6db | 2009-03-02 12:12:46 +0000 | [diff] [blame] | 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 |
klu2 | f8b30ae | 2009-04-16 02:36:20 +0000 | [diff] [blame^] | 32 | return 1 |
klu2 | 71bd6db | 2009-03-02 12:12:46 +0000 | [diff] [blame] | 33 | esac |
gikidy | f89afdd | 2009-03-02 08:37:23 +0000 | [diff] [blame] | 34 | |
klu2 | 71bd6db | 2009-03-02 12:12:46 +0000 | [diff] [blame] | 35 | # |
| 36 | # Boot sector module could only be built under IA32 tool chain |
| 37 | # |
| 38 | export OUTPUT_DIR=$BUILD_DIR/IA32/DuetPkg/BootSector/BootSector/OUTPUT |
gikidy | f89afdd | 2009-03-02 08:37:23 +0000 | [diff] [blame] | 39 | |
| 40 | echo Compressing DUETEFIMainFv.FV ... |
| 41 | $BASETOOLS_DIR/TianoCompress -e -o $BUILD_DIR/FV/DUETEFIMAINFV.z $BUILD_DIR/FV/DUETEFIMAINFV.Fv |
| 42 | |
| 43 | echo Compressing DxeMain.efi ... |
| 44 | $BASETOOLS_DIR/TianoCompress -e -o $BUILD_DIR/FV/DxeMain.z $BUILD_DIR/$PROCESSOR/DxeCore.efi |
| 45 | |
| 46 | echo Compressing DxeIpl.efi ... |
| 47 | $BASETOOLS_DIR/TianoCompress -e -o $BUILD_DIR/FV/DxeIpl.z $BUILD_DIR/$PROCESSOR/DxeIpl.efi |
| 48 | |
| 49 | echo Generate Loader Image ... |
| 50 | |
| 51 | if [ $PROCESSOR = IA32 ] |
| 52 | then |
| 53 | $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 |
klu2 | 71bd6db | 2009-03-02 12:12:46 +0000 | [diff] [blame] | 54 | cat $OUTPUT_DIR/start.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr |
klu2 | fe9591c | 2009-03-16 04:59:21 +0000 | [diff] [blame] | 55 | # |
| 56 | # It is safe to use "bcat" to cat following binary file, if bcat command is avaiable for your system |
| 57 | # |
| 58 | #bcat -o $BUILD_DIR/FV/Efildr.bcat $OUTPUT_DIR/start.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 |
klu2 | 71bd6db | 2009-03-02 12:12:46 +0000 | [diff] [blame] | 59 | cat $OUTPUT_DIR/start16.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr16 |
klu2 | fe9591c | 2009-03-16 04:59:21 +0000 | [diff] [blame] | 60 | #bcat -o $BUILD_DIR/FV/Efildr16.bcat $OUTPUT_DIR/start16.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 |
klu2 | 71bd6db | 2009-03-02 12:12:46 +0000 | [diff] [blame] | 61 | cat $OUTPUT_DIR/start32.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr20 |
klu2 | fe9591c | 2009-03-16 04:59:21 +0000 | [diff] [blame] | 62 | #bcat -o $BUILD_DIR/FV/Efildr20.bcat $OUTPUT_DIR/start32.com $OUTPUT_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 |
gikidy | f89afdd | 2009-03-02 08:37:23 +0000 | [diff] [blame] | 63 | echo Done! |
| 64 | fi |
| 65 | |
| 66 | if [ $PROCESSOR = X64 ] |
| 67 | then |
| 68 | $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 |
klu2 | 71bd6db | 2009-03-02 12:12:46 +0000 | [diff] [blame] | 69 | cat $OUTPUT_DIR/start64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/EfildrPure |
klu2 | fe9591c | 2009-03-16 04:59:21 +0000 | [diff] [blame] | 70 | #bcat -o $BUILD_DIR/FV/EfildrPure $OUTPUT_DIR/start64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 |
gikidy | f89afdd | 2009-03-02 08:37:23 +0000 | [diff] [blame] | 71 | $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/EfildrPure -o $BUILD_DIR/FV/Efildr |
klu2 | 71bd6db | 2009-03-02 12:12:46 +0000 | [diff] [blame] | 72 | cat $OUTPUT_DIR/st16_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr16Pure |
klu2 | fe9591c | 2009-03-16 04:59:21 +0000 | [diff] [blame] | 73 | #bcat -o $BUILD_DIR/FV/Efildr16Pure $OUTPUT_DIR/st16_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 |
gikidy | f89afdd | 2009-03-02 08:37:23 +0000 | [diff] [blame] | 74 | $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr16Pure -o $BUILD_DIR/FV/Efildr16 |
klu2 | 71bd6db | 2009-03-02 12:12:46 +0000 | [diff] [blame] | 75 | cat $OUTPUT_DIR/st32_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr20Pure |
klu2 | fe9591c | 2009-03-16 04:59:21 +0000 | [diff] [blame] | 76 | #bcat -o $BUILD_DIR/FV/Efildr20Pure $OUTPUT_DIR/st32_64.com $OUTPUT_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 |
gikidy | f89afdd | 2009-03-02 08:37:23 +0000 | [diff] [blame] | 77 | $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr20Pure -o $BUILD_DIR/FV/Efildr20 |
| 78 | |
| 79 | echo Done! |
| 80 | fi |
| 81 | |
klu2 | f8b30ae | 2009-04-16 02:36:20 +0000 | [diff] [blame^] | 82 | |