Skip to content

Commit cb32b29

Browse files
committed
gem5: use --generate-dtb by default
1 parent f8d9514 commit cb32b29

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

run

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,17 @@ def main(args, extra_args=None):
200200
# TODO why is it mandatory to pass mem= here? Not true for QEMU.
201201
# Anything smaller than physical blows up as expected, but why can't it auto-detect the right value?
202202
'--command-line', 'earlyprintk=pl011,0x1c090000 lpj=19988480 rw loglevel=8 mem={} root=/dev/sda {}'.format(memory, kernel_cli), common.Newline,
203-
'--dtb-filename', os.path.join(common.gem5_system_dir, 'arm', 'dt', 'armv{}_gem5_v1_{}{}cpu.dtb'.format(common.armv, dp650_cmd, args.cpus)), common.Newline,
204203
'--machine-type', common.machine, common.Newline,
205204
])
205+
dtb = None
206+
if args.dtb is not None:
207+
dtb = args.dtb
208+
elif args.dp650:
209+
dtb = os.path.join(common.gem5_system_dir, 'arm', 'dt', 'armv{}_gem5_v1_{}{}cpu.dtb'.format(common.armv, dp650_cmd, args.cpus)), common.Newline,
210+
if dtb is None:
211+
cmd.extend(['--generate-dtb', common.Newline])
212+
else:
213+
cmd.extend(['--dtb-filename', dtb, common.Newline])
206214
if common.baremetal is None:
207215
cmd.extend([
208216
'--param', 'system.panic_on_panic = True', common.Newline
@@ -228,10 +236,11 @@ def main(args, extra_args=None):
228236
'--big-cpus', '2', common.Newline,
229237
'--cpu-type', cpu_type, common.Newline,
230238
'--disk', common.disk_image, common.Newline,
231-
'--dtb', os.path.join(common.gem5_system_dir, 'arm', 'dt', 'armv8_gem5_v1_big_little_2_2.dtb'), common.Newline,
232239
'--kernel', common.image, common.Newline,
233240
'--little-cpus', '2', common.Newline,
234241
])
242+
if args.dtb:
243+
cmd.extend(['--dtb', os.path.join(common.gem5_system_dir, 'arm', 'dt', 'armv8_gem5_v1_big_little_2_2.dtb'), common.Newline,])
235244
if args.wait_gdb:
236245
# https://stackoverflow.com/questions/49296092/how-to-make-gem5-wait-for-gdb-to-connect-to-reliably-break-at-start-kernel-of-th
237246
cmd.extend(['--param', 'system.cpu[0].wait_for_remote_gdb = True', common.Newline])
@@ -312,6 +321,8 @@ def main(args, extra_args=None):
312321
serial_monitor +
313322
vnc
314323
)
324+
if args.dtb is not None:
325+
cmd.extend(['-dtb', args.dtb, common.Newline])
315326
if not qemu_executable_prebuilt:
316327
cmd.extend(qemu_user_and_system_options)
317328
if args.initrd:
@@ -458,6 +469,13 @@ https://superuser.com/questions/1373226/how-to-redirect-qemu-serial-output-to-bo
458469
'-D', '--debug-vm', default=defaults['debug_vm'], nargs='?', action='store', const='',
459470
help='Run GDB on the emulator itself.'
460471
)
472+
parser.add_argument(
473+
'--dtb',
474+
help='''\
475+
Use the specified DTB file. If not given, let the emulator generate a DTB for us,
476+
which is what you usually want.
477+
'''
478+
)
461479
parser.add_argument(
462480
'-E', '--eval',
463481
help='''\

0 commit comments

Comments
 (0)