Skip to content

Commit

Permalink
Merge pull request #1 from rcore-os/master
Browse files Browse the repository at this point in the history
merge upstream to me
  • Loading branch information
sunshine-lcc authored Apr 13, 2022
2 parents a34f520 + 5389c41 commit c2c9eb7
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 2 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,56 @@ jobs:
- name: Run full tests
if: github.event_name == 'schedule'
run: cd tests && python3 linux_libc_test.py --arch ${{ matrix.arch }}

linux-other-test-baremetal:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
arch: [x86_64, riscv64]
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Pull prebuilt images
run: git lfs pull -I prebuilt/linux/libc-libos.so
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly-2022-01-20
components: rust-src, llvm-tools-preview
- if: matrix.arch == 'riscv64'
uses: actions-rs/[email protected]
with:
crate: cargo-binutils
version: latest
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install musl-tools musl-dev ninja-build -y
pip3 install -r tests/requirements.txt
- name: Cache QEMU
uses: actions/cache@v1
with:
path: qemu-6.1.0
key: qemu-6.1.0-${{ matrix.arch }}
- name: Install QEMU
run: |
[ ! -d qemu-6.1.0 ] && wget https://download.qemu.org/qemu-6.1.0.tar.xz \
&& tar xJf qemu-6.1.0.tar.xz > /dev/null \
&& cd qemu-6.1.0 && ./configure --target-list=${{ matrix.arch }}-softmmu && cd ..
cd qemu-6.1.0 && sudo make install -j
qemu-system-${{ matrix.arch }} --version
- name: Prepare rootfs
run: |
if [ "${{ matrix.arch }}" = "x86_64" ]; then
make rootfs && make image
elif [ "${{ matrix.arch }}" = "riscv64" ]; then
make riscv-image
fi
- name: Run fast tests
if: github.event_name != 'schedule'
run: cd tests && python3 linux_other_test.py --arch ${{ matrix.arch }} --fast
- name: Run full tests
if: github.event_name == 'schedule'
run: cd tests && python3 linux_other_test.py --arch ${{ matrix.arch }}
28 changes: 27 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
# Makefile for top level of zCore

# Possible things to $(MAKE):
#
# rootfs-x64 : contains alpine-rootfs for x86_64, and compiled binary of linux-syscall/test/*.c
# riscv-rootfs : prebuilt binary for riscv64, contains busybox, libc-test and oscomp
# libc-test : build binary of libc-test for x86_64
# rcore-fs-fuse : install a tool called rcore-fs-fuse
# image : make a normal x86_64 image from alpine-rootfs
# riscv-image : make a riscv64 image from riscv-rootfs for testing
# clean : delete all files generated by compilation
# doc : cargo doc --open
# baremetal-test-img : make a x86_64 image for testing

ROOTFS_TAR := alpine-minirootfs-3.12.0-x86_64.tar.gz
ROOTFS_URL := http://dl-cdn.alpinelinux.org/alpine/v3.12/releases/x86_64/$(ROOTFS_TAR)

RISCV64_ROOTFS_TAR := prebuild.tar.xz
RISCV64_ROOTFS_URL := https://github.com/rcore-os/libc-test-prebuilt/releases/download/0.1/$(RISCV64_ROOTFS_TAR)
LIBC_TEST_URL := https://github.com/rcore-os/libc-test.git

CROSS_TOOLCHAIN := http://musl.cc/riscv64-linux-musl-cross.tgz
PATH := $(PATH):$(PWD)/toolchain/riscv64-linux-musl-cross/bin

ARCH ?= x86_64
rcore_fs_fuse_revision := 7f5eeac
OUT_IMG := zCore/$(ARCH).img
Expand All @@ -26,6 +43,11 @@ prebuilt/linux/$(ROOTFS_TAR):
prebuilt/linux/riscv64/$(RISCV64_ROOTFS_TAR):
@wget $(RISCV64_ROOTFS_URL) -O $@

toolchain:
@mkdir -p toolchain
@cd toolchain && wget $(CROSS_TOOLCHAIN)
@cd toolchain && tar xzf riscv64-linux-musl-cross.tgz

rootfs: prebuilt/linux/$(ROOTFS_TAR)
rm -rf rootfs && mkdir -p rootfs
tar xf $< -C rootfs
Expand Down Expand Up @@ -69,8 +91,12 @@ image: $(OUT_IMG)
@qemu-img resize $(OUT_IMG) +5M


riscv-image: rcore-fs-fuse riscv-rootfs
riscv-image: rcore-fs-fuse riscv-rootfs toolchain
@echo building riscv.img
@cd riscv_rootfs && mv libc-test libc-test-prebuild
@cd riscv_rootfs && git clone $(LIBC_TEST_URL) --depth 1
@cd riscv_rootfs/libc-test && cp config.mak.def config.mak && make ARCH=riscv64 CROSS_COMPILE=riscv64-linux-musl- -j
@cd riscv_rootfs && cp libc-test-prebuild/functional/tls_align-static.exe libc-test/src/functional/
@rcore-fs-fuse zCore/riscv64.img riscv_rootfs zip
@qemu-img resize -f raw zCore/riscv64.img +5M

Expand Down

0 comments on commit c2c9eb7

Please sign in to comment.