Compare commits

...

1 Commits

Author SHA1 Message Date
Dylan Van Assche 63acc8ddcd
install: add option to disable overlap detection
Some devices such as ODROID XU3/XU4/HC1/HC2/MC1 have
boot binaries which overlap when flasing them to
uboot partition. This is not allowed by pmbootstrap.
Add a deviceinfo option to disable this check.
2021-06-13 20:49:29 +02:00
2 changed files with 18 additions and 8 deletions

View File

@ -424,6 +424,7 @@ deviceinfo_attributes = [
"rootfs_image_sector_size",
"sd_embed_firmware",
"sd_embed_firmware_step_size",
"sd_embed_check_overlap",
"partition_blacklist",
"boot_part_start",
"root_filesystem",

View File

@ -391,6 +391,13 @@ def embed_firmware(args, suffix):
device_rootfs = mount_device_rootfs(args, suffix)
binaries = args.deviceinfo["sd_embed_firmware"].split(",")
detect_overlap = True
if args.deviceinfo["sd_embed_detect_overlap"]:
detect_overlap = (args.deviceinfo["sd_embed_detect_overlap"] == "true")
if not detect_overlap:
logging.info("Embedding firmware overlap detection disabled")
# Perform three checks prior to writing binaries to disk: 1) that binaries
# exist, 2) that binaries do not extend into the first partition, 3) that
# binaries do not overlap each other
@ -420,14 +427,16 @@ def embed_firmware(args, suffix):
max_size))
# Insure that the firmware does not conflict with any other firmware
# that will be embedded
binary_start = offset * step
binary_end = binary_start + binary_size
for start, end in binary_ranges.items():
if ((binary_start >= start and binary_start <= end) or
(binary_end >= start and binary_end <= end)):
raise RuntimeError("The firmware overlaps with at least one "
"other firmware image: {}".format(binary))
binary_ranges[binary_start] = binary_end
if detect_overlap:
binary_start = offset * step
binary_end = binary_start + binary_size
for start, end in binary_ranges.items():
if ((binary_start >= start and binary_start <= end) or
(binary_end >= start and binary_end <= end)):
raise RuntimeError("The firmware overlaps with at least "
f"one other firmware image: {binary}")
binary_ranges[binary_start] = binary_end
binary_list.append((binary, offset))
# Write binaries to disk