blob: 69a4747ecbaad80da6f85fd2432ebe4d402b1560 [file] [log] [blame]
klu271bd6db2009-03-02 12:12:46 +00001#!/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.
gikidyf89afdd2009-03-02 08:37:23 +00007#
klu2fe9591c2009-03-16 04:59:21 +00008
gikidyf89afdd2009-03-02 08:37:23 +00009export BUILD_DIR=$WORKSPACE/Build/DuetPkg/DEBUG_UNIXGCC
klu2df6434f2009-09-17 02:16:30 +000010export BASETOOLS_DIR=$WORKSPACE/Conf/BaseToolsSource/Source/C/bin
klu2e88f3052009-06-22 03:01:53 +000011export BOOTSECTOR_BIN_DIR=$WORKSPACE/DuetPkg/BootSector/bin
gikidyf89afdd2009-03-02 08:37:23 +000012export PROCESSOR=""
13if [ \
14 -z "$1" -o \
15 "$1" = "-?" -o \
16 "$1" = "-h" -o \
17 "$1" = "--help" \
18 ]
19then
20 echo Error! Please specific the architecture.
klu271bd6db2009-03-02 12:12:46 +000021 echo Usage: "./PostBuild.sh [IA32|X64]"
gikidyf89afdd2009-03-02 08:37:23 +000022fi
23
klu271bd6db2009-03-02 12:12:46 +000024case "$1" in
25 IA32)
26 export PROCESSOR=IA32
27 ;;
28 X64)
29 export PROCESSOR=X64
30 ;;
31 *)
32 echo Invalid Architecture string, should be only IA32 or X64
klu2f8b30ae2009-04-16 02:36:20 +000033 return 1
klu271bd6db2009-03-02 12:12:46 +000034esac
gikidyf89afdd2009-03-02 08:37:23 +000035
klu271bd6db2009-03-02 12:12:46 +000036#
37# Boot sector module could only be built under IA32 tool chain
38#
gikidyf89afdd2009-03-02 08:37:23 +000039
40echo Compressing DUETEFIMainFv.FV ...
gikidy11d909a2009-05-06 09:03:11 +000041$BASETOOLS_DIR/LzmaCompress -e -o $BUILD_DIR/FV/DUETEFIMAINFV.z $BUILD_DIR/FV/DUETEFIMAINFV.Fv
gikidyf89afdd2009-03-02 08:37:23 +000042
43echo Compressing DxeMain.efi ...
gikidy11d909a2009-05-06 09:03:11 +000044$BASETOOLS_DIR/LzmaCompress -e -o $BUILD_DIR/FV/DxeMain.z $BUILD_DIR/$PROCESSOR/DxeCore.efi
gikidyf89afdd2009-03-02 08:37:23 +000045
46echo Compressing DxeIpl.efi ...
gikidy11d909a2009-05-06 09:03:11 +000047$BASETOOLS_DIR/LzmaCompress -e -o $BUILD_DIR/FV/DxeIpl.z $BUILD_DIR/$PROCESSOR/DxeIpl.efi
gikidyf89afdd2009-03-02 08:37:23 +000048
49echo Generate Loader Image ...
50
51if [ $PROCESSOR = IA32 ]
52then
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
klu2df6434f2009-09-17 02:16:30 +000054 cat $BOOTSECTOR_BIN_DIR/start.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr
klu2fe9591c2009-03-16 04:59:21 +000055 #
56 # It is safe to use "bcat" to cat following binary file, if bcat command is avaiable for your system
57 #
klu2df6434f2009-09-17 02:16:30 +000058 #bcat -o $BUILD_DIR/FV/Efildr.bcat $BOOTSECTOR_BIN_DIR/start.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
59 cat $BOOTSECTOR_BIN_DIR/start16.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr16
60 #bcat -o $BUILD_DIR/FV/Efildr16.bcat $BOOTSECTOR_BIN_DIR/start16.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
61 cat $BOOTSECTOR_BIN_DIR/start32.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32 > $BUILD_DIR/FV/Efildr20
62 #bcat -o $BUILD_DIR/FV/Efildr20.bcat $BOOTSECTOR_BIN_DIR/start32.com $BOOTSECTOR_BIN_DIR/efi32.com2 $BUILD_DIR/FV/Efildr32
gikidyf89afdd2009-03-02 08:37:23 +000063 echo Done!
64fi
65
66if [ $PROCESSOR = X64 ]
67then
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
klu29e8c32c2009-07-08 07:25:02 +000069 cat $BOOTSECTOR_BIN_DIR/Start64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/EfildrPure
klu2df6434f2009-09-17 02:16:30 +000070 #bcat -o $BUILD_DIR/FV/EfildrPure $BOOTSECTOR_BIN_DIR/start64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
gikidyf89afdd2009-03-02 08:37:23 +000071 $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/EfildrPure -o $BUILD_DIR/FV/Efildr
klu29e8c32c2009-07-08 07:25:02 +000072 cat $BOOTSECTOR_BIN_DIR/St16_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr16Pure
klu2e88f3052009-06-22 03:01:53 +000073 #bcat -o $BUILD_DIR/FV/Efildr16Pure $BOOTSECTOR_BIN_DIR/st16_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
gikidyf89afdd2009-03-02 08:37:23 +000074 $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr16Pure -o $BUILD_DIR/FV/Efildr16
klu29e8c32c2009-07-08 07:25:02 +000075 cat $BOOTSECTOR_BIN_DIR/St32_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64 > $BUILD_DIR/FV/Efildr20Pure
klu2e88f3052009-06-22 03:01:53 +000076 #bcat -o $BUILD_DIR/FV/Efildr20Pure $BOOTSECTOR_BIN_DIR/st32_64.com $BOOTSECTOR_BIN_DIR/efi64.com2 $BUILD_DIR/FV/Efildr64
gikidyf89afdd2009-03-02 08:37:23 +000077 $BASETOOLS_DIR/GenPage $BUILD_DIR/FV/Efildr20Pure -o $BUILD_DIR/FV/Efildr20
78
79 echo Done!
80fi
81
klu2f8b30ae2009-04-16 02:36:20 +000082