[linux] 01/01: buildcheck.py: Add check for uncompressed Image size

debian-kernel at lists.debian.org debian-kernel at lists.debian.org
Sun Aug 27 05:47:18 UTC 2017


This is an automated email from the git hooks/post-receive script.

rosh-guest pushed a commit to branch rosh/check-uncompressed-size
in repository linux.

commit cc7783abbfb8c49be5fceace90d5c212ea8e0fcc
Author: Roger Shimizu <rogershimizu at gmail.com>
Date:   Sun Aug 27 14:43:49 2017 +0900

    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            |  3 +++
 debian/config/armel/defines |  5 +++++
 4 files changed, 29 insertions(+), 6 deletions(-)

diff --git a/debian/bin/buildcheck.py b/debian/bin/buildcheck.py
index 5cd0d8a..6a50978 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 5302e56..29ea618 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 112718e..18974da 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,9 @@ linux (4.13~rc6-1~exp1) UNRELEASED; urgency=medium
     RTC_DRV_DS1307, RTC_DRV_RS5C372, RTC_DRV_PCF8563, RTC_DRV_M41T80,
     and RTC_DRV_S35390A, to modules. Because most marvell boards use
     RTC_DRV_MV. (above two fix FTBFS)
+  * debian/bin/buildcheck.py:
+    Add check for uncompressed Image size, which is necessary for
+    armel/marvell flavour currently.
 
  -- Ben Hutchings <ben at decadent.org.uk>  Sat, 19 Aug 2017 22:37:38 +0100
 
diff --git a/debian/config/armel/defines b/debian/config/armel/defines
index 193c81b..9f4ed16 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~)

-- 
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