[Lenny400] LetuxOS on SD card for MIPS JZ4780 CI20

H. Nikolaus Schaller hns at goldelico.com
Sat Apr 13 22:14:19 CEST 2019

Hi Paul,

> Am 13.04.2019 um 21:48 schrieb Paul Boddie <paul at boddie.org.uk>:
> Nikolaus,
> On Saturday 13. April 2019 20.02.15 H. Nikolaus Schaller wrote:
>> Hi Paul,
>> I have spent some minutes on adapting LetuxOS to the CI20 so that we
>> eventually can create bootable SD cards with "makesd".
>> I have a first success:
>> Net:   dm9000
>> Hit any key to stop autoboot:  0
>> 4058380 bytes read in 673 ms (5.8 MiB/s)
>> ## Booting kernel from Legacy Image at 88000000 ...
>>   Image Name:   Linux-4.19.34-letux-l400+
>>   Image Type:   MIPS Linux Kernel Image (gzip compressed)
>>   Data Size:    4058316 Bytes = 3.9 MiB
>>   Load Address: 80010000
>>   Entry Point:  8065f750
>>   Verifying Checksum ... OK
>>   Uncompressing Kernel Image ... OK
>> Starting kernel ...
> The details certainly look quite reasonable.
>> This is a self-made cross-compiled SPL + U-Boot on SD card based on the
>> description at https://elinux.org/CI20_Dev_Zone#Building_uboot_from_sources
>> 	http://download.goldelico.com/letux-u-boot/CI20/2019-04-13/
> I noticed that the CONFIG contains settings enabled for ARM/OMAP and wondered 
> whether this was actually the configuration used.

Hm. Yes, this one looks strange:


Maybe my script that copies it to the server is broken... Or the old U-Boot code
does not store a copy in .config and the script copies the last one found in
the source tree? Yes, the file ".config" is from Feb 2019 so it was not created
by the make process.

For the kernel:


which is clearly Ingenic configured.

> [...]
>> There are two issues so far:
>> 1. the console output of the SPL (and U-Boot) seems to be mostly missing and
>> starts not before the "Net:   dm9000" line or "Hit any key"
> What is the SPL?

Second Phase Loader - the 11kB u-boot-spl.bin stored starting at sector 1
First Phase Loader is the Boot ROM
Third Phase Loader is U-Boot

> I don't remember ever seeing anything before those messages. 

Well, booting from the factory NAND image does this:

U-Boot SPL 2013.10-rc3-00057-g86d6668 (Jun 25 2015 - 10:10:03)
SDRAM K4B2G0846Q initialization... done

U-Boot 2013.10-rc3-00057-g86d6668 (Jun 25 2015 - 10:10:03)

Board: ci20 (Ingenic XBurst JZ4780 SoC)
DRAM:  1 GiB
NAND:  8192 MiB
MMC:   jz_mmc msc1: 0
*** Warning - bad CRC, using default environment

In:    eserial4
Out:   eserial4
Err:   eserial4
Net:   dm9000
Hit any key to stop autoboot:  0 

There you can see that the SPL loads U-Boot and starts it. And "Net:  dm9000"
is one of the last messages from U-Boot. So both, SPL and U-Boot, are not
showing everything...

> One thing which I did encounter was some confusion about which UART was being 
> used. Ultimately, I used UART0, but I do wonder if U-Boot might use another 
> UART early on.

Yes, the eserial4 is indicative...

But I have not changed any line of the source code (well one about endianness
if host gcc is used).

What could be is that I should connect to the other UART port... And U-Boot
switches to eserial4 just after printing "Err:   eserial4". Therefore the
first message I can see on eserial4 is "Net:   dm9000".

If we dig into the U-Boot source it should be possible to find these definitions.
And change them to our needs (stable console port...).

> Here is a page on the topic:
> https://www.elinux.org/CI20_Headless_Setup
> What I did need to do was to change /etc/inittab to enable ttyS0 for a login 
> prompt to appear on UART0, but that is with the kernel starting...

Maybe I must enable earlycon to see more. And there could be the same issue
with uart numbers. If the kernel logs to the other uart, I won't be able to
see anything after "Starting kernel ..." which is the last thing printed
by U-Boot.

Or I have to tell U-Boot to load a device tree and pass it to the kernel.

>> 2. Kernel is not starting
>>   well, I have not found how this U-Boot wants to handle the device-tree so
>> this is very expected. And I am not 100% sure if the installed kernel is
>> the jz4730/Mipsbook or the jz4780/CI20 kernel (unfortunately, there is no
>> Multiarch for Ingenic so we can't build universal kernels)
> I don't know what Multiarch means in this context,

A single uImage that supports multiple different SoC. Where the differentiation
is done by loading different DTB files. We have that on ARM. The same uImage build
runs OMAP3/4/5/AM335x/i.MX6/BCM28xx. Just need different device trees.

For Ingenic it seems we have to build one binary for JZ4730 and a different one
for JZ4780.

> but I would think that just 
> bundling the right device tree binary would be enough. Otherwise, the SoCs are 
> pretty similar, and I can't immediately think of anything that would require 
> different kernels for the different devices, at least if device tree works as 
> advertised.
> Still, this looks promising!

Yes, it is much better than my first attempts to get LetuxOS on RasPi. There was
no activity on the console for a long time... With U-Boot up and running it is
much easier to analyse and do experiments.

Maybe if you find a little time, you could also try makesd to create an SD card
for your CI20.


More information about the Lenny400 mailing list