Skip to content

Commit fd24f55

Browse files
Add uthash.h and revise some text
- Included uthash.h header file in the repository - Eliminates the need for system-wide uthash-dev installation - Ensures consistent builds across all environments Besides, I revise some description of reeadme to be clearer. - folder -> directory And minimize the necessary changes in linux.config.
1 parent 44d4ed7 commit fd24f55

File tree

6 files changed

+1160
-24
lines changed

6 files changed

+1160
-24
lines changed

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ endif
4444
# virtio-fs
4545
ENABLE_VIRTIOFS ?= 1
4646
$(call set-feature, VIRTIOFS)
47-
MOUNT_FOLDER ?= ./shared
47+
MOUNT_DIRECTORY ?= ./shared
4848
ifeq ($(call has, VIRTIOFS), 1)
4949
OBJS_EXTRA += virtio-fs.o
50-
OPTS += -s $(MOUNT_FOLDER)
50+
OPTS += -s $(MOUNT_DIRECTORY)
5151
endif
5252

5353
NETDEV ?= tap
@@ -206,14 +206,14 @@ ext4.img:
206206
$(Q)dd if=/dev/zero of=$@ bs=4k count=600
207207
$(Q)$(MKFS_EXT4) -F $@
208208

209-
.PHONY: $(MOUNT_FOLDER)
210-
$(MOUNT_FOLDER):
209+
.PHONY: $(DIRECTORY)
210+
$(MOUNT_DIRECTORY):
211211
@if [ ! -d $@ ]; then \
212-
echo "Creating mount folder: $@"; \
212+
echo "Creating mount directory: $@"; \
213213
mkdir -p $@; \
214214
fi
215215

216-
check: $(BIN) minimal.dtb $(KERNEL_DATA) $(INITRD_DATA) $(DISKIMG_FILE) $(MOUNT_FOLDER)
216+
check: $(BIN) minimal.dtb $(KERNEL_DATA) $(INITRD_DATA) $(DISKIMG_FILE) $(MOUNT_DIRECTORY)
217217
@$(call notice, Ready to launch Linux kernel. Please be patient.)
218218
$(Q)./$(BIN) -k $(KERNEL_DATA) -c $(SMP) -b minimal.dtb -i $(INITRD_DATA) -n $(NETDEV) $(OPTS)
219219

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,32 +77,32 @@ You can exit the emulator using: \<Ctrl-a x\>. (press Ctrl+A, leave it, afterwar
7777
## Usage
7878

7979
```shell
80-
./semu -k linux-image [-b dtb-file] [-i initrd-image] [-d disk-image] [-s mount-folder]
80+
./semu -k linux-image [-b dtb-file] [-i initrd-image] [-d disk-image] [-s mount-directory]
8181
```
8282

8383
* `linux-image` is the path to the Linux kernel `Image`.
8484
* `dtb-file` is optional, as it specifies the user-specified device tree blob.
8585
* `initrd-image` is optional, as it specifies the user-specified initial RAM disk image.
8686
* `disk-image` is optional, as it specifies the path of a disk image in ext4 file system for the virtio-blk device.
87-
* `mount-folder` is optional, as it specifies the path of a folder you want to mount in host.
87+
* `mount-directory` is optional, as it specifies the path of a directory you want to mount in host.
8888

89-
## Mount and unmount a folder in semu
89+
## Mount and unmount a directory in semu
9090

91-
To mount the folder in semu:
91+
To mount the directory in semu:
9292

9393
```shell
94-
$ mount -t virtiofs myfs [mount-folder]
94+
$ mount -t virtiofs myfs [mount-directory]
9595
```
9696

97-
* `mount-folder` is the path of a folder you want to mount in semu.
97+
* `mount-directory` is the path of a directory you want to mount in semu.
9898

99-
To unmount the folder in semu:
99+
To unmount the directory in semu:
100100

101101
```shell
102-
$ umount [mount-folder]
102+
$ umount [mount-directory]
103103
```
104104

105-
* `mount-folder` is the path of a folder you want to unmount in semu.
105+
* `mount-directory` is the path of a directory you want to unmount in semu.
106106

107107

108108
## Build Linux kernel image and root file system

configs/linux.config

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,7 @@ CONFIG_SRCU=y
102102
CONFIG_TINY_SRCU=y
103103
# end of RCU Subsystem
104104

105-
CONFIG_IKCONFIG=y
106-
CONFIG_IKCONFIG_PROC=y
105+
# CONFIG_IKCONFIG is not set
107106
# CONFIG_IKHEADERS is not set
108107
CONFIG_LOG_BUF_SHIFT=16
109108
CONFIG_PRINTK_SAFE_LOG_BUF_SHIFT=12
@@ -948,10 +947,6 @@ CONFIG_SND=y
948947
CONFIG_SND_VIRTIO=y
949948
CONFIG_SND_HRTIMER=y
950949

951-
CONFIG_CUSE=y
952-
CONFIG_FUSE_FS=y
953-
CONFIG_VIRTIO_FS=y
954-
955950
#
956951
# HID support
957952
#
@@ -1262,7 +1257,9 @@ CONFIG_INOTIFY_USER=y
12621257
# CONFIG_QUOTA is not set
12631258
CONFIG_AUTOFS4_FS=y
12641259
CONFIG_AUTOFS_FS=y
1265-
1260+
CONFIG_CUSE=y
1261+
CONFIG_FUSE_FS=y
1262+
CONFIG_VIRTIO_FS=y
12661263
# CONFIG_OVERLAY_FS is not set
12671264

12681265
#

device.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
#if SEMU_HAS(VIRTIONET)
44
#include "netdev.h"
55
#endif
6-
#include <uthash.h>
6+
#if SEMU_HAS(VIRTIOFS)
7+
#include "uthash.h"
8+
#endif
79
#include "riscv.h"
810
#include "virtio.h"
911

fuse.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ struct fuse_entry_out {
115115
uint64_t attr_valid; // attr cache timeout (sec)
116116
uint32_t entry_valid_nsec; // cache timeout (nsec)
117117
uint32_t attr_valid_nsec; // attr cache timeout (nsec)
118-
struct fuse_attr attr; // file attributes (與 stat 結構相似)
118+
struct fuse_attr attr; // file attributes
119119
};
120120

121121
struct fuse_dirent {

0 commit comments

Comments
 (0)