[linux] 01/01: Check decompressed Image size
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Mon Aug 21 16:12:01 UTC 2017
This is an automated email from the git hooks/post-receive script.
rosh-guest pushed a commit to branch rosh/check-size2
in repository linux.
commit 8e38f42b593cf29dceb3259399553905d4c74cbc
Author: Roger Shimizu <rogershimizu at gmail.com>
Date: Tue Aug 22 01:11:12 2017 +0900
Check decompressed Image size
Currently only armel/marvell flavour need this check
---
debian/bin/buildcheck.py | 32 ++++++++++++++++++++++++++++++++
debian/bin/gencontrol.py | 1 +
debian/config/armel/defines | 5 +++++
3 files changed, 38 insertions(+)
diff --git a/debian/bin/buildcheck.py b/debian/bin/buildcheck.py
index 5cd0d8a..83ccd44 100755
--- a/debian/bin/buildcheck.py
+++ b/debian/bin/buildcheck.py
@@ -189,6 +189,7 @@ class CheckImage(object):
def __call__(self, out):
image = self.config_entry_build.get('image-file')
+ image2 = self.config_entry_build.get('image2-file')
if not image:
# TODO: Bail out
@@ -199,6 +200,9 @@ class CheckImage(object):
fail = 0
fail |= self.check_size(out, image)
+ if image2:
+ image2 = os.path.join(self.dir, image2)
+ fail |= self.check_size2(out, image2)
return fail
@@ -238,6 +242,34 @@ class CheckImage(object):
return 0
+ def check_size2(self, out, image):
+ value = self.config_entry_image.get('check-size2')
+
+ if not value:
+ return 0
+
+ size = os.stat(image).st_size
+
+ if size > value:
+ out.write('Decompressed 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.
+ usage = (float(size)/value) * 100.0
+ out.write('Decompressed 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('Under 1%% space in %s. ' % self.changelog.distribution)
+ else:
+ out.write('Decompressed Image fits. ')
+ out.write('Continuing.\n')
+
+ return 0
+
class Main(object):
def __init__(self, dir, arch, featureset, flavour):
diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py
index 5302e56..ed0f13c 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-size2': config.SchemaItemInteger(),
},
'relations': {
},
diff --git a/debian/config/armel/defines b/debian/config/armel/defines
index 193c81b..7453dc3 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
+# image2 is just for size checking
+image2-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 decompressed kernel size for supported devices
+# Buffalo Linkstation LS-WSXL/WXL/WVL: 7340032
+check-size2: 7340032
breaks: flash-kernel (<< 3.57~)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git
More information about the Kernel-svn-changes
mailing list