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", "rootfs_image_sector_size",
"sd_embed_firmware", "sd_embed_firmware",
"sd_embed_firmware_step_size", "sd_embed_firmware_step_size",
"sd_embed_check_overlap",
"partition_blacklist", "partition_blacklist",
"boot_part_start", "boot_part_start",
"root_filesystem", "root_filesystem",

View File

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