damien-lemoal / riscv64-nommu-buildroot

Other
42 stars 11 forks source link

Is the precompiled kernel flashable to Sipeed Maix Go Development Board? #8

Closed eminfedar closed 3 years ago

eminfedar commented 3 years ago

Hi, I'm trying to install linux to Maix GO Development Board and saw your repo.

I have flashed this file with kflash-gui: https://github.com/damien-lemoal/riscv64-nommu-buildroot/blob/master/riscv64-uclibc-nommu/kernel-image/linux-5.6-rc1.bin

But it is not booting and I can't see anything in ttyUSB0.

How can I make it work? Thanks!

damien-lemoal commented 3 years ago

Use the new buildroot fork I just created today (https://github.com/damien-lemoal/buildroot). Clone it then run:

make kendryte_k210_defconfig make (this will take a while)

Then flash the file buildroot/output/image/loader.bin

This is kernel 5.8. I will not be maintaining this riscv64-nommu-buildroot anymore. Integrating cleanly into buildroot now. I posted the patches to buildroot too. Hopefully, we get all this upstream very soon.

damien-lemoal commented 3 years ago

By the way, just tested on my MAIX Go and all is good. Also works on MAIX Dock and Dan Dock.

eminfedar commented 3 years ago

How did you connect after flash? I'm trying screen /dev/ttyUSB0 115200 but nothing appears?

damien-lemoal commented 3 years ago

For flashing, I run:

sudo python3 kflash.py/kflash.py -p /dev/ttyUSB0 -b 1500000 -t loader.bin

The "-t" option gives you the terminal. Once flashed, if you want the terminal only, you can run:

sudo miniterm.py --eol LF /dev/ttyUSB0 115200

Boot message I get:

[    0.000000] Linux version 5.8.0 (damien@localhost.localdomain) (riscv64-buildroot-linux-uclibc-gcc.br_real (Buildroot 2020
.08-332-g6a6dcd0c4b) 9.3.0, GNU ld (GNU Binutils) 2.32) #5 SMP Tue Sep 8 18:55:35 JST 2020
[    0.000000] earlycon: sifive0 at MMIO 0x0000000038000000 (options '')
[    0.000000] printk: bootconsole [sifive0] enabled
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000080000000-0x00000000807fffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080000000-0x00000000807fffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080000000-0x00000000807fffff]
[    0.000000] riscv: ISA extensions acdfim
[    0.000000] riscv: ELF capabilities acdfim
[    0.000000] percpu: max_distance=0x18000 too large for vmalloc space 0x0
[    0.000000] percpu: Embedded 12 pages/cpu s18336 r0 d30816 u49152
[    0.000000] Built 1 zonelists, mobility grouping off.  Total pages: 2020
[    0.000000] Kernel command line: earlycon console=ttySIF0
[    0.000000] Dentry cache hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.000000] Inode-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.000000] Sorting __ex_table...
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 6328K/8192K available (939K kernel code, 119K rwdata, 169K rodata, 289K init, 97K bss, 1864K reserved,
 0K cma-reserved)
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] riscv-intc: 64 local interrupts mapped
[    0.000000] plic: interrupt-controller@c000000: mapped 65 interrupts with 2 handlers for 4 contexts.
[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [0]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x3990be68b, max_idle_ns: 881590404272 ns
[    0.000014] sched_clock: 64 bits at 7MHz, resolution 128ns, wraps every 4398046511054ns
[    0.008240] Console: colour dummy device 80x25
[    0.012480] Calibrating delay loop (skipped), value calculated using timer frequency.. 15.60 BogoMIPS (lpj=31200)
[    0.022679] pid_max: default: 4096 minimum: 301
[    0.027301] Mount-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.034417] Mountpoint-cache hash table entries: 512 (order: 0, 4096 bytes, linear)
[    0.044883] rcu: Hierarchical SRCU implementation.
[    0.049782] smp: Bringing up secondary CPUs ...
[    0.055060] smp: Brought up 1 node, 2 CPUs
[    0.059461] devtmpfs: initialized
[    0.065621] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.074642] futex hash table entries: 16 (order: -2, 1024 bytes, linear)
[    0.084165] Kendryte K210 SoC sysctl
[    0.097643] clocksource: Switched to clocksource riscv_clocksource
[    0.230882] workingset: timestamp_bits=62 max_order=11 bucket_order=0
[    0.238392] 38000000.serial: ttySIF0 at MMIO 0x38000000 (irq = 1, base_baud = 0) is a SiFive UART v0
[    0.246927] printk: console [ttySIF0] enabled
[    0.246927] printk: console [ttySIF0] enabled
[    0.255479] printk: bootconsole [sifive0] disabled
[    0.255479] printk: bootconsole [sifive0] disabled
[    0.267589] random: get_random_bytes called from 0x000000008004e75c with crng_init=0
[    0.276073] Freeing unused kernel memory: 288K
[    0.279789] This architecture does not have kernel memory protection.
[    0.286234] Run /init as init process

-----------------------------
| Kendryte K210 NOMMU Linux |
-----------------------------

BusyBox v1.32.0 (2020-09-08 18:31:00 JST) hush - the humble shell
Enter 'help' for a list of built-in commands.

/ # cat /proc/cpuinfo
processor       : 0
hart            : 0
isa             : rv64imafdc
uarch           : kendryte,k210

processor       : 1
hart            : 1
isa             : rv64imafdc
uarch           : kendryte,k210

/ #
damien-lemoal commented 3 years ago

Note: I am not using the kflash GUI. I could never get it to run.

damien-lemoal commented 3 years ago

Correction, to run the console only, this command is better:

sudo miniterm.py --raw --eol LF /dev/ttyUSB0 115200

Otherwise, there are problems with the backspace key, among others.

eminfedar commented 3 years ago

Can you send your loader.bin file? May be mine is not proper.

I have compiled and it ended successfully. Then flashed the loader.bin file from 0x000000 but still didn't manage to get the shell. :)

I also tried kflash.py as you write too.

For example when I flash MaixPy, it flashes nicely and works. But this doesn't... I wonder why...

damien-lemoal commented 3 years ago

Sent it to your gmail address. The tar.gz file is 955KB, so gmail should let it go through. If it does not, let me know and I will put the file somewhere for you to grab it.

damien-lemoal commented 3 years ago

@eminfedar Did you get your board to boot ?

eminfedar commented 3 years ago

No 😅 but that's okay. Thanks for your nice efforts to help. Maybe our board is not working properly somehow...👍🏻

damien-lemoal commented 3 years ago

Did you try hitting the reset button several times after flashing the image ? I sometimes also do not get any output, but resetting one or 2 times gives me a clean boot. Not sure why. Stay in the terminal from the kflash command and hit reset...