Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the workaround code from fel-sdboot.c (and possibly uart0-helloworld) #48

Open
n1tehawk opened this issue May 14, 2016 · 3 comments

Comments

@n1tehawk
Copy link
Collaborator

The root cause of the problems that surfaced with these ARM binaries is that the U-Boot mksunxiboot utility writes a minimal header that is too small to avoid corruption of actual code by the BROM bootloader. See https://patchwork.ozlabs.org/patch/622173.

Once this is fixed (in upstream U-Boot), we should probably revert the NOP padding used in fel-sdboot.c to circumvent this. The uart0-helloworld-sdboot.sunxi under development currently also contains a workaround that won't be needed any more afterwards.

@n1tehawk n1tehawk added the todo label May 14, 2016
@ssvb
Copy link
Contributor

ssvb commented May 19, 2016

Yes, the workaround needs to be at least changed to branch over the corrupted location. The description at

sunxi-tools/fel-sdboot.c

Lines 41 to 50 in ce9cf33

/*
* FEL mode fails to activate in an unpredictable way without
* this NOP padding. Minor changes in the code, such as checking
* the PC register (PC >= 0x10000) instead of SCTLR.V or doing
* jump instead of call to the FEL handler in the BROM sometimes
* break on A64 and sometimes break on A10/A13/A20. Trying to
* add DSB & ISB instructions and/or invalidating caches and
* BTB do not seem to make any difference. Only adding a bunch
* of NOP instructions in the beginning helps.
*/
also needs to be updated. It did accurately state the facts, but now we have more information.

As for removing the workaround completely, some people may still try to recompile these binaries and use a buggy mksunxiboot tool while doing this. It might be safer to keep the workarounds at least for a year or so, maybe even longer.

@n1tehawk
Copy link
Collaborator Author

Okay, i'll tag this as "wontfix" for the time being - so the issue can be left open until we decide that a sane mksunxiboot should have made it everywhere, and the workaround gets finally removed.

@n1tehawk
Copy link
Collaborator Author

Note: U-Boot release v2016.07 contains the related commit that fixes SPL header size, and thus mksunxiboot operation. Images created with this (or a later) version account for the field written by the BROM, i.e. they should no longer suffer from code corruption.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants