arm: add device tree support
PATCH 1/1 arm: add device tree support
From: Grant Likely <[email protected]>
If compiled with CONFIG_FDT, allow user to specify a device tree file using the -dtb argument. If the machine supports it then the dtb will be loaded into memory and passed to the kernel on boot.
Signed-off-by Jeremy Kerr <[email protected]>
Signed-off-by Grant Likely <[email protected]>
[Peter Maydell: Use machine opt rather than global to pass dtb filename]
Signed-off-by Peter Maydell <[email protected]>
---
As http://patchwork.ozlabs.org/patch/140066/ (4/4 in that series) but
* rebased on current master
* fixed a bug I accidentally introduced that meant we never passed the initrd to the kernel if using device tree
Anthony and Andrzej between them have applied patches 1-3 of that series so as Anthony suggests I'll put this one in my next arm-devs pullreq...
Makefile.target | 1 + configure | 1 + hw/arm-misc.h | 1 + hw/arm_boot.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++--- qemu-config.c | 4 ++ qemu-options.hx | 9 +++++ vl.c | 9 +++++ 7 files changed, 116 insertions(+), 6 deletions(-)
Makefile.target +1 -0
@@ -372,6 +372,7 @@ obj-arm-y += vexpress.o obj-arm-y += strongarm.o obj-arm-y += collie.o obj-arm-y += pl041.o lm4549.o +obj-arm-$(CONFIG_FDT) += device_tree.o obj-sh4-y = shix.o r2d.o sh7750.o sh7750_regnames.o tc58128.o obj-sh4-y += sh_timer.o sh_serial.o sh_intc.o sh_pci.o sm501.o
configure +1 -0
@@ -3457,6 +3457,7 @@ case "$target_arch2" in gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml" target_phys_bits=32 target_llong_alignment=4 + target_libs_softmmu="$fdt_libs" ;; cris) target_nptl="yes"
hw/arm-misc.h +1 -0
@@ -29,6 +29,7 @@ struct arm_boot_info {const char *kernel_filename;const char *kernel_cmdline;const char *initrd_filename; +const char *dtb_filename;target_phys_addr_t loader_start;/* multicore boards that use the default secondary core boot functions * need to put the address of the secondary boot code, the boot reg,
hw/arm_boot.c +91 -6
139 lines not on this page · raw message
qemu-config.c +4 -0
@@ -578,6 +578,10 @@ static QemuOptsList qemu_machine_opts = { .name = "append", .type = QEMU_OPT_STRING, .help = "Linux kernel command line", + }, { + .name = "dtb", + .type = QEMU_OPT_STRING, + .help = "Linux kernel device tree file", }, {/* End of list */ } },
qemu-options.hx +9 -0
@@ -2037,6 +2037,15 @@ Use @var{file1} and @var{file2} as modules and pass arg=foo as parameter to the first module. ETEXI +DEF("dtb", HAS_ARG, QEMU_OPTION_dtb, \ + "-dtb file use 'file' as device tree image\n", QEMU_ARCH_ARM) +STEXI +@item -dtb @var{file} +@findex -dtb +Use @var{file} as a device tree binary (dtb) image and pass it to the kernel +on boot. +ETEXI + STEXI @end table ETEXI
vl.c +9 -0
@@ -2453,6 +2453,9 @@ int main(int argc, char **argv, char **envp)case QEMU_OPTION_append:qemu_opts_set (qemu_find_opts ("machine" ),0 ,"append" , optarg);break ; +case QEMU_OPTION_dtb: +qemu_opts_set (qemu_find_opts ("machine" ),0 ,"dtb" , optarg); +break ;case QEMU_OPTION_cdrom:drive_add (IF_DEFAULT ,2 , optarg,CDROM_OPTS );break ;
@@ -3269,6 +3272,12 @@ int main(int argc, char **argv, char **envp)exit (1 ); } +if (!linux_boot + &&qemu_opt_get (qemu_opts_find (qemu_find_opts ("machine" ),0 ),"dtb" )) { +fprintf (stderr,"-dtb only allowed with -kernel option\n" ); +exit (1 ); + } +os_set_line_buffering ();if (init_timer_alarm () <0 ) {
Signature · 1 line
1.7.1