From 817eb4f23c03bbda68d008b27c5a7692f7d5e00e Mon Sep 17 00:00:00 2001 From: Stefan Kalkowski Date: Tue, 7 May 2019 16:06:01 +0200 Subject: [PATCH] okl4: create elfweaver tools on demand (ref #3329) --- repos/base-okl4/lib/mk/syscall-okl4.inc | 12 ------------ repos/base-okl4/lib/mk/tools.mk | 11 +++++++++++ tool/run/boot_dir/okl4 | 8 +++++++- 3 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 repos/base-okl4/lib/mk/tools.mk diff --git a/repos/base-okl4/lib/mk/syscall-okl4.inc b/repos/base-okl4/lib/mk/syscall-okl4.inc index 39f0bd2fb2..cf789ae577 100644 --- a/repos/base-okl4/lib/mk/syscall-okl4.inc +++ b/repos/base-okl4/lib/mk/syscall-okl4.inc @@ -50,15 +50,3 @@ include/bootinfo: $(OKL4_DIR)/libs/bootinfo/include $(VERBOSE)ln -sf $< $@ endif - -# -# Create symlink to elfweaver so that the run tool can use it from within the -# build directory. -# -HOST_TOOLS += $(BUILD_BASE_DIR)/tool/okl4/elfweaver - -$(BUILD_BASE_DIR)/tool/okl4/elfweaver: - mkdir -p $(dir $@) - cp -a $(OKL4_DIR)/tools/pyelf $(dir $@)/ - ln -sf pyelf/elfweaver $@ - diff --git a/repos/base-okl4/lib/mk/tools.mk b/repos/base-okl4/lib/mk/tools.mk new file mode 100644 index 0000000000..40d07e581c --- /dev/null +++ b/repos/base-okl4/lib/mk/tools.mk @@ -0,0 +1,11 @@ +# +# Create symlink to elfweaver so that the run tool can use it from within the +# build directory. +# +OKL4_DIR = $(call select_from_ports,okl4)/src/kernel/okl4 +HOST_TOOLS += $(BUILD_BASE_DIR)/tool/okl4/elfweaver + +$(BUILD_BASE_DIR)/tool/okl4/elfweaver: + $(VERBOSE)mkdir -p $(dir $@) + $(VERBOSE)cp -a $(OKL4_DIR)/tools/pyelf $(dir $@)/ + $(VERBOSE)ln -sf pyelf/elfweaver $@ diff --git a/tool/run/boot_dir/okl4 b/tool/run/boot_dir/okl4 index a1bd4d20bc..fa77895bd3 100644 --- a/tool/run/boot_dir/okl4 +++ b/tool/run/boot_dir/okl4 @@ -98,6 +98,12 @@ proc run_boot_string { } { proc core_link_address { } { return "0x03000000" } +proc elfweaver {} { + if { ![file exists tool/okl4/elfweaver] } { build LIB=tools } + return tool/okl4/elfweaver +} + + ## # Populate directory with binaries on OKL4 # @@ -135,7 +141,7 @@ proc run_boot_dir {binaries} { # # Run ELF Weaver to create a boot image # - set ret [exec "./tool/okl4/elfweaver" merge --output "[run_dir]/image.elf" "[run_dir].weaver.xml"] + set ret [exec [elfweaver] merge --output "[run_dir]/image.elf" "[run_dir].weaver.xml"] if {[regexp "error" $ret dummy]} { puts stderr "Elfweaver failed: $ret" exit -6