Skip to content
Snippets Groups Projects
Unverified Commit ba3e8345 authored by nl6720's avatar nl6720
Browse files

scripts/run_archiso.sh: support booting the image as a hard disk or an optical disc

Use virtio-scsi to attach the image. virtio-blk (if=virtio) is inconsistent about the used media type.
parent 55d9d1ff
No related branches found
No related tags found
1 merge request!66run_archiso.sh improvements
Pipeline #1074 passed
...@@ -22,6 +22,7 @@ Usage: ...@@ -22,6 +22,7 @@ Usage:
Options: Options:
-b set boot type to 'BIOS' (default) -b set boot type to 'BIOS' (default)
-d set image type to hard disk instead of optical disc
-h print help -h print help
-i [image] image to boot into -i [image] image to boot into
-s use Secure Boot (only relevant when using UEFI) -s use Secure Boot (only relevant when using UEFI)
...@@ -80,7 +81,9 @@ run_image() { ...@@ -80,7 +81,9 @@ run_image() {
-m "size=3072,slots=0,maxmem=$((3072*1024*1024))" \ -m "size=3072,slots=0,maxmem=$((3072*1024*1024))" \
-k en \ -k en \
-name archiso,process=archiso_0 \ -name archiso,process=archiso_0 \
-drive file="${image}",media=cdrom,readonly=on,if=virtio \ -device virtio-scsi-pci,id=scsi0 \
-device "scsi-${mediatype%rom},bus=scsi0.0,drive=${mediatype}0" \
-drive "id=${mediatype}0,if=none,format=raw,media=${mediatype/hd/disk},readonly=on,file=${image}" \
-display sdl \ -display sdl \
-vga virtio \ -vga virtio \
-device virtio-net-pci,romfile=,netdev=net0 -netdev user,id=net0 \ -device virtio-net-pci,romfile=,netdev=net0 -netdev user,id=net0 \
...@@ -105,17 +108,21 @@ set_image() { ...@@ -105,17 +108,21 @@ set_image() {
image='' image=''
boot_type='bios' boot_type='bios'
mediatype='cdrom'
secure_boot='off' secure_boot='off'
qemu_options=() qemu_options=()
working_dir="$(mktemp -dt run_archiso.XXXXXXXXXX)" working_dir="$(mktemp -dt run_archiso.XXXXXXXXXX)"
trap cleanup_working_dir EXIT trap cleanup_working_dir EXIT
if (( ${#@} > 0 )); then if (( ${#@} > 0 )); then
while getopts 'bhi:su' flag; do while getopts 'bdhi:su' flag; do
case "$flag" in case "$flag" in
b) b)
boot_type='bios' boot_type='bios'
;; ;;
d)
mediatype='hd'
;;
h) h)
print_help print_help
exit 0 exit 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment