Skip to content

Commit

Permalink
Merge pull request #531 from ddiss/misc_cleanups_and_minor_fixes
Browse files Browse the repository at this point in the history
Misc cleanups and minor fixes
  • Loading branch information
tavip committed Sep 16, 2023
2 parents 182efc8 + d3a47cf commit 31a835e
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
19 changes: 11 additions & 8 deletions tools/lkl/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ ifneq ($(silent),1)
endif
endif

PREFIX := /usr
PREFIX := /usr
BINDIR := $(PREFIX)/bin
INCDIR := $(PREFIX)/include
LIBDIR := $(PREFIX)/lib

ifeq (,$(srctree))
srctree := $(patsubst %/,%,$(dir $(shell pwd)))
Expand Down Expand Up @@ -119,20 +122,20 @@ clean-conf: clean

headers_install: $(TARGETS)
$(call QUIET_INSTALL, headers) \
install -d $(DESTDIR)$(PREFIX)/include ; \
install -d $(DESTDIR)$(INCDIR) ; \
install -m 644 include/lkl.h include/lkl_host.h $(OUTPUT)include/lkl_autoconf.h \
include/lkl_config.h $(DESTDIR)$(PREFIX)/include ; \
cp -r $(OUTPUT)include/lkl $(DESTDIR)$(PREFIX)/include
include/lkl_config.h $(DESTDIR)$(INCDIR) ; \
cp -r $(OUTPUT)include/lkl $(DESTDIR)$(INCDIR)

libraries_install: $(libs-y:%=$(OUTPUT)%$(SOSUF)) $(OUTPUT)liblkl.a
$(call QUIET_INSTALL, libraries) \
install -d $(DESTDIR)$(PREFIX)/lib ; \
install -m 644 $^ $(DESTDIR)$(PREFIX)/lib
install -d $(DESTDIR)$(LIBDIR) ; \
install -m 644 $^ $(DESTDIR)$(LIBDIR)

programs_install: $(progs-y:%=$(OUTPUT)%$(EXESUF))
$(call QUIET_INSTALL, programs) \
install -d $(DESTDIR)$(PREFIX)/bin ; \
install -m 755 $^ $(DESTDIR)$(PREFIX)/bin
install -d $(DESTDIR)$(BINDIR) ; \
install -m 755 $^ $(DESTDIR)$(BINDIR)

install: headers_install libraries_install programs_install

Expand Down
3 changes: 2 additions & 1 deletion tools/lkl/Makefile.autoconf
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ define virtio_net_dpdk
CFLAGS += -I$$(RTE_SDK)/$$(RTE_TARGET)/include -msse4.2 -mpopcnt
LDFLAGS +=-L$$(RTE_SDK)/$$(RTE_TARGET)/lib
LDFLAGS +=-Wl,--whole-archive $$(DPDK_LIBS) -Wl,--no-whole-archive -lm -ldl
LDFLAGS +=-z noexecstack
endef

define virtio_net_vde
Expand All @@ -72,7 +73,7 @@ define posix_host
$(call set_autoconf_var,VIRTIO_NET,y)
$(call set_autoconf_var,VIRTIO_NET_FD,y)
$(if $(strip $(call find_include,linux/vfio.h)),$(call set_autoconf_var,VFIO_PCI,y))
LDFLAGS += -pie
LDFLAGS += -pie -z noexecstack
CFLAGS += -fPIC -pthread
SOSUF := .so
$(if $(call is_defined,__ANDROID__),$(call android_host),LDLIBS += -lrt -lpthread)
Expand Down
4 changes: 2 additions & 2 deletions tools/lkl/cptofs.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ static int do_entry(const char *_src, const char *_dst, const char *name)
if (cptofs) {
struct lkl_timespec lkl_ts[] = { atime, mtime };

ret = lkl_sys_utimensat(-1, dst,
ret = lkl_sys_utimensat(LKL_AT_FDCWD, dst,
(struct __lkl__kernel_timespec
*)lkl_ts,
LKL_AT_SYMLINK_NOFOLLOW);
Expand All @@ -423,7 +423,7 @@ static int do_entry(const char *_src, const char *_dst, const char *name)
{ .tv_sec = mtime.tv_sec, .tv_nsec = mtime.tv_nsec, },
};

ret = utimensat(-1, dst, ts, AT_SYMLINK_NOFOLLOW);
ret = utimensat(AT_FDCWD, dst, ts, AT_SYMLINK_NOFOLLOW);
}
}

Expand Down
1 change: 1 addition & 0 deletions tools/lkl/fs2tar.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
case ARGP_KEY_END:
if (state->arg_num < 2 || !cla->fsimg_type)
argp_usage(state);
break;
default:
return ARGP_ERR_UNKNOWN;
}
Expand Down
7 changes: 6 additions & 1 deletion tools/lkl/tests/disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static int lkl_test_opendir(void)

dir = lkl_opendir(mnt_point, &err);

lkl_test_logf("lkl_opedir(%s) = %d %s\n", mnt_point, err,
lkl_test_logf("lkl_opendir(%s) = %d %s\n", mnt_point, err,
lkl_strerror(err));

if (err == 0)
Expand Down Expand Up @@ -182,6 +182,11 @@ int main(int argc, const char **argv)
if (parse_args(argc, argv, args) < 0)
return -1;

if (!cla.disk || !cla.fstype) {
fprintf(stderr, "disk and type parameters required.\n");
return -1;
}

lkl_host_ops.print = lkl_test_log;

lkl_init(&lkl_host_ops);
Expand Down

0 comments on commit 31a835e

Please sign in to comment.