Skip to content

Commit 220f636

Browse files
committed
meta-dts-distro/recipes-dts/dts: Address review discussions
Signed-off-by: Michał Żygowski <[email protected]>
1 parent b9fd39b commit 220f636

File tree

2 files changed

+32
-14
lines changed

2 files changed

+32
-14
lines changed

meta-dts-distro/recipes-dts/dts/dasharo-deploy/dasharo-deploy

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,20 @@ backup() {
199199
romhole_migration() {
200200
cbfstool $BIOS_UPDATE_FILE layout -w | grep -q "ROMHOLE" || return
201201

202-
echo "Beginning ROM hole migration process..."
203202
flashrom -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} -r /tmp/rom.bin --ifd -i bios >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE
204-
error_check "Failed to read current firmware"
203+
error_check "Failed to read current firmware ti migrate MSI ROMHOLE"
205204
if check_if_dasharo; then
206205
cbfstool /tmp/rom.bin layout -w | grep -q "ROMHOLE" || return
207-
cbfstool /tmp/rom.bin read -r ROMHOLE -f /tmp/romhole.bin || return
206+
# This one is rather unlikely to fail, but just in case print a warning
207+
cbfstool /tmp/rom.bin read -r ROMHOLE -f /tmp/romhole.bin 2> /dev/null
208+
if [ $? -ne 0 ]; then
209+
print_warning "Failed to migrate MSI ROMHOLE, your platform's unique SMBIOS/DMI data may be lost"
210+
return
211+
else
208212
else
209-
dd if=/tmp/rom.bin of=/tmp/romhole.bin skip=$((0x17C0000)) bs=128K count=1 iflag=skip_bytes
213+
dd if=/tmp/rom.bin of=/tmp/romhole.bin skip=$((0x17C0000)) bs=128K count=1 iflag=skip_bytes > /dev/null 2>&1
210214
fi
211215

212-
echo "Migrate to ROMHOLE section."
213216
cbfstool "$BIOS_UPDATE_FILE" write -r ROMHOLE -f /tmp/romhole.bin -u 2> /dev/null
214217
}
215218

@@ -283,8 +286,7 @@ check_vboot_keys() {
283286
# No FMAP flashing? Also skip
284287
grep -q "\-\-fmap" <<< "$FLASHROM_ADD_OPT_UPDATE" || return
285288

286-
CBFSTOOL=$(which cbfstool)
287-
BINARY_KEYS=$(futility show $BIOS_UPDATE_FILE| grep -i 'key sha1sum')
289+
BINARY_KEYS=$(CBFSTOOL=$(which cbfstool) futility show $BIOS_UPDATE_FILE| grep -i 'key sha1sum')
288290

289291
if [ $BOARD_HAS_FD_REGION -eq 0 ]; then
290292
FLASHROM_ADD_OPT_READ=""
@@ -294,7 +296,7 @@ check_vboot_keys() {
294296
echo "Checking vboot keys."
295297
flashrom -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_READ} -r /tmp/bios.bin > /dev/null 2>/dev/null
296298
if [ $? -eq 0 ] && [ -f "/tmp/bios.bin" ]; then
297-
FLASH_KEYS=$(futility show /tmp/bios.bin | grep -i 'key sha1sum')
299+
FLASH_KEYS=$(CBFSTOOL=$(which cbfstool) futility show /tmp/bios.bin | grep -i 'key sha1sum')
298300
diff <(echo "$BINARY_KEYS") <(echo "$FLASH_KEYS") > /dev/null 2>&1
299301
# If keys are different we must additionally flash at least GBB region as well
300302
if [ $? -ne 0 ]; then
@@ -410,7 +412,7 @@ install() {
410412
fi
411413

412414
echo "Installing Dasharo firmware..."
413-
flashrom -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_INTEL_REGIONS} -w "$BIOS_UPDATE_FILE" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE
415+
flashrom -p "$PROGRAMMER_BIOS" ${FLASH_CHIP_SELECT} ${FLASHROM_ADD_OPT_REGIONS} -w "$BIOS_UPDATE_FILE" >> $FLASHROM_LOG_FILE 2>> $ERR_LOG_FILE
414416
error_check "Failed to install Dasharo firmware"
415417

416418
print_green "Successfully installed Dasharo firmware"

meta-dts-distro/recipes-dts/dts/dts/dts-functions.sh

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ board_config() {
180180
PROGRAMMER_EC="ite_ec"
181181
if check_if_dasharo; then
182182
# if v1.5.1 or older, flash the whole bios region
183+
# TODO: Let DTS determine which parameters are suitable.
184+
# FIXME: Can we ever get rid of that? We change so much in each release,
185+
# that we almost always need to flash whole BIOS regions
186+
# because of non-backward compatbile or breaking changes.
183187
compare_versions $DASHARO_VERSION 1.5.2
184188
if [ $? -eq 1 ]; then
185189
# For Dasharo version lesser than 1.5.2
@@ -208,7 +212,11 @@ board_config() {
208212
PROGRAMMER_BIOS="internal"
209213
PROGRAMMER_EC="ite_ec"
210214
if check_if_dasharo; then
211-
# if v1.5.0 or older, flash the whole bios region
215+
# if v1.5.1 or older, flash the whole bios region
216+
# TODO: Let DTS determine which parameters are suitable.
217+
# FIXME: Can we ever get rid of that? We change so much in each release,
218+
# that we almost always need to flash whole BIOS regions
219+
# because of non-backward compatbile or breaking changes.
212220
compare_versions $DASHARO_VERSION 1.5.1
213221
if [ $? -eq 1 ]; then
214222
# For Dasharo version lesser than 1.5.1
@@ -237,6 +245,10 @@ board_config() {
237245
PROGRAMMER_EC="ite_ec"
238246
if check_if_dasharo; then
239247
# if v1.7.2 or older, flash the whole bios region
248+
# TODO: Let DTS determine which parameters are suitable.
249+
# FIXME: Can we ever get rid of that? We change so much in each release,
250+
# that we almost always need to flash whole BIOS regions
251+
# because of non-backward compatbile or breaking changes.
240252
compare_versions $DASHARO_VERSION 1.7.2
241253
if [ $? -eq 1 ]; then
242254
# For Dasharo version lesser than 1.7.2
@@ -266,6 +278,10 @@ board_config() {
266278
PROGRAMMER_EC="ite_ec"
267279
if check_if_dasharo; then
268280
# if v1.7.2 or older, flash the whole bios region
281+
# TODO: Let DTS determine which parameters are suitable.
282+
# FIXME: Can we ever get rid of that? We change so much in each release,
283+
# that we almost always need to flash whole BIOS regions
284+
# because of non-backward compatbile or breaking changes.
269285
compare_versions $DASHARO_VERSION 1.7.2
270286
if [ $? -eq 1 ]; then
271287
# For Dasharo version lesser than 1.7.2
@@ -775,7 +791,7 @@ check_if_me_disabled() {
775791
echo "ME disabled by Security Override MEI Message/HMRFPO" >> $ERR_LOG_FILE
776792
ME_DISABLED=1
777793
return
778-
elif [ $ME_OPMODE == "5" ]; then
794+
elif [ $ME_OPMODE == "6" ]; then
779795
echo "ME disabled by Security Override MEI Message/HMRFPO" >> $ERR_LOG_FILE
780796
ME_DISABLED=1
781797
return
@@ -808,12 +824,12 @@ force_me_update() {
808824
print_warning "You have been warned."
809825
while : ; do
810826
echo
811-
read -r -p "Force the flashing without updating ME? (Y|n) " OPTION
827+
read -r -p "Skip ME flashing and proceed with BIOS/firmware flashing/udpating? (Y|n) " OPTION
812828
echo
813829

814830
case ${OPTION} in
815831
yes|y|Y|Yes|YES)
816-
print_warning "Proceeding without ME flashing, because we were forced to."
832+
print_warning "Proceeding without ME flashing, because we were asked to."
817833
break
818834
;;
819835
n|N)
@@ -887,7 +903,7 @@ set_intel_regions_update_params() {
887903
if [ $ME_DISABLED -eq 1 ]; then
888904
FLASHROM_ADD_OPT_REGIONS+=" -i me"
889905
else
890-
echo "The firmware binary to be flashed contains Management Engine (ME), but ME is not disabled!" >> $ERR_LOG_FILE
906+
echo "The firmware binary to be flashed contains Management Engine (ME), but ME is not disabled!" >> $ERR_LOG_FILE
891907
print_error "The firmware binary contains Management Engine (ME), but ME is not disabled!"
892908
force_me_update
893909
fi

0 commit comments

Comments
 (0)