Hi,

some comments inline. Just a few things I noticed for now. I don't have the
time right now for a more detailed review.

Michael

On Mon, Mar 14, 2011 at 04:21:29PM +0100, Stephan Linz wrote:
> This is support for Xilinx MicroBlaze processors. MicroBlaze
> is a soft core processor designed for Xilinx FPGAs. With this
> new architecture ptxdist have to handle dynamic platform
> configurations exported by Xilinx design tools.
> 
> Some essential changes and extensions inside a few ptxdist core
> scripts were made to merge external platform configurations into
> the ptxdist platform configuration. That is very important since
> the resulting build process have to know about the real CPU
> features like hardware multiplier, barrel shifter or similar high
> performance accelerators.
> 
> So ptxdist knows about this specialty, parse the new platform
> directory "xlbsp" and use the content for its own platform
> configuration. The content of the new platform directory "xlbsp"
> comes from Xilinx design tools and have to be:
>   * auto-config.in      (Linux Kernel 2.4 configuration)
>   * Kconfig.auto        (Linux Kernel 2.6 configuration)
>   * xilinx.dts          (Linux Kernel 2.6 configuration)
>   * config.mk           (U-Boot configuration)
>   * xparameters.h       (U-Boot configuration)

Which file contains the definitions for XILINX_MICROBLAZE0_*? I think it
should go to platforms/. Also I'm not comfortable with using options that
are provided externaly. Why not import like we do with busybox?

> 
> Signed-off-by: Stephan Linz <[email protected]>
> ---
>  platforms/architecture.in            |    9 ++
>  platforms/kernel.in                  |    9 ++-
>  platforms/microblaze.in              |   33 +++++++
>  platforms/xlbsp_softcpu.in           |   25 +++++
>  rules/post/ptxd_make_xilinx_bsp.make |   41 ++++++++
>  rules/pre/Machine.make               |   68 ++++++++++++++
>  rules/pre/Rules.make                 |    4 +-
>  scripts/lib/ptxd_lib_00-init.sh      |    3 +
>  scripts/lib/ptxd_lib_kgen.sh         |    3 +-
>  scripts/lib/ptxd_make_00-init.sh     |    5 +
>  scripts/lib/ptxd_make_xilinx_bsp.sh  |  167 
> ++++++++++++++++++++++++++++++++++
>  11 files changed, 363 insertions(+), 4 deletions(-)
>  create mode 100644 platforms/microblaze.in
>  create mode 100644 platforms/xlbsp_softcpu.in
>  create mode 100644 rules/post/ptxd_make_xilinx_bsp.make
>  create mode 100644 rules/pre/Machine.make
>  create mode 100644 scripts/lib/ptxd_make_xilinx_bsp.sh
> 
> diff --git a/platforms/architecture.in b/platforms/architecture.in
> index 5a623cb..3b8436b 100644
> --- a/platforms/architecture.in
> +++ b/platforms/architecture.in
> @@ -69,6 +69,13 @@ choice
>               help
>                 This is support for the SPARC architecture.
>  
> +     config ARCH_MICROBLAZE
> +             bool "microblaze "
> +             select HAS_MMU
> +             select ARCH_SUPPORTS_ENDIAN_BIG
> +             help
> +               This is support for the Xilinx MicroBlaze architecture (with 
> MMU).
> +
>       config ARCH_MIPS
>               bool "mips       "
>               select HAS_MMU
> @@ -302,6 +309,7 @@ config ARCH_STRING
>       default "m68k"                  if ARCH_M68K
>       default "ppc"                   if ARCH_PPC
>       default "sparc"                 if ARCH_SPARC
> +     default "microblaze"            if ARCH_MICROBLAZE
>       default "mips"                  if ARCH_MIPS
>       default "cris"                  if ARCH_CRIS
>       default "parisc"                if ARCH_PARISC
> @@ -309,6 +317,7 @@ config ARCH_STRING
>  
>  # 
> ----------------------------------------------------------------------------
>  
> +source "generated/microblaze_options.in"
>  source "generated/architecture_options.in"
>  
>  endmenu
> diff --git a/platforms/kernel.in b/platforms/kernel.in
> index 476bdde..0d8702e 100644
> --- a/platforms/kernel.in
> +++ b/platforms/kernel.in
> @@ -83,6 +83,7 @@ config KERNEL_ARCH_STRING
>       default "blackfin"              if ARCH_BLACKFIN
>       default "m68k"                  if ARCH_M68K
>       default "sparc"                 if ARCH_SPARC
> +     default "microblaze"            if ARCH_MICROBLAZE
>       default "mips"                  if ARCH_MIPS
>       default "mips"                  if ARCH_MIPSEL
>       default "cris"                  if ARCH_CRIS
> @@ -142,11 +143,16 @@ choice
>               help
>                This is the target to get the kernel image as an raw 
> uncompressed
>                binary file.
> +
> +if KERNEL_ARCH_POWERPC || ARCH_MICROBLAZE

why make this conditional?

> +
>       config KERNEL_IMAGE_SIMPLE
>               bool
>               prompt "simpleImage"
>               help
>                 Create a simple Image with embedded DTB
> +endif
> +
>  endchoice
>  
>  if KERNEL_IMAGE_SIMPLE
> @@ -182,7 +188,8 @@ config KERNEL_IMAGE
>       default "vmImage" if KERNEL_IMAGE_VM
>       default "vmlinux" if KERNEL_IMAGE_VMLINUX
>       default "Image"   if KERNEL_IMAGE_RAW
> -     default "simpleImage.${PTXCONF_KERNEL_IMAGE_SIMPLE_TARGET}.elf" if 
> KERNEL_IMAGE_SIMPLE
> +     default "simpleImage.${PTXCONF_KERNEL_IMAGE_SIMPLE_TARGET}.elf" if 
> KERNEL_IMAGE_SIMPLE && KERNEL_ARCH_POWERPC

... if KERNEL_IMAGE_SIMPLE && !ARCH_MICROBLAZE
maybe?

> +     default "simpleImage.${PTXCONF_KERNEL_IMAGE_SIMPLE_TARGET}" if 
> KERNEL_IMAGE_SIMPLE && ARCH_MICROBLAZE
>  
>  config KERNEL_XZ
>       prompt "build xz-utils hosttool"
> diff --git a/platforms/microblaze.in b/platforms/microblaze.in
> new file mode 100644
> index 0000000..4b76569
> --- /dev/null
> +++ b/platforms/microblaze.in
> @@ -0,0 +1,33 @@
> +## SECTION=microblaze_options
> +
> +menu "microblaze options            "
> +depends on ARCH_MICROBLAZE
> +
> +config ARCH_MICROBLAZE_HAVE_XLBSP
> +     prompt "Xilinx BSP (TPOS)"
> +     bool
> +     default y
> +     help
> +       The Xilinx BSP (shortly "xlbsp") is part of a specific OSELAS.BSP()
> +       and consits of different automatically generated files from the
> +       Xilinx FPGA design. All files for the xlbsp have to copied from the
> +       Xilinx FPGA design project into the OSELAS.BSP() project somewhere
> +       below ${PTXDIST_PATH//://xlbsp:}
> +
> +       You have to copy all auto generated files from Xilinx BSP "Third
> +       Party OS (TPOS)" to xlbsp in your OSELAS.BSP(). To get TPOS you have
> +       to include the EDK user repository from MB-Ref into your Xilinx FPGA
> +       design flow.
> +
> +       See: http://gitorious.org/mbref/mbref
> +        or: http://www.li-pro.de/xilinx_mb/mbref/start
> +
> +if ARCH_MICROBLAZE_HAVE_XLBSP
> +
> +menu "SoftCPU features"
> +source "generated/xlbsp_softcpu.in"
> +endmenu
> +
> +endif
> +
> +endmenu
> diff --git a/platforms/xlbsp_softcpu.in b/platforms/xlbsp_softcpu.in
> new file mode 100644
> index 0000000..30a1de4
> --- /dev/null
> +++ b/platforms/xlbsp_softcpu.in
> @@ -0,0 +1,25 @@
> +## SECTION=xlbsp_softcpu
> +
> +comment "------------------------------------"
> +comment "Xilinx BSP Configuration"
> +comment "------------------------------------"
> +comment ""
> +comment "Do you missing configuration?"
> +comment ""
> +comment "You need the file 'Kconfig.auto'"
> +comment "from your Xilinx BSP directory."
> +comment ""
> +comment "Copy this file into the Xilinx BSP"
> +comment "configuration path, normaly at:"
> +comment "'${PTXDIST_WORKSPACE}/xlbsp' or"
> +comment "'${PTXDIST_PLATFORMCONFIGDIR}/xlbsp'."
> +comment ""
> +comment "HINT: In some cases, the 'SECTION'"
> +comment "comment in Kconfig.auto is missing."
> +comment "This leads to the same error. If so"
> +comment "adding the comment line on top of"
> +comment "the file Kconfig.auto:"
> +comment ""
> +comment "## SECTION=xlbsp_softcpu"
> +comment ""
> +comment "------------------------------------"
> diff --git a/rules/post/ptxd_make_xilinx_bsp.make 
> b/rules/post/ptxd_make_xilinx_bsp.make
> new file mode 100644
> index 0000000..325714e
> --- /dev/null
> +++ b/rules/post/ptxd_make_xilinx_bsp.make
> @@ -0,0 +1,41 @@
> +# -*-makefile-*-
> +#
> +# Copyright (C) 2011 by Stephan Linz <[email protected]>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +ifeq ($(PTXCONF_ARCH_MICROBLAZE),y)

ifdef PTXCONF_ARCH_MICROBLAZE

the same in other places.

> +
> +ifeq ($(PTXCONF_ARCH_MICROBLAZE_HAVE_XLBSP),y)
> +$(STATEDIR)/u-boot.prepare: $(STATEDIR)/u-boot.xlbsp
> +endif
> +
> +ifeq ($(PTXCONF_ARCH_MICROBLAZE_HAVE_XLBSP),y)
> +$(STATEDIR)/kernel.prepare: $(STATEDIR)/kernel.xlbsp
> +endif
> +
> +ifeq ($(PTXCONF_KERNEL_IMAGE_SIMPLE),y)
> +SEL_ROOTFS-$(PTXCONF_IMAGE_KERNEL) += $(IMAGEDIR)/linuximage.ub
> +endif
> +
> +$(IMAGEDIR)/linuximage.ub: $(KERNEL_IMAGE_PATH_y).ub $(IMAGEDIR)/linuximage
> +     @echo -n "Creating '$(notdir $(@))' from '$(notdir $(<))'..."
> +     @install -m 644 "$(<)" "$(@)"
> +     @echo "done."
> +
> +endif
> +
> +$(STATEDIR)/%.xlbsp: $(STATEDIR)/%.extract
> +     @$(call targetinfo)
> +     @$(call xilinx/bsp, $(PTX_MAP_TO_PACKAGE_$(*)), 
> $($(PTX_MAP_TO_PACKAGE_$(*))_DIR))
> +     @$(call touch)
> +
> +xilinx/bsp = \
> +     $(call world/env, $(1)) \
> +     ptxd_make_xilinx_bsp
> +
> +# vim: syntax=make
> diff --git a/rules/pre/Machine.make b/rules/pre/Machine.make
> new file mode 100644
> index 0000000..e6c9601
> --- /dev/null
> +++ b/rules/pre/Machine.make
> @@ -0,0 +1,68 @@
> +# -*-makefile-*-
> +#
> +# This file contains global machine/cpu dependent definitions.
> +#
> +# Copyright (C) 2011 by Stephan Linz <[email protected]>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +# 
> ----------------------------------------------------------------------------
> +# Machine & CPU Defines (mainly SoftCPU)
> +# 
> ----------------------------------------------------------------------------
> +
> +#
> +# Xilinx MicroBlaze, SoftCPU inside a FPGA
> +#
> +ifeq ($(PTXCONF_ARCH_MICROBLAZE),y)
> +
> +  # Use defines by Xilinx BSP (borrowed from Linux kernel)
> +  ifeq ($(PTXCONF_ARCH_MICROBLAZE_HAVE_XLBSP),y)
> +
> +    # What CPU vesion are we building for, and crack it open
> +    # as major.minor.rev
> +    CPU_VER   := $(shell echo $(PTXCONF_XILINX_MICROBLAZE0_HW_VER))
> +    CPU_MAJOR := $(shell echo $(CPU_VER) | cut -d '.' -f 1)
> +    CPU_MINOR := $(shell echo $(CPU_VER) | cut -d '.' -f 2)
> +    CPU_REV   := $(shell echo $(CPU_VER) | cut -d '.' -f 3)
> +
> +    export CPU_VER CPU_MAJOR CPU_MINOR CPU_REV
> +
> +    # Use cpu-related PTXCONF_ vars to set compile options.
> +    # The various PTXCONF_XILINX cpu features options are integers 0/1/2...
> +    # rather than bools y/n
> +
> +    # Work out HW multiplier support.  This is icky.
> +    # 1. Spartan2 has no HW multipliers.
> +    # 2. MicroBlaze v3.x always uses them, except in Spartan 2
> +    # 3. All other FPGa/CPU ver combos, we can trust the PTXCONF_ settings
> +    ifeq (,$(findstring spartan2,$(PTXCONF_XILINX_MICROBLAZE0_FAMILY)))
> +      ifeq ($(CPU_MAJOR),3)
> +        CPUFLAGS-1 += -mno-xl-soft-mul
> +      else
> +        # USE_HW_MUL can be 0, 1, or 2, defining a heirarchy of HW Mul 
> support.
> +        CPUFLAGS-$(subst 1,,$(PTXCONF_XILINX_MICROBLAZE0_USE_HW_MUL)) += 
> -mxl-multiply-high
> +        CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul
> +      endif
> +    endif
> +    CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_DIV) += -mno-xl-soft-div
> +    CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_BARREL) += -mxl-barrel-shift
> +    CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_PCMP_INSTR) += 
> -mxl-pattern-compare
> +
> +    ifeq ($(PTXCONF_HAS_HARDFLOAT),y)
> +      CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_FPU) += -mhard-float
> +      CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_FPU) += -mxl-float-convert
> +      CPUFLAGS-$(PTXCONF_XILINX_MICROBLAZE0_USE_FPU) += -mxl-float-sqrt
> +    endif
> +
> +    CPUFLAGS-1 += -mcpu=v$(CPU_VER)
> +
> +    CPUFLAGS := $(CPUFLAGS-1) $(CPUFLAGS-2)
> +
> +  endif # PTXCONF_ARCH_MICROBLAZE_HAVE_XLBSP
> +
> +endif # PTXCONF_ARCH_MICROBLAZE
> +
> diff --git a/rules/pre/Rules.make b/rules/pre/Rules.make
> index c531a50..85babcd 100644
> --- a/rules/pre/Rules.make
> +++ b/rules/pre/Rules.make
> @@ -38,8 +38,8 @@ CROSS_PATH := 
> $(PTXDIST_SYSROOT_CROSS)/bin:$(PTXDIST_SYSROOT_CROSS)/sbin:$$PATH
>  #
>  # Environment variables for the compiler
>  #
> -CROSS_CFLAGS                 := $(PTXCONF_TARGET_EXTRA_CFLAGS)
> -CROSS_CXXFLAGS                       := $(PTXCONF_TARGET_EXTRA_CXXFLAGS)
> +CROSS_CFLAGS                 := $(CPUFLAGS) $(PTXCONF_TARGET_EXTRA_CFLAGS)
> +CROSS_CXXFLAGS                       := $(CPUFLAGS) 
> $(PTXCONF_TARGET_EXTRA_CXXFLAGS)
>  CROSS_CPPFLAGS                       := $(strip 
> $(PTXCONF_TARGET_EXTRA_CPPFLAGS) $(PTXDIST_CROSS_CPPFLAGS))
>  CROSS_LDFLAGS                        := $(strip 
> $(PTXCONF_TARGET_EXTRA_LDFLAGS)  $(PTXDIST_CROSS_LDFLAGS))
>  
> diff --git a/scripts/lib/ptxd_lib_00-init.sh b/scripts/lib/ptxd_lib_00-init.sh
> index 02a48e7..64d09e1 100644
> --- a/scripts/lib/ptxd_lib_00-init.sh
> +++ b/scripts/lib/ptxd_lib_00-init.sh
> @@ -101,6 +101,9 @@ ptxd_init_ptxdist_path() {
>      PTXDIST_PATH_PLATFORMS="${PTXDIST_PATH//://platforms:}"
>      export PTXDIST_PATH_PLATFORMS
>  
> +    PTXDIST_PATH_XLBSP="${PTXDIST_PATH//://xlbsp:}"
> +    export PTXDIST_PATH_XLBSP
> +
>      ptxd_init_ptxdist_path_sysroot
>  }
>  
> diff --git a/scripts/lib/ptxd_lib_kgen.sh b/scripts/lib/ptxd_lib_kgen.sh
> index 2ab7ca0..6705d20 100644
> --- a/scripts/lib/ptxd_lib_kgen.sh
> +++ b/scripts/lib/ptxd_lib_kgen.sh
> @@ -58,6 +58,7 @@ ptxd_kgen_generate_sections()
>           fi
>           # '! -name ".#*"' filters out emacs's lock files
>           find "${dir}/" -name *.in \! -name ".#*" -print0
> +         find "${dir}/" -name *.auto \! -name ".#*" -print0
>       done
>      } | {
>       #
> @@ -91,7 +92,7 @@ EOF
>      local oldIFS="$IFS"
>      case "${kgen_part}" in
>       ptx)      IFS=: kgen_dirs=( ${PTXDIST_PATH_RULES} ) ;;
> -     platform) IFS=: kgen_dirs=( ${PTXDIST_PATH_PLATFORMS} ) ;;
> +     platform) IFS=: kgen_dirs=( ${PTXDIST_PATH_PLATFORMS} 
> ${PTXDIST_PATH_XLBSP} ) ;;
>       board|user|collection) return 0 ;;
>       *) cat <<EOF

I don't like these changes. If it goes into platformconfig the file should
be in PTXDIST_PATH_PLATFORMS and named *.in

>  
> diff --git a/scripts/lib/ptxd_make_00-init.sh 
> b/scripts/lib/ptxd_make_00-init.sh
> index b74e47a..526dbae 100644
> --- a/scripts/lib/ptxd_make_00-init.sh
> +++ b/scripts/lib/ptxd_make_00-init.sh
> @@ -32,6 +32,11 @@ ptxd_init_arch() {
>                   ipkg_arch=arm
>                   ;;
>           esac
> +         ;;
> +
> +     microblaze)
> +         ipkg_arch=mb
> +         ;;
>      esac
>  
>      PTXDIST_IPKG_ARCH_STRING="${ipkg_arch}"
> diff --git a/scripts/lib/ptxd_make_xilinx_bsp.sh 
> b/scripts/lib/ptxd_make_xilinx_bsp.sh
> new file mode 100644
> index 0000000..1d74f2d
> --- /dev/null
> +++ b/scripts/lib/ptxd_make_xilinx_bsp.sh
> @@ -0,0 +1,167 @@
> +#!/bin/bash
> +#
> +# Copyright (C) 2011 by Stephan Linz <[email protected]>
> +#
> +# See CREDITS for details about who has contributed to this project.
> +#
> +# For further information about the PTXdist project and license conditions
> +# see the README file.
> +#
> +
> +#
> +# ptxd_make_xilinx_bsp_apply_init -
> +# initialize variables used to apply the Xilinx BSP
> +#
> +# out:
> +#
> +# pkg_xlbsp_dir              path to Xilinx BSP
> +#
> +ptxd_make_xilinx_bsp_apply_init()
> +{
> +    local path="${PTXDIST_PATH_XLBSP//:/ }"
> +
> +    # find patch_dir
> +    if ! ptxd_get_path "${path}"; then

ptxd_in_path PTXDIST_PATH_XLBSP

> +     echo "xlbsp: no Xilinx BSP found"
> +     return
> +    fi
> +    pkg_xlbsp_dir="${ptxd_reply}"
> +
> +}
> +export -f ptxd_make_xilinx_bsp_apply_init
> +
> +
> +#
> +# apply Xilinx BSP for U-Boot
> +#
> +ptxd_make_xilinx_bsp_apply_uboot()
> +{
> +    local \
> +     ptx_xlbsp_uboot_cfg="$(ptxd_get_ptxconf PTXCONF_U_BOOT_CONFIG)" \
> +     pkg_xlbsp_uboot_files="${pkg_xlbsp_dir}/config.mk \
> +         ${pkg_xlbsp_dir}/xparameters.h" \
> +     pkg_xlbsp_uboot_file \
> +     ptx_xlbsp_uboot_dir

local <varname>=<value>
for each var, is better.

> +
> +    # find ptx_xlbsp_uboot_dir
> +    if ! ptxd_get_path 
> "${pkg_build_dir}/board/xilinx/${ptx_xlbsp_uboot_cfg%%_config}"; then
> +     echo "xlbsp: ${pkg_xlbsp_apply}: no board path found"
> +     return
> +    fi
> +    ptx_xlbsp_uboot_dir="${ptxd_reply}"
> +
> +    # apply files (remove old, link new)
> +    echo "xlbsp: ${pkg_xlbsp_apply}: board '$(ptxd_print_path 
> "${ptx_xlbsp_uboot_dir:-<none>}")'"
> +    pushd "${ptx_xlbsp_uboot_dir}" > /dev/null &&
> +    for pkg_xlbsp_uboot_file in ${pkg_xlbsp_uboot_files}; do
> +     echo "xlbsp: ${pkg_xlbsp_apply}: rm/ln '$(ptxd_print_path 
> "${pkg_xlbsp_uboot_file:-<none>}")'"
> +
> +     local pkg_uboot_file="$(basename "${pkg_xlbsp_uboot_file}")" &&
> +     rm -f ${pkg_uboot_file} &&
> +     ln -s ${pkg_xlbsp_uboot_file} ${pkg_uboot_file}
> +
> +    done &&
> +    popd > /dev/null
> +}
> +export -f ptxd_make_xilinx_bsp_apply_uboot
> +
> +
> +#
> +# apply Xilinx BSP for Linux kernel 2.6
> +#
> +ptxd_make_xilinx_bsp_apply_kernel()
> +{
> +    local \
> +     ptx_xlbsp_kernel_arch="$(ptxd_get_ptxconf PTXCONF_KERNEL_ARCH_STRING)" \
> +     pkg_xlbsp_kernel24_files="${pkg_xlbsp_dir}/auto-config.in" \
> +     pkg_xlbsp_kernel26_files="${pkg_xlbsp_dir}/Kconfig.auto" \
> +     ptx_xlbsp_kernel_platform \
> +     pkg_xlbsp_kernel_files \
> +     pkg_xlbsp_kernel_file \
> +     ptx_xlbsp_kernel_dir

dito

> +
> +    # files and platform to use per version
> +    case "${pkg_pkg}" in
> +     linux-24*|linux-2.4*)
> +         pkg_xlbsp_kernel_files=${pkg_xlbsp_kernel24_files};
> +         ptx_xlbsp_kernel_platform="uclinux-auto";
> +         ;;
> +     linux-26*|linux-2.6*)
> +         pkg_xlbsp_kernel_files=${pkg_xlbsp_kernel26_files};
> +         ptx_xlbsp_kernel_platform="generic";
> +         ;;
> +     *)
> +         echo "xlbsp: ${pkg_xlbsp_apply}: unsupported kernel version: 
> ${pkg_pkg##linux-}"
> +         return
> +         ;;
> +    esac
> +
> +    # find ptx_xlbsp_kernel_dir
> +    if ! ptxd_get_path 
> "${pkg_build_dir}/arch/${ptx_xlbsp_kernel_arch}/platform/${ptx_xlbsp_kernel_platform}";
>  then
> +     echo "xlbsp: ${pkg_xlbsp_apply}: no board path found"
> +     return
> +    fi
> +    ptx_xlbsp_kernel_dir="${ptxd_reply}"
> +
> +    # apply files (remove old, link new)
> +    echo "xlbsp: ${pkg_xlbsp_apply}: board '$(ptxd_print_path 
> "${ptx_xlbsp_kernel_dir:-<none>}")'"
> +    pushd "${ptx_xlbsp_kernel_dir}" > /dev/null &&
> +    for pkg_xlbsp_kernel_file in ${pkg_xlbsp_kernel_files}; do
> +     echo "xlbsp: ${pkg_xlbsp_apply}: rm/ln '$(ptxd_print_path 
> "${pkg_xlbsp_kernel_file:-<none>}")'"
> +
> +     local pkg_kernel_file="$(basename "${pkg_xlbsp_kernel_file}")" &&
> +     rm -f ${pkg_kernel_file} &&
> +     ln -s ${pkg_xlbsp_kernel_file} ${pkg_kernel_file}
> +
> +    done &&
> +    popd > /dev/null
> +}
> +export -f ptxd_make_xilinx_bsp_apply_kernel
> +
> +
> +#
> +# generic apply Xilinx BSP function
> +#
> +ptxd_make_xilinx_bsp_apply()
> +{
> +    local \
> +     pkg_xlbsp_dir \
> +     pkg_xlbsp_apply
> +
> +    ptxd_make_xilinx_bsp_apply_init || return
> +    if [ -z "${pkg_xlbsp_dir}" ]; then
> +     return
> +    fi &&
> +
> +    # files to use per package
> +    case "${pkg_pkg}" in
> +     u-boot*)
> +         pkg_xlbsp_apply="uboot";
> +         ;;
> +     linux*)
> +         pkg_xlbsp_apply="kernel";
> +         ;;
> +    esac || return
> +
> +    echo "pkg_xlbsp_dir:     '$(ptxd_print_path "${pkg_xlbsp_dir:-<none>}")'"
> +    echo "pkg_build_dir:     '$(ptxd_print_path "${pkg_build_dir:-<none>}")'"
> +    echo
> +
> +    # apply Xilinx BSP per package if files are available
> +    if [ -n "${pkg_xlbsp_apply}" ]; then
> +     echo    "xlbsp: ${pkg_xlbsp_apply}: apply '$(ptxd_print_path 
> "${pkg_xlbsp_dir:-<none>}")'"
> +     "ptxd_make_xilinx_bsp_apply_${pkg_xlbsp_apply}" || return
> +     echo -e "xlbsp: ${pkg_xlbsp_apply}: done\n"
> +    fi
> +}
> +export -f ptxd_make_xilinx_bsp_apply
> +
> +
> +#
> +# copy and adjust per package
> +#
> +ptxd_make_xilinx_bsp() {
> +    ptxd_make_world_init || return
> +    ptxd_make_xilinx_bsp_apply
> +}
> +export -f ptxd_make_xilinx_bsp
> -- 
> 1.6.0.4
> 
> 
> -- 
> ptxdist mailing list
> [email protected]
> 

-- 
ptxdist mailing list
[email protected]

Reply via email to