[LEDE-DEV] Kirkwood Audi U-Boot fw_setenv errors
David Gilman
dgilman at gilslotd.com
Sun Jun 26 15:40:54 PDT 2016
Claudio, I have a Kirkwood EA3500 (Audi) board and it seems that at some
point the patches for this board have regressed the uboot fw_setenv
utility and semi-bricked my machine. I've been digging into this issue
and I suspect there was some value missed somewhere but I would like to
hear some feedback from you and am willing to dig around on this box to
help you troubleshoot the issue.
I find it pretty tricky to time the dual firmware resetting feature in
the board's uboot (I think I've gotten it to work for me once...) so I
prefer to set the uboot variables directly to switch what partition I'm
booting from. When I do so with a `fw_setenv boot_part 1':
Read error on /dev/mtd1: No error information
Error: can't write fw_env to flash
At one point I think this worked, but I'm not sure when it regressed.
The "No error information" is from an errno of 0, so the read worked,
but uboot bailed out anyway. I ran the utility under strace:
_llseek(4, 0, [0], SEEK_SET) = 0
read(4, "7b\23\200bootdelay=0\0baudrate=115200\0"..., 131072) = 16384
writev(2, [{"Read error on /dev/mtd1: No erro"..., 46}, {NULL, 0}], 2) = 46
close(4) = 0
writev(2, [{"", 0}, {"Error: can't write fw_env to fla"..., 35}], 2) = 35
The read() there returned 16384 (0x4000) although we asked it for 131072
bytes (0x20000). That is why fw_setenv fails, if you look at the source
code inside uboot it bails out like this when those two aren't equal.
For reference, this is fw_env.c line 734 in uboot:
https://github.com/trini/u-boot/blob/master/tools/env/fw_env.c#L734
The 0x20000 argument comes from CUR_ENVSIZE which is where I lose the
trail on where these magic numbers are coming from. However, I am
seeing these magic numbers in a patch you authored: "kirkwood: rework
Linksys EA[34]500 DTS". If you look at the diff there, you'll see those
magic numbers 0x4000 and 0x20000 popping up again. So I am not sure
what's the way to go forward here but at the moment I can't write to any
flash (to change uboot variables or flash a new root partition) so I am
sort of stuck.
--
David Gilman :DG<
http://gilslotd.com
More information about the Lede-dev
mailing list