mirror of
https://github.com/raspberrypi/rpi-eeprom.git
synced 2026-01-20 21:13:36 +08:00
rpi-eeprom-config: Increase the configuration size limit to 2024
Update the rpi-eeprom-config tool to accept config files of up to 2024 byte. The config section has a 24byte header so the section is always <= 2KiB. This allows a reasonably large user-data section in the config file accessible via 'vcgencmd bootloader_config' as an alternative to customer OTP data. N.B. The vcgencmd uses a single VCHIQ message which is limited to 4092 bytes. Setting a 2KiB limit here gives room for user-data plus some spare space for future config expansion before an VCHIQ bulk message or an extra EEPROM 4KiB page is required.
This commit is contained in:
@@ -10,6 +10,8 @@ import sys
|
|||||||
|
|
||||||
IMAGE_SIZE = 512 * 1024
|
IMAGE_SIZE = 512 * 1024
|
||||||
|
|
||||||
|
MAX_BOOTCONF_SIZE = 2024
|
||||||
|
|
||||||
# Each section starts with a magic number followed by a 32 bit offset to the
|
# Each section starts with a magic number followed by a 32 bit offset to the
|
||||||
# next section (big-endian).
|
# next section (big-endian).
|
||||||
# The number, order and size of the sections depends on the bootloader version
|
# The number, order and size of the sections depends on the bootloader version
|
||||||
@@ -55,8 +57,9 @@ class BootloaderImage(object):
|
|||||||
hdr_offset, length = self.find_config()
|
hdr_offset, length = self.find_config()
|
||||||
new_config_bytes = open(new_config, 'rb').read()
|
new_config_bytes = open(new_config, 'rb').read()
|
||||||
new_len = len(new_config_bytes) + FILENAME_LEN + 4
|
new_len = len(new_config_bytes) + FILENAME_LEN + 4
|
||||||
if new_len > length and new_len > 1024:
|
if len(new_config_bytes) > MAX_BOOTCONF_SIZE:
|
||||||
raise Exception('Config is too large')
|
raise Exception("Config is too large (%d bytes). The maximum size is %d bytes."
|
||||||
|
% (len(new_config_bytes), MAX_BOOTCONF_SIZE))
|
||||||
if hdr_offset + len(new_config_bytes) + FILE_HDR_LEN > IMAGE_SIZE:
|
if hdr_offset + len(new_config_bytes) + FILE_HDR_LEN > IMAGE_SIZE:
|
||||||
raise Exception('EEPROM image size exceeded')
|
raise Exception('EEPROM image size exceeded')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user