From 8d9993070b4fb64673de37d0cae1e126da11e639 Mon Sep 17 00:00:00 2001 From: Roger Shimizu Date: Sat, 2 Sep 2017 00:30:02 +0900 Subject: [PATCH] buildcheck.py: Add check for uncompressed Image size Currently only armel/marvell flavour need this check --- debian/bin/buildcheck.py | 26 ++++++++++++++++++++------ debian/bin/gencontrol.py | 1 + debian/changelog | 9 +++++++++ debian/config/armel/defines | 5 +++++ 4 files changed, 35 insertions(+), 6 deletions(-) diff --git a/debian/bin/buildcheck.py b/debian/bin/buildcheck.py index 5cd0d8ab4..6a50978aa 100755 --- a/debian/bin/buildcheck.py +++ b/debian/bin/buildcheck.py @@ -189,20 +189,23 @@ class CheckImage(object): def __call__(self, out): image = self.config_entry_build.get('image-file') + uncompressed_image = self.config_entry_build.get('uncompressed-image-file') if not image: # TODO: Bail out return 0 image = os.path.join(self.dir, image) + if uncompressed_image: + uncompressed_image = os.path.join(self.dir, uncompressed_image) fail = 0 - fail |= self.check_size(out, image) + fail |= self.check_size(out, image, uncompressed_image) return fail - def check_size(self, out, image): + def check_size(self, out, image, uncompressed_image): value = self.config_entry_image.get('check-size') if not value: @@ -218,10 +221,6 @@ class CheckImage(object): 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 # through the lifetime of a stable release. Warn if this is # not the case. @@ -236,6 +235,21 @@ class CheckImage(object): out.write('Image fits. ') 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 diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py index 5302e5672..29ea618b0 100755 --- a/debian/bin/gencontrol.py +++ b/debian/bin/gencontrol.py @@ -35,6 +35,7 @@ class Gencontrol(Base): 'initramfs-generators': config.SchemaItemList(), 'check-size': config.SchemaItemInteger(), 'check-size-with-dtb': config.SchemaItemBoolean(), + 'check-uncompressed-size': config.SchemaItemInteger(), }, 'relations': { }, diff --git a/debian/changelog b/debian/changelog index fb275f647..60c2e228d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Thu, 31 Aug 2017 19:47:54 +0900 + linux (4.13~rc7-1~exp1) experimental; urgency=medium * New upstream release candidate diff --git a/debian/config/armel/defines b/debian/config/armel/defines index 193c81b61..9f4ed16b1 100644 --- a/debian/config/armel/defines +++ b/debian/config/armel/defines @@ -9,6 +9,8 @@ image-file: arch/arm/boot/zImage # 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. signed-modules: false +# uncompressed-image is just for size checking +uncompressed-image-file: arch/arm/boot/Image [image] install-stem: vmlinuz @@ -32,4 +34,7 @@ recommends: u-boot-tools # Buffalo Linkstation LS-WSXL/WXL/WVL (from stock kernel): 2729776 - 64 = 2729712 check-size: 2097080 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~)