Skip to content

Commit 56d38e1

Browse files
tlaurionJonathonHall-Purism
authored andcommitted
Talos-2 fixes to comply with hashing file standard. Bypass flash-gui.sh prompt when talos-2 ato validate hashes against hashes provided under tgz through flash.sh validation (still offer zip and tgz, which tgz might change to zip later but only tgz offered through builds)
Attempt to address #1526 (comment) Signed-off-by: Thierry Laurion <insurgo@riseup.net>
1 parent 6ef5298 commit 56d38e1

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

boards/talos-2/talos-2.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,6 @@ $(board_build)/$(OUTPUT_PREFIX).tgz: \
6464
rm -rf $(board_build)/pkg # cleanup in case directory exists
6565
mkdir $(board_build)/pkg
6666
cp $^ $(board_build)/pkg
67-
cd $(board_build)/pkg && sha256sum * > hashes.txt
67+
cd $(board_build)/pkg && sha256sum * > sha256sum.txt
6868
cd $(board_build)/pkg && tar zcf $@ *
6969
rm -r $(board_build)/pkg

initrd/bin/flash-gui.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ while true; do
6363
--yesno "You will need to insert a USB drive containing your BIOS image (*.$UPDATE_PKG_EXT or\n*.$UPDATE_PLAIN_EXT).\n\nAfter you select this file, this program will reflash your BIOS.\n\nDo you want to proceed?" 0 80); then
6464
mount_usb
6565
if grep -q /media /proc/mounts; then
66-
find /media ! -path '*/\.*' -type f \( -name "*.$UPDATE_PLAIN_EXT" -o -type f -name "*.$UPDATE_PKG_EXT" \) | sort >/tmp/filelist.txt
66+
if [ "${CONFIG_BOARD%_*}" = talos-2 ]; then
67+
find /media ! -path '*/\.*' -type f -name "*.$UPDATE_PLAIN_EXT" | sort >/tmp/filelist.txt
68+
else
69+
find /media ! -path '*/\.*' -type f \( -name "*.$UPDATE_PLAIN_EXT" -o -type f -name "*.$UPDATE_PKG_EXT" \) | sort >/tmp/filelist.txt
70+
fi
6771
file_selector "/tmp/filelist.txt" "Choose the ROM to flash"
6872
if [ "$FILE" == "" ]; then
6973
exit 1
@@ -109,12 +113,19 @@ while true; do
109113
# Continue on using the verified ROM
110114
ROM="$PACKAGE_ROM"
111115
else
116+
# talos-2 uses a .tgz file for its "plain" update, contains other parts as well, validated against hashes under flash.sh
117+
# Skip prompt for hash validation for talos-2. Only method is through tgz or through bmc with individual parts
118+
if [ "${CONFIG_BOARD%_*}" != talos-2 ]; then
112119
# a rom file was provided. exit if we shall not proceed
113120
ROM="$PKG_FILE"
114121
ROM_HASH=$(sha256sum "$ROM" | awk '{print $1}') || die "Failed to hash ROM file"
115122
if ! (whiptail $CONFIG_ERROR_BG_COLOR --title 'Flash ROM without integrity check?' \
116123
--yesno "You have provided a *.$UPDATE_PLAIN_EXT file. The integrity of the file can not be\nchecked automatically for this file type.\n\nROM: $ROM\nSHA256SUM: $ROM_HASH\n\nIf you do not know how to check the file integrity yourself,\nyou should use a *.$UPDATE_PKG_EXT file instead.\n\nIf the file is damaged, you will not be able to boot anymore.\nDo you want to proceed flashing without file integrity check?" 0 80); then
117124
exit 1
125+
fi
126+
else
127+
#We are on talos-2, so we have a tgz file. We will pass it directly to flash.sh which will take care of it
128+
ROM="$PKG_FILE"
118129
fi
119130
fi
120131

initrd/bin/flash.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ if [ "$READ" -eq 0 ] && [ "${ROM##*.}" = tgz ]; then
180180
mkdir /tmp/verified_rom
181181

182182
tar -C /tmp/verified_rom -xf $ROM || die "Rom archive $ROM could not be extracted"
183-
if ! (cd /tmp/verified_rom/ && sha256sum -cs hashes.txt); then
183+
if ! (cd /tmp/verified_rom/ && sha256sum -cs sha256sum.txt); then
184184
die "Provided tgz image did not pass hash verification"
185185
fi
186186

0 commit comments

Comments
 (0)