diff --git a/README.md b/README.md index fde5579..3f0ce53 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Berkeley YACC, GNU bison, flex, groff, ELF library and FUSE library. Under Ubuntu, for example, you can do it by command: ```shell -$ sudo apt-get install bison byacc flex groff-base libelf-dev libfuse-dev +$ sudo apt-get install bison byacc flex groff-base libelf-dev ``` You can change a desired filesystem size and swap area size, as required. diff --git a/tools/fsutil/Makefile b/tools/fsutil/Makefile index 95426ec..75bd802 100644 --- a/tools/fsutil/Makefile +++ b/tools/fsutil/Makefile @@ -5,14 +5,21 @@ OBJS = fsutil.o superblock.o block.c inode.o create.o check.o \ file.o mount.o manifest.o PROG = fsutil +# Enable mount option. +#ENABLE_FUSE = 1 + # For Mac OS X ifneq ($(wildcard /usr/local/lib/pkgconfig),) FUSE_PATH = /usr/local/lib/pkgconfig endif # Fuse -MOUNT_CFLAGS = $(shell PKG_CONFIG_PATH=$(FUSE_PATH) pkg-config fuse --cflags) -LIBS += $(shell PKG_CONFIG_PATH=$(FUSE_PATH) pkg-config fuse --libs) +ifneq ($(ENABLE_FUSE),) + CFLAGS += -DENABLE_FUSE + MOUNT_CFLAGS = -DFUSE_USE_VERSION=26 + MOUNT_CFLAGS += $(shell PKG_CONFIG_PATH=$(FUSE_PATH) pkg-config fuse --cflags) + LIBS += $(shell PKG_CONFIG_PATH=$(FUSE_PATH) pkg-config fuse --libs) +endif all: $(PROG) diff --git a/tools/fsutil/fsutil.c b/tools/fsutil/fsutil.c index 1d13294..92a162c 100644 --- a/tools/fsutil/fsutil.c +++ b/tools/fsutil/fsutil.c @@ -85,7 +85,9 @@ static void print_help (char *progname) printf (" %s [--verbose] [--partition=n] disk.img\n", progname); printf (" %s --check [--fix] [--partition=n] disk.img\n", progname); printf (" %s --new [--size=kbytes | --partition=n] [--manifest=file] disk.img [dir]\n", progname); +#ifdef ENABLE_FUSE printf (" %s --mount [--partition=n] disk.img dir\n", progname); +#endif printf (" %s --add [--partition=n] disk.img files...\n", progname); printf (" %s --extract [--partition=n] disk.img\n", progname); printf (" %s --repartition=format disk.img\n", progname); @@ -99,7 +101,9 @@ static void print_help (char *progname) printf (" -s NUM, --size=NUM Size of filesystem in kbytes.\n"); printf (" -M file, --manifest=file\n"); printf (" List of files and attributes to create.\n"); +#ifdef ENABLE_FUSE printf (" -m, --mount Mount the filesystem.\n"); +#endif printf (" -a, --add Add files to filesystem.\n"); printf (" -x, --extract Extract all files.\n"); printf (" -r format, --repartition=format\n"); @@ -889,7 +893,12 @@ int main (int argc, char **argv) print_help (argv[0]); return -1; } +#ifdef ENABLE_FUSE return fs_mount(&fs, argv[i+1]); +#else + fprintf (stderr, "fsutil: -m, --mount options are not supported in this version.\n"); + return -1; +#endif } /* Print the structure of flesystem. */ diff --git a/tools/fsutil/mount.c b/tools/fsutil/mount.c index 489e84d..20f93be 100644 --- a/tools/fsutil/mount.c +++ b/tools/fsutil/mount.c @@ -28,7 +28,7 @@ #include #include -#define FUSE_USE_VERSION 26 +#ifdef ENABLE_FUSE #include #include "bsdfs.h" @@ -909,3 +909,5 @@ int fs_mount(fs_t *fs, char *dirname) printf ("\nFilesystem %s unmounted\n", dirname); return ret; } + +#endif /* ENABLE_FUSE */ diff --git a/tools/virtualmips/Makefile b/tools/virtualmips/Makefile index 76900f4..420cc4e 100644 --- a/tools/virtualmips/Makefile +++ b/tools/virtualmips/Makefile @@ -16,8 +16,11 @@ CFLAGS = -DSIM_PIC32 -DPIC32MX7 -DMAX32 #CFLAGS = -DSIM_PIC32 -DPIC32MX7 -DUBW32 CC = gcc -g -CFLAGS += -Wall -Werror -MT $@ -MD -MP -MF .deps/$*.dep -I/opt/local/include -I/opt/local/include/libelf -LIBS = -lpthread -lelf +CFLAGS += -Wall -Werror -MT $@ -MD -MP -MF .deps/$*.dep +LIBS = -lpthread + +CFLAGS += $(shell pkg-config libelf --cflags) +LIBS += $(shell pkg-config libelf --libs) ifneq ($(wildcard /usr/lib/librt.a),) LIBS += -lrt # Linux diff --git a/tools/virtualmips/dev_vtty.c b/tools/virtualmips/dev_vtty.c index 0d62486..9c8d165 100644 --- a/tools/virtualmips/dev_vtty.c +++ b/tools/virtualmips/dev_vtty.c @@ -803,12 +803,12 @@ static void vtty_read_and_store (vtty_t * vtty) vtty->telnet_opt = c; /* if telnet client can support ttype, ask it to send ttype string */ if ((vtty->telnet_cmd == WILL) && (vtty->telnet_opt == TELOPT_TTYPE)) { - vtty_put_char (vtty, IAC); - vtty_put_char (vtty, SB); + vtty_put_char (vtty, (char)IAC); + vtty_put_char (vtty, (char)SB); vtty_put_char (vtty, TELOPT_TTYPE); vtty_put_char (vtty, TELQUAL_SEND); - vtty_put_char (vtty, IAC); - vtty_put_char (vtty, SE); + vtty_put_char (vtty, (char)IAC); + vtty_put_char (vtty, (char)SE); } vtty->input_state = VTTY_INPUT_TEXT; return;