[Lenny400] Patches for linux-stable
H. Nikolaus Schaller
hns at goldelico.com
Sun Sep 3 11:17:28 CEST 2017
> Am 02.09.2017 um 22:59 schrieb Paul Boddie <paul at boddie.org.uk>:
> On Saturday 2. September 2017 21.25.37 H. Nikolaus Schaller wrote:
>> Indeed. I don't see it as high priority. Especially since it is easy to
>> brick the device by overwriting U-Boot. That is what I had started the
>> L400-JTAG project long time ago but never finished. To be able to reflash
>> the complete NAND in case of such a malheur.
> Maybe we get this far, it is difficult to say at the moment.
> Currently, I'm trying to figure some things out. For instance, the platform.c
> file contains device structures, as does the board file, but as you noted
> before, we should be able to get the device tree to create these structures
> for us, shouldn't we?
Yes, a quick glance did show that we can replace most of them. At lest those
for setting up peripheral devices.
> Another thing that seems like it might be a problem is deploying the device
> tree definition. I imagine that the U-Boot on the Minibook doesn't understand
> .dtb payloads.
Most likely not. And if it does, it needs a special boot-script that loads
the .dtb file to some address and tells the bootm command to pass it to the
kernel. And the script must know the file name to load.
This is a too hot potato for me... I't prefer not to open another construction
site and keep U-Boot completely untouched.
> If not, which "append" option should we use? If it does,
> however, where do we put the .dtb file?
There is CONFIG_ARM_APPENDED_DTB and with =y it is as easy as
cat zImage mipsbook_400.dtb >zImage-with-dtb
mkimage -A arm -O linux -T kernel -C none -a "$LOADADDRESS" -e "$ENTRYPOINT" -n "$VERSION" -d zImage-with-dtb uImage
This makes an uImage that can be loaded like a non-DT based kernel.
(see for example https://www.osadl.org/Single-View.111+M5c9f8010d87.0.html)
But it appears that this mechanism works for ARM only :(
So we will have to port this ARM feature to MIPS:
It is not complex, but Assembler and requires a deep understanding on how
the startup setup works. Fortunately the same head.S exists for MIPS and is very short:
Imho this means we probably just have to calculate an address and overwrite a2/s2 (depending
on which register KERNEL_ENTRY expects the DTB base address to be).
Anyways, looks like another area of trouble and difficult debugging... But if
solved once it will be forever. So it is just a challenge :)
So how are DT based JZ4740/80 devices doing that? Do they have a modern U-Boot?
More information about the Lenny400