0
0
mirror of https://github.com/edk2-porting/edk2-msm synced 2024-05-16 21:29:31 +00:00

build: Add the option to build flashable installer zip

Signed-off-by: Molly Sophia <mollysophia379@gmail.com>
This commit is contained in:
Molly Sophia 2023-02-13 22:41:08 +08:00
parent f8cbad0776
commit 136032e707
13 changed files with 42 additions and 48 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
boot-*.img
uefi-*.img
uefi-installer-*.zip
uefi-*.img-dtb
uefi-*.img.gz
uefi-*.img.gz-dtb

View File

@ -4,14 +4,6 @@ function platform_build_kernel(){
"${WORKSPACE}/Build/${DEVICE}/${_MODE}_${TOOLCHAIN}/FV/${SOC_PLATFORM}_UEFI.fd" \
> "${WORKSPACE}/Build/${DEVICE}/${_MODE}_${TOOLCHAIN}/FV/${SOC_PLATFORM}_UEFI.fd-bootshim" \
||return "$?"
if [ 1 = ${ENABLE_LINUX_UTILS} ]
then
cat \
"${WORKSPACE}/Build/${DEVICE}/${_MODE}_${TOOLCHAIN}/FV/${SOC_PLATFORM}_UEFI.fd-bootshim" \
"${ROOTDIR}/tools/BootShim/Padding.bin" \
> "${OUTDIR}/${DEVICE}_UEFI-Padding.fd" \
||return "$?"
fi
gzip -c \
< "${WORKSPACE}/Build/${DEVICE}/${_MODE}_${TOOLCHAIN}/FV/${SOC_PLATFORM}_UEFI.fd-bootshim" \
> "${WORKSPACE}/uefi-${DEVICE}.img.gz" \

View File

@ -13,13 +13,14 @@ function _help(){
echo " --toolchain TOOLCHAIN: Set toolchain, default is 'CLANG38'."
echo " --uart, -u: compile with UART support, print debug messages to uart debug port."
echo " --skip-rootfs-gen: skip generating SimpleInit rootfs to speed up building."
echo " --no-exception-disp: do not display exception information in DEBUG builds"
echo " --acpi, -A: compile DSDT using MS asl with wine"
echo " --no-exception-disp: do not display exception information in DEBUG builds."
echo " --acpi, -A: compile DSDT using MS asl with wine."
echo " --clean, -C: clean workspace and output."
echo " --distclean, -D: clean up all files that are not in repo."
echo " --outputdir, -O: output folder."
echo " --boot, -b: fastboot boot image."
echo " --fixclang, -f: fix build using Clang by suppressing -Os flag."
echo " --installer-zip, -z: generate flashable installer zip."
echo " --help, -h: show this help."
echo
echo "MainPage: https://github.com/edk2-porting/edk2-msm"
@ -66,6 +67,11 @@ function _build(){
# for overriding config
source "configs/devices/${DEVICE}.conf"
if "${GEN_INSTALLER_ZIP}"
then
export ENABLE_LINUX_UTILS=1
fi
_load_platform_hooks Platform/platform.sh.inc
_load_platform_hooks Silicon/platform.sh.inc
_load_platform_hooks "Silicon/${SOC_VENDOR}/platform.sh.inc"
@ -111,11 +117,8 @@ function _build(){
echo "Building BootShim"
pushd "${ROOTDIR}/tools/BootShim"
rm -f BootShim.bin BootShim.elf Padding.bin
rm -f BootShim.bin BootShim.elf BootShim.Dualboot.bin BootShim.Dualboot.elf
make UEFI_BASE=${FD_BASE} UEFI_SIZE=${FD_SIZE}
bootshimsize=$(stat -c %s "BootShim.bin")
# padding for 2M alignment for Linux kernel appended
head -c `expr 2097152 - $bootshimsize` /dev/zero > Padding.bin
popd
_call_hook platform_pre_build||return "$?"
@ -137,10 +140,23 @@ function _build(){
_call_hook platform_build_kernel||return "$?"
_call_hook platform_build_bootimg||return "$?"
echo "Build done: ${OUTDIR}/boot-${DEVICE}${EXT}.img"
if "${GEN_INSTALLER_ZIP}"
then
cp "${WORKSPACE}/Build/${DEVICE}/${_MODE}_${TOOLCHAIN}/FV/SM8150_UEFI.fd" "${ROOTDIR}/tools/Installer/${DEVICE}_UEFI.fd"
cp "${ROOTDIR}/tools/BootShim/BootShim.Dualboot.bin" "${ROOTDIR}/tools/Installer/BootShim.Dualboot.bin"
pushd "${ROOTDIR}/tools/Installer/"
./pack.sh
popd
mv "${ROOTDIR}/tools/Installer/installer.zip" "${OUTDIR}/uefi-installer-${DEVICE}${EXT}.zip"
rm -f "${ROOTDIR}/tools/Installer/${DEVICE}_UEFI.fd"
rm -f "${ROOTDIR}/tools/Installer/BootShim.Dualboot.bin"
echo "Pack done: ${OUTDIR}/uefi-installer-${DEVICE}${EXT}.zip"
fi
set +x
}
function _clean(){ rm --one-file-system --recursive --force "${WORKSPACE}"./workspace "${OUTDIR}"/boot-*.img "${OUTDIR}"/uefi-*.img*; }
function _clean(){ rm --one-file-system --recursive --force "${WORKSPACE}"./workspace "${OUTDIR}"/boot-*.img "${OUTDIR}"/uefi-installer-*.zip "${OUTDIR}"/uefi-*.img*; }
function _distclean(){ if [ -d .git ];then git clean -xdf;else _clean;fi; }
@ -156,15 +172,15 @@ CLEAN=false
DISTCLEAN=false
TOOLCHAIN=CLANG38
export FIX_CLANG=0
export ENABLE_LINUX_UTILS=0
SOC_VENDOR=Qualcomm
USE_UART=0
NO_EXCEPTION_DISPLAY=0
export ROOTDIR OUTDIR SOC_VENDOR
export GEN_ACPI=false
export GEN_ROOTFS=true
export GEN_INSTALLER_ZIP=false
export FASTBOOT=false
OPTS="$(getopt -o t:d:hfabcACDO:r:u -l toolchain:,device:,help,fixclang,all,boot,chinese,acpi,skip-rootfs-gen,no-exception-disp,uart,clean,distclean,outputdir:,release: -n 'build.sh' -- "$@")"||exit 1
OPTS="$(getopt -o t:d:hfabczACDO:r:u -l toolchain:,device:,help,fixclang,all,boot,chinese,acpi,skip-rootfs-gen,no-exception-disp,installer-zip,uart,clean,distclean,outputdir:,release: -n 'build.sh' -- "$@")"||exit 1
eval set -- "${OPTS}"
while true
do case "${1}" in
@ -182,6 +198,7 @@ do case "${1}" in
-t|--toolchain) TOOLCHAIN="${2}";shift 2;;
-u|--uart) USE_UART=1;shift;;
-f|--fixclang) FIX_CLANG=1;shift;;
-z|--installer-zip) GEN_INSTALLER_ZIP=true;ENABLE_LINUX_UTILS=1;shift;;
-h|--help) _help 0;shift;;
--) shift;break;;
*) _help 1;;
@ -199,7 +216,8 @@ then
git submodule set-url Common/edk2 https://hub.nuaa.cf/tianocore/edk2.git
git submodule set-url Common/edk2-platforms https://hub.nuaa.cf/tianocore/edk2-platforms.git
git submodule set-url Platform/EFI_Binaries https://hub.nuaa.cf/edk2-porting/edk2-sdm845-binary.git
git submodule set-url GPLDrivers/Library/SimpleInit https://hub.nuaa.cf/BigfootACA/simple-init.git
git submodule set-url GPLDrivers/Library/SimpleInit https://hub.nuaa.cf/BigfootACA/simple-init.git
git submodule set-url tools/Installer https://hub.nuaa.cf/MollySophia/Flashable_UEFI_Installer.git
git submodule init;git submodule update --depth 1
pushd Common/edk2
@ -228,6 +246,9 @@ then
pushd GPLDrivers/Library/SimpleInit
git submodule init;git submodule update
popd
pushd tools/Installer
git submodule init;git submodule update
popd
fi
set +e
fi

View File

@ -1,4 +1,2 @@
FD_BASE=0xCE000000
FD_SIZE=0x02000000
ENABLE_LINUX_UTILS=0
FD_SIZE=0x02000000

View File

@ -1,4 +1,2 @@
FD_BASE=0xCE000000
FD_SIZE=0x02000000
ENABLE_LINUX_UTILS=0
FD_SIZE=0x02000000

View File

@ -1,4 +1,2 @@
FD_BASE=0xCE000000
FD_SIZE=0x02000000
ENABLE_LINUX_UTILS=0
FD_SIZE=0x02000000

View File

@ -1,4 +1,2 @@
FD_BASE=0xCE000000
FD_SIZE=0x02000000
ENABLE_LINUX_UTILS=0
FD_SIZE=0x02000000

View File

@ -1,4 +1,2 @@
FD_BASE=0xCE000000
FD_SIZE=0x02000000
ENABLE_LINUX_UTILS=0
FD_SIZE=0x02000000

View File

@ -1,4 +1,2 @@
FD_BASE=0xCE000000
FD_SIZE=0x02000000
ENABLE_LINUX_UTILS=0
FD_SIZE=0x02000000

View File

@ -1,4 +1,2 @@
FD_BASE=0xCE000000
FD_SIZE=0x02000000
ENABLE_LINUX_UTILS=0
FD_SIZE=0x02000000

View File

@ -1,4 +1,2 @@
FD_BASE=0xCE000000
FD_SIZE=0x00700000
ENABLE_LINUX_UTILS=0
FD_SIZE=0x00700000

View File

@ -1,4 +1,2 @@
FD_BASE=0xCE000000
FD_SIZE=0x02000000
ENABLE_LINUX_UTILS=0
FD_SIZE=0x02000000

View File

@ -1,4 +1,2 @@
FD_BASE=0xCE000000
FD_SIZE=0x02000000
ENABLE_LINUX_UTILS=0
FD_SIZE=0x02000000