make configurable default memory size and minimum disk size
This commit is contained in:
parent
68fb5be67a
commit
50d32d2cba
@ -21,13 +21,15 @@
|
||||
# shellcheck source=/usr/lib/libretools/messages.sh
|
||||
source "$(librelib messages)"
|
||||
|
||||
readonly DEF_RAM_MB=1000
|
||||
|
||||
|
||||
usage() {
|
||||
print "USAGE: %s [-h] <img> [qemu-args ...]" "${0##*/}"
|
||||
prose "Determine the architecture of <img> and boot it using qemu. <img> is assumed
|
||||
to be a valid, raw-formatted parabola virtual machine image, ideally
|
||||
created using pvmbootstrap. The started instance is assigned 1G of
|
||||
RAM and one SMP core."
|
||||
created using pvmbootstrap. The started instance is assigned
|
||||
${DEF_RAM_MB}MB of RAM and one SMP core."
|
||||
echo
|
||||
prose "When a graphical desktop environment is available, start the machine
|
||||
normally, otherwise append -nographic to the qemu options. This behavior
|
||||
@ -129,13 +131,13 @@ pvm_guess_qemu_args() {
|
||||
local kernel_console
|
||||
case "$2" in
|
||||
i386|x86_64|ppc64)
|
||||
qemu_args+=(-m 1G -hda "$1")
|
||||
qemu_args+=(-m $DEF_RAM_MB -hda "$1")
|
||||
# unmount the unneeded virtual drive early
|
||||
pvm_umount ;;
|
||||
arm)
|
||||
kernel_console="console=tty0 console=ttyAMA0 "
|
||||
qemu_args+=(-machine virt
|
||||
-m 1G
|
||||
-m $DEF_RAM_MB
|
||||
-kernel "$workdir"/vmlinuz-linux-libre
|
||||
-initrd "$workdir"/initramfs-linux-libre.img
|
||||
-append "${kernel_console}rw root=/dev/vda3"
|
||||
@ -146,7 +148,7 @@ pvm_guess_qemu_args() {
|
||||
riscv64)
|
||||
kernel_console=$( [ -z "$DISPLAY" ] && echo "console=ttyS0 " )
|
||||
qemu_args+=(-machine virt
|
||||
-m 1G
|
||||
-m $DEF_RAM_MB
|
||||
-kernel "$workdir"/bbl
|
||||
-append "${kernel_console}rw root=/dev/vda"
|
||||
-drive "file=${loopdev}p3,format=raw,id=hd0"
|
||||
|
@ -52,7 +52,7 @@ usage() {
|
||||
echo " -M <mirror> Specify a different mirror from which to fetch packages"
|
||||
echo " (default: $DEF_MIRROR)"
|
||||
echo " -O Bootstrap an openrc system instead of a systemd one"
|
||||
echo " -s <img_size> Set the size (in GB) of the VM image (default: $DEF_IMG_GB)"
|
||||
echo " -s <img_size> Set the size (in GB) of the VM image (minimum: $MIN_GB, default: $DEF_IMG_GB)"
|
||||
echo
|
||||
echo "Pre-defined hooks:"
|
||||
echo " ethernet-dhcp: Configure and enable an ethernet device in the virtual"
|
||||
@ -390,9 +390,10 @@ main() {
|
||||
|
||||
local shiftlen=$(( OPTIND - 1 ))
|
||||
shift $shiftlen
|
||||
if [ "$#" -ne 2 ]; then usage >&2; exit "$EXIT_INVALIDARGUMENT"; fi
|
||||
local file="$1"
|
||||
local arch="$2"
|
||||
[ "$#" -ne 2 ] && usage >&2 && exit "$EXIT_INVALIDARGUMENT"
|
||||
[ "$ImgSizeGb" -lt $MIN_GB ] && usage >&2 && exit "$EXIT_INVALIDARGUMENT"
|
||||
|
||||
# determine if the target arch is supported
|
||||
case "$arch" in
|
||||
|
Loading…
Reference in New Issue
Block a user