oscourse-tsinghua / rcore_plus

Rust version of THU uCore OS. Linux compatible.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

biscuit/ls error on ubuntu16.04 x86_64

deltavoid opened this issue · comments

The output lools like this:

Hello world! from CPU 1!
Hello world! from CPU 2!
Hello world! from CPU 3!
Hello world! from CPU 0!
Available programs: [".", "..", "busybox", "rust", "biscuit"]

biscuit/ls
[ERROR]
EXCEPTION: Page Fault @ 0xffffffffffffffd0, code: PRESENT | WRITE | USER
[ERROR] TrapFrame {
fpstate_offset: 0x8,
fpstate: fpstate,
fsbase: 0x0,
r15: 0x0,
r14: 0x0,
r13: 0x2,
r12: 0x2,
rbp: 0x180000ffe30,
rbx: 0x0,
r11: 0x0,
r10: 0x0,
r9: 0x1000,
r8: 0x3,
rsi: 0x902,
rdi: 0x4a8927,
rdx: 0xffffffffffffffd0,
rcx: 0x0,
rax: 0x2,
trap_num: 0xe,
error_code: 0x7,
rip: 0x41204d,
cs: 0x13,
rflags: 0x213,
rsp: 0x180000ffdb0,
ss: 0x1b
}
[ERROR] On CPU0 Process 1

When I delete musl-tools, musl, musl-dev package in ubuntu 16.04, the sfsimg could be built correctly.
So I think the make uses gcc-glibc instead of gcc-musllibc.
We should check Makefile in usr DIR

FIX method: passed in ubuntu 16.04 x86-64

step 1: build musl-gcc with gcc-6.4+musl-1.1.21

git clone https://github.com/richfelker/musl-cross-make.git
cp config.mak.dist config.mak

add two line in config.mak

TARGET = x86_64-linux-musl
OUTPUT = /usr/local

make && sudo make install

step 2: remove ubuntu musl* packages

sudo apt remove musl*

step 3: use x86_64-linux-musl-gcc to rebuild sfsimg

change rcore_plus/user/biscuit/CMakeLists.txt LINE:35

        set(PREFIX          x86_64-linux-musl-)

cd usr && make clean && make sfsimg arch=x86_64
cd ../kernel && make run arch=x86_64

in qemu

biscuit/ls ##should work now

I have solve the problem with the method above.

Hello world! from CPU 1!
Hello world! from CPU 2!
Hello world! from CPU 3!
Hello world! from CPU 0!
Available programs: [".", "..", "busybox", "biscuit", "rust"]
>> 
>> biscuit/ls
>> [ WARN] sys_set_tid_address is unimplemented
[ WARN] sys_ioctl is unimplemented
./:
[ WARN] sys_brk is unimplemented
[ WARN] sys_brk is unimplemented
[ WARN] sys_fcntl is unimplemented
[ WARN] stat is partial implemented as lstat
drwxr-xr-x 5 .
[ WARN] stat is partial implemented as lstat
drwxr-xr-x 5 ..
[ WARN] stat is partial implemented as lstat
-rwxr-xr-x 973200 busybox
[ WARN] stat is partial implemented as lstat
drwxr-xr-x 58 biscuit
[ WARN] stat is partial implemented as lstat
drwxr-xr-x 5 rust