Skip to content

Commit d366ee9

Browse files
committed
Specify runtime options upon configurations
At present, there is an additional option -d passed to the emulator when the project is built with ENABLE_VIRTIOBLK=1
1 parent 88c7907 commit d366ee9

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Makefile

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,28 @@ CFLAGS := -O2 -g -Wall -Wextra
55
CFLAGS += -include common.h
66

77
OBJS_EXTRA :=
8+
# command line option
9+
OPTS :=
810

911
# virtio-blk
1012
ENABLE_VIRTIOBLK ?= 1
11-
OBJS_EXTRA += virtio-blk.o
1213
$(call set-feature, VIRTIOBLK)
14+
DISKIMG_FILE :=
15+
ifeq ($(call has, VIRTIOBLK), 1)
16+
OBJS_EXTRA += virtio-blk.o
17+
DISKIMG_FILE := ext4.img
18+
OPTS += -d $(DISKIMG_FILE)
19+
endif
1320

1421
# virtio-net
1522
ENABLE_VIRTIONET ?= 1
16-
ifeq ($(UNAME_S),Linux)
17-
OBJS_EXTRA += virtio-net.o
18-
else
23+
ifneq ($(UNAME_S),Linux)
1924
ENABLE_VIRTIONET := 0
2025
endif
2126
$(call set-feature, VIRTIONET)
27+
ifeq ($(call has, VIRTIONET), 1)
28+
OBJS_EXTRA += virtio-net.o
29+
endif
2230

2331
BIN = semu
2432
all: $(BIN) minimal.dtb
@@ -64,9 +72,9 @@ ext4.img:
6472
$(Q)dd if=/dev/zero of=$@ bs=4k count=600
6573
$(Q)mkfs.ext4 -F $@
6674

67-
check: $(BIN) minimal.dtb $(KERNEL_DATA) ext4.img
75+
check: $(BIN) minimal.dtb $(KERNEL_DATA) $(DISKIMG_FILE)
6876
@$(call notice, Ready to launch Linux kernel. Please be patient.)
69-
$(Q)./$(BIN) -k $(KERNEL_DATA) -b minimal.dtb -d ext4.img
77+
$(Q)./$(BIN) -k $(KERNEL_DATA) -b minimal.dtb $(OPTS)
7078

7179
build-image:
7280
scripts/build-image.sh

0 commit comments

Comments
 (0)