aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZwb <ethercflow@gmail.com>2019-10-15 06:01:06 -0400
committerDmitry Vyukov <dvyukov@google.com>2019-10-15 12:40:28 +0200
commitb5268b89c2964733654c89f8322fb155d9fa6799 (patch)
treebca021297c3ca99b59fbc0cccf29a6ec279f7a83
parent05ad729222eb9c1bcd9ebe41800e967429b297a1 (diff)
tools/create-image.sh: add a new option seek
The usage of current create-image.sh: ``` ./create-image.sh -d=stretch -f=minimal --add-perf The options are in the following: -d, --distribution Set on which debian distribution to create -f, --feature Check what packages to install in the image, options are minimal, full -s, --seek Image size (MB), default 2048 (2G) -p, --add-perf Add perf support with this option enabled The default image size may too small (2G) in some debugging scenarios, so change it to configurable.
-rw-r--r--AUTHORS1
-rw-r--r--CONTRIBUTORS1
-rwxr-xr-xtools/create-image.sh8
3 files changed, 9 insertions, 1 deletions
diff --git a/AUTHORS b/AUTHORS
index 5ede57a8e..8fb37048c 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -36,3 +36,4 @@ Mellanox Technologies
Cody Holliday
JinWoo Lee
Andrew Turner
+Ethercflow
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
index 4b80b3bd3..c02d4ffe7 100644
--- a/CONTRIBUTORS
+++ b/CONTRIBUTORS
@@ -51,3 +51,4 @@ Mellanox Technologies
Cody Holliday
JinWoo Lee
Andrew Turner
+Ethercflow
diff --git a/tools/create-image.sh b/tools/create-image.sh
index 19c2019e3..9e931e99e 100755
--- a/tools/create-image.sh
+++ b/tools/create-image.sh
@@ -18,6 +18,7 @@ fi
# Variables affected by options
RELEASE=stretch
FEATURE=minimal
+SEEK=2047
PERF=false
# Display help function
@@ -26,6 +27,7 @@ display_help() {
echo
echo " -d, --distribution Set on which debian distribution to create"
echo " -f, --feature Check what packages to install in the image, options are minimal, full"
+ echo " -s, --size Image size (MB), default 2048 (2G)"
echo " -h, --help Display help message"
echo " -p, --add-perf Add perf support with this option enabled. Please set envrionment variable \$KERNEL at first"
echo
@@ -49,6 +51,10 @@ while true; do
FEATURE=$2
shift 2
;;
+ -s | --seek)
+ SEEK=$(($2 - 1))
+ shift 2
+ ;;
-p | --add-perf)
PERF=true
shift 1
@@ -113,7 +119,7 @@ if [ $PERF = "true" ]; then
fi
# Build a disk image
-dd if=/dev/zero of=$RELEASE.img bs=1M seek=2047 count=1
+dd if=/dev/zero of=$RELEASE.img bs=1M seek=$SEEK count=1
sudo mkfs.ext4 -F $RELEASE.img
sudo mkdir -p /mnt/$DIR
sudo mount -o loop $RELEASE.img /mnt/$DIR