From a1be4e44674b1366622d9f773ebce315676404ea Mon Sep 17 00:00:00 2001 From: Jonathon Hall Date: Fri, 23 Jun 2023 12:21:49 -0400 Subject: [PATCH 1/2] modules/flashrom: Update to 1776bb46 Update flashrom - in particular, this includes support for new chipsets like Jasper Lake. CONFIG_INTERAL_X86 was created so CONFIG_INTERNAL could apply to other platforms, enable it for x86. The default build target now requires sphinx, just build flashrom itself. Update flashrom_progress - filter out noise in newer flashrom that chokes the progress bar implementation, make size detection more robust, improve progress bar implementation slightly. Signed-off-by: Jonathon Hall Co-signed by: Thierry Laurion /dev/null ; then status="writing" + IN= fi fi if [ "$status" == "writing" ]; then - echo -ne "Flashing: [${progressbar}${spin:$spin_idx:1}${progressbar2}] (${percent}%)\\r" - if echo "$IN" | grep "Verifying" > /dev/null ; then + # walk_eraseblocks() prints info for each block, of the form + # , 0xAAAAAA-0xBBBBBB:X + # The 'X' is a char indicating the action, but the debug from actually erasing + # and writing is mixed into the output so it may be separated. It can also be + # interrupted occasionally, so only match a complete token. + current=$(echo "$IN" | sed -nE 's/^0x[0-9a-f]+-(0x[0-9a-f]+):.*$/\1/p') + if [ "$current" != "" ]; then + percent=$((100 * (current + 1) / total_bytes)) + fi + print_flashing_progress "$percent" + if [ "$IN" == "done." ]; then status="verifying" + IN= + print_flashing_progress 100 echo "" echo "Verifying flash contents. Please wait..." fi - if echo "$IN" | grep "identical" > /dev/null ; then + # This appears before "Erase/write done."; skip the verifying state + if [ "$IN" == "identical" ]; then status="done" + IN= + print_flashing_progress 100 echo "" echo "The flash contents are identical to the image being flashed." break @@ -142,7 +148,8 @@ flash_rom() { fi flashrom $CONFIG_FLASHROM_OPTIONS -w /tmp/${CONFIG_BOARD}.rom \ - -V -o "/tmp/flashrom-$(date '+%Y%m%d-%H%M%S').log" 2>&1 | flashrom_progress \ + -V -o "/tmp/flashrom-$(date '+%Y%m%d-%H%M%S').log" 2>&1 | \ + flashrom_progress "$(stat -c %s "/tmp/${CONFIG_BOARD}.rom")" \ || die "$ROM: Flash failed" fi } diff --git a/modules/flashrom b/modules/flashrom index 05a3ca7da..17508298b 100644 --- a/modules/flashrom +++ b/modules/flashrom @@ -2,17 +2,18 @@ modules-$(CONFIG_FLASHROM) += flashrom flashrom_depends := pciutils $(musl_dep) -flashrom_version := b1f858f65b2abd276542650d8cb9e382da258967 +flashrom_version := 1776bb46ba6ea3d1ab2ec3f0cd88158aabed7400 flashrom_dir := flashrom-$(flashrom_version) flashrom_tar := $(flashrom_dir).tar.gz flashrom_url := https://github.com/flashrom/flashrom/archive/$(flashrom_version).tar.gz -flashrom_hash := 4873ad50f500629c244fc3fbee64b56403a82307d7f555dfa235336a200c336c +flashrom_hash := 65e262ca4428a0ceddd73f481ed0d8444393b73a78469f266a4457dfc834ecb7 # Default options for flashrom flashrom_cfg := \ WARNERROR=no \ CONFIG_NOTHING=yes \ CONFIG_INTERNAL=yes \ + CONFIG_INTERNAL_X86=yes CONFIG_DUMMY=yes \ CONFIG_AST1100=yes \ @@ -28,7 +29,8 @@ endif flashrom_target := \ $(MAKE_JOBS) \ $(CROSS_TOOLS) \ - $(flashrom_cfg) + $(flashrom_cfg) \ + flashrom flashrom_output := \ flashrom From 979c9dd3187e25df9777be5cf4dd8f258eaa91b1 Mon Sep 17 00:00:00 2001 From: Thierry Laurion Date: Mon, 26 Jun 2023 09:29:13 -0400 Subject: [PATCH 2/2] flashrom: remove DUMMY and AST1100 by default on both x86/ppc64, leave MTD only for ppc64, have AST1100 enablement configurable for kgpe-d16 (patch not in) --- modules/flashrom | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/modules/flashrom b/modules/flashrom index 17508298b..c7ce3e949 100644 --- a/modules/flashrom +++ b/modules/flashrom @@ -13,19 +13,22 @@ flashrom_cfg := \ WARNERROR=no \ CONFIG_NOTHING=yes \ CONFIG_INTERNAL=yes \ - CONFIG_INTERNAL_X86=yes - CONFIG_DUMMY=yes \ - CONFIG_AST1100=yes \ + CONFIG_INTERNAL_X86=yes \ ifeq "$(CONFIG_TARGET_ARCH)" "ppc64" flashrom_cfg := \ WARNERROR=no \ CONFIG_NOTHING=yes \ - CONFIG_LINUX_MTD=yes \ - CONFIG_DUMMY=yes \ - CONFIG_AST1100=yes + CONFIG_LINUX_MTD=yes endif +#Only enable AST1100 if requested per board configs +ifeq "$(CONFIG_FLASHROM_AST1100)" "y" +flashrom_cfg += CONFIG_AST1100=yes +endif + + + flashrom_target := \ $(MAKE_JOBS) \ $(CROSS_TOOLS) \