[PATCH 3/3] imx-bbu-nand-fcb: Add command to help debug FCB issues
Trent Piepho
trent.piepho at igorinstitute.com
Wed Oct 13 03:14:01 PDT 2021
On Tue, Oct 12, 2021 at 1:21 AM Sascha Hauer <sha at pengutronix.de> wrote:
> On Mon, Oct 11, 2021 at 06:53:59PM -0700, Trent Piepho wrote:
> > Add new "fcb" command. It can save a decoded copy of the FCB to a file,
> > do a hexdump of the decoded FCB, or display the FCB fields. Or simply
> > read and validate the FCB.
> Not sure if we need to control this command in such a fine grained way.
> For me just extracting all possible FCBs including the firmware images,
> maybe printing consistency information would be enough. That's just a
> personal opinion though, feel free to override it.
Originally I was having issues creating correct FCBs, mostly due to
kobs-ng (I wonder how hard it would be to port barebox_update to
Linux?) and wanted to extract factory FCB and kobs-ng generated FCB.
But copying data from Barebox to Linux and looking at hexdumps was
very tedious. Really, one wants to see fields of FCB decoded and
Barebox already had code that did this.
So the -i flag that prints out FCB fields and -o to save a copy were
what I wrote originally as debug aid, with -i the most useful to me.
I don't actually want to extract firmware images. It was the FCB that
was the issue. I didn't think it would be useful enough to other
people to bother sending it to the list.
But then later there was a thread from Yunas at Phytec about the
difficulty of doing a flash crc check on NAND when one does not know
where data will be due to possible bad blocks. Extracting this
information from the FCB seemed like the correct way to do it and I
realized it would be easy to add into the command I had written. So
that is why this feature is there. And this was evidence that this
would be useful to someone besides myself.
I added hexdump because it seemed like someone might like it and it
was one line. I could drop this part.
Extracting all possible FCBs has issues. Number and location of FCBs
varies. Pin strapping and possibly OTP memory fuses control what the
boot ROM does. However, the boot ROM's search, what is actually in
flash, and what kobs-ng wants to write, can all be different. I did
write this debug aid for a real problem!
If it did just write dump everything, then how would it work? Some
details are not clear to me.
Where does the data go? Assume /tmp? Or argument to supply directory name?
It will need multiple files. How to name? Arguments for each
filename? Seems too many arguments. Or have a fixed filename
pattern? FCB1, FCB2, firmware1.img, firmware2.img, etc. Not really a
huge fan of hardcoded filenames.
What happens if the FCBs are not where Barebox thinks they are? This
really does happen.
What if all the FCBs do not agree on the location/size of the firmware images?
Is it possible extra space used to dump firmware copies into /tmp,
then crc the copies matters vs doing it in place from flash?
What if someone wants to script something with firmware images other
than a checksum? E.g., they want to erase firmware1 to test that
fallback to firmware2 works. Or want to know how large the firmware
is. I do not know of a way to get the size of a file in hush.
More information about the barebox
mailing list