From d2cbfbc292155863453411dd72a006df7dcb40b6 Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Fri, 25 Nov 2022 16:30:34 +0000 Subject: [PATCH 1/3] rpi-eeprom-config: Add -x option to extract files For test/debug add an option to extract all of the modifiable files. --- rpi-eeprom-config | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/rpi-eeprom-config b/rpi-eeprom-config index 2eaf252..f2bbc47 100755 --- a/rpi-eeprom-config +++ b/rpi-eeprom-config @@ -360,8 +360,15 @@ class BootloaderImage(object): def get_file(self, filename): hdr_offset, length, is_last = self.find_file(filename) offset = hdr_offset + 4 + FILE_HDR_LEN - config_bytes = self._bytes[offset:offset+length-FILENAME_LEN-4] - return config_bytes + file_bytes = self._bytes[offset:offset+length-FILENAME_LEN-4] + return file_bytes + + def extract_files(self): + for i in range(0, len(self._sections)): + s = self._sections[i] + if s.magic == FILE_MAGIC: + file_bytes = self.get_file(s.filename) + open(s.filename, 'wb').write(file_bytes) def read(self): config_bytes = self.get_file('bootconf.txt') @@ -457,6 +464,7 @@ See 'rpi-eeprom-update -h' for more information about the available EEPROM image parser.add_argument('-o', '--out', help='Name of output file', required=False) parser.add_argument('-d', '--digest', help='Signed boot only. The name of the .sig file generated by rpi-eeprom-dgst for config.txt ', required=False) parser.add_argument('-p', '--pubkey', help='Signed boot only. The name of the RSA public key file to store in the EEPROM', required=False) + parser.add_argument('-x', '--extract', action='store_true', default=False, help='Extract the modifiable files (boot.conf, pubkey, signature)', required=False) parser.add_argument('eeprom', nargs='?', help='Name of EEPROM file to use as input') args = parser.parse_args() @@ -468,6 +476,9 @@ See 'rpi-eeprom-update -h' for more information about the available EEPROM image if args.edit: edit_config(args.eeprom) + elif args.eeprom is not None and args.extract: + image = BootloaderImage(args.eeprom, args.out) + image.extract_files() elif args.apply is not None: if not os.path.exists(args.apply): exit_error("config file '%s' not found" % args.apply) From 214cb6ffd4886007227d73a44f681f9234f9e1cb Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Fri, 25 Nov 2022 16:09:00 +0000 Subject: [PATCH 2/3] rpi-eeprom-config: Make padding more robust. Make it explicit that a modifiable file is stored withing a single 4K sector (for erase) and that this includes the 20 byte header. When modifying a file pad up to the next section instead of just to an alignment size. This enables future changes to be more flexible in terms of alignment and padding. Although, files/sections with different padding requirements will likely get a different magic. --- rpi-eeprom-config | 48 +++++++++++++++++++++++++++---------- test/bootconf-2024.txt | 28 ---------------------- test/bootconf-2025.txt | 28 ---------------------- test/bootconf-4076.txt | 46 +++++++++++++++++++++++++++++++++++ test/bootconf-4077.txt | 46 +++++++++++++++++++++++++++++++++++ test/test-rpi-eeprom-config | 4 ++-- 6 files changed, 129 insertions(+), 71 deletions(-) delete mode 100644 test/bootconf-2024.txt delete mode 100644 test/bootconf-2025.txt create mode 100644 test/bootconf-4076.txt create mode 100644 test/bootconf-4077.txt diff --git a/rpi-eeprom-config b/rpi-eeprom-config index f2bbc47..a5dd19f 100755 --- a/rpi-eeprom-config +++ b/rpi-eeprom-config @@ -16,9 +16,6 @@ import time IMAGE_SIZE = 512 * 1024 -# Larger files won't with with "vcgencmd bootloader_config" -MAX_FILE_SIZE = 2024 -ALIGN_SIZE = 4096 BOOTCONF_TXT = 'bootconf.txt' BOOTCONF_SIG = 'bootconf.sig' PUBKEY_BIN = 'pubkey.bin' @@ -39,6 +36,11 @@ FILE_HDR_LEN = 20 FILENAME_LEN = 12 TEMP_DIR = None +# Modifiable files are stored in a single 4K erasable sector. +# The max content 4076 bytes because of the file header. +ERASE_ALIGN_SIZE = 4096 +MAX_FILE_SIZE = ERASE_ALIGN_SIZE - FILE_HDR_LEN + DEBUG = False def debug(s): if DEBUG: @@ -221,7 +223,7 @@ class ImageSection: self.offset = offset self.length = length self.filename = filename - debug("ImageSection %x %x %x %s" % (magic, offset, length, filename)) + debug("ImageSection %x offset %d length %d %s" % (magic, offset, length, filename)) class BootloaderImage(object): def __init__(self, filename, output=None): @@ -250,7 +252,6 @@ class BootloaderImage(object): """ offset = 0 magic = 0 - found = False while offset < IMAGE_SIZE: magic, length = struct.unpack_from('>LL', self._bytes, offset) if magic == 0x0 or magic == 0xffffffff: @@ -262,6 +263,7 @@ class BootloaderImage(object): if magic == FILE_MAGIC: # Found a file # Discard trailing null characters used to pad filename filename = self._bytes[offset + 8: offset + FILE_HDR_LEN].decode('utf-8').replace('\0', '') + debug("section at %d length %d magic %08x %s" % (offset, length, magic, filename)) self._sections.append(ImageSection(magic, offset, length, filename)) offset += 8 + length # length + type @@ -272,26 +274,46 @@ class BootloaderImage(object): Returns the offset, length and whether this is the last section in the EEPROM for a modifiable file within the image. """ - ret = (-1, -1, False) + offset = -1 + length = -1 + is_last = False + + next_offset = IMAGE_SIZE - ERASE_ALIGN_SIZE # Don't create padding inside the bootloader scratch page for i in range(0, len(self._sections)): s = self._sections[i] if s.magic == FILE_MAGIC and s.filename == filename: is_last = (i == len(self._sections) - 1) - ret = (s.offset, s.length, is_last) + offset = s.offset + length = s.length break - debug('%s offset %d length %d last %s' % (filename, ret[0], ret[1], ret[2])) + + # Find the start of the next non padding section + i += 1 + while i < len(self._sections): + if self._sections[i].magic == PAD_MAGIC: + i += 1 + else: + next_offset = self._sections[i].offset + break + ret = (offset, length, is_last, next_offset) + debug('%s offset %d length %d is-last %d next %d' % (filename, ret[0], ret[1], ret[2], ret[3])) return ret def update(self, src_bytes, dst_filename): """ Replaces a modifiable file with specified byte array. """ - hdr_offset, length, is_last = self.find_file(dst_filename) + hdr_offset, length, is_last, next_offset = self.find_file(dst_filename) + update_len = len(src_bytes) + FILE_HDR_LEN + + if hdr_offset + update_len > IMAGE_SIZE - ERASE_ALIGN_SIZE: + raise Exception('No space available - image past EOF.') + if hdr_offset < 0: raise Exception('Update target %s not found' % dst_filename) - if hdr_offset + len(src_bytes) + FILE_HDR_LEN > IMAGE_SIZE: - raise Exception('EEPROM image size exceeded') + if hdr_offset + update_len > next_offset: + raise Exception('Update %d bytes is larger than section size %d' % (update_len, next_offset - hdr_offset)) new_len = len(src_bytes) + FILENAME_LEN + 4 struct.pack_into('>L', self._bytes, hdr_offset + 4, new_len) @@ -312,7 +334,7 @@ class BootloaderImage(object): # by convention bootconf.txt is the last section and there's no need to # pad to the end of the sector. This also ensures that the loopback # config read/write tests produce identical binaries. - pad_bytes = ALIGN_SIZE - (pad_start % ALIGN_SIZE) + pad_bytes = next_offset - pad_start if pad_bytes > 8 and not is_last: pad_bytes -= 8 struct.pack_into('>i', self._bytes, pad_start, PAD_MAGIC) @@ -358,7 +380,7 @@ class BootloaderImage(object): sys.stdout.write(self._bytes) def get_file(self, filename): - hdr_offset, length, is_last = self.find_file(filename) + hdr_offset, length, is_last, next_offset = self.find_file(filename) offset = hdr_offset + 4 + FILE_HDR_LEN file_bytes = self._bytes[offset:offset+length-FILENAME_LEN-4] return file_bytes diff --git a/test/bootconf-2024.txt b/test/bootconf-2024.txt deleted file mode 100644 index 77db039..0000000 --- a/test/bootconf-2024.txt +++ /dev/null @@ -1,28 +0,0 @@ -[all] -BOOT_UART=0 -WAKE_ON_GPIO=1 -POWER_OFF_ON_HALT=0 -[none] -userdata0=0x12345789 -userdata1=0x12345789 -userdata2=0x12345789 -userdata3=0x12345789 -userdata4=0x12345789 -userdata5=0x12345789 -userdata6=0x12345789 -userdata7=0x12345789 -userdata8=0x12345789 -userdata9=0x12345789 -usercert=ZZZZZZZZZZZZlhEAAAADAQABAAABAQDg2l41l7troIKOA0hk3p9y4KuITWBL/aaTMORoqmXfyqEONNULSMElaLWch/b8ScHmcS+kxkS5DtLmKFo1JI14IaQNL5fr4C6Dp23CyMGIgjp3ZFg9tXs/qWpw36Ge0MCxjabbFeKVcMXD10voMT0AHfJtQb2YfOl37ffzC4bR3phUnp0Ceqpl0Loe6hxUP/r4Jen1OKskdfjsldfjalAjn9ASdkjnkjbaAKjnLKJbaKJHDRDkllDAlciaIKSPX2b0uk2MJRJhfarMHDnmxZtEzqMgwLdLol9XVjiSu/7EUzR9Qtvs8xhf6XuUJPRD6OtJCb49L+bb/pXAej/GOk0f -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# ++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/test/bootconf-2025.txt b/test/bootconf-2025.txt deleted file mode 100644 index e7752e4..0000000 --- a/test/bootconf-2025.txt +++ /dev/null @@ -1,28 +0,0 @@ -[all] -BOOT_UART=0 -WAKE_ON_GPIO=1 -POWER_OFF_ON_HALT=0 -[none] -userdata0=0x12345789 -userdata1=0x12345789 -userdata2=0x12345789 -userdata3=0x12345789 -userdata4=0x12345789 -userdata5=0x12345789 -userdata6=0x12345789 -userdata7=0x12345789 -userdata8=0x12345789 -userdata9=0x12345789 -usercert=ZZZZZZZZZZZZlhEAAAADAQABAAABAQDg2l41l7troIKOA0hk3p9y4KuITWBL/aaTMORoqmXfyqEONNULSMElaLWch/b8ScHmcS+kxkS5DtLmKFo1JI14IaQNL5fr4C6Dp23CyMGIgjp3ZFg9tXs/qWpw36Ge0MCxjabbFeKVcMXD10voMT0AHfJtQb2YfOl37ffzC4bR3phUnp0Ceqpl0Loe6hxUP/r4Jen1OKskdfjsldfjalAjn9ASdkjnkjbaAKjnLKJbaKJHDRDkllDAlciaIKSPX2b0uk2MJRJhfarMHDnmxZtEzqMgwLdLol9XVjiSu/7EUzR9Qtvs8xhf6XuUJPRD6OtJCb49L+bb/pXAej/GOk0f -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 -# ++++++++++++++++++++++++++++++++++++++++++++++++! diff --git a/test/bootconf-4076.txt b/test/bootconf-4076.txt new file mode 100644 index 0000000..a455332 --- /dev/null +++ b/test/bootconf-4076.txt @@ -0,0 +1,46 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 +[none] +userdata0=0x12345789 +userdata1=0x12345789 +userdata2=0x12345789 +userdata3=0x12345789 +userdata4=0x12345789 +userdata5=0x12345789 +userdata6=0x12345789 +userdata7=0x12345789 +userdata8=0x12345789 +userdata9=0x12345789 +usercert=ZZZZZZZZZZZZlhEAAAADAQABAAABAQDg2l41l7troIKOA0hk3p9y4KuITWBL/aaTMORoqmXfyqEONNULSMElaLWch/b8ScHmcS+kxkS5DtLmKFo1JI14IaQNL5fr4C6Dp23CyMGIgjp3ZFg9tXs/qWpw36Ge0MCxjabbFeKVcMXD10voMT0AHfJtQb2YfOl37ffzC4bR3phUnp0Ceqpl0Loe6hxUP/r4Jen1OKskdfjsldfjalAjn9ASdkjnkjbaAKjnLKJbaKJHDRDkllDAlciaIKSPX2b0uk2MJRJhfarMHDnmxZtEzqMgwLdLol9XVjiSu/7EUzR9Qtvs8xhf6XuUJPRD6OtJCb49L+bb/pXAej/GOk0f +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/test/bootconf-4077.txt b/test/bootconf-4077.txt new file mode 100644 index 0000000..1f8c3dc --- /dev/null +++ b/test/bootconf-4077.txt @@ -0,0 +1,46 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 +[none] +userdata0=0x12345789 +userdata1=0x12345789 +userdata2=0x12345789 +userdata3=0x12345789 +userdata4=0x12345789 +userdata5=0x12345789 +userdata6=0x12345789 +userdata7=0x12345789 +userdata8=0x12345789 +userdata9=0x12345789 +usercert=ZZZZZZZZZZZZlhEAAAADAQABAAABAQDg2l41l7troIKOA0hk3p9y4KuITWBL/aaTMORoqmXfyqEONNULSMElaLWch/b8ScHmcS+kxkS5DtLmKFo1JI14IaQNL5fr4C6Dp23CyMGIgjp3ZFg9tXs/qWpw36Ge0MCxjabbFeKVcMXD10voMT0AHfJtQb2YfOl37ffzC4bR3phUnp0Ceqpl0Loe6hxUP/r4Jen1OKskdfjsldfjalAjn9ASdkjnkjbaAKjnLKJbaKJHDRDkllDAlciaIKSPX2b0uk2MJRJhfarMHDnmxZtEzqMgwLdLol9XVjiSu/7EUzR9Qtvs8xhf6XuUJPRD6OtJCb49L+bb/pXAej/GOk0f +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 0123456789 +# +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/test/test-rpi-eeprom-config b/test/test-rpi-eeprom-config index 25acdd7..baec697 100755 --- a/test/test-rpi-eeprom-config +++ b/test/test-rpi-eeprom-config @@ -135,7 +135,7 @@ check_conf_size_large() { echo "check maximum config file size" image="${script_dir}/$1" - conf="bootconf-2024.txt" + conf="bootconf-4076.txt" expected_md5="$(md5sum "${conf}" | awk '{print $1}')" @@ -154,7 +154,7 @@ check_conf_size_too_large() { echo "check config file which exceeds the maximum size" image="${script_dir}/$1" - conf="bootconf-2025.txt" + conf="bootconf-4077.txt" expected_md5="$(md5sum "${conf}" | awk '{print $1}')" From 2c709e087af4ae3d18ad3a4e0624de6e9bb7f91a Mon Sep 17 00:00:00 2001 From: Tim Gover Date: Sun, 27 Nov 2022 15:43:17 +0000 Subject: [PATCH 3/3] unit-test: Update to cover all the releases including beta --- test/configs/bootconf-2021-03-04.txt | 5 +++++ test/configs/bootconf-2021-03-17.txt | 5 +++++ test/configs/bootconf-2021-05-19.txt | 5 +++++ test/configs/bootconf-2021-06-11.txt | 5 +++++ test/configs/bootconf-2021-06-17.txt | 5 +++++ test/configs/bootconf-2021-06-25.txt | 5 +++++ test/configs/bootconf-2021-07-06.txt | 5 +++++ test/configs/bootconf-2021-09-23.txt | 5 +++++ test/configs/bootconf-2021-09-27.txt | 5 +++++ test/configs/bootconf-2021-10-04.txt | 5 +++++ test/configs/bootconf-2021-10-05.txt | 5 +++++ test/configs/bootconf-2021-10-27.txt | 5 +++++ test/configs/bootconf-2021-11-22.txt | 5 +++++ test/configs/bootconf-2021-12-02.txt | 5 +++++ test/configs/bootconf-2022-01-20.txt | 5 +++++ test/configs/bootconf-2022-01-25.txt | 5 +++++ test/configs/bootconf-2022-02-04.txt | 5 +++++ test/configs/bootconf-2022-02-16.txt | 5 +++++ test/configs/bootconf-2022-02-28.txt | 5 +++++ test/configs/bootconf-2022-03-10.txt | 5 +++++ test/configs/bootconf-2022-04-14.txt | 5 +++++ test/configs/bootconf-2022-04-26.txt | 5 +++++ test/configs/bootconf-2022-05-20.txt | 5 +++++ test/configs/bootconf-2022-07-14.txt | 5 +++++ test/configs/bootconf-2022-07-19.txt | 5 +++++ test/configs/bootconf-2022-07-22.txt | 5 +++++ test/configs/bootconf-2022-07-26.txt | 5 +++++ test/configs/bootconf-2022-08-02.txt | 5 +++++ test/configs/bootconf-2022-09-02.txt | 5 +++++ test/configs/bootconf-2022-10-03.txt | 5 +++++ test/configs/bootconf-2022-10-06.txt | 5 +++++ test/configs/bootconf-2022-10-12.txt | 5 +++++ test/configs/bootconf-2022-10-18.txt | 5 +++++ test/configs/bootconf-2022-11-02.txt | 5 +++++ test/configs/bootconf-2022-11-04.txt | 5 +++++ test/configs/bootconf-2022-11-25.txt | 5 +++++ test/test-rpi-eeprom-config | 7 ++++++- 37 files changed, 186 insertions(+), 1 deletion(-) create mode 100644 test/configs/bootconf-2021-03-04.txt create mode 100644 test/configs/bootconf-2021-03-17.txt create mode 100644 test/configs/bootconf-2021-05-19.txt create mode 100644 test/configs/bootconf-2021-06-11.txt create mode 100644 test/configs/bootconf-2021-06-17.txt create mode 100644 test/configs/bootconf-2021-06-25.txt create mode 100644 test/configs/bootconf-2021-07-06.txt create mode 100644 test/configs/bootconf-2021-09-23.txt create mode 100644 test/configs/bootconf-2021-09-27.txt create mode 100644 test/configs/bootconf-2021-10-04.txt create mode 100644 test/configs/bootconf-2021-10-05.txt create mode 100644 test/configs/bootconf-2021-10-27.txt create mode 100644 test/configs/bootconf-2021-11-22.txt create mode 100644 test/configs/bootconf-2021-12-02.txt create mode 100644 test/configs/bootconf-2022-01-20.txt create mode 100644 test/configs/bootconf-2022-01-25.txt create mode 100644 test/configs/bootconf-2022-02-04.txt create mode 100644 test/configs/bootconf-2022-02-16.txt create mode 100644 test/configs/bootconf-2022-02-28.txt create mode 100644 test/configs/bootconf-2022-03-10.txt create mode 100644 test/configs/bootconf-2022-04-14.txt create mode 100644 test/configs/bootconf-2022-04-26.txt create mode 100644 test/configs/bootconf-2022-05-20.txt create mode 100644 test/configs/bootconf-2022-07-14.txt create mode 100644 test/configs/bootconf-2022-07-19.txt create mode 100644 test/configs/bootconf-2022-07-22.txt create mode 100644 test/configs/bootconf-2022-07-26.txt create mode 100644 test/configs/bootconf-2022-08-02.txt create mode 100644 test/configs/bootconf-2022-09-02.txt create mode 100644 test/configs/bootconf-2022-10-03.txt create mode 100644 test/configs/bootconf-2022-10-06.txt create mode 100644 test/configs/bootconf-2022-10-12.txt create mode 100644 test/configs/bootconf-2022-10-18.txt create mode 100644 test/configs/bootconf-2022-11-02.txt create mode 100644 test/configs/bootconf-2022-11-04.txt create mode 100644 test/configs/bootconf-2022-11-25.txt diff --git a/test/configs/bootconf-2021-03-04.txt b/test/configs/bootconf-2021-03-04.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-03-04.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2021-03-17.txt b/test/configs/bootconf-2021-03-17.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-03-17.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2021-05-19.txt b/test/configs/bootconf-2021-05-19.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-05-19.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2021-06-11.txt b/test/configs/bootconf-2021-06-11.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-06-11.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2021-06-17.txt b/test/configs/bootconf-2021-06-17.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-06-17.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2021-06-25.txt b/test/configs/bootconf-2021-06-25.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-06-25.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2021-07-06.txt b/test/configs/bootconf-2021-07-06.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-07-06.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2021-09-23.txt b/test/configs/bootconf-2021-09-23.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-09-23.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2021-09-27.txt b/test/configs/bootconf-2021-09-27.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-09-27.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2021-10-04.txt b/test/configs/bootconf-2021-10-04.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-10-04.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2021-10-05.txt b/test/configs/bootconf-2021-10-05.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-10-05.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2021-10-27.txt b/test/configs/bootconf-2021-10-27.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-10-27.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2021-11-22.txt b/test/configs/bootconf-2021-11-22.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-11-22.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2021-12-02.txt b/test/configs/bootconf-2021-12-02.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2021-12-02.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-01-20.txt b/test/configs/bootconf-2022-01-20.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-01-20.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-01-25.txt b/test/configs/bootconf-2022-01-25.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-01-25.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-02-04.txt b/test/configs/bootconf-2022-02-04.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-02-04.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-02-16.txt b/test/configs/bootconf-2022-02-16.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-02-16.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-02-28.txt b/test/configs/bootconf-2022-02-28.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-02-28.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-03-10.txt b/test/configs/bootconf-2022-03-10.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-03-10.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-04-14.txt b/test/configs/bootconf-2022-04-14.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-04-14.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-04-26.txt b/test/configs/bootconf-2022-04-26.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-04-26.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-05-20.txt b/test/configs/bootconf-2022-05-20.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-05-20.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-07-14.txt b/test/configs/bootconf-2022-07-14.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-07-14.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-07-19.txt b/test/configs/bootconf-2022-07-19.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-07-19.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-07-22.txt b/test/configs/bootconf-2022-07-22.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-07-22.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-07-26.txt b/test/configs/bootconf-2022-07-26.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-07-26.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-08-02.txt b/test/configs/bootconf-2022-08-02.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-08-02.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-09-02.txt b/test/configs/bootconf-2022-09-02.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-09-02.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-10-03.txt b/test/configs/bootconf-2022-10-03.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-10-03.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-10-06.txt b/test/configs/bootconf-2022-10-06.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-10-06.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-10-12.txt b/test/configs/bootconf-2022-10-12.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-10-12.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-10-18.txt b/test/configs/bootconf-2022-10-18.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-10-18.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-11-02.txt b/test/configs/bootconf-2022-11-02.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-11-02.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-11-04.txt b/test/configs/bootconf-2022-11-04.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-11-04.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/configs/bootconf-2022-11-25.txt b/test/configs/bootconf-2022-11-25.txt new file mode 100644 index 0000000..e85498a --- /dev/null +++ b/test/configs/bootconf-2022-11-25.txt @@ -0,0 +1,5 @@ +[all] +BOOT_UART=0 +WAKE_ON_GPIO=1 +POWER_OFF_ON_HALT=0 + diff --git a/test/test-rpi-eeprom-config b/test/test-rpi-eeprom-config index baec697..366afa5 100755 --- a/test/test-rpi-eeprom-config +++ b/test/test-rpi-eeprom-config @@ -167,7 +167,12 @@ check_conf_size_too_large() echo "Check config read and loopback read/write against reference config files" versions="$(cd configs; ls *.txt | sed 's/bootconf-//g' | sed 's/.txt//g')" for ver in ${versions}; do - check_loopback "../firmware/old/beta/pieeprom-${ver}.bin" "configs/bootconf-${ver}.txt" + if [ -f "../firmware/old/beta/pieeprom-${ver}.bin" ]; then + # Use this directory if the bootloader has been archived + check_loopback "../firmware/old/beta/pieeprom-${ver}.bin" "configs/bootconf-${ver}.txt" + else + check_loopback "../firmware/beta/pieeprom-${ver}.bin" "configs/bootconf-${ver}.txt" + fi cleanup done