Commit 772ca925 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

added append to linux-xlnx recipes instead of the stand alone recipe

parent c6c18813
# Utility functions for various Xilinx specific recipes
# Returns a ':' seperated list of expanded '${BBPATH}/$path'
def get_additional_bbpath_filespath(path, d):
board_extrapaths = []
bbpath = d.getVar("BBPATH", True) or ""
for i in bbpath.split(":"):
board_extrapaths.append(os.path.join(i, path))
if len(board_extrapaths):
return ":".join(board_extrapaths) + ":"
return ""
# Add a prefix or suffix to all paths in the list of paths
# e.g. add 'file://' to all paths
def paths_affix(paths, suffix = "", prefix = ""):
if paths:
files=set()
for path in paths.split():
newpath = path
if suffix and len(suffix) != 0:
newpath = newpath + suffix
if prefix and len(prefix) != 0:
newpath = prefix + newpath
files.add(newpath)
if len(files) != 0:
return ' '.join(files)
return ''
# Expand all relative paths to absolute based on the WORKDIR location
def expand_workdir_paths(variable, d):
workdir = d.getVar("WORKDIR", True)
variable_value = d.getVar(variable, True) or ''
if variable_value:
files=set()
for path in variable_value.split():
if workdir:
files.add(os.path.join(workdir, path))
else:
files.add(path)
if len(files) != 0:
return ' '.join(files)
return ''
# Returns a space seperated list of all files which match the extension, joined
# with the dir path.
def expand_dir_basepaths_by_extension(variable, dir, extension, d):
variable_value = d.getVar(variable, True) or ''
if variable_value:
files=set()
for path in variable_value.split():
if os.path.splitext(path)[1] == extension or extension == None:
if dir:
files.add(os.path.join(dir, os.path.basename(path)))
else:
files.add(os.path.basename(path))
if len(files) != 0:
return ' '.join(files)
return ''
# Default Xilinx BSP Machine settings
# File System Configuration
#IMAGE_FSTYPES ?= "cpio tar.gz ext2 ext2.gz.u-boot ext2.gz"
IMAGE_FSTYPES ?= "ext2.gz.u-boot"
IMAGE_CLASSES += "image_types_uboot"
# Kernel Configuration
PREFERRED_PROVIDER_virtual/kernel ?= "linux-xlnx"
PREFERRED_VERSION_linux-xlnx ?= "3.10%"
PREFERRED_VERSION_linux-yocto ?= "3.8%"
PREFERRED_VERSION_linux-yocto-tiny ?= "3.8%"
# U-Boot Configuration
PREFERRED_PROVIDER_u-boot ?= "u-boot-xlnx"
PREFERRED_VERSION_u-boot-xlnx ?= "v2013.01%"
...@@ -21,7 +21,6 @@ KERNEL_EXTRA_ARGS_zynq += "UIMAGE_LOADADDR=0x8000" ...@@ -21,7 +21,6 @@ KERNEL_EXTRA_ARGS_zynq += "UIMAGE_LOADADDR=0x8000"
# File System Configuration # File System Configuration
IMAGE_FSTYPES ?= "cpio ext2 ext2.gz.u-boot ext2.gz" IMAGE_FSTYPES ?= "cpio ext2 ext2.gz.u-boot ext2.gz"
#IMAGE_FSTYPES ?= "ext2.gz.u-boot"
IMAGE_CLASSES += "image_types_uboot" IMAGE_CLASSES += "image_types_uboot"
# ezynq-u-boot Configuration # ezynq-u-boot Configuration
......
...@@ -4,10 +4,15 @@ ...@@ -4,10 +4,15 @@
# http://www.elphel.com/ # http://www.elphel.com/
require conf/machine/include/tune-zynq.inc require conf/machine/include/tune-zynq.inc
require conf/machine/include/machine-xilinx-default.inc
LINUX_VERSION = "3.10"
# Corresponding from linux-xlnx and ezynq-u-boot # Corresponding from linux-xlnx and ezynq-u-boot
PREFERRED_VERSION_ezynq-u-boot ?= "v2013.01%"
PREFERRED_VERSION_linux-xlnx ?= "3.10%" PREFERRED_VERSION_ezynq-u-boot = "v2013.01%"
PREFERRED_PROVIDER_virtual/kernel = "linux-xlnx"
PREFERRED_VERSION_linux-xlnx = "3.10%"
# microzed machine definition known by ezynq and xilinx u-boot # microzed machine definition known by ezynq and xilinx u-boot
UBOOT_MACHINE = "zynq_microzed_config" UBOOT_MACHINE = "zynq_microzed_config"
......
...@@ -30,4 +30,4 @@ LICENSE = "MIT" ...@@ -30,4 +30,4 @@ LICENSE = "MIT"
inherit core-image inherit core-image
IMAGE_ROOTFS_SIZE = "131072" IMAGE_ROOTFS_SIZE = "131072"
\ No newline at end of file
# Support for device tree generation
FILES_kernel-devicetree = "/boot/devicetree*"
OOT_KERNEL_DEVICETREE_FLAGS ?= "-R 8 -p 0x3000"
python __anonymous () {
oot_devicetree = d.getVar("OOT_KERNEL_DEVICETREE", True) or ''
if oot_devicetree:
depends = d.getVar("DEPENDS", True)
d.setVar("DEPENDS", "%s dtc-native" % depends)
packages = d.getVar("PACKAGES", True)
if "kernel-devicetree" not in packages:
d.setVar("PACKAGES", "%s kernel-devicetree" % packages)
}
do_install_append() {
if test -n "${OOT_KERNEL_DEVICETREE}"; then
for DTS_FILE in ${OOT_KERNEL_DEVICETREE}; do
if [ ! -f ${DTS_FILE} ]; then
echo "Warning: ${DTS_FILE} is not available!"
continue
fi
DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTS_BASE_NAME}/g"`
DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTS_BASE_NAME}/g"`
dtc -I dts -O dtb ${OOT_KERNEL_DEVICETREE_FLAGS} -o ${DTS_BASE_NAME} ${DTS_FILE}
install -m 0644 ${DTS_BASE_NAME} ${D}/${KERNEL_IMAGEDEST}/devicetree-${DTB_SYMLINK_NAME}.dtb
done
fi
}
do_deploy_append() {
if test -n "${OOT_KERNEL_DEVICETREE}"; then
for DTS_FILE in ${OOT_KERNEL_DEVICETREE}; do
if [ ! -f ${DTS_FILE} ]; then
echo "Warning: ${DTS_FILE} is not available!"
continue
fi
DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
DTB_NAME=`echo ${KERNEL_IMAGE_BASE_NAME} | sed "s/${MACHINE}/${DTS_BASE_NAME}/g"`
DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTS_BASE_NAME}/g"`
install -d ${DEPLOYDIR}
install -m 0644 ${B}/${DTS_BASE_NAME} ${DEPLOYDIR}/${DTB_NAME}.dtb
cd ${DEPLOYDIR}
ln -sf ${DTB_NAME}.dtb ${DTB_SYMLINK_NAME}.dtb
cd -
done
fi
}
pkg_postinst_kernel-devicetree () {
cd /${KERNEL_IMAGEDEST}
for DTS_FILE in ${OOT_KERNEL_DEVICETREE}
do
DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTS_BASE_NAME}/g"`
update-alternatives --install /${KERNEL_IMAGEDEST}/${DTS_BASE_NAME}.dtb ${DTS_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
done
}
pkg_postrm_kernel-devicetree () {
cd /${KERNEL_IMAGEDEST}
for DTS_FILE in ${OOT_KERNEL_DEVICETREE}
do
DTS_BASE_NAME=`basename ${DTS_FILE} | awk -F "." '{print $1}'`
DTB_SYMLINK_NAME=`echo ${KERNEL_IMAGE_SYMLINK_NAME} | sed "s/${MACHINE}/${DTS_BASE_NAME}/g"`
update-alternatives --remove ${DTS_BASE_NAME}.dtb devicetree-${DTB_SYMLINK_NAME}.dtb ${KERNEL_PRIORITY} || true
done
}
\ No newline at end of file
inherit xilinx-utils
# If OOT_KERNEL_DEVICETREE is not set, default to the device tree's provided by
# MACHINE_DEVICETREE
OOT_KERNEL_DEVICETREE ?= "${@expand_dir_basepaths_by_extension("MACHINE_DEVICETREE", os.path.join(d.getVar("WORKDIR", True), 'devicetree'), '.dts', d)}"
# Appends the '<layer>/conf/machine/boards' path to FILESEXTRAPATHS for all
# layers (using the ${BBPATH})
FILESEXTRAPATHS_append := "${@get_additional_bbpath_filespath('conf/machine/boards:', d)}"
# Using the MACHINE_DEVICETREE and MACHINE_KCONFIG vars, append them to SRC_URI
SRC_URI_append += " \
${@paths_affix(d.getVar("MACHINE_DEVICETREE", True) or '', prefix = 'file://')} \
${@paths_affix(d.getVar("MACHINE_KCONFIG", True) or '', prefix = 'file://')} \
"
# Copy all device tree's into the same directory. This is due to compatibility
# with dtc and the use of DTSI (Device Tree Includes), the version of DTC in
# Yocto does not provide include path support.
do_install_prepend() {
if test -n "${MACHINE_DEVICETREE}"; then
mkdir -p ${WORKDIR}/devicetree
for i in ${MACHINE_DEVICETREE}; do
if test -e ${WORKDIR}/$i; then
cp ${WORKDIR}/$i ${WORKDIR}/devicetree
fi
done
fi
}
\ No newline at end of file
DESCRIPTION = "Xilinx Kernel"
SECTION = "kernel"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
# This version extension should match CONFIG_LOCALVERSION in defconfig
LINUX_VERSION_EXTENSION ?= "-xilinx"
PV = "${LINUX_VERSION}${LINUX_VERSION_EXTENSION}+git${SRCPV}"
KBRANCH ?= "master"
SRC_URI = "git://github.com/Xilinx/linux-xlnx;protocol=git;branch=${KBRANCH}"
# Source Directory
S = "${WORKDIR}/git"
FILESEXTRAPATHS_append := "${THISDIR}/linux-xlnx:"
SRC_URI_append += " file://xilinx_nandps_elphel393.patch"
SRC_URI_append += " file://xilinx_emacps.c.patch"
SRC_URI_append += " file://vsc3304.patch"
inherit kernel
require linux-dtb.inc
require linux-machine-config.inc
# returns all the elements from the src uri that are .cfg files
def find_config_fragments(d):
sources=src_patches(d, True)
sources_list=[]
for s in sources:
if s.endswith('.cfg'):
sources_list.append(s)
return sources_list
kernel_do_configure_prepend() {
# Find all ".cfg" files and cat them together into a .config
CFG_FILES="${@" ".join(find_config_fragments(d))}"
if [ ! -z "$CFG_FILES" ]; then
echo "# Generated by linux-xlnx recipe in meta-xilinx" > "${B}/.config"
for i in $CFG_FILES; do
echo "Joining configuration file $i"
echo "# $i" >> "${B}/.config"
cat $i >> "${B}/.config"
done
fi
}
# See include file for common information
include linux-xlnx.inc
PR = "r1"
# Kernel version and SRCREV correspond to:
# github.com/Xilinx/linux-xlnx.git xilinx-v14.7 tag
LINUX_VERSION = "3.10"
SRCREV = "efc27505715e64526653f35274717c0fc56491e3"
\ No newline at end of file
FILESEXTRAPATHS_append := "${THISDIR}/linux-xlnx:"
SRC_URI_append += " file://xilinx_nandps_elphel393.patch"
SRC_URI_append += " file://xilinx_emacps.c.patch"
SRC_URI_append += " file://vsc3304.patch"
# Kernel version and SRCREV correspond to:
# github.com/Xilinx/linux-xlnx.git xilinx-v14.7 tag
LINUX_VERSION = "3.10"
SRCREV = "efc27505715e64526653f35274717c0fc56491e3"
#inherit xilinx-utils
#FILESEXTRAPATHS_append := "${@get_additional_bbpath_filespath('conf/machine/boards:', d)}"
#OOT_KERNEL_DEVICETREE_append := "${@expand_dir_basepaths_by_extension("MACHINE_DEVICETREE", os.path.join(d.getVar("WORKDIR", True), 'devicetree'), '.dts', d)}"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment