Skip to content

Commit 348dcea

Browse files
committed
Mount kernel module directory
1 parent ee53d67 commit 348dcea

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Makefile

+8-3
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ else ifeq ($(filter x86_64 arm64 i386,$(ARCH)),)
3131
endif
3232

3333
.PHONY: default
34-
default: linux tools-vm
34+
default: linux linux_modules tools-vm
3535

3636
.PHONY: clean
3737
clean: linux_clean tools-vm_clean
@@ -198,7 +198,6 @@ ifneq (,$(wildcard $(LINUX_SRC)/scripts/clang-tools/gen_compile_commands.py))
198198
cd $(LINUX_SRC) && ./scripts/clang-tools/gen_compile_commands.py -d $(LINUX_OUT)
199199
endif
200200

201-
202201
.PHONY: linux_modules
203202
linux_modules $(LINUX_OUT_MODULES_DEP): $(KERNEL_IMAGE)
204203
+ $(LINUX_MAKE) modules
@@ -368,6 +367,7 @@ QEMU_ARGS := \
368367
-kernel $(QEMU_KERNEL_IMAGE) \
369368
-netdev user,id=eth0,hostfwd=tcp::7777-:7777,hostfwd=tcp::2222-:22,hostfwd=tcp::2223-:23 -device virtio-net-pci,netdev=eth0 \
370369
-virtfs local,security_model=mapped-xattr,path=$(SHARED_DIR),mount_tag=shared \
370+
-virtfs local,security_model=mapped-xattr,path=$(LINUX_MODULES_INSTALL_PATH)/lib/modules,mount_tag=modules \
371371
-echr $(ECHR) \
372372
$(QEMU_EXTRA_ARGS)
373373

@@ -417,8 +417,13 @@ QEMU_ARGS += -append "$(QEMU_KERNEL_CMDLINE) $(QEMU_EXTRA_KERNEL_CMDLINE)"
417417

418418
RUN_DEPS := $(QEMU_KERNEL_IMAGE)
419419

420+
# Make sure the modules directory exists, even if it's empty. Otherwise mount
421+
# will fail.
422+
$(LINUX_MODULES_INSTALL_PATH)/lib/modules:
423+
mkdir -p $@
424+
420425
.PHONY: run
421-
run: $(RUN_DEPS) | $(SHARED_DIR)
426+
run: $(RUN_DEPS) | $(SHARED_DIR) $(LINUX_MODULES_INSTALL_PATH)/lib/modules
422427
@echo "$(GREEN)Running QEMU, press 'ctrl-a x' to quit $(NC)"
423428
ifeq ($(GDB),1)
424429
@echo "$(ARCH) $(ACK)" > $(OUT_DIR)/.gdb

config/rootfs-overlay/etc/init.d/setup

+3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ case "$1" in
2626
mkdir -p /shared
2727
mount -t 9p -o trans=virtio,version=9p2000.L shared /shared
2828

29+
mkdir -p /lib/modules
30+
mount -t 9p -o trans=virtio,version=9p2000.L modules /lib/modules
31+
2932
mount -t debugfs none /sys/kernel/debug
3033
[ ! -e /d ] && ln -s /sys/kernel/debug /d
3134

0 commit comments

Comments
 (0)