gem5-users@gem5.org

The gem5 Users mailing list

View all threads

Segmentation fault when booting RISCV Linux on Gem5

ZB
zahra butool
Fri, Feb 2, 2024 5:09 AM

Hi everyone,

I want to run RISCV Linux on Gem5 FS modethe . I followed the instructions
in this link (https://github.com/UCanLinux/riscv64-sample/tree/master) to
build the Linux kernel, rootfs, and bbl. When I run this on Gem5, I can see
the boot logs, but at the end of the bootloader, I get multiple
segmentation fault errors. Then I get the login prompt to enter the login
and password, but again if I run any command (e.g., ls), I get a
segmentation fault.

I would appreciate any ideas on how to solve this issue.

[ 1.028000]  t1 : 000000000001818c t2 : 00000000000f43b0 s0 : 0000000000000000
[ 1.028000]  s1 : 0000000000000005 a0 : 0000000000000000 a1 : 0000000000000000
[ 1.032000]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000001
[ 1.032000]  a5 : 0000000000000000 a6 : 0000000000000006 a7 : 00000000000000dc
[ 1.032000]  s2 : 00000000000f6670 s3 : 0000000000000000 s4 : 00000000000f6670
[ 1.032000]  s5 : 00000000000f7b85 s6 : ffffffffffffffff s7 : 0000000000000000
[ 1.032000]  s8 : 0000000000000000 s9 : 00000000000d5398 s10: 00000000000f7b85
[ 1.032000]  s11: 00000000000d53d8 t3 : 0000002000132d60 t4 : 0000002000183540
[ 1.032000]  t5 : 0000000000000005 t6 : ffffffffffffffff
[ 1.032000] sstatus: 8000000200006020 sbadaddr: 0000000000000000
scause: 000000000000000c
Segmentation fault
[ 1.040000] rcS[48]: unhandled signal 11 code 0x1 at
0x0000000000000000 in busybox[10000+e3000]
[ 1.040000] CPU: 0 PID: 48 Comm: rcS Not tainted 4.20.0+ #1
[ 1.040000] sepc: 0000000000000000 ra : 0000000000000000 sp : 0000003fffe21750
[ 1.040000]  gp : 00000000000f5108 tp : 00000020001b9720 t0 : 0000000000000000
[ 1.040000]  t1 : 000000000001818c t2 : 00000000000f43b0 s0 : 0000000000000000
[ 1.044000]  s1 : 0000000000000002 a0 : 0000000000000000 a1 : 0000000000000000
[ 1.044000]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000001
[ 1.044000]  a5 : 0000000000000000 a6 : 0000000000000006 a7 : 00000000000000dc
[ 1.044000]  s2 : 00000000000f6600 s3 : 0000000000000000 s4 : 00000000000f6600
[ 1.044000]  s5 : 00000000000f7b85 s6 : ffffffffffffffff s7 : 0000000000000000
[ 1.044000]  s8 : 0000000000000000 s9 : 00000000000d5398 s10: 00000000000f7b85
[ 1.044000]  s11: 00000000000d53d8 t3 : 0000002000132d60 t4 : 0000002000183540
[ 1.044000]  t5 : 0000000000000005 t6 : ffffffffffffffff
[ 1.048000] sstatus: 8000000200006020 sbadaddr: 0000000000000000
scause: 000000000000000c
Segmentation fault
[ 1.052000] rcS[49]: unhandled signal 11 code 0x1 at
0x0000000000000000 in busybox[10000+e3000]
[ 1.052000] CPU: 0 PID: 49 Comm: rcS Not tainted 4.20.0+ #1
[ 1.052000] sepc: 0000000000000000 ra : 0000000000000000 sp : 0000003fffe21750
[ 1.052000]  gp : 00000000000f5108 tp : 00000020001b9720 t0 : 0000000000000000
[ 1.056000]  t1 : 000000000001818c t2 : 00000000000f43b0 s0 : 0000000000000000
[ 1.056000]  s1 : 0000000000000005 a0 : 0000000000000000 a1 : 0000000000000000
[ 1.056000]  a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000001
[ 1.056000]  a5 : 0000000000000000 a6 : 0000000000000006 a7 : 00000000000000dc
[ 1.056000]  s2 : 00000000000f6678 s3 : 0000000000000000 s4 : 00000000000f6678
[ 1.056000]  s5 : 00000000000f7b85 s6 : ffffffffffffffff s7 : 0000000000000000
[ 1.056000]  s8 : 0000000000000000 s9 : 00000000000d5398 s10: 00000000000f7b85
[ 1.056000]  s11: 00000000000d53d8 t3 : 0000002000132d60 t4 : 0000002000183540
[ 1.060000]  t5 : 0000000000000005 t6 : ffffffffffffffff
[ 1.060000] sstatus: 8000000200006020 sbadaddr: 0000000000000000
scause: 000000000000000c
Segmentation fault
[ 1.064000] rcS[50]: unhandled signal 11 code 0x1 at
0x0000000000000000 in busybox[10000+e3000]
[ 1.064000] CPU: 0 PID: 50 Comm: rcS Not tainted 4.20.0+ #1
[ 1.064000] sepc: 0000000000000000 ra : 0000000000000000 sp : 0000003fffe21750

.
.
.


| | | |/ | _ _ __ | |  ()_ __  _  ___  __
| | | | |  / ` | ' | |  | | '_ | | | \ / /
| || | |__| (| | | | | || | | | | || |>  <
_
/ __,|| ||_____||| ||_,/_/_
Welcome to RiscV

UCanLinux login: root
root
Password: root

login[68]: root login on 'ttyS0'
Segmentation fault
sh: 0: unknown operand
root@UCanLinux:~ $
root@UCanLinux:~ $ ls
ls
Segmentation fault
root@UCanLinux:~ $

Hi everyone, I want to run RISCV Linux on Gem5 FS modethe . I followed the instructions in this link (https://github.com/UCanLinux/riscv64-sample/tree/master) to build the Linux kernel, rootfs, and bbl. When I run this on Gem5, I can see the boot logs, but at the end of the bootloader, I get multiple segmentation fault errors. Then I get the login prompt to enter the login and password, but again if I run any command (e.g., ls), I get a segmentation fault. I would appreciate any ideas on how to solve this issue. [ 1.028000] t1 : 000000000001818c t2 : 00000000000f43b0 s0 : 0000000000000000 [ 1.028000] s1 : 0000000000000005 a0 : 0000000000000000 a1 : 0000000000000000 [ 1.032000] a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000001 [ 1.032000] a5 : 0000000000000000 a6 : 0000000000000006 a7 : 00000000000000dc [ 1.032000] s2 : 00000000000f6670 s3 : 0000000000000000 s4 : 00000000000f6670 [ 1.032000] s5 : 00000000000f7b85 s6 : ffffffffffffffff s7 : 0000000000000000 [ 1.032000] s8 : 0000000000000000 s9 : 00000000000d5398 s10: 00000000000f7b85 [ 1.032000] s11: 00000000000d53d8 t3 : 0000002000132d60 t4 : 0000002000183540 [ 1.032000] t5 : 0000000000000005 t6 : ffffffffffffffff [ 1.032000] sstatus: 8000000200006020 sbadaddr: 0000000000000000 scause: 000000000000000c Segmentation fault [ 1.040000] rcS[48]: unhandled signal 11 code 0x1 at 0x0000000000000000 in busybox[10000+e3000] [ 1.040000] CPU: 0 PID: 48 Comm: rcS Not tainted 4.20.0+ #1 [ 1.040000] sepc: 0000000000000000 ra : 0000000000000000 sp : 0000003fffe21750 [ 1.040000] gp : 00000000000f5108 tp : 00000020001b9720 t0 : 0000000000000000 [ 1.040000] t1 : 000000000001818c t2 : 00000000000f43b0 s0 : 0000000000000000 [ 1.044000] s1 : 0000000000000002 a0 : 0000000000000000 a1 : 0000000000000000 [ 1.044000] a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000001 [ 1.044000] a5 : 0000000000000000 a6 : 0000000000000006 a7 : 00000000000000dc [ 1.044000] s2 : 00000000000f6600 s3 : 0000000000000000 s4 : 00000000000f6600 [ 1.044000] s5 : 00000000000f7b85 s6 : ffffffffffffffff s7 : 0000000000000000 [ 1.044000] s8 : 0000000000000000 s9 : 00000000000d5398 s10: 00000000000f7b85 [ 1.044000] s11: 00000000000d53d8 t3 : 0000002000132d60 t4 : 0000002000183540 [ 1.044000] t5 : 0000000000000005 t6 : ffffffffffffffff [ 1.048000] sstatus: 8000000200006020 sbadaddr: 0000000000000000 scause: 000000000000000c Segmentation fault [ 1.052000] rcS[49]: unhandled signal 11 code 0x1 at 0x0000000000000000 in busybox[10000+e3000] [ 1.052000] CPU: 0 PID: 49 Comm: rcS Not tainted 4.20.0+ #1 [ 1.052000] sepc: 0000000000000000 ra : 0000000000000000 sp : 0000003fffe21750 [ 1.052000] gp : 00000000000f5108 tp : 00000020001b9720 t0 : 0000000000000000 [ 1.056000] t1 : 000000000001818c t2 : 00000000000f43b0 s0 : 0000000000000000 [ 1.056000] s1 : 0000000000000005 a0 : 0000000000000000 a1 : 0000000000000000 [ 1.056000] a2 : 0000000000000000 a3 : 0000000000000000 a4 : 0000000000000001 [ 1.056000] a5 : 0000000000000000 a6 : 0000000000000006 a7 : 00000000000000dc [ 1.056000] s2 : 00000000000f6678 s3 : 0000000000000000 s4 : 00000000000f6678 [ 1.056000] s5 : 00000000000f7b85 s6 : ffffffffffffffff s7 : 0000000000000000 [ 1.056000] s8 : 0000000000000000 s9 : 00000000000d5398 s10: 00000000000f7b85 [ 1.056000] s11: 00000000000d53d8 t3 : 0000002000132d60 t4 : 0000002000183540 [ 1.060000] t5 : 0000000000000005 t6 : ffffffffffffffff [ 1.060000] sstatus: 8000000200006020 sbadaddr: 0000000000000000 scause: 000000000000000c Segmentation fault [ 1.064000] rcS[50]: unhandled signal 11 code 0x1 at 0x0000000000000000 in busybox[10000+e3000] [ 1.064000] CPU: 0 PID: 50 Comm: rcS Not tainted 4.20.0+ #1 [ 1.064000] sepc: 0000000000000000 ra : 0000000000000000 sp : 0000003fffe21750 . . . _ _ ____ _ _ | | | |/ ___|__ _ _ __ | | (_)_ __ _ ___ __ | | | | | / _` | '_ \| | | | '_ \| | | \ \/ / | |_| | |__| (_| | | | | |___| | | | | |_| |> < \___/ \____\__,_|_| |_|_____|_|_| |_|\__,_/_/\_\ Welcome to RiscV UCanLinux login: root root Password: root login[68]: root login on 'ttyS0' Segmentation fault sh: 0: unknown operand root@UCanLinux:~ $ root@UCanLinux:~ $ ls ls Segmentation fault root@UCanLinux:~ $