summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAndrew Geissler <geissonator@gmail.com>2023-03-24 15:13:33 -0500
committerSteve Sakoman <steve@sakoman.com>2023-04-14 06:30:29 -1000
commitab086e9bd683326ac9c129964dff787b74d1fd57 (patch)
tree4dbd38ec525b656842be44ef6882bdf59cabf24f /scripts
parent8c1fa125681d09056b2b952c6503f0599a213933 (diff)
downloadpoky-ab086e9bd683326ac9c129964dff787b74d1fd57.tar.gz
filemap.py: enforce maximum of 4kb block size
The logic in this script validates that the length of data sections are evenly divisible by the block size. On most systems the block size is 4KB and all is good. Some systems though, such as ppc64le, have a block size larger then 4KB. For example on a POWER9 based ppc64le system, the block size is 64KB. This results in this script failing with errors like this when building wic images: |440, in _do_get_mapped_ranges | assert extent_len % self.block_size == 0 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | AssertionError In this case the data section size was 268KB and the block size was 64KB, resulting in the above assert failure. Resolves https://bugzilla.yoctoproject.org/show_bug.cgi?id=15075 (From OE-Core rev: 303cc9ce3a9d7ca85542f12ebfda27eeb449e73b) Signed-off-by: Andrew Geissler <geissonator@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 1e23b803af6991fc20e4a4e88a0ef0541399e722) Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/wic/filemap.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py
index 4d9da28172..85b39d5d74 100644
--- a/scripts/lib/wic/filemap.py
+++ b/scripts/lib/wic/filemap.py
@@ -46,6 +46,13 @@ def get_block_size(file_obj):
46 bsize = stat.st_blksize 46 bsize = stat.st_blksize
47 else: 47 else:
48 raise IOError("Unable to determine block size") 48 raise IOError("Unable to determine block size")
49
50 # The logic in this script only supports a maximum of a 4KB
51 # block size
52 max_block_size = 4 * 1024
53 if bsize > max_block_size:
54 bsize = max_block_size
55
49 return bsize 56 return bsize
50 57
51class ErrorNotSupp(Exception): 58class ErrorNotSupp(Exception):