aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorVíctor Mayoral Vilches2021-04-23 17:57:10 -0700
committerStefano Stabellini2021-05-17 14:51:00 -0700
commitf4b1ad9e1bfe85d36956a8b6272d816202a36e22 (patch)
treef36a254591c994c177694e8b1b4fec568a787ed1 /scripts
parent2deb09c3c157d1a3fbc8d4a60ebb76bfae3593ca (diff)
Add a configurable SLACK parameter to set how many MB of free space are added to each partition.
Signed-off-by: Víctor Mayoral Vilches <v.mayoralv@gmail.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com> Reviewed-by: Brian Woods <brian.woods@xilinx.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/disk_image16
1 files changed, 13 insertions, 3 deletions
diff --git a/scripts/disk_image b/scripts/disk_image
index 953bf0d..7f602d1 100755
--- a/scripts/disk_image
+++ b/scripts/disk_image
@@ -4,6 +4,7 @@
set -e
PROG_REQ=( kpartx mkfs.ext4 losetup sgdisk readlink awk )
+SLACK=128
function check_depends()
{
@@ -130,7 +131,7 @@ function add_partition()
# account for gzip compression
_part_size=$(( $_part_size * 2 ))
# add some slack
- _part_size=$(( 128*1024*1024 + $_part_size ))
+ _part_size=$(( $SLACK*1024*1024 + $_part_size ))
_part_size=$(( $_part_size / 1024 / 1024 ))
echo PART size: "$_part_size"MB
@@ -173,7 +174,7 @@ function write_rootfs()
function print_help
{
echo "usage:"
- echo " $0 -c CONFIG_FILE -d UBOOT_DIRECTORY -t UBOOT_TYPE <-w WORK_DIRECTORY> -o IMG_FILE"
+ echo " $0 -c CONFIG_FILE -d UBOOT_DIRECTORY -t UBOOT_TYPE <-w WORK_DIRECTORY> <-s SLACK> -o IMG_FILE"
echo " $0 -h"
echo "where:"
echo " -c CONFIG_FILE - configuration file"
@@ -184,6 +185,7 @@ function print_help
echo " tftp - alias for \"tftpb\" for uboot load cammnds"
echo " < > - used for uboot load commands"
echo " -w WORK_DIRECTORY - work directory used when building the image"
+ echo " -s SLACK - free MB to add to each partition, default 128"
echo " -o IMG_FILE - the output img file "
echo "Example:"
echo " $0 -c ../config -d ./build42 -w tmp -o disk.img"
@@ -196,7 +198,7 @@ then
exit 1
fi
-while getopts ":w:d:c:t:o:h" opt
+while getopts ":w:d:c:t:s:o:h" opt
do
case ${opt} in
t )
@@ -215,6 +217,14 @@ do
;;
esac
;;
+ s )
+ SLACK=$OPTARG
+ if ! test $SLACK -gt 0
+ then
+ echo "Invalid SLACK parameter."
+ exit 1
+ fi
+ ;;
w )
DESTDIR=$OPTARG
;;