Skip to content

Commit 94d584f

Browse files
committed
make the init param optional
1 parent 5d97d8f commit 94d584f

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

scripts/debug_image.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ socket="/tmp/virtiofs.sock"
55
rootfs=""
66
kernel="$rootfs/boot/vmlinuz"
77
initram="$rootfs/boot/initrd.img"
8+
cmdline="rw console=ttyS0 reboot=k panic=1 root=vroot rootfstype=virtiofs rootdelay=30"
89

910
user="user"
1011
pass="pass"
1112
name="cloud"
12-
init="/sbin/init"
1313

1414
fspid=0
1515

@@ -21,10 +21,11 @@ fail() {
2121
usage() {
2222
echo ""
2323
echo "Usage: $0 [OPTIONS]"
24-
echo " -r, --rootfs Path to the root filesystem image (required)"
25-
echo " -u, --user Username for the system (optional)"
26-
echo " -p, --pass Password for the user (optional)"
27-
echo " -n, --name Hostname for the system (optional)"
24+
echo " --rootfs Path to the root filesystem image (required)"
25+
echo " --user Username for the system (optional)"
26+
echo " --pass Password for the user (optional)"
27+
echo " --name Hostname for the system (optional)"
28+
echo " --init Entrypoint for the system (optional)"
2829
echo ""
2930
exit 1
3031
}
@@ -56,7 +57,9 @@ handle_options() {
5657
shift
5758
;;
5859
--init)
59-
init="$2"
60+
if [ ! -z "$2" ]; then
61+
cmdline="$cmdline init=$2"
62+
fi
6063
shift
6164
;;
6265
*)
@@ -129,7 +132,7 @@ run_hypervisor() {
129132
--initramfs "${initram}" \
130133
--fs tag=vroot,socket="${socket}" \
131134
--disk path="${cidata}" \
132-
--cmdline "rw console=ttyS0 reboot=k panic=1 root=vroot rootfstype=virtiofs rootdelay=30 init=${init}" \
135+
--cmdline "${cmdline}" \
133136
--serial tty \
134137
--console off
135138
}

0 commit comments

Comments
 (0)