diff --git a/Makefile b/Makefile index 858c79034..b807f3a3f 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,11 @@ 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) +ARCH := x86_64 +rcore_fs_fuse_revision := 7f5eeac +OUT_IMG := zCore/$(ARCH).img +TMP_ROOTFS := /tmp/rootfs + # for linux syscall tests TEST_DIR := linux-syscall/test/ DEST_DIR := rootfs/bin/ @@ -9,7 +14,7 @@ BASENAMES := $(notdir $(basename $(TEST_PATH))) CFLAG := -Wl,--dynamic-linker=/lib/ld-musl-x86_64.so.1 -.PHONY: rootfs +.PHONY: rootfs libc-test rcore-fs-fuse image prebuilt/linux/$(ROOTFS_TAR): wget $(ROOTFS_URL) -O $@ @@ -23,3 +28,22 @@ rootfs: prebuilt/linux/$(ROOTFS_TAR) libc-test: cd rootfs && git clone git://repo.or.cz/libc-test --depth 1 cd rootfs/libc-test && cp config.mak.def config.mak && echo 'CC := musl-gcc' >> config.mak && make -j + +rcore-fs-fuse: +ifneq ($(shell rcore-fs-fuse dir image git-version), $(rcore_fs_fuse_revision)) + @echo Installing rcore-fs-fuse + @cargo install rcore-fs-fuse --git https://github.com/rcore-os/rcore-fs --rev $(rcore_fs_fuse_revision) --force +endif + +$(OUT_IMG): prebuilt/linux/$(ROOTFS_TAR) rcore-fs-fuse + @echo Generating $(ARCH).img + @mkdir -p $(TMP_ROOTFS) + @tar xf $< -C $(TMP_ROOTFS) + @cp $(TMP_ROOTFS)/lib/ld-musl-x86_64.so.1 rootfs/lib/ + @rcore-fs-fuse $@ rootfs zip + @cp prebuilt/linux/libc-libos.so rootfs/lib/ld-musl-x86_64.so.1 + +image: $(OUT_IMG) + @echo Resizing $(ARCH).img + @qemu-img resize $(OUT_IMG) +50M + diff --git a/README.md b/README.md index 5f986172d..a982e1206 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,13 @@ Run native Zircon program (shell): cargo run --release -p zircon-loader prebuilt/zircon/x64 ``` +Run Linux shell on bare-metal (zCore): + +```sh +make image +cd zCore && make run mode=release linux=1 [graphic=on] [accel=1] +``` + Run Zircon on bare-metal (zCore): ```sh