Skip to contentSkip to conversation

Fix several bugs in qemu-mips configuration

PATCH Superseded Kyle Edwards 2 participants 4 messages Apr 11, 2017 – Apr 12, 2017

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Fix several bugs in qemu-mips configuration

I recently played around with the qemu-mips configuration, and encountered several issues. Saving the environment to flash overwrites the U-Boot code, and the malloc pool isn't big enough for initr_malloc_bootparams(). This patchset fixes these issues.

Kyle Edwards (2):
mips: qemu-mips: Remove obsolete CONFIG_SYS_MONITOR_LEN from config
mips: qemu-mips: Expand malloc pool to fit CONFIG_SYS_BOOTPARAMS_LEN

 include/configs/qemu-mips.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 mips: qemu-mips: Remove obsolete CONFIG_SYS_MONITOR_LEN from config

This fixes an issue with the saveenv command causing U-Boot to no longer work on the QEMU Mips pseudoboard. Because the offset of the environment was being determined by CONFIG_SYS_MONITOR_LEN, and this value was less than the actual size of U-Boot, saveenv was overwriting parts of the U-Boot code. Because CONFIG_SYS_MONITOR_LEN is no longer used on MIPS, this patch removes it and places the environment at the end of the pseudoboard's 4MB flash.

Cc Daniel Schwierzeck <[email protected]>
---
 include/configs/qemu-mips.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
include/configs/qemu-mips.h +1 -2
index be7f4f2..b67d413 100644
@@ -102,7 +102,6 @@
  */
 /* The following #defines are needed to get flash environment right */
 #define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE
-#define CONFIG_SYS_MONITOR_LEN		(192 << 10)
 
 #define CONFIG_SYS_INIT_SP_OFFSET	0x400000
 
@@ -115,10 +114,10 @@
 #define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
 
 #define CONFIG_ENV_IS_IN_FLASH
-#define CONFIG_ENV_ADDR		(CONFIG_SYS_FLASH_BASE + CONFIG_SYS_MONITOR_LEN)
 
 /* Address and size of Primary Environment Sector */
 #define CONFIG_ENV_SIZE		0x8000
+#define CONFIG_ENV_ADDR		(CONFIG_SYS_FLASH_BASE + (4 << 20) - CONFIG_ENV_SIZE)
 
 #define CONFIG_ENV_OVERWRITE	1
 
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 mips: qemu-mips: Expand malloc pool to fit CONFIG_SYS_BOOTPARAMS_LEN

In reply to Kyle Edwards

Before this patch, CONFIG_SYS_BOOTPARAMS_LEN was the same size as CONFIG_SYS_MALLOC_LEN. So, if malloc() had previously been called, and initr_malloc_bootparams() was called, it would fail with an out-of- memory error. This patch fixes this issue by expanding the malloc pool to 256KB.

Cc Daniel Schwierzeck <[email protected]>
---
 include/configs/qemu-mips.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/qemu-mips.h +1 -1
index b67d413..59a793b 100644
@@ -80,7 +80,7 @@
 /* max number of command args */
 #define CONFIG_SYS_MAXARGS		16
 
-#define CONFIG_SYS_MALLOC_LEN		128*1024
+#define CONFIG_SYS_MALLOC_LEN		(256 << 10)
 
 #define CONFIG_SYS_BOOTPARAMS_LEN	128*1024
 
Signature · 1 line
2.7.4
#3 lore raw

cover Fix several bugs in qemu-mips configuration

In reply to Kyle Edwards

Am 12.04.2017 um 01:06 schrieb Kyle Edwards:

Quoted 5 lines

I recently played around with the qemu-mips configuration, and encountered several issues. Saving the environment to flash overwrites the U-Boot code, and the malloc pool isn't big enough for initr_malloc_bootparams(). This patchset fixes these issues.

Quoted 7 lines

Kyle Edwards (2):
mips: qemu-mips: Remove obsolete CONFIG_SYS_MONITOR_LEN from config
mips: qemu-mips: Expand malloc pool to fit CONFIG_SYS_BOOTPARAMS_LEN

 include/configs/qemu-mips.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

could you also fix include/configs/qemu-mips64.h? Thanks.

Signature · 9 lines
- Daniel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20170412/9ebb1dd6/attachment.sig>