0

This is my script:

KERNEL_CFG="-kernel Image -append \"root=/dev/vda1 nokaslr console=ttyAMA0 earlycon=pl011,mmio,0x09000000\""
DISK_CFG="-drive if=none,file=$DISKFILE,format=qcow2,id=hd1 -device virtio-blk-pci,drive=hd1,bootindex=0"

sudo ./qemu-system-aarch64 \
        -machine virt -cpu host -accel kvm \
        -bios QEMU_EFI.fd \
        -nographic \
        -net user,hostfwd=tcp::2222-:22 -net nic \
        -smp cpus=8 \
        -m 4G \
        $KERNEL_CFG \
        $DISK_CFG 

It returns:

sudo ./qemu-system-aarch64 -machine virt -cpu host -accel kvm -bios QEMU_EFI.fd -nographic -net user,hostfwd=tcp::2222-:22 -net nic -smp cpus=8 -m 4G -kernel Image -append '"root=/dev/vda1' nokaslr console=ttyAMA0 'earlycon=pl011,mmio,0x09000000"' -drive if=none,file=debian-10-nocloud-arm64-20230601-1398.qcow2,format=qcow2,id=hd0 -device virtio-blk-pci,drive=hd0,bootindex=1
qemu-system-aarch64: nokaslr: Could not open 'nokaslr': No such file or directory

How to input a full cmdline to qemu?

Input a full cmdline to qemu.

  • 1
    Use an array to store options as: `KERNEL_CFG=(-kernel Image -append "root=/dev/vda1 nokaslr console=ttyAMA0 earlycon=pl011,mmio,0x09000000")` and put it in the command line as `"${KERNEL_CFG[@]}"` in place of `$KERNEL_CFG`. – tshiono Jul 19 '23 at 07:36
  • Use arrays. (Also, avoid uppercase variable names; they are (by convention) reserved for environment variables, which you don’t want to change in most cases.) – Andrej Podzimek Jul 21 '23 at 12:35

0 Answers0