buildcheck.py: Add check for uncompressed Image size

Currently only armel/marvell flavour need this check
This commit is contained in:
Roger Shimizu 2017-09-02 00:30:02 +09:00
parent 3c3aa2c3a3
commit 8d9993070b
4 changed files with 35 additions and 6 deletions

View File

@ -189,20 +189,23 @@ class CheckImage(object):
def __call__(self, out): def __call__(self, out):
image = self.config_entry_build.get('image-file') image = self.config_entry_build.get('image-file')
uncompressed_image = self.config_entry_build.get('uncompressed-image-file')
if not image: if not image:
# TODO: Bail out # TODO: Bail out
return 0 return 0
image = os.path.join(self.dir, image) image = os.path.join(self.dir, image)
if uncompressed_image:
uncompressed_image = os.path.join(self.dir, uncompressed_image)
fail = 0 fail = 0
fail |= self.check_size(out, image) fail |= self.check_size(out, image, uncompressed_image)
return fail return fail
def check_size(self, out, image): def check_size(self, out, image, uncompressed_image):
value = self.config_entry_image.get('check-size') value = self.config_entry_image.get('check-size')
if not value: if not value:
@ -218,10 +221,6 @@ class CheckImage(object):
size = os.stat(image).st_size + dtb_size size = os.stat(image).st_size + dtb_size
if size > value:
out.write('Image too large (%d > %d)! Refusing to continue.\n' % (size, value))
return 1
# 1% overhead is desirable in order to cope with growth # 1% overhead is desirable in order to cope with growth
# through the lifetime of a stable release. Warn if this is # through the lifetime of a stable release. Warn if this is
# not the case. # not the case.
@ -236,6 +235,21 @@ class CheckImage(object):
out.write('Image fits. ') out.write('Image fits. ')
out.write('Continuing.\n') out.write('Continuing.\n')
# Also check the uncompressed image
if uncompressed_image and self.config_entry_image.get('check-uncompressed-size'):
value = self.config_entry_image.get('check-uncompressed-size')
size = os.stat(uncompressed_image).st_size
usage = (float(size)/value) * 100.0
out.write('Uncompressed Image size %d/%d, using %.2f%%. ' % (size, value, usage))
if size > value:
out.write('Too large. Refusing to continue.\n')
return 1
elif usage >= 99.0:
out.write('Uncompressed Image Under 1%% space in %s. ' % self.changelog.distribution)
else:
out.write('Uncompressed Image fits. ')
out.write('Continuing.\n')
return 0 return 0

View File

@ -35,6 +35,7 @@ class Gencontrol(Base):
'initramfs-generators': config.SchemaItemList(), 'initramfs-generators': config.SchemaItemList(),
'check-size': config.SchemaItemInteger(), 'check-size': config.SchemaItemInteger(),
'check-size-with-dtb': config.SchemaItemBoolean(), 'check-size-with-dtb': config.SchemaItemBoolean(),
'check-uncompressed-size': config.SchemaItemInteger(),
}, },
'relations': { 'relations': {
}, },

9
debian/changelog vendored
View File

@ -1,3 +1,12 @@
linux (4.13~rc7-1~exp2) UNRELEASED; urgency=medium
[ Roger Shimizu ]
* debian/bin/buildcheck.py:
Add check for uncompressed Image size, which is necessary for
armel/marvell flavour currently.
-- Roger Shimizu <rogershimizu@gmail.com> Thu, 31 Aug 2017 19:47:54 +0900
linux (4.13~rc7-1~exp1) experimental; urgency=medium linux (4.13~rc7-1~exp1) experimental; urgency=medium
* New upstream release candidate * New upstream release candidate

View File

@ -9,6 +9,8 @@ image-file: arch/arm/boot/zImage
# apply only to marvell, but we would then need to build udebs only for # apply only to marvell, but we would then need to build udebs only for
# marvell and we don't have a way to do that. # marvell and we don't have a way to do that.
signed-modules: false signed-modules: false
# uncompressed-image is just for size checking
uncompressed-image-file: arch/arm/boot/Image
[image] [image]
install-stem: vmlinuz install-stem: vmlinuz
@ -32,4 +34,7 @@ recommends: u-boot-tools
# Buffalo Linkstation LS-WSXL/WXL/WVL (from stock kernel): 2729776 - 64 = 2729712 # Buffalo Linkstation LS-WSXL/WXL/WVL (from stock kernel): 2729776 - 64 = 2729712
check-size: 2097080 check-size: 2097080
check-size-with-dtb: true check-size-with-dtb: true
## Maximum uncompressed kernel size for supported devices
# Buffalo Linkstation LS-WSXL/WXL/WVL: 7340032
check-uncompressed-size: 7340032
breaks: flash-kernel (<< 3.57~) breaks: flash-kernel (<< 3.57~)