base-okl4: migrate to new ports mechanism

Issue #1082
This commit is contained in:
Norman Feske 2014-05-17 00:34:46 +02:00
parent 85a2ebc1c4
commit 35cf48cdc8
10 changed files with 33 additions and 61 deletions

2
.gitignore vendored
View File

@ -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

View File

@ -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:

View File

@ -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 $@

View File

@ -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 \

View File

@ -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.

View File

@ -0,0 +1 @@
dummy

View File

@ -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

View File

@ -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

View File

@ -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 =

View File

@ -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