rockchip: rv1126: fit: clean coding style

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: Ibfba9e70d3d5bcae8bd6850ab546edc736f56ba4
This commit is contained in:
Joseph Chen 2020-10-16 15:55:06 +08:00 committed by Jianhong Chen
parent a9c93f9d80
commit c45a6d11b5
1 changed files with 33 additions and 48 deletions

View File

@ -8,10 +8,16 @@
# Process args and auto set variables # Process args and auto set variables
source ./${srctree}/arch/arm/mach-rockchip/make_fit_args.sh source ./${srctree}/arch/arm/mach-rockchip/make_fit_args.sh
# compression rm -f ${srctree}/*.digest ${srctree}/*.bin.gz
rm -f ${srctree}/mcu.digest ${srctree}/u-boot-nodtb.digest ${srctree}/tee.digest
rm -f ${srctree}/u-boot-nodtb.bin.gz ${srctree}/tee.bin.gz ${srctree}/mcu.bin.gz
if [ "${COMPRESSION}" == "gzip" ]; then
SUFFIX=".gz"
else
COMPRESSION="none"
SUFFIX=
fi
# digest
if [ "${COMPRESSION}" == "gzip" ]; then if [ "${COMPRESSION}" == "gzip" ]; then
openssl dgst -sha256 -binary -out ${srctree}/u-boot-nodtb.digest ${srctree}/u-boot-nodtb.bin openssl dgst -sha256 -binary -out ${srctree}/u-boot-nodtb.digest ${srctree}/u-boot-nodtb.bin
openssl dgst -sha256 -binary -out ${srctree}/tee.digest ${srctree}/tee.bin openssl dgst -sha256 -binary -out ${srctree}/tee.digest ${srctree}/tee.bin
@ -27,35 +33,15 @@ if [ "${COMPRESSION}" == "gzip" ]; then
gzip -k -f -9 ${srctree}/mcu.bin gzip -k -f -9 ${srctree}/mcu.bin
fi fi
SUFFIX=".gz" UBOOT_DIGEST=" digest {
else
COMPRESSION="none"
SUFFIX=
fi
# u-boot and tee
UBOOT_BODY=" data = /incbin/(\"./u-boot-nodtb.bin${SUFFIX}\");
compression = \"${COMPRESSION}\";
load = <"${UBOOT_LOAD_ADDR}">;"
TEE_BODY=" data = /incbin/(\"./tee.bin${SUFFIX}\");
compression = \"${COMPRESSION}\";
load = <0x"${TEE_LOAD_ADDR}">;
entry = <0x"${TEE_LOAD_ADDR}">;"
# digest
if [ "${COMPRESSION}" != "none" ]; then
UBOOT_DIGEST=" digest {
value = /incbin/(\"./u-boot-nodtb.digest\"); value = /incbin/(\"./u-boot-nodtb.digest\");
algo = \"sha256\"; algo = \"sha256\";
};" };"
TEE_DIGEST=" digest {
TEE_DIGEST=" digest {
value = /incbin/(\"./tee.digest\"); value = /incbin/(\"./tee.digest\");
algo = \"sha256\"; algo = \"sha256\";
};" };"
MCU_DIGEST=" digest {
MCU_DIGEST=" digest {
value = /incbin/(\"./mcu.digest\"); value = /incbin/(\"./mcu.digest\");
algo = \"sha256\"; algo = \"sha256\";
};" };"
@ -63,7 +49,7 @@ fi
# mcu # mcu
if [ ! -z "${MCU_LOAD_ADDR}" ]; then if [ ! -z "${MCU_LOAD_ADDR}" ]; then
MCU_BODY=" mcu { MCU_NODE=" mcu {
description = \"mcu\"; description = \"mcu\";
type = \"standalone\"; type = \"standalone\";
arch = \"riscv\"; arch = \"riscv\";
@ -75,17 +61,11 @@ MCU_BODY=" mcu {
}; };
${MCU_DIGEST} ${MCU_DIGEST}
};" };"
MCU_STANDALONE=" standalone = \"mcu\";"
MCU_STANDALONE=" standalone = \"mcu\";" SIGN_IMAGES=" sign-images = \"fdt\", \"firmware\", \"loadables\", \"standalone\";"
fi
# /configurations/conf
if [ ! -z "${MCU_LOAD_ADDR}" ]; then
SIGN_IMAGES=" sign-images = \"fdt\", \"firmware\", \"loadables\", \"standalone\";"
else else
SIGN_IMAGES=" sign-images = \"fdt\", \"firmware\", \"loadables\";" SIGN_IMAGES=" sign-images = \"fdt\", \"firmware\", \"loadables\";"
fi fi
######################################################################################################## ########################################################################################################
cat << EOF cat << EOF
@ -103,30 +83,35 @@ cat << EOF
images { images {
uboot { uboot {
description = "U-Boot"; description = "U-Boot (32-bit)";
data = /incbin/("./u-boot-nodtb.bin${SUFFIX}");
type = "standalone"; type = "standalone";
os = "U-Boot";
arch = "arm"; arch = "arm";
EOF os = "U-Boot";
echo "${UBOOT_BODY}" compression = "${COMPRESSION}";
echo "${UBOOT_DIGEST}" load = <${UBOOT_LOAD_ADDR}>;
cat << EOF
hash { hash {
algo = "sha256"; algo = "sha256";
}; };
EOF
echo "${UBOOT_DIGEST}"
cat << EOF
}; };
optee { optee {
description = "OP-TEE"; description = "OP-TEE";
data = /incbin/("./tee.bin${SUFFIX}");
type = "firmware"; type = "firmware";
arch = "arm"; arch = "arm";
os = "op-tee"; os = "op-tee";
EOF compression = "${COMPRESSION}";
echo "${TEE_BODY}" load = <0x${TEE_LOAD_ADDR}>;
echo "${TEE_DIGEST}" entry = <0x${TEE_LOAD_ADDR}>;
cat << EOF
hash { hash {
algo = "sha256"; algo = "sha256";
}; };
EOF
echo "${TEE_DIGEST}"
cat << EOF
}; };
fdt { fdt {
description = "U-Boot dtb"; description = "U-Boot dtb";
@ -138,14 +123,14 @@ cat << EOF
}; };
}; };
EOF EOF
echo "${MCU_BODY}" echo "${MCU_NODE}"
cat << EOF cat << EOF
}; };
configurations { configurations {
default = "conf"; default = "conf";
conf { conf {
description = "RV1126 U-Boot FIT"; description = "Rockchip armv7 with OP-TEE";
rollback-index = <0x0>; rollback-index = <0x0>;
firmware = "optee"; firmware = "optee";
loadables = "uboot"; loadables = "uboot";