if options.dtb is not None:
system.dtb_filename = SysPaths.binary(options.dtb)
else:
- def create_dtb_for_system(system, filename):
- state = FdtState(addr_cells=2, size_cells=2, cpu_cells=1)
- rootNode = system.generateDeviceTree(state)
-
- fdt = Fdt()
- fdt.add_rootnode(rootNode)
- dtb_filename = os.path.join(m5.options.outdir, filename)
- return fdt.writeDtbFile(dtb_filename)
-
- system.dtb_filename = create_dtb_for_system(system, 'system.dtb')
+ system.generateDtb(m5.options.outdir, 'system.dtb')
return root
"with generation functionality.")
# Generate a Device Tree
- def create_dtb_for_system(system, filename):
- state = FdtState(addr_cells=2, size_cells=2, cpu_cells=1)
- rootNode = system.generateDeviceTree(state)
-
- fdt = Fdt()
- fdt.add_rootnode(rootNode)
- dtb_filename = os.path.join(m5.options.outdir, filename)
- return fdt.writeDtbFile(dtb_filename)
-
for sysname in ('system', 'testsys', 'drivesys'):
if hasattr(root, sysname):
sys = getattr(root, sysname)
- sys.dtb_filename = create_dtb_for_system(sys, '%s.dtb' % sysname)
+ sys.generateDtb(m5.options.outdir, '%s.dtb' % sysname)
Simulation.setWorkCountOptions(test_sys, options)
Simulation.run(options, root, test_sys, FutureClass)
# Glenn Bergmans
from m5.params import *
+from m5.options import *
from m5.SimObject import *
from m5.util.fdthelper import *
panic_on_oops = Param.Bool(False, "Trigger a gem5 panic if the " \
"guest kernel oopses")
+ def generateDtb(self, outdir, filename):
+ """
+ Autogenerate DTB. Arguments are the folder where the DTB
+ will be stored, and the name of the DTB file.
+ """
+ state = FdtState(addr_cells=2, size_cells=2, cpu_cells=1)
+ rootNode = self.generateDeviceTree(state)
+
+ fdt = Fdt()
+ fdt.add_rootnode(rootNode)
+ dtb_filename = os.path.join(outdir, filename)
+ self.dtb_filename = fdt.writeDtbFile(dtb_filename)
+
class LinuxArmSystem(GenericArmSystem):
type = 'LinuxArmSystem'
cxx_header = "arch/arm/linux/system.hh"