Disable iperf for darwin, update README for gcc

master
Jiajie Chen 6 years ago
parent 1349a4c4c2
commit 8af72001d1

@ -100,12 +100,14 @@ endif
iperf3:
ifeq ($(arch), x86_64)
ifneq ($(shell uname), Darwin)
@echo Building iperf3
@mkdir -p $(out_dir)/dev
@dd if=/dev/urandom of=$(out_dir)/dev/urandom count=512
@cd iperf3 && make arch=$(arch) all
@cp iperf3/build/$(arch)/iperf3 $(out_dir)
endif
endif
$(alpine):
wget "http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/$(arch)/$(alpine_file)" -O $(alpine)

@ -2,15 +2,29 @@
[![Build Status](https://travis-ci.org/rcore-os/rcore-user.svg?branch=master)](https://travis-ci.org/rcore-os/rcore-user)
User programs for [rCore OS](https://github.com/rcore-os/rCore).
<!--ts-->
* [rCore-user](#rcore-user)
* [Build](#build)
* [Support matrix](#support-matrix)
* [How to run real world programs](#how-to-run-real-world-programs)
* [How to use Redis](#how-to-use-redis)
* [How to use nginx](#how-to-use-nginx)
* [How to use gcc](#how-to-use-gcc)
<!-- Added by: macbookpro, at: Fri Mar 29 14:02:36 CST 2019 -->
<!--te-->
User programs for [rCore OS](https://github.com/rcore-os/rCore).
Now it has 4 parts:
* `ucore`: C-lang, from the original [ucore_os_lab](https://github.com/chyyuu/ucore_os_plus)
* `biscuit`: C/C++, from [Biscuit](https://github.com/mit-pdos/biscuit), based on a `musl` instead of original `litc`.
* `rust`: Simple no_std Rust programs.
* `nginx`, `redis`, `busybox`, `alpine`: Real world applications.
* `nginx`, `redis`, `busybox`, `alpine`, `gcc`: Real world applications.
## Build
@ -46,10 +60,11 @@ A rootfs is created at `build/$(arch)` and converted to `qcow2`.
| redis (linux only) | ✅ | ✅ | ✅ | ❌ |
| busybox | ✅ | ✅ | ❌ | ✅ |
| alpine rootfs | ✅ | ✅ | ❌ | ❌ |
| iperf3 | ✅ | ❌ | ❌ | ❌ |
## How to run real world programs
## How to use Redis
### How to use Redis
If redis is dynamically linked to musl (default if you use commands above), you might need to copy `ld-musl-$(arch).so.1` to rootfs `/lib` . Alpine rootfs includes one as well.
@ -72,7 +87,7 @@ $ redis-cli -h 10.0.0.2 get abc
Note: `redis-cli` in rCore is not working at the time.
## How to use nginx
### How to use nginx
Nginx is statically linked to musl instead, so there is no need to copy its dynamic loader. A nginx.conf is provided in this repo and automatically copied to its destination. So, just start `nginx` directly:
@ -121,3 +136,23 @@ $ curl http://10.0.0.2/
It is generated by `autoindex`.
Note: `nginx` might lead to an unresolved file system bug, so you might need to re-create sfs img after killing it.
### How to use gcc
First, download prebuilt musl toolchain from [musl.cc](https://musl.cc), for example `x86_64-linux-musl-cross.tgz`. Untar it into `build/x86_64` directory. You are expected have a `build/x86_64/x86_64-linux-musl` directory now.
To build a simple C program, `printf.c` for example:
```bash
$ x86_64-linux-musl-cross/bin/x86_64-linux-musl-gcc printf.c -c -o printf.o
$ x86_64-linux-musl-cross/bin/x86_64-linux-musl-ld -dynamic-linker /lib/ld-musl-x86_64.so.1 x86_64-linux-musl-cross/x86_64-linux-musl/lib/crt1.o x86_64-linux-musl-cross/x86_64-linux-musl/lib/crtn.o x86_64-linux-musl-cross/lib/gcc/x86_64-linux-musl/8.3.0/crtbeginS.o x86_64-linux-musl-cross/lib/gcc/x86_64-linux-musl/8.3.0/crtendS.o printf.o -o printf -lc -static
```
You can now run the produced program:
```bash
$ printf
Built within rCore
```
Note: the long linker args can be replaced by invoking gcc instead later when we fix the problem. If you encountered `rcore-fs-fuse` panicking, consider upgrading it to latest version.
Loading…
Cancel
Save