configs: Make --disk-image optional in baremetal.py
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Fri, 20 Mar 2020 19:07:45 +0000 (19:07 +0000)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Wed, 25 Mar 2020 09:37:26 +0000 (09:37 +0000)
Since the script could be used to run baremetal applications, we don't
have to enforce the presence of a disk image

Change-Id: I511515361cfd7a2e06ede0df3ddcc595de15f38b
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26992
Tested-by: Gem5 Cloud Project GCB service account <345032938727@cloudbuild.gserviceaccount.com>
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Ciro Santilli <ciro.santilli@arm.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>

configs/example/arm/baremetal.py

index c1628934bd79b3618e51a2229d9b9dcb6c348286..c691a7d82e7589a45415ba214bf698c5c9f9f0d5 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2016-2017,2019 ARM Limited
+# Copyright (c) 2016-2017,2019-2020 ARM Limited
 # All rights reserved.
 #
 # The license below extends only to copyright in the software and shall
@@ -104,22 +104,23 @@ def create(args):
 
     MemConfig.config_mem(args, system)
 
-
     # Add the PCI devices we need for this system. The base system
     # doesn't have any PCI devices by default since they are assumed
     # to be added by the configurastion scripts needin them.
-    system.pci_devices = [
+    pci_devices = []
+    if args.disk_image:
         # Create a VirtIO block device for the system's boot
         # disk. Attach the disk image using gem5's Copy-on-Write
         # functionality to avoid writing changes to the stored copy of
         # the disk image.
-        PciVirtIO(vio=VirtIOBlock(image=create_cow_image(args.disk_image))),
-    ]
+        system.disk = PciVirtIO(vio=VirtIOBlock(
+            image=create_cow_image(args.disk_image)))
+        pci_devices.append(system.disk)
 
     # Attach the PCI devices to the system. The helper method in the
     # system assigns a unique PCI bus ID to each of the devices and
     # connects them to the IO bus.
-    for dev in system.pci_devices:
+    for dev in pci_devices:
         system.attach_pci(dev)
 
     # Wire up the system's memory system