arm_boot: Conditionalised DTB command line update
authorPeter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Sun, 17 Jun 2012 15:35:36 +0000 (15:35 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Tue, 19 Jun 2012 13:24:44 +0000 (13:24 +0000)
The DTB command line should only be overwritten if the user provides a command
line with -append. Otherwise whatever command line was in the DTB should stay
unchanged.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/arm_boot.c

index d0e643ba11130ae6f23f3f84912584036b6c21c4..a1e6ddbc1c01b4ee9740c012cd2aea6accb11b00 100644 (file)
@@ -242,10 +242,12 @@ static int load_dtb(target_phys_addr_t addr, const struct arm_boot_info *binfo)
         fprintf(stderr, "couldn't set /memory/reg\n");
     }
 
-    rc = qemu_devtree_setprop_string(fdt, "/chosen", "bootargs",
-                                      binfo->kernel_cmdline);
-    if (rc < 0) {
-        fprintf(stderr, "couldn't set /chosen/bootargs\n");
+    if (binfo->kernel_cmdline && *binfo->kernel_cmdline) {
+        rc = qemu_devtree_setprop_string(fdt, "/chosen", "bootargs",
+                                          binfo->kernel_cmdline);
+        if (rc < 0) {
+            fprintf(stderr, "couldn't set /chosen/bootargs\n");
+        }
     }
 
     if (binfo->initrd_size) {