Skip to content

Commit

Permalink
feat: 分解 riscv-image,与 x86_64 实现流程一致
Browse files Browse the repository at this point in the history
  • Loading branch information
YdrMaster committed May 6, 2022
1 parent d9531ce commit 9f87804
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,9 @@ jobs:
- name: Prepare rootfs
run: |
if [ "${{ matrix.arch }}" = "x86_64" ]; then
make baremetal-test-img
make test-image
elif [ "${{ matrix.arch }}" = "riscv64" ]; then
ARCH=riscv64 make riscv-image
ARCH=riscv64 make riscv-test-image
fi
- name: Run fast tests
if: github.event_name != 'schedule'
Expand Down Expand Up @@ -218,7 +218,7 @@ jobs:
- name: Prepare rootfs
run: |
if [ "${{ matrix.arch }}" = "x86_64" ]; then
make rootfs && make image
make image
elif [ "${{ matrix.arch }}" = "riscv64" ]; then
ARCH=riscv64 make riscv-image
fi
Expand Down
27 changes: 14 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,25 @@ PATH := $(PATH):$(PWD)/toolchain/riscv64-linux-musl-cross/bin
ARCH ?= x86_64
OUT_IMG := zCore/$(ARCH).img

.PHONY: rootfs clone-libc-test libc-test image baremetal-test-img riscv-image check doc clean
.PHONY: rootfs libc-test riscv-libc-test image riscv-image test-image riscv-test-image check doc clean

rootfs:
cargo rootfs $(ARCH)

clone-libc-test:
libc-test:
cargo xtask libc-test

libc-test: clone-libc-test rootfs
@rm -rf rootfs/libc-test
@cp -r ignored/libc-test rootfs
@cd rootfs/libc-test && cp config.mak.def config.mak && echo 'CC := musl-gcc' >> config.mak && make -j

riscv-libc-test:
cargo xtask libc-test
@mv riscv_rootfs/libc-test riscv_rootfs/libc-test-prebuild
@cp -r ignored/libc-test riscv_rootfs
@cd riscv_rootfs/libc-test && cp config.mak.def config.mak && make ARCH=$(ARCH) CROSS_COMPILE=$(ARCH)-linux-musl- -j
@cp riscv_rootfs/libc-test-prebuild/functional/tls_align-static.exe riscv_rootfs/libc-test/src/functional/
@rm -rf riscv_rootfs/libc-test-prebuild

image: rootfs
@echo Generating $(OUT_IMG)
cargo image $(ARCH)
Expand All @@ -39,22 +45,17 @@ image: rootfs
@echo Resizing $(OUT_IMG)
@qemu-img resize $(OUT_IMG) +5M

baremetal-test-img: libc-test image

riscv-image: rootfs clone-libc-test
riscv-image: rootfs
@echo Generating $(OUT_IMG)
cargo image $(ARCH)

@mv riscv_rootfs/libc-test riscv_rootfs/libc-test-prebuild
@cp -r ignored/libc-test riscv_rootfs
@cd riscv_rootfs/libc-test && cp config.mak.def config.mak && make ARCH=$(ARCH) CROSS_COMPILE=$(ARCH)-linux-musl- -j
@cp riscv_rootfs/libc-test-prebuild/functional/tls_align-static.exe riscv_rootfs/libc-test/src/functional/
@rm -rf riscv_rootfs/libc-test-prebuild

@rcore-fs-fuse $(OUT_IMG) riscv_rootfs zip
@echo Resizing $(OUT_IMG)
@qemu-img resize -f raw $(OUT_IMG) +5M

test-image: rootfs libc-test image
riscv-test-image: rootfs riscv-libc-test riscv-image

check:
cargo xtask check

Expand Down

0 comments on commit 9f87804

Please sign in to comment.