install: allow to use last block for embedding (MR 2069)
Devices such as ODROIDs have binaries use which every single block for embedding. Do not raise an error when binaries are touching, but not overlapping, each other when embedding these binaries during installation. Add a test for this scenario, which fails when reverting the change. Co-Authored-By: Oliver Smith <ollieparanoid@postmarketos.org>
This commit is contained in:
parent
e900ee169a
commit
834cc7f877
|
@ -465,8 +465,8 @@ def generate_binary_list(args, suffix, step):
|
|||
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)):
|
||||
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 "
|
||||
f"other firmware image: {binary}")
|
||||
|
||||
|
|
|
@ -160,3 +160,23 @@ def test_generate_binary_list(args):
|
|||
with pytest.raises(RuntimeError) as e:
|
||||
func(args, suffix, step)
|
||||
assert str(e.value).startswith("The following firmware binary does not")
|
||||
|
||||
# Binaries are touching but not overlapping
|
||||
# boot_part_start is at 2 sectors (1024 b)
|
||||
# |-----|---------------------|-------------------|-------------------
|
||||
# | … | binary2.bin (100 b) | small.bin (600 b) | /boot part start …
|
||||
# |-----|---------------------|-------------------|-------------------
|
||||
# 0 324 424 1024
|
||||
step = 1
|
||||
binaries = "binary2.bin:324,small.bin:424"
|
||||
args.deviceinfo = {"sd_embed_firmware": binaries,
|
||||
"boot_part_start": "2"}
|
||||
assert func(args, suffix, step) == [('binary2.bin', 324),
|
||||
('small.bin', 424)]
|
||||
|
||||
# Same layout written with different order in sd_embed_firmware
|
||||
binaries = "small.bin:424,binary2.bin:324"
|
||||
args.deviceinfo = {"sd_embed_firmware": binaries,
|
||||
"boot_part_start": "2"}
|
||||
assert func(args, suffix, step) == [('small.bin', 424),
|
||||
('binary2.bin', 324)]
|
||||
|
|
Loading…
Reference in New Issue