Skip to content

Commit

Permalink
Add target disk_image to Makefile, update README
Browse files Browse the repository at this point in the history
  • Loading branch information
equation314 committed Apr 9, 2023
1 parent daf3651 commit b1fe860
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ LOG ?= warn
A ?= apps/helloworld
APP ?= $(A)
APP_FEATURES ?=
DISK_IMG ?= disk.img

FS ?= n
NET ?= n
Expand Down Expand Up @@ -89,7 +90,6 @@ clippy:
doc:
cargo doc --no-deps --target $(TARGET)


fmt:
cargo fmt --all

Expand All @@ -102,6 +102,13 @@ test:
test_no_fail_fast:
$(call unittest,--no-fail-fast)

disk_image:
ifneq ($(wildcard $(DISK_IMG)),)
@echo "$(YELLOW_C)warning$(END_C): image \"$(DISK_IMG)\" already exists!"
else
$(call make_disk_image,fat32,$(DISK_IMG))
endif

clean: clean_c
rm -rf $(APP)/*.bin $(APP)/*.elf
cargo clean
Expand All @@ -110,4 +117,4 @@ clean_c:
rm -rf ulib/c_libax/build_*
rm -rf $(APP)/*.o

.PHONY: all build disasm run justrun debug clippy fmt fmt_c test test_no_fail_fast clean clean_c doc
.PHONY: all build disasm run justrun debug clippy fmt fmt_c test test_no_fail_fast clean clean_c doc disk_image
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ArceOS was inspired a lot by [Unikraft](https://github.com/unikraft/unikraft).
* [x] TCP net stack using [smoltcp](https://github.com/smoltcp-rs/smoltcp)
* [x] Synchronization/Mutex
* [x] SMP scheduling with single run queue
* [ ] File system
* [x] File system
* [ ] Compatible with Linux apps
* [ ] Interrupt driven device I/O
* [ ] Async I/O
Expand All @@ -43,6 +43,7 @@ The currently supported applications (Rust), as well as their dependent modules
| [yield](apps/task/yield/) | axalloc, axtask | alloc, paging, multitask, sched_fifo | Multi-threaded yielding test |
| [parallel](apps/task/parallel/) | axalloc, axtask | alloc, paging, multitask, sched_fifo | Parallel computing test (to test synchronization & mutex) |
| [sleep](apps/task/sleep/) | axalloc, axtask | alloc, paging, multitask, sched_fifo | Thread sleeping test |
| [shell](apps/fs/shell/) | axalloc, axdriver, axfs | alloc, paging, fs | A simple shell that responds to filesystem operations |
| [httpclient](apps/net/httpclient/) | axalloc, axdriver, axnet | alloc, paging, net | A simple client that sends an HTTP request and then prints the response |
| [echoserver](apps/net/echoserver/) | axalloc, axdriver, axnet, axtask | alloc, paging, net, multitask | A multi-threaded TCP server that reverses messages sent by the client |
| [httpserver](apps/net/httpserver/) | axalloc, axdriver, axnet, axtask | alloc, paging, net, multitask | A multi-threaded HTTP server that serves a static web page |
Expand Down
2 changes: 1 addition & 1 deletion scripts/make/qemu.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ qemu_args-y := -m 128M -smp $(SMP) $(qemu_args-$(ARCH))

qemu_args-$(FS) += \
-device virtio-blk-device,drive=disk0 \
-drive id=disk0,if=none,format=raw,file=disk.img
-drive id=disk0,if=none,format=raw,file=$(DISK_IMG)

qemu_args-$(NET) += \
-device virtio-net-device,netdev=net0 \
Expand Down
11 changes: 11 additions & 0 deletions scripts/make/utils.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,15 @@

GREEN_C := \033[92;1m
CYAN_C := \033[96;1m
YELLOW_C := \033[93;1m
END_C := \033[0m

define make_disk_image_fat32
@echo " $(GREEN_C)Creating$(END_C) FAT32 disk image \"$(1)\" ..."
@dd if=/dev/zero of=$(1) bs=1M count=64
@mkfs.fat -F 32 $(1)
endef

define make_disk_image
$(if $(filter $(1),fat32), $(call make_disk_image_fat32,$(2)))
endef

0 comments on commit b1fe860

Please sign in to comment.