From 516816b15ab5057956cb4150adbbe4dfc710e679 Mon Sep 17 00:00:00 2001
From: Eduardo Piva <efpiva@gmail.com>
Date: Wed, 12 Feb 2014 18:10:51 -0200
Subject: [PATCH] check-image-size: check if enough space exists for kernel
 decompression

This script is called from build.mk to check if enough space exists for kernel
decompression. If not, break the build.

Signed-off-by: Eduardo Piva <efpiva@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
---
 scripts/check-image-size.sh | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)
 create mode 100755 scripts/check-image-size.sh

diff --git a/scripts/check-image-size.sh b/scripts/check-image-size.sh
new file mode 100755
index 000000000..5dd65d2c4
--- /dev/null
+++ b/scripts/check-image-size.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+#
+# Copyright (C) 2014 Eduardo Piva
+#
+# This work is open source software, licensed under the terms of the
+# BSD license as described in the LICENSE file in the top-level directory.
+#
+if [ "$#" -ne 2 ]; then
+    echo "usage: $0 file maxsize"
+    exit 1
+fi
+
+if [ $(ls -l "$1" | cut -d " " -f 5) -ge "$2" ]; then
+    echo "$1 is greater than $2, needed to uncompress kernel"
+    echo "Change arch/x64/boot16.S and arch/x65/lzloader.ld "
+    echo " in order to have more available space for the kernel. "
+
+    exit 1
+else
+    exit 0
+fi
-- 
GitLab