Skip to content

Commit

Permalink
Merge pull request rcore-os#165 from wfly1998/master
Browse files Browse the repository at this point in the history
Add image generating
  • Loading branch information
wangrunji0408 authored Aug 28, 2020
2 parents c667f56 + a4da17c commit 8e34c8c
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
26 changes: 25 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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/
Expand All @@ -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 $@
Expand All @@ -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

7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8e34c8c

Please sign in to comment.