From f4fd64504fb58df3586f8484b8ddde9c8c3e8ea2 Mon Sep 17 00:00:00 2001 From: Matt Madison Date: Sun, 19 Jan 2025 06:10:55 -0800 Subject: [PATCH] tegra-helper-scripts: restore main files after RCM boot signing The odmsign functions do the same post-processing for RCM boot signing as they do for main signing, so be sure to save and restore the main files after the second call for signing the RCM boot blob. Signed-off-by: Matt Madison --- .../tegra-flash-helper.sh | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/recipes-bsp/tegra-binaries/tegra-helper-scripts/tegra-flash-helper.sh b/recipes-bsp/tegra-binaries/tegra-helper-scripts/tegra-flash-helper.sh index a31a45bf..89d0ec58 100644 --- a/recipes-bsp/tegra-binaries/tegra-helper-scripts/tegra-flash-helper.sh +++ b/recipes-bsp/tegra-binaries/tegra-helper-scripts/tegra-flash-helper.sh @@ -703,7 +703,16 @@ if [ $want_signing -eq 1 ]; then FBARGS="--cmd \"$tfcmd\"" . "$here/odmsign.func" (odmsign_ext_sign_and_flash) || exit 1 + if [ $bup_blob -eq 0 -a $no_flash -ne 0 ]; then + mv flashcmd.txt secureflash.sh || exit 1 + chmod +x secureflash.sh + fi if [ $also_sign_rcmboot -ne 0 ]; then + outfolder="$(odmsign_get_folder)" + rm -rf ${outfolder}_save + mv ${outfolder} ${outfolder}_save + rm -f secureflash.xml.save + mv secureflash.xml secureflash.xml.save BCTARGS="$bctargs $rcm_overlay_dtb_arg $custinfo_args --bct_backup" L4T_CONF_DTBO="$rcm_bootcontrol_overlay" BINSARGS="--bins \"$binsargs_params; kernel $RCMBOOT_KERNEL; kernel_dtb $kernel_dtbfile\"" @@ -717,20 +726,20 @@ if [ $want_signing -eq 1 ]; then --boot_chain A \ $bctargs $rcm_overlay_dtb_arg $custinfo_args $ramcodeargs $extdevargs $sparseargs $BINSARGS" (rcm_boot=1 odmsign_ext_sign_and_flash) || exit 1 + rm -f flashcmd.txt + rm -rf ${outfolder} + mv ${outfolder}_save ${outfolder} + cp -f ${outfolder}/* . + rm -f secureflash.xml + mv secureflash.xml.save secureflash.xml fi if [ $bup_blob -eq 0 -a $no_flash -ne 0 ]; then - if [ -f flashcmd.txt ]; then - chmod +x flashcmd.txt - ln -sf flashcmd.txt ./secureflash.sh - else - echo "WARN: signing completed successfully, but flashcmd.txt missing" >&2 - fi + cp secureflash.sh flashcmd.txt rm -f APPFILE APPFILE_b DATAFILE fi if [ $bup_blob -eq 0 ]; then exit 0 fi - touch odmsign.func flashcmd="python3 $flashappname ${inst_args} $FLASHARGS" else flashcmd="python3 $flashappname ${inst_args} --chip 0x23 --bl uefi_jetson_with_dtb.bin \