diff mbox

[U-Boot,v3,09/13] cmd: qfw: do not require default macros when building qfw command

Message ID 1463971042-24531-10-git-send-email-yanmiaobest@gmail.com
State Accepted
Delegated to: Bin Meng
Headers show

Commit Message

Miao Yan May 23, 2016, 2:37 a.m. UTC
The qfw command interface makes use of CONFIG_LOADADDR and
CONFIG_RAMDISKADDR to setup kernel. But not all boards have these macros,
which causes build problem on those platforms.

This patch fixes this issue.

Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
---
Changes in v3:
 - none

 cmd/qfw.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

Comments

Bin Meng May 23, 2016, 6:24 a.m. UTC | #1
On Mon, May 23, 2016 at 10:37 AM, Miao Yan <yanmiaobest@gmail.com> wrote:
> The qfw command interface makes use of CONFIG_LOADADDR and
> CONFIG_RAMDISKADDR to setup kernel. But not all boards have these macros,
> which causes build problem on those platforms.
>
> This patch fixes this issue.
>
> Signed-off-by: Miao Yan <yanmiaobest@gmail.com>
> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
> ---
> Changes in v3:
>  - none
>
>  cmd/qfw.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
>

applied to u-boot-x86, thanks!
diff mbox

Patch

diff --git a/cmd/qfw.c b/cmd/qfw.c
index c6730bf..12436ec 100644
--- a/cmd/qfw.c
+++ b/cmd/qfw.c
@@ -126,12 +126,20 @@  static int qemu_fwcfg_do_load(cmd_tbl_t *cmdtp, int flag,
 	env = getenv("loadaddr");
 	load_addr = env ?
 		(void *)simple_strtoul(env, NULL, 16) :
+#ifdef CONFIG_LOADADDR
 		(void *)CONFIG_LOADADDR;
+#else
+		NULL;
+#endif
 
 	env = getenv("ramdiskaddr");
 	initrd_addr = env ?
 		(void *)simple_strtoul(env, NULL, 16) :
+#ifdef CONFIG_RAMDISK_ADDR
 		(void *)CONFIG_RAMDISK_ADDR;
+#else
+		NULL;
+#endif
 
 	if (argc == 2) {
 		load_addr = (void *)simple_strtoul(argv[0], NULL, 16);
@@ -140,6 +148,11 @@  static int qemu_fwcfg_do_load(cmd_tbl_t *cmdtp, int flag,
 		load_addr = (void *)simple_strtoul(argv[0], NULL, 16);
 	}
 
+	if (!load_addr || !initrd_addr) {
+		printf("missing load or initrd address\n");
+		return CMD_RET_FAILURE;
+	}
+
 	return qemu_fwcfg_setup_kernel(load_addr, initrd_addr);
 }