qemu_mips - CONFIG_SYS_MONITOR_LEN is too small
Hi all,
I recently tried to use u-boot on the qemu_mips platform, and running the saveenv command causes u-boot to not boot after a reset. I followed these steps:
$ git clone git://git.denx.de/u-boot.git $ cd u-boot $ git checkout v2017.05-rc1 $ export CROSS_COMPILE=mips-linux-gnu- $ make qemu_mips_defconfig $ make $ dd if=/dev/zero of=../flash.bin bs=1k count=4k $ dd if=u-boot.bin of=../flash.bin bs=1k conv=notrunc $ qemu-system-mips -nographic -M mips -pflash ../flash.bin
At this point I stopped autoboot, ran "saveenv" inside U-Boot, and reset qemu. After reset, U-Boot did not print any messages, and is stuck.
I tracked this down to an invalid CONFIG_SYS_MONITOR_LEN. It's currently configured for 196608 (192 << 10), but running "ls -l u-boot.bin" shows a size of 232296. When the environment is being saved, it overwrites part of the U-Boot code.
I am willing to write a patch for this bug, but I thought I would report it here first.
Kyle
Am 09.04.2017 um 20:19 schrieb Kyle Edwards:
Quoted 16 lines
Hi all,
I recently tried to use u-boot on the
qemu_mipsplatform, and running the saveenv command causes u-boot to not boot after a reset. I followed these steps:$ git clone git://git.denx.de/u-boot.git $ cd u-boot $ git checkout v2017.05-rc1 $ export CROSS_COMPILE=mips-linux-gnu- $ make qemu_mips_defconfig $ make $ dd if=/dev/zero of=../flash.bin bs=1k count=4k $ dd if=u-boot.bin of=../flash.bin bs=1k conv=notrunc $ qemu-system-mips -nographic -M mips -pflash ../flash.bin
Quoted 7 lines
At this point I stopped autoboot, ran "saveenv" inside U-Boot, and reset qemu. After reset, U-Boot did not print any messages, and is stuck.
I tracked this down to an invalid
CONFIG_SYS_MONITOR_LEN. It's currently configured for 196608 (192 << 10), but running "ls -l u-boot.bin" shows a size of 232296. When the environment is being saved, it overwrites part of the U-Boot code.
good catch, but your description is a little bit misleading. CONFIG_SYS_MONITOR_LEN is not used any more on MIPS. The main problem is the wrong env offset which is currently derived from CONFIG_SYS_MONITOR_LEN:
#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + CONFIG_SYS_MONITOR_LEN)
Quoted 4 lines
I am willing to write a patch for this bug, but I thought I would report it here first.
please do. Patches are always preferred to bug reports because we only have a patch-tracking system. Thus bug reports likely go missing whereas patches get picked up by a maintainer eventually.
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/20170411/806e202b/attachment.sig>