Add network device to L4Linux

Yiyang Su suyiyang at hotmail.com
Wed Sep 13 13:56:58 CEST 2017


Hi,


Starting from a previous work [1], I have succeeded in booting L4Linux on

Cubietruck with the snapshot (l4re-snapshot-2016082114). Then I have

been trying to configure L4Linux to access Ethernet device. With current

configuration I cannot boot L4Llinux anymore. Following is my configuration

and boot log:


l4lx-net-cubi.devs

===========================================

local Res = Io.Res
local Hw = Io.Hw

Io.hw_add_devices(function()
    NIC = Hw.Device(function()
        Property.hid = "sun7ia20gmac";
        compatible = {"allwinner,sun7i-a20-gmac"};
        Resource.regs = Res.mmio(0x01c50000, 0x01c5ffff);
        --Resource.irq = Res.irq(0);
        Resource.irq = Res.irq(85);
        --Resource.irq = Res.irq(4);
        Property.flags = Io.Hw_device_DF_dma_supported;
    end);
end)



l4lx-net-cubi.io

===========================================

local hw = Io.system_bus()

Io.add_vbus("l4linux", Io.Vi.System_bus
{
    NIC = wrap(hw:match("allwinner,sun7i-a20-gmac"));
})



l4lx-net-cubi.cfg

===========================================

local L4 = require("L4");

local loader = L4.default_loader;

vbus_l4linux = loader:new_channel();

loader:start(
    {
        caps = {
            icu = L4.Env.icu,
            sigma0 = L4.cast(L4.Proto.Factory, L4.Env.sigma0):create(L4.Proto.Sigma0),
            l4linux = vbus_l4linux:svr(),
        },
        log = {"IO", "y"},
        l4re_dbg = L4.Dbg.Warn,
    },
    "rom/io -vvv rom/l4lx-net-cubi.devs rom/l4lx-net-cubi.io"
);

-- start L4Linux
loader:start(
    {
        caps = {
            vbus = vbus_l4linux,
        },
        --log = {"l4linux", "cyan"},
        log = L4.Env.log:m("rws"),
        l4re_dbg = L4.Dbg.Warn,
    },
    "rom/vmlinuz mem=64M console=ttyLv0 earlyprintk=1 l4x_dtb=rom/sun7i-a20-cubietruck.dtb "
    .. "l4x_rd=rom/ramdisk-" ..  L4.Info.arch() .. ".rd "
    .. "root=1:0 rw ramdisk_size=4000"
);


modules.list
============================================
entry L4Linux-net-cubi
roottask moe rom/l4lx-net-cubi.cfg
module l4re
module ned
module io
module sun7i-a20-cubietruck.dtb
module l4lx-net-cubi.cfg
module l4lx-net-cubi.devs
module l4lx-net-cubi.io
module vmlinuz
module[perl] "ramdisk-$ENV{ARCH}.rd"


boot log
===================================
U-Boot SPL 2017.03-rc3 (Aug 14 2017 - 13:26:17)
DRAM: 2048 MiB
CPU: 912000000Hz, AXI/AHB/APB: 3/2/2
Trying to boot from MMC1


U-Boot 2017.03-rc3 (Aug 14 2017 - 13:26:17 +0200) Allwinner Technology

CPU:   Allwinner A20 (SUN7I)
Model: Cubietech Cubietruck
I2C:   ready
DRAM:  2 GiB
MMC:   SUNXI SD/MMC: 0
*** Warning - bad CRC, using default environment

Setting up a 1024x768 vga console (overscan 0x0)
In:    serial
Out:   vga
Err:   vga
SCSI:  SATA link 0 timeout.
AHCI 0001.0100 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part ccc apst
Net:   eth0: ethernet at 01c50000
starting USB...
USB0:   USB EHCI 1.00
USB1:   USB OHCI 1.0
USB2:   USB EHCI 1.00
USB3:   USB OHCI 1.0
scanning bus 0 for devices... 1 USB Device(s) found
scanning bus 2 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0 is current device
Scanning mmc 0:1...
Found U-Boot script /boot/boot.scr
reading /boot/boot.scr
1165 bytes read in 24 ms (46.9 KiB/s)
## Executing script at 43100000
Failed to mount ext2 filesystem...
** Unrecognized filesystem type **
reading boot/uImage
10481728 bytes read in 652 ms (15.3 MiB/s)
## Booting kernel from Legacy Image at 48000000 ...
   Image Name:   L4 Image #32
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    10481664 Bytes = 10 MiB
   Load Address: 41000000
   Entry Point:  41000000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...


L4 Bootstrapper
  Build: #32 Mi 13. Sep 11:47:18 CEST 2017, 4.9.4
  Scanning up to 1024 MB RAM, starting at offset 32MB
  Memory size is 1024MB (40000000 - 7fffffff)
  RAM: 0000000040000000 - 000000007fffffff: 1048576kB
  Total RAM: 1024MB
  Scanning fiasco
  Scanning sigma0
  Scanning moe
  Moving up to 12 modules behind 41100000
  moving module 02 { 419cd000-419fe49b } -> { 41abd000-41aee49b } [201884]
  moving module 01 { 419bb000-419cc337 } -> { 41aab000-41abc337 } [70456]
  moving module 00 { 4192d000-419ba98b } -> { 41a1d000-41aaa98b } [579980]
  moving module 11 { 4162d000-4192cfff } -> { 4171d000-41a1cfff } [3145728]
  moving module 10 { 4122b000-4162c473 } -> { 4131b000-4171c473 } [4199540]
  moving module 09 { 4122a000-4122a0c2 } -> { 4131a000-4131a0c2 } [195]
  moving module 08 { 41229000-412291ef } -> { 41319000-413191ef } [496]
  moving module 07 { 41228000-4122835d } -> { 41318000-4131835d } [862]
  moving module 06 { 4121f000-41227d73 } -> { 4130f000-41317d73 } [36212]
  moving module 05 { 41094000-4121e8d3 } -> { 41184000-4130e8d3 } [1616084]
  moving module 04 { 41032000-410936a7 } -> { 41122000-411836a7 } [399016]
  moving module 03 { 41010000-4103145f } -> { 41100000-4112145f } [136288]
  Loading fiasco
  Loading sigma0
  Loading moe
  find kernel info page...
  found kernel info page (via ELF) at 40002000
Regions of list 'regions'
    [ 40000000,  400001cf] {      1d0} Root   mbi_rt
    [ 40001000,  40001a7f] {      a80} Kern   fiasco
    [ 40002000,  4009afff] {    99000} Kern   fiasco
    [ 400c0000,  400ca287] {     a288} Sigma0 sigma0
    [ 400d0000,  400d6177] {     6178} Sigma0 sigma0
    [ 40140000,  40168fcb] {    28fcc} Root   moe
    [ 40170000,  40176ff3] {     6ff4} Root   moe
    [ 41000000,  4100f5cb] {     f5cc} Boot   bootstrap
    [ 41100000,  41a1cfff] {   91d000} Root   Module
  found kernel options (via ELF) at 40003000
  API Version: (87) experimental
  Sigma0 config    ip:400c0100 sp:00000000
  Roottask config  ip:40140210 sp:00000000
  Starting kernel fiasco at 4000124c
  Non-HYP kernel detected but running in HYP mode, switching back.
Hello from Startup::stage2
Number of IRQs available at this GIC: 160
FPU: Initialize
FPU0: Subarch: 2, Part: 30, Rev: 4, Var: 7, Impl: 41
ARM generic timer: freq=24000000 interval=24000 cnt=212673046
SERIAL ESC: allocated IRQ 33 for serial uart
Not using serial hack in slow timer handler.
Welcome to L4/Fiasco.OC!
L4/Fiasco.OC microkernel on arm
Rev: unknown compiled with gcc 4.9.4 for Allwinner A20    []
Build: #4 Mon Sep 11 10:25:38 CEST 2017

Calibrating timer loop... done.
MDB: use page size: 20
MDB: use page size: 12
SIGMA0: Hello!
  KIP @ 40002000
  allocated 4KB for maintenance structures
SIGMA0: Dump of all resource maps
RAM:------------------------
[4:40000000;40000fff]
[0:4009b000;400bffff]
[0:400cb000;400cffff]
[0:400d7000;4013ffff]
[4:40140000;40168fff]
[0:40169000;4016ffff]
[4:40170000;40176fff]
[0:40177000;410fffff]
[4:41100000;41a1cfff]
[0:41a1d000;7effffff]
IOMEM:----------------------
[0:0;3fffffff]
[0:80000000;ffffffff]
MOE: Hello world
MOE: found 1021976 KByte free memory
MOE: found RAM from 40000000 to 7f000000
MOE: allocated 1008 KByte for the page array @0x40177000
MOE: virtual user address space [0-bfffffff]
MOE: rom name space cap -> [C:103000]
  BOOTFS: [41100000-41121460] [C:105000] l4re
  BOOTFS: [41122000-411836a8] [C:107000] ned
  BOOTFS: [41184000-4130e8d4] [C:109000] io
  BOOTFS: [4130f000-41317d74] [C:10b000] sun7i-a20-cubietruck.dtb
  BOOTFS: [41318000-4131835e] [C:10d000] l4lx-net-cubi.cfg
  BOOTFS: [41319000-413191f0] [C:10f000] l4lx-net-cubi.devs
  BOOTFS: [4131a000-4131a0c3] [C:111000] l4lx-net-cubi.io
  BOOTFS: [4131b000-4171c474] [C:113000] vmlinuz
  BOOTFS: [4171d000-41a1d000] [C:115000] ramdisk-arm.rd
MOE: cmdline: moe rom/l4lx-net-cubi.cfg
MOE: Starting: rom/ned rom/l4lx-net-cubi.cfg
MOE: loading 'rom/ned'
Ned says: Hi World!
Ned: loading file: 'rom/l4lx-net-cubi.cfg'
IO      | Io service
IO      | Verboseness level: 4
IO      | unused physical memory space:
IO      |   [00000000000000-0000003fffffff]
IO      |   [00000080000000-000000ffffffff]
IO      | no 'iommu' capability found use CPU-phys for DMA
IO      | Loading: config 'rom/l4lx-net-cubi.devs'
IO      | warning: inconsistent fixed resource @ device: /System Bus/
IO      |   : hid=sun7ia20gmac
IO      |   DMADOM  [00000000000000-00000000000000 1] non-pref (32bit) (align=0 flags=6)
IO      | Loading: config 'rom/l4lx-net-cubi.io'
IO      | Real Hardware -----------------------------------
IO      | System Bus: hid=
IO      |   Resources: ==== start ====
IO      |   DMADOM  [00000000000000-00000000000000 1] non-pref (32bit) (align=0 flags=6)
IO      |   Resources: ===== end =====
IO      |   NIC: hid=sun7ia20gmac
IO      |     Clients: ===== start ====
IO      |       NIC: [N2Vi9Proxy_devE]
IO      |     Clients: ===== end ====
IO      |     Resources: ==== start ====
IO      |     IRQ     [00000000000055-00000000000055 1] none (32bit) (align=0 flags=1)
IO      |     IOMEM   [00000001c50000-00000001c5ffff 10000] non-pref (32bit) (align=ffff flags=2)
IO      |     DMADOM  [00000000000000-00000000000000 1] non-pref (32bit) (align=0 flags=6)
IO      |     Resources: ===== end =====
IO      | warning: could not register control interface at cap 'platform_ctl'
IO      | Ready. Waiting for request.
PH  0 offs=00010000 flags=rwx PH-type=0x1
      virt=02000000 evirt=0245b5dc
      phys=02000000 ephys=0245b5dc
      f_sz=003d3653 memsz=0045b5dc
PH  1 offs=00394898 flags=r-x PH-type=0x4
      virt=02384898 evirt=023848bc
      phys=02384898 ephys=023848bc
      f_sz=00000024 memsz=00000024
PH  2 offs=00000000 flags=rwx PH-type=0x6474e551
      virt=00000000 evirt=00000000
      phys=00000000 ephys=00000000
      f_sz=00000000 memsz=00000000
Starting binary at 0x2000330, argc=9 argv=0xafff4f84 *argv=0xb1007ff4 argv0=rom/vmlinuz
External resolver is at 0xa80007cc
======> L4Linux starting... <========
Linux version 4.7.0-l4 (yiyang at i85217) (gcc version 4.9.4 (Linaro GCC 4.9-2017.01) ) #4 Wed Sep 13 11:18:30 CEST 2017
Binary name: rom/vmlinuz
   This is an AEABI build.
Linux kernel command line (8 args): mem=64M console=ttyLv0 earlyprintk=1 l4x_dtb=rom/sun7i-a20-cubietruck.dtb l4x_rd=rom/ramdisk-arm.rd root=1:0 rw ramdisk_size=4000
CPU mapping (l:p)[1]: 0:0
Image: 02000000 - 02600000 [6144 KiB].
Areas: Text:     02000000 - 023848bc [3602kB]
       RO-Data:  022ad000 - 02370000 [780kB]
       Data:     023ac000 - 023cefe0 [139kB]
       Init:     02385000 - 023ac000 [156kB]
       BSS:      023d3653 - 0245b5dc [543kB]
Device scan:
  Device: L4ICU
  Device: NIC
    IRQ: 00000055 - 00000055
    MEM: 01c50000 - 01c5ffff
    DMAD: 00000000 - 00000000
Device scan done.
l4lx_thread_create: Created thread 41e (cpu0) (u:b3000e00, v:b3000c00, sp:023adfa4)
main thread will be 41e
L4x: section-with-init(-data): Virt: 0x2000000 to 0x245bfff [4464 KiB]
section-with-init(-data): Phys: 0x40273000 to 0x406cefff, [4464 KiB]
L4x: section-with-init-text: Virt: 0x2000000 to 0x245bfff [4464 KiB]
error: failed to get physical address for 2000000.
L4x: Main thread running, waiting...
L4x: Memory size: 64MB
L4x: Setting superpages for main memory
L4x: Adjusted memory start: 02000000
L4x:     Main memory: Virt: 0x2600000 to 0x65fffff [65536 KiB]
    Main memory: Phys: 0x41c00000 to 0x45bfffff, [65536 KiB]
l4x: vmalloc area: 06600000 - 0e600000
L4x:            text: Virt: 0x2000000 to 0x245bfff [4464 KiB]
error: failed to get physical address for 2000000.


The boot process stops at this point. Compare with other boot logs in archives the following step could
be the loading ramdisk and device tree blob. Then I delete the "l4x_dtb=rom/sun7i-a20-cubietruck.dtb"
from the cmdline, it can boot the L4Linux again. Does it mean there is a problem with loading the device tree blob?

Any suggestion is very appreciated. Thanks.

Best regards,
Yang



[1] http://os.inf.tu-dresden.de/pipermail/l4-hackers/2017/008120.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://os.inf.tu-dresden.de/pipermail/l4-hackers/attachments/20170913/134ff01b/attachment.html>


More information about the l4-hackers mailing list