From f9a4a6f1aba6c2ea54cf4972c14389db4a88f6fc Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Thu, 12 Sep 2019 11:11:56 +0100 Subject: [PATCH 1/2] Fix magic number check --- rpi-eeprom-config | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rpi-eeprom-config b/rpi-eeprom-config index 32cbd80..ee39da2 100755 --- a/rpi-eeprom-config +++ b/rpi-eeprom-config @@ -15,7 +15,8 @@ IMAGE_SIZE = 512 * 1024 # The number, order and size of the sections depends on the bootloader version # but the following mask can be used to test for section headers and skip # unknown data. -MAGIC_MASK = 0x55aaf00f +MAGIC = 0x55aaf00f +MAGIC_MASK = 0xfffff00f FILE_MAGIC = 0x55aaf11f # id for modifiable file, currently only bootconf.txt FILE_HDR_LEN = 20 FILENAME_LEN = 12 @@ -37,7 +38,7 @@ class BootloaderImage(object): magic = 0 while offset < IMAGE_SIZE: magic, length = struct.unpack_from('>LL', self._bytes, offset) - if (magic & MAGIC_MASK) != MAGIC_MASK: + if (magic & MAGIC_MASK) != MAGIC: raise Exception('EEPROM is corrupted') if magic == FILE_MAGIC: # Found a file From 311cc79c6ff6327b672080f1d65e738c584da6a2 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Thu, 12 Sep 2019 11:49:14 +0100 Subject: [PATCH 2/2] Add .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp