CONFIG_PARTITION_TABLE_MD5=y is bricking devices

william.ferguson.au
Posts: 107
Joined: Wed Jan 02, 2019 8:55 am

CONFIG_PARTITION_TABLE_MD5=y is bricking devices

Postby william.ferguson.au » Sat Oct 15, 2022 3:16 am

We have always built with CONFIG_PARTITION_TABLE_MD5=y under the assumption that it was actually generating an MD5 for the partition table, however that appears not to have always been the case.

We have recently had dozens of devices bricked during OTA (I believe) because of this change https://github.com/espressif/esp-idf/bl ... xt#L19-L21 which from what I understand was intended to fix the build so that it started
  • Generating the MD5 for the partition table.
  • Enforcing that the partition table has a valid MD5.
While fixing the build system to actually do what it claimed it was doing is laudable, and this change works great for newly deployed builds.

making that change in way that bricks devices when delivered via OTA is really crap. Surely it would have been better to split the config into 2 parts
  • Generate partition table MD5
  • Enforce partition table MD5
That way you could start generating the MD5 without bricking devices that OTA update (because OTA doesn't deliver them a new partition with the MD5).

See also viewtopic.php?t=12794


ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: CONFIG_PARTITION_TABLE_MD5=y is bricking devices

Postby ESP_igrr » Sat Oct 15, 2022 6:21 pm

Hi william.ferguson.au,
Sorry for the issue you have encountered!
To clarify the issue, was the bootloader flashed into the devices in the field built with IDF 3.3 and with CMake build system?

cruvus
Posts: 59
Joined: Fri Jul 08, 2022 5:08 pm
Location: Planet Earth

Re: CONFIG_PARTITION_TABLE_MD5=y is bricking devices

Postby cruvus » Sat Oct 15, 2022 7:18 pm

Is the check done by the bootloader or the app?
ESP32 / ESP-IDF 5.1.4

william.ferguson.au
Posts: 107
Joined: Wed Jan 02, 2019 8:55 am

Re: CONFIG_PARTITION_TABLE_MD5=y is bricking devices

Postby william.ferguson.au » Sun Oct 16, 2022 12:16 am

ESP_igrr

Yes. The devices were built with IDF 3.3 using CMake.
So 3.3 bootloader and 4.4.2 app

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: CONFIG_PARTITION_TABLE_MD5=y is bricking devices

Postby ESP_igrr » Sun Oct 16, 2022 7:50 am

This is probably the issue that is mentioned in the release notes of IDF v4.4 in the "Breaking changes" section:
https://github.com/espressif/esp-idf/releases/tag/v4.4
Bootloader: The default app configuration is only compatible with bootloader and partition table generated from ESP-IDF V3.1 or newer. Apps that need to support OTA update on bootloaders and/or partition tables from older ESP-IDF must enable the new configuration option "App compatible with bootloader and partition table before ESP-IDF v3.1". Additionally, in ESP-IDF v3.3, CMake build system failed to append MD5 checksum to the partition table even when the option was enabled. This bug was fixed before v4.0 release. If the bootloader and partition table were initially built with CMake and IDF v3.3.x, then the compatibility option should also be enabled.
Enabling the option CONFIG_ESP32_COMPATIBLE_PRE_V3_1_BOOTLOADERS should solve the issue. We will update the option description to say that it is also applicable to IDF v3.3 with CMake build system.

william.ferguson.au
Posts: 107
Joined: Wed Jan 02, 2019 8:55 am

Re: CONFIG_PARTITION_TABLE_MD5=y is bricking devices

Postby william.ferguson.au » Sun Oct 16, 2022 10:26 pm

Ah. Thanks. Missed that in the breaking changes.
You might want to highlight the impact of that breaking change.

william.ferguson.au
Posts: 107
Joined: Wed Jan 02, 2019 8:55 am

Re: CONFIG_PARTITION_TABLE_MD5=y is bricking devices

Postby william.ferguson.au » Mon Oct 17, 2022 12:46 am

OK, so where/how dop I configure "App compatible with bootloader and partition table before ESP-IDF v3.1"

According to https://docs.espressif.com/projects/esp ... ootloaders

it should be visible in the BuildType section of MenuConfig. But I'm not seeing it.

Image

ESP_igrr
Posts: 2071
Joined: Tue Dec 01, 2015 8:37 am

Re: CONFIG_PARTITION_TABLE_MD5=y is bricking devices

Postby ESP_igrr » Mon Oct 17, 2022 8:05 pm

The documentation link you have posted is for the master branch ("latest"). It so happens that this configuration option got moved into a different location in v5.0, which is why you didn't find it. For v4.4.2, the link is this one: https://docs.espressif.com/projects/esp ... ootloaders. In release/v4.4 branch it is located under Component config, ESP32-specific.

I have written a task to update the release notes according to your suggestion!

william.ferguson.au
Posts: 107
Joined: Wed Jan 02, 2019 8:55 am

Re: CONFIG_PARTITION_TABLE_MD5=y is bricking devices

Postby william.ferguson.au » Tue Oct 18, 2022 4:35 am

Brilliant thanks - that was doing my head in.

Who is online

Users browsing this forum: Bing [Bot] and 105 guests