From 35cf48cdc8c7ca4468011faeb6d541d6a0cfb031 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Sat, 17 May 2014 00:34:46 +0200 Subject: [PATCH] base-okl4: migrate to new ports mechanism Issue #1082 --- .gitignore | 2 - repos/base-okl4/Makefile | 56 ++---------------------- repos/base-okl4/lib/mk/platform.inc | 11 +++++ repos/base-okl4/lib/mk/x86/kernel.mk | 2 +- repos/base-okl4/mk/spec-okl4.mk | 2 +- repos/base-okl4/ports/okl4.hash | 1 + repos/base-okl4/ports/okl4.port | 10 +++++ repos/base-okl4/run/env | 2 +- repos/base-okl4/src/kernel/target.inc | 2 +- repos/base-okl4/src/kernel/x86/target.mk | 6 +-- 10 files changed, 33 insertions(+), 61 deletions(-) create mode 100644 repos/base-okl4/ports/okl4.hash create mode 100644 repos/base-okl4/ports/okl4.port diff --git a/.gitignore b/.gitignore index fc13b6194b..3589316044 100644 --- a/.gitignore +++ b/.gitignore @@ -11,8 +11,6 @@ /repos/base-foc/contrib /repos/base-nova/contrib /repos/base-nova/download -/repos/base-okl4/contrib -/repos/base-okl4/download /repos/base-pistachio/contrib /repos/dde_ipxe/contrib /repos/dde_linux/contrib diff --git a/repos/base-okl4/Makefile b/repos/base-okl4/Makefile index 3470db5f5e..cc228bc33c 100644 --- a/repos/base-okl4/Makefile +++ b/repos/base-okl4/Makefile @@ -2,37 +2,9 @@ # \brief Download, unpack and patch OKL4 source code # \author Stefan Kalkowski # \date 2011-05-02 - -DOWNLOAD_DIR = download -CONTRIB_DIR = contrib/okl4 - -VERBOSE ?= @ -ECHO = @echo -OKL4_VERSION = okl4_2.1.1-patch.9 -OKL4_ARCHIVE = $(OKL4_VERSION).tar.gz -OKL4_URI = http://wiki.ok-labs.com/downloads/release-2.1.1-patch.9/$(OKL4_ARCHIVE) -PATCHES = $(shell find patches -name *.patch) -SHELL = bash - # -# Utility to check if a tool is installed -# -check_tool = $(if $(shell which $(1)),,$(error Need to have '$(1)' installed.)) -$(call check_tool,wget) -$(call check_tool,patch) -$(call check_tool,sed) - -# -# Determine python version to use for OKL4's elfweaver -# -PYTHON2 := $(notdir $(lastword $(shell which python2 python2.{4,5,6,7,8}))) -ifeq ($(PYTHON2),) -prepare: python_not_installed -python_not_installed: - $(ECHO) "Error: OKL4 needs Python 2 to be installed" - @false; -endif +VERBOSE ?= @ # # Print help information by default @@ -43,29 +15,9 @@ help: $(ECHO) $(ECHO) "--- available commands ---" $(ECHO) "prepare - download and extract the OKL4 source code" - $(ECHO) "clean - clean everything except downloaded archives" - $(ECHO) "cleanall - clean everything including downloaded archives" $(ECHO) -$(DOWNLOAD_DIR)/$(OKL4_ARCHIVE): - $(ECHO) "downloading source code to '$(DOWNLOAD_DIR)/'" - $(VERBOSE)mkdir -p $(DOWNLOAD_DIR) - $(VERBOSE)wget -c $(OKL4_URI) -O $@ +prepare: + $(VERBOSE)../../tool/ports/prepare_port okl4 -$(CONTRIB_DIR): clean - -$(CONTRIB_DIR): $(DOWNLOAD_DIR)/$(OKL4_ARCHIVE) - $(ECHO) "unpacking source code to '$(CONTRIB_DIR)/'" - $(VERBOSE)tar xzf $< - $(VERBOSE)mv $(OKL4_VERSION) $@ - $(ECHO) "applying patches to '$(CONTRIB_DIR)/'" - $(VERBOSE)for i in $(PATCHES); do patch -d $@ -p1 < $$i; done - $(VERBOSE)sed -i "s/env python/env $(PYTHON2)/" $(CONTRIB_DIR)/tools/pyelf/elfweaver - -prepare: $(CONTRIB_DIR) - -clean: - $(VERBOSE)rm -rf $(CONTRIB_DIR) - -cleanall: clean - $(VERBOSE)rm -rf $(DOWNLOAD_DIR) +clean cleanall: diff --git a/repos/base-okl4/lib/mk/platform.inc b/repos/base-okl4/lib/mk/platform.inc index e33e29caa7..19ac287b81 100644 --- a/repos/base-okl4/lib/mk/platform.inc +++ b/repos/base-okl4/lib/mk/platform.inc @@ -55,3 +55,14 @@ $(BUILD_BASE_DIR)/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 $@) + ln -sf $(OKL4_DIR)/tools/pyelf/elfweaver $@ + diff --git a/repos/base-okl4/lib/mk/x86/kernel.mk b/repos/base-okl4/lib/mk/x86/kernel.mk index 88f5f35a37..beb9635a95 100644 --- a/repos/base-okl4/lib/mk/x86/kernel.mk +++ b/repos/base-okl4/lib/mk/x86/kernel.mk @@ -1,5 +1,5 @@ OKL4_BUILD_DIR = $(BUILD_BASE_DIR)/kernel -OKL4_SRC_DIR = $(REP_DIR)/contrib/okl4 +OKL4_SRC_DIR = $(call select_from_ports,okl4)/src/kernel/okl4 ARCH_DIR = $(OKL4_SRC_DIR)/arch/ia32 PLAT_DIR = $(OKL4_SRC_DIR)/platform/pc99 INC_SYMLINKS = arch/apic.h \ diff --git a/repos/base-okl4/mk/spec-okl4.mk b/repos/base-okl4/mk/spec-okl4.mk index c52d22d9d7..6047671ce0 100644 --- a/repos/base-okl4/mk/spec-okl4.mk +++ b/repos/base-okl4/mk/spec-okl4.mk @@ -11,7 +11,7 @@ # # If no OKL4 source directory is set, we use the standard contrib directory # -OKL4_DIR ?= $(BASE_DIR)/../base-okl4/contrib/okl4 +OKL4_DIR ?= $(call select_from_ports,okl4)/src/kernel/okl4 # # Make sure that symlink modification times are handled correctly. diff --git a/repos/base-okl4/ports/okl4.hash b/repos/base-okl4/ports/okl4.hash new file mode 100644 index 0000000000..421376db9e --- /dev/null +++ b/repos/base-okl4/ports/okl4.hash @@ -0,0 +1 @@ +dummy diff --git a/repos/base-okl4/ports/okl4.port b/repos/base-okl4/ports/okl4.port new file mode 100644 index 0000000000..e4a96bebd3 --- /dev/null +++ b/repos/base-okl4/ports/okl4.port @@ -0,0 +1,10 @@ +LICENSE := OKL4 +VERSION := 2.1.1 +DOWNLOADS := okl4.archive + +URL(okl4) := http://wiki.ok-labs.com/downloads/release-2.1.1-patch.9/okl4_2.1.1-patch.9.tar.gz +SHA(okl4) := ff3062344fd6b0a3bd69d99583aa271d3bb13911 +DIR(okl4) := src/kernel/okl4 + +PATCHES := $(wildcard $(REP_DIR)/patches/*.patch) +PATCH_OPT := -p1 -d src/kernel/okl4 diff --git a/repos/base-okl4/run/env b/repos/base-okl4/run/env index b3c3c4c1b7..b8ec42c51e 100644 --- a/repos/base-okl4/run/env +++ b/repos/base-okl4/run/env @@ -166,7 +166,7 @@ proc build_boot_image {binaries} { # # Run ELF Weaver to create a boot image # - set ret [exec "[okl4_dir]/tools/pyelf/elfweaver" merge --output "[run_dir]/image.elf" "[run_dir].weaver.xml"] + set ret [exec "./tool/okl4/elfweaver" merge --output "[run_dir]/image.elf" "[run_dir].weaver.xml"] if {[regexp "error" $ret dummy]} { puts stderr "Elfweaver failed: $ret" exit -6 diff --git a/repos/base-okl4/src/kernel/target.inc b/repos/base-okl4/src/kernel/target.inc index 7696ddfaf6..9f66792a9c 100644 --- a/repos/base-okl4/src/kernel/target.inc +++ b/repos/base-okl4/src/kernel/target.inc @@ -1,5 +1,5 @@ TARGET = kernel -OKL4_SRC_DIR = $(REP_DIR)/contrib/okl4 +OKL4_SRC_DIR = $(call select_from_ports,okl4)/src/kernel/okl4 OKL4_BUILD_DIR = $(BUILD_BASE_DIR)/kernel REQUIRES += okl4 STARTUP_LIB = diff --git a/repos/base-okl4/src/kernel/x86/target.mk b/repos/base-okl4/src/kernel/x86/target.mk index eb597953fc..467aa36093 100644 --- a/repos/base-okl4/src/kernel/x86/target.mk +++ b/repos/base-okl4/src/kernel/x86/target.mk @@ -47,10 +47,10 @@ LD_TEXT_ADDR = 0xf0100000 -include $(PRG_DIR)/../target.inc -LD_SCRIPT_STATIC = $(OKL4_SRC_DIR)/../generated/x86/linker.ld +LD_SCRIPT_STATIC = $(REP_DIR)/contrib/generated/x86/linker.ld INC_DIR = $(OKL4_BUILD_DIR)/include \ - $(OKL4_SRC_DIR)/../generated/x86 \ + $(REP_DIR)/contrib/generated/x86 \ $(OKL4_SRC_DIR)/pistachio/include -vpath macro_sets.cc $(OKL4_SRC_DIR)/../generated/x86 +vpath macro_sets.cc $(REP_DIR)/contrib/generated/x86 vpath %.spp $(OKL4_SRC_DIR)/arch/ia32/pistachio/src