dde_linux: migrate to new ports mechanism

Issue #1082
This commit is contained in:
Sebastian Sumpf 2014-05-20 16:09:29 +02:00 committed by Norman Feske
parent abcb0f62d7
commit d1e10e939d
11 changed files with 76 additions and 118 deletions

View File

@ -1,74 +1,25 @@
#
# \brief Download integrate Linux kernel sources with Genode
# \author Norman Feske
# \date 2012-01-28
# \brief Download, and unpack Linux
# \author Sebastian Sumpf
# \date 2014-05-20
#
CONTRIB_DIR = contrib
DOWNLOAD_DIR = download
VERBOSE ?= @
ECHO = @echo
PATCHES := $(shell find patches -name \*.patch)
LINUX = linux-3.9
LINUX_TGZ = $(LINUX).tar.gz
LINUX_URL = http://www.kernel.org/pub/linux/kernel/v3.x/$(LINUX_TGZ)
# Raspberry Pi
DWC_OTG_GIT_URL := https://github.com/nfeske/dwc_otg.git
DWC_OTG_GIT_BRANCH := r1
#
#
# 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)
ECHO := @echo
#
# Print help information by default
#
help:
help::
prepare:
$(VERBOSE)../../tool/ports/prepare_port dde_linux CHECK_HASH=no
help::
$(ECHO)
$(ECHO) "Download integrate Linux kernel sources with Genode"
$(ECHO) "Prepare the dde_linux repository"
$(ECHO)
$(ECHO) "--- available commands ---"
$(ECHO) "prepare - download and integrate Linux source code"
$(ECHO) "clean - remove contib sources except downloaded archives"
$(ECHO) "cleanall - remove contib sources and downloaded archives"
$(ECHO) "prepare - checkout upstream source codes"
$(ECHO)
prepare: clean $(CONTRIB_DIR)/.prepared
prepare_rpi: prepare
$(VERBOSE)cd $(CONTRIB_DIR)/drivers/usb/host; \
git clone $(DWC_OTG_GIT_URL) dwc_otg
$(VERBOSE)cd $(CONTRIB_DIR)/drivers/usb/host/dwc_otg; \
git reset --hard HEAD && git checkout $(DWC_OTG_GIT_BRANCH)
$(CONTRIB_DIR)/.prepared: Makefile
$(CONTRIB_DIR)/.prepared: $(DOWNLOAD_DIR)/$(LINUX_TGZ)
$(ECHO) "extracting source code to '$(CONTRIB_DIR)'"
$(VERBOSE)tar xfz $< --transform "s{$(LINUX){$(CONTRIB_DIR){" --files-from files.list
$(VERBOSE)tar xfz $< --transform "s{$(LINUX){$(CONTRIB_DIR)/lxip{" --files-from lxip_header.list
$(VERBOSE)touch $@
$(ECHO) "applying patches to '$(CONTRIB_DIR)/'"
$(VERBOSE)for i in $(PATCHES); do patch -d $(CONTRIB_DIR) -p1 < $$i; done
$(VERBOSE)touch $(CONTRIB_DIR)/drivers/usb/dwc3/gadget.h
$(VERBOSE)touch $(CONTRIB_DIR)/drivers/usb/dwc3/debug.h
$(DOWNLOAD_DIR):
$(VERBOSE)mkdir -p $@
$(DOWNLOAD_DIR)/$(LINUX_TGZ): $(DOWNLOAD_DIR)
$(ECHO) "downloading source code to '$@'"
$(VERBOSE)cd $(DOWNLOAD_DIR); wget -c $(LINUX_URL)
$(VERBOSE)touch $@
clean:
$(VERBOSE)rm -rf $(CONTRIB_DIR)
cleanall: clean
$(VERBOSE)rm -rf $(DOWNLOAD_DIR)

View File

@ -5,17 +5,17 @@ LIB_INC_DIR = $(LIB_DIR)/include
LIBS += base cxx dde_kit
CONTRIB_DIR := $(REP_DIR)/contrib
NET_DIR := $(CONTRIB_DIR)/net
LX_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/lib/dde_linux
NET_DIR := $(LX_CONTRIB_DIR)/net
#
# The order of include-search directories is important, we need to look into
# 'contrib' before falling back to our custom 'lx_emul.h' header.
#
INC_DIR += $(LIB_INC_DIR)
INC_DIR += $(CONTRIB_DIR)/include $(CONTRIB_DIR)/include/uapi \
$(CONTRIB_DIR)/lxip/include $(CONTRIB_DIR)/lxip/include/uapi \
$(CONTRIB_DIR)
INC_DIR += $(LX_CONTRIB_DIR)/include $(LX_CONTRIB_DIR)/include/uapi \
$(LX_CONTRIB_DIR)/lxip/include $(LX_CONTRIB_DIR)/lxip/include/uapi \
$(LX_CONTRIB_DIR)
CC_OLEVEL = -O2
@ -57,13 +57,13 @@ SRC_C += net/ipv4/ipconfig.c
# Determine the header files included by the contrib code. For each
# of these header files we create a symlink to 'lx_emul.h'.
#
GEN_INCLUDES := $(shell grep -rh "^\#include .*\/" $(CONTRIB_DIR) |\
GEN_INCLUDES := $(shell grep -rh "^\#include .*\/" $(LX_CONTRIB_DIR) |\
sed "s/^\#include [^<\"]*[<\"]\([^>\"]*\)[>\"].*/\1/" | sort | uniq)
#
# Filter out original Linux headers that exist in the contrib directory
#
NO_GEN_INCLUDES := $(shell cd $(CONTRIB_DIR); find -name "*.h" | sed "s/.\///" | sed "s/.*include\///")
NO_GEN_INCLUDES := $(shell cd $(LX_CONTRIB_DIR); find -name "*.h" | sed "s/.\///" | sed "s/.*include\///")
GEN_INCLUDES := $(filter-out $(NO_GEN_INCLUDES),$(GEN_INCLUDES))
#
@ -88,6 +88,6 @@ $(GEN_INCLUDES):
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)ln -s $(LIB_INC_DIR)/lx_emul.h $@
vpath %.c $(CONTRIB_DIR)
vpath %.c $(LX_CONTRIB_DIR)
vpath %.c $(LIB_DIR)
vpath %.cc $(LIB_DIR)

View File

@ -6,7 +6,7 @@ include $(REP_DIR)/lib/mk/arm/usb.inc
CC_OPT += -DCONFIG_USB_EHCI_S5P -DCONFIG_USB_EHCI_TT_NEWSCHED -DCONFIG_OF -DCONFIG_USB_DWC3_HOST \
-DCONFIG_USB_OTG_UTILS -DCONFIG_USB_XHCI_PLATFORM -DDWC3_QUIRK
INC_DIR += $(CONTRIB_DIR)/arch/arm/plat-samsung/include
INC_DIR += $(LX_CONTRIB_DIR)/arch/arm/plat-samsung/include
SRC_CC += platform.cc
#DWC3
@ -16,5 +16,5 @@ SRC_C += dwc3-exynos.c host.c core.c
SRC_C += xhci-plat.c
vpath platform.cc $(LIB_DIR)/arm/platform_arndale
vpath %.c $(CONTRIB_DIR)/drivers/usb/dwc3
vpath %.c $(CONTRIB_DIR)/drivers/net/usb
vpath %.c $(LX_CONTRIB_DIR)/drivers/usb/dwc3
vpath %.c $(LX_CONTRIB_DIR)/drivers/net/usb

View File

@ -7,4 +7,4 @@ CC_OPT += -DCONFIG_USB_EHCI_HCD_OMAP -DCONFIG_USB_EHCI_TT_NEWSCHED -DVERBOSE_DE
SRC_CC += platform.cc
vpath platform.cc $(LIB_DIR)/arm/platform_panda
vpath %.c $(CONTRIB_DIR)/drivers/net/usb
vpath %.c $(LX_CONTRIB_DIR)/drivers/net/usb

View File

@ -37,12 +37,12 @@ CC_OPT += -DINTERRUPT_VC_USB=9
# for 'dwc_otg_driver.c' for preventing calls to set_irq_type
CC_OPT += -DIRQF_TRIGGER_LOW=1
INC_DIR += $(CONTRIB_DIR)/drivers/usb/host/dwc_otg/dwc_common_port \
$(CONTRIB_DIR)/drivers/usb/host/dwc_otg/dwc_otg
INC_DIR += $(LX_CONTRIB_DIR)/drivers/usb/host/dwc_otg/dwc_common_port \
$(LX_CONTRIB_DIR)/drivers/usb/host/dwc_otg/dwc_otg
SRC_CC += platform.cc
vpath platform.cc $(LIB_DIR)/arm/platform_rpi
vpath %.c $(CONTRIB_DIR)/drivers/net/usb
vpath %.c $(LX_CONTRIB_DIR)/drivers/net/usb
# enable C++11 support
CC_CXX_OPT += -std=gnu++11

View File

@ -6,8 +6,8 @@ SRC_CC += main.cc lx_emul.cc irq.cc timer.cc event.cc storage.cc \
input_component.cc nic.cc
SRC_C += dummies.c scsi.c evdev.c
CONTRIB_DIR := $(REP_DIR)/contrib
DRIVERS_DIR := $(CONTRIB_DIR)/drivers
LX_CONTRIB_DIR := $(call select_from_ports,dde_linux)/src/lib/dde_linux
DRIVERS_DIR := $(LX_CONTRIB_DIR)/drivers
USB_DIR := $(DRIVERS_DIR)/usb
CC_OLEVEL = -O2
@ -17,7 +17,7 @@ CC_OLEVEL = -O2
# 'contrib' before falling back to our custom 'lx_emul.h' header.
#
INC_DIR += $(LIB_INC_DIR)
INC_DIR += $(CONTRIB_DIR)/include $(CONTRIB_DIR)/include/uapi $(CONTRIB_DIR)
INC_DIR += $(LX_CONTRIB_DIR)/include $(LX_CONTRIB_DIR)/include/uapi $(LX_CONTRIB_DIR)
CC_OPT += -U__linux__ -D__KERNEL__
CC_OPT += -DCONFIG_USB_DEVICEFS -DCONFIG_HOTPLUG -DDEBUG
@ -57,13 +57,13 @@ SRC_C += $(addprefix scsi/,scsi.c constants.c)
# Determine the header files included by the contrib code. For each
# of these header files we create a symlink to 'lx_emul.h'.
#
GEN_INCLUDES := $(shell grep -rh "^\#include .*\/" $(CONTRIB_DIR) |\
GEN_INCLUDES := $(shell grep -rh "^\#include .*\/" $(LX_CONTRIB_DIR) |\
sed "s/^\#include [^<\"]*[<\"]\([^>\"]*\)[>\"].*/\1/" | sort | uniq)
#
# Filter out original Linux headers that exist in the contrib directory
#
NO_GEN_INCLUDES := $(shell cd $(CONTRIB_DIR)/include; find -name "*.h" | sed "s/.\///" | sed "s/.*include\///")
NO_GEN_INCLUDES := $(shell cd $(LX_CONTRIB_DIR)/include; find -name "*.h" | sed "s/.\///" | sed "s/.*include\///")
GEN_INCLUDES := $(filter-out $(NO_GEN_INCLUDES),$(GEN_INCLUDES))
#

View File

@ -16,6 +16,6 @@ include $(REP_DIR)/lib/mk/usb.inc
CC_OPT += -DCONFIG_PCI -DCONFIG_USB_EHCI_PCI=1 -DCONFIG_USB_XHCI_HCD=1
vpath platform.cc $(LIB_DIR)/x86
vpath %.c $(CONTRIB_DIR)/drivers/net/usb
vpath %.c $(LX_CONTRIB_DIR)/drivers/net/usb
# vi:set ft=make :

View File

@ -0,0 +1 @@
dummy

View File

@ -0,0 +1,38 @@
LICENSE := GPL
VERSION := 3.9
DOWNLOADS := dwc_otg.git linux.archive linux_lxip.archive
SRC_DIR := src/lib/dde_linux
#
# The git checkout checks for the existence of SRC_DIR, which is created by the
# Linux extraction, therefore make sure to checkout the GIT sources first.
#
linux.archive linux_lxip.archive: dwc_otg.git
#
# USB and IP stack sources
#
URL(linux) := http://www.kernel.org/pub/linux/kernel/v3.x/linux-$(VERSION).tar.gz
SHA(linux) := 7979f0d670838d0552c7ede5cc06497b81dcd812
DIR(linux) := $(SRC_DIR)
TAR_OPT(linux) := --strip-components=1 --files-from $(REP_DIR)/files.list
#
# IP stack headers
#
URL(linux_lxip) := ${URL(linux)}
SHA(linux_lxip) := ${SHA(linux)}
DIR(linux_lxip) := $(SRC_DIR)/lxip
TAR_OPT(linux_lxip) := --strip-components=1 --files-from $(REP_DIR)/lxip_header.list
#
# Raspberry Pi USB controller
#
URL(dwc_otg) := https://github.com/nfeske/dwc_otg.git
REV(dwc_otg) := r1
DIR(dwc_otg) := $(SRC_DIR)/drivers/usb/host/dwc_otg
PATCHES := patches/*.patch
PATCH_OPT = -p1 -d$(SRC_DIR)
# vi: set ft=make :

View File

@ -16,7 +16,7 @@
#include <base/env.h>
#include <util/list.h>
#include <libc/setjmp.h>
#include <setjmp.h>
extern "C" {
#include <dde_kit/memory.h>

View File

@ -1,33 +1 @@
#
# Add generic libc headers to standard include search paths
#
REP_INC_DIR += include/libc
#
# Add platform-specific libc headers to standard include search paths
#
ifeq ($(filter-out $(SPECS),x86),)
ifeq ($(filter-out $(SPECS),32bit),)
LIBC_REP_INC_DIR = include/libc-i386
endif # 32bit
ifeq ($(filter-out $(SPECS),64bit),)
LIBC_REP_INC_DIR = include/libc-amd64
endif # 32bit
LIBC_REP_INC_DIR += include/libc-x86
endif # x86
ifeq ($(filter-out $(SPECS),arm),)
LIBC_REP_INC_DIR = include/libc-arm
endif # ARM
#
# If we found no valid include path for the configured target platform,
# we have to prevent the build system from building the target. This is
# done by adding an artificial requirement.
#
ifeq ($(LIBC_REP_INC_DIR),)
REQUIRES += libc_support_for_your_target_platform
endif
REP_INC_DIR += $(LIBC_REP_INC_DIR)
include $(call select_from_repositories,lib/import/import-libc.mk)