-
Notifications
You must be signed in to change notification settings - Fork 225
/
0010-Rework-logging-in-l4t_sign_image.sh.patch
71 lines (65 loc) · 2.99 KB
/
0010-Rework-logging-in-l4t_sign_image.sh.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From 6d609566d40d203425d68d79d0105323e20e3d98 Mon Sep 17 00:00:00 2001
From: Ilies CHERGUI <ichergui@nvidia.com>
Date: Wed, 28 Feb 2024 19:55:34 +0000
Subject: [PATCH] Rework logging in l4t_sign_image.sh
to be more compatible with the pseudo environment during
builds, which wasn't happy about the output redirection
cloning that the script was using.
Signed-off-by: Matt Madison <matt@madison.systems>
---
l4t_sign_image.sh | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
diff --git a/l4t_sign_image.sh b/l4t_sign_image.sh
index a684289..1ddbe4c 100755
--- a/l4t_sign_image.sh
+++ b/l4t_sign_image.sh
@@ -112,8 +112,8 @@ function write_size_to_sig
fi
local tempfile
tempfile=$(mktemp)
- echo "${SCRIPT_NAME}: chip ${chip}: add $(printf "0x%x" "${size}") to offset "\
- "$(printf "0x%x" "${offset}") in sig file" >&5
+ [ $quiet -eq 1 ] || echo "${SCRIPT_NAME}: chip ${chip}: add $(printf "0x%x" "${size}") to offset "\
+ "$(printf "0x%x" "${offset}") in sig file"
# Convert size to bytes in little endian
python3 -c "f = open(\"${tempfile}\",'wb'); f.write(int(${size}).to_bytes(8,'little')); f.close()"
# write to header at position 0x8
@@ -138,8 +138,9 @@ function set_params_using_chipid
function sign_file
{
local sig_file="${1}"
- echo "${CMD} --chip ${chip} ${options[*]} --cmd sign ${sig_file} ${ftype}" >&5
- output="$("${CMD}" --chip "${chip}" "${options[@]}" --cmd "sign \"${sig_file}\" \"${ftype}\"" | tee >(cat - >&5))"
+ [ $quiet -eq 1 ] || echo "${CMD} --chip ${chip} ${options[*]} --cmd sign ${sig_file} ${ftype}"
+ output="$("${CMD}" --chip "${chip}" "${options[@]}" --cmd "sign \"${sig_file}\" \"${ftype}\"")"
+ [ $quiet -eq 1 ] || echo $output
if [ -n "${encryptkey}" ]; then
signedfile="$(echo "${output}" | grep "Signed and encrypted file:" | \
sed -n "s/.*Signed and encrypted file: //p")"
@@ -150,10 +151,10 @@ function sign_file
echo "${SCRIPT_NAME}: Error: Unable to find the signed file generated by tegraflash.py" >&2
exit 6;
fi
- echo "${SCRIPT_NAME}: Generate header for $(basename "${signedfile}")" >&5
+ [ $quiet -eq 1 ] || echo "${SCRIPT_NAME}: Generate header for $(basename "${signedfile}")"
dd if="${signedfile}" of="${sig_file}.sig" bs="${offset}" count=1 > /dev/null 2>&1;
write_size_to_sig "${sig_file}.sig" "${file_size}"
- echo "${SCRIPT_NAME}: Generate 16-byte-size-aligned base file for $(basename "${signedfile}")" >&5
+ [ $quiet -eq 1 ] || echo "${SCRIPT_NAME}: Generate 16-byte-size-aligned base file for $(basename "${signedfile}")"
dd if="${signedfile}" of="${sig_file}" bs="${offset}" skip="1" > /dev/null 2>&1;
if [[ "${signedfile}" = *_sigheader.encrypt.signed ]]; then
filename=$(basename -- "$file")
@@ -310,13 +311,6 @@ elif [ "${enable_user_kdk}" != "False" ]; then
exit 1
fi
-# Create a new file descriptor to duplicate the output to both a variable and
-# stdout
-if [ ${quiet} -eq 1 ]; then
- exec 5>/dev/null
-else
- exec 5>&1
-fi
set_params_using_chipid
CMD="${L4T_BOOTLOADER_DIR}/tegraflash.py"
--
2.34.1