diff options
| author | Evan Lojewski <github@meklort.com> | 2020-09-25 18:54:04 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-25 18:54:04 -0600 |
| commit | f9459621dc74c3ff14407da65a1b77940cf6ec59 (patch) | |
| tree | 2ac8207d619955d593ef302ca56e18f8c36d8baf /utils/bcmflash/main.cpp | |
| parent | 038fef47787312dc7c043d754aad62f08db55b6c (diff) | |
| download | bcm5719-ortega-f9459621dc74c3ff14407da65a1b77940cf6ec59.tar.gz bcm5719-ortega-f9459621dc74c3ff14407da65a1b77940cf6ec59.zip | |
ape: Fix ape on-disk format to match NVM endianness. (#115)
This closes GH-113
Diffstat (limited to 'utils/bcmflash/main.cpp')
| -rw-r--r-- | utils/bcmflash/main.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/utils/bcmflash/main.cpp b/utils/bcmflash/main.cpp index 67bd16a..ef50427 100644 --- a/utils/bcmflash/main.cpp +++ b/utils/bcmflash/main.cpp @@ -497,10 +497,13 @@ int main(int argc, char const *argv[]) #endif } - // Ensure everything is in the correct endianness. - for (int i = 0; i < (new_ape_length - 4) / 4; i++) + if (ape_wd[0] == APE_HEADER_MAGIC) { - ape_wd[i] = be32toh(ape_wd[i]); + // Ensure everything is in the correct endianness. + for (int i = 0; i < (new_ape_length - 4) / 4; i++) + { + ape_wd[i] = be32toh(ape_wd[i]); + } } uint32_t new_ape_crc = be32toh(~NVRam_crc(ape, ape_length - sizeof(uint32_t), 0xffffffff)); |

