Step-by-Step Tutorial for building k210's linux image

Check out here:

Prebuild firmware:
http://dl.sipeed.com/MAIX/MaixLinux/Firmware

image
image
image

Very exciting. Thank you for posting.

Iā€™m trying to boot the prebuilt on MAIX Bit:
http://dl.sipeed.com/MAIX/MaixLinux/Firmware/Maix-linux-5.6-rc1_preview0.1.bin

But it hits a bug during boot:

----------------[    0.266890] unexpected interrupt cause 0x8000000000000009
[    0.266901] ------------[ cut here ]------------
[    0.276874] kernel BUG at arch/riscv/kernel/irq.c:43!
[    0.281908] Kernel BUG [#1]
[    0.284695] CPU: 1 PID: 1 Comm: sh Not tainted 5.6.0-rc1-g9dbcd412b #5
[    0.291201] epc: 0000000080145f78 ra : 0000000080145f78 sp : 000000008078bec0
[    0.298319]  gp : 000000008018a9b0 tp : 0000000080786000 t0 : 0000000000046000
[    0.305526]  t1 : 5c5c5c5c5c207c2e t2 : 0000000000000008 s0 : 000000008078bee0
[    0.312732]  s1 : 000000008078bee0 a0 : 000000000000002d a1 : 0000000080190dbf
[    0.319937]  a2 : 0000000000000008 a3 : 0000000000000000 a4 : 0000000000000000
[    0.327144]  a5 : 0000000000000000 a6 : 0000000000000004 a7 : 00000000000000d7
[    0.334351]  s2 : 0000000000000000 s3 : 00000001001f9100 s4 : 8000000000000009
[    0.341557]  s5 : 0000000000000000 s6 : 0000000080447298 s7 : ffffffffffffffff
[    0.348763]  s8 : 000000000000000a s9 : 0000000000000000 s10: 0000000000000062
[    0.355970]  s11: 0000000000000010 t3 : ffffffffffffffff t4 : 0000000000000018
[    0.363173]  t5 : 0000000000000028 t6 : 00000000801909bd
[    0.368472] status: 0000000000001800 badaddr: 0000000000000000 cause: 0000000000000003
[    0.376580] ---[ end trace 1606611251fb8ffb ]---
[    0.380989] Kernel panic - not syncing: Fatal exception in interrupt
[    0.387311] SMP: stopping secondary CPUs
[    0.391232] ---[ end Kernel panic - not syncing: Fatal exception in interrupt ]---

Full log here:

Anyone able to boot OK on the MAIX Bit?

UPDATE: I got a shell!

Step 1: flashed maixpy_v0.4.0_20_g06ed455.bin and then I flashed Maix-linux-5.6-rc1_preview0.1.bin.

pdp7@x1:~/dev/rv/kflash.py$ kflash -B bit -b 3000000 -p /dev/ttyUSB0  /home/pdp7/Downloads/maixpy_v0.4.0_20_g06ed455.bin
[INFO] COM Port Selected Manually:  /dev/ttyUSB0 
[INFO] Default baudrate is 115200 , later it may be changed to the value you set. 
[INFO] Trying to Enter the ISP Mode... 
.
[INFO] Greeting Message Detected, Start Downloading ISP 
[INFO] CH340 mode 
Downloading ISP: |================================================================================================================================================================================| 100.0% 10kiB/s
[INFO] Booting From 0x80000000 
[INFO] Wait For 0.1 second for ISP to Boot 
[INFO] Boot to Flashmode Successfully 
[INFO] Selected Baudrate:  3000000 
[INFO] Baudrate changed, greeting with ISP again ...  
[INFO] Boot to Flashmode Successfully 
[INFO] Selected Flash:  On-Board 
[INFO] Initialization flash Successfully 
Programming BIN: |================================================================================================================================================================================| 100.0% 71kiB/s
[INFO] Rebooting... 
pdp7@x1:~/dev/rv/kflash.py$ kflash -B bit -b 3000000 -p /dev/ttyUSB0  /home/pdp7/Downloads/Maix-linux-5.6-rc1_preview0.1.bin
[INFO] COM Port Selected Manually:  /dev/ttyUSB0 
[INFO] Default baudrate is 115200 , later it may be changed to the value you set. 
[INFO] Trying to Enter the ISP Mode... 
.
[INFO] Greeting Message Detected, Start Downloading ISP 
[INFO] CH340 mode 
Downloading ISP: |================================================================================================================================================================================| 100.0% 10kiB/s
[INFO] Booting From 0x80000000 
[INFO] Wait For 0.1 second for ISP to Boot 
[INFO] Boot to Flashmode Successfully 
[INFO] Selected Baudrate:  3000000 
[INFO] Baudrate changed, greeting with ISP again ...  
[INFO] Boot to Flashmode Successfully 
[INFO] Selected Flash:  On-Board 
[INFO] Initialization flash Successfully 
Programming BIN: |================================================================================================================================================================================| 100.0% 72kiB/s
[INFO] Rebooting... 

Step 2: open terminal and got a root shell!

/ # uname -a
Linux (none) 5.6.0-rc1-g9dbcd412b #5 SMP Sat Feb 15 13:02:55 CST 2020 riscv64 GNU/Linux
/ # ps
  PID USER       VSZ STAT COMMAND
    1 0          460 S    /bin/sh
    2 0            0 SW   [kthreadd]
    3 0            0 IW<  [rcu_gp]
    4 0            0 IW<  [rcu_par_gp]
    5 0            0 IW   [kworker/0:0-eve]
    6 0            0 IW<  [kworker/0:0H]
    7 0            0 IW   [kworker/u4:0-ev]
    8 0            0 IW<  [mm_percpu_wq]
    9 0            0 SW   [ksoftirqd/0]
   10 0            0 IW   [rcu_sched]
   11 0            0 SW   [migration/0]
   12 0            0 SW   [cpuhp/0]
   13 0            0 SW   [cpuhp/1]
   14 0            0 SW   [migration/1]
   15 0            0 SW   [ksoftirqd/1]
   16 0            0 IW   [kworker/1:0-eve]
   17 0            0 IW<  [kworker/1:0H]
   18 0            0 SW   [kdevtmpfs]
   19 0            0 IW<  [writeback]
   20 0            0 IW   [kworker/0:1-eve]
   21 0            0 SW   [kswapd0]
   22 0            0 IW   [kworker/1:1-mm_]
   24 0            0 IW   [kworker/u4:1]
   36 0          324 R    ps
/ # cat /proc/cpuinfo 
processor	: 0
hart		: 0
isa		: rv64imafdc

processor	: 1
hart		: 1
isa		: rv64imafdc

/ # uname -a
Linux (none) 5.6.0-rc1-g9dbcd412b #5 SMP Sat Feb 15 13:02:55 CST 2020 riscv64 GNU/Linux
/ # cat /proc/meminfo 
MemTotal:           6656 kB
MemFree:            4300 kB
MemAvailable:       3832 kB
Buffers:               0 kB
Cached:              560 kB
SwapCached:            0 kB
Active:                0 kB
Inactive:              0 kB
Active(anon):          0 kB
Inactive(anon):        0 kB
Active(file):          0 kB
Inactive(file):        0 kB
Unevictable:         540 kB
Mlocked:               0 kB
MmapCopy:            780 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:             0 kB
Mapped:                0 kB
Shmem:                 0 kB
KReclaimable:          0 kB
Slab:                740 kB
SReclaimable:          0 kB
SUnreclaim:          740 kB
KernelStack:         200 kB
PageTables:            0 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:        3328 kB
Committed_AS:          0 kB
VmallocTotal:          0 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
Percpu:               96 kB
/ # 

2 Likes