scripts: Support a root disk connected via virtio-scsi
Sometimes it is useful to use SCSI instead of the plain virtio. Add a -S option to connect the root disk via SCSI. Drop the -S for --sct-seq since it is a less common option. Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -52,7 +52,7 @@ def parse_args():
|
||||
parser.add_argument('-x', '--xpl', action='store_true',
|
||||
help='Use xPL image rather than U-Boot proper')
|
||||
parser.add_argument(
|
||||
'-S', '--sct-seq',
|
||||
'--sct-seq',
|
||||
help='SCT sequence-file to be written into the SCT image if -e')
|
||||
parser.add_argument('-v', '--verbose', action='store_true',
|
||||
help='Show executed commands')
|
||||
|
||||
@@ -26,6 +26,8 @@ from u_boot_pylib import tools
|
||||
from u_boot_pylib import tout
|
||||
import fs_helper
|
||||
|
||||
MODERN_PCI = 'disable-legacy=on,disable-modern=off'
|
||||
|
||||
|
||||
class Helper:
|
||||
def __init__(self, args):
|
||||
@@ -163,13 +165,18 @@ sct_mnt = /mnt/sct
|
||||
|
||||
if self.img_fname:
|
||||
if self.img_fname.exists():
|
||||
iface = 'none' if args.scsi else 'virtio'
|
||||
if args.scsi:
|
||||
cmd.extend([
|
||||
'-device',
|
||||
f'virtio-scsi-pci,id=scsi0,{MODERN_PCI}',
|
||||
'-device', 'scsi-hd,bus=scsi0.0,drive=hd0'])
|
||||
cmd.extend([
|
||||
'-drive',
|
||||
f'if=virtio,file={self.img_fname},format=raw,id=hd1'])
|
||||
f'if={iface},file={self.img_fname},format=raw,id=hd0'])
|
||||
else:
|
||||
tout.warning(f"Disk image '{self.img_fname}' not found")
|
||||
|
||||
|
||||
def add_common_args(parser):
|
||||
"""Add some arguments which are common to build-efi/qemu scripts
|
||||
|
||||
@@ -200,6 +207,9 @@ def add_common_args(parser):
|
||||
help='Select OS release version (e.g, 24.04) Default: 24.04.1')
|
||||
parser.add_argument('-s', '--serial-only', action='store_true',
|
||||
help='Run QEMU with serial only (no display)')
|
||||
parser.add_argument(
|
||||
'-S', '--scsi', action='store_true',
|
||||
help='Attach root disk using virtio-sci instead of virtio-blk')
|
||||
parser.add_argument(
|
||||
'-t', '--root',
|
||||
help='Pass the given root device to linux via root=xxx')
|
||||
|
||||
Reference in New Issue
Block a user