[U-Boot] [PATCH]: U-Boot build failure with CONFIG_SYS_NO_FLASH defined for qemu-mips.

Himanshu Chauhan himanshu at symmetricore.com
Fri Dec 18 14:03:58 CET 2009


U-Boot hangs with qemu-system-mips with ##unknown flash error.
Disabling flash using CONFIG_SYS_NO_FLASH breaks the build.
This patch fixes the issue. Don't know if its okay.

Signed-off-by: Himanshu Chauhan <himanshu at symmetricore.com>

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index efd6aec..5bd3af0 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -76,7 +76,7 @@ extern void bz_internal_error(int);
 static int image_info (unsigned long addr);
 #endif

-#if defined(CONFIG_CMD_IMLS)
+#if !defined(CONFIG_SYS_NO_FLASH) && defined(CONFIG_CMD_IMLS)
 #include <flash.h>
 extern flash_info_t flash_info[]; /* info for FLASH chips */
 static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
@@ -1153,7 +1153,7 @@ U_BOOT_CMD(
 /*******************************************************************/
 /* imls - list all images found in flash */
 /*******************************************************************/
-#if defined(CONFIG_CMD_IMLS)
+#if !defined(CONFIG_SYS_NO_FLASH) && defined(CONFIG_CMD_IMLS)
 int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
 	flash_info_t *info;
diff --git a/drivers/mtd/cfi_flash.c b/drivers/mtd/cfi_flash.c
index 24eb33f..06c7271 100644
--- a/drivers/mtd/cfi_flash.c
+++ b/drivers/mtd/cfi_flash.c
@@ -41,6 +41,7 @@
 #include <environment.h>
 #include <mtd/cfi_flash.h>

+#ifndef CONFIG_SYS_NO_FLASH
 /*
  * This file implements a Common Flash Interface (CFI) driver for
  * U-Boot.
@@ -2020,3 +2021,5 @@ unsigned long flash_init (void)

 	return (size);
 }
+
+#endif
diff --git a/include/configs/qemu-mips.h b/include/configs/qemu-mips.h
index cbacdf9..49a1a1c 100644
--- a/include/configs/qemu-mips.h
+++ b/include/configs/qemu-mips.h
:q
@@ -142,6 +142,7 @@
 #define CONFIG_SYS_INIT_SP_OFFSET	0x400000

 /* We boot from this flash, selected with dip switch */
+#define CONFIG_SYS_NO_FLASH
 #define CONFIG_SYS_FLASH_BASE		0xbfc00000
 #define CONFIG_SYS_MAX_FLASH_BANKS	1
 #define CONFIG_SYS_MAX_FLASH_SECT	128
@@ -149,7 +150,8 @@
 #define CONFIG_FLASH_CFI_DRIVER	1
 #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE	1

-#define CONFIG_ENV_IS_IN_FLASH	1
+#define CONFIG_ENV_IS_IN_FLASH	0
+#define CONFIG_ENV_IS_NOWHERE
 #define CONFIG_ENV_ADDR		(CONFIG_SYS_FLASH_BASE + CONFIG_SYS_MONITOR_LEN)

 /* Address and size of Primary Environment Sector */
diff --git a/include/mtd/cfi_flash.h b/include/mtd/cfi_flash.h
index 2aa6911..2229ddf 100644
--- a/include/mtd/cfi_flash.h
+++ b/include/mtd/cfi_flash.h
@@ -151,7 +151,8 @@ struct cfi_pri_hdr {
 	u8	minor_version;
 } __attribute__((packed));

-void flash_write_cmd(flash_info_t * info, flash_sect_t sect,
-		     uint offset, u32 cmd);
+#ifndef CONFIG_SYS_NO_FLASH
+void flash_write_cmd(flash_info_t * info, flash_sect_t sect, uint offset, u32 cmd);
+#endif

 #endif /* __CFI_FLASH_H__ */



More information about the U-Boot mailing list