From e65a7944211c70f6b5cfb6cedd73cc31105319de Mon Sep 17 00:00:00 2001 From: Tian Fang Date: Mon, 14 Dec 2015 22:08:40 -0800 Subject: Sync to internal OpenBMC repo f926614 --- meta-aspeed/conf/distro/include/tclibc-eglibc.inc | 40 + meta-aspeed/conf/machine/include/ast1250.inc | 4 +- .../0003-u-boot-snapshot-of-OpenBMC-f926614.patch | 13 + .../u-boot/u-boot-fw-utils_2013.07%.bbappend | 13 - .../recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb | 38 + meta-aspeed/recipes-bsp/u-boot/u-boot.inc | 78 + .../recipes-bsp/u-boot/u-boot_2013.07%.bbappend | 6 - meta-aspeed/recipes-bsp/u-boot/u-boot_2013.07.bb | 23 + .../eglibc/cross-localedef-native_2.19.bb | 49 + .../eglibc-2.19/0001-R_ARM_TLS_DTPOFF32.patch | 56 + .../0001-eglibc-menuconfig-support.patch | 912 ++++++++++++ ...n-libm-err-tab.pl-with-specific-dirs-in-S.patch | 36 + ...0002-eglibc-menuconfig-hex-string-options.patch | 169 +++ ...0003-eglibc-menuconfig-build-instructions.patch | 176 +++ .../eglibc/eglibc-2.19/GLRO_dl_debug_mask.patch | 143 ++ .../eglibc/eglibc-2.19/IO-acquire-lock-fix.patch | 17 + .../eglibc-2.19/add_resource_h_to_wait_h.patch | 20 + .../eglibc-svn-arm-lowlevellock-include-tls.patch | 21 + .../eglibc_fix_findidx_parameters.patch | 38 + .../recipes-core/eglibc/eglibc-2.19/etc/ld.so.conf | 0 .../eglibc-2.19/fileops-without-wchar-io.patch | 22 + .../eglibc/eglibc-2.19/fix-tibetian-locales.patch | 38 + .../eglibc/eglibc-2.19/fix_for_centos_5.8.patch | 18 + .../eglibc/eglibc-2.19/fsl-ppc-no-fsqrt.patch | 100 ++ .../eglibc/eglibc-2.19/generate-supported.mk | 11 + .../eglibc/eglibc-2.19/glibc.fix_sqrt2.patch | 1516 ++++++++++++++++++++ .../eglibc/eglibc-2.19/grok_gold.patch | 34 + .../eglibc/eglibc-2.19/initgroups_keys.patch | 20 + .../eglibc/eglibc-2.19/ld-search-order.patch | 56 + .../eglibc/eglibc-2.19/mips-rld-map-check.patch | 26 + .../eglibc/eglibc-2.19/multilib_readlib.patch | 17 + .../eglibc/eglibc-2.19/ppc-sqrt_finite.patch | 184 +++ .../eglibc/eglibc-2.19/ppc_slow_ieee754_sqrt.patch | 365 +++++ .../ppce6500-32b_slow_ieee754_sqrt.patch | 47 + .../eglibc/eglibc-2.19/relocatable_sdk.patch | 108 ++ .../eglibc-2.19/relocatable_sdk_fix_openpath.patch | 41 + .../recipes-core/eglibc/eglibc-collateral.inc | 12 + meta-aspeed/recipes-core/eglibc/eglibc-common.inc | 9 + meta-aspeed/recipes-core/eglibc/eglibc-initial.inc | 78 + .../recipes-core/eglibc/eglibc-initial_2.19.bb | 11 + meta-aspeed/recipes-core/eglibc/eglibc-ld.inc | 56 + meta-aspeed/recipes-core/eglibc/eglibc-locale.inc | 96 ++ .../recipes-core/eglibc/eglibc-locale_2.19.bb | 1 + meta-aspeed/recipes-core/eglibc/eglibc-mtrace.inc | 13 + .../recipes-core/eglibc/eglibc-mtrace_2.19.bb | 1 + meta-aspeed/recipes-core/eglibc/eglibc-options.inc | 162 +++ meta-aspeed/recipes-core/eglibc/eglibc-package.inc | 155 ++ meta-aspeed/recipes-core/eglibc/eglibc-scripts.inc | 16 + .../recipes-core/eglibc/eglibc-scripts_2.19.bb | 1 + meta-aspeed/recipes-core/eglibc/eglibc-testing.inc | 79 + meta-aspeed/recipes-core/eglibc/eglibc.inc | 84 ++ meta-aspeed/recipes-core/eglibc/eglibc_2.19.bb | 147 ++ .../eglibc/ldconfig-native-2.12.1/32and64bit.patch | 331 +++++ .../eglibc/ldconfig-native-2.12.1/README | 8 + .../endian-ness_handling.patch | 454 ++++++ .../ldconfig-native-2.12.1/endianess-header.patch | 113 ++ .../eglibc/ldconfig-native-2.12.1/flag_fix.patch | 24 + .../ldconfig-default-to-all-multilib-dirs.patch | 37 + .../ldconfig-native-2.12.1.tar.bz2 | Bin 0 -> 21491 bytes .../eglibc/ldconfig-native-2.12.1/ldconfig.patch | 471 ++++++ .../ldconfig_aux-cache_path_fix.patch | 36 + .../recipes-core/eglibc/ldconfig-native_2.12.1.bb | 32 + meta-aspeed/recipes-core/eglibc/site_config/funcs | 474 ++++++ .../recipes-core/eglibc/site_config/headers | 156 ++ meta-aspeed/recipes-core/eglibc/site_config/types | 21 + .../0033-Linux-snapshot-of-OpenBMC-f926614.patch | 978 +++++++++++++ meta-aspeed/recipes-kernel/linux/linux-aspeed.inc | 24 +- .../recipes-kernel/linux/linux-aspeed_2.6.28.9.bb | 31 +- .../openbmc-gpio/files/ast2400_gpio_table.py | 1022 +++++++++++++ .../openbmc-gpio/files/ast_gpio_parser.py | 204 +++ .../openbmc-gpio/files/data/ast2400-gpio.csv | 225 +++ .../recipes-utils/openbmc-gpio/files/soc_gpio.py | 42 + .../openbmc-gpio/openbmc-gpio_%.bbappend | 23 + meta-aspeed/recipes-utils/soc-utils/files/COPYING | 340 +++++ .../recipes-utils/soc-utils/files/soc-utils.sh | 20 + .../soc-utils/openbmc-utils_%.bbappend | 26 + 76 files changed, 10428 insertions(+), 40 deletions(-) create mode 100644 meta-aspeed/conf/distro/include/tclibc-eglibc.inc create mode 100644 meta-aspeed/recipes-bsp/u-boot/files/patch-2013.07/0003-u-boot-snapshot-of-OpenBMC-f926614.patch delete mode 100644 meta-aspeed/recipes-bsp/u-boot/u-boot-fw-utils_2013.07%.bbappend create mode 100644 meta-aspeed/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb create mode 100644 meta-aspeed/recipes-bsp/u-boot/u-boot.inc delete mode 100644 meta-aspeed/recipes-bsp/u-boot/u-boot_2013.07%.bbappend create mode 100644 meta-aspeed/recipes-bsp/u-boot/u-boot_2013.07.bb create mode 100644 meta-aspeed/recipes-core/eglibc/cross-localedef-native_2.19.bb create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/0001-R_ARM_TLS_DTPOFF32.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/0001-eglibc-menuconfig-support.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/0002-eglibc-menuconfig-hex-string-options.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/0003-eglibc-menuconfig-build-instructions.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/GLRO_dl_debug_mask.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/IO-acquire-lock-fix.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/add_resource_h_to_wait_h.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/eglibc-svn-arm-lowlevellock-include-tls.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/eglibc_fix_findidx_parameters.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/etc/ld.so.conf create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/fileops-without-wchar-io.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/fix-tibetian-locales.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/fix_for_centos_5.8.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/fsl-ppc-no-fsqrt.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/generate-supported.mk create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/glibc.fix_sqrt2.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/grok_gold.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/initgroups_keys.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/ld-search-order.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/mips-rld-map-check.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/multilib_readlib.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/ppc-sqrt_finite.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/ppc_slow_ieee754_sqrt.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/ppce6500-32b_slow_ieee754_sqrt.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/relocatable_sdk.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-2.19/relocatable_sdk_fix_openpath.patch create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-collateral.inc create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-common.inc create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-initial.inc create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-initial_2.19.bb create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-ld.inc create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-locale.inc create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-locale_2.19.bb create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-mtrace.inc create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-mtrace_2.19.bb create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-options.inc create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-package.inc create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-scripts.inc create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-scripts_2.19.bb create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc-testing.inc create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc.inc create mode 100644 meta-aspeed/recipes-core/eglibc/eglibc_2.19.bb create mode 100644 meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch create mode 100644 meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/README create mode 100644 meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch create mode 100644 meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/endianess-header.patch create mode 100644 meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch create mode 100644 meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch create mode 100644 meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 create mode 100644 meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch create mode 100644 meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch create mode 100644 meta-aspeed/recipes-core/eglibc/ldconfig-native_2.12.1.bb create mode 100644 meta-aspeed/recipes-core/eglibc/site_config/funcs create mode 100644 meta-aspeed/recipes-core/eglibc/site_config/headers create mode 100644 meta-aspeed/recipes-core/eglibc/site_config/types create mode 100644 meta-aspeed/recipes-kernel/linux/files/patch-2.6.28.9/0033-Linux-snapshot-of-OpenBMC-f926614.patch create mode 100644 meta-aspeed/recipes-utils/openbmc-gpio/files/ast2400_gpio_table.py create mode 100644 meta-aspeed/recipes-utils/openbmc-gpio/files/ast_gpio_parser.py create mode 100644 meta-aspeed/recipes-utils/openbmc-gpio/files/data/ast2400-gpio.csv create mode 100644 meta-aspeed/recipes-utils/openbmc-gpio/files/soc_gpio.py create mode 100644 meta-aspeed/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend create mode 100644 meta-aspeed/recipes-utils/soc-utils/files/COPYING create mode 100644 meta-aspeed/recipes-utils/soc-utils/files/soc-utils.sh create mode 100644 meta-aspeed/recipes-utils/soc-utils/openbmc-utils_%.bbappend (limited to 'meta-aspeed') diff --git a/meta-aspeed/conf/distro/include/tclibc-eglibc.inc b/meta-aspeed/conf/distro/include/tclibc-eglibc.inc new file mode 100644 index 0000000..15f5ee5 --- /dev/null +++ b/meta-aspeed/conf/distro/include/tclibc-eglibc.inc @@ -0,0 +1,40 @@ +# +# eglibc specific configuration +# + +LIBCEXTENSION = "${@['', '-gnu'][(d.getVar('ABIEXTENSION', True) or '') != '']}" + +# Add glibc overrides to the overrides for eglibc. +LIBCOVERRIDE = ":libc-glibc" +OVERRIDES .= "${LIBCOVERRIDE}" + +PREFERRED_PROVIDER_virtual/libiconv ?= "eglibc" +PREFERRED_PROVIDER_virtual/nativesdk-libiconv ?= "nativesdk-eglibc" +PREFERRED_PROVIDER_virtual/nativesdk-libintl ?= "nativesdk-eglibc" +PREFERRED_PROVIDER_virtual/libintl ?= "eglibc" +PREFERRED_PROVIDER_virtual/libc ?= "eglibc" +PREFERRED_PROVIDER_virtual/nativesdk-libc ?= "nativesdk-eglibc" +PREFERRED_PROVIDER_virtual/libc-locale ?= "eglibc-locale" + +CXXFLAGS += "-fvisibility-inlines-hidden" + +LIBC_DEPENDENCIES = "libsegfault \ + eglibc \ + eglibc-dbg \ + eglibc-dev \ + eglibc-utils \ + eglibc-thread-db \ + ${@get_libc_locales_dependencies(d)}" + +LIBC_LOCALE_DEPENDENCIES = "\ + eglibc-localedata-i18n \ + eglibc-gconv-ibm850 \ + eglibc-gconv-cp1252 \ + eglibc-gconv-iso8859-1 \ + eglibc-gconv-iso8859-15" + +def get_libc_locales_dependencies(d): + if 'libc-locales' in (d.getVar('DISTRO_FEATURES', True) or '').split() : + return d.getVar('LIBC_LOCALE_DEPENDENCIES', True) or '' + else: + return '' diff --git a/meta-aspeed/conf/machine/include/ast1250.inc b/meta-aspeed/conf/machine/include/ast1250.inc index 099fdb0..210e3b5 100644 --- a/meta-aspeed/conf/machine/include/ast1250.inc +++ b/meta-aspeed/conf/machine/include/ast1250.inc @@ -11,12 +11,14 @@ EXTRA_IMAGEDEPENDS += "u-boot" # Uncomment the following line to enable the hard floating point abi. Note that # this breaks some binary libraries and 3D (neither of which ship with # meta-yocto). For maximum compatibility, leave this disabled. -DEFAULTTUNE ?= "arm926ejs" require conf/machine/include/tune-arm926ejs.inc PREFERRED_PROVIDER_virtual/kernel ?= "linux-aspeed" PREFERRED_VERSION_linux-aspeed ?= "2.6.28%" +PREFERRED_VERSION_u-boot ?= "v2013.07" +PREFERRED_VERSION_u-boot-fw-utils ?= "v2013.07" + KERNEL_IMAGETYPE ?= "uImage" KERNEL_EXTRA_ARGS ?= "UIMAGE_LOADADDR=0x40008000" diff --git a/meta-aspeed/recipes-bsp/u-boot/files/patch-2013.07/0003-u-boot-snapshot-of-OpenBMC-f926614.patch b/meta-aspeed/recipes-bsp/u-boot/files/patch-2013.07/0003-u-boot-snapshot-of-OpenBMC-f926614.patch new file mode 100644 index 0000000..559e65b --- /dev/null +++ b/meta-aspeed/recipes-bsp/u-boot/files/patch-2013.07/0003-u-boot-snapshot-of-OpenBMC-f926614.patch @@ -0,0 +1,13 @@ +diff --git a/meta-aspeed/recipes-bsp/u-boot/files/u-boot-v2013.07/include/configs/fbyosemite.h b/meta-aspeed/recipes-bsp/u-boot/files/u-boot-v2013.07/include/configs/fbyosemite.h +index 73a3cf9..397ca48 100644 +--- a/meta-aspeed/recipes-bsp/u-boot/files/u-boot-v2013.07/include/configs/fbyosemite.h ++++ b/meta-aspeed/recipes-bsp/u-boot/files/u-boot-v2013.07/include/configs/fbyosemite.h +@@ -155,7 +155,7 @@ + */ + #define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */ + #define PHYS_SDRAM_1 0x40000000 /* SDRAM Bank #1 */ +-#define PHYS_SDRAM_1_SIZE 0x8000000 /* 128 MB */ ++#define PHYS_SDRAM_1_SIZE 0x10000000 /* 256 MB */ + + #define CONFIG_SYS_SDRAM_BASE 0x40000000 + diff --git a/meta-aspeed/recipes-bsp/u-boot/u-boot-fw-utils_2013.07%.bbappend b/meta-aspeed/recipes-bsp/u-boot/u-boot-fw-utils_2013.07%.bbappend deleted file mode 100644 index be61682..0000000 --- a/meta-aspeed/recipes-bsp/u-boot/u-boot-fw-utils_2013.07%.bbappend +++ /dev/null @@ -1,13 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -SRC_URI += "file://fw_env.config \ - file://patch-2013.07/0000-u-boot-aspeed-064.patch \ - file://patch-2013.07/0001-u-boot-openbmc.patch \ - file://patch-2013.07/0002-Create-snapshot-of-OpenBMC.patch;striplevel=6 \ - " -do_install_append() { - if [ -e ${WORKDIR}/fw_env.config ] ; then - install -d ${D}${sysconfdir} - install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config - fi -} diff --git a/meta-aspeed/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb b/meta-aspeed/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb new file mode 100644 index 0000000..fcf8ac8 --- /dev/null +++ b/meta-aspeed/recipes-bsp/u-boot/u-boot-fw-utils_2013.07.bb @@ -0,0 +1,38 @@ +SUMMARY = "U-Boot bootloader fw_printenv/setenv utilities" +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb" +SECTION = "bootloader" +DEPENDS = "mtd-utils" + +# This revision corresponds to the tag "v2013.07" +# We use the revision in order to avoid having to fetch it from the +# repo during parse +SRCREV = "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c" + +PV = "v2013.07" + +SRC_URI = "git://git.denx.de/u-boot.git;branch=master;protocol=git \ + file://patch-2013.07/0000-u-boot-aspeed-064.patch \ + file://patch-2013.07/0001-u-boot-openbmc.patch \ + file://patch-2013.07/0002-Create-snapshot-of-OpenBMC.patch;striplevel=6 \ + file://patch-2013.07/0003-u-boot-snapshot-of-OpenBMC-f926614.patch;striplevel=6 \ + " + +S = "${WORKDIR}/git" + +EXTRA_OEMAKE = 'HOSTCC="${CC}" HOSTSTRIP="true"' + +inherit uboot-config + +do_compile () { + oe_runmake ${UBOOT_MACHINE} + oe_runmake env +} + +do_install () { + install -d ${D}${base_sbindir} + install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_printenv + install -m 755 ${S}/tools/env/fw_printenv ${D}${base_sbindir}/fw_setenv +} + +PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/meta-aspeed/recipes-bsp/u-boot/u-boot.inc b/meta-aspeed/recipes-bsp/u-boot/u-boot.inc new file mode 100644 index 0000000..cb1c403 --- /dev/null +++ b/meta-aspeed/recipes-bsp/u-boot/u-boot.inc @@ -0,0 +1,78 @@ +SUMMARY = "Universal Boot Loader for embedded devices" +HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome" +SECTION = "bootloaders" +PROVIDES = "virtual/bootloader" + +inherit uboot-config deploy + +EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}"' + +# Allow setting an additional version string that will be picked up by the +# u-boot build system and appended to the u-boot version. If the .scmversion +# file already exists it will not be overwritten. +UBOOT_LOCALVERSION ?= "" + +# Some versions of u-boot use .bin and others use .img. By default use .bin +# but enable individual recipes to change this value. +UBOOT_SUFFIX ?= "bin" +UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}" +UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}" +UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}" +UBOOT_MAKE_TARGET ?= "all" + +# Some versions of u-boot build an SPL (Second Program Loader) image that +# should be packaged along with the u-boot binary as well as placed in the +# deploy directory. For those versions they can set the following variables +# to allow packaging the SPL. +SPL_BINARY ?= "" +SPL_IMAGE ?= "${SPL_BINARY}-${MACHINE}-${PV}-${PR}" +SPL_SYMLINK ?= "${SPL_BINARY}-${MACHINE}" + +do_compile () { + if [ "${@base_contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then + sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk + fi + + unset LDFLAGS + unset CFLAGS + unset CPPFLAGS + + if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ] + then + echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion + echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion + fi + + oe_runmake ${UBOOT_MACHINE} + oe_runmake ${UBOOT_MAKE_TARGET} +} + +do_install () { + if [ -e ${WORKDIR}/fw_env.config ] ; then + install -d ${D}${sysconfdir} + install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config + fi +} + +FILES_${PN} = "${sysconfdir}" +FILESPATH =. "${FILE_DIRNAME}/u-boot-git/${MACHINE}:" + +do_deploy () { + install -d ${DEPLOYDIR} + install ${S}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE} + + cd ${DEPLOYDIR} + rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK} + ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK} + ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY} + + if [ "x${SPL_BINARY}" != "x" ] + then + install ${S}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE} + rm -f ${DEPLOYDIR}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_SYMLINK} + ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARY} + ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK} + fi +} + +addtask deploy before do_build after do_compile diff --git a/meta-aspeed/recipes-bsp/u-boot/u-boot_2013.07%.bbappend b/meta-aspeed/recipes-bsp/u-boot/u-boot_2013.07%.bbappend deleted file mode 100644 index a2f26a5..0000000 --- a/meta-aspeed/recipes-bsp/u-boot/u-boot_2013.07%.bbappend +++ /dev/null @@ -1,6 +0,0 @@ -FILESEXTRAPATHS_prepend := "${THISDIR}/files:" - -SRC_URI += "file://patch-2013.07/0000-u-boot-aspeed-064.patch \ - file://patch-2013.07/0001-u-boot-openbmc.patch \ - file://patch-2013.07/0002-Create-snapshot-of-OpenBMC.patch;striplevel=6 \ - " diff --git a/meta-aspeed/recipes-bsp/u-boot/u-boot_2013.07.bb b/meta-aspeed/recipes-bsp/u-boot/u-boot_2013.07.bb new file mode 100644 index 0000000..253c525 --- /dev/null +++ b/meta-aspeed/recipes-bsp/u-boot/u-boot_2013.07.bb @@ -0,0 +1,23 @@ +require u-boot.inc + +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb \ + file://README;beginline=1;endline=22;md5=78b195c11cb6ef63e6985140db7d7bab" + +# This revision corresponds to the tag "v2013.07" +# We use the revision in order to avoid having to fetch it from the repo during parse +SRCREV = "62c175fbb8a0f9a926c88294ea9f7e88eb898f6c" + +PV = "v2013.07" + +SRC_URI = "git://git.denx.de/u-boot.git;branch=master \ + file://fw_env.config \ + file://patch-2013.07/0000-u-boot-aspeed-064.patch \ + file://patch-2013.07/0001-u-boot-openbmc.patch \ + file://patch-2013.07/0002-Create-snapshot-of-OpenBMC.patch;striplevel=6 \ + file://patch-2013.07/0003-u-boot-snapshot-of-OpenBMC-f926614.patch;striplevel=6 \ + " + +S = "${WORKDIR}/git" + +PACKAGE_ARCH = "${MACHINE_ARCH}" diff --git a/meta-aspeed/recipes-core/eglibc/cross-localedef-native_2.19.bb b/meta-aspeed/recipes-core/eglibc/cross-localedef-native_2.19.bb new file mode 100644 index 0000000..3ce0e1d --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/cross-localedef-native_2.19.bb @@ -0,0 +1,49 @@ +SUMMARY = "Cross locale generation tool for eglibc" +HOMEPAGE = "http://www.eglibc.org/home" +SECTION = "libs" +LICENSE = "LGPL-2.1" + +LIC_DIR = "${WORKDIR}/eglibc-${PV}/libc" +LIC_FILES_CHKSUM = "file://${LIC_DIR}/LICENSES;md5=e9a558e243b36d3209f380deb394b213 \ + file://${LIC_DIR}/COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://${LIC_DIR}/posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ + file://${LIC_DIR}/COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" + + +inherit native +inherit autotools + +# pick up an eglibc patch +FILESPATH = "${FILE_DIRNAME}/eglibc-${PV}" + +SRC_URI = "http://downloads.yoctoproject.org/releases/eglibc/eglibc-${PV}-svnr25243.tar.bz2 \ + file://fix_for_centos_5.8.patch;patchdir=.. \ + " +SRC_URI[md5sum] = "197836c2ba42fb146e971222647198dd" +SRC_URI[sha256sum] = "baaa030531fc308f7820c46acdf8e1b2f8e3c1f40bcd28b6e440d1c95d170d4c" + +S = "${WORKDIR}/eglibc-${PV}/localedef" + +do_unpack_append() { + bb.build.exec_func('do_move_ports', d) +} + +do_move_ports() { + if test -d ${WORKDIR}/eglibc-${PV}/ports ; then + rm -rf ${WORKDIR}/libc/ports + mv ${WORKDIR}/eglibc-${PV}/ports ${WORKDIR}/libc/ + fi +} + +EXTRA_OECONF = "--with-glibc=${WORKDIR}/eglibc-${PV}/libc" +CFLAGS += "-DNOT_IN_libc=1" + +do_configure () { + ${S}/configure ${EXTRA_OECONF} +} + + +do_install() { + install -d ${D}${bindir} + install -m 0755 ${B}/localedef ${D}${bindir}/cross-localedef +} diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0001-R_ARM_TLS_DTPOFF32.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0001-R_ARM_TLS_DTPOFF32.patch new file mode 100644 index 0000000..b4489e9 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0001-R_ARM_TLS_DTPOFF32.patch @@ -0,0 +1,56 @@ + +Quote from bug 1443 which explains what the patch does : + + We build some random program and link it with -lust. When we run it, + it dies with a SIGSEGV before reaching main(). + + Libust.so depends on liburcu-bp.so from the usermode-rcu package. + Although libust.so is not prelinked, liburcu-bp.so IS prelinked; this + is critical. + + Libust.so uses a TLS / __thread variable that is defined in liburcu- + bp.so. There are special ARM-specific relocation types that allow two + shared libraries to share thread-specific data. This is critical too. + + One more critical issue: although liburcu-bp.so is prelinked, we can't + load it at its prelinked address, because we also link against + librt.so, and librt.so uses that address. + + The dynamic linker is forced to relink liburcu-bp.so at a different + address. In the course of relinking, it processes the special ARM + relocation record mentioned above. The prelinker has already filled + in the information, which is a short offset into a table of thread- + specific data that is allocated per-thread for each library that uses + TLS. Because the normal behavior of a relocation is to add the symbol + value to an addend stored at the address being relocated, we end up + adding the short offset to itself, doubling it. + + Now we have an awkward situation. The libust.so library doesn't know + about the addend, so its TLS data for this element is correct. The + liburcu-bp.so library has a different offset for the element. When we + go to initialize the element for the first time in liburcu-bp.so, we + write the address of the result at the doubled (broken) offset. + Later, when we refer to the address from libust.so, we check the value + at the correct offset, but it's NULL, so we eat hot SIGSEGV. + +Upstream-Status: Pending + +Signed-off-by: Andrei Dinu +--- + .../libc/ports/sysdeps/arm/dl-machine.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +ndex 8d905e8..dcfa71e 100644 +--- libc.orig/ports/sysdeps/arm/dl-machine.h ++++ libc/ports/sysdeps/arm/dl-machine.h +@@ -503,7 +503,7 @@ elf_machine_rel (struct link_map *map, const Elf32_Rel *reloc, + + case R_ARM_TLS_DTPOFF32: + if (sym != NULL) +- *reloc_addr += sym->st_value; ++ *reloc_addr = sym->st_value; + break; + + case R_ARM_TLS_TPOFF32: +-- + diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0001-eglibc-menuconfig-support.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0001-eglibc-menuconfig-support.patch new file mode 100644 index 0000000..4559a11 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0001-eglibc-menuconfig-support.patch @@ -0,0 +1,912 @@ +Pulled from +http://www.eglibc.org/archives/patches/msg01042.html + +Upstream-Status: Pending +Signed-off-by: Khem + +Hi, + +This patch adds 'make menuconfig' support to EGLIBC. + + +EGLIBC can re-use the Linux kernel kconfig host tools ('conf' and 'mconf') unmodified, by passing appropriate environment variables and with some pre- and post-processing on the input/output config files. + +There are three new make targets supported, which all are defined in the new libc/options-config/Makefile, which is included by the top-level libc/Makefile: + +- 'make defconfig'. This passes 'libc/option-groups.defaults' to 'conf' as a default config, and outputs 'option-groups.config' to the top-level build directory, which will be the same as the default config. + +- 'make config'. This is the same line-oriented interface as in the Linux kernel. Input and output is 'option-groups.config' in the top-level build directory. + +- 'make menuconfig'. This is the same menu-based interface as in the Linux kernel. Input and output is 'option-groups.config' in the top-level build directory. + + +Pre-Processing: + + +The Linux kernel kconfig tools expect a prefix of "CONFIG_" on all config option names, but EGLIBC expects a prefix of "OPTION_". The pre-processing script, libc/options-config/config-preproc.pl, simply replaces "CONFIG_ with "OPTION_" in the given config file. The libc/options-config/Makefile passes the script output to a temporary config file, which is then passed to 'conf' or 'mconf'. + +Post-Processing (libc/options-config/config-postproc.pl): + + +- Disabled options are output as a comment line of the form "# CONFIG_FOO is not set". This needs to be changed to an explicit "CONFIG_FOO=n" in order to be compatible with 'option-groups.awk' which generates the option-groups.h header. + +- "CONFIG_" prefix is changed back to "OPTION_". + + +- The kconfig tools will not output anything for options that depend on a parent option, when the parent option is disabled. This implicit disable must be converted to an explicit "CONFIG_FOO=n" in order to be compatible with the way EGLIBC overrides the default option settings in 'libc/option-groups.defaults' with those in 'option-groups.config'. + + +A new configure option, '--with-kconfig=', tells EGLIBC where to find the pre-built 'conf' and 'mconf' host tools from Linux kernel builds. + +libc/EGLIBC.cross-building is updated to include instructions for using '--with-kconfig' for the final EGLIBC build, and shows how and when to run 'make *config'. + +libc/EGLIBC.option-groups is updated to include new information on the menuconfig support. + +Thanks, + +attached is the updated patch to address above issues. + +Steve + +-- +Steve Longerbeam | Senior Embedded Engineer, ESD Services +Mentor Embedded(tm) | 46871 Bayside Parkway, Fremont, CA 94538 +P 510.354.5838 | M 408.410.2735 +Nucleus(r) | Linux(r) | Android(tm) | Services | UI | Multi-OS + + +Index: libc/EGLIBC.cross-building +=================================================================== +--- libc.orig/EGLIBC.cross-building ++++ libc/EGLIBC.cross-building +@@ -243,9 +243,29 @@ full EGLIBC build: + > $src/libc/configure \ + > --prefix=/usr \ + > --with-headers=$sysroot/usr/include \ ++ > --with-kconfig=$obj/linux/scripts/kconfig \ + > --build=$build \ + > --host=$target \ + > --disable-profile --without-gd --without-cvs --enable-add-ons ++ ++Note the additional '--with-kconfig' option. This tells EGLIBC where to ++find the host config tools used by the kernel 'make config' and 'make ++menuconfig'. These tools can be re-used by EGLIBC for its own 'make ++*config' support, which will create 'option-groups.config' for you. ++But first make sure those tools have been built by running some ++dummy 'make *config' calls in the kernel directory: ++ ++ $ cd $obj/linux ++ $ PATH=$tools/bin:$PATH make config \ ++ > ARCH=$linux_arch CROSS_COMPILE=$target- \ ++ $ PATH=$tools/bin:$PATH make menuconfig \ ++ > ARCH=$linux_arch CROSS_COMPILE=$target- \ ++ ++Now we can configure and build the full EGLIBC: ++ ++ $ cd $obj/eglibc ++ $ PATH=$tools/bin:$PATH make defconfig ++ $ PATH=$tools/bin:$PATH make menuconfig + $ PATH=$tools/bin:$PATH make + $ PATH=$tools/bin:$PATH make install install_root=$sysroot + +Index: libc/configure.ac +=================================================================== +--- libc.orig/configure.ac ++++ libc/configure.ac +@@ -127,6 +127,16 @@ AC_ARG_WITH([headers], + [sysheaders='']) + AC_SUBST(sysheaders) + ++AC_ARG_WITH([kconfig], ++ AC_HELP_STRING([--with-kconfig=PATH], ++ [location of kconfig tools to use (from Linux ++ kernel builds) to re-use for configuring EGLIBC ++ option groups]), ++ [KCONFIG_TOOLS=$withval], ++ [KCONFIG_TOOLS='']) ++AC_SUBST(KCONFIG_TOOLS) ++ ++ + AC_SUBST(use_default_link) + AC_ARG_WITH([default-link], + AC_HELP_STRING([--with-default-link], +Index: libc/config.make.in +=================================================================== +--- libc.orig/config.make.in ++++ libc/config.make.in +@@ -45,6 +45,8 @@ sysincludes = @SYSINCLUDES@ + c++-sysincludes = @CXX_SYSINCLUDES@ + all-warnings = @all_warnings@ + ++kconfig_tools = @KCONFIG_TOOLS@ ++ + have-z-combreloc = @libc_cv_z_combreloc@ + have-z-execstack = @libc_cv_z_execstack@ + have-Bgroup = @libc_cv_Bgroup@ +Index: libc/options-config/config-postproc.pl +=================================================================== +--- /dev/null ++++ libc/options-config/config-postproc.pl +@@ -0,0 +1,54 @@ ++#!/usr/bin/perl ++ ++$usage = "usage: $0 \n"; ++ ++die "$usage" unless @ARGV; ++$defaults = shift @ARGV; ++die "$usage" unless @ARGV; ++die "Could not open $ARGV[0]" unless -T $ARGV[0]; ++ ++sub yank { ++ @option = grep($_ ne $_[0], @option); ++} ++ ++open(DEFAULTS, $defaults) || die "Could not open $defaults\n"; ++ ++# get the full list of available options using the default config file ++$i = 0; ++while () { ++ if (/^\s*OPTION_(\w+)\s*=/) { ++ $option[$i++] = $1; ++ } ++} ++ ++# now go through the config file, making the necessary changes ++while (<>) { ++ if (/Linux Kernel Configuration/) { ++ # change title ++ s/Linux Kernel/Option Groups/; ++ print; ++ } elsif (/^\s*CONFIG_(\w+)\s*=/) { ++ # this is an explicit option set line, change CONFIG_ to OPTION_ ++ # before printing and remove this option from option list ++ $opt = $1; ++ yank($opt); ++ s/CONFIG_/OPTION_/g; ++ print; ++ } elsif (/^\s*#\s+CONFIG_(\w+) is not set/) { ++ # this is a comment line, change CONFIG_ to OPTION_, remove this ++ # option from option list, and convert to explicit OPTION_FOO=n ++ $opt = $1; ++ yank($opt); ++ s/CONFIG_/OPTION_/g; ++ print "OPTION_$opt=n\n"; ++ } else { ++ print; ++ } ++} ++ ++# any options left in @options, are options that were not mentioned in ++# the config file, and implicitly that means the option must be set =n, ++# so do that here. ++foreach $opt (@option) { ++ print "OPTION_$opt=n\n"; ++} +Index: libc/options-config/config-preproc.pl +=================================================================== +--- /dev/null ++++ libc/options-config/config-preproc.pl +@@ -0,0 +1,8 @@ ++#!/usr/bin/perl ++ ++if (@ARGV) { ++ while (<>) { ++ s/OPTION_/CONFIG_/g; ++ print; ++ } ++} +Index: libc/options-config/Makefile +=================================================================== +--- /dev/null ++++ libc/options-config/Makefile +@@ -0,0 +1,55 @@ ++# =========================================================================== ++# EGLIBC option-groups configuration targets ++# These targets are included from top-level makefile ++ ++ifneq ($(kconfig_tools),) ++ifneq (no,$(PERL)) ++ ++ocdir := options-config ++ ++OconfigDefaults := option-groups.defaults ++OconfigDefaults_tmp := $(common-objpfx).tmp.defconfig ++OconfigDef := option-groups.def ++Oconfig := $(common-objpfx)option-groups.config ++Oconfig_tmp := $(common-objpfx).tmp.config ++ ++conf := $(kconfig_tools)/conf ++mconf := $(kconfig_tools)/mconf ++ ++preproc := $(PERL) $(ocdir)/config-preproc.pl ++postproc := $(PERL) $(ocdir)/config-postproc.pl ++ ++PHONY += defconfig config menuconfig ++ ++defconfig: $(conf) $(OconfigDefaults) $(OconfigDef) ++ rm -f $(OconfigDefaults_tmp) ++ rm -f $(Oconfig_tmp) ++ $(preproc) $(OconfigDefaults) > $(OconfigDefaults_tmp) ++ KCONFIG_CONFIG=$(Oconfig_tmp) $< --defconfig=$(OconfigDefaults_tmp) \ ++ $(OconfigDef) ++ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig) ++ rm $(Oconfig_tmp) ++ rm $(OconfigDefaults_tmp) ++ ++config: $(conf) $(OconfigDefaults) $(OconfigDef) ++ rm -f $(Oconfig_tmp) ++ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp) ++ KCONFIG_CONFIG=$(Oconfig_tmp) $< --oldaskconfig $(OconfigDef) ++ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig) ++ rm $(Oconfig_tmp) ++ ++menuconfig: $(mconf) $(OconfigDefaults) $(OconfigDef) ++ rm -f $(Oconfig_tmp) ++ $(preproc) $(wildcard $(Oconfig)) > $(Oconfig_tmp) ++ KCONFIG_CONFIG=$(Oconfig_tmp) $< $(OconfigDef) ++ $(postproc) $(OconfigDefaults) $(Oconfig_tmp) > $(Oconfig) ++ rm $(Oconfig_tmp) ++ ++# Help text used by make help ++help: ++ @echo ' defconfig - New config with default from default config' ++ @echo ' config - Update current config utilising a line-oriented program' ++ @echo ' menuconfig - Update current config utilising a menu based program' ++ ++endif ++endif +Index: libc/option-groups.def +=================================================================== +--- libc.orig/option-groups.def ++++ libc/option-groups.def +@@ -4,19 +4,19 @@ + # + # An entry of the form: + # +-# config OPTION_GROUP_NAME ++# config GROUP_NAME + # bool "one-line explanation of what this option group controls" + # help + # Multi-line help explaining the option group's meaning in + # some detail, terminated by indentation level. + # +-# defines an option group whose variable is OPTION_GROUP_NAME, with ++# defines an option group whose variable is GROUP_NAME, with + # meaningful values 'y' (enabled) and 'n' (disabled). The + # documentation is formatted to be consumed by some sort of + # interactive configuration interface, but EGLIBC doesn't have such an + # interface yet. + # +-# An option may have a 'depends' line, indicating which other options ++# An option may have a 'depends on' line, indicating which other options + # must also be enabled if this option is. At present, EGLIBC doesn't + # check that these dependencies are satisfied. + # +@@ -41,9 +41,9 @@ + # although this simply reestablishes the value already set by + # 'option-groups.defaults'. + +-config OPTION_EGLIBC_ADVANCED_INET6 ++config EGLIBC_ADVANCED_INET6 + bool "IPv6 Advanced Sockets API support (RFC3542)" +- depends OPTION_EGLIBC_INET ++ depends on EGLIBC_INET + help + This option group includes the functions specified by RFC 3542, + "Advanced Sockets Application Program Interface (API) for +@@ -71,7 +71,7 @@ config OPTION_EGLIBC_ADVANCED_INET6 + inet6_rth_segments + inet6_rth_space + +-config OPTION_EGLIBC_BACKTRACE ++config EGLIBC_BACKTRACE + bool "Functions for producing backtraces" + help + This option group includes functions for producing a list of +@@ -85,7 +85,7 @@ config OPTION_EGLIBC_BACKTRACE + backtrace_symbols + backtrace_symbols_fd + +-config OPTION_EGLIBC_BIG_MACROS ++config EGLIBC_BIG_MACROS + bool "Use extensive inline code" + help + This option group specifies whether certain pieces of code +@@ -93,7 +93,7 @@ config OPTION_EGLIBC_BIG_MACROS + group is not selected, function calls will be used instead, + hence reducing the library footprint. + +-config OPTION_EGLIBC_BSD ++config EGLIBC_BSD + bool "BSD-specific functions, and their compatibility stubs" + help + This option group includes functions specific to BSD kernels. +@@ -109,10 +109,9 @@ config OPTION_EGLIBC_BSD + revoke + setlogin + +-config OPTION_EGLIBC_CXX_TESTS ++config EGLIBC_CXX_TESTS + bool "Tests that link against the standard C++ library." +- depends OPTION_POSIX_WIDE_CHAR_DEVICE_IO +- depends OPTION_EGLIBC_LIBM ++ depends on POSIX_WIDE_CHAR_DEVICE_IO && EGLIBC_LIBM + help + This option group does not include any C library functions; + instead, it controls which EGLIBC tests an ordinary 'make +@@ -121,23 +120,22 @@ config OPTION_EGLIBC_CXX_TESTS + run. + + The standard C++ library depends on the math library 'libm' and +- the wide character I/O functions included in EGLIBC. If those +- option groups are disabled, this test must also be disabled. ++ the wide character I/O functions included in EGLIBC. So those ++ option groups must be enabled if this test is enabled. + +-config OPTION_EGLIBC_CATGETS ++config EGLIBC_CATGETS + bool "Functions for accessing message catalogs" +- depends OPTION_EGLIBC_LOCALE_CODE ++ depends on EGLIBC_LOCALE_CODE + help + This option group includes functions for accessing message + catalogs: catopen, catclose, and catgets. + +- This option group depends on the OPTION_EGLIBC_LOCALE_CODE +- option group; if you disable that, you must also disable this. ++ This option group depends on the EGLIBC_LOCALE_CODE ++ option group. + +-config OPTION_EGLIBC_CHARSETS ++config EGLIBC_CHARSETS + bool "iconv/gconv character set conversion libraries" + help +- + This option group includes support for character sets other + than ASCII (ANSI_X3.4-1968) and Unicode and ISO-10646 in their + various encodings. This affects both the character sets +@@ -198,16 +196,16 @@ config OPTION_EGLIBC_CHARSETS + WCHAR_T - EGLIBC's internal form (target-endian, + 32-bit ISO 10646) + +-config OPTION_EGLIBC_CRYPT ++config EGLIBC_CRYPT + bool "Encryption library" + help + This option group includes the `libcrypt' library which + provides functions for one-way encryption. Supported + encryption algorithms include MD5, SHA-256, SHA-512 and DES. + +-config OPTION_EGLIBC_CRYPT_UFC ++config EGLIBC_CRYPT_UFC + bool "Ultra fast `crypt' implementation" +- depends OPTION_EGLIBC_CRYPT ++ depends on EGLIBC_CRYPT + help + This option group provides ultra fast DES-based implementation of + the `crypt' function. When this option group is disabled, +@@ -216,7 +214,7 @@ config OPTION_EGLIBC_CRYPT_UFC + errno to ENOSYS if /salt/ passed does not correspond to either MD5, + SHA-256 or SHA-512 algorithm. + +-config OPTION_EGLIBC_DB_ALIASES ++config EGLIBC_DB_ALIASES + bool "Functions for accessing the mail aliases database" + help + This option group includues functions for looking up mail +@@ -233,7 +231,7 @@ config OPTION_EGLIBC_DB_ALIASES + When this option group is disabled, the NSS service libraries + also lack support for querying their mail alias tables. + +-config OPTION_EGLIBC_ENVZ ++config EGLIBC_ENVZ + bool "Functions for handling envz-style environment vectors." + help + This option group contains functions for creating and operating +@@ -248,7 +246,7 @@ config OPTION_EGLIBC_ENVZ + envz_entry envz_remove + envz_get envz_strip + +-config OPTION_EGLIBC_FCVT ++config EGLIBC_FCVT + bool "Functions for converting floating-point numbers to strings" + help + This option group includes functions for converting +@@ -262,14 +260,14 @@ config OPTION_EGLIBC_FCVT + fcvt_r qfcvt_r + gcvt qgcvt + +-config OPTION_EGLIBC_FMTMSG ++config EGLIBC_FMTMSG + bool "Functions for formatting messages" + help + This option group includes the following functions: + + addseverity fmtmsg + +-config OPTION_EGLIBC_FSTAB ++config EGLIBC_FSTAB + bool "Access functions for 'fstab'" + help + This option group includes functions for reading the mount +@@ -283,7 +281,7 @@ config OPTION_EGLIBC_FSTAB + getfsent setfsent + getfsfile + +-config OPTION_EGLIBC_FTRAVERSE ++config EGLIBC_FTRAVERSE + bool "Functions for traversing file hierarchies" + help + This option group includes functions for traversing file +@@ -297,9 +295,9 @@ config OPTION_EGLIBC_FTRAVERSE + fts_set nftw64 + fts_close + +-config OPTION_EGLIBC_GETLOGIN ++config EGLIBC_GETLOGIN + bool "The getlogin function" +- depends OPTION_EGLIBC_UTMP ++ depends on EGLIBC_UTMP + help + This function group includes the 'getlogin' and 'getlogin_r' + functions, which return the user name associated by the login +@@ -309,17 +307,17 @@ config OPTION_EGLIBC_GETLOGIN + fall back on 'getlogin' to find the user's login name for tilde + expansion when the 'HOME' environment variable is not set. + +-config OPTION_EGLIBC_IDN ++config EGLIBC_IDN + bool "International domain names support" + help + This option group includes the `libcidn' library which + provides support for international domain names. + +-config OPTION_EGLIBC_INET ++config EGLIBC_INET + bool "Networking support" + help + This option group includes networking-specific functions and +- data. With OPTION_EGLIBC_INET disabled, the EGLIBC ++ data. With EGLIBC_INET disabled, the EGLIBC + installation and API changes as follows: + + - The following libraries are not installed: +@@ -439,14 +437,14 @@ config OPTION_EGLIBC_INET + use Unix-domain sockets to communicate with the syslog daemon; + syslog is valuable in non-networked contexts. + +-config OPTION_EGLIBC_INET_ANL ++config EGLIBC_INET_ANL + bool "Asynchronous name lookup" +- depends OPTION_EGLIBC_INET ++ depends on EGLIBC_INET + help + This option group includes the `libanl' library which + provides support for asynchronous name lookup. + +-config OPTION_EGLIBC_LIBM ++config EGLIBC_LIBM + bool "libm (math library)" + help + This option group includes the 'libm' library, containing +@@ -464,7 +462,7 @@ config OPTION_EGLIBC_LIBM + group, you will not be able to build 'libstdc++' against the + resulting EGLIBC installation. + +-config OPTION_EGLIBC_LOCALES ++config EGLIBC_LOCALES + bool "Locale definitions" + help + This option group includes all locale definitions other than +@@ -472,17 +470,17 @@ config OPTION_EGLIBC_LOCALES + only the "C" locale is supported. + + +-config OPTION_EGLIBC_LOCALE_CODE ++config EGLIBC_LOCALE_CODE + bool "Locale functions" +- depends OPTION_POSIX_C_LANG_WIDE_CHAR ++ depends on POSIX_C_LANG_WIDE_CHAR + help + This option group includes locale support functions, programs, +- and libraries. With OPTION_EGLIBC_LOCALE_FUNCTIONS disabled, ++ and libraries. With EGLIBC_LOCALE_CODE disabled, + EGLIBC supports only the 'C' locale (also known as 'POSIX'), + and ignores the settings of the 'LANG' and 'LC_*' environment + variables. + +- With OPTION_EGLIBC_LOCALE_CODE disabled, the following ++ With EGLIBC_LOCALE_CODE disabled, the following + functions are omitted from libc: + + duplocale localeconv nl_langinfo rpmatch strfmon_l +@@ -491,46 +489,43 @@ config OPTION_EGLIBC_LOCALE_CODE + Furthermore, only the LC_CTYPE and LC_TIME categories of the + standard "C" locale are available. + +- The OPTION_EGLIBC_CATGETS option group depends on this option +- group; if you disable OPTION_EGLIBC_LOCALE_CODE, you must also +- disable OPTION_EGLIBC_CATGETS. ++ The EGLIBC_CATGETS option group depends on this option group. ++ + +-config OPTION_EGLIBC_MEMUSAGE ++config EGLIBC_MEMUSAGE + bool "Memory profiling library" + help + This option group includes the `libmemusage' library and + the `memusage' and `memusagestat' utilities. + These components provide memory profiling functions. + +- OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE ++ EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE + + Libmemusage library buffers the profiling data in memory + before writing it out to disk. By default, the library + allocates 1.5M buffer, which can be substantial for some +- systems. OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE option ++ systems. EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE option + allows to change the default buffer size. It specifies + the number of entries the buffer should have. + On most architectures one buffer entry amounts to 48 bytes, + so setting this option to the value of 512 will reduce the size of + the memory buffer to 24K. + +-config OPTION_EGLIBC_NIS ++config EGLIBC_NIS + bool "Support for NIS, NIS+, and the special 'compat' services." +- depends OPTION_EGLIBC_INET +- depends OPTION_EGLIBC_SUNRPC ++ depends on EGLIBC_INET && EGLIBC_SUNRPC + help + This option group includes the NIS, NIS+, and 'compat' Name + Service Switch service libraries. When it is disabled, those + services libraries are not installed; you should remove any + references to them from your 'nsswitch.conf' file. + +- This option group depends on the OPTION_EGLIBC_INET option ++ This option group depends on the EGLIBC_INET option + group; you must enable that to enable this option group. + +-config OPTION_EGLIBC_NSSWITCH ++config EGLIBC_NSSWITCH + bool "Name service switch (nsswitch) support" + help +- + This option group includes support for the 'nsswitch' facility. + With this option group enabled, all EGLIBC functions for + accessing various system databases (passwords and groups; +@@ -544,12 +539,12 @@ config OPTION_EGLIBC_NSSWITCH + 'option-groups.config' file must set the following two + variables: + +- OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG ++ EGLIBC_NSSWITCH_FIXED_CONFIG + + Set this to the name of a file whose contents observe the + same syntax as an ordinary '/etc/nsswitch.conf' file. The + EGLIBC build process parses this file just as EGLIBC would +- at run time if OPTION_EGLIBC_NSSWITCH were enabled, and ++ at run time if EGLIBC_NSSWITCH were enabled, and + produces a C library that uses the nsswitch service + libraries to search for database entries as this file + specifies, instead of consulting '/etc/nsswitch.conf' at run +@@ -567,7 +562,7 @@ config OPTION_EGLIBC_NSSWITCH + you will probably want to delete references to databases not + needed on your system. + +- OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS ++ EGLIBC_NSSWITCH_FIXED_FUNCTIONS + + The EGLIBC build process uses this file to decide which + functions to make available from which service libraries. +@@ -585,28 +580,28 @@ config OPTION_EGLIBC_NSSWITCH + Be sure to mention each function in each service you wish to + use. If you do not mention a service's function here, the + EGLIBC database access functions will not find it, even if +- it is listed in the OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG ++ it is listed in the EGLIBC_NSSWITCH_FIXED_CONFIG + file. + +- In this arrangement, EGLIBC will not use the 'dlopen' and +- 'dlsym' functions to find database access functions. Instead, +- libc hard-codes references to the service libraries' database +- access functions. You must explicitly link your program +- against the name service libraries (those whose names start +- with 'libnss_', in the sysroot's '/lib' directory) whose +- functions you intend to use. This arrangement helps +- system-wide static analysis tools decide which functions a +- system actually uses. +- +- Note that some nsswitch service libraries require other option +- groups to be enabled; for example, the OPTION_EGLIBC_INET +- option group must be enabled to use the 'libnss_dns.so.2' +- service library, which uses the Domain Name System network +- protocol to answer queries. ++ In this arrangement, EGLIBC will not use the 'dlopen' and ++ 'dlsym' functions to find database access functions. Instead, ++ libc hard-codes references to the service libraries' database ++ access functions. You must explicitly link your program ++ against the name service libraries (those whose names start ++ with 'libnss_', in the sysroot's '/lib' directory) whose ++ functions you intend to use. This arrangement helps ++ system-wide static analysis tools decide which functions a ++ system actually uses. ++ ++ Note that some nsswitch service libraries require other option ++ groups to be enabled; for example, the EGLIBC_INET ++ option group must be enabled to use the 'libnss_dns.so.2' ++ service library, which uses the Domain Name System network ++ protocol to answer queries. + +-config OPTION_EGLIBC_RCMD ++config EGLIBC_RCMD + bool "Support for 'rcmd' and related library functions" +- depends OPTION_EGLIBC_INET ++ depends on EGLIBC_INET + help + This option group includes functions for running commands on + remote machines via the 'rsh' protocol, and doing authentication +@@ -622,7 +617,7 @@ config OPTION_EGLIBC_RCMD + rresvport ruserpass + rresvport_af + +-config OPTION_EGLIBC_RTLD_DEBUG ++config EGLIBC_RTLD_DEBUG + bool "Runtime linker debug print outs" + help + This option group enables debug output of the runtime linker +@@ -633,7 +628,7 @@ config OPTION_EGLIBC_RTLD_DEBUG + the `ldd' utility which may also be used by the prelinker. + In particular, the `--unused' ldd option will not work correctly. + +-config OPTION_EGLIBC_SPAWN ++config EGLIBC_SPAWN + bool "Support for POSIX posix_spawn functions" + help + This option group includes the POSIX functions for executing +@@ -669,7 +664,7 @@ config OPTION_EGLIBC_SPAWN + disabled, those programs will only operate on uncompressed + charmap files. + +-config OPTION_EGLIBC_STREAMS ++config EGLIBC_STREAMS + bool "Support for accessing STREAMS." + help + This option group includes functions for reading and writing +@@ -685,14 +680,14 @@ config OPTION_EGLIBC_STREAMS + isastream fdetach + putmsg + +-config OPTION_EGLIBC_SUNRPC ++config EGLIBC_SUNRPC + bool "Support for the Sun 'RPC' protocol." +- depends OPTION_EGLIBC_INET ++ depends on EGLIBC_INET + help + This option group includes support for the Sun RPC protocols, + including the 'rpcgen' and 'rpcinfo' programs. + +-config OPTION_EGLIBC_UTMP ++config EGLIBC_UTMP + bool "Older access functions for 'utmp' login records" + help + This option group includes the older 'utent' family of +@@ -719,9 +714,9 @@ config OPTION_EGLIBC_UTMP + + libutil.so (and libutil.a) + +-config OPTION_EGLIBC_UTMPX ++config EGLIBC_UTMPX + bool "POSIX access functions for 'utmp' login records" +- depends OPTION_EGLIBC_UTMP ++ depends on EGLIBC_UTMP + help + This option group includes the POSIX functions for reading and + writing user login records in the 'utmp' file (usually +@@ -742,21 +737,21 @@ config OPTION_EGLIBC_UTMPX + updwtmpx + utmpxname + +-config OPTION_EGLIBC_WORDEXP ++config EGLIBC_WORDEXP + bool "Shell-style word expansion" + help + This option group includes the 'wordexp' function for + performing word expansion in the manner of the shell, and the + accompanying 'wordfree' function. + +-config OPTION_POSIX_C_LANG_WIDE_CHAR ++config POSIX_C_LANG_WIDE_CHAR + bool "ISO C library wide character functions, excluding I/O" + help + This option group includes the functions defined by the ISO C + standard for working with wide and multibyte characters in + memory. Functions for reading and writing wide and multibyte + characters from and to files call in the +- OPTION_POSIX_WIDE_CHAR_DEVICE_IO option group. ++ POSIX_WIDE_CHAR_DEVICE_IO option group. + + This option group includes the following functions: + +@@ -778,14 +773,14 @@ config OPTION_POSIX_C_LANG_WIDE_CHAR + mbrlen wcscoll wcstol + mbrtowc wcscpy wcstold + +-config OPTION_POSIX_REGEXP ++config POSIX_REGEXP + bool "Regular expressions" + help + This option group includes the POSIX regular expression + functions, and the associated non-POSIX extensions and + compatibility functions. + +- With OPTION_POSIX_REGEXP disabled, the following functions are ++ With POSIX_REGEXP disabled, the following functions are + omitted from libc: + + re_comp re_max_failures regcomp +@@ -799,9 +794,9 @@ config OPTION_POSIX_REGEXP + header file, 'compile', 'step', and 'advance', is + omitted. + +-config OPTION_POSIX_REGEXP_GLIBC ++config POSIX_REGEXP_GLIBC + bool "Regular expressions from GLIBC" +- depends OPTION_POSIX_REGEXP ++ depends on POSIX_REGEXP + help + This option group specifies which regular expression + library to use. The choice is between regex +@@ -810,9 +805,9 @@ config OPTION_POSIX_REGEXP_GLIBC + optimized for speed; regex from libiberty is more than twice + as small while still is enough for most practical purposes. + +-config OPTION_POSIX_WIDE_CHAR_DEVICE_IO ++config POSIX_WIDE_CHAR_DEVICE_IO + bool "Input and output functions for wide characters" +- depends OPTION_POSIX_C_LANG_WIDE_CHAR ++ depends on POSIX_C_LANG_WIDE_CHAR + help + This option group includes functions for reading and writing + wide characters to and from streams. +Index: libc/Makefile +=================================================================== +--- libc.orig/Makefile ++++ libc/Makefile +@@ -24,6 +24,7 @@ endif + + include Makeconfig + ++include options-config/Makefile + + # This is the default target; it makes everything except the tests. + .PHONY: all +Index: libc/configure +=================================================================== +--- libc.orig/configure ++++ libc/configure +@@ -621,6 +621,7 @@ KSH + libc_cv_have_bash2 + BASH_SHELL + libc_cv_gcc_static_libgcc ++KCONFIG_TOOLS + CXX_SYSINCLUDES + SYSINCLUDES + AUTOCONF +@@ -734,6 +735,7 @@ with_fp + with_binutils + with_selinux + with_headers ++with_kconfig + with_default_link + enable_sanity_checks + enable_shared +@@ -1438,6 +1440,9 @@ Optional Packages: + --with-selinux if building with SELinux support + --with-headers=PATH location of system headers to use (for example + /usr/src/linux/include) [default=compiler default] ++ --with-kconfig=PATH location of kconfig tools to use (from Linux kernel ++ builds) to re-use for configuring EGLIBC option ++ groups + --with-default-link do not use explicit linker scripts + --with-cpu=CPU select code for CPU variant + +@@ -3401,6 +3406,14 @@ fi + + + ++# Check whether --with-kconfig was given. ++if test "${with_kconfig+set}" = set; then ++ withval=$with_kconfig; KCONFIG_TOOLS=$withval ++else ++ KCONFIG_TOOLS='' ++fi ++ ++ + + # Check whether --with-default-link was given. + if test "${with_default_link+set}" = set; then : +Index: libc/EGLIBC.option-groups +=================================================================== +--- libc.orig/EGLIBC.option-groups ++++ libc/EGLIBC.option-groups +@@ -56,33 +56,9 @@ disable option groups one by one, until + + The Option Groups + +-EGLIBC currently implements the following option groups, also +-documented in the file 'option-groups.def': +- +-OPTION_EGLIBC_CATGETS +- This option group includes functions for accessing message +- catalogs: catopen, catclose, and catgets. +- +-OPTION_EGLIBC_LOCALES +- This option group includes all locale definitions other than +- those for the "C" locale. If this option group is omitted, then +- only the "C" locale is supported. +- +-OPTION_EGLIBC_LIBM +- This option group includes the 'libm' library, containing +- mathematical functions. If this option group is omitted, then +- an EGLIBC installation does not include shared or unshared versions +- of the math library. +- +- Note that this does not remove all floating-point related +- functionality from EGLIBC; for example, 'printf' and 'scanf' +- can still print and read floating-point values with this option +- group disabled. +- +- Note that the ISO Standard C++ library 'libstdc++' depends on +- EGLIBC's math library 'libm'. If you disable this option +- group, you will not be able to build 'libstdc++' against the +- resulting EGLIBC installation. ++To see the current full list of implemented option groups, refer to the ++file 'option-groups.def' at the top of the source tree, or run ++'make menuconfig' from the top-level build directory. + + The POSIX.1-2001 specification includes a suggested partition of all + the functions in the POSIX C API into option groups: math functions +@@ -110,6 +86,18 @@ data, but include mathematical functions + OPTION_EGLIBC_LOCALES = n + OPTION_EGLIBC_LIBM = y + ++Like the Linux kernel, EGLIBC supports a similar set of '*config' make ++targets to make it easier to create 'option-groups.config', with all ++dependencies between option groups automatically satisfied. Run ++'make help' to see the list of supported make config targets. For ++example, 'make menuconfig' will update the current config utilising a ++menu based program. ++ ++The option group names and their type (boolean, int, hex, string), help ++description, and dependencies with other option groups, are described by ++'option-groups.def' at the top of the source tree, analogous to the ++'Kconfig' files in the Linux kernel. ++ + In general, each option group variable controls whether a given set of + object files in EGLIBC is compiled and included in the final + libraries, or omitted from the build. +@@ -132,22 +120,3 @@ under development. + + We have used the system to subset some portions of EGLIBC's + functionality. It needs to be extended to cover more of the library. +- +-At the moment, EGLIBC performs no sanity checks on the contents of +-'option-groups.config'; if an option group's name is mistyped, the +-option group is silently included in the build. EGLIBC should check +-that all variables set in 'option-groups.config' are proper option +-group names, and that their values are appropriate. +- +-Some portions of EGLIBC depend on others; for example, the Sun Remote +-Procedure Call functions in 'sunrpc' depend on the networking +-functions in 'inet'. The sanity checking described above should check +-that the selection configuration satisfies dependencies within EGLIBC, +-and produce a legible error message if it does not. At the moment, +-inconsistent configurations produce link errors late in the build +-process. +- +-The Linux kernel's configuration system provides interactive +-interfaces for creating and modifying configuration files (which also +-perform the sanity checking and dependency tracking described above). +-EGLIBC should provide similar interfaces. diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch new file mode 100644 index 0000000..a8463ea --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch @@ -0,0 +1,36 @@ +From 713d822908d1b2ae8403af7f9375c7054ed3dd49 Mon Sep 17 00:00:00 2001 +From: Ting Liu +Date: Wed, 19 Dec 2012 04:39:57 -0600 +Subject: [PATCH] eglibc: run libm-err-tab.pl with specific dirs in ${S} + +libm-err-tab.pl will parse all the files named "libm-test-ulps" +in the given dir recursively. To avoid parsing the one in +${S}/.pc/ (it does exist after eglibc adds aarch64 support, +${S}/.pc/aarch64-0001-glibc-fsf-v1-eaf6f205.patch/ports/sysdeps/ +aarch64/libm-test-ulps), run libm-err-tab.pl with specific dirs +in ${S}. + +Upstream-Status: inappropriate [OE specific] + +Signed-off-by: Ting Liu +--- + manual/Makefile | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/manual/Makefile b/manual/Makefile +index 6fddff0..7af242e 100644 +--- a/manual/Makefile ++++ b/manual/Makefile +@@ -109,7 +109,8 @@ $(objpfx)libm-err.texi: $(objpfx)stamp-libm-err + $(objpfx)stamp-libm-err: libm-err-tab.pl $(wildcard $(foreach dir,$(sysdirs),\ + $(dir)/libm-test-ulps)) + pwd=`pwd`; \ +- $(PERL) $< $$pwd/.. > $(objpfx)libm-err-tmp ++ $(PERL) $< $$pwd/../ports > $(objpfx)libm-err-tmp ++ $(PERL) $< $$pwd/../sysdeps >> $(objpfx)libm-err-tmp + $(move-if-change) $(objpfx)libm-err-tmp $(objpfx)libm-err.texi + touch $@ + +-- +1.7.9.7 + diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0002-eglibc-menuconfig-hex-string-options.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0002-eglibc-menuconfig-hex-string-options.patch new file mode 100644 index 0000000..7caba48 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0002-eglibc-menuconfig-hex-string-options.patch @@ -0,0 +1,169 @@ +pulled from + +http://www.eglibc.org/archives/patches/msg01043.html + + +Upstream-Status: Pending +Signed-off-by: Khem + + +This patch builds on the menuconfig patch for EGLIBC. + + +There are a few options that have non-boolean types, that would benefit from the new 'make *config' support: + +EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE (int) +EGLIBC_NSSWITCH_FIXED_CONFIG (string) +EGLIBC_NSSWITCH_FIXED_FUNCTIONS (string) + + +The patch converts these to real options in libc/option-groups.def. Also, libc/scripts/option-groups.awk is modified to output a '#define' line for int, hex, or string options encountered in the config file. + +In the post-processing script config-postproc.pl, a small change is needed: for any boolean option FOO that is implicitly disabled in the kconfig output, make sure that option is indeed a boolean before printing the explicit OPTION_FOO=n. + +Finally, libc/malloc/Makefile passes __OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE as a CPPFLAGS, which is not necessary anymore because this macro will now be present in the generated header. + +attached is the updated patch to address above issues. + +Steve + +-- +Steve Longerbeam | Senior Embedded Engineer, ESD Services +Mentor Embedded(tm) | 46871 Bayside Parkway, Fremont, CA 94538 +P 510.354.5838 | M 408.410.2735 +Nucleus(r) | Linux(r) | Android(tm) | Services | UI | Multi-OS + + +Index: libc/malloc/Makefile +=================================================================== +--- libc.orig/malloc/Makefile 2012-01-04 22:06:18.000000000 -0800 ++++ libc/malloc/Makefile 2012-05-09 19:35:28.598682105 -0700 +@@ -48,10 +48,6 @@ + ifeq ($(OPTION_EGLIBC_MEMUSAGE),y) + extra-libs = libmemusage + extra-libs-others = $(extra-libs) +- +-ifdef OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE +-CPPFLAGS-memusage += -D__OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE=$(OPTION_EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE) +-endif + endif + + libmemusage-routines = memusage +Index: libc/option-groups.def +=================================================================== +--- libc.orig/option-groups.def 2012-05-09 19:33:48.398677256 -0700 ++++ libc/option-groups.def 2012-05-09 19:35:28.610682107 -0700 +@@ -513,8 +513,11 @@ + the `memusage' and `memusagestat' utilities. + These components provide memory profiling functions. + +- EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE +- ++config EGLIBC_MEMUSAGE_DEFAULT_BUFFER_SIZE ++ int "Memory profiling library buffer size" ++ depends on EGLIBC_MEMUSAGE ++ default "32768" ++ help + Libmemusage library buffers the profiling data in memory + before writing it out to disk. By default, the library + allocates 1.5M buffer, which can be substantial for some +@@ -553,8 +556,11 @@ + 'option-groups.config' file must set the following two + variables: + +- EGLIBC_NSSWITCH_FIXED_CONFIG +- ++config EGLIBC_NSSWITCH_FIXED_CONFIG ++ string "Nsswitch fixed config filename" ++ depends on !EGLIBC_NSSWITCH ++ default "" ++ help + Set this to the name of a file whose contents observe the + same syntax as an ordinary '/etc/nsswitch.conf' file. The + EGLIBC build process parses this file just as EGLIBC would +@@ -576,8 +582,11 @@ + you will probably want to delete references to databases not + needed on your system. + +- EGLIBC_NSSWITCH_FIXED_FUNCTIONS +- ++config EGLIBC_NSSWITCH_FIXED_FUNCTIONS ++ string "Nsswitch fixed functions filename" ++ depends on !EGLIBC_NSSWITCH ++ default "" ++ help + The EGLIBC build process uses this file to decide which + functions to make available from which service libraries. + The file 'nss/fixed-nsswitch.functions' serves as a sample +Index: libc/options-config/config-postproc.pl +=================================================================== +--- libc.orig/options-config/config-postproc.pl 2012-05-09 19:33:36.530676681 -0700 ++++ libc/options-config/config-postproc.pl 2012-05-09 19:35:28.610682107 -0700 +@@ -8,7 +8,7 @@ + die "Could not open $ARGV[0]" unless -T $ARGV[0]; + + sub yank { +- @option = grep($_ ne $_[0], @option); ++ @option = grep(!($_ =~ /$_[0]\s*=/), @option); + } + + open(DEFAULTS, $defaults) || die "Could not open $defaults\n"; +@@ -16,7 +16,7 @@ + # get the full list of available options using the default config file + $i = 0; + while () { +- if (/^\s*OPTION_(\w+)\s*=/) { ++ if (/^\s*OPTION_(\w+\s*=.*$)/) { + $option[$i++] = $1; + } + } +@@ -35,8 +35,9 @@ + s/CONFIG_/OPTION_/g; + print; + } elsif (/^\s*#\s+CONFIG_(\w+) is not set/) { +- # this is a comment line, change CONFIG_ to OPTION_, remove this +- # option from option list, and convert to explicit OPTION_FOO=n ++ # this is a comment line for an unset boolean option, change CONFIG_ ++ # to OPTION_, remove this option from option list, and convert to ++ # explicit OPTION_FOO=n + $opt = $1; + yank($opt); + s/CONFIG_/OPTION_/g; +@@ -46,9 +47,12 @@ + } + } + +-# any options left in @options, are options that were not mentioned in ++# any boolean options left in @options, are options that were not mentioned in + # the config file, and implicitly that means the option must be set =n, + # so do that here. + foreach $opt (@option) { +- print "OPTION_$opt=n\n"; ++ if ($opt =~ /=\s*[yn]/) { ++ $opt =~ s/=\s*[yn]/=n/; ++ print "OPTION_$opt\n"; ++ } + } +Index: libc/scripts/option-groups.awk +=================================================================== +--- libc.orig/scripts/option-groups.awk 2012-01-04 22:06:00.000000000 -0800 ++++ libc/scripts/option-groups.awk 2012-05-09 19:35:28.610682107 -0700 +@@ -46,9 +46,15 @@ + print "#define __" var " 1" + else if (vars[var] == "n") + print "/* #undef __" var " */" +- # Ignore variables that don't have boolean values. +- # Ideally, this would be driven by the types given in +- # option-groups.def. ++ else if (vars[var] ~ /^[0-9]+/ || ++ vars[var] ~ /^0x[0-9aAbBcCdDeEfF]+/ || ++ vars[var] ~ /^\"/) ++ print "#define __" var " " vars[var] ++ else ++ print "/* #undef __" var " */" ++ # Ignore variables that don't have boolean, int, hex, or ++ # string values. Ideally, this would be driven by the types ++ # given in option-groups.def. + } + } + diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0003-eglibc-menuconfig-build-instructions.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0003-eglibc-menuconfig-build-instructions.patch new file mode 100644 index 0000000..d137f5b --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/0003-eglibc-menuconfig-build-instructions.patch @@ -0,0 +1,176 @@ +Pulled from + +http://www.eglibc.org/archives/patches/msg01035.html + +Upstream-Status: Pending +Signed-off-by: Khem + +As part of the menuconfig development, I encountered some outdated information in the cross-build instructions, libc/EGLIBC.cross-building. This patch updates the file with new (and tested) instructions. It is unrelated to the menuconfig support, but applies after. + +My testing was done with an ARM target, and an x86_64 Linux host, so I converted the instructions to use those host/target types from the original i686/powerpc. Hope that's ok. + + +Thanks, + +-- +Steve Longerbeam | Senior Embedded Engineer, ESD Services +Mentor Embedded(tm) | 46871 Bayside Parkway, Fremont, CA 94538 +P 510.354.5838 | M 408.410.2735 +Nucleus(r) | Linux(r) | Android(tm) | Services | UI | Multi-OS + + + EGLIBC.cross-building | 59 +++++++++++++++++++++++++++++--------------------- + 1 file changed, 35 insertions(+), 24 deletions(-) + +Index: libc/EGLIBC.cross-building +=================================================================== +--- libc.orig/EGLIBC.cross-building 2012-05-09 19:33:36.522676681 -0700 ++++ libc/EGLIBC.cross-building 2012-05-09 19:36:13.918684298 -0700 +@@ -47,31 +47,34 @@ + EGLIBC requires recent versions of the GNU binutils, GCC, and the + Linux kernel. The web page + documents the current requirements, and lists patches needed for +-certain target architectures. As of this writing, EGLIBC required +-binutils 2.17, GCC 4.1, and Linux 2.6.19.1. ++certain target architectures. As of this writing, these build ++instructions have been tested with binutils 2.22.51, GCC 4.6.2, ++and Linux 3.1. + + First, let's set some variables, to simplify later commands. We'll +-build EGLIBC and GCC for a PowerPC target, known to the Linux kernel +-as 'powerpc', and we'll do the build on an Intel Linux box: ++build EGLIBC and GCC for an ARM target, known to the Linux kernel ++as 'arm', and we'll do the build on an Intel x86_64 Linux box: + +- $ build=i686-pc-linux-gnu ++ $ build=x86_64-pc-linux-gnu + $ host=$build +- $ target=powerpc-none-linux-gnu +- $ linux_arch=powerpc ++ $ target=arm-none-linux-gnueabi ++ $ linux_arch=arm + + We're using the aforementioned versions of Binutils, GCC, and Linux: + +- $ binutilsv=binutils-2.17 +- $ gccv=gcc-4.1.1 +- $ linuxv=linux-2.6.20 ++ $ binutilsv=binutils-2.22.51 ++ $ gccv=gcc-4.6.2 ++ $ linuxv=linux-3.1 + + We're carrying out the entire process under '~/cross-build', which +-contains unpacked source trees: ++contains unpacked source trees for binutils, gcc, and linux kernel, ++along with EGLIBC svn trunk (which can be checked-out with ++'svn co http://www.eglibc.org/svn/trunk eglibc'): + +- $ top=$HOME/cross-build/ppc ++ $ top=$HOME/cross-build/$target + $ src=$HOME/cross-build/src + $ ls $src +- binutils-2.17 gcc-4.1.1 libc linux-2.6.20 ++ binutils-2.22.51 eglibc gcc-4.6.2 linux-3.1 + + We're going to place our build directories in a subdirectory 'obj', + we'll install the cross-development toolchain in 'tools', and we'll +@@ -99,7 +102,7 @@ + + The First GCC + +-For our work, we need a cross-compiler targeting a PowerPC Linux ++For our work, we need a cross-compiler targeting an ARM Linux + system. However, that configuration includes the shared library + 'libgcc_s.so', which is compiled against the EGLIBC headers (which we + haven't installed yet) and linked against 'libc.so' (which we haven't +@@ -125,7 +128,8 @@ + > --prefix=$tools \ + > --without-headers --with-newlib \ + > --disable-shared --disable-threads --disable-libssp \ +- > --disable-libgomp --disable-libmudflap \ ++ > --disable-libgomp --disable-libmudflap --disable-libquadmath \ ++ > --disable-decimal-float --disable-libffi \ + > --enable-languages=c + $ PATH=$tools/bin:$PATH make + $ PATH=$tools/bin:$PATH make install +@@ -162,12 +166,13 @@ + > CXX=$tools/bin/$target-g++ \ + > AR=$tools/bin/$target-ar \ + > RANLIB=$tools/bin/$target-ranlib \ +- > $src/libc/configure \ ++ > $src/eglibc/libc/configure \ + > --prefix=/usr \ + > --with-headers=$sysroot/usr/include \ + > --build=$build \ + > --host=$target \ +- > --disable-profile --without-gd --without-cvs --enable-add-ons ++ > --disable-profile --without-gd --without-cvs \ ++ > --enable-add-ons=nptl,libidn,../ports + + The option '--prefix=/usr' may look strange, but you should never + configure EGLIBC with a prefix other than '/usr': in various places, +@@ -181,6 +186,11 @@ + The '--with-headers' option tells EGLIBC where the Linux headers have + been installed. + ++The '--enable-add-ons=nptl,libidn,../ports' option tells EGLIBC to look ++for the listed glibc add-ons. Most notably the ports add-on (located ++just above the libc sources in the EGLIBC svn tree) is required to ++support ARM targets. ++ + We can now use the 'install-headers' makefile target to install the + headers: + +@@ -223,6 +233,7 @@ + > --prefix=$tools \ + > --with-sysroot=$sysroot \ + > --disable-libssp --disable-libgomp --disable-libmudflap \ ++ > --disable-libffi --disable-libquadmath \ + > --enable-languages=c + $ PATH=$tools/bin:$PATH make + $ PATH=$tools/bin:$PATH make install +@@ -240,13 +251,14 @@ + > CXX=$tools/bin/$target-g++ \ + > AR=$tools/bin/$target-ar \ + > RANLIB=$tools/bin/$target-ranlib \ +- > $src/libc/configure \ ++ > $src/eglibc/libc/configure \ + > --prefix=/usr \ + > --with-headers=$sysroot/usr/include \ + > --with-kconfig=$obj/linux/scripts/kconfig \ + > --build=$build \ + > --host=$target \ +- > --disable-profile --without-gd --without-cvs --enable-add-ons ++ > --disable-profile --without-gd --without-cvs \ ++ > --enable-add-ons=nptl,libidn,../ports + + Note the additional '--with-kconfig' option. This tells EGLIBC where to + find the host config tools used by the kernel 'make config' and 'make +@@ -337,15 +349,15 @@ + ELF Header: + ... + Type: EXEC (Executable file) +- Machine: PowerPC ++ Machine: ARM + + ... + Program Headers: + Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align + PHDR 0x000034 0x10000034 0x10000034 0x00100 0x00100 R E 0x4 +- INTERP 0x000134 0x10000134 0x10000134 0x0000d 0x0000d R 0x1 +- [Requesting program interpreter: /lib/ld.so.1] +- LOAD 0x000000 0x10000000 0x10000000 0x008f0 0x008f0 R E 0x10000 ++ INTERP 0x000134 0x00008134 0x00008134 0x00013 0x00013 R 0x1 ++ [Requesting program interpreter: /lib/ld-linux.so.3] ++ LOAD 0x000000 0x00008000 0x00008000 0x0042c 0x0042c R E 0x8000 + ... + + Looking at the dynamic section of the installed 'libgcc_s.so', we see +@@ -357,7 +369,6 @@ + Dynamic section at offset 0x1083c contains 24 entries: + Tag Type Name/Value + 0x00000001 (NEEDED) Shared library: [libc.so.6] +- 0x00000001 (NEEDED) Shared library: [ld.so.1] + 0x0000000e (SONAME) Library soname: [libgcc_s.so.1] + ... + diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/GLRO_dl_debug_mask.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/GLRO_dl_debug_mask.patch new file mode 100644 index 0000000..7258c82 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/GLRO_dl_debug_mask.patch @@ -0,0 +1,143 @@ +Its controlled by __OPTION_EGLIBC_RTLD_DEBUG +so we should use GLRO_dl_debug_mask + +Singed-off-by: Khem Raj + +Upstream-Status: Pending +Index: libc/elf/dl-open.c +=================================================================== +--- libc.orig/elf/dl-open.c 2012-10-25 10:18:12.000000000 -0700 ++++ libc/elf/dl-open.c 2013-01-09 11:49:02.635577870 -0800 +@@ -155,7 +155,7 @@ + ns->_ns_main_searchlist->r_list[new_nlist++] = map; + + /* We modify the global scope. Report this. */ +- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0)) ++ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_SCOPES, 0)) + _dl_debug_printf ("\nadd %s [%lu] to global scope\n", + map->l_name, map->l_ns); + } +@@ -298,7 +298,7 @@ + LIBC_PROBE (map_complete, 3, args->nsid, r, new); + + /* Print scope information. */ +- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0)) ++ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_SCOPES, 0)) + _dl_show_scope (new, 0); + + /* Only do lazy relocation if `LD_BIND_NOW' is not set. */ +@@ -515,7 +515,7 @@ + } + + /* Print scope information. */ +- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0)) ++ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_SCOPES, 0)) + _dl_show_scope (imap, from_scope); + } + +Index: libc/ports/sysdeps/mips/dl-lookup.c +=================================================================== +--- libc.orig/ports/sysdeps/mips/dl-lookup.c 2012-08-17 12:39:53.000000000 -0700 ++++ libc/ports/sysdeps/mips/dl-lookup.c 2013-01-09 11:49:02.635577870 -0800 +@@ -111,7 +111,7 @@ + continue; + + /* Print some debugging info if wanted. */ +- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SYMBOLS, 0)) ++ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_SYMBOLS, 0)) + _dl_debug_printf ("symbol=%s; lookup in file=%s [%lu]\n", + undef_name, + map->l_name[0] ? map->l_name : rtld_progname, +@@ -432,7 +432,7 @@ + hash table. */ + if (__builtin_expect (tab->size, 0)) + { +- assert (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK); ++ assert (GLRO_dl_debug_mask & DL_DEBUG_PRELINK); + __rtld_lock_unlock_recursive (tab->lock); + goto success; + } +@@ -681,7 +681,7 @@ + } + + /* Display information if we are debugging. */ +- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0)) ++ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0)) + _dl_debug_printf ("\ + \nfile=%s [%lu]; needed by %s [%lu] (relocation dependency)\n\n", + map->l_name[0] ? map->l_name : rtld_progname, +@@ -788,7 +788,7 @@ + { + if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK) + && skip_map == NULL +- && !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED)) ++ && !(GLRO_dl_debug_mask & DL_DEBUG_UNUSED)) + { + /* We could find no value for a strong reference. */ + const char *reference_name = undef_map ? undef_map->l_name : ""; +@@ -861,7 +861,7 @@ + if (__builtin_expect (current_value.m->l_used == 0, 0)) + current_value.m->l_used = 1; + +- if (__builtin_expect (GLRO(dl_debug_mask) ++ if (__builtin_expect (GLRO_dl_debug_mask + & (DL_DEBUG_BINDINGS|DL_DEBUG_PRELINK), 0)) + _dl_debug_bindings (undef_name, undef_map, ref, + ¤t_value, version, type_class, protected); +@@ -926,7 +926,7 @@ + { + const char *reference_name = undef_map->l_name; + +- if (GLRO(dl_debug_mask) & DL_DEBUG_BINDINGS) ++ if (GLRO_dl_debug_mask & DL_DEBUG_BINDINGS) + { + _dl_debug_printf ("binding file %s [%lu] to %s [%lu]: %s symbol `%s'", + (reference_name[0] +@@ -942,7 +942,7 @@ + _dl_debug_printf_c ("\n"); + } + #ifdef SHARED +- if (GLRO(dl_debug_mask) & DL_DEBUG_PRELINK) ++ if (GLRO_dl_debug_mask & DL_DEBUG_PRELINK) + { + int conflict = 0; + struct sym_val val = { NULL, NULL }; +Index: libc/elf/rtld.c +=================================================================== +--- libc.orig/elf/rtld.c 2012-10-10 08:35:46.000000000 -0700 ++++ libc/elf/rtld.c 2013-01-09 11:49:02.635577870 -0800 +@@ -2118,7 +2118,7 @@ + GLRO(dl_init_all_dirs) = GL(dl_all_dirs); + + /* Print scope information. */ +- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_SCOPES, 0)) ++ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_SCOPES, 0)) + { + _dl_debug_printf ("\nInitial object scopes\n"); + +Index: libc/elf/dl-lookup.c +=================================================================== +--- libc.orig/elf/dl-lookup.c 2012-08-17 12:39:53.000000000 -0700 ++++ libc/elf/dl-lookup.c 2013-01-09 11:49:02.635577870 -0800 +@@ -771,7 +771,7 @@ + { + if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK) + && skip_map == NULL +- && !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED)) ++ && !(GLRO_dl_debug_mask & DL_DEBUG_UNUSED)) + { + /* We could find no value for a strong reference. */ + const char *reference_name = undef_map ? undef_map->l_name : ""; +Index: libc/elf/get-dynamic-info.h +=================================================================== +--- libc.orig/elf/get-dynamic-info.h 2012-12-02 13:11:45.000000000 -0800 ++++ libc/elf/get-dynamic-info.h 2013-01-09 12:53:51.015657653 -0800 +@@ -157,7 +157,7 @@ + them. Therefore to avoid breaking existing applications the + best we can do is add a warning during debugging with the + intent of notifying the user of the problem. */ +- if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_FILES, 0) ++ if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_FILES, 0) + && l->l_flags_1 & ~DT_1_SUPPORTED_MASK) + _dl_debug_printf ("\nWARNING: Unsupported flag value(s) of 0x%x in DT_FLAGS_1.\n", + l->l_flags_1 & ~DT_1_SUPPORTED_MASK); diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/IO-acquire-lock-fix.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/IO-acquire-lock-fix.patch new file mode 100644 index 0000000..cf58035 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/IO-acquire-lock-fix.patch @@ -0,0 +1,17 @@ +import http://sourceware.org/ml/libc-ports/2007-12/msg00000.html + +Upstream-Status: Pending + +Index: libc/bits/stdio-lock.h +=================================================================== +--- libc.orig/bits/stdio-lock.h 2009-10-28 14:34:19.000000000 -0700 ++++ libc/bits/stdio-lock.h 2009-10-28 14:34:54.000000000 -0700 +@@ -50,6 +50,8 @@ __libc_lock_define_recursive (typedef, _ + _IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, (_fp)); \ + _IO_flockfile (_fp) + ++# define _IO_acquire_lock_clear_flags2(_fp) _IO_acquire_lock (_fp) ++ + # define _IO_release_lock(_fp) \ + _IO_funlockfile (_fp); \ + _IO_cleanup_region_end (0) diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/add_resource_h_to_wait_h.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/add_resource_h_to_wait_h.patch new file mode 100644 index 0000000..f5023c0 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/add_resource_h_to_wait_h.patch @@ -0,0 +1,20 @@ +The older versions of perf still require sys/resource.h to be +present in this header, the newer version of perf in 3.2 and +beyond directly include sys/resource.h + +Upstream-Status: Inapproriate [older kernel/perf specific] + +Signed-off-by: Saul Wold + +Index: libc/posix/sys/wait.h +=================================================================== +--- libc.orig/posix/sys/wait.h ++++ libc/posix/sys/wait.h +@@ -28,6 +28,7 @@ + __BEGIN_DECLS + + #include ++#include + + /* These macros could also be defined in . */ + #if !defined _STDLIB_H || (!defined __USE_XOPEN && !defined __USE_XOPEN2K8) diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/eglibc-svn-arm-lowlevellock-include-tls.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/eglibc-svn-arm-lowlevellock-include-tls.patch new file mode 100644 index 0000000..4313aa5 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/eglibc-svn-arm-lowlevellock-include-tls.patch @@ -0,0 +1,21 @@ +In file included from ../nptl/sysdeps/unix/sysv/linux/libc-lowlevellock.c:21: +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c: In function '__lll_lock_wait_private': +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: warning: implicit declaration of function 'THREAD_GETMEM' +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: 'THREAD_SELF' undeclared (first use in this function) +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: (Each undeclared identifier is reported only once +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: for each function it appears in.) +../nptl/sysdeps/unix/sysv/linux/lowlevellock.c:34: error: 'header' undeclared (first use in this function) +make[4]: *** [/var/tmp/portage/sys-libs/glibc-2.7-r1/work/build-default-armv4l-unknown-linux-gnu-nptl/nptl/rtld-libc-lowlevellock.os] Error 1 + +Upstream-Status: Pending + +--- libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h.orig ++++ libc/ports/sysdeps/unix/sysv/linux/arm/nptl/lowlevellock.h +@@ -25,6 +25,7 @@ + #include + #include + #include ++#include + + #define FUTEX_WAIT 0 + #define FUTEX_WAKE 1 diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/eglibc_fix_findidx_parameters.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/eglibc_fix_findidx_parameters.patch new file mode 100644 index 0000000..bbf4605 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/eglibc_fix_findidx_parameters.patch @@ -0,0 +1,38 @@ +Upstream-Status: backport + +Imported patch from: http://www.eglibc.org/archives/patches/msg01124.html + +Signed-Off-By: Nitin A Kamble +2012/05/09 + +Index: libc/posix/xregex.c +=================================================================== +--- libc.orig/posix/xregex.c ++++ libc/posix/xregex.c +@@ -2943,7 +2943,7 @@ PREFIX(regex_compile) (const char *ARG_P + _NL_CURRENT (LC_COLLATE, + _NL_COLLATE_INDIRECTWC); + +- idx = findidx ((const wint_t**)&cp); ++ idx = findidx ((const wint_t**)&cp, -1); + if (idx == 0 || cp < (wint_t*) str + c1) + /* This is no valid character. */ + FREE_STACK_RETURN (REG_ECOLLATE); +@@ -3392,7 +3392,7 @@ PREFIX(regex_compile) (const char *ARG_P + indirect = (const int32_t *) + _NL_CURRENT (LC_COLLATE, _NL_COLLATE_INDIRECTMB); + +- idx = findidx (&cp); ++ idx = findidx (&cp, -1); + if (idx == 0 || cp < str + c1) + /* This is no valid character. */ + FREE_STACK_RETURN (REG_ECOLLATE); +@@ -6363,7 +6363,7 @@ byte_re_match_2_internal (struct re_patt + } + str_buf[i] = TRANSLATE(*(d+i)); + str_buf[i+1] = '\0'; /* sentinel */ +- idx2 = findidx ((const wint_t**)&cp); ++ idx2 = findidx ((const wint_t**)&cp, -1); + } + + /* Update d, however d will be incremented at diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/etc/ld.so.conf b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/etc/ld.so.conf new file mode 100644 index 0000000..e69de29 diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/fileops-without-wchar-io.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/fileops-without-wchar-io.patch new file mode 100644 index 0000000..2ca0bca --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/fileops-without-wchar-io.patch @@ -0,0 +1,22 @@ +Fix error like + +/home/kraj/work/angstrom/sources/openembedded-core/build/tmp-eglibc/work/mips64-oe-linux/eglibc-2.16-r2+svnr19383/build-mips64-oe-linux/libc_pic.os: In function `_IO_new_file_fopen': +/home/kraj/work/angstrom/sources/openembedded-core/build/tmp-eglibc/work/mips64-oe-linux/eglibc-2.16-r2+svnr19383/eglibc-2_16/libc/libio/fileops.c:431: undefined reference to `_IO_file_close_it_internal' +collect2: error: ld returned 1 exit status + + +Signed-off-by: Khem Raj +Upstream-Status: Pending +Index: libc/libio/fileops.c +=================================================================== +--- libc.orig/libio/fileops.c 2012-07-04 18:25:47.000000000 -0700 ++++ libc/libio/fileops.c 2012-07-24 00:21:17.220322557 -0700 +@@ -428,7 +428,7 @@ + result->_mode = 1; + #else + /* Treat this as if we couldn't find the given character set. */ +- (void) INTUSE(_IO_file_close_it) (fp); ++ (void) _IO_file_close_it (fp); + __set_errno (EINVAL); + return NULL; + #endif diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/fix-tibetian-locales.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/fix-tibetian-locales.patch new file mode 100644 index 0000000..25c43a9 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/fix-tibetian-locales.patch @@ -0,0 +1,38 @@ +cross localedef fails to compile these locales because name_fmt field is empty +It is not acceptable for cross localedef and it errors out + +LC_NAME: field `name_fmt' not defined + +We therefore give a dummy string to the format, the real fix needs some native +tibetian person to define proper name_fmt + +Upstream-Status: Pending + +Signed-off-by: Khem Raj + +Index: libc/localedata/locales/bo_CN +=================================================================== +--- libc.orig/localedata/locales/bo_CN 2012-11-17 09:50:14.000000000 -0800 ++++ libc/localedata/locales/bo_CN 2013-01-04 08:55:15.593612288 -0800 +@@ -145,7 +145,7 @@ + LC_NAME + % FIXME + +-name_fmt "" ++name_fmt "FIXME" + % name_gen "FIXME" + % name_miss "FIXME" + % name_mr "FIXME" +Index: libc/localedata/locales/bo_IN +=================================================================== +--- libc.orig/localedata/locales/bo_IN 2012-11-17 09:50:14.000000000 -0800 ++++ libc/localedata/locales/bo_IN 2013-01-04 08:54:12.345609028 -0800 +@@ -70,7 +70,7 @@ + + LC_NAME + % FIXME +-name_fmt "" ++name_fmt "FIXME" + % name_gen "FIXME" + % name_miss "FIXME" + % name_mr "FIXME" diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/fix_for_centos_5.8.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/fix_for_centos_5.8.patch new file mode 100644 index 0000000..7618c99 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/fix_for_centos_5.8.patch @@ -0,0 +1,18 @@ +Upstream-Status: Inappropriate [other] + +This is a hack to fix building the locale bits on an older +CentOs 5.X machine + +Index: eglibc-2_16/libc/locale/programs/config.h +=================================================================== +--- eglibc-2_16.orig/libc/locale/programs/config.h ++++ eglibc-2_16/libc/locale/programs/config.h +@@ -19,6 +19,8 @@ + #ifndef _LD_CONFIG_H + #define _LD_CONFIG_H 1 + ++#define DUMMY_LOCALE_T ++ + /* Use the internal textdomain used for libc messages. */ + #define PACKAGE _libc_intl_domainname + #ifndef VERSION diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/fsl-ppc-no-fsqrt.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/fsl-ppc-no-fsqrt.patch new file mode 100644 index 0000000..511ee9d --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/fsl-ppc-no-fsqrt.patch @@ -0,0 +1,100 @@ +Create e5500 specific math_private.h and let it include when compiling for e5500/64bit core +We prefefine __CPU_HAS_FSQRT to 0 and then in general ppc64 math_private.h we check if its +already defined before redefining it. This way we can ensure that on e5500 builds it wont +emit fsqrt intructions + +-Khem + +Upstream-Status: Pending + +Index: libc/sysdeps/powerpc/fpu/math_private.h +=================================================================== +--- libc.orig/sysdeps/powerpc/fpu/math_private.h ++++ libc/sysdeps/powerpc/fpu/math_private.h +@@ -25,10 +25,12 @@ + #include + #include_next + +-# if __WORDSIZE == 64 || defined _ARCH_PWR4 +-# define __CPU_HAS_FSQRT 1 +-# else +-# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0) ++# ifndef __CPU_HAS_FSQRT ++# if __WORDSIZE == 64 || defined _ARCH_PWR4 ++# define __CPU_HAS_FSQRT 1 ++# else ++# define __CPU_HAS_FSQRT ((GLRO(dl_hwcap) & PPC_FEATURE_64) != 0) ++# endif + # endif + + extern double __slow_ieee754_sqrt (double); +Index: libc/ports/sysdeps/powerpc/powerpc64/e5500/fpu/math_private.h +=================================================================== +--- /dev/null ++++ libc/ports/sysdeps/powerpc/powerpc64/e5500/fpu/math_private.h +@@ -0,0 +1,9 @@ ++#ifndef _E5500_MATH_PRIVATE_H_ ++#define _E5500_MATH_PRIVATE_H_ 1 ++/* E5500 core FPU does not implement ++ fsqrt */ ++ ++#define __CPU_HAS_FSQRT 0 ++#include_next ++ ++#endif /* _E5500_MATH_PRIVATE_H_ */ +Index: libc/ports/sysdeps/powerpc/powerpc64/e6500/fpu/math_private.h +=================================================================== +--- /dev/null ++++ libc/ports/sysdeps/powerpc/powerpc64/e6500/fpu/math_private.h +@@ -0,0 +1,9 @@ ++#ifndef _E6500_MATH_PRIVATE_H_ ++#define _E6500_MATH_PRIVATE_H_ 1 ++/* E6500 core FPU does not implement ++ fsqrt */ ++ ++#define __CPU_HAS_FSQRT 0 ++#include_next ++ ++#endif /* _E6500_MATH_PRIVATE_H_ */ +Index: libc/ports/sysdeps/powerpc/powerpc32/e500mc/fpu/math_private.h +=================================================================== +--- /dev/null ++++ libc/ports/sysdeps/powerpc/powerpc32/e500mc/fpu/math_private.h +@@ -0,0 +1,9 @@ ++#ifndef _E500MC_MATH_PRIVATE_H_ ++#define _E500MC_MATH_PRIVATE_H_ 1 ++/* E500MC core FPU does not implement ++ fsqrt */ ++ ++#define __CPU_HAS_FSQRT 0 ++#include_next ++ ++#endif /* _E500MC_MATH_PRIVATE_H_ */ +Index: libc/ports/sysdeps/powerpc/powerpc32/e5500/fpu/math_private.h +=================================================================== +--- /dev/null ++++ libc/ports/sysdeps/powerpc/powerpc32/e5500/fpu/math_private.h +@@ -0,0 +1,9 @@ ++#ifndef _E5500_MATH_PRIVATE_H_ ++#define _E5500_MATH_PRIVATE_H_ 1 ++/* E5500 core FPU does not implement ++ fsqrt */ ++ ++#define __CPU_HAS_FSQRT 0 ++#include_next ++ ++#endif /* _E5500_MATH_PRIVATE_H_ */ +Index: libc/ports/sysdeps/powerpc/powerpc32/e6500/fpu/math_private.h +=================================================================== +--- /dev/null ++++ libc/ports/sysdeps/powerpc/powerpc32/e6500/fpu/math_private.h +@@ -0,0 +1,9 @@ ++#ifndef _E6500_MATH_PRIVATE_H_ ++#define _E6500_MATH_PRIVATE_H_ 1 ++/* E6500 core FPU does not implement ++ fsqrt */ ++ ++#define __CPU_HAS_FSQRT 0 ++#include_next ++ ++#endif /* _E6500_MATH_PRIVATE_H_ */ diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/generate-supported.mk b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/generate-supported.mk new file mode 100644 index 0000000..d2a28c2 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/generate-supported.mk @@ -0,0 +1,11 @@ +#!/usr/bin/make + +include $(IN) + +all: + rm -f $(OUT) + touch $(OUT) + for locale in $(SUPPORTED-LOCALES); do \ + [ $$locale = true ] && continue; \ + echo $$locale | sed 's,/, ,' >> $(OUT); \ + done diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/glibc.fix_sqrt2.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/glibc.fix_sqrt2.patch new file mode 100644 index 0000000..689b79c --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/glibc.fix_sqrt2.patch @@ -0,0 +1,1516 @@ +Signed-of-by: Edmar Wienskoski +Upstream-Status: Pending + +Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c +=================================================================== +--- /dev/null ++++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c +@@ -0,0 +1,134 @@ ++/* Double-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float two108 = 3.245185536584267269e+32; ++static const float twom54 = 5.551115123125782702e-17; ++static const float half = 0.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the actual square root and half of its reciprocal ++ simultaneously. */ ++ ++#ifdef __STDC__ ++double ++__ieee754_sqrt (double b) ++#else ++double ++__ieee754_sqrt (b) ++ double b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++ double y, g, h, d, r; ++ ieee_double_shape_type u; ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ u.value = b; ++ ++ relax_fenv_state (); ++ ++ __asm__ ("frsqrte %[estimate], %[x]\n" ++ : [estimate] "=f" (y) : [x] "f" (b)); ++ ++ /* Following Muller et al, page 168, equation 5.20. ++ ++ h goes to 1/(2*sqrt(b)) ++ g goes to sqrt(b). ++ ++ We need three iterations to get within 1ulp. */ ++ ++ /* Indicate that these can be performed prior to the branch. GCC ++ insists on sinking them below the branch, however; it seems like ++ they'd be better before the branch so that we can cover any latency ++ from storing the argument and loading its high word. Oh well. */ ++ ++ g = b * y; ++ h = 0.5 * y; ++ ++ /* Handle small numbers by scaling. */ ++ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) ++ return __ieee754_sqrt (b * two108) * twom54; ++ ++#define FMADD(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */ ++ ++ /* Final refinement. */ ++ d = FNMSUB (g, g, b); ++ ++ fesetenv_register (fe); ++ return FMADD (d, h, g); ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_wash (b); ++} +Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c +=================================================================== +--- /dev/null ++++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c +@@ -0,0 +1,101 @@ ++/* Single-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float threehalf = 1.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the reciprocal square root and use that to compute the actual ++ square root. */ ++ ++#ifdef __STDC__ ++float ++__ieee754_sqrtf (float b) ++#else ++float ++__ieee754_sqrtf (b) ++ float b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++#define FMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ double y, x; ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ relax_fenv_state (); ++ ++ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */ ++ y = FMSUB (threehalf, b, b); ++ ++ /* Initial estimate. */ ++ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b)); ++ ++ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */ ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ ++ /* All done. */ ++ fesetenv_register (fe); ++ return x * b; ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_washf (b); ++} +Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c +=================================================================== +--- /dev/null ++++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c +@@ -0,0 +1,134 @@ ++/* Double-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float two108 = 3.245185536584267269e+32; ++static const float twom54 = 5.551115123125782702e-17; ++static const float half = 0.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the actual square root and half of its reciprocal ++ simultaneously. */ ++ ++#ifdef __STDC__ ++double ++__ieee754_sqrt (double b) ++#else ++double ++__ieee754_sqrt (b) ++ double b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++ double y, g, h, d, r; ++ ieee_double_shape_type u; ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ u.value = b; ++ ++ relax_fenv_state (); ++ ++ __asm__ ("frsqrte %[estimate], %[x]\n" ++ : [estimate] "=f" (y) : [x] "f" (b)); ++ ++ /* Following Muller et al, page 168, equation 5.20. ++ ++ h goes to 1/(2*sqrt(b)) ++ g goes to sqrt(b). ++ ++ We need three iterations to get within 1ulp. */ ++ ++ /* Indicate that these can be performed prior to the branch. GCC ++ insists on sinking them below the branch, however; it seems like ++ they'd be better before the branch so that we can cover any latency ++ from storing the argument and loading its high word. Oh well. */ ++ ++ g = b * y; ++ h = 0.5 * y; ++ ++ /* Handle small numbers by scaling. */ ++ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) ++ return __ieee754_sqrt (b * two108) * twom54; ++ ++#define FMADD(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */ ++ ++ /* Final refinement. */ ++ d = FNMSUB (g, g, b); ++ ++ fesetenv_register (fe); ++ return FMADD (d, h, g); ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_wash (b); ++} +Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c +=================================================================== +--- /dev/null ++++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c +@@ -0,0 +1,101 @@ ++/* Single-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float threehalf = 1.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the reciprocal square root and use that to compute the actual ++ square root. */ ++ ++#ifdef __STDC__ ++float ++__ieee754_sqrtf (float b) ++#else ++float ++__ieee754_sqrtf (b) ++ float b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++#define FMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ double y, x; ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ relax_fenv_state (); ++ ++ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */ ++ y = FMSUB (threehalf, b, b); ++ ++ /* Initial estimate. */ ++ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b)); ++ ++ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */ ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ ++ /* All done. */ ++ fesetenv_register (fe); ++ return x * b; ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_washf (b); ++} +Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c +=================================================================== +--- /dev/null ++++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c +@@ -0,0 +1,134 @@ ++/* Double-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float two108 = 3.245185536584267269e+32; ++static const float twom54 = 5.551115123125782702e-17; ++static const float half = 0.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the actual square root and half of its reciprocal ++ simultaneously. */ ++ ++#ifdef __STDC__ ++double ++__ieee754_sqrt (double b) ++#else ++double ++__ieee754_sqrt (b) ++ double b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++ double y, g, h, d, r; ++ ieee_double_shape_type u; ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ u.value = b; ++ ++ relax_fenv_state (); ++ ++ __asm__ ("frsqrte %[estimate], %[x]\n" ++ : [estimate] "=f" (y) : [x] "f" (b)); ++ ++ /* Following Muller et al, page 168, equation 5.20. ++ ++ h goes to 1/(2*sqrt(b)) ++ g goes to sqrt(b). ++ ++ We need three iterations to get within 1ulp. */ ++ ++ /* Indicate that these can be performed prior to the branch. GCC ++ insists on sinking them below the branch, however; it seems like ++ they'd be better before the branch so that we can cover any latency ++ from storing the argument and loading its high word. Oh well. */ ++ ++ g = b * y; ++ h = 0.5 * y; ++ ++ /* Handle small numbers by scaling. */ ++ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) ++ return __ieee754_sqrt (b * two108) * twom54; ++ ++#define FMADD(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */ ++ ++ /* Final refinement. */ ++ d = FNMSUB (g, g, b); ++ ++ fesetenv_register (fe); ++ return FMADD (d, h, g); ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_wash (b); ++} +Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c +=================================================================== +--- /dev/null ++++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c +@@ -0,0 +1,101 @@ ++/* Single-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float threehalf = 1.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the reciprocal square root and use that to compute the actual ++ square root. */ ++ ++#ifdef __STDC__ ++float ++__ieee754_sqrtf (float b) ++#else ++float ++__ieee754_sqrtf (b) ++ float b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++#define FMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ double y, x; ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ relax_fenv_state (); ++ ++ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */ ++ y = FMSUB (threehalf, b, b); ++ ++ /* Initial estimate. */ ++ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b)); ++ ++ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */ ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ ++ /* All done. */ ++ fesetenv_register (fe); ++ return x * b; ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_washf (b); ++} +Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +=================================================================== +--- /dev/null ++++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +@@ -0,0 +1,134 @@ ++/* Double-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float two108 = 3.245185536584267269e+32; ++static const float twom54 = 5.551115123125782702e-17; ++static const float half = 0.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the actual square root and half of its reciprocal ++ simultaneously. */ ++ ++#ifdef __STDC__ ++double ++__ieee754_sqrt (double b) ++#else ++double ++__ieee754_sqrt (b) ++ double b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++ double y, g, h, d, r; ++ ieee_double_shape_type u; ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ u.value = b; ++ ++ relax_fenv_state (); ++ ++ __asm__ ("frsqrte %[estimate], %[x]\n" ++ : [estimate] "=f" (y) : [x] "f" (b)); ++ ++ /* Following Muller et al, page 168, equation 5.20. ++ ++ h goes to 1/(2*sqrt(b)) ++ g goes to sqrt(b). ++ ++ We need three iterations to get within 1ulp. */ ++ ++ /* Indicate that these can be performed prior to the branch. GCC ++ insists on sinking them below the branch, however; it seems like ++ they'd be better before the branch so that we can cover any latency ++ from storing the argument and loading its high word. Oh well. */ ++ ++ g = b * y; ++ h = 0.5 * y; ++ ++ /* Handle small numbers by scaling. */ ++ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) ++ return __ieee754_sqrt (b * two108) * twom54; ++ ++#define FMADD(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */ ++ ++ /* Final refinement. */ ++ d = FNMSUB (g, g, b); ++ ++ fesetenv_register (fe); ++ return FMADD (d, h, g); ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_wash (b); ++} +Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +=================================================================== +--- /dev/null ++++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +@@ -0,0 +1,101 @@ ++/* Single-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float threehalf = 1.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the reciprocal square root and use that to compute the actual ++ square root. */ ++ ++#ifdef __STDC__ ++float ++__ieee754_sqrtf (float b) ++#else ++float ++__ieee754_sqrtf (b) ++ float b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++#define FMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ double y, x; ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ relax_fenv_state (); ++ ++ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */ ++ y = FMSUB (threehalf, b, b); ++ ++ /* Initial estimate. */ ++ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b)); ++ ++ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */ ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ ++ /* All done. */ ++ fesetenv_register (fe); ++ return x * b; ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_washf (b); ++} +Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c +=================================================================== +--- /dev/null ++++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c +@@ -0,0 +1,134 @@ ++/* Double-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float two108 = 3.245185536584267269e+32; ++static const float twom54 = 5.551115123125782702e-17; ++static const float half = 0.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the actual square root and half of its reciprocal ++ simultaneously. */ ++ ++#ifdef __STDC__ ++double ++__ieee754_sqrt (double b) ++#else ++double ++__ieee754_sqrt (b) ++ double b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++ double y, g, h, d, r; ++ ieee_double_shape_type u; ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ u.value = b; ++ ++ relax_fenv_state (); ++ ++ __asm__ ("frsqrte %[estimate], %[x]\n" ++ : [estimate] "=f" (y) : [x] "f" (b)); ++ ++ /* Following Muller et al, page 168, equation 5.20. ++ ++ h goes to 1/(2*sqrt(b)) ++ g goes to sqrt(b). ++ ++ We need three iterations to get within 1ulp. */ ++ ++ /* Indicate that these can be performed prior to the branch. GCC ++ insists on sinking them below the branch, however; it seems like ++ they'd be better before the branch so that we can cover any latency ++ from storing the argument and loading its high word. Oh well. */ ++ ++ g = b * y; ++ h = 0.5 * y; ++ ++ /* Handle small numbers by scaling. */ ++ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) ++ return __ieee754_sqrt (b * two108) * twom54; ++ ++#define FMADD(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */ ++ ++ /* Final refinement. */ ++ d = FNMSUB (g, g, b); ++ ++ fesetenv_register (fe); ++ return FMADD (d, h, g); ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_wash (b); ++} +Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c +=================================================================== +--- /dev/null ++++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c +@@ -0,0 +1,101 @@ ++/* Single-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float threehalf = 1.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the reciprocal square root and use that to compute the actual ++ square root. */ ++ ++#ifdef __STDC__ ++float ++__ieee754_sqrtf (float b) ++#else ++float ++__ieee754_sqrtf (b) ++ float b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++#define FMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ double y, x; ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ relax_fenv_state (); ++ ++ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */ ++ y = FMSUB (threehalf, b, b); ++ ++ /* Initial estimate. */ ++ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b)); ++ ++ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */ ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ ++ /* All done. */ ++ fesetenv_register (fe); ++ return x * b; ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_washf (b); ++} +Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c +=================================================================== +--- /dev/null ++++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c +@@ -0,0 +1,134 @@ ++/* Double-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float two108 = 3.245185536584267269e+32; ++static const float twom54 = 5.551115123125782702e-17; ++static const float half = 0.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the actual square root and half of its reciprocal ++ simultaneously. */ ++ ++#ifdef __STDC__ ++double ++__ieee754_sqrt (double b) ++#else ++double ++__ieee754_sqrt (b) ++ double b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++ double y, g, h, d, r; ++ ieee_double_shape_type u; ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ u.value = b; ++ ++ relax_fenv_state (); ++ ++ __asm__ ("frsqrte %[estimate], %[x]\n" ++ : [estimate] "=f" (y) : [x] "f" (b)); ++ ++ /* Following Muller et al, page 168, equation 5.20. ++ ++ h goes to 1/(2*sqrt(b)) ++ g goes to sqrt(b). ++ ++ We need three iterations to get within 1ulp. */ ++ ++ /* Indicate that these can be performed prior to the branch. GCC ++ insists on sinking them below the branch, however; it seems like ++ they'd be better before the branch so that we can cover any latency ++ from storing the argument and loading its high word. Oh well. */ ++ ++ g = b * y; ++ h = 0.5 * y; ++ ++ /* Handle small numbers by scaling. */ ++ if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) ++ return __ieee754_sqrt (b * two108) * twom54; ++ ++#define FMADD(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmadd %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ r = FNMSUB (g, h, half); ++ g = FMADD (g, r, g); ++ h = FMADD (h, r, h); ++ ++ /* g is now +/- 1ulp, or exactly equal to, the square root of b. */ ++ ++ /* Final refinement. */ ++ d = FNMSUB (g, g, b); ++ ++ fesetenv_register (fe); ++ return FMADD (d, h, g); ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_wash (b); ++} +Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c +=================================================================== +--- /dev/null ++++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c +@@ -0,0 +1,101 @@ ++/* Single-precision floating point square root. ++ Copyright (C) 2010 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++static const ieee_float_shape_type a_nan = {.word = 0x7fc00000 }; ++static const ieee_float_shape_type a_inf = {.word = 0x7f800000 }; ++static const float threehalf = 1.5; ++ ++/* The method is based on the descriptions in: ++ ++ _The Handbook of Floating-Pointer Arithmetic_ by Muller et al., chapter 5; ++ _IA-64 and Elementary Functions: Speed and Precision_ by Markstein, chapter 9 ++ ++ We find the reciprocal square root and use that to compute the actual ++ square root. */ ++ ++#ifdef __STDC__ ++float ++__ieee754_sqrtf (float b) ++#else ++float ++__ieee754_sqrtf (b) ++ float b; ++#endif ++{ ++ if (__builtin_expect (b > 0, 1)) ++ { ++#define FMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++#define FNMSUB(a_, c_, b_) \ ++ ({ double __r; \ ++ __asm__ ("fnmsub %[r], %[a], %[c], %[b]\n" \ ++ : [r] "=f" (__r) : [a] "f" (a_), [c] "f" (c_), [b] "f" (b_)); \ ++ __r;}) ++ ++ if (__builtin_expect (b != a_inf.value, 1)) ++ { ++ double y, x; ++ fenv_t fe; ++ ++ fe = fegetenv_register (); ++ ++ relax_fenv_state (); ++ ++ /* Compute y = 1.5 * b - b. Uses fewer constants than y = 0.5 * b. */ ++ y = FMSUB (threehalf, b, b); ++ ++ /* Initial estimate. */ ++ __asm__ ("frsqrte %[x], %[b]\n" : [x] "=f" (x) : [b] "f" (b)); ++ ++ /* Iterate. x_{n+1} = x_n * (1.5 - y * (x_n * x_n)). */ ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ x = x * FNMSUB (y, x * x, threehalf); ++ ++ /* All done. */ ++ fesetenv_register (fe); ++ return x * b; ++ } ++ } ++ else if (b < 0) ++ { ++ /* For some reason, some PowerPC32 processors don't implement ++ FE_INVALID_SQRT. */ ++#ifdef FE_INVALID_SQRT ++ feraiseexcept (FE_INVALID_SQRT); ++ ++ fenv_union_t u = { .fenv = fegetenv_register () }; ++ if ((u.l & FE_INVALID) == 0) ++#endif ++ feraiseexcept (FE_INVALID); ++ b = a_nan.value; ++ } ++ return f_washf (b); ++} +Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies +=================================================================== +--- /dev/null ++++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/603e/fpu/Implies +@@ -0,0 +1 @@ ++powerpc/powerpc32/603e/fpu +Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies +=================================================================== +--- /dev/null ++++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e300c3/fpu/Implies +@@ -0,0 +1,2 @@ ++# e300c3 is a variant of 603e so use the same optimizations for sqrt ++powerpc/powerpc32/603e/fpu +Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies +=================================================================== +--- /dev/null ++++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500mc/fpu/Implies +@@ -0,0 +1 @@ ++powerpc/powerpc32/e500mc/fpu +Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies +=================================================================== +--- /dev/null ++++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e5500/fpu/Implies +@@ -0,0 +1 @@ ++powerpc/powerpc32/e5500/fpu +Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies +=================================================================== +--- /dev/null ++++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/e6500/fpu/Implies +@@ -0,0 +1 @@ ++powerpc/powerpc32/e6500/fpu +Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies +=================================================================== +--- /dev/null ++++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/e5500/fpu/Implies +@@ -0,0 +1 @@ ++powerpc/powerpc64/e5500/fpu +Index: libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies +=================================================================== +--- /dev/null ++++ libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/e6500/fpu/Implies +@@ -0,0 +1 @@ ++powerpc/powerpc64/e6500/fpu diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/grok_gold.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/grok_gold.patch new file mode 100644 index 0000000..d46737a --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/grok_gold.patch @@ -0,0 +1,34 @@ +Make ld --version output matching grok gold's output + +adapted from from upstream branch roland/gold-vs-libc + +Signed-off-by: Khem Raj +Upstream-Status: Backport + + +Index: libc/configure +=================================================================== +--- libc.orig/configure ++++ libc/configure +@@ -4654,7 +4654,7 @@ else + # Found it, now check the version. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking version of $LD" >&5 + $as_echo_n "checking version of $LD... " >&6; } +- ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'` ++ ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU [Bbinutilsd][^.]* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'` + case $ac_prog_version in + '') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;; + 2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*) +Index: libc/configure.ac +=================================================================== +--- libc.orig/configure.ac ++++ libc/configure.ac +@@ -990,7 +990,7 @@ AC_CHECK_PROG_VER(AS, $AS, --version, + [GNU assembler.* \([0-9]*\.[0-9.]*\)], + [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as") + AC_CHECK_PROG_VER(LD, $LD, --version, +- [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)], ++ [GNU [Bbinutilsd][^.]* \([0-9][0-9]*\.[0-9.]*\)], + [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld") + + # These programs are version sensitive. diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/initgroups_keys.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/initgroups_keys.patch new file mode 100644 index 0000000..be29856 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/initgroups_keys.patch @@ -0,0 +1,20 @@ +This is needed since initgroups belongs to NET group +so when NET is disabled in eglibc build then it reports +as undefined symbol + +Signed-off-by: Khem Raj +Upstream-Status: Pending + +Index: libc/nss/getent.c +=================================================================== +--- libc.orig/nss/getent.c 2012-03-09 09:41:57.099581559 -0800 ++++ libc/nss/getent.c 2012-03-09 09:42:13.095582334 -0800 +@@ -898,7 +898,7 @@ + D(group) + D(gshadow) + DN(hosts) +-D(initgroups) ++DN(initgroups) + DN(netgroup) + DN(networks) + D(passwd) diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/ld-search-order.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/ld-search-order.patch new file mode 100644 index 0000000..e83a0ad --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/ld-search-order.patch @@ -0,0 +1,56 @@ +Upstream-Status: Inappropriate [embedded specific] + +The default lib search path order is: + + 1) LD_LIBRARY_PATH + 2) RPATH from the binary + 3) ld.so.cache + 4) default search paths embedded in the linker + +For nativesdk binaries which are being used alongside binaries on a host system, we +need the search paths to firstly search the shipped nativesdk libs but then also +cover the host system. For example we want the host system's libGL and this may be +in a non-standard location like /usr/lib/mesa. The only place the location is know +about is in the ld.so.cache of the host system. + +Since nativesdk has a simple structure and doesn't need to use a cache itself, we +repurpose the cache for use as a last resort in finding host system binaries. This +means we need to switch the order of 3 and 4 above to make this work effectively. + +RP 14/10/2010 + +Index: libc/elf/dl-load.c +=================================================================== +--- libc.orig/elf/dl-load.c 2012-12-02 13:11:45.000000000 -0800 ++++ libc/elf/dl-load.c 2013-01-09 07:00:59.135223084 -0800 +@@ -2215,7 +2215,14 @@ + fd = open_path (name, namelen, mode & __RTLD_SECURE, + &loader->l_runpath_dirs, &realname, &fb, loader, + LA_SER_RUNPATH, &found_other_class); +- ++ /* try the default path. */ ++ if (fd == -1 ++ && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL ++ || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1)) ++ && rtld_search_dirs.dirs != (void *) -1) ++ fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs, ++ &realname, &fb, l, LA_SER_DEFAULT, &found_other_class); ++ /* Finally try ld.so.cache */ + #ifdef USE_LDCONFIG + if (fd == -1 + && (__builtin_expect (! (mode & __RTLD_SECURE), 1) +@@ -2283,14 +2290,6 @@ + } + #endif + +- /* Finally, try the default path. */ +- if (fd == -1 +- && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL +- || __builtin_expect (!(l->l_flags_1 & DF_1_NODEFLIB), 1)) +- && rtld_search_dirs.dirs != (void *) -1) +- fd = open_path (name, namelen, mode & __RTLD_SECURE, &rtld_search_dirs, +- &realname, &fb, l, LA_SER_DEFAULT, &found_other_class); +- + /* Add another newline when we are tracing the library loading. */ + if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)) + _dl_debug_printf ("\n"); diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/mips-rld-map-check.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/mips-rld-map-check.patch new file mode 100644 index 0000000..9b646fe --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/mips-rld-map-check.patch @@ -0,0 +1,26 @@ + +On mips target, binutils currently sets DT_MIPS_RLD_MAP to 0 in dynamic +section if a --version-script sets _RLD_MAP to local. This is apparently +a binutils bug, but libc shouldn't segfault in this case. + +see also: http://sourceware.org/bugilla/show_bug.cgi?id=11615 + +Upstream-Status: Pending + +9/19/2010 - added by Qing He + + +--- +diff -ru glibc-2.10.1.orig/ports/sysdeps/mips/dl-machine.h glibc-2.10.1/ports/sysdeps/mips/dl-machine.h +--- glibc-2.10.1.orig/ports/sysdeps/mips/dl-machine.h 2009-05-16 16:36:20.000000000 +0800 ++++ glibc-2.10.1/ports/sysdeps/mips/dl-machine.h 2010-09-19 09:11:53.000000000 +0800 +@@ -70,7 +70,8 @@ + /* If there is a DT_MIPS_RLD_MAP entry in the dynamic section, fill it in + with the run-time address of the r_debug structure */ + #define ELF_MACHINE_DEBUG_SETUP(l,r) \ +-do { if ((l)->l_info[DT_MIPS (RLD_MAP)]) \ ++do { if ((l)->l_info[DT_MIPS (RLD_MAP)] && \ ++ (l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) \ + *(ElfW(Addr) *)((l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = \ + (ElfW(Addr)) (r); \ + } while (0) diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/multilib_readlib.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/multilib_readlib.patch new file mode 100644 index 0000000..1542b1b --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/multilib_readlib.patch @@ -0,0 +1,17 @@ +Upstream-Status: Inappropriate [embedded specific] + +Replace the OECORE_KNOWN_INTERPRETER_NAMES with the value of +variable EGLIBC_KNOWN_INTERPRETER_NAMES. + +Lianhao Lu, 08/01/2011 + +--- libc/elf/readlib.c.orig 2011-08-12 17:05:51.864470837 +0800 ++++ libc/elf/readlib.c 2011-08-12 17:06:39.346942074 +0800 +@@ -52,6 +52,7 @@ + #ifdef SYSDEP_KNOWN_INTERPRETER_NAMES + SYSDEP_KNOWN_INTERPRETER_NAMES + #endif ++ OECORE_KNOWN_INTERPRETER_NAMES + }; + + static struct known_names known_libs[] = diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/ppc-sqrt_finite.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/ppc-sqrt_finite.patch new file mode 100644 index 0000000..6ea666b --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/ppc-sqrt_finite.patch @@ -0,0 +1,184 @@ +on ppc fixes the errors like below +| ./.libs/libpulsecore-1.1.so: undefined reference to `__sqrt_finite' +| collect2: ld returned 1 exit status + +Upstream-Status: Pending + +ChangeLog + +2012-01-06 Khem Raj + + * sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c: Add __*_finite alias. + Remove cruft. + * sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c: Ditto. + * sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c: Ditto. + * sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c: Ditto. + +Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c ++++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c +@@ -39,14 +39,8 @@ static const float half = 0.5; + We find the actual square root and half of its reciprocal + simultaneously. */ + +-#ifdef __STDC__ + double + __ieee754_sqrt (double b) +-#else +-double +-__ieee754_sqrt (b) +- double b; +-#endif + { + if (__builtin_expect (b > 0, 1)) + { +@@ -132,3 +126,4 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++strong_alias (__ieee754_sqrt, __sqrt_finite) +Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c ++++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c +@@ -37,14 +37,8 @@ static const float threehalf = 1.5; + We find the reciprocal square root and use that to compute the actual + square root. */ + +-#ifdef __STDC__ + float + __ieee754_sqrtf (float b) +-#else +-float +-__ieee754_sqrtf (b) +- float b; +-#endif + { + if (__builtin_expect (b > 0, 1)) + { +@@ -99,3 +93,4 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++strong_alias (__ieee754_sqrtf, __sqrtf_finite) +Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c ++++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c +@@ -39,14 +39,8 @@ static const float half = 0.5; + We find the actual square root and half of its reciprocal + simultaneously. */ + +-#ifdef __STDC__ + double + __ieee754_sqrt (double b) +-#else +-double +-__ieee754_sqrt (b) +- double b; +-#endif + { + if (__builtin_expect (b > 0, 1)) + { +@@ -132,3 +126,4 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++strong_alias (__ieee754_sqrt, __sqrt_finite) +Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c ++++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c +@@ -37,14 +37,8 @@ static const float threehalf = 1.5; + We find the reciprocal square root and use that to compute the actual + square root. */ + +-#ifdef __STDC__ + float + __ieee754_sqrtf (float b) +-#else +-float +-__ieee754_sqrtf (b) +- float b; +-#endif + { + if (__builtin_expect (b > 0, 1)) + { +@@ -99,3 +93,4 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++strong_alias (__ieee754_sqrtf, __sqrtf_finite) +Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c ++++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c +@@ -132,3 +132,4 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++strong_alias (__ieee754_sqrt, __sqrt_finite) +Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c ++++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c +@@ -99,3 +99,4 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++strong_alias (__ieee754_sqrtf, __sqrtf_finite) +Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c ++++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c +@@ -132,3 +132,4 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++strong_alias (__ieee754_sqrt, __sqrt_finite) +Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c ++++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c +@@ -99,3 +99,4 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++strong_alias (__ieee754_sqrtf, __sqrtf_finite) +Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c ++++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c +@@ -132,3 +132,4 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++strong_alias (__ieee754_sqrt, __sqrt_finite) +Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c ++++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c +@@ -99,3 +99,4 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++strong_alias (__ieee754_sqrtf, __sqrtf_finite) +Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c ++++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +@@ -132,3 +132,4 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++strong_alias (__ieee754_sqrt, __sqrt_finite) +Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c ++++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +@@ -99,3 +99,4 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++strong_alias (__ieee754_sqrtf, __sqrtf_finite) diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/ppc_slow_ieee754_sqrt.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/ppc_slow_ieee754_sqrt.patch new file mode 100644 index 0000000..60532cb --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/ppc_slow_ieee754_sqrt.patch @@ -0,0 +1,365 @@ + __ieee754_sqrt{,f} are now inline functions and call out __slow versions + + +Signed-off-by: Khem Raj +Upstream-Status: Pending +Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c ++++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrt.c +@@ -40,7 +40,7 @@ static const float half = 0.5; + simultaneously. */ + + double +-__ieee754_sqrt (double b) ++__slow_ieee754_sqrt (double b) + { + if (__builtin_expect (b > 0, 1)) + { +@@ -77,7 +77,7 @@ __ieee754_sqrt (double b) + + /* Handle small numbers by scaling. */ + if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) +- return __ieee754_sqrt (b * two108) * twom54; ++ return __slow_ieee754_sqrt (b * two108) * twom54; + + #define FMADD(a_, c_, b_) \ + ({ double __r; \ +@@ -126,4 +126,12 @@ __ieee754_sqrt (double b) + } + return f_wash (b); + } ++ ++#undef __ieee754_sqrt ++double ++__ieee754_sqrt (double x) ++{ ++ return __slow_ieee754_sqrt (x); ++} ++ + strong_alias (__ieee754_sqrt, __sqrt_finite) +Index: libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c ++++ libc/sysdeps/powerpc/powerpc32/603e/fpu/e_sqrtf.c +@@ -38,7 +38,7 @@ static const float threehalf = 1.5; + square root. */ + + float +-__ieee754_sqrtf (float b) ++__slow_ieee754_sqrtf (float b) + { + if (__builtin_expect (b > 0, 1)) + { +@@ -93,4 +93,10 @@ __ieee754_sqrtf (float b) + } + return f_washf (b); + } ++#undef __ieee754_sqrtf ++float ++__ieee754_sqrtf (float x) ++{ ++ return __slow_ieee754_sqrtf (x); ++} + strong_alias (__ieee754_sqrtf, __sqrtf_finite) +Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c ++++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrt.c +@@ -40,7 +40,7 @@ static const float half = 0.5; + simultaneously. */ + + double +-__ieee754_sqrt (double b) ++__slow_ieee754_sqrt (double b) + { + if (__builtin_expect (b > 0, 1)) + { +@@ -77,7 +77,7 @@ __ieee754_sqrt (double b) + + /* Handle small numbers by scaling. */ + if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) +- return __ieee754_sqrt (b * two108) * twom54; ++ return __slow_ieee754_sqrt (b * two108) * twom54; + + #define FMADD(a_, c_, b_) \ + ({ double __r; \ +@@ -126,4 +126,12 @@ __ieee754_sqrt (double b) + } + return f_wash (b); + } ++ ++#undef __ieee754_sqrt ++double ++__ieee754_sqrt (double x) ++{ ++ return __slow_ieee754_sqrt (x); ++} ++ + strong_alias (__ieee754_sqrt, __sqrt_finite) +Index: libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c ++++ libc/sysdeps/powerpc/powerpc64/e5500/fpu/e_sqrtf.c +@@ -38,7 +38,7 @@ static const float threehalf = 1.5; + square root. */ + + float +-__ieee754_sqrtf (float b) ++__slow_ieee754_sqrtf (float b) + { + if (__builtin_expect (b > 0, 1)) + { +@@ -93,4 +93,11 @@ __ieee754_sqrtf (float b) + } + return f_washf (b); + } ++#undef __ieee754_sqrtf ++float ++__ieee754_sqrtf (float x) ++{ ++ return __slow_ieee754_sqrtf (x); ++} ++ + strong_alias (__ieee754_sqrtf, __sqrtf_finite) +Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c ++++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrt.c +@@ -41,10 +41,10 @@ static const float half = 0.5; + + #ifdef __STDC__ + double +-__ieee754_sqrt (double b) ++__slow_ieee754_sqrt (double b) + #else + double +-__ieee754_sqrt (b) ++__slow_ieee754_sqrt (b) + double b; + #endif + { +@@ -83,7 +83,7 @@ __ieee754_sqrt (b) + + /* Handle small numbers by scaling. */ + if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) +- return __ieee754_sqrt (b * two108) * twom54; ++ return __slow_ieee754_sqrt (b * two108) * twom54; + + #define FMADD(a_, c_, b_) \ + ({ double __r; \ +@@ -132,4 +132,12 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++ ++#undef __ieee754_sqrt ++double ++__ieee754_sqrt (double x) ++{ ++ return __slow_ieee754_sqrt (x); ++} ++ + strong_alias (__ieee754_sqrt, __sqrt_finite) +Index: libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c ++++ libc/sysdeps/powerpc/powerpc64/e6500/fpu/e_sqrtf.c +@@ -39,10 +39,10 @@ static const float threehalf = 1.5; + + #ifdef __STDC__ + float +-__ieee754_sqrtf (float b) ++__slow_ieee754_sqrtf (float b) + #else + float +-__ieee754_sqrtf (b) ++__slow_ieee754_sqrtf (b) + float b; + #endif + { +@@ -99,4 +99,12 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++ ++#undef __ieee754_sqrtf ++float ++__ieee754_sqrtf (float x) ++{ ++ return __slow_ieee754_sqrtf (x); ++} ++ + strong_alias (__ieee754_sqrtf, __sqrtf_finite) +Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c ++++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrt.c +@@ -41,10 +41,10 @@ static const float half = 0.5; + + #ifdef __STDC__ + double +-__ieee754_sqrt (double b) ++__slow_ieee754_sqrt (double b) + #else + double +-__ieee754_sqrt (b) ++__slow_ieee754_sqrt (b) + double b; + #endif + { +@@ -83,7 +83,7 @@ __ieee754_sqrt (b) + + /* Handle small numbers by scaling. */ + if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) +- return __ieee754_sqrt (b * two108) * twom54; ++ return __slow_ieee754_sqrt (b * two108) * twom54; + + #define FMADD(a_, c_, b_) \ + ({ double __r; \ +@@ -132,4 +132,12 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++ ++#undef __ieee754_sqrt ++double ++__ieee754_sqrt (double x) ++{ ++ return __slow_ieee754_sqrt (x); ++} ++ + strong_alias (__ieee754_sqrt, __sqrt_finite) +Index: libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c ++++ libc/sysdeps/powerpc/powerpc32/e500mc/fpu/e_sqrtf.c +@@ -39,10 +39,10 @@ static const float threehalf = 1.5; + + #ifdef __STDC__ + float +-__ieee754_sqrtf (float b) ++__slow_ieee754_sqrtf (float b) + #else + float +-__ieee754_sqrtf (b) ++__slow_ieee754_sqrtf (b) + float b; + #endif + { +@@ -99,4 +99,12 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++ ++#undef __ieee754_sqrtf ++float ++__ieee754_sqrtf (float x) ++{ ++ return __slow_ieee754_sqrtf (x); ++} ++ + strong_alias (__ieee754_sqrtf, __sqrtf_finite) +Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c ++++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrt.c +@@ -41,10 +41,10 @@ static const float half = 0.5; + + #ifdef __STDC__ + double +-__ieee754_sqrt (double b) ++__slow_ieee754_sqrt (double b) + #else + double +-__ieee754_sqrt (b) ++__slow_ieee754_sqrt (b) + double b; + #endif + { +@@ -83,7 +83,7 @@ __ieee754_sqrt (b) + + /* Handle small numbers by scaling. */ + if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) +- return __ieee754_sqrt (b * two108) * twom54; ++ return __slow_ieee754_sqrt (b * two108) * twom54; + + #define FMADD(a_, c_, b_) \ + ({ double __r; \ +@@ -132,4 +132,12 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++ ++#undef __ieee754_sqrt ++double ++__ieee754_sqrt (double x) ++{ ++ return __slow_ieee754_sqrt (x); ++} ++ + strong_alias (__ieee754_sqrt, __sqrt_finite) +Index: libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c ++++ libc/sysdeps/powerpc/powerpc32/e5500/fpu/e_sqrtf.c +@@ -39,10 +39,10 @@ static const float threehalf = 1.5; + + #ifdef __STDC__ + float +-__ieee754_sqrtf (float b) ++__slow_ieee754_sqrtf (float b) + #else + float +-__ieee754_sqrtf (b) ++__slow_ieee754_sqrtf (b) + float b; + #endif + { +@@ -99,4 +99,12 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++ ++#undef __ieee754_sqrtf ++float ++__ieee754_sqrtf (float x) ++{ ++ return __slow_ieee754_sqrtf (x); ++} ++ + strong_alias (__ieee754_sqrtf, __sqrtf_finite) +Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c ++++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +@@ -132,4 +132,12 @@ __ieee754_sqrt (b) + } + return f_wash (b); + } ++ ++#undef __ieee754_sqrt ++double ++__ieee754_sqrt (double x) ++{ ++ return __slow_ieee754_sqrt (x); ++} ++ + strong_alias (__ieee754_sqrt, __sqrt_finite) +Index: libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +=================================================================== +--- libc.orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c ++++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +@@ -99,4 +99,12 @@ __ieee754_sqrtf (b) + } + return f_washf (b); + } ++ ++#undef __ieee754_sqrtf ++float ++__ieee754_sqrtf (float x) ++{ ++ return __slow_ieee754_sqrtf (x); ++} ++ + strong_alias (__ieee754_sqrtf, __sqrtf_finite) diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/ppce6500-32b_slow_ieee754_sqrt.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/ppce6500-32b_slow_ieee754_sqrt.patch new file mode 100644 index 0000000..4c6c107 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/ppce6500-32b_slow_ieee754_sqrt.patch @@ -0,0 +1,47 @@ + __ieee754_sqrt{,f} are now inline functions and call out __slow versions + + +Signed-off-by: chunrong guo +Upstream-Status: Pending + +diff -rNu libc-orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c +--- libc-orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-04-08 04:39:58.487229887 -0500 ++++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrt.c 2014-04-08 04:40:52.643069198 -0500 +@@ -41,10 +41,10 @@ + + #ifdef __STDC__ + double +-__ieee754_sqrt (double b) ++__slow_ieee754_sqrt (double b) + #else + double +-__ieee754_sqrt (b) ++__slow_ieee754_sqrt (b) + double b; + #endif + { +@@ -83,7 +83,7 @@ + + /* Handle small numbers by scaling. */ + if (__builtin_expect ((u.parts.msw & 0x7ff00000) <= 0x02000000, 0)) +- return __ieee754_sqrt (b * two108) * twom54; ++ return __slow_ieee754_sqrt (b * two108) * twom54; + + #define FMADD(a_, c_, b_) \ + ({ double __r; \ +diff -rNu libc-orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c +--- libc-orig/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-04-08 04:39:58.487229887 -0500 ++++ libc/sysdeps/powerpc/powerpc32/e6500/fpu/e_sqrtf.c 2014-04-08 04:41:26.017067682 -0500 +@@ -39,10 +39,10 @@ + + #ifdef __STDC__ + float +-__ieee754_sqrtf (float b) ++__slow_ieee754_sqrtf (float b) + #else + float +-__ieee754_sqrtf (b) ++__slow_ieee754_sqrtf (b) + float b; + #endif + { diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/relocatable_sdk.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/relocatable_sdk.patch new file mode 100644 index 0000000..ca5f17b --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/relocatable_sdk.patch @@ -0,0 +1,108 @@ +Upstream-Status: Inappropriate [SDK specific] + +This patch puts the dynamic loader path in the binaries, SYSTEM_DIRS strings +and lengths as well as ld.so.cache path in the dynamic loader to specific +sections in memory. The sections that contain paths have been allocated a 4096 +byte section, which is the maximum path length in linux. This will allow the +relocating script to parse the ELF binary, detect the section and easily replace +the strings in a certain path. + +Signed-off-by: Laurentiu Palcu + +Index: libc/elf/interp.c +=================================================================== +--- libc.orig/elf/interp.c ++++ libc/elf/interp.c +@@ -16,5 +16,5 @@ + License along with the GNU C Library; if not, see + . */ + +-const char __invoke_dynamic_linker__[] __attribute__ ((section (".interp"))) ++const char __invoke_dynamic_linker__[4096] __attribute__ ((section (".interp"))) + = RUNTIME_LINKER; +Index: libc/elf/dl-load.c +=================================================================== +--- libc.orig/elf/dl-load.c ++++ libc/elf/dl-load.c +@@ -144,8 +144,8 @@ static size_t max_capstrlen attribute_re + /* Get the generated information about the trusted directories. */ + #include "trusted-dirs.h" + +-static const char system_dirs[] = SYSTEM_DIRS; +-static const size_t system_dirs_len[] = ++static const char system_dirs[4096] __attribute__ ((section (".sysdirs"))) = SYSTEM_DIRS; ++volatile static const size_t system_dirs_len[] __attribute__ ((section (".sysdirslen"))) = + { + SYSTEM_DIRS_LEN + }; +Index: libc/elf/dl-cache.c +=================================================================== +--- libc.orig/elf/dl-cache.c ++++ libc/elf/dl-cache.c +@@ -133,6 +133,10 @@ do \ + while (0) + + ++const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))) = ++ SYSCONFDIR "/ld.so.cache"; ++ ++ + int + internal_function + _dl_cache_libcmp (const char *p1, const char *p2) +Index: libc/elf/ldconfig.c +=================================================================== +--- libc.orig/elf/ldconfig.c ++++ libc/elf/ldconfig.c +@@ -166,6 +166,9 @@ static struct argp argp = + options, parse_opt, NULL, doc, NULL, more_help, NULL + }; + ++ ++extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))); ++ + /* Check if string corresponds to an important hardware capability or + a platform. */ + static int +Index: libc/sysdeps/generic/dl-cache.h +=================================================================== +--- libc.orig/sysdeps/generic/dl-cache.h ++++ libc/sysdeps/generic/dl-cache.h +@@ -27,10 +27,6 @@ + ((flags) == 1 || (flags) == _DL_CACHE_DEFAULT_ID) + #endif + +-#ifndef LD_SO_CACHE +-# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache" +-#endif +- + #ifndef add_system_dir + # define add_system_dir(dir) add_dir (dir) + #endif +Index: libc/elf/rtld.c +=================================================================== +--- libc.orig/elf/rtld.c ++++ libc/elf/rtld.c +@@ -99,6 +99,7 @@ uintptr_t __pointer_chk_guard_local + strong_alias (__pointer_chk_guard_local, __pointer_chk_guard) + #endif + ++extern const char LD_SO_CACHE[4096] __attribute__ ((section (".ldsocache"))); + + /* List of auditing DSOs. */ + static struct audit_list +@@ -1031,12 +1032,12 @@ of this helper program; chances are you + --list list all dependencies and how they are resolved\n\ + --verify verify that given object really is a dynamically linked\n\ + object we can handle\n\ +- --inhibit-cache Do not use " LD_SO_CACHE "\n\ ++ --inhibit-cache Do not use %s\n\ + --library-path PATH use given PATH instead of content of the environment\n\ + variable LD_LIBRARY_PATH\n\ + --inhibit-rpath LIST ignore RUNPATH and RPATH information in object names\n\ + in LIST\n\ +- --audit LIST use objects named in LIST as auditors\n"); ++ --audit LIST use objects named in LIST as auditors\n", LD_SO_CACHE); + + ++_dl_skip_args; + --_dl_argc; diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-2.19/relocatable_sdk_fix_openpath.patch b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/relocatable_sdk_fix_openpath.patch new file mode 100644 index 0000000..f164f8f --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-2.19/relocatable_sdk_fix_openpath.patch @@ -0,0 +1,41 @@ +Upstream-Status: Inappropriate [SDK specific] + +eglibc-nativesdk: Fix buffer overrun with a relocated SDK + +When ld-linux-*.so.2 is relocated to a path that is longer than the +original fixed location, the dynamic loader will crash in open_path +because it implicitly assumes that max_dirnamelen is a fixed size that +never changes. + +The allocated buffer will not be large enough to contain the directory +path string which is larger than the fixed location provided at build +time. + +Signed-off-by: Jason Wessel + +--- + elf/dl-load.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +--- a/elf/dl-load.c ++++ b/elf/dl-load.c +@@ -1919,7 +1919,19 @@ open_path (const char *name, size_t name + given on the command line when rtld is run directly. */ + return -1; + ++ do ++ { ++ struct r_search_path_elem *this_dir = *dirs; ++ if (this_dir->dirnamelen > max_dirnamelen) ++ { ++ max_dirnamelen = this_dir->dirnamelen; ++ } ++ } ++ while (*++dirs != NULL); ++ + buf = alloca (max_dirnamelen + max_capstrlen + namelen); ++ ++ dirs = sps->dirs; + do + { + struct r_search_path_elem *this_dir = *dirs; diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-collateral.inc b/meta-aspeed/recipes-core/eglibc/eglibc-collateral.inc new file mode 100644 index 0000000..8feca09 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-collateral.inc @@ -0,0 +1,12 @@ +INHIBIT_DEFAULT_DEPS = "1" +LICENSE = "GPLv2 & LGPLv2.1" +HOMEPAGE = "http://www.eglibc.org/" + +do_fetch[noexec] = "1" +do_unpack[noexec] = "1" +do_patch[noexec] = "1" +do_configure[noexec] = "1" +do_compile[noexec] = "1" + +do_install[depends] += "virtual/${MLPREFIX}libc:do_populate_sysroot" + diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-common.inc b/meta-aspeed/recipes-core/eglibc/eglibc-common.inc new file mode 100644 index 0000000..d18786a --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-common.inc @@ -0,0 +1,9 @@ +SUMMARY = "Embedded GLIBC (GNU C Library)" +DESCRIPTION = "Embedded GLIBC (EGLIBC) is a variant of the GNU C Library (GLIBC) that is designed to work well on embedded systems. EGLIBC strives to be source and binary compatible with GLIBC. EGLIBC's goals include reduced footprint, configurable components, better support for cross-compilation and cross-testing." +HOMEPAGE = "http://www.eglibc.org/home" +SECTION = "libs" +LICENSE = "GPLv2 & LGPLv2.1" +LIC_FILES_CHKSUM ?= "file://LICENSES;md5=07a394b26e0902b9ffdec03765209770 \ + file://COPYING;md5=393a5ca445f6965873eca0259a17f833 \ + file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ + file://COPYING.LIB;md5=bbb461211a33b134d42ed5ee802b37ff " diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-initial.inc b/meta-aspeed/recipes-core/eglibc/eglibc-initial.inc new file mode 100644 index 0000000..39d553e --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-initial.inc @@ -0,0 +1,78 @@ +DEPENDS = "linux-libc-headers virtual/${TARGET_PREFIX}gcc-initial" +PROVIDES = "virtual/${TARGET_PREFIX}libc-initial" + +PACKAGES = "" +PACKAGES_DYNAMIC = "" + +STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}" +STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}" +TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TARGET}" + +do_configure () { + sed -ie 's,{ (exit 1); exit 1; }; },{ (exit 0); }; },g' ${S}/configure + chmod +x ${S}/configure + (cd ${S} && gnu-configize) || die "failure in running gnu-configize" + find ${S} -name "configure" | xargs touch + ${S}/configure --host=${TARGET_SYS} --build=${BUILD_SYS} \ + --prefix=/usr \ + --without-cvs --disable-sanity-checks \ + --with-headers=${STAGING_DIR_TARGET}${includedir} \ + --with-kconfig=${STAGING_BINDIR_NATIVE} \ + --enable-hacker-mode --enable-addons +} + +do_compile () { + : +} + +do_install () { + oe_runmake cross-compiling=yes install_root=${D} \ + includedir='${includedir}' prefix='${prefix}' \ + install-bootstrap-headers=yes install-headers + + oe_runmake csu/subdir_lib + mkdir -p ${D}${libdir}/ + install -m 644 csu/crt[1in].o ${D}${libdir} + + # Two headers -- stubs.h and features.h -- aren't installed by install-headers, + # so do them by hand. We can tolerate an empty stubs.h for the moment. + # See e.g. http://gcc.gnu.org/ml/gcc/2002-01/msg00900.html + mkdir -p ${D}${includedir}/gnu/ + touch ${D}${includedir}/gnu/stubs.h + cp ${S}/include/features.h ${D}${includedir}/features.h + + if [ -e ${B}/bits/stdio_lim.h ]; then + cp ${B}/bits/stdio_lim.h ${D}${includedir}/bits/ + fi + # add links to linux-libc-headers: final eglibc build need this. + for t in linux asm asm-generic; do + ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${D}${includedir}/ + done +} + +do_install_locale() { + : +} + +do_siteconfig () { + : +} + +SSTATEPOSTINSTFUNCS += "eglibcinitial_sstate_postinst" +eglibcinitial_sstate_postinst() { + if [ "${BB_CURRENTTASK}" = "populate_sysroot" -o "${BB_CURRENTTASK}" = "populate_sysroot_setscene" ] + then + # Recreate the symlinks to ensure they point to the correct location + for t in linux asm asm-generic; do + rm -f ${STAGING_DIR_TCBOOTSTRAP}${includedir}/$t + ln -s ${STAGING_DIR_TARGET}${includedir}/$t ${STAGING_DIR_TCBOOTSTRAP}${includedir}/ + done + fi +} + +do_populate_sysroot[sstate-outputdirs] = "${STAGING_DIR_TCBOOTSTRAP}/" + +# We don't install any scripts so there is nothing to evacuate +do_evacuate_scripts () { + : +} diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-initial_2.19.bb b/meta-aspeed/recipes-core/eglibc/eglibc-initial_2.19.bb new file mode 100644 index 0000000..de45079 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-initial_2.19.bb @@ -0,0 +1,11 @@ +require eglibc_${PV}.bb +require eglibc-initial.inc + +DEPENDS += "kconfig-frontends-native" + +# main eglibc recipes muck with TARGET_CPPFLAGS to point into +# final target sysroot but we +# are not there when building eglibc-initial +# so reset it here + +TARGET_CPPFLAGS = "" diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-ld.inc b/meta-aspeed/recipes-core/eglibc/eglibc-ld.inc new file mode 100644 index 0000000..6261ae3 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-ld.inc @@ -0,0 +1,56 @@ +def ld_append_if_tune_exists(d, infos, dict): + tune = d.getVar("DEFAULTTUNE", True) or "" + libdir = d.getVar("base_libdir", True) or "" + if tune in dict: + infos['ldconfig'].add('{"' + libdir + '/' + dict[tune][0] + '",' + dict[tune][1] + ' }') + infos['lddrewrite'].add(libdir+'/'+dict[tune][0]) + +def eglibc_dl_info(d): + ld_info_all = { + "mips": ["ld.so.1", "FLAG_ELF_LIBC6"], + "mips64-n32": ["ld.so.1", "FLAG_ELF_LIBC6"], + "mips64": ["ld.so.1", "FLAG_ELF_LIBC6"], + "mipsel": ["ld.so.1", "FLAG_ELF_LIBC6"], + "mips64el-n32": ["ld.so.1", "FLAG_ELF_LIBC6"], + "mips64el": ["ld.so.1", "FLAG_ELF_LIBC6"], + "mips-nf": ["ld.so.1", "FLAG_ELF_LIBC6"], + "mips64-nf-n32": ["ld.so.1", "FLAG_ELF_LIBC6"], + "mips64-nf": ["ld.so.1", "FLAG_ELF_LIBC6"], + "mips64el-nf-n32": ["ld.so.1", "FLAG_ELF_LIBC6"], + "mips64el-nf": ["ld.so.1", "FLAG_ELF_LIBC6"], + "powerpc": ["ld.so.1", "FLAG_ELF_LIBC6"], + "powerpc-nf": ["ld.so.1", "FLAG_ELF_LIBC6"], + "powerpc64": ["ld64.so.1", "FLAG_ELF_LIBC6"], + "powerpc64-nf": ["ld64.so.1", "FLAG_ELF_LIBC6"], + "core2-32": ["ld-linux.so.2", "FLAG_ELF_LIBC6"], + "core2-64": ["ld-linux-x86-64.so.2", "FLAG_ELF_LIBC6"], + "x86": ["ld-linux.so.2", "FLAG_ELF_LIBC6"], + "x86-64": ["ld-linux-x86-64.so.2", "FLAG_ELF_LIBC6"], + "i586": ["ld-linux.so.2", "FLAG_ELF_LIBC6"], + "corei7-32": ["ld-linux.so.2", "FLAG_ELF_LIBC6"], + "corei7-64": ["ld-linux-x86-64.so.2", "FLAG_ELF_LIBC6"], + } + + infos = {'ldconfig':set(), 'lddrewrite':set()} + ld_append_if_tune_exists(d, infos, ld_info_all) + + #DEFAULTTUNE_MULTILIB_ORIGINAL + original_tune=d.getVar("DEFAULTTUNE_MULTILIB_ORIGINAL",True) + if original_tune: + localdata = bb.data.createCopy(d) + localdata.setVar("DEFAULTTUNE", original_tune) + ld_append_if_tune_exists(localdata, infos, ld_info_all) + + variants = d.getVar("MULTILIB_VARIANTS", True) or "" + for item in variants.split(): + localdata = bb.data.createCopy(d) + overrides = localdata.getVar("OVERRIDES", False) + ":virtclass-multilib-" + item + localdata.setVar("OVERRIDES", overrides) + bb.data.update_data(localdata) + ld_append_if_tune_exists(localdata, infos, ld_info_all) + infos['ldconfig'] = ','.join(infos['ldconfig']) + infos['lddrewrite'] = ' '.join(infos['lddrewrite']) + return infos + +EGLIBC_KNOWN_INTERPRETER_NAMES = "${@eglibc_dl_info(d)['ldconfig']}" +RTLDLIST = "${@eglibc_dl_info(d)['lddrewrite']}" diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-locale.inc b/meta-aspeed/recipes-core/eglibc/eglibc-locale.inc new file mode 100644 index 0000000..4da5abd --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-locale.inc @@ -0,0 +1,96 @@ +include eglibc-collateral.inc + +SUMMARY = "Locale data from eglibc" + +BPN = "eglibc" +LOCALEBASEPN = "${MLPREFIX}eglibc" + +# eglibc-collateral.inc inhibits all default deps, but do_package needs objcopy +# ERROR: objcopy failed with exit code 127 (cmd was 'i586-webos-linux-objcopy' --only-keep-debug 'eglibc-locale/2.17-r0/package/usr/lib/gconv/IBM1166.so' 'eglibc-locale/2.17-r0/package/usr/lib/gconv/.debug/IBM1166.so') +# ERROR: Function failed: split_and_strip_files +BINUTILSDEP = "virtual/${MLPREFIX}${TARGET_PREFIX}binutils:do_populate_sysroot" +BINUTILSDEP_class-nativesdk = "virtual/${TARGET_PREFIX}binutils-crosssdk:do_populate_sysroot" +do_package[depends] += "${BINUTILSDEP}" + +# Binary locales are generated at build time if ENABLE_BINARY_LOCALE_GENERATION +# is set. The idea is to avoid running localedef on the target (at first boot) +# to decrease initial boot time and avoid localedef being killed by the OOM +# killer which used to effectively break i18n on machines with < 128MB RAM. + +# default to disabled +ENABLE_BINARY_LOCALE_GENERATION ?= "0" +ENABLE_BINARY_LOCALE_GENERATION_pn-nativesdk-eglibc-locale = "0" + +#enable locale generation on these arches +# BINARY_LOCALE_ARCHES is a space separated list of regular expressions +BINARY_LOCALE_ARCHES ?= "arm.* i[3-6]86 x86_64 powerpc mips mips64" + +# set "1" to use cross-localedef for locale generation +# set "0" for qemu emulation of native localedef for locale generation +LOCALE_GENERATION_WITH_CROSS-LOCALEDEF = "1" + +PROVIDES = "virtual/libc-locale" + +PACKAGES = "localedef ${PN}-dbg" + +PACKAGES_DYNAMIC = "^locale-base-.* \ + ^eglibc-gconv-.* ^eglibc-charmap-.* ^eglibc-localedata-.* ^eglibc-binary-localedata-.* \ + ^glibc-gconv-.* ^glibc-charmap-.* ^glibc-localedata-.* ^glibc-binary-localedata-.* \ + ^${MLPREFIX}eglibc-gconv$" + +# Create a eglibc-binaries package +ALLOW_EMPTY_${BPN}-binaries = "1" +PACKAGES += "${BPN}-binaries" +RRECOMMENDS_${BPN}-binaries = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("eglibc-binary") != -1])}" + +# Create a eglibc-charmaps package +ALLOW_EMPTY_${BPN}-charmaps = "1" +PACKAGES += "${BPN}-charmaps" +RRECOMMENDS_${BPN}-charmaps = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("eglibc-charmap") != -1])}" + +# Create a eglibc-gconvs package +ALLOW_EMPTY_${BPN}-gconvs = "1" +PACKAGES += "${BPN}-gconvs" +RRECOMMENDS_${BPN}-gconvs = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("eglibc-gconv") != -1])}" + +# Create a eglibc-localedatas package +ALLOW_EMPTY_${BPN}-localedatas = "1" +PACKAGES += "${BPN}-localedatas" +RRECOMMENDS_${BPN}-localedatas = "${@" ".join([p for p in d.getVar('PACKAGES', True).split() if p.find("eglibc-localedata") != -1])}" + +DESCRIPTION_localedef = "eglibc: compile locale definition files" + +# eglibc-gconv is dynamically added into PACKAGES, thus +# FILES_eglibc-gconv will not be automatically extended in multilib. +# Explicitly add ${MLPREFIX} for FILES_eglibc-gconv. +FILES_${MLPREFIX}eglibc-gconv = "${libdir}/gconv/*" +FILES_${PN}-dbg += "${libdir}/gconv/.debug/*" +FILES_localedef = "${bindir}/localedef" + +LOCALETREESRC = "${STAGING_INCDIR}/eglibc-locale-internal-${MULTIMACH_TARGET_SYS}" + +do_install () { + mkdir -p ${D}${bindir} ${D}${datadir} ${D}${libdir} + if [ -n "$(ls ${LOCALETREESRC}/${bindir})" ]; then + cp -fpPR ${LOCALETREESRC}/${bindir}/* ${D}${bindir} + fi + if [ -n "$(ls ${LOCALETREESRC}/${localedir})" ]; then + mkdir -p ${D}${localedir} + cp -fpPR ${LOCALETREESRC}/${localedir}/* ${D}${localedir} + fi + if [ -e ${LOCALETREESRC}/${libdir}/gconv ]; then + cp -fpPR ${LOCALETREESRC}/${libdir}/gconv ${D}${libdir} + fi + if [ -e ${LOCALETREESRC}/${datadir}/i18n ]; then + cp -fpPR ${LOCALETREESRC}/${datadir}/i18n ${D}${datadir} + fi + if [ -e ${LOCALETREESRC}/${datadir}/locale ]; then + cp -fpPR ${LOCALETREESRC}/${datadir}/locale ${D}${datadir} + fi + chown root.root -R ${D} + cp -fpPR ${LOCALETREESRC}/SUPPORTED ${WORKDIR} +} + +inherit libc-package + +BBCLASSEXTEND = "nativesdk" diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-locale_2.19.bb b/meta-aspeed/recipes-core/eglibc/eglibc-locale_2.19.bb new file mode 100644 index 0000000..ce6c1d2 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-locale_2.19.bb @@ -0,0 +1 @@ +require eglibc-locale.inc diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-mtrace.inc b/meta-aspeed/recipes-core/eglibc/eglibc-mtrace.inc new file mode 100644 index 0000000..d68783e --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-mtrace.inc @@ -0,0 +1,13 @@ +include eglibc-collateral.inc + +SUMMARY = "mtrace utility provided by eglibc" +DESCRIPTION = "mtrace utility provided by eglibc" +RDEPENDS_${PN} = "perl" +RPROVIDES_${PN} = "libc-mtrace" + +SRC = "${STAGING_INCDIR}/eglibc-scripts-internal-${MULTIMACH_TARGET_SYS}" + +do_install() { + install -d -m 0755 ${D}${bindir} + install -m 0755 ${SRC}/mtrace ${D}${bindir}/ +} diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-mtrace_2.19.bb b/meta-aspeed/recipes-core/eglibc/eglibc-mtrace_2.19.bb new file mode 100644 index 0000000..6fa2be9 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-mtrace_2.19.bb @@ -0,0 +1 @@ +require eglibc-mtrace.inc diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-options.inc b/meta-aspeed/recipes-core/eglibc/eglibc-options.inc new file mode 100644 index 0000000..0432758 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-options.inc @@ -0,0 +1,162 @@ +def eglibc_cfg(feature, tokens, cnf): + if type(tokens) == type(""): + tokens = [tokens] + if feature: + cnf.extend([token + '=y' for token in tokens]) + else: + for token in tokens: + cnf.extend([token + '=n']) + if token == 'OPTION_EGLIBC_NSSWITCH': + cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_CONFIG=\"${S}/nss/nsswitch.conf\""]) + cnf.extend(["OPTION_EGLIBC_NSSWITCH_FIXED_FUNCTIONS=\"${S}/nss/fixed-nsswitch.functions\""]) + +# Map distro features to eglibc options settings +def features_to_eglibc_settings(d): + cnf = ([]) + + ipv4 = base_contains('DISTRO_FEATURES', 'ipv4', True, False, d) + ipv6 = base_contains('DISTRO_FEATURES', 'ipv6', True, False, d) + libc_backtrace = base_contains('DISTRO_FEATURES', 'libc-backtrace', True, False, d) + libc_big_macros = base_contains('DISTRO_FEATURES', 'libc-big-macros', True, False, d) + libc_bsd = base_contains('DISTRO_FEATURES', 'libc-bsd', True, False, d) + libc_cxx_tests = base_contains('DISTRO_FEATURES', 'libc-cxx-tests', True, False, d) + libc_catgets = base_contains('DISTRO_FEATURES', 'libc-catgets', True, False, d) + libc_charsets = base_contains('DISTRO_FEATURES', 'libc-charsets', True, False, d) + libc_crypt = base_contains('DISTRO_FEATURES', 'libc-crypt', True, False, d) + libc_crypt_ufc = base_contains('DISTRO_FEATURES', 'libc-crypt-ufc', True, False, d) + libc_db_aliases = base_contains('DISTRO_FEATURES', 'libc-db-aliases', True, False, d) + libc_envz = base_contains('DISTRO_FEATURES', 'libc-envz', True, False, d) + libc_fcvt = base_contains('DISTRO_FEATURES', 'libc-fcvt', True, False, d) + libc_fmtmsg = base_contains('DISTRO_FEATURES', 'libc-fmtmsg', True, False, d) + libc_fstab = base_contains('DISTRO_FEATURES', 'libc-fstab', True, False, d) + libc_ftraverse = base_contains('DISTRO_FEATURES', 'libc-ftraverse', True, False, d) + libc_getlogin = base_contains('DISTRO_FEATURES', 'libc-getlogin', True, False, d) + libc_idn = base_contains('DISTRO_FEATURES', 'libc-idn', True, False, d) + libc_inet_anl = base_contains('DISTRO_FEATURES', 'libc-inet-anl', True, False, d) + libc_libm = base_contains('DISTRO_FEATURES', 'libc-libm', True, False, d) + libc_locales = base_contains('DISTRO_FEATURES', 'libc-locales', True, False, d) + libc_locale_code = base_contains('DISTRO_FEATURES', 'libc-locale-code', True, False, d) + libc_memusage = base_contains('DISTRO_FEATURES', 'libc-memusage', True, False, d) + libc_nis = base_contains('DISTRO_FEATURES', 'libc-nis', True, False, d) + libc_nsswitch = base_contains('DISTRO_FEATURES', 'libc-nsswitch', True, False, d) + libc_rcmd = base_contains('DISTRO_FEATURES', 'libc-rcmd', True, False, d) + libc_rtld_debug = base_contains('DISTRO_FEATURES', 'libc-rtld-debug', True, False, d) + libc_spawn = base_contains('DISTRO_FEATURES', 'libc-spawn', True, False, d) + libc_streams = base_contains('DISTRO_FEATURES', 'libc-streams', True, False, d) + libc_sunrpc = base_contains('DISTRO_FEATURES', 'libc-sunrpc', True, False, d) + libc_utmp = base_contains('DISTRO_FEATURES', 'libc-utmp', True, False, d) + libc_utmpx = base_contains('DISTRO_FEATURES', 'libc-utmpx', True, False, d) + libc_wordexp = base_contains('DISTRO_FEATURES', 'libc-wordexp', True, False, d) + libc_posix_clang_wchar = base_contains('DISTRO_FEATURES', 'libc-posix-clang-wchar', True, False, d) + libc_posix_regexp = base_contains('DISTRO_FEATURES', 'libc-posix-regexp', True, False, d) + libc_posix_regexp_glibc = base_contains('DISTRO_FEATURES', 'libc-posix-regexp-glibc', True, False, d) + libc_posix_wchar_io = base_contains('DISTRO_FEATURES', 'libc-posix-wchar-io', True, False, d) + + # arrange the dependencies among eglibc configuable options according to file option-groups.def from eglibc source code + new_dep = True + while new_dep: + new_dep = False + + if ipv6 and not ipv4: + new_dep = True + ipv4 = True + + if ipv4 and not libc_nsswitch: + new_dep = True + libc_nsswitch = True + + if libc_cxx_tests: + if not libc_posix_wchar_io: + new_dep = True + libc_posix_wchar_io = True + if not libc_libm: + new_dep = True + libc_libm = True + + if libc_catgets and not libc_locale_code: + new_dep = True + libc_locale_code = True + + if libc_crypt_ufc and not libc_crypt: + new_dep = True + libc_crypt = True + + if libc_getlogin and not libc_utmp: + new_dep = True + libc_utmp = True + + if libc_inet_anl and not ipv4: + new_dep = True + ipv4 = True + + if libc_locale_code and not libc_posix_clang_wchar: + new_dep = True + libc_posix_clang_wchar = True + + if libc_nis: + if not ipv4: + new_dep = True + ipv4 = True + if not libc_sunrpc: + new_dep = True + libc_sunrpc = True + + if libc_rcmd and not ipv4: + new_dep = True + ipv4 = True + + if libc_sunrpc and not ipv4: + new_dep = True + ipv4 = True + + if libc_utmpx and not libc_utmp: + new_dep = True + libc_utmp = True + + if libc_posix_regexp_glibc and not libc_posix_regexp: + new_dep = True + libc_posix_regexp = True + + if libc_posix_wchar_io and not libc_posix_clang_wchar: + new_dep = True + libc_posix_clang_wchar = True + + eglibc_cfg(ipv6, 'OPTION_EGLIBC_ADVANCED_INET6', cnf) + eglibc_cfg(libc_backtrace, 'OPTION_EGLIBC_BACKTRACE', cnf) + eglibc_cfg(libc_big_macros, 'OPTION_EGLIBC_BIG_MACROS', cnf) + eglibc_cfg(libc_bsd, 'OPTION_EGLIBC_BSD', cnf) + eglibc_cfg(libc_cxx_tests, 'OPTION_EGLIBC_CXX_TESTS', cnf) + eglibc_cfg(libc_catgets, 'OPTION_EGLIBC_CATGETS', cnf) + eglibc_cfg(libc_charsets, 'OPTION_EGLIBC_CHARSETS', cnf) + eglibc_cfg(libc_crypt, 'OPTION_EGLIBC_CRYPT', cnf) + eglibc_cfg(libc_crypt_ufc, 'OPTION_EGLIBC_CRYPT_UFC', cnf) + eglibc_cfg(libc_db_aliases, 'OPTION_EGLIBC_DB_ALIASES', cnf) + eglibc_cfg(libc_envz, 'OPTION_EGLIBC_ENVZ', cnf) + eglibc_cfg(libc_fcvt, 'OPTION_EGLIBC_FCVT', cnf) + eglibc_cfg(libc_fmtmsg, 'OPTION_EGLIBC_FMTMSG', cnf) + eglibc_cfg(libc_fstab, 'OPTION_EGLIBC_FSTAB', cnf) + eglibc_cfg(libc_ftraverse, 'OPTION_EGLIBC_FTRAVERSE', cnf) + eglibc_cfg(libc_getlogin, 'OPTION_EGLIBC_GETLOGIN', cnf) + eglibc_cfg(libc_idn, 'OPTION_EGLIBC_IDN', cnf) + eglibc_cfg(ipv4, 'OPTION_EGLIBC_INET', cnf) + eglibc_cfg(libc_inet_anl, 'OPTION_EGLIBC_INET_ANL', cnf) + eglibc_cfg(libc_libm, 'OPTION_EGLIBC_LIBM', cnf) + eglibc_cfg(libc_locales, 'OPTION_EGLIBC_LOCALES', cnf) + eglibc_cfg(libc_locale_code, 'OPTION_EGLIBC_LOCALE_CODE', cnf) + eglibc_cfg(libc_memusage, 'OPTION_EGLIBC_MEMUSAGE', cnf) + eglibc_cfg(libc_nis, 'OPTION_EGLIBC_NIS', cnf) + eglibc_cfg(libc_nsswitch, 'OPTION_EGLIBC_NSSWITCH', cnf) + eglibc_cfg(libc_rcmd, 'OPTION_EGLIBC_RCMD', cnf) + eglibc_cfg(libc_rtld_debug, 'OPTION_EGLIBC_RTLD_DEBUG', cnf) + eglibc_cfg(libc_spawn, 'OPTION_EGLIBC_SPAWN', cnf) + eglibc_cfg(libc_streams, 'OPTION_EGLIBC_STREAMS', cnf) + eglibc_cfg(libc_sunrpc, 'OPTION_EGLIBC_SUNRPC', cnf) + eglibc_cfg(libc_utmp, 'OPTION_EGLIBC_UTMP', cnf) + eglibc_cfg(libc_utmpx, 'OPTION_EGLIBC_UTMPX', cnf) + eglibc_cfg(libc_wordexp, 'OPTION_EGLIBC_WORDEXP', cnf) + eglibc_cfg(libc_posix_clang_wchar, 'OPTION_POSIX_C_LANG_WIDE_CHAR', cnf) + eglibc_cfg(libc_posix_regexp, 'OPTION_POSIX_REGEXP', cnf) + eglibc_cfg(libc_posix_regexp_glibc, 'OPTION_POSIX_REGEXP_GLIBC', cnf) + eglibc_cfg(libc_posix_wchar_io, 'OPTION_POSIX_WIDE_CHAR_DEVICE_IO', cnf) + + return "\n".join(cnf) diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-package.inc b/meta-aspeed/recipes-core/eglibc/eglibc-package.inc new file mode 100644 index 0000000..6721819 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-package.inc @@ -0,0 +1,155 @@ +# +# For now, we will skip building of a gcc package if it is a uclibc one +# and our build is not a uclibc one, and we skip a eglibc one if our build +# is a uclibc build. +# +# See the note in gcc/gcc_3.4.0.oe +# + +python __anonymous () { + import bb, re + uc_os = (re.match('.*uclibc*', d.getVar('TARGET_OS', True)) != None) + if uc_os: + raise bb.parse.SkipPackage("incompatible with target %s" % + d.getVar('TARGET_OS', True)) +} + +# Set this to zero if you don't want ldconfig in the output package +USE_LDCONFIG ?= "1" + +PACKAGES = "${PN}-dbg catchsegv sln nscd ldd ${PN}-utils eglibc-thread-db ${PN}-pic libcidn libmemusage libsegfault ${PN}-pcprofile libsotruss ${PN} eglibc-extra-nss ${PN}-dev ${PN}-staticdev ${PN}-doc" + +# The ld.so in this eglibc supports the GNU_HASH +RPROVIDES_${PN} = "glibc rtld(GNU_HASH)" +RPROVIDES_${PN}-utils = "glibc-utils" +RPROVIDES_${PN}-mtrace = "glibc-mtrace libc-mtrace" +RPROVIDES_${PN}-pic = "glibc-pic" +RPROVIDES_${PN}-dev = "glibc-dev libc6-dev virtual-libc-dev" +RPROVIDES_${PN}-staticdev = "glibc-staticdev" +RPROVIDES_${PN}-doc = "glibc-doc" +RPROVIDES_eglibc-extra-nss = "glibc-extra-nss" +RPROVIDES_eglibc-thread-db = "glibc-thread-db" +RPROVIDES_${PN}-pcprofile = "glibc-pcprofile" +RPROVIDES_${PN}-dbg = "glibc-dbg" +libc_baselibs = "${base_libdir}/libcrypt*.so.* ${base_libdir}/libcrypt-*.so ${base_libdir}/libc.so.* ${base_libdir}/libc-*.so ${base_libdir}/libm*.so.* ${base_libdir}/libm-*.so ${base_libdir}/ld*.so.* ${base_libdir}/ld-*.so ${base_libdir}/libpthread*.so.* ${base_libdir}/libpthread-*.so ${base_libdir}/libresolv*.so.* ${base_libdir}/libresolv-*.so ${base_libdir}/librt*.so.* ${base_libdir}/librt-*.so ${base_libdir}/libutil*.so.* ${base_libdir}/libutil-*.so ${base_libdir}/libnsl*.so.* ${base_libdir}/libnsl-*.so ${base_libdir}/libnss_files*.so.* ${base_libdir}/libnss_files-*.so ${base_libdir}/libnss_compat*.so.* ${base_libdir}/libnss_compat-*.so ${base_libdir}/libnss_dns*.so.* ${base_libdir}/libnss_dns-*.so ${base_libdir}/libdl*.so.* ${base_libdir}/libdl-*.so ${base_libdir}/libanl*.so.* ${base_libdir}/libanl-*.so ${base_libdir}/libBrokenLocale*.so.* ${base_libdir}/libBrokenLocale-*.so" + +FILES_${PN} = "${libc_baselibs} ${libexecdir}/* ${@base_conditional('USE_LDCONFIG', '1', '${base_sbindir}/ldconfig ${sysconfdir}/ld.so.conf', '', d)}" +FILES_ldd = "${bindir}/ldd" +FILES_libsegfault = "${base_libdir}/libSegFault*" +FILES_libcidn = "${base_libdir}/libcidn-*.so ${base_libdir}/libcidn.so.*" +FILES_libmemusage = "${base_libdir}/libmemusage.so" +FILES_eglibc-extra-nss = "${base_libdir}/libnss_*-*.so ${base_libdir}/libnss_*.so.*" +FILES_sln = "/sbin/sln" +FILES_${PN}-pic = "${libdir}/*_pic.a ${libdir}/*_pic.map ${libdir}/libc_pic/*.o" +FILES_libsotruss = "${libdir}/audit/sotruss-lib.so" +FILES_SOLIBSDEV = "${libdir}/lib*${SOLIBSDEV}" +FILES_${PN}-dev += "${bindir}/rpcgen ${libdir}/*_nonshared.a ${base_libdir}/*_nonshared.a ${base_libdir}/*.o ${datadir}/aclocal" +FILES_${PN}-staticdev += "${libdir}/*.a ${base_libdir}/*.a" +FILES_nscd = "${sbindir}/nscd*" +FILES_${PN}-mtrace = "${bindir}/mtrace" +FILES_${PN}-utils = "${bindir}/* ${sbindir}/*" +FILES_${PN}-dbg += "${libexecdir}/*/.debug ${libdir}/audit/.debug" +FILES_catchsegv = "${bindir}/catchsegv" +RDEPENDS_catchsegv = "libsegfault" +FILES_${PN}-pcprofile = "${base_libdir}/libpcprofile.so" +FILES_eglibc-thread-db = "${base_libdir}/libthread_db.so.* ${base_libdir}/libthread_db-*.so" +RPROVIDES_${PN}-dev += "libc-dev" +RPROVIDES_${PN}-staticdev += "libc-staticdev" + +SUMMARY_sln = "The static ln" +DESCRIPTION_sln = "Similar to the 'ln' utility, but statically linked. sln is useful to make symbolic links to dynamic libraries if the dynamic linking system, for some reason, is not functional." +SUMMARY_nscd = "Name service cache daemon" +DESCRIPTION_nscd = "nscd, name service cache daemon, caches name service lookups for the passwd, group and hosts information. It can damatically improvide performance with remote, such as NIS or NIS+, name services." +SUMMARY_eglibc-extra-nss = "hesiod, NIS and NIS+ nss libraries" +DESCRIPTION_eglibc-extra-nss = "eglibc: nis, nisplus and hesiod search services." +SUMMARY_ldd = "print shared library dependencies" +DESCRIPTION_ldd = "${bindir}/ldd prints shared library dependencies for each program or shared library specified on the command line." +SUMMARY_${PN}-utils = "Miscellaneous utilities provided by eglibc" +DESCRIPTION_${PN}-utils = "Miscellaneous utilities including getconf, iconf, locale, gencat, tzselect, zic, rpcinfo, ..." +DESCRIPTION_libsotruss = "Library to support sotruss which traces calls through PLTs" + +inherit libc-common multilib_header + +do_install_append () { + rm -f ${D}${sysconfdir}/localtime + rm -rf ${D}${localstatedir} + + # remove empty eglibc dir + if [ -d ${D}${libdir}/eglibc -a ! -e ${D}${libdir}/eglibc/pt_chown ]; then + rmdir ${D}${libdir}/eglibc + fi + oe_multilib_header bits/syscall.h + + if [ -f ${D}${bindir}/mtrace ]; then + sed -i -e '1s,#!.*perl,#! ${USRBINPATH}/env perl,' -e '2s,exec.*perl,exec ${USRBINPATH}/env perl,' ${D}${bindir}/mtrace + fi + rm -rf ${D}${includedir}/rpcsvc/rquota* + # Info dir listing isn't interesting at this point so remove it if it exists. + if [ -e "${D}${infodir}/dir" ]; then + rm -f ${D}${infodir}/dir + fi + + if [ "${USE_LDCONFIG}" != "1" ]; then + # We won't ship this file (see FILES above) so let's not install it + rm -f ${D}${sysconfdir}/ld.so.conf + # This directory will be empty now so remove it too. + # But check whether it exists first, since it won't for eglibc-initial. + if [ -d ${D}${sysconfdir} ]; then + rmdir ${D}${sysconfdir} + fi + fi +} + +do_install_locale () { + dest=${D}/${includedir}/eglibc-locale-internal-${MULTIMACH_TARGET_SYS} + install -d ${dest}${base_libdir} ${dest}${bindir} ${dest}${libdir} ${dest}${datadir} + if [ "${base_libdir}" != "${libdir}" ]; then + cp -fpPR ${D}${base_libdir}/* ${dest}${base_libdir} + fi + if [ -e ${D}${bindir}/localedef ]; then + mv -f ${D}${bindir}/localedef ${dest}${bindir} + fi + if [ -e ${D}${libdir}/gconv ]; then + mv -f ${D}${libdir}/gconv ${dest}${libdir} + fi + if [ -e ${D}${exec_prefix}/lib ]; then + cp -fpPR ${D}${exec_prefix}/lib ${dest}${exec_prefix} + fi + if [ -e ${D}${datadir}/i18n ]; then + mv ${D}${datadir}/i18n ${dest}${datadir} + fi + cp -fpPR ${D}${datadir}/* ${dest}${datadir} + rm -rf ${D}${datadir}/locale/ + cp -fpPR ${WORKDIR}/SUPPORTED ${dest} +} + +addtask do_install_locale after do_install before do_populate_sysroot do_package + +bashscripts = "mtrace sotruss xtrace" + +do_evacuate_scripts () { + target=${D}${includedir}/eglibc-scripts-internal-${MULTIMACH_TARGET_SYS} + mkdir -p $target + for i in ${bashscripts}; do + if [ -f ${D}${bindir}/$i ]; then + cp ${D}${bindir}/$i $target/ + fi + done +} + +addtask evacuate_scripts after do_install before do_populate_sysroot do_package + +PACKAGE_PREPROCESS_FUNCS += "eglibc_package_preprocess" + +eglibc_package_preprocess () { + rm -rf ${PKGD}/${includedir}/eglibc-locale-internal-${MULTIMACH_TARGET_SYS} + rm -rf ${PKGD}/${includedir}/eglibc-scripts-internal-${MULTIMACH_TARGET_SYS} + for i in ${bashscripts}; do + rm -f ${PKGD}${bindir}/$i + done + rm -rf ${PKGD}/${localedir} + if [ "${libdir}" != "${exec_prefix}/lib" ]; then + # This dir only exists to hold locales + rm -rf ${PKGD}${exec_prefix}/lib + fi +} diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-scripts.inc b/meta-aspeed/recipes-core/eglibc/eglibc-scripts.inc new file mode 100644 index 0000000..9ca6673 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-scripts.inc @@ -0,0 +1,16 @@ +include eglibc-collateral.inc + +SUMMARY = "utility scripts provided by eglibc" +DESCRIPTION = "utility scripts provided by eglibc" +RDEPENDS_${PN} = "bash eglibc-mtrace" + +SRC = "${STAGING_INCDIR}/eglibc-scripts-internal-${MULTIMACH_TARGET_SYS}" + +bashscripts = "sotruss xtrace" + +do_install() { + install -d -m 0755 ${D}${bindir} + for i in ${bashscripts}; do + install -m 0755 ${SRC}/$i ${D}${bindir}/ + done +} diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-scripts_2.19.bb b/meta-aspeed/recipes-core/eglibc/eglibc-scripts_2.19.bb new file mode 100644 index 0000000..3113362 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-scripts_2.19.bb @@ -0,0 +1 @@ +require eglibc-scripts.inc diff --git a/meta-aspeed/recipes-core/eglibc/eglibc-testing.inc b/meta-aspeed/recipes-core/eglibc/eglibc-testing.inc new file mode 100644 index 0000000..ab3ec15 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc-testing.inc @@ -0,0 +1,79 @@ +do_compile_append () { + # now generate script to drive testing + echo "#!/usr/bin/env sh" >${B}/${HOST_PREFIX}testeglibc + set >> ${B}/${HOST_PREFIX}testeglibc + # prune out the unneeded vars + sed -i -e "/^BASH/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^USER/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^OPT/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^DIRSTACK/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^EUID/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^FUNCNAME/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^GROUPS/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^HOST/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^HOME/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^IFS/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^LC_ALL/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^LOGNAME/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^MACHTYPE/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^OSTYPE/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^PIPE/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^SHELL/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^'/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^UID/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^TERM/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^PATCH_GET/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^PKG_/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^POSIXLY_/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^PPID/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^PS4/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^Q/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^SHLVL/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^STAGING/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^LD_LIBRARY_PATH/d" ${B}/${HOST_PREFIX}testeglibc + sed -i -e "/^PSEUDO/d" ${B}/${HOST_PREFIX}testeglibc + + # point to real sysroot not the toolchain bootstrap sysroot + sed -i -e "s/\-tcbootstrap//g" ${B}/${HOST_PREFIX}testeglibc + + # use the final cross-gcc to test since some tests need libstdc++ + sed -i -e "s/^PATH=.*\.gcc-cross-initial\:/PATH=/g" ${B}/${HOST_PREFIX}testeglibc + + # append execution part script +cat >> ${B}/${HOST_PREFIX}testeglibc << STOP +target="\$1" +if [ "x\$target" = "x" ] +then + echo "Please specify the target machine and remote user in form of user@target" + exit 1; +fi +ssh \$target ls \$PWD\ 2>&1 > /dev/null +if [ "x\$?" != "x0" ] +then + echo "Failed connecting to \$target it could be because of:" + echo "1. You dont have passwordless ssh setup to access \$target" + echo "2. NFS share on \$target is not mounted or if mounted then not matching the build tree layout." + echo " The tree should be accessible at same location on build host and target" + echo " You can add nfs-server to IMAGE_FEATURES to get the nfs client on target" + echo "3. nfs server on build host is not running." + echo " Please make sure that you have 'no_root_squash' added in /etc/exports if you want" + echo " to test as root user on target (usually its recommended to create a non" + echo " root user." + echo " As a sanity check make sure that target can read/write to the eglibc build tree" + echo " Please refer to ${S}/EGLIBC.cross-testing for further instructions on setup" + exit 1 +fi + echo "# we test using cross compiler from real sysroot therefore override the" > ${B}/configparms + echo "# definitions that come from ${B}/config.make" >> ${B}/configparms + + fgrep tcbootstrap ${B}/config.make > ${B}/configparms + sed -i -e "s/\-tcbootstrap//g" ${B}/configparms +wrapper="${S}/scripts/cross-test-ssh.sh \$target" +localedef="${STAGING_BINDIR_NATIVE}/cross-localedef --little-endian --uint32-align=4" +make tests-clean +make cross-localedef="\$localedef" cross-test-wrapper="\$wrapper" -k check +rm -rf ${B}/configparms +STOP + + chmod +x ${B}/${HOST_PREFIX}testeglibc +} diff --git a/meta-aspeed/recipes-core/eglibc/eglibc.inc b/meta-aspeed/recipes-core/eglibc/eglibc.inc new file mode 100644 index 0000000..c0b2494 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc.inc @@ -0,0 +1,84 @@ +require eglibc-common.inc +require eglibc-ld.inc +require eglibc-testing.inc + +STAGINGCC = "gcc-cross-initial-${TARGET_ARCH}" +STAGINGCC_class-nativesdk = "gcc-crosssdk-initial-${TARGET_ARCH}" +PATH_prepend = "${STAGING_BINDIR_TOOLCHAIN}.${STAGINGCC}:" + +TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_TCBOOTSTRAP}" + +# eglibc can't be built without optimization, if someone tries to compile an +# entire image as -O0, we override it with -O2 here and give a note about it. +def get_optimization(d): + selected_optimization = d.getVar("SELECTED_OPTIMIZATION", True) + if base_contains("SELECTED_OPTIMIZATION", "-O0", "x", "", d) == "x": + bb.note("eglibc can't be built with -O0, -O2 will be used instead.") + return selected_optimization.replace("-O0", "-O2") + return selected_optimization + +SELECTED_OPTIMIZATION := "${@get_optimization(d)}" + +# siteconfig.bbclass runs configure which needs a working compiler +# For the compiler to work we need a working libc yet libc isn't +# in the sysroots directory at this point. This means the libc.so +# linker script won't work as the --sysroot setting isn't correct. +# Here we create a hacked up libc linker script and pass in the right +# flags to let configure work. Ugly. +EXTRASITECONFIG = "CFLAGS='${CFLAGS} -Wl,-L${WORKDIR}/site_config_libc -L${WORKDIR}/site_config_libc -L${SYSROOT_DESTDIR}${libdir} -L${SYSROOT_DESTDIR}${base_libdir} -Wl,-L${SYSROOT_DESTDIR}${libdir} -Wl,-L${SYSROOT_DESTDIR}${base_libdir}'" +siteconfig_do_siteconfig_gencache_prepend = " \ + mkdir -p ${WORKDIR}/site_config_libc; \ + cp ${SYSROOT_DESTDIR}${libdir}/libc.so ${WORKDIR}/site_config_libc; \ + sed -i -e 's# ${base_libdir}# ${SYSROOT_DESTDIR}${base_libdir}#g' -e 's# ${libdir}# ${SYSROOT_DESTDIR}${libdir}#g' ${WORKDIR}/site_config_libc/libc.so; \ +" + +# nptl needs unwind support in gcc, which can't be built without glibc. +DEPENDS = "virtual/${TARGET_PREFIX}gcc-initial libgcc-initial linux-libc-headers virtual/${TARGET_PREFIX}libc-initial" +# nptl needs libgcc but dlopens it, so our shlibs code doesn't detect this +#RDEPENDS_${PN} += "${@['','libgcc']['nptl' in '${GLIBC_ADDONS}']}" +PROVIDES = "virtual/libc virtual/${TARGET_PREFIX}libc-for-gcc" +PROVIDES += "virtual/libintl virtual/libiconv" +inherit autotools +require eglibc-options.inc + +LEAD_SONAME = "libc.so" + +CACHED_CONFIGUREVARS += "ac_cv_path_KSH=${base_bindir}/bash \ + ac_cv_path_BASH_SHELL=${base_bindir}/bash \ + libc_cv_localedir=${localedir} \ + libc_cv_ssp=no \ + " + +GLIBC_EXTRA_OECONF ?= "" +GLIBC_EXTRA_OECONF_class-nativesdk = "" +INHIBIT_DEFAULT_DEPS = "1" + +ARM_INSTRUCTION_SET = "arm" + +# eglibc uses PARALLELMFLAGS variable to pass parallel build info so transfer +# PARALLEL_MAKE into PARALLELMFLAGS and empty out PARALLEL_MAKE +EGLIBCPARALLELISM := "PARALLELMFLAGS="${PARALLEL_MAKE}"" +EXTRA_OEMAKE[vardepsexclude] += "EGLIBCPARALLELISM" +EXTRA_OEMAKE += "${EGLIBCPARALLELISM}" +PARALLEL_MAKE = "" + +# eglibc make-syscalls.sh has a number of issues with /bin/dash and +# it's output which make calls via the SHELL also has issues, so +# ensure make uses /bin/bash +EXTRA_OEMAKE += "SHELL=/bin/bash" + +OE_FEATURES = "${@features_to_eglibc_settings(d)}" +do_configure_prepend() { + sed -e "s#@BASH@#/bin/sh#" -i ${S}/elf/ldd.bash.in + echo '${OE_FEATURES}' > ${B}/option-groups.config +} + +do_configure_append() { + oe_runmake config + + # Remove quotation marks from OPTION_EGLIBC_NSSWITCH_FIXED_*. This will + # avoid install error. + sed -i 's/^OPTION_EGLIBC_NSSWITCH_FIXED_\(.*\)="\(.*\)"$/OPTION_EGLIBC_NSSWITCH_FIXED_\1=\2/' option-groups.config +} + +GLIBC_ADDONS ?= "ports,nptl,libidn" diff --git a/meta-aspeed/recipes-core/eglibc/eglibc_2.19.bb b/meta-aspeed/recipes-core/eglibc/eglibc_2.19.bb new file mode 100644 index 0000000..c65e6a5 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/eglibc_2.19.bb @@ -0,0 +1,147 @@ +require eglibc.inc + +DEPENDS += "gperf-native kconfig-frontends-native" + +SRC_URI = "http://downloads.yoctoproject.org/releases/eglibc/eglibc-${PV}-svnr25243.tar.bz2 \ + file://eglibc-svn-arm-lowlevellock-include-tls.patch \ + file://IO-acquire-lock-fix.patch \ + file://mips-rld-map-check.patch \ + file://etc/ld.so.conf \ + file://generate-supported.mk \ + file://glibc.fix_sqrt2.patch \ + file://multilib_readlib.patch \ + file://ppc-sqrt_finite.patch \ + file://GLRO_dl_debug_mask.patch \ + file://initgroups_keys.patch \ + file://eglibc_fix_findidx_parameters.patch \ + file://ppc_slow_ieee754_sqrt.patch \ + file://fileops-without-wchar-io.patch \ + file://add_resource_h_to_wait_h.patch \ + file://0001-eglibc-menuconfig-support.patch \ + file://0002-eglibc-menuconfig-hex-string-options.patch \ + file://0003-eglibc-menuconfig-build-instructions.patch \ + file://fsl-ppc-no-fsqrt.patch \ + file://0001-R_ARM_TLS_DTPOFF32.patch \ + file://0001-eglibc-run-libm-err-tab.pl-with-specific-dirs-in-S.patch \ + file://fix-tibetian-locales.patch \ + file://ppce6500-32b_slow_ieee754_sqrt.patch \ + file://grok_gold.patch \ + " +SRC_URI[md5sum] = "197836c2ba42fb146e971222647198dd" +SRC_URI[sha256sum] = "baaa030531fc308f7820c46acdf8e1b2f8e3c1f40bcd28b6e440d1c95d170d4c" + +LIC_FILES_CHKSUM = "file://LICENSES;md5=e9a558e243b36d3209f380deb394b213 \ + file://COPYING;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ + file://posix/rxspencer/COPYRIGHT;md5=dc5485bb394a13b2332ec1c785f5d83a \ + file://COPYING.LIB;md5=4fbd65380cdd255951079008b364516c" + +SRC_URI_append_class-nativesdk = " file://ld-search-order.patch \ + file://relocatable_sdk.patch \ + file://relocatable_sdk_fix_openpath.patch \ + " +S = "${WORKDIR}/eglibc-${PV}/libc" +B = "${WORKDIR}/build-${TARGET_SYS}" + +PACKAGES_DYNAMIC = "" + +# the -isystem in bitbake.conf screws up glibc do_stage +BUILD_CPPFLAGS = "-I${STAGING_INCDIR_NATIVE}" +TARGET_CPPFLAGS = "-I${STAGING_DIR_TARGET}${includedir}" + +GLIBC_BROKEN_LOCALES = " _ER _ET so_ET yn_ER sid_ET tr_TR mn_MN gez_ET gez_ER bn_BD te_IN es_CR.ISO-8859-1" + +FILESPATH = "${@base_set_filespath([ '${FILE_DIRNAME}/eglibc-${PV}', '${FILE_DIRNAME}/eglibc', '${FILE_DIRNAME}/files', '${FILE_DIRNAME}' ], d)}" + +# +# For now, we will skip building of a gcc package if it is a uclibc one +# and our build is not a uclibc one, and we skip a glibc one if our build +# is a uclibc build. +# +# See the note in gcc/gcc_3.4.0.oe +# + +python __anonymous () { + import re + uc_os = (re.match('.*uclibc$', d.getVar('TARGET_OS', True)) != None) + if uc_os: + raise bb.parse.SkipPackage("incompatible with target %s" % + d.getVar('TARGET_OS', True)) +} + +export libc_cv_slibdir = "${base_libdir}" + +EXTRA_OECONF = "--enable-kernel=${OLDEST_KERNEL} \ + --without-cvs --disable-profile \ + --disable-debug --without-gd \ + --enable-clocale=gnu \ + --enable-add-ons \ + --with-headers=${STAGING_INCDIR} \ + --without-selinux \ + --enable-obsolete-rpc \ + --with-kconfig=${STAGING_BINDIR_NATIVE} \ + ${GLIBC_EXTRA_OECONF}" + +EXTRA_OECONF += "${@get_libc_fpu_setting(bb, d)}" + +do_patch_append() { + bb.build.exec_func('do_fix_readlib_c', d) +} + +# for mips eglibc now builds syscall tables for all abi's +# so we make sure that we choose right march option which is +# compatible with o32,n32 and n64 abi's +# e.g. -march=mips32 is not compatible with n32 and n64 therefore +# we filter it out in such case -march=from-abi which will be +# mips1 when using o32 and mips3 when using n32/n64 + +TUNE_CCARGS_mips := "${@oe_filter_out('-march=mips32', '${TUNE_CCARGS}', d)}" +TUNE_CCARGS_mipsel := "${@oe_filter_out('-march=mips32', '${TUNE_CCARGS}', d)}" + +do_fix_readlib_c () { + sed -i -e 's#OECORE_KNOWN_INTERPRETER_NAMES#${EGLIBC_KNOWN_INTERPRETER_NAMES}#' ${S}/elf/readlib.c +} + +do_configure () { +# override this function to avoid the autoconf/automake/aclocal/autoheader +# calls for now +# don't pass CPPFLAGS into configure, since it upsets the kernel-headers +# version check and doesn't really help with anything + if [ -z "`which rpcgen`" ]; then + echo "rpcgen not found. Install glibc-devel." + exit 1 + fi + (cd ${S} && gnu-configize) || die "failure in running gnu-configize" + find ${S} -name "configure" | xargs touch + CPPFLAGS="" oe_runconf +} + +rpcsvc = "bootparam_prot.x nlm_prot.x rstat.x \ + yppasswd.x klm_prot.x rex.x sm_inter.x mount.x \ + rusers.x spray.x nfs_prot.x rquota.x key_prot.x" + +do_compile () { + # -Wl,-rpath-link /lib in LDFLAGS can cause breakage if another glibc is in staging + unset LDFLAGS + base_do_compile + ( + cd ${S}/sunrpc/rpcsvc + for r in ${rpcsvc}; do + h=`echo $r|sed -e's,\.x$,.h,'` + rpcgen -h $r -o $h || bbwarn "unable to generate header for $r" + done + ) + echo "Adjust ldd script" + if [ -n "${RTLDLIST}" ] + then + prevrtld=`cat ${B}/elf/ldd | grep "^RTLDLIST=" | sed 's#^RTLDLIST="\?\([^"]*\)"\?$#\1#'` + if [ "${prevrtld}" != "${RTLDLIST}" ] + then + sed -i ${B}/elf/ldd -e "s#^RTLDLIST=.*\$#RTLDLIST=\"${prevrtld} ${RTLDLIST}\"#" + fi + fi + +} + +require eglibc-package.inc + +BBCLASSEXTEND = "nativesdk" diff --git a/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch new file mode 100644 index 0000000..cdfeaea --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/32and64bit.patch @@ -0,0 +1,331 @@ +Upstream-Status: Inappropriate [embedded specific] + +We run the ldconfig in the cross fashion. make the code bitsize aware so that +we can cross build ldconfig cache for various architectures. + +Richard Purdie 2009/05/19 +Nitin A Kamble 2009/03/29 + +Index: ldconfig-native-2.12.1/readelflib.c +=================================================================== +--- ldconfig-native-2.12.1.orig/readelflib.c ++++ ldconfig-native-2.12.1/readelflib.c +@@ -40,39 +40,212 @@ do \ + + /* Returns 0 if everything is ok, != 0 in case of error. */ + int +-process_elf_file (const char *file_name, const char *lib, int *flag, ++process_elf_file32 (const char *file_name, const char *lib, int *flag, + unsigned int *osversion, char **soname, void *file_contents, + size_t file_length) + { + int i; + unsigned int j; +- ElfW(Addr) loadaddr; ++ Elf32_Addr loadaddr; + unsigned int dynamic_addr; + size_t dynamic_size; + char *program_interpreter; + +- ElfW(Ehdr) *elf_header; +- ElfW(Phdr) *elf_pheader, *segment; +- ElfW(Dyn) *dynamic_segment, *dyn_entry; ++ Elf32_Ehdr *elf_header; ++ Elf32_Phdr *elf_pheader, *segment; ++ Elf32_Dyn *dynamic_segment, *dyn_entry; + char *dynamic_strings; + +- elf_header = (ElfW(Ehdr) *) file_contents; ++ elf_header = (Elf32_Ehdr *) file_contents; + *osversion = 0; + +- if (elf_header->e_ident [EI_CLASS] != ElfW (CLASS)) ++ if (elf_header->e_type != ET_DYN) + { +- if (opt_verbose) ++ error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, ++ elf_header->e_type); ++ return 1; ++ } ++ ++ /* Get information from elf program header. */ ++ elf_pheader = (Elf32_Phdr *) (elf_header->e_phoff + file_contents); ++ check_ptr (elf_pheader); ++ ++ /* The library is an elf library, now search for soname and ++ libc5/libc6. */ ++ *flag = FLAG_ELF; ++ ++ loadaddr = -1; ++ dynamic_addr = 0; ++ dynamic_size = 0; ++ program_interpreter = NULL; ++ for (i = 0, segment = elf_pheader; ++ i < elf_header->e_phnum; i++, segment++) ++ { ++ check_ptr (segment); ++ ++ switch (segment->p_type) + { +- if (elf_header->e_ident [EI_CLASS] == ELFCLASS32) +- error (0, 0, _("%s is a 32 bit ELF file.\n"), file_name); +- else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64) +- error (0, 0, _("%s is a 64 bit ELF file.\n"), file_name); +- else +- error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name); ++ case PT_LOAD: ++ if (loadaddr == (Elf32_Addr) -1) ++ loadaddr = segment->p_vaddr - segment->p_offset; ++ break; ++ ++ case PT_DYNAMIC: ++ if (dynamic_addr) ++ error (0, 0, _("more than one dynamic segment\n")); ++ ++ dynamic_addr = segment->p_offset; ++ dynamic_size = segment->p_filesz; ++ break; ++ ++ case PT_INTERP: ++ program_interpreter = (char *) (file_contents + segment->p_offset); ++ check_ptr (program_interpreter); ++ ++ /* Check if this is enough to classify the binary. */ ++ for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]); ++ ++j) ++ if (strcmp (program_interpreter, interpreters[j].soname) == 0) ++ { ++ *flag = interpreters[j].flag; ++ break; ++ } ++ break; ++ ++ case PT_NOTE: ++ if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) ++ { ++ Elf32_Word *abi_note = (Elf32_Word *) (file_contents ++ + segment->p_offset); ++ Elf32_Addr size = segment->p_filesz; ++ ++ while (abi_note [0] != 4 || abi_note [1] != 16 ++ || abi_note [2] != 1 ++ || memcmp (abi_note + 3, "GNU", 4) != 0) ++ { ++#define ROUND(len) (((len) + sizeof (Elf32_Word)) - 1) & -sizeof (Elf32_Word))) ++ Elf32_Addr) note_size = 3 * sizeof (Elf32_Word)) ++ + ROUND (abi_note[0]) ++ + ROUND (abi_note[1]); ++ ++ if (size - 32 < note_size || note_size == 0) ++ { ++ size = 0; ++ break; ++ } ++ size -= note_size; ++ abi_note = (void *) abi_note + note_size; ++ } ++ ++ if (size == 0) ++ break; ++ ++ *osversion = (abi_note [4] << 24) | ++ ((abi_note [5] & 0xff) << 16) | ++ ((abi_note [6] & 0xff) << 8) | ++ (abi_note [7] & 0xff); ++ } ++ break; ++ ++ default: ++ break; ++ } ++ ++ } ++ if (loadaddr == (Elf32_Addr) -1) ++ { ++ /* Very strange. */ ++ loadaddr = 0; ++ } ++ ++ /* Now we can read the dynamic sections. */ ++ if (dynamic_size == 0) ++ return 1; ++ ++ dynamic_segment = (Elf32_Dyn *) (file_contents + dynamic_addr); ++ check_ptr (dynamic_segment); ++ ++ /* Find the string table. */ ++ dynamic_strings = NULL; ++ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; ++ ++dyn_entry) ++ { ++ check_ptr (dyn_entry); ++ if (dyn_entry->d_tag == DT_STRTAB) ++ { ++ dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr); ++ check_ptr (dynamic_strings); ++ break; + } +- return 1; + } + ++ if (dynamic_strings == NULL) ++ return 1; ++ ++ /* Now read the DT_NEEDED and DT_SONAME entries. */ ++ for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; ++ ++dyn_entry) ++ { ++ if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME) ++ { ++ char *name = dynamic_strings + dyn_entry->d_un.d_val; ++ check_ptr (name); ++ ++ if (dyn_entry->d_tag == DT_NEEDED) ++ { ++ ++ if (*flag == FLAG_ELF) ++ { ++ /* Check if this is enough to classify the binary. */ ++ for (j = 0; ++ j < sizeof (known_libs) / sizeof (known_libs [0]); ++ ++j) ++ if (strcmp (name, known_libs [j].soname) == 0) ++ { ++ *flag = known_libs [j].flag; ++ break; ++ } ++ } ++ } ++ ++ else if (dyn_entry->d_tag == DT_SONAME) ++ *soname = xstrdup (name); ++ ++ /* Do we have everything we need? */ ++ if (*soname && *flag != FLAG_ELF) ++ return 0; ++ } ++ } ++ ++ /* We reach this point only if the file doesn't contain a DT_SONAME ++ or if we can't classify the library. If it doesn't have a ++ soname, return the name of the library. */ ++ if (*soname == NULL) ++ *soname = xstrdup (lib); ++ ++ return 0; ++} ++ ++int ++process_elf_file64 (const char *file_name, const char *lib, int *flag, ++ unsigned int *osversion, char **soname, void *file_contents, ++ size_t file_length) ++{ ++ int i; ++ unsigned int j; ++ Elf64_Addr loadaddr; ++ unsigned int dynamic_addr; ++ size_t dynamic_size; ++ char *program_interpreter; ++ ++ Elf64_Ehdr *elf_header; ++ Elf64_Phdr *elf_pheader, *segment; ++ Elf64_Dyn *dynamic_segment, *dyn_entry; ++ char *dynamic_strings; ++ ++ elf_header = (Elf64_Ehdr *) file_contents; ++ *osversion = 0; ++ + if (elf_header->e_type != ET_DYN) + { + error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, +@@ -81,7 +254,7 @@ process_elf_file (const char *file_name, + } + + /* Get information from elf program header. */ +- elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents); ++ elf_pheader = (Elf64_Phdr *) (elf_header->e_phoff + file_contents); + check_ptr (elf_pheader); + + /* The library is an elf library, now search for soname and +@@ -100,7 +273,7 @@ process_elf_file (const char *file_name, + switch (segment->p_type) + { + case PT_LOAD: +- if (loadaddr == (ElfW(Addr)) -1) ++ if (loadaddr == (Elf64_Addr) -1) + loadaddr = segment->p_vaddr - segment->p_offset; + break; + +@@ -129,16 +302,16 @@ process_elf_file (const char *file_name, + case PT_NOTE: + if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) + { +- ElfW(Word) *abi_note = (ElfW(Word) *) (file_contents ++ Elf64_Word *abi_note = (Elf64_Word *) (file_contents + + segment->p_offset); +- ElfW(Addr) size = segment->p_filesz; ++ Elf64_Addr size = segment->p_filesz; + + while (abi_note [0] != 4 || abi_note [1] != 16 + || abi_note [2] != 1 + || memcmp (abi_note + 3, "GNU", 4) != 0) + { +-#define ROUND(len) (((len) + sizeof (ElfW(Word)) - 1) & -sizeof (ElfW(Word))) +- ElfW(Addr) note_size = 3 * sizeof (ElfW(Word)) ++#define ROUND(len) (((len) + sizeof (Elf64_Word) - 1) & -sizeof (Elf64_Word)) ++ Elf64_Addr note_size = 3 * sizeof (Elf64_Word) + + ROUND (abi_note[0]) + + ROUND (abi_note[1]); + +@@ -166,7 +339,7 @@ process_elf_file (const char *file_name, + } + + } +- if (loadaddr == (ElfW(Addr)) -1) ++ if (loadaddr == (Elf64_Addr) -1) + { + /* Very strange. */ + loadaddr = 0; +@@ -176,7 +349,7 @@ process_elf_file (const char *file_name, + if (dynamic_size == 0) + return 1; + +- dynamic_segment = (ElfW(Dyn) *) (file_contents + dynamic_addr); ++ dynamic_segment = (Elf64_Dyn *) (file_contents + dynamic_addr); + check_ptr (dynamic_segment); + + /* Find the string table. */ +@@ -233,3 +406,33 @@ process_elf_file (const char *file_name, + + return 0; + } ++/* Returns 0 if everything is ok, != 0 in case of error. */ ++int ++process_elf_file (const char *file_name, const char *lib, int *flag, ++ unsigned int *osversion, char **soname, void *file_contents, ++ size_t file_length) ++{ ++ int i; ++ unsigned int j; ++ ElfW(Addr) loadaddr; ++ unsigned int dynamic_addr; ++ size_t dynamic_size; ++ char *program_interpreter; ++ ++ ElfW(Ehdr) *elf_header; ++ ElfW(Phdr) *elf_pheader, *segment; ++ ElfW(Dyn) *dynamic_segment, *dyn_entry; ++ char *dynamic_strings; ++ ++ elf_header = (ElfW(Ehdr) *) file_contents; ++ *osversion = 0; ++ ++ if (elf_header->e_ident [EI_CLASS] == ELFCLASS32) ++ return process_elf_file32(file_name, lib,flag, osversion, soname, file_contents, file_length); ++ else if (elf_header->e_ident [EI_CLASS] == ELFCLASS64) ++ return process_elf_file64(file_name, lib,flag, osversion, soname, file_contents, file_length); ++ error (0, 0, _("Unknown ELFCLASS in file %s.\n"), file_name); ++ return 1; ++} ++ ++ diff --git a/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/README b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/README new file mode 100644 index 0000000..43fb983 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/README @@ -0,0 +1,8 @@ +The files are pulled verbatim from glibc 2.5 and then patched to allow +standalone compilation of ldconfig. + +Richard Purdie +OpenedHand Ltd. + +Upgraded the ldconfig recipe to eglibc 2.12.1 +Nitin A Kamble 2011/03/29 diff --git a/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch new file mode 100644 index 0000000..7f8e4db --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/endian-ness_handling.patch @@ -0,0 +1,454 @@ +Upstream-Status: Inappropriate [embedded specific] + +Do data input/output handling according to endien-ness of the library file. That +enables use of ldconfig in the cross fashion for any architecture. + +2011/04/04 +Richard Purdie +Nitin Kamble + +Index: ldconfig-native-2.12.1/readelflib.c +=================================================================== +--- ldconfig-native-2.12.1.orig/readelflib.c ++++ ldconfig-native-2.12.1/readelflib.c +@@ -38,6 +38,28 @@ do \ + } \ + while (0); + ++int be; ++static uint16_t read16(uint16_t x, int be) ++{ ++ if (be) ++ return be16toh(x); ++ return le16toh(x); ++} ++ ++static uint32_t read32(uint32_t x, int be) ++{ ++ if (be) ++ return be32toh(x); ++ return le32toh(x); ++} ++ ++static uint64_t read64(uint64_t x, int be) ++{ ++ if (be) ++ return be64toh(x); ++ return le64toh(x); ++} ++ + /* Returns 0 if everything is ok, != 0 in case of error. */ + int + process_elf_file32 (const char *file_name, const char *lib, int *flag, +@@ -59,15 +81,17 @@ process_elf_file32 (const char *file_nam + elf_header = (Elf32_Ehdr *) file_contents; + *osversion = 0; + +- if (elf_header->e_type != ET_DYN) ++ be = (elf_header->e_ident[EI_DATA] == ELFDATA2MSB); ++ ++ if (read16(elf_header->e_type, be) != ET_DYN) + { + error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, +- elf_header->e_type); ++ read16(elf_header->e_type, be)); + return 1; + } + + /* Get information from elf program header. */ +- elf_pheader = (Elf32_Phdr *) (elf_header->e_phoff + file_contents); ++ elf_pheader = (Elf32_Phdr *) (read32(elf_header->e_phoff, be) + file_contents); + check_ptr (elf_pheader); + + /* The library is an elf library, now search for soname and +@@ -79,27 +103,27 @@ process_elf_file32 (const char *file_nam + dynamic_size = 0; + program_interpreter = NULL; + for (i = 0, segment = elf_pheader; +- i < elf_header->e_phnum; i++, segment++) ++ i < read16(elf_header->e_phnum, be); i++, segment++) + { + check_ptr (segment); + +- switch (segment->p_type) ++ switch (read32(segment->p_type, be)) + { + case PT_LOAD: + if (loadaddr == (Elf32_Addr) -1) +- loadaddr = segment->p_vaddr - segment->p_offset; ++ loadaddr = read32(segment->p_vaddr, be) - read32(segment->p_offset, be); + break; + + case PT_DYNAMIC: + if (dynamic_addr) + error (0, 0, _("more than one dynamic segment\n")); + +- dynamic_addr = segment->p_offset; +- dynamic_size = segment->p_filesz; ++ dynamic_addr = read32(segment->p_offset, be); ++ dynamic_size = read32(segment->p_filesz, be); + break; + + case PT_INTERP: +- program_interpreter = (char *) (file_contents + segment->p_offset); ++ program_interpreter = (char *) (file_contents + read32(segment->p_offset, be)); + check_ptr (program_interpreter); + + /* Check if this is enough to classify the binary. */ +@@ -113,20 +137,20 @@ process_elf_file32 (const char *file_nam + break; + + case PT_NOTE: +- if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) ++ if (!*osversion && read32(segment->p_filesz, be) >= 32 && segment->p_align >= 4) + { + Elf32_Word *abi_note = (Elf32_Word *) (file_contents +- + segment->p_offset); +- Elf32_Addr size = segment->p_filesz; ++ + read32(segment->p_offset, be)); ++ Elf32_Addr size = read32(segment->p_filesz, be); + +- while (abi_note [0] != 4 || abi_note [1] != 16 +- || abi_note [2] != 1 ++ while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16 ++ || read32(abi_note [2], be) != 1 + || memcmp (abi_note + 3, "GNU", 4) != 0) + { +-#define ROUND(len) (((len) + sizeof (Elf32_Word)) - 1) & -sizeof (Elf32_Word))) +- Elf32_Addr) note_size = 3 * sizeof (Elf32_Word)) +- + ROUND (abi_note[0]) +- + ROUND (abi_note[1]); ++#define ROUND(len) (((len) + sizeof (Elf32_Word) - 1) & -sizeof (Elf32_Word)) ++ Elf32_Addr note_size = 3 * sizeof (Elf32_Word) ++ + ROUND (read32(abi_note[0], be)) ++ + ROUND (read32(abi_note[1], be)); + + if (size - 32 < note_size || note_size == 0) + { +@@ -140,10 +164,10 @@ process_elf_file32 (const char *file_nam + if (size == 0) + break; + +- *osversion = (abi_note [4] << 24) | +- ((abi_note [5] & 0xff) << 16) | +- ((abi_note [6] & 0xff) << 8) | +- (abi_note [7] & 0xff); ++ *osversion = (read32(abi_note [4], be) << 24) | ++ ((read32(abi_note [5], be) & 0xff) << 16) | ++ ((read32(abi_note [6], be) & 0xff) << 8) | ++ (read32(abi_note [7], be) & 0xff); + } + break; + +@@ -167,13 +191,13 @@ process_elf_file32 (const char *file_nam + + /* Find the string table. */ + dynamic_strings = NULL; +- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; ++ for (dyn_entry = dynamic_segment; read32(dyn_entry->d_tag, be) != DT_NULL; + ++dyn_entry) + { + check_ptr (dyn_entry); +- if (dyn_entry->d_tag == DT_STRTAB) ++ if (read32(dyn_entry->d_tag, be) == DT_STRTAB) + { +- dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr); ++ dynamic_strings = (char *) (file_contents + read32(dyn_entry->d_un.d_val, be) - loadaddr); + check_ptr (dynamic_strings); + break; + } +@@ -183,15 +207,15 @@ process_elf_file32 (const char *file_nam + return 1; + + /* Now read the DT_NEEDED and DT_SONAME entries. */ +- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; ++ for (dyn_entry = dynamic_segment; read32(dyn_entry->d_tag, be) != DT_NULL; + ++dyn_entry) + { +- if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME) ++ if (read32(dyn_entry->d_tag, be) == DT_NEEDED || read32(dyn_entry->d_tag, be) == DT_SONAME) + { +- char *name = dynamic_strings + dyn_entry->d_un.d_val; ++ char *name = dynamic_strings + read32(dyn_entry->d_un.d_val, be); + check_ptr (name); + +- if (dyn_entry->d_tag == DT_NEEDED) ++ if (read32(dyn_entry->d_tag, be) == DT_NEEDED) + { + + if (*flag == FLAG_ELF) +@@ -208,7 +232,7 @@ process_elf_file32 (const char *file_nam + } + } + +- else if (dyn_entry->d_tag == DT_SONAME) ++ else if (read32(dyn_entry->d_tag, be) == DT_SONAME) + *soname = xstrdup (name); + + /* Do we have everything we need? */ +@@ -246,15 +270,17 @@ process_elf_file64 (const char *file_nam + elf_header = (Elf64_Ehdr *) file_contents; + *osversion = 0; + +- if (elf_header->e_type != ET_DYN) ++ be = (elf_header->e_ident[EI_DATA] == ELFDATA2MSB); ++ ++ if (read16(elf_header->e_type, be) != ET_DYN) + { + error (0, 0, _("%s is not a shared object file (Type: %d).\n"), file_name, +- elf_header->e_type); ++ read16(elf_header->e_type, be)); + return 1; + } + + /* Get information from elf program header. */ +- elf_pheader = (Elf64_Phdr *) (elf_header->e_phoff + file_contents); ++ elf_pheader = (Elf64_Phdr *) (read64(elf_header->e_phoff, be) + file_contents); + check_ptr (elf_pheader); + + /* The library is an elf library, now search for soname and +@@ -266,27 +292,27 @@ process_elf_file64 (const char *file_nam + dynamic_size = 0; + program_interpreter = NULL; + for (i = 0, segment = elf_pheader; +- i < elf_header->e_phnum; i++, segment++) ++ i < read16(elf_header->e_phnum, be); i++, segment++) + { + check_ptr (segment); + +- switch (segment->p_type) ++ switch (read32(segment->p_type, be)) + { + case PT_LOAD: + if (loadaddr == (Elf64_Addr) -1) +- loadaddr = segment->p_vaddr - segment->p_offset; ++ loadaddr = read64(segment->p_vaddr, be) - read64(segment->p_offset, be); + break; + + case PT_DYNAMIC: + if (dynamic_addr) + error (0, 0, _("more than one dynamic segment\n")); + +- dynamic_addr = segment->p_offset; +- dynamic_size = segment->p_filesz; ++ dynamic_addr = read64(segment->p_offset, be); ++ dynamic_size = read32(segment->p_filesz, be); + break; + + case PT_INTERP: +- program_interpreter = (char *) (file_contents + segment->p_offset); ++ program_interpreter = (char *) (file_contents + read64(segment->p_offset, be)); + check_ptr (program_interpreter); + + /* Check if this is enough to classify the binary. */ +@@ -300,20 +326,21 @@ process_elf_file64 (const char *file_nam + break; + + case PT_NOTE: +- if (!*osversion && segment->p_filesz >= 32 && segment->p_align >= 4) ++ if (!*osversion && read32(segment->p_filesz, be) >= 32 && read32(segment->p_align, be) >= 4) + { + Elf64_Word *abi_note = (Elf64_Word *) (file_contents +- + segment->p_offset); +- Elf64_Addr size = segment->p_filesz; ++ + read64(segment->p_offset, be)); ++ Elf64_Addr size = read32(segment->p_filesz, be); + +- while (abi_note [0] != 4 || abi_note [1] != 16 +- || abi_note [2] != 1 ++ while (read32(abi_note [0], be) != 4 || read32(abi_note [1], be) != 16 ++ || read32(abi_note [2], be) != 1 + || memcmp (abi_note + 3, "GNU", 4) != 0) + { ++#undef ROUND + #define ROUND(len) (((len) + sizeof (Elf64_Word) - 1) & -sizeof (Elf64_Word)) + Elf64_Addr note_size = 3 * sizeof (Elf64_Word) +- + ROUND (abi_note[0]) +- + ROUND (abi_note[1]); ++ + ROUND (read32(abi_note[0], be)) ++ + ROUND (read32(abi_note[1], be)); + + if (size - 32 < note_size || note_size == 0) + { +@@ -327,10 +354,10 @@ process_elf_file64 (const char *file_nam + if (size == 0) + break; + +- *osversion = (abi_note [4] << 24) | +- ((abi_note [5] & 0xff) << 16) | +- ((abi_note [6] & 0xff) << 8) | +- (abi_note [7] & 0xff); ++ *osversion = (read32(abi_note [4], be) << 24) | ++ ((read32(abi_note [5], be) & 0xff) << 16) | ++ ((read32(abi_note [6], be) & 0xff) << 8) | ++ (read32(abi_note [7], be) & 0xff); + } + break; + +@@ -354,13 +381,13 @@ process_elf_file64 (const char *file_nam + + /* Find the string table. */ + dynamic_strings = NULL; +- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; ++ for (dyn_entry = dynamic_segment; read64(dyn_entry->d_tag, be) != DT_NULL; + ++dyn_entry) + { + check_ptr (dyn_entry); +- if (dyn_entry->d_tag == DT_STRTAB) ++ if (read64(dyn_entry->d_tag, be) == DT_STRTAB) + { +- dynamic_strings = (char *) (file_contents + dyn_entry->d_un.d_val - loadaddr); ++ dynamic_strings = (char *) (file_contents + read64(dyn_entry->d_un.d_val, be) - loadaddr); + check_ptr (dynamic_strings); + break; + } +@@ -370,15 +397,15 @@ process_elf_file64 (const char *file_nam + return 1; + + /* Now read the DT_NEEDED and DT_SONAME entries. */ +- for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL; ++ for (dyn_entry = dynamic_segment; read64(dyn_entry->d_tag, be) != DT_NULL; + ++dyn_entry) + { +- if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME) ++ if (read64(dyn_entry->d_tag, be) == DT_NEEDED || read64(dyn_entry->d_tag, be) == DT_SONAME) + { +- char *name = dynamic_strings + dyn_entry->d_un.d_val; ++ char *name = dynamic_strings + read64(dyn_entry->d_un.d_val, be); + check_ptr (name); + +- if (dyn_entry->d_tag == DT_NEEDED) ++ if (read64(dyn_entry->d_tag, be) == DT_NEEDED) + { + + if (*flag == FLAG_ELF) +@@ -395,7 +422,7 @@ process_elf_file64 (const char *file_nam + } + } + +- else if (dyn_entry->d_tag == DT_SONAME) ++ else if (read64(dyn_entry->d_tag, be) == DT_SONAME) + *soname = xstrdup (name); + + /* Do we have everything we need? */ +Index: ldconfig-native-2.12.1/readlib.c +=================================================================== +--- ldconfig-native-2.12.1.orig/readlib.c ++++ ldconfig-native-2.12.1/readlib.c +@@ -169,7 +169,8 @@ process_file (const char *real_file_name + ret = 1; + } + /* Libraries have to be shared object files. */ +- else if (elf_header->e_type != ET_DYN) ++ else if ((elf_header->e_ident[EI_DATA] == ELFDATA2MSB && be16toh(elf_header->e_type) != ET_DYN) || ++ (elf_header->e_ident[EI_DATA] == ELFDATA2LSB && le16toh(elf_header->e_type) != ET_DYN)) + ret = 1; + else if (process_elf_file (file_name, lib, flag, osversion, soname, + file_contents, statbuf.st_size)) +Index: ldconfig-native-2.12.1/cache.c +=================================================================== +--- ldconfig-native-2.12.1.orig/cache.c ++++ ldconfig-native-2.12.1/cache.c +@@ -39,6 +39,29 @@ + # define N_(msgid) msgid + #define _(msg) msg + ++extern int be; ++ ++static uint16_t write16(uint16_t x, int be) ++{ ++ if (be) ++ return htobe16(x); ++ return htole16(x); ++} ++ ++static uint32_t write32(uint32_t x, int be) ++{ ++ if (be) ++ return htobe32(x); ++ return htole32(x); ++} ++ ++static uint64_t write64(uint64_t x, int be) ++{ ++ if (be) ++ return htobe64(x); ++ return htole64(x); ++} ++ + struct cache_entry + { + char *lib; /* Library name. */ +@@ -279,7 +302,12 @@ save_cache (const char *cache_name) + /* Number of normal cache entries. */ + int cache_entry_old_count = 0; + +- for (entry = entries; entry != NULL; entry = entry->next) ++ if (be) ++ printf("saving cache in big endian encoding\n"); ++ else ++ printf("saving cache in little endian encoding\n"); ++ ++ for (entry = entries; entry != NULL; entry = entry->next) + { + /* Account the final NULs. */ + total_strlen += strlen (entry->lib) + strlen (entry->path) + 2; +@@ -310,7 +338,7 @@ save_cache (const char *cache_name) + memset (file_entries, '\0', sizeof (struct cache_file)); + memcpy (file_entries->magic, CACHEMAGIC, sizeof CACHEMAGIC - 1); + +- file_entries->nlibs = cache_entry_old_count; ++ file_entries->nlibs = write32(cache_entry_old_count, be); + } + + struct cache_file_new *file_entries_new = NULL; +@@ -330,8 +358,8 @@ save_cache (const char *cache_name) + memcpy (file_entries_new->version, CACHE_VERSION, + sizeof CACHE_VERSION - 1); + +- file_entries_new->nlibs = cache_entry_count; +- file_entries_new->len_strings = total_strlen; ++ file_entries_new->nlibs = write32(cache_entry_count, be); ++ file_entries_new->len_strings = write32(total_strlen, be); + } + + /* Pad for alignment of cache_file_new. */ +@@ -358,9 +386,9 @@ save_cache (const char *cache_name) + /* First the library. */ + if (opt_format != 2 && entry->hwcap == 0) + { +- file_entries->libs[idx_old].flags = entry->flags; ++ file_entries->libs[idx_old].flags = write32(entry->flags, be); + /* XXX: Actually we can optimize here and remove duplicates. */ +- file_entries->libs[idx_old].key = str_offset + pad; ++ file_entries->libs[idx_old].key = write32(str_offset + pad, be); + } + if (opt_format != 0) + { +@@ -368,10 +396,10 @@ save_cache (const char *cache_name) + not doing so makes the code easier, the string table + always begins at the beginning of the the new cache + struct. */ +- file_entries_new->libs[idx_new].flags = entry->flags; +- file_entries_new->libs[idx_new].osversion = entry->osversion; +- file_entries_new->libs[idx_new].hwcap = entry->hwcap; +- file_entries_new->libs[idx_new].key = str_offset; ++ file_entries_new->libs[idx_new].flags = write32(entry->flags, be); ++ file_entries_new->libs[idx_new].osversion = write32(entry->osversion, be); ++ file_entries_new->libs[idx_new].hwcap = write64(entry->hwcap, be); ++ file_entries_new->libs[idx_new].key = write32(str_offset, be); + } + + size_t len = strlen (entry->lib) + 1; +@@ -379,9 +407,9 @@ save_cache (const char *cache_name) + str_offset += len; + /* Then the path. */ + if (opt_format != 2 && entry->hwcap == 0) +- file_entries->libs[idx_old].value = str_offset + pad; ++ file_entries->libs[idx_old].value = write32(str_offset + pad, be); + if (opt_format != 0) +- file_entries_new->libs[idx_new].value = str_offset; ++ file_entries_new->libs[idx_new].value = write32(str_offset, be); + len = strlen (entry->path) + 1; + str = mempcpy (str, entry->path, len); + str_offset += len; diff --git a/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/endianess-header.patch b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/endianess-header.patch new file mode 100644 index 0000000..a18b2c2 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/endianess-header.patch @@ -0,0 +1,113 @@ +Upstream-Status: Inappropriate [fix poky patch] + +This patch fixes build issues with a previous endian-ness_handling.patch on +distros that don't have macros referenced + +7/20/2011 +Matthew McClintock + +diff -purN ldconfig-native-2.12.1.orig/endian_extra.h ldconfig-native-2.12.1/endian_extra.h +--- ldconfig-native-2.12.1.orig/endian_extra.h 1969-12-31 18:00:00.000000000 -0600 ++++ ldconfig-native-2.12.1/endian_extra.h 2011-07-19 18:09:14.323048417 -0500 +@@ -0,0 +1,64 @@ ++/* Copyright (C) 1992, 1996, 1997, 2000, 2008 Free Software Foundation, Inc. ++ This file is part of the GNU C Library. ++ ++ The GNU C Library is free software; you can redistribute it and/or ++ modify it under the terms of the GNU Lesser General Public ++ License as published by the Free Software Foundation; either ++ version 2.1 of the License, or (at your option) any later version. ++ ++ The GNU C Library is distributed in the hope that it will be useful, ++ but WITHOUT ANY WARRANTY; without even the implied warranty of ++ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ Lesser General Public License for more details. ++ ++ You should have received a copy of the GNU Lesser General Public ++ License along with the GNU C Library; if not, write to the Free ++ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA ++ 02111-1307 USA. */ ++ ++#include ++ ++#ifndef _ENDIAN_EXTRA_H ++#define _ENDIAN_EXTRA_H 1 ++ ++/* Don't redefine these macros if they already exist */ ++#ifndef htobe16 ++#ifdef __USE_BSD ++/* Conversion interfaces. */ ++# include ++ ++# if __BYTE_ORDER == __LITTLE_ENDIAN ++# define htobe16(x) __bswap_16 (x) ++# define htole16(x) (x) ++# define be16toh(x) __bswap_16 (x) ++# define le16toh(x) (x) ++ ++# define htobe32(x) __bswap_32 (x) ++# define htole32(x) (x) ++# define be32toh(x) __bswap_32 (x) ++# define le32toh(x) (x) ++ ++# define htobe64(x) __bswap_64 (x) ++# define htole64(x) (x) ++# define be64toh(x) __bswap_64 (x) ++# define le64toh(x) (x) ++# else ++# define htobe16(x) (x) ++# define htole16(x) __bswap_16 (x) ++# define be16toh(x) (x) ++# define le16toh(x) __bswap_16 (x) ++ ++# define htobe32(x) (x) ++# define htole32(x) __bswap_32 (x) ++# define be32toh(x) (x) ++# define le32toh(x) __bswap_32 (x) ++ ++# define htobe64(x) (x) ++# define htole64(x) __bswap_64 (x) ++# define be64toh(x) (x) ++# define le64toh(x) __bswap_64 (x) ++# endif ++#endif ++#endif ++ ++#endif /* endian_extra.h */ +diff -purN ldconfig-native-2.12.1.orig/cache.c ldconfig-native-2.12.1/cache.c +--- ldconfig-native-2.12.1.orig/cache.c 2011-07-19 18:21:28.347041301 -0500 ++++ ldconfig-native-2.12.1/cache.c 2011-07-19 18:22:54.118048064 -0500 +@@ -39,6 +39,8 @@ + # define N_(msgid) msgid + #define _(msg) msg + ++#include "endian_extra.h" ++ + extern int be; + + static uint16_t write16(uint16_t x, int be) +diff -purN ldconfig-native-2.12.1.orig/readelflib.c ldconfig-native-2.12.1/readelflib.c +--- ldconfig-native-2.12.1.orig/readelflib.c 2011-07-19 18:21:28.346041593 -0500 ++++ ldconfig-native-2.12.1/readelflib.c 2011-07-19 18:23:05.324059875 -0500 +@@ -25,6 +25,9 @@ + + /* check_ptr checks that a pointer is in the mmaped file and doesn't + point outside it. */ ++ ++#include "endian_extra.h" ++ + #undef check_ptr + #define check_ptr(ptr) \ + do \ +diff -purN ldconfig-native-2.12.1.orig/readlib.c ldconfig-native-2.12.1/readlib.c +--- ldconfig-native-2.12.1.orig/readlib.c 2011-07-19 18:21:28.346041593 -0500 ++++ ldconfig-native-2.12.1/readlib.c 2011-07-19 18:23:23.877046210 -0500 +@@ -40,6 +40,8 @@ + + #include "ldconfig.h" + ++#include "endian_extra.h" ++ + #define _(msg) msg + + #define Elf32_CLASS ELFCLASS32 diff --git a/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch new file mode 100644 index 0000000..4e9aab9 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/flag_fix.patch @@ -0,0 +1,24 @@ +Upstream-Status: Inappropriate [embedded specific] + +The native version of ldconfig was using native definition of LD_SO (i.e. +ld-linux-x86-64.so.2 ) which is not correct for doing the cross ldconfig. +This was causing libc.so on the target marked as ELF lib rather than +FLAG_ELF_LIBC6 in the ld.so.cache. + +Nitin A Kamble 2011/04/4 + +Index: ldconfig-native-2.12.1/readlib.c +=================================================================== +--- ldconfig-native-2.12.1.orig/readlib.c ++++ ldconfig-native-2.12.1/readlib.c +@@ -51,6 +51,10 @@ struct known_names + int flag; + }; + ++/* don't use host's definition of LD_SO */ ++#undef LD_SO ++#define LD_SO "ld.so.1" ++ + static struct known_names interpreters[] = + { + { "/lib/" LD_SO, FLAG_ELF_LIBC6 }, diff --git a/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch new file mode 100644 index 0000000..5ed4f6f --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-default-to-all-multilib-dirs.patch @@ -0,0 +1,37 @@ +Upstream-Status: Inappropriate [embedded specific] + +make ldconfig default to both /lib+/usr/lib, /lib32+/usr/lib32 and +/lib64+/usr/lib64 on bi-ABI architectures. + +--- + ldconfig.c | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +diff -urpN a/ldconfig.c b/ldconfig.c +--- a/ldconfig.c ++++ b/ldconfig.c +@@ -52,7 +52,11 @@ + + #define SYSCONFDIR "/etc" + #define LIBDIR "/usr/lib" ++#define LIBDIR32 "/usr/lib32" ++#define LIBDIR64 "/usr/lib64" + #define SLIBDIR "/lib" ++#define SLIBDIR32 "/lib32" ++#define SLIBDIR64 "/lib64" + # define N_(msgid) msgid + #define _(msg) msg + +@@ -1373,6 +1377,12 @@ main (int argc, char **argv) + add_system_dir (SLIBDIR); + if (strcmp (SLIBDIR, LIBDIR)) + add_system_dir (LIBDIR); ++ add_system_dir (SLIBDIR32); ++ if (strcmp (SLIBDIR32, LIBDIR32)) ++ add_system_dir (LIBDIR32); ++ add_system_dir (SLIBDIR64); ++ if (strcmp (SLIBDIR64, LIBDIR64)) ++ add_system_dir (LIBDIR64); + } + + const char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE; diff --git a/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 new file mode 100644 index 0000000..dc1e798 Binary files /dev/null and b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig-native-2.12.1.tar.bz2 differ diff --git a/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch new file mode 100644 index 0000000..52986e6 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig.patch @@ -0,0 +1,471 @@ +Upstream-Status: Inappropriate [embedded specific] + +enable standalone building of ldconfig + +--- + cache.c | 11 +- + chroot_canon.c | 7 + + dl-cache.c | 235 --------------------------------------------------------- + dl-cache.h | 3 + ldconfig.c | 27 ++++-- + readlib.c | 7 + + xstrdup.c | 11 -- + 7 files changed, 45 insertions(+), 256 deletions(-) + +Index: ldconfig-native-2.12.1/cache.c +=================================================================== +--- ldconfig-native-2.12.1.orig/cache.c ++++ ldconfig-native-2.12.1/cache.c +@@ -16,6 +16,9 @@ + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + ++#define _LARGEFILE64_SOURCE ++#define _GNU_SOURCE ++ + #include + #include + #include +@@ -31,8 +34,10 @@ + #include + #include + +-#include +-#include ++#include "ldconfig.h" ++#include "dl-cache.h" ++# define N_(msgid) msgid ++#define _(msg) msg + + struct cache_entry + { +Index: ldconfig-native-2.12.1/chroot_canon.c +=================================================================== +--- ldconfig-native-2.12.1.orig/chroot_canon.c ++++ ldconfig-native-2.12.1/chroot_canon.c +@@ -17,6 +17,9 @@ + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + ++#define _LARGEFILE64_SOURCE ++#define _GNU_SOURCE ++ + #include + #include + #include +@@ -27,7 +30,9 @@ + #include + #include + +-#include ++#include "ldconfig.h" ++ ++#define __set_errno(Val) errno = (Val) + + #ifndef PATH_MAX + #define PATH_MAX 1024 +Index: ldconfig-native-2.12.1/dl-cache.c +=================================================================== +--- ldconfig-native-2.12.1.orig/dl-cache.c ++++ ldconfig-native-2.12.1/dl-cache.c +@@ -20,12 +20,12 @@ + + #include + #include +-#include ++//#include "ldsodefs.h" + #include + #include + #include + +-#include ++//#include "_itoa.h" + + #ifndef _DL_PLATFORMS_COUNT + # define _DL_PLATFORMS_COUNT 0 +@@ -39,103 +39,7 @@ static size_t cachesize; + /* 1 if cache_data + PTR points into the cache. */ + #define _dl_cache_verify_ptr(ptr) (ptr < cache_data_size) + +-#define SEARCH_CACHE(cache) \ +-/* We use binary search since the table is sorted in the cache file. \ +- The first matching entry in the table is returned. \ +- It is important to use the same algorithm as used while generating \ +- the cache file. */ \ +-do \ +- { \ +- left = 0; \ +- right = cache->nlibs - 1; \ +- \ +- while (left <= right) \ +- { \ +- __typeof__ (cache->libs[0].key) key; \ +- \ +- middle = (left + right) / 2; \ +- \ +- key = cache->libs[middle].key; \ +- \ +- /* Make sure string table indices are not bogus before using \ +- them. */ \ +- if (! _dl_cache_verify_ptr (key)) \ +- { \ +- cmpres = 1; \ +- break; \ +- } \ +- \ +- /* Actually compare the entry with the key. */ \ +- cmpres = _dl_cache_libcmp (name, cache_data + key); \ +- if (__builtin_expect (cmpres == 0, 0)) \ +- { \ +- /* Found it. LEFT now marks the last entry for which we \ +- know the name is correct. */ \ +- left = middle; \ +- \ +- /* There might be entries with this name before the one we \ +- found. So we have to find the beginning. */ \ +- while (middle > 0) \ +- { \ +- __typeof__ (cache->libs[0].key) key; \ +- \ +- key = cache->libs[middle - 1].key; \ +- /* Make sure string table indices are not bogus before \ +- using them. */ \ +- if (! _dl_cache_verify_ptr (key) \ +- /* Actually compare the entry. */ \ +- || _dl_cache_libcmp (name, cache_data + key) != 0) \ +- break; \ +- --middle; \ +- } \ +- \ +- do \ +- { \ +- int flags; \ +- __typeof__ (cache->libs[0]) *lib = &cache->libs[middle]; \ +- \ +- /* Only perform the name test if necessary. */ \ +- if (middle > left \ +- /* We haven't seen this string so far. Test whether the \ +- index is ok and whether the name matches. Otherwise \ +- we are done. */ \ +- && (! _dl_cache_verify_ptr (lib->key) \ +- || (_dl_cache_libcmp (name, cache_data + lib->key) \ +- != 0))) \ +- break; \ +- \ +- flags = lib->flags; \ +- if (_dl_cache_check_flags (flags) \ +- && _dl_cache_verify_ptr (lib->value)) \ +- { \ +- if (best == NULL || flags == GLRO(dl_correct_cache_id)) \ +- { \ +- HWCAP_CHECK; \ +- best = cache_data + lib->value; \ +- \ +- if (flags == GLRO(dl_correct_cache_id)) \ +- /* We've found an exact match for the shared \ +- object and no general `ELF' release. Stop \ +- searching. */ \ +- break; \ +- } \ +- } \ +- } \ +- while (++middle <= right); \ +- break; \ +- } \ +- \ +- if (cmpres < 0) \ +- left = middle + 1; \ +- else \ +- right = middle - 1; \ +- } \ +- } \ +-while (0) +- +- + int +-internal_function + _dl_cache_libcmp (const char *p1, const char *p2) + { + while (*p1 != '\0') +@@ -172,139 +76,3 @@ _dl_cache_libcmp (const char *p1, const + } + return *p1 - *p2; + } +- +- +-/* Look up NAME in ld.so.cache and return the file name stored there, +- or null if none is found. */ +- +-const char * +-internal_function +-_dl_load_cache_lookup (const char *name) +-{ +- int left, right, middle; +- int cmpres; +- const char *cache_data; +- uint32_t cache_data_size; +- const char *best; +- +- /* Print a message if the loading of libs is traced. */ +- if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0)) +- _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE); +- +- if (cache == NULL) +- { +- /* Read the contents of the file. */ +- void *file = _dl_sysdep_read_whole_file (LD_SO_CACHE, &cachesize, +- PROT_READ); +- +- /* We can handle three different cache file formats here: +- - the old libc5/glibc2.0/2.1 format +- - the old format with the new format in it +- - only the new format +- The following checks if the cache contains any of these formats. */ +- if (file != MAP_FAILED && cachesize > sizeof *cache +- && memcmp (file, CACHEMAGIC, sizeof CACHEMAGIC - 1) == 0) +- { +- size_t offset; +- /* Looks ok. */ +- cache = file; +- +- /* Check for new version. */ +- offset = ALIGN_CACHE (sizeof (struct cache_file) +- + cache->nlibs * sizeof (struct file_entry)); +- +- cache_new = (struct cache_file_new *) ((void *) cache + offset); +- if (cachesize < (offset + sizeof (struct cache_file_new)) +- || memcmp (cache_new->magic, CACHEMAGIC_VERSION_NEW, +- sizeof CACHEMAGIC_VERSION_NEW - 1) != 0) +- cache_new = (void *) -1; +- } +- else if (file != MAP_FAILED && cachesize > sizeof *cache_new +- && memcmp (file, CACHEMAGIC_VERSION_NEW, +- sizeof CACHEMAGIC_VERSION_NEW - 1) == 0) +- { +- cache_new = file; +- cache = file; +- } +- else +- { +- if (file != MAP_FAILED) +- __munmap (file, cachesize); +- cache = (void *) -1; +- } +- +- assert (cache != NULL); +- } +- +- if (cache == (void *) -1) +- /* Previously looked for the cache file and didn't find it. */ +- return NULL; +- +- best = NULL; +- +- if (cache_new != (void *) -1) +- { +- uint64_t platform; +- +- /* This is where the strings start. */ +- cache_data = (const char *) cache_new; +- +- /* Now we can compute how large the string table is. */ +- cache_data_size = (const char *) cache + cachesize - cache_data; +- +- platform = _dl_string_platform (GLRO(dl_platform)); +- if (platform != (uint64_t) -1) +- platform = 1ULL << platform; +- +-#define _DL_HWCAP_TLS_MASK (1LL << 63) +- uint64_t hwcap_exclude = ~((GLRO(dl_hwcap) & GLRO(dl_hwcap_mask)) +- | _DL_HWCAP_PLATFORM | _DL_HWCAP_TLS_MASK); +- +- /* Only accept hwcap if it's for the right platform. */ +-#define HWCAP_CHECK \ +- if (lib->hwcap & hwcap_exclude) \ +- continue; \ +- if (GLRO(dl_osversion) && lib->osversion > GLRO(dl_osversion)) \ +- continue; \ +- if (_DL_PLATFORMS_COUNT \ +- && (lib->hwcap & _DL_HWCAP_PLATFORM) != 0 \ +- && (lib->hwcap & _DL_HWCAP_PLATFORM) != platform) \ +- continue +- SEARCH_CACHE (cache_new); +- } +- else +- { +- /* This is where the strings start. */ +- cache_data = (const char *) &cache->libs[cache->nlibs]; +- +- /* Now we can compute how large the string table is. */ +- cache_data_size = (const char *) cache + cachesize - cache_data; +- +-#undef HWCAP_CHECK +-#define HWCAP_CHECK do {} while (0) +- SEARCH_CACHE (cache); +- } +- +- /* Print our result if wanted. */ +- if (__builtin_expect (GLRO_dl_debug_mask & DL_DEBUG_LIBS, 0) +- && best != NULL) +- _dl_debug_printf (" trying file=%s\n", best); +- +- return best; +-} +- +-#ifndef MAP_COPY +-/* If the system does not support MAP_COPY we cannot leave the file open +- all the time since this would create problems when the file is replaced. +- Therefore we provide this function to close the file and open it again +- once needed. */ +-void +-_dl_unload_cache (void) +-{ +- if (cache != NULL && cache != (struct cache_file *) -1) +- { +- __munmap (cache, cachesize); +- cache = NULL; +- } +-} +-#endif +Index: ldconfig-native-2.12.1/dl-cache.h +=================================================================== +--- ldconfig-native-2.12.1.orig/dl-cache.h ++++ ldconfig-native-2.12.1/dl-cache.h +@@ -101,5 +101,4 @@ struct cache_file_new + (((addr) + __alignof__ (struct cache_file_new) -1) \ + & (~(__alignof__ (struct cache_file_new) - 1))) + +-extern int _dl_cache_libcmp (const char *p1, const char *p2) +- internal_function; ++extern int _dl_cache_libcmp (const char *p1, const char *p2); +Index: ldconfig-native-2.12.1/ldconfig.c +=================================================================== +--- ldconfig-native-2.12.1.orig/ldconfig.c ++++ ldconfig-native-2.12.1/ldconfig.c +@@ -16,6 +16,9 @@ + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + ++#define _LARGEFILE64_SOURCE ++#define _GNU_SOURCE ++ + #define PROCINFO_CLASS static + #include + #include +@@ -39,10 +42,20 @@ + #include + #include + +-#include +-#include ++#include "ldconfig.h" ++#include "dl-cache.h" ++ ++#include "dl-procinfo.h" ++ ++#include "argp.h" ++ ++ ++#define SYSCONFDIR "/etc" ++#define LIBDIR "/usr/lib" ++#define SLIBDIR "/lib" ++# define N_(msgid) msgid ++#define _(msg) msg + +-#include + + #ifdef _DL_FIRST_PLATFORM + # define _DL_FIRST_EXTRA (_DL_FIRST_PLATFORM + _DL_PLATFORMS_COUNT) +@@ -55,7 +68,7 @@ + #endif + + /* Get libc version number. */ +-#include ++#include "version.h" + + #define PACKAGE _libc_intl_domainname + +@@ -152,8 +165,8 @@ static const struct argp_option options[ + { NULL, 0, NULL, 0, NULL, 0 } + }; + +-#define PROCINFO_CLASS static +-#include ++//#define PROCINFO_CLASS static ++//#include + + /* Short description of program. */ + static const char doc[] = N_("Configure Dynamic Linker Run Time Bindings."); +@@ -291,6 +304,7 @@ parse_opt (int key, char *arg, struct ar + return 0; + } + ++#define REPORT_BUGS_TO "mailing list : poky@yoctoproject.org" + /* Print bug-reporting information in the help message. */ + static char * + more_help (int key, const char *text, void *input) +@@ -315,7 +329,7 @@ For bug reporting instructions, please s + static void + print_version (FILE *stream, struct argp_state *state) + { +- fprintf (stream, "ldconfig %s%s\n", PKGVERSION, VERSION); ++ fprintf (stream, "ldconfig (Hacked Poky Version)\n"); + fprintf (stream, gettext ("\ + Copyright (C) %s Free Software Foundation, Inc.\n\ + This is free software; see the source for copying conditions. There is NO\n\ +@@ -1233,6 +1247,7 @@ set_hwcap (void) + hwcap_mask = strtoul (mask, NULL, 0); + } + ++const char _libc_intl_domainname[] = "libc"; + + int + main (int argc, char **argv) +Index: ldconfig-native-2.12.1/readlib.c +=================================================================== +--- ldconfig-native-2.12.1.orig/readlib.c ++++ ldconfig-native-2.12.1/readlib.c +@@ -22,6 +22,9 @@ + development version. Besides the simplification, it has also been + modified to read some other file formats. */ + ++#define _LARGEFILE64_SOURCE ++#define _GNU_SOURCE ++ + #include + #include + #include +@@ -35,7 +38,9 @@ + #include + #include + +-#include ++#include "ldconfig.h" ++ ++#define _(msg) msg + + #define Elf32_CLASS ELFCLASS32 + #define Elf64_CLASS ELFCLASS64 +Index: ldconfig-native-2.12.1/xstrdup.c +=================================================================== +--- ldconfig-native-2.12.1.orig/xstrdup.c ++++ ldconfig-native-2.12.1/xstrdup.c +@@ -16,15 +16,10 @@ + along with this program; if not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +-#ifdef HAVE_CONFIG_H +-# include +-#endif ++#define _GNU_SOURCE ++ ++#include + +-#if defined STDC_HEADERS || defined HAVE_STRING_H || _LIBC +-# include +-#else +-# include +-#endif + void *xmalloc (size_t n) __THROW; + char *xstrdup (char *string) __THROW; + diff --git a/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch new file mode 100644 index 0000000..27bc411 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/ldconfig-native-2.12.1/ldconfig_aux-cache_path_fix.patch @@ -0,0 +1,36 @@ +Upstream-Status: Pending + +Coming from this bug: http://sourceware.org/bugzilla/show_bug.cgi?id=11149 + +Nitin A Kamble 2011/03/29 + +--- ldconfig-native-2.12.1.orig/ldconfig.c ++++ ldconfig-native-2.12.1/ldconfig.c +@@ -1359,14 +1359,9 @@ main (int argc, char **argv) + + const char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE; + if (opt_chroot) +- { +- aux_cache_file = chroot_canon (opt_chroot, aux_cache_file); +- if (aux_cache_file == NULL) +- error (EXIT_FAILURE, errno, _("Can't open cache file %s\n"), +- _PATH_LDCONFIG_AUX_CACHE); +- } ++ aux_cache_file = chroot_canon (opt_chroot, aux_cache_file); + +- if (! opt_ignore_aux_cache) ++ if (! opt_ignore_aux_cache && aux_cache_file) + load_aux_cache (aux_cache_file); + else + init_aux_cache (); +@@ -1376,7 +1371,8 @@ main (int argc, char **argv) + if (opt_build_cache) + { + save_cache (cache_file); +- save_aux_cache (aux_cache_file); ++ if (aux_cache_file) ++ save_aux_cache (aux_cache_file); + } + + return 0; + diff --git a/meta-aspeed/recipes-core/eglibc/ldconfig-native_2.12.1.bb b/meta-aspeed/recipes-core/eglibc/ldconfig-native_2.12.1.bb new file mode 100644 index 0000000..75ffbf6 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/ldconfig-native_2.12.1.bb @@ -0,0 +1,32 @@ +SUMMARY = "A standalone native ldconfig build" + +LICENSE = "GPLv2+" + +LIC_FILES_CHKSUM = "file://${S}/ldconfig.c;endline=17;md5=1d15f20937c055cb5de2329a4c054399" + +SRC_URI = "file://ldconfig-native-2.12.1.tar.bz2 \ + file://ldconfig.patch \ + file://ldconfig_aux-cache_path_fix.patch \ + file://32and64bit.patch \ + file://endian-ness_handling.patch \ + file://flag_fix.patch \ + file://endianess-header.patch \ + file://ldconfig-default-to-all-multilib-dirs.patch \ +" + +PR = "r2" + +FILESPATH = "${FILE_DIRNAME}/${PN}-${PV}/" + +inherit native + +S = "${WORKDIR}/${PN}-${PV}" + +do_compile () { + $CC ldconfig.c -std=gnu99 chroot_canon.c xmalloc.c xstrdup.c cache.c readlib.c -I. dl-cache.c -o ldconfig +} + +do_install () { + install -d ${D}/${bindir}/ + install ldconfig ${D}/${bindir}/ +} diff --git a/meta-aspeed/recipes-core/eglibc/site_config/funcs b/meta-aspeed/recipes-core/eglibc/site_config/funcs new file mode 100644 index 0000000..ccc8539 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/site_config/funcs @@ -0,0 +1,474 @@ +a64l +abs +access +__adjtimex +alarm +alphasort +argz_append +__argz_count +argz_create_sep +argz_insert +__argz_next +argz_next +__argz_stringify +argz_stringify +asprintf +atexit +atof +atoi +bcmp +bcopy +bindresvport +bind_textdomain_codeset +btowc +bzero +calloc +canonicalize_file_name +catgets +cfgetospeed +cfsetispeed +cfsetspeed +chmod +chown +chroot +clock +close +closedir +closelog +confstr +connect +daemon +dcgettext +difftime +dirfd +dirname +dngettext +dup2 +ecvt +endgrent +endmntent +endpwent +endutent +endutxent +epoll_ctl +err +ether_hostton +ether_ntohost +euidaccess +execv +fchdir +fchmod +fchmodat +fchown +fchownat +fcntl +fcvt +fdatasync +fdopendir +feof_unlocked +fgets_unlocked +fgetxattr +finite +flistxattr +flock +flockfile +fnmatch +fork +fpathconf +__fpending +fprintf +free +freeaddrinfo +freeifaddrs +fseeko +__fsetlocking +fsetxattr +fstat64 +fstat +fstatfs +fsync +ftello +ftime +ftruncate +funlockfile +futimes +futimesat +gai_strerror +gcvt +getaddrinfo +getc_unlocked +getcwd +getdelim +getdomainname +getdtablesize +getegid +getenv +geteuid +getgid +getgrent +getgrent_r +getgrgid_r +getgrnam +getgrnam_r +getgrouplist +getgroups +gethostbyaddr_r +gethostbyname2 +gethostbyname +gethostbyname_r +gethostent +gethostid +gethostname +getifaddrs +getline +getloadavg +getmntent +getmsg +getnameinfo +getnetbyaddr_r +getnetgrent_r +getopt +getopt_long +getopt_long_only +getpagesize +getpass +getpeername +getpgrp +getpid +getppid +getprotoent_r +getpwent +getpwent_r +getpwnam +getpwnam_r +getpwuid +getpwuid_r +getresuid +getrlimit +getrusage +getservbyname +getservbyname_r +getservbyport_r +getservent +getservent_r +getspnam +getspnam_r +gettimeofday +getttyent +getttynam +getuid +getusershell +getutent +getutid +getutline +getutmp +getutmpx +getutxent +getutxid +getutxline +getwd +getxattr +glob +gmtime +gmtime_r +grantpt +group_member +herror +hstrerror +iconv +iconv_open +if_freenameindex +if_indextoname +if_nameindex +if_nametoindex +index +inet_addr +inet_aton +inet_ntoa +inet_ntop +inet_pton +initgroups +innetgr +iruserok +isascii +isatty +isblank +isgraph +isinf +isnan +isprint +isspace +iswalnum +iswcntrl +iswctype +iswprint +iswspace +iswupper +isxdigit +kill +killpg +lchown +lckpwdf +lgetxattr +link +listxattr +llistxattr +localtime +localtime_r +lockf +lrand48 +lsearch +lseek64 +lsetxattr +lstat +mallinfo +malloc +mblen +mbrlen +mbrtowc +mbsinit +mbsrtowcs +mbtowc +memalign +memchr +memcmp +memcpy +memmove +mempcpy +memrchr +memset +mkdir +mkdirat +mkdtemp +mkfifo +mknod +mkstemp64 +mkstemp +mktime +mlock +mmap +mtrace +munlock +munmap +nanosleep +nice +nl_langinfo +ntp_adjtime +ntp_gettime +_obstack_free +on_exit +open64 +open +openat +opendir +openlog +pathconf +pipe +poll +popen +posix_memalign +prctl +pread +printf +__progname +pselect +pthread_mutex_lock +ptsname +putenv +putgrent +putpwent +putspent +pututline +pututxline +putwc +pwrite +qsort +raise +rand +random +rand_r +read +readdir +readdir_r +readlink +realloc +realpath +re_comp +recvmsg +re_exec +regcomp +regexec +remove +rename +re_search +rmdir +rpmatch +rresvport_af +ruserok +ruserok_af +sbrk +scandir +sched_setscheduler +sched_yield +__secure_getenv +select +semctl +semget +sendmsg +setbuf +setbuffer +setegid +setenv +seteuid +setgid +setgroups +sethostname +setitimer +_setjmp +setjmp +setlinebuf +setlocale +setmntent +setpgid +setpgrp +setpriority +setregid +setresgid +setresuid +setreuid +setrlimit +setsid +setsockopt +settimeofday +setuid +setutent +setutxent +setvbuf +setxattr +sgetspent +shmat +shmctl +shmdt +shmget +shutdown +sigaction +sigaddset +sigaltstack +sigblock +sigemptyset +sighold +siginterrupt +signal +sigprocmask +sigset +sigsetmask +sigstack +sigsuspend +sigvec +snprintf +socket +socketpair +sprintf +srand48 +srand +srandom +sscanf +stat +statfs +statvfs +stime +stpcpy +strcasecmp +strcasestr +strchr +strchrnul +strcmp +strcspn +strdup +strerror +strerror_r +strftime +strlen +strncasecmp +strncmp +strndup +strnlen +strpbrk +strptime +strrchr +strsep +strsignal +strspn +strstr +strtod +strtoimax +strtok_r +strtol +strtoll +strtoul +strtoull +strtoumax +strverscmp +strxfrm +symlink +sync +sysconf +sysctl +sysinfo +syslog +_sys_siglist +sys_siglist +system +tcgetattr +tcgetpgrp +tcsetattr +tcsetpgrp +time +timegm +times +timezone +tmpnam +towlower +towupper +truncate +tsearch +ttyname +tzset +ulimit +umask +uname +unlink +unsetenv +unshare +updwtmp +updwtmpx +usleep +ustat +utime +utimes +utmpname +utmpxname +valloc +vasprintf +verrx +vfork +vfprintf +vfscanf +vhangup +vprintf +vsnprintf +vsprintf +wait3 +wait4 +waitpid +wcrtomb +wcscoll +wcsdup +wcslen +wctob +wctomb +wctype +wcwidth +wmemchr +wmemcpy +wmempcpy diff --git a/meta-aspeed/recipes-core/eglibc/site_config/headers b/meta-aspeed/recipes-core/eglibc/site_config/headers new file mode 100644 index 0000000..609ab53 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/site_config/headers @@ -0,0 +1,156 @@ +aio.h +alloca.h +argz.h +arpa/inet.h +arpa/nameser.h +asm/byteorder.h +asm/ioctls.h +asm/page.h +asm/types.h +assert.h +byteswap.h +crypt.h +ctype.h +dirent.h +dlfcn.h +elf.h +endian.h +err.h +errno.h +execinfo.h +fcntl.h +features.h +float.h +fstab.h +ftw.h +getopt.h +glob.h +grp.h +iconv.h +ifaddrs.h +inttypes.h +langinfo.h +lastlog.h +libgen.h +libintl.h +limits.h +linux/capability.h +linux/fd.h +linux/fs.h +linux/hayesesp.h +linux/hdreg.h +linux/icmp.h +linux/in6.h +linux/joystick.h +linux/ptrace.h +linux/serial.h +linux/sonypi.h +linux/unistd.h +linux/utsname.h +linux/version.h +locale.h +malloc.h +math.h +mcheck.h +memory.h +mntent.h +mqueue.h +netdb.h +net/if.h +netinet/ether.h +netinet/in.h +netinet/ip6.h +netinet/ip.h +netinet/tcp.h +netinet/udp.h +netipx/ipx.h +net/route.h +paths.h +poll.h +pthread.h +pty.h +pwd.h +regex.h +resolv.h +rpc/rpc.h +rpc/types.h +sched.h +scsi/scsi.h +search.h +semaphore.h +setjmp.h +sgtty.h +shadow.h +signal.h +stdarg.h +stdbool.h +stdc +stddef.h +stdint.h +stdio.h +stdlib.h +string.h +strings.h +stropts.h +sys/bitypes.h +sys/cdefs.h +sys/dir.h +sys/epoll.h +sysexits.h +sys/fcntl.h +sys/file.h +sys/fsuid.h +sys/ioctl.h +sys/ipc.h +syslog.h +sys/mman.h +sys/mount.h +sys/mtio.h +sys/param.h +sys/poll.h +sys/prctl.h +sys/ptrace.h +sys/queue.h +sys/reg.h +sys/resource.h +sys/select.h +sys/sem.h +sys/shm.h +sys/signal.h +sys/socket.h +sys/socketvar.h +sys/soundcard.h +sys/statfs.h +sys/stat.h +sys/statvfs.h +sys/stropts.h +sys/swap.h +sys/sysctl.h +sys/sysinfo.h +sys/sysmacros.h +sys/termios.h +sys/timeb.h +sys/time.h +sys/times.h +sys/timex.h +sys/types.h +sys/uio.h +sys/un.h +sys/unistd.h +sys/user.h +sys/utsname.h +sys/vfs.h +sys/wait.h +termio.h +termios.h +time.h +ttyent.h +ulimit.h +unistd.h +ustat.h +utime.h +utmp.h +utmpx.h +values.h +wchar.h +wctype.h diff --git a/meta-aspeed/recipes-core/eglibc/site_config/types b/meta-aspeed/recipes-core/eglibc/site_config/types new file mode 100644 index 0000000..178bd85 --- /dev/null +++ b/meta-aspeed/recipes-core/eglibc/site_config/types @@ -0,0 +1,21 @@ +char +char * +double +float +int +long +long double +long int +long long +long long int +short +short int +signed char +unsigned char +unsigned int +unsigned long +unsigned long int +unsigned long long int +unsigned short +unsigned short int +void * diff --git a/meta-aspeed/recipes-kernel/linux/files/patch-2.6.28.9/0033-Linux-snapshot-of-OpenBMC-f926614.patch b/meta-aspeed/recipes-kernel/linux/files/patch-2.6.28.9/0033-Linux-snapshot-of-OpenBMC-f926614.patch new file mode 100644 index 0000000..4e4c76e --- /dev/null +++ b/meta-aspeed/recipes-kernel/linux/files/patch-2.6.28.9/0033-Linux-snapshot-of-OpenBMC-f926614.patch @@ -0,0 +1,978 @@ +diff --git a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/arch/arm/plat-aspeed/dev-i2c.c b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/arch/arm/plat-aspeed/dev-i2c.c +index fffa480..a6f75b1 100644 +--- a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/arch/arm/plat-aspeed/dev-i2c.c ++++ b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/arch/arm/plat-aspeed/dev-i2c.c +@@ -634,6 +634,9 @@ static struct i2c_board_info __initdata wedge100_i2c_bus5[] = { + { + I2C_BOARD_INFO("fb_panther_plus", 0x40), + }, ++ { ++ I2C_BOARD_INFO("com_e_driver", 0x33), ++ } + }; + + static struct i2c_board_info __initdata wedge100_i2c_bus6[] = { +@@ -767,11 +770,17 @@ static struct i2c_board_info __initdata ast_i2c_board_info_11[] = { + //Under I2C Dev 12 + static struct i2c_board_info __initdata ast_i2c_board_info_12[] = { + // Mezz Card LAN_SMB bus (PHY, Temp. Sensor) ++ { ++ //I2C_BOARD_INFO("tmp75", 0x1f), ++ }, + }; + + //Under I2C Dev 13 + static struct i2c_board_info __initdata ast_i2c_board_info_13[] = { + // Mezz Card Mezz_SMB bus (FRUID, GPIO expander, QSFP+) ++ { ++ I2C_BOARD_INFO("24c64", 0x51), ++ }, + }; + + /* end of CONFIG_YOSEMITE */ +diff --git a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/hwmon/ast_adc.c b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/hwmon/ast_adc.c +index 8f5aa54..e21d52e 100644 +--- a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/hwmon/ast_adc.c ++++ b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/hwmon/ast_adc.c +@@ -525,7 +525,7 @@ ast_show_adc(struct device *dev, struct device_attribute *attr, char *sysfsbuf) + break; + case 1: //value + voltage = ast_get_voltage(sensor_attr->index); +- return sprintf(sysfsbuf, "%d.%d (V)\n",voltage/100, voltage%100); ++ return sprintf(sysfsbuf, "%d.%02d (V)\n",voltage/100, voltage%100); + break; + case 2: //alarm + return sprintf(sysfsbuf, "%d \n", ast_get_adc_alarm(ast_adc,sensor_attr->index)); +diff --git a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/i2c/busses/i2c-ast.c b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/i2c/busses/i2c-ast.c +index 9bb3154..48f0192 100644 +--- a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/i2c/busses/i2c-ast.c ++++ b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/i2c/busses/i2c-ast.c +@@ -49,14 +49,22 @@ + /***************************************************************************/ + + #ifdef CONFIG_AST_I2C_SLAVE_RDWR +-#define I2C_S_BUF_SIZE 64 +-#define I2C_S_RX_BUF_NUM 4 ++#define I2C_S_BUF_SIZE 256 ++#define I2C_S_RX_BUF_NUM 20 + #define BUFF_FULL 0xff00 + #define BUFF_ONGOING 1 + #endif + + #define AST_LOCKUP_DETECTED (0x1 << 15) + ++// Enable SCL/SDA pull LOW detection for Yosemite platform ++#ifdef CONFIG_YOSEMITE ++#define AST_I2C_LOW_TIMEOUT 0x07 ++#else ++#define AST_I2C_LOW_TIMEOUT 0x00 ++#endif //CONFIG_YOSEMITE ++ ++ + struct ast_i2c_dev { + struct ast_i2c_driver_data *ast_i2c_data; + struct device *dev; +@@ -192,12 +200,12 @@ static void ast_i2c_dev_init(struct ast_i2c_dev *i2c_dev) + , I2C_FUN_CTRL_REG); + + /* Set AC Timing */ +- ast_i2c_write(i2c_dev, 0x3, I2C_AC_TIMING_REG2); ++ ast_i2c_write(i2c_dev, AST_I2C_LOW_TIMEOUT, I2C_AC_TIMING_REG2); + ast_i2c_write(i2c_dev, select_i2c_clock(i2c_dev), I2C_AC_TIMING_REG1); + }else { + /* target apeed is xxKhz*/ + ast_i2c_write(i2c_dev, select_i2c_clock(i2c_dev), I2C_AC_TIMING_REG1); +- ast_i2c_write(i2c_dev, AST_NO_TIMEOUT_CTRL, I2C_AC_TIMING_REG2); ++ ast_i2c_write(i2c_dev, AST_I2C_LOW_TIMEOUT, I2C_AC_TIMING_REG2); + } + #else + /* target apeed is xxKhz*/ +@@ -252,6 +260,7 @@ static void ast_i2c_slave_buff_init(struct ast_i2c_dev *i2c_dev) + static void ast_i2c_slave_rdwr_xfer(struct ast_i2c_dev *i2c_dev) + { + int i; ++ int count = 0; + unsigned long flags; + + spin_lock_irqsave(&i2c_dev->slave_rx_lock, flags); +@@ -265,15 +274,31 @@ static void ast_i2c_slave_rdwr_xfer(struct ast_i2c_dev *i2c_dev) + } + } + if(i == I2C_S_RX_BUF_NUM) { +- printk("RX buffer full ........use tmp msgs buff \n"); +- //TODO... ++ // dev_err(i2c_dev->dev, "RX buffer full ........use tmp msgs buff \n"); ++ for(i=0; islave_rx_msg[i].flags == 0) && (i2c_dev->slave_rx_msg[i].addr == BUFF_ONGOING)) { ++ count++; ++ i2c_dev->slave_rx_msg[i].addr = 0; ++ } ++ } ++ ++ if (count) { ++ dev_err(i2c_dev->dev, "Cleared slave ongoing buffers of count: %d\n", count); ++ } ++ ++ for(i=0; islave_rx_msg[i].flags == 0) && (i2c_dev->slave_rx_msg[i].addr != BUFF_ONGOING)) { ++ i2c_dev->slave_rx_msg[i].addr = BUFF_ONGOING; ++ break; ++ } ++ } + } + //printk("I2C_SLAVE_EVENT_START_WRITE ... %d \n", i); + + i2c_dev->slave_msgs = &i2c_dev->slave_rx_msg[i]; + break; + case I2C_SLAVE_EVENT_START_READ: +- //printk("I2C_SLAVE_EVENT_START_READ ERROR .. not imple \n"); ++ // printk("I2C_SLAVE_EVENT_START_READ ERROR .. not imple \n"); + i2c_dev->slave_msgs = &i2c_dev->slave_tx_msg; + break; + case I2C_SLAVE_EVENT_WRITE: +@@ -379,17 +404,17 @@ ast_i2c_bus_error_recover(struct ast_i2c_dev *i2c_dev) + + if ((sts & AST_I2CD_SDA_LINE_STS) && (sts & AST_I2CD_SCL_LINE_STS)) { + //Means bus is idle. +- dev_dbg(i2c_dev->dev, "I2C bus (%d) is idle. I2C slave doesn't exist?!\n", i2c_dev->bus_id); ++ dev_err(i2c_dev->dev, "I2C bus (%d) is idle. I2C slave doesn't exist?!\n", i2c_dev->bus_id); + return -1; + } + +- dev_dbg(i2c_dev->dev, "ERROR!! I2C(%d) bus hanged, try to recovery it!\n", i2c_dev->bus_id); ++ dev_err(i2c_dev->dev, "ERROR!! I2C(%d) bus hanged, try to recovery it!\n", i2c_dev->bus_id); + + + if ((sts & AST_I2CD_SDA_LINE_STS) && !(sts & AST_I2CD_SCL_LINE_STS)) { + //if SDA == 1 and SCL == 0, it means the master is locking the bus. + //Send a stop command to unlock the bus. +- dev_dbg(i2c_dev->dev, "I2C's master is locking the bus, try to stop it.\n"); ++ dev_err(i2c_dev->dev, "I2C's master is locking the bus, try to stop it.\n"); + // + init_completion(&i2c_dev->cmd_complete); + i2c_dev->cmd_err = 0; +@@ -401,15 +426,15 @@ ast_i2c_bus_error_recover(struct ast_i2c_dev *i2c_dev) + + if(i2c_dev->cmd_err && + i2c_dev->cmd_err != AST_I2CD_INTR_STS_NORMAL_STOP) { +- dev_dbg(i2c_dev->dev, "recovery error \n"); ++ dev_err(i2c_dev->dev, "recovery error \n"); + return -1; + } + + if (r == 0) { +- dev_dbg(i2c_dev->dev, "recovery timed out\n"); ++ dev_err(i2c_dev->dev, "recovery timed out\n"); + return -1; + } else { +- dev_dbg(i2c_dev->dev, "Recovery successfully\n"); ++ dev_err(i2c_dev->dev, "Recovery successfully\n"); + return 0; + } + +@@ -417,19 +442,20 @@ ast_i2c_bus_error_recover(struct ast_i2c_dev *i2c_dev) + } else if (!(sts & AST_I2CD_SDA_LINE_STS)) { + //else if SDA == 0, the device is dead. We need to reset the bus + //And do the recovery command. +- dev_dbg(i2c_dev->dev, "I2C's slave is dead, try to recover it\n"); ++ dev_err(i2c_dev->dev, "I2C's slave is dead, try to recover it\n"); + //Let's retry 10 times + for (i = 0; i < 10; i++) { + ast_i2c_dev_init(i2c_dev); + //Do the recovery command BIT11 + init_completion(&i2c_dev->cmd_complete); ++ i2c_dev->cmd_err = 0; + ast_i2c_write(i2c_dev, AST_I2CD_BUS_RECOVER_CMD_EN, I2C_CMD_REG); + + r = wait_for_completion_interruptible_timeout(&i2c_dev->cmd_complete, + i2c_dev->adap.timeout*HZ); + if (i2c_dev->cmd_err != 0 && + i2c_dev->cmd_err != AST_I2CD_INTR_STS_NORMAL_STOP) { +- dev_dbg(i2c_dev->dev, "ERROR!! Failed to do recovery command(0x%08x)\n", i2c_dev->cmd_err); ++ dev_err(i2c_dev->dev, "ERROR!! Failed to do recovery command(0x%08x)\n", i2c_dev->cmd_err); + return -1; + } + //Check 0x14's SDA and SCL status +@@ -438,14 +464,14 @@ ast_i2c_bus_error_recover(struct ast_i2c_dev *i2c_dev) + break; + } + if (i == 10) { +- dev_dbg(i2c_dev->dev, "ERROR!! recover failed\n"); ++ dev_err(i2c_dev->dev, "ERROR!! recover failed\n"); + return -1; + } + } else { +- dev_dbg(i2c_dev->dev, "Don't know how to handle this case?!\n"); ++ dev_err(i2c_dev->dev, "Don't know how to handle this case?!\n"); + return -1; + } +- dev_dbg(i2c_dev->dev, "Recovery successfully\n"); ++ dev_err(i2c_dev->dev, "Recovery successfully\n"); + return 0; + } + +@@ -472,7 +498,8 @@ static int ast_i2c_wait_bus_not_busy(struct ast_i2c_dev *i2c_dev) + } + + if (timeout <= 0) { +- return -EAGAIN; ++ //TODO: sometimes the slave operation flag is not reset properly so go ahead with checking bus busy signal ++ dev_err(i2c_dev->dev, "slave operation set, check busy status line\n"); + } + + // Wait for Bus to go IDLE +@@ -491,6 +518,8 @@ static int ast_i2c_wait_bus_not_busy(struct ast_i2c_dev *i2c_dev) + return 0; + } + ++ // TODO: hack to reset slave operation flag manually ++ i2c_dev->slave_operation = 0; + return 0; + } + +@@ -499,9 +528,6 @@ static void ast_i2c_do_dma_xfer(struct ast_i2c_dev *i2c_dev) + u32 cmd = 0; + int i; + +- i2c_dev->master_xfer_mode = DMA_XFER; +- i2c_dev->slave_xfer_mode = DMA_XFER; +- + if(i2c_dev->slave_operation == 1) { + if(i2c_dev->slave_msgs->flags & I2C_M_RD) { + //DMA tx mode +@@ -683,9 +709,6 @@ static void ast_i2c_do_pool_xfer(struct ast_i2c_dev *i2c_dev) + int i; + u32 *tx_buf; + +- i2c_dev->master_xfer_mode = BUFF_XFER; +- i2c_dev->slave_xfer_mode = BUFF_XFER; +- + #if defined(CONFIG_ARCH_AST2400) + ast_i2c_write(i2c_dev, + (ast_i2c_read(i2c_dev, I2C_FUN_CTRL_REG) & +@@ -872,12 +895,6 @@ static void ast_i2c_do_byte_xfer(struct ast_i2c_dev *i2c_dev) + u8 *xfer_buf; + u32 cmd = 0; + +- i2c_dev->master_xfer_mode = BYTE_XFER; +- i2c_dev->master_xfer_len = 1; +- +- i2c_dev->slave_xfer_mode = BYTE_XFER; +- i2c_dev->slave_xfer_len = 1; +- + if(i2c_dev->slave_operation == 1) { + dev_dbg(i2c_dev->dev,"S cnt %d, xf len %d \n",i2c_dev->slave_xfer_cnt, i2c_dev->slave_msgs->len); + if(i2c_dev->slave_msgs->flags & I2C_M_RD) { +@@ -973,14 +990,16 @@ static void ast_i2c_slave_xfer_done(struct ast_i2c_dev *i2c_dev) + u32 xfer_len; + int i; + u8 *rx_buf; ++ unsigned long flags; + + dev_dbg(i2c_dev->dev, "ast_i2c_slave_xfer_done [%d]\n",i2c_dev->slave_xfer_mode); + ++ + if (i2c_dev->slave_msgs->flags & I2C_M_RD) { + //tx done , only check tx count ... +- if(i2c_dev->master_xfer_mode == BYTE_XFER) { ++ if(i2c_dev->slave_xfer_mode == BYTE_XFER) { + xfer_len = 1; +- } else if (i2c_dev->master_xfer_mode == BUFF_XFER) { ++ } else if (i2c_dev->slave_xfer_mode == BUFF_XFER) { + xfer_len = AST_I2CD_TX_DATA_BUF_GET(ast_i2c_read(i2c_dev, I2C_BUF_CTRL_REG)); + xfer_len++; + dev_dbg(i2c_dev->dev,"S tx buff done len %d \n",xfer_len); +@@ -1004,10 +1023,12 @@ static void ast_i2c_slave_xfer_done(struct ast_i2c_dev *i2c_dev) + i2c_dev->slave_msgs->buf[i2c_dev->slave_xfer_cnt] = 0; + i2c_dev->slave_msgs->len = i2c_dev->slave_xfer_cnt; + } else { ++ if (i2c_dev->slave_xfer_cnt == 0) ++ dev_err(i2c_dev->dev,"Possible first byte failure issue\n"); + i2c_dev->slave_msgs->buf[i2c_dev->slave_xfer_cnt] = ast_i2c_read(i2c_dev,I2C_BYTE_BUF_REG) >> 8; + } + dev_dbg(i2c_dev->dev,"rx buff %d, [%x] \n",i2c_dev->slave_xfer_cnt ,i2c_dev->slave_msgs->buf[i2c_dev->slave_xfer_cnt]); +- } else if (i2c_dev->master_xfer_mode == BUFF_XFER) { ++ } else if (i2c_dev->slave_xfer_mode == BUFF_XFER) { + xfer_len = AST_I2CD_RX_BUF_ADDR_GET(ast_i2c_read(i2c_dev, I2C_BUF_CTRL_REG)); + if(xfer_len == 0) + xfer_len = AST_I2C_PAGE_SIZE; +@@ -1056,7 +1077,7 @@ static void ast_i2c_slave_xfer_done(struct ast_i2c_dev *i2c_dev) + i2c_dev->slave_xfer_cnt = 0; + } else { + if(i2c_dev->slave_xfer_cnt == i2c_dev->slave_msgs->len) { +- dev_dbg(i2c_dev->dev,"slave next msgs \n"); ++ dev_err(i2c_dev->dev,"slave next msgs with len %d\n", i2c_dev->slave_xfer_cnt); + #ifdef CONFIG_AST_I2C_SLAVE_RDWR + ast_i2c_slave_rdwr_xfer(i2c_dev); + #else +@@ -1068,6 +1089,8 @@ static void ast_i2c_slave_xfer_done(struct ast_i2c_dev *i2c_dev) + i2c_dev->do_slave_xfer(i2c_dev); + } + ++ // Read the current state for clearing up the slave mode ++ i2c_dev->state = (ast_i2c_read(i2c_dev,I2C_CMD_REG) >> 19) & 0xf; + + if(AST_I2CD_IDLE == i2c_dev->state) { + dev_dbg(i2c_dev->dev,"** Slave go IDLE **\n"); +@@ -1077,7 +1100,10 @@ static void ast_i2c_slave_xfer_done(struct ast_i2c_dev *i2c_dev) + i2c_dev->ast_i2c_data->free_pool_buff_page(i2c_dev->req_page); + } + +- } ++ } else if (i2c_dev->slave_event == I2C_SLAVE_EVENT_STOP) { ++ // TODO: hack to reset slave operation flag in case the stop is received ++ i2c_dev->slave_operation = 0; ++ } + + } + +@@ -1212,6 +1238,8 @@ unlock_out: + static void ast_i2c_slave_addr_match(struct ast_i2c_dev *i2c_dev) + { + u8 match; ++ unsigned long flags; ++ + + i2c_dev->slave_operation = 1; + i2c_dev->slave_xfer_cnt = 0; +@@ -1219,7 +1247,6 @@ static void ast_i2c_slave_addr_match(struct ast_i2c_dev *i2c_dev) + i2c_dev->slave_msgs->buf[0] = match; + dev_dbg(i2c_dev->dev, "S Start Addr match [%x] \n",match); + +- + if(match & 1) { + i2c_dev->slave_event = I2C_SLAVE_EVENT_START_READ; + } else { +@@ -1228,23 +1255,33 @@ static void ast_i2c_slave_addr_match(struct ast_i2c_dev *i2c_dev) + + #ifdef CONFIG_AST_I2C_SLAVE_RDWR + ast_i2c_slave_rdwr_xfer(i2c_dev); +- i2c_dev->slave_msgs->buf[0] = match; +- i2c_dev->slave_xfer_cnt = 1; ++ i2c_dev->slave_msgs->buf[0] = match; ++ i2c_dev->slave_xfer_cnt = 1; ++ // Reset the length field as we have received new slave address match ++ i2c_dev->slave_msgs->len = 0x0; + #else + i2c_dev->ast_i2c_data->slave_xfer(i2c_dev->slave_event, &(i2c_dev->slave_msgs)); + i2c_dev->slave_xfer_cnt = 0; + #endif + +- //request +- if(i2c_dev->ast_i2c_data->slave_dma == BYTE_MODE) ++ //request: set slave_xfer_mode properly based on slave_dma mode ++ if(i2c_dev->ast_i2c_data->slave_dma == BYTE_MODE) { + i2c_dev->do_slave_xfer = ast_i2c_do_byte_xfer; +- else if (i2c_dev->ast_i2c_data->slave_dma == DMA_MODE) ++ i2c_dev->slave_xfer_mode = BYTE_XFER; ++ i2c_dev->slave_xfer_len = 1; ++ } else if (i2c_dev->ast_i2c_data->slave_dma == DMA_MODE) { + i2c_dev->do_slave_xfer = ast_i2c_do_dma_xfer; +- else { +- if(i2c_dev->ast_i2c_data->request_pool_buff_page(&(i2c_dev->req_page)) == 0) ++ i2c_dev->slave_xfer_mode = DMA_XFER; ++ } else { ++ if(i2c_dev->ast_i2c_data->request_pool_buff_page(&(i2c_dev->req_page)) == 0) { + i2c_dev->do_slave_xfer = ast_i2c_do_pool_xfer; +- else ++ i2c_dev->slave_xfer_mode = BUFF_XFER; ++ } else { + i2c_dev->do_slave_xfer = ast_i2c_do_byte_xfer; ++ dev_err(i2c_dev->dev,"i2cdriver: pool request failed for slave\n"); ++ i2c_dev->slave_xfer_mode = BYTE_XFER; ++ i2c_dev->slave_xfer_len = 1; ++ } + } + + i2c_dev->do_slave_xfer(i2c_dev); +@@ -1254,6 +1291,7 @@ static void ast_i2c_slave_addr_match(struct ast_i2c_dev *i2c_dev) + static irqreturn_t i2c_ast_handler(int this_irq, void *dev_id) + { + u32 sts; ++ u32 temp; + + struct ast_i2c_dev *i2c_dev = dev_id; + u32 isr_sts = readl(i2c_dev->ast_i2c_data->reg_gr); +@@ -1280,17 +1318,15 @@ static irqreturn_t i2c_ast_handler(int this_irq, void *dev_id) + } + + if(AST_I2CD_INTR_STS_ABNORMAL & sts) { +- i2c_dev->cmd_err |= AST_I2CD_INTR_STS_ABNORMAL; +- // Turn off interrupts for further abnormal +- // conditions until we fix this one. +- ast_i2c_write(i2c_dev, +- ast_i2c_read(i2c_dev,I2C_INTR_CTRL_REG) & +- ~AST_I2CD_ABNORMAL_INTR_EN, +- I2C_INTR_CTRL_REG); +- complete(&i2c_dev->cmd_complete); +- sts &= ~AST_I2CD_INTR_STS_ABNORMAL; ++ // TODO: observed abnormal interrupt happening when the bus is stressed with traffic ++ dev_err(i2c_dev->dev, "abnormal interrupt happens with status: %x, slave mode: %d\n", sts, i2c_dev->slave_operation); + // Need to clear the interrupt + ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_ABNORMAL, I2C_INTR_STS_REG); ++ ++ i2c_dev->cmd_err |= AST_I2CD_INTR_STS_ABNORMAL; ++ complete(&i2c_dev->cmd_complete); ++ ++ return IRQ_HANDLED; + } + + switch(sts) { +@@ -1316,15 +1352,47 @@ static irqreturn_t i2c_ast_handler(int this_irq, void *dev_id) + ast_i2c_master_xfer_done(i2c_dev); + + } else { +- printk("ast_i2c: TX_ACK | NORMAL_STOP; xfer_last %d\n", i2c_dev->xfer_last); ++ dev_err(i2c_dev->dev,"ast_i2c: TX_ACK | NORMAL_STOP; xfer_last %d\n", i2c_dev->xfer_last); ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_TX_ACK | AST_I2CD_INTR_STS_NORMAL_STOP, I2C_INTR_STS_REG); ++ uint32_t new_val = ast_i2c_read(i2c_dev,I2C_INTR_CTRL_REG) | ++ AST_I2CD_NORMAL_STOP_INTR_EN | ++ AST_I2CD_TX_ACK_INTR_EN; ++ ast_i2c_write(i2c_dev, new_val, I2C_INTR_CTRL_REG); ++ //take care ++ i2c_dev->cmd_err |= AST_LOCKUP_DETECTED; ++ complete(&i2c_dev->cmd_complete); ++ } ++ break; ++ case AST_I2CD_INTR_STS_TX_ACK | AST_I2CD_INTR_STS_NORMAL_STOP | AST_I2CD_INTR_STS_SLAVE_MATCH : ++ if((i2c_dev->xfer_last == 1) && (i2c_dev->slave_operation == 0)) { ++ dev_dbg(i2c_dev->dev, "M clear isr: AST_I2CD_INTR_STS_TX_ACK | AST_I2CD_INTR_STS_NORMAL_STOP | AST_I2CD_INTR_STS_SLAVE_MATCH= %x\n",sts); ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_TX_ACK | AST_I2CD_INTR_STS_NORMAL_STOP, I2C_INTR_STS_REG); ++ //take care ++ ast_i2c_write(i2c_dev, ast_i2c_read(i2c_dev,I2C_INTR_CTRL_REG) | ++ AST_I2CD_TX_ACK_INTR_EN, I2C_INTR_CTRL_REG); ++ ast_i2c_master_xfer_done(i2c_dev); ++ ++ // Handle the new slave match interrupt ++ ast_i2c_slave_addr_match(i2c_dev); ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_SLAVE_MATCH, I2C_INTR_STS_REG); ++ } else { ++ dev_err(i2c_dev->dev, "Slave TX_ACK | NORMAL_STOP | AST_I2CD_INTR_STS_SLAVE_MATCH; xfer_last %d\n", i2c_dev->xfer_last); + ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_TX_ACK | AST_I2CD_INTR_STS_NORMAL_STOP, I2C_INTR_STS_REG); + uint32_t new_val = ast_i2c_read(i2c_dev,I2C_INTR_CTRL_REG) | +- AST_I2CD_NORMAL_STOP_INTR_EN | ++ AST_I2CD_NORMAL_STOP_INTR_EN | + AST_I2CD_TX_ACK_INTR_EN; + ast_i2c_write(i2c_dev, new_val, I2C_INTR_CTRL_REG); + //take care + i2c_dev->cmd_err |= AST_LOCKUP_DETECTED; + complete(&i2c_dev->cmd_complete); ++ ++ // stop previous slave transaction ++ i2c_dev->slave_event = I2C_SLAVE_EVENT_STOP; ++ ast_i2c_slave_xfer_done(i2c_dev); ++ ++ // Handle the new slave match interrupt ++ ast_i2c_slave_addr_match(i2c_dev); ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_SLAVE_MATCH, I2C_INTR_STS_REG); + } + break; + +@@ -1332,9 +1400,8 @@ static irqreturn_t i2c_ast_handler(int this_irq, void *dev_id) + if(i2c_dev->slave_operation == 1) { + i2c_dev->slave_event = I2C_SLAVE_EVENT_NACK; + ast_i2c_slave_xfer_done(i2c_dev); +- dev_dbg(i2c_dev->dev, "S clear isr: AST_I2CD_INTR_STS_TX_NAK = %x\n",sts); ++ dev_err(i2c_dev->dev, "S clear isr: AST_I2CD_INTR_STS_TX_NAK = %x\n",sts); + ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_TX_NAK, I2C_INTR_STS_REG); +- + } else { + dev_dbg(i2c_dev->dev, "M clear isr: AST_I2CD_INTR_STS_TX_NAK = %x\n",sts); + ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_TX_NAK, I2C_INTR_STS_REG); +@@ -1352,7 +1419,10 @@ static irqreturn_t i2c_ast_handler(int this_irq, void *dev_id) + case AST_I2CD_INTR_STS_TX_NAK | AST_I2CD_INTR_STS_NORMAL_STOP: + if(i2c_dev->slave_operation == 1) { + printk("SLAVE TODO .... \n"); +- ++ i2c_dev->slave_operation = 0; ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_TX_NAK | AST_I2CD_INTR_STS_NORMAL_STOP, I2C_INTR_STS_REG); ++ i2c_dev->cmd_err |= AST_I2CD_INTR_STS_TX_NAK | AST_I2CD_INTR_STS_NORMAL_STOP; ++ complete(&i2c_dev->cmd_complete); + } else { + dev_dbg(i2c_dev->dev, "M clear isr: AST_I2CD_INTR_STS_TX_NAK| AST_I2CD_INTR_STS_NORMAL_STOP = %x\n",sts); + ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_TX_NAK | AST_I2CD_INTR_STS_NORMAL_STOP, I2C_INTR_STS_REG); +@@ -1365,12 +1435,17 @@ static irqreturn_t i2c_ast_handler(int this_irq, void *dev_id) + //Issue : Workaround for I2C slave mode + case AST_I2CD_INTR_STS_TX_NAK | AST_I2CD_INTR_STS_SLAVE_MATCH: + if(i2c_dev->slave_operation == 1) { +- i2c_dev->slave_event = I2C_SLAVE_EVENT_NACK; +- ast_i2c_slave_xfer_done(i2c_dev); ++ dev_err(i2c_dev->dev, "i2cdriver: TX_NAK and Slave match sts = %x\n",sts); + ast_i2c_slave_addr_match(i2c_dev); + ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_TX_NAK | AST_I2CD_INTR_STS_SLAVE_MATCH , I2C_INTR_STS_REG); + } else { + printk("ERROR !!!!\n"); ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_TX_NAK, I2C_INTR_STS_REG); ++ i2c_dev->cmd_err |= AST_I2CD_INTR_STS_TX_NAK; ++ complete(&i2c_dev->cmd_complete); ++ ++ ast_i2c_slave_addr_match(i2c_dev); ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_SLAVE_MATCH , I2C_INTR_STS_REG); + } + break; + case AST_I2CD_INTR_STS_RX_DOWN | AST_I2CD_INTR_STS_SLAVE_MATCH: +@@ -1378,7 +1453,17 @@ static irqreturn_t i2c_ast_handler(int this_irq, void *dev_id) + dev_dbg(i2c_dev->dev, "S clear isr: AST_I2CD_INTR_STS_RX_DOWN | AST_I2CD_INTR_STS_SLAVE_MATCH = %x\n",sts); + ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_RX_DOWN | AST_I2CD_INTR_STS_SLAVE_MATCH, I2C_INTR_STS_REG); + break; ++ case AST_I2CD_INTR_STS_RX_DOWN | AST_I2CD_INTR_STS_SLAVE_MATCH | AST_I2CD_INTR_STS_ARBIT_LOSS: ++ dev_err(i2c_dev->dev, "M clear isr: sts = %x\n",sts); ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_ARBIT_LOSS, I2C_INTR_STS_REG); ++ i2c_dev->cmd_err |= AST_I2CD_INTR_STS_ARBIT_LOSS; ++ ast_i2c_write(i2c_dev, ast_i2c_read(i2c_dev,I2C_INTR_CTRL_REG) | ++ AST_I2CD_RX_DOWN_INTR_EN, I2C_INTR_CTRL_REG); ++ complete(&i2c_dev->cmd_complete); + ++ ast_i2c_slave_addr_match(i2c_dev); ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_RX_DOWN | AST_I2CD_INTR_STS_SLAVE_MATCH, I2C_INTR_STS_REG); ++ break; + case AST_I2CD_INTR_STS_RX_DOWN: + if(i2c_dev->slave_operation == 1) { + i2c_dev->slave_event = I2C_SLAVE_EVENT_WRITE; +@@ -1389,7 +1474,6 @@ static irqreturn_t i2c_ast_handler(int this_irq, void *dev_id) + dev_dbg(i2c_dev->dev, "M clear isr: AST_I2CD_INTR_STS_RX_DOWN = %x\n",sts); + ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_RX_DOWN, I2C_INTR_STS_REG); + ast_i2c_master_xfer_done(i2c_dev); +- + } + break; + +@@ -1407,7 +1491,7 @@ static irqreturn_t i2c_ast_handler(int this_irq, void *dev_id) + complete(&i2c_dev->cmd_complete); + } + break; +- case (AST_I2CD_INTR_STS_RX_DOWN | AST_I2CD_INTR_STS_NORMAL_STOP): ++ case AST_I2CD_INTR_STS_RX_DOWN | AST_I2CD_INTR_STS_NORMAL_STOP: + /* Whether or not we're done, the hardware thinks we're done, so bail. */ + if(i2c_dev->slave_operation == 0) { + dev_dbg(i2c_dev->dev, "M clear isr: AST_I2CD_INTR_STS_RX_DOWN | AST_I2CD_INTR_STS_NORMAL_STOP = %x\n",sts); +@@ -1416,18 +1500,47 @@ static irqreturn_t i2c_ast_handler(int this_irq, void *dev_id) + ast_i2c_write(i2c_dev, ast_i2c_read(i2c_dev,I2C_INTR_CTRL_REG) | + AST_I2CD_RX_DOWN_INTR_EN, I2C_INTR_CTRL_REG); + ast_i2c_master_xfer_done(i2c_dev); +- } ++ } else { ++ dev_err(i2c_dev->dev, "S clear isr: AST_I2CD_INTR_STS_RX_DOWN | AST_I2CD_INTR_STS_NORMAL_STOP = %x\n",sts); ++ i2c_dev->slave_event = I2C_SLAVE_EVENT_STOP; ++ ast_i2c_slave_xfer_done(i2c_dev); ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_RX_DOWN | AST_I2CD_INTR_STS_NORMAL_STOP, I2C_INTR_STS_REG); ++ ast_i2c_write(i2c_dev, ast_i2c_read(i2c_dev,I2C_INTR_CTRL_REG) | ++ AST_I2CD_RX_DOWN_INTR_EN, I2C_INTR_CTRL_REG); ++ ast_i2c_master_xfer_done(i2c_dev); ++ } + break; + case AST_I2CD_INTR_STS_ARBIT_LOSS: +- dev_dbg(i2c_dev->dev, "M clear isr: AST_I2CD_INTR_STS_ARBIT_LOSS = %x\n",sts); ++ dev_err(i2c_dev->dev, "M clear isr: AST_I2CD_INTR_STS_ARBIT_LOSS = %x\n",sts); + ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_ARBIT_LOSS, I2C_INTR_STS_REG); + i2c_dev->cmd_err |= AST_I2CD_INTR_STS_ARBIT_LOSS; + complete(&i2c_dev->cmd_complete); + break; + case AST_I2CD_INTR_STS_SCL_TO: ++ dev_err(i2c_dev->dev, "SCL LOW detected with sts = %x, slave mode: %x\n",sts, i2c_dev->slave_operation); ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_SCL_TO, I2C_INTR_STS_REG); ++ i2c_dev->cmd_err |= AST_I2CD_INTR_STS_SCL_TO; ++ complete(&i2c_dev->cmd_complete); ++ ++ // Reset i2c controller ++ temp = ast_i2c_read(i2c_dev,I2C_FUN_CTRL_REG); ++ ++ ast_i2c_write(i2c_dev, temp & ~(AST_I2CD_SLAVE_EN | AST_I2CD_MASTER_EN), I2C_FUN_CTRL_REG); ++ ++ ast_i2c_write(i2c_dev, temp, I2C_FUN_CTRL_REG); ++ break; ++ case AST_I2CD_INTR_STS_SLAVE_MATCH | AST_I2CD_INTR_STS_SCL_TO: ++ dev_err(i2c_dev->dev, "SCL LOW detected with sts = %x, slave mode: %x\n",sts, i2c_dev->slave_operation); ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_SCL_TO | AST_I2CD_INTR_STS_SLAVE_MATCH, I2C_INTR_STS_REG); + i2c_dev->cmd_err |= AST_I2CD_INTR_STS_SCL_TO; + complete(&i2c_dev->cmd_complete); + ++ // Reset i2c controller ++ temp = ast_i2c_read(i2c_dev,I2C_FUN_CTRL_REG); ++ ++ ast_i2c_write(i2c_dev, temp & ~(AST_I2CD_SLAVE_EN | AST_I2CD_MASTER_EN), I2C_FUN_CTRL_REG); ++ ++ ast_i2c_write(i2c_dev, temp, I2C_FUN_CTRL_REG); + break; + case AST_I2CD_INTR_STS_GCALL_ADDR: + i2c_dev->cmd_err |= AST_I2CD_INTR_STS_GCALL_ADDR; +@@ -1437,24 +1550,26 @@ static irqreturn_t i2c_ast_handler(int this_irq, void *dev_id) + case AST_I2CD_INTR_STS_SMBUS_DEF_ADDR: + break; + case AST_I2CD_INTR_STS_SMBUS_DEV_ALT: +- + break; + + case AST_I2CD_INTR_STS_SMBUS_ARP_ADDR: + break; + case AST_I2CD_INTR_STS_SDA_DL_TO: ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_SDA_DL_TO, I2C_INTR_STS_REG); ++ i2c_dev->cmd_err |= AST_I2CD_INTR_STS_SDA_DL_TO; ++ complete(&i2c_dev->cmd_complete); + break; + case AST_I2CD_INTR_STS_BUS_RECOVER: +- dev_dbg(i2c_dev->dev, "M clear isr: AST_I2CD_INTR_STS_BUS_RECOVER= %x\n",sts); ++ dev_err(i2c_dev->dev, "Bus recover with sts= %x, slave mode: %x\n",sts, i2c_dev->slave_operation); + ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_BUS_RECOVER, I2C_INTR_STS_REG); + complete(&i2c_dev->cmd_complete); + break; + default: +- //TODO: Clearing this interrupt for now, but needs to cleanup this ISR function +- ast_i2c_write(i2c_dev, sts, I2C_INTR_STS_REG); ++ printk("GR %x : Status : %x, bus_id %d\n",i2c_dev->ast_i2c_data->reg_gr, sts, i2c_dev->bus_id); + + // Handle Arbitration Loss + if (sts & AST_I2CD_INTR_STS_ARBIT_LOSS) { ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_ARBIT_LOSS, I2C_INTR_STS_REG); + i2c_dev->cmd_err |= AST_I2CD_INTR_STS_ARBIT_LOSS; + complete(&i2c_dev->cmd_complete); + sts &= (~AST_I2CD_INTR_STS_ARBIT_LOSS); +@@ -1462,22 +1577,35 @@ static irqreturn_t i2c_ast_handler(int this_irq, void *dev_id) + + // Handle the write transaction ACK + if (sts & AST_I2CD_INTR_STS_TX_ACK) { ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_TX_ACK, I2C_INTR_STS_REG); + ast_i2c_master_xfer_done(i2c_dev); +- complete(&i2c_dev->cmd_complete); + sts &= (~AST_I2CD_INTR_STS_TX_ACK); + } + ++ // Handle Normal Stop conditon ++ if (sts & AST_I2CD_INTR_STS_NORMAL_STOP) { ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_TX_ACK, I2C_INTR_STS_REG); ++ sts &= (~AST_I2CD_INTR_STS_NORMAL_STOP); ++ i2c_dev->cmd_err |= AST_I2CD_INTR_STS_NORMAL_STOP; ++ complete(&i2c_dev->cmd_complete); ++ } ++ + // Handle the Slave address match + if (sts & AST_I2CD_INTR_STS_SLAVE_MATCH) { + ast_i2c_slave_addr_match(i2c_dev); + sts &= (~AST_I2CD_INTR_STS_SLAVE_MATCH); ++ ast_i2c_write(i2c_dev, AST_I2CD_INTR_STS_SLAVE_MATCH, I2C_INTR_STS_REG); + } + ++ + // TODO: Debug print for any unhandled condition + if(sts) { + printk("GR %x : Status : %x, bus_id %d\n",i2c_dev->ast_i2c_data->reg_gr, sts, i2c_dev->bus_id); + } + ++ //TODO: Clearing this interrupt for now, but needs to cleanup this ISR function ++ ast_i2c_write(i2c_dev, sts, I2C_INTR_STS_REG); ++ + return IRQ_HANDLED; + } + +@@ -1492,16 +1620,25 @@ static int ast_i2c_do_msgs_xfer(struct ast_i2c_dev *i2c_dev, struct i2c_msg *msg + + spin_lock_irqsave(&i2c_dev->master_lock, flags); + +- //request +- if(i2c_dev->ast_i2c_data->master_dma == BYTE_MODE) ++ //request: update master_xfer_mode based on master_dma selection ++ if(i2c_dev->ast_i2c_data->master_dma == BYTE_MODE) { + i2c_dev->do_master_xfer = ast_i2c_do_byte_xfer; +- else if (i2c_dev->ast_i2c_data->master_dma == DMA_MODE) ++ i2c_dev->master_xfer_mode = BYTE_XFER; ++ i2c_dev->master_xfer_len = 1; ++ } else if (i2c_dev->ast_i2c_data->master_dma == DMA_MODE) { + i2c_dev->do_master_xfer = ast_i2c_do_dma_xfer; +- else { +- if(i2c_dev->ast_i2c_data->request_pool_buff_page(&(i2c_dev->req_page)) == 0) ++ i2c_dev->master_xfer_mode = DMA_XFER; ++ } else { ++ if(i2c_dev->ast_i2c_data->request_pool_buff_page(&(i2c_dev->req_page)) == 0) { + i2c_dev->do_master_xfer = ast_i2c_do_pool_xfer; +- else ++ i2c_dev->master_xfer_mode = BUFF_XFER; ++ } else { + i2c_dev->do_master_xfer = ast_i2c_do_byte_xfer; ++ dev_err(i2c_dev->dev, "i2cdriver: pool request failed for master\n"); ++ i2c_dev->master_xfer_mode = BYTE_XFER; ++ i2c_dev->master_xfer_len = 1; ++ ++ } + } + + // printk("start xfer ret = %d \n",ret); +@@ -1534,7 +1671,7 @@ static int ast_i2c_do_msgs_xfer(struct ast_i2c_dev *i2c_dev, struct i2c_msg *msg + i2c_dev->master_msgs = NULL; + + if (ret == 0) { +- dev_dbg(i2c_dev->dev, "controller timed out\n"); ++ dev_err(i2c_dev->dev, "controller timed out\n"); + i2c_dev->state = (ast_i2c_read(i2c_dev,I2C_CMD_REG) >> 19) & 0xf; + // printk("sts [%x], isr sts [%x] \n",i2c_dev->state, ast_i2c_read(i2c_dev,I2C_INTR_STS_REG)); + ret = -ETIMEDOUT; +@@ -1564,9 +1701,10 @@ static int ast_i2c_do_msgs_xfer(struct ast_i2c_dev *i2c_dev, struct i2c_msg *msg + + } + stop: +- init_completion(&i2c_dev->cmd_complete); + if(i2c_dev->cmd_err & AST_I2CD_INTR_STS_NORMAL_STOP) + goto out; ++ init_completion(&i2c_dev->cmd_complete); ++ i2c_dev->cmd_err = 0; + ast_i2c_write(i2c_dev, AST_I2CD_M_STOP_CMD, I2C_CMD_REG); + wait_for_completion_interruptible_timeout(&i2c_dev->cmd_complete, + i2c_dev->adap.timeout*HZ); +@@ -1605,7 +1743,7 @@ static int ast_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) + ret = ast_i2c_do_msgs_xfer(i2c_dev, msgs, num); + if (ret != -EAGAIN) + goto out; +- dev_dbg(&adap->dev, "Retrying transmission [%d]\n",i); ++ dev_dbg(&i2c_dev->adap.dev, "Retrying transmission [%d]\n",i); + udelay(100); + } + +diff --git a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/net/ftgmac100_26.c b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/net/ftgmac100_26.c +index 3a5d796..f558d38 100644 +--- a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/net/ftgmac100_26.c ++++ b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/net/ftgmac100_26.c +@@ -901,6 +901,41 @@ void Enable_Broadcast_Filter (struct net_device * dev) + lp->Retry = 0; + } + ++void Disable_Multicast_Filter (struct net_device * dev) ++{ ++ struct ftgmac100_priv *lp = (struct ftgmac100_priv *)dev->priv; ++ unsigned long Combined_Channel_ID; ++ struct sk_buff * skb; ++ ++ do { ++ skb = dev_alloc_skb (TX_BUF_SIZE + 16); ++ memset(skb->data, 0, TX_BUF_SIZE + 16); ++//TX ++ lp->InstanceID++; ++ lp->NCSI_Request.IID = lp->InstanceID; ++ lp->NCSI_Request.Command = DISABLE_GLOBAL_MULTICAST_FILTERING; ++ Combined_Channel_ID = (lp->NCSI_Cap.Package_ID << 5) + lp->NCSI_Cap.Channel_ID; ++ lp->NCSI_Request.Channel_ID = Combined_Channel_ID; ++ lp->NCSI_Request.Payload_Length = 0; ++ memcpy ((unsigned char *)skb->data, &lp->NCSI_Request, 30); ++ copy_data (dev, skb, lp->NCSI_Request.Payload_Length); ++ skb->len = 30 + lp->NCSI_Request.Payload_Length + 4; ++ ftgmac100_wait_to_send_packet (skb, dev); ++//RX ++ NCSI_Rx(dev); ++ if (((lp->NCSI_Respond.IID != lp->InstanceID) || (lp->NCSI_Respond.Command != (DISABLE_GLOBAL_MULTICAST_FILTERING | 0x80)) || (lp->NCSI_Respond.Response_Code != COMMAND_COMPLETED)) && (lp->Retry != RETRY_COUNT)) { ++ printk ("Retry: Command = %x, Response_Code = %x\n", lp->NCSI_Request.Command, lp->NCSI_Respond.Response_Code); ++ printk ("IID: %x:%x, Command: %x:%x\n", lp->InstanceID, lp->NCSI_Respond.IID, lp->NCSI_Request.Command, lp->NCSI_Respond.Command); ++ lp->Retry++; ++ lp->InstanceID--; ++ } ++ else { ++ lp->Retry = 0; ++ } ++ } while ((lp->Retry != 0) && (lp->Retry <= RETRY_COUNT)); ++ lp->Retry = 0; ++} ++ + void Disable_VLAN (struct net_device * dev) + { + struct ftgmac100_priv *lp = (struct ftgmac100_priv *)dev->priv; +@@ -1416,6 +1451,8 @@ static void ftgmac100_enable( struct net_device *dev ) + Enable_Set_MAC_Address(dev); + //Enable Broadcast Filter + Enable_Broadcast_Filter(dev); ++//Disable Multicast Filter ++ Disable_Multicast_Filter(dev); + //Disable VLAN + Disable_VLAN(dev); + //Enable AEN +diff --git a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/serial/8250.c b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/serial/8250.c +index f16da59..d01c1c7 100644 +--- a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/serial/8250.c ++++ b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/serial/8250.c +@@ -127,6 +127,11 @@ static unsigned long probe_rsa[PORT_RSA_MAX]; + static unsigned int probe_rsa_count; + #endif /* CONFIG_SERIAL_8250_RSA */ + ++struct rs485_wait_state { ++ int gpio; ++ int waiting; ++}; ++ + struct uart_8250_port { + struct uart_port port; + struct timer_list timer; /* "no irq" timer */ +@@ -156,6 +161,8 @@ struct uart_8250_port { + */ + void (*pm)(struct uart_port *port, + unsigned int state, unsigned int old); ++ ++ struct rs485_wait_state rs485_wait_state; + }; + + struct irq_info { +@@ -169,6 +176,9 @@ struct irq_info { + static struct hlist_head irq_lists[NR_IRQ_HASH]; + static DEFINE_MUTEX(hash_mutex); /* Used to walk the hash */ + ++#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) ++static void wait_for_xmitr(struct uart_8250_port *up, int bits); ++ + /* + * Here we define the default xmit fifo size used for each type of UART. + */ +@@ -530,6 +540,31 @@ static void serial_dl_write(struct uart_8250_port *up, int value) + #define serial_dl_write(up, value) _serial_dl_write(up, value) + #endif + ++// unfortunately it seems the gpio switch for RS485 can be late even with the ++// wait queue based wakeup of the task waiting on its completion, so we *have* ++// to do the gpio switch in the interrupt handler. ++static void rs485_wait_end(struct uart_8250_port *up) { ++ struct rs485_wait_state *rs485_wait_state = ++ &up->rs485_wait_state; ++ if (rs485_wait_state->waiting) { ++ int status; ++ status = serial_in(up, UART_LSR); ++ // no interrupt will be fire for shift register (TEMT) so we have to spin ++ // on it. ++ if (status & UART_LSR_THRE) { ++ wait_for_xmitr(up, BOTH_EMPTY); ++ // turn off RS485 DE pin ++ if (rs485_wait_state->gpio) ++ gpio_set_value(rs485_wait_state->gpio, 0); ++ // grab any phantom char seen on RX when transceiver switches ++ (void) serial_inp(up, UART_RX); ++ // enable read ++ up->port.ignore_status_mask &= ~UART_LSR_DR; ++ rs485_wait_state->waiting = 0; ++ } ++ } ++} ++ + /* + * For the 16C950 + */ +@@ -1235,6 +1270,7 @@ static inline void __stop_tx(struct uart_8250_port *p) + p->ier &= ~UART_IER_THRI; + serial_out(p, UART_IER, p->ier); + } ++ uart_write_wakeup(&p->port); + } + + static void serial8250_stop_tx(struct uart_port *port) +@@ -1436,7 +1472,7 @@ static unsigned int check_modem_status(struct uart_8250_port *up) + if (status & UART_MSR_DCTS) + uart_handle_cts_change(&up->port, status & UART_MSR_CTS); + +- wake_up_interruptible(&up->port.info->delta_msr_wait); ++ wake_up_interruptible(&up->port.info->delta_msr_wait); + } + + return status; +@@ -1462,6 +1498,7 @@ static void serial8250_handle_port(struct uart_8250_port *up) + if (status & UART_LSR_THRE) + transmit_chars(up); + ++ rs485_wait_end(up); + spin_unlock_irqrestore(&up->port.lock, flags); + } + +@@ -1777,8 +1814,6 @@ static void serial8250_break_ctl(struct uart_port *port, int break_state) + spin_unlock_irqrestore(&up->port.lock, flags); + } + +-#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) +- + /* + * Wait for transmitter & holding register to empty + */ +@@ -2539,8 +2574,13 @@ static int serial8250_ioctl(struct uart_port *port, unsigned int cmd, unsigned l + int ret = -ENOIOCTLCMD; + // kernel-space RS485 drain-and-switch hack + if (cmd == TIOCSERWAITTEMT) { +- // wait for kernel buffers and UART FIFO to both empty + struct circ_buf *xmit = &up->port.info->xmit; ++ spin_lock_irqsave(&up->port.lock, flags); ++ up->rs485_wait_state.gpio = arg; ++ up->rs485_wait_state.waiting = 1; ++ spin_unlock_irqrestore(&up->port.lock, flags); ++ ++ // wait for kernel buffers and UART FIFO to both empty + wait_event_interruptible( + thre_wait, + uart_circ_empty(xmit) && +@@ -2548,14 +2588,6 @@ static int serial8250_ioctl(struct uart_port *port, unsigned int cmd, unsigned l + // spin until TEMT (transmit shift register empty) + spin_lock_irqsave(&up->port.lock, flags); + wait_for_xmitr(up, BOTH_EMPTY); +- if (arg != 0) { +- // turn off RS485 DE pin +- gpio_set_value(arg, 0); +- } +- // grab any phantom char seen on RX when transceiver switches +- (void) serial_inp(up, UART_RX); +- // enable read +- up->port.ignore_status_mask &= ~UART_LSR_DR; + spin_unlock_irqrestore(&up->port.lock, flags); + return 0; + } +@@ -2607,6 +2639,8 @@ static void __init serial8250_isa_init_ports(void) + + init_timer(&up->timer); + up->timer.function = serial8250_timeout; ++ up->rs485_wait_state.waiting = 0; ++ up->rs485_wait_state.gpio = 0; + + /* + * ALPHA_KLUDGE_MCR needs to be killed. +diff --git a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/usb/gadget/aspeed_udc.c b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/usb/gadget/aspeed_udc.c +index a65e52a..51cb34c 100644 +--- a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/usb/gadget/aspeed_udc.c ++++ b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/usb/gadget/aspeed_udc.c +@@ -580,10 +580,10 @@ static void ep_dequeue_locked(struct ast_ep* ep, struct ast_usb_request *req) { + + static void ep_dequeue_all(struct ast_ep* ep, int status) { + struct ast_usb_request *req; +- struct ast_usb_request *n; + unsigned long flags; + spin_lock_irqsave(&ep->lock, flags); +- list_for_each_entry_safe(req, n, &ep->queue, queue) { ++ while (!list_empty(&ep->queue)) { ++ req = list_entry(ep->queue.next, struct ast_usb_request, queue); + ep_dequeue_locked(ep, req); + req->req.status = status; + if(req->req.complete) { +@@ -654,8 +654,14 @@ static void ep_txrx_check_done(struct ast_ep* ep) { + spin_lock_irqsave(&ep->lock, flags); + status = ep_hreadl(ep, DESC_STATUS); + // if txrx complete; +- if(!(status & 0xff) && +- !list_empty(&ep->queue)) { ++ if (!(status & 0xff)) { ++ /* DMA is done */ ++ ep->dma_busy = 0; ++ /* if the list is empty, nothing to do */ ++ if (list_empty(&ep->queue)) { ++ spin_unlock_irqrestore(&ep->lock, flags); ++ return; ++ } + req = list_entry(ep->queue.next, struct ast_usb_request, queue); + if(!req->in_transit) { + spin_unlock_irqrestore(&ep->lock, flags); +@@ -663,7 +669,6 @@ static void ep_txrx_check_done(struct ast_ep* ep) { + } + //head rq completed + req->in_transit = 0; +- ep->dma_busy = 0; + if(!ep->to_host) { + req->lastpacket = (status >> 16) & 0x3ff; + __cpuc_flush_kern_all(); +diff --git a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/watchdog/ast_wdt.c b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/watchdog/ast_wdt.c +index e599a55..cfe70a1 100644 +--- a/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/watchdog/ast_wdt.c ++++ b/meta-aspeed/recipes-kernel/linux/files/linux-aspeed-2.6.28.9/drivers/watchdog/ast_wdt.c +@@ -450,7 +450,7 @@ static int ast_wdt_open(struct inode *inode, struct file *file) + + static int ast_wdt_release(struct inode *inode, struct file *file) + { +- if (expect_close != 42 || !nowayout) ++ if (expect_close != 42 && !nowayout) + { + /* handles the case where the device is closed without the "magic + * close" character (anything that is not 'V' qualifies -- see the diff --git a/meta-aspeed/recipes-kernel/linux/linux-aspeed.inc b/meta-aspeed/recipes-kernel/linux/linux-aspeed.inc index a66c7e1..5e28e76 100644 --- a/meta-aspeed/recipes-kernel/linux/linux-aspeed.inc +++ b/meta-aspeed/recipes-kernel/linux/linux-aspeed.inc @@ -11,16 +11,22 @@ do_compile[depends] = "libgcc:do_populate_sysroot" inherit kernel # auto load the following modules -module_autoload_tun = "tun" -module_autoload_at24 = "at24" -module_autoload_ads7828 = "ads7828" -module_autoload_pcf8574 = "pcf8574" -module_autoload_max127 = "max127" +KERNEL_MODULE_AUTOLOAD += " \ + adm1275 \ + ads7828 \ + at24 \ + fb_panther_plus \ + max127 \ + pcf8574 \ + pfe1100 \ + pmbus_core \ + tun \ +" + +KERNEL_MODULE_PROBECONF += " \ + max127 \ +" module_conf_max127 = "options max127 scaling=24414" -module_autoload_pmbus_core = "pmbus_core" -module_autoload_pfe1100 = "pfe1100" -module_autoload_fb_panther_plus = "fb_panther_plus" -module_autoload_adm1275 = "adm1275" # Do not install kernel in rootfs do_install[postfuncs] += "remove_kernel_image_from_rootfs" diff --git a/meta-aspeed/recipes-kernel/linux/linux-aspeed_2.6.28.9.bb b/meta-aspeed/recipes-kernel/linux/linux-aspeed_2.6.28.9.bb index 9a76066..7798bab 100644 --- a/meta-aspeed/recipes-kernel/linux/linux-aspeed_2.6.28.9.bb +++ b/meta-aspeed/recipes-kernel/linux/linux-aspeed_2.6.28.9.bb @@ -3,7 +3,7 @@ SRCREV = "1e85856853e24e9013d142adaad38c2adc7e48ac" SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git;protocol=https;branch=linux-2.6.28.y \ - file://patch-2.6.28.9/0000-linux-aspeed-064.patch \ + file://patch-2.6.28.9/0000-linux-aspeed-064.patch;striplevel=1 \ file://patch-2.6.28.9/0000-linux-openbmc.patch \ file://patch-2.6.28.9/0001-MTD-fix-m25p80-64-bit-divisions.patch \ file://patch-2.6.28.9/0005-mtd-Bug-in-m25p80.c-during-whole-chip-erase.patch \ @@ -23,28 +23,37 @@ SRC_URI = "git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git file://patch-2.6.28.9/0001-bzip2-lzma-library-support-for-gzip-bzip2-and-lzma-d.patch \ file://patch-2.6.28.9/0002-bzip2-lzma-config-and-initramfs-support-for-bzip2-lz.patch \ file://patch-2.6.28.9/0032-Create-snapshot-of-OpenBMC.patch \ + file://patch-2.6.28.9/0033-Linux-snapshot-of-OpenBMC-f926614.patch;striplevel=6 \ " -S = "${WORKDIR}/git" - LINUX_VERSION ?= "2.6.28.9" LINUX_VERSION_EXTENSION ?= "-aspeed" PR = "r1" PV = "${LINUX_VERSION}" +include linux-aspeed.inc + +S = "${WORKDIR}/git" + # Install bounds.h for external module install # The default install script handles this. However, it looks for bounds.h from # 'include/generated', which doesnot match 2.6.28, where the file is in # 'include/linux'. -do_install[postfuncs] += "install_bounds_h" -install_bounds_h() { - kerneldir=${D}${KERNEL_SRC_PATH} - if [ -f include/linux/bounds.h ]; then - cp -l include/linux/bounds.h $kerneldir/include/linux/bounds.h - fi +addtask create_generated after do_compile before do_shared_workdir +do_create_generated() { + install -d ${B}/include/generated + cp -l ${B}/include/linux/bounds.h ${B}/include/generated/bounds.h } -KERNEL_CONFIG_COMMAND = "oe_runmake wedge_defconfig && oe_runmake oldconfig" +# With Fido, ${KERNEL_SRC} is set to ${STAGING_KERENL_DIR}, which is passed +# to kernel module build. So, copy all .h files from the build direcory to +# the ${STAGING_KERNEL_DIR} +addtask copy_to_kernelsrc after do_shared_workdir before do_compile_kernelmodules +do_copy_to_kernelsrc() { + kerneldir=${STAGING_KERNEL_DIR}/include/linux + install -d ${kerneldir} + cp -l ${B}/include/linux/* ${kerneldir}/ +} -include linux-aspeed.inc +KERNEL_CC += " --sysroot=${PKG_CONFIG_SYSROOT_DIR}" diff --git a/meta-aspeed/recipes-utils/openbmc-gpio/files/ast2400_gpio_table.py b/meta-aspeed/recipes-utils/openbmc-gpio/files/ast2400_gpio_table.py new file mode 100644 index 0000000..68d4203 --- /dev/null +++ b/meta-aspeed/recipes-utils/openbmc-gpio/files/ast2400_gpio_table.py @@ -0,0 +1,1022 @@ +# Copyright 2015-present Facebook. All rights reserved. +# +# This program file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from openbmc_gpio_table import ( + BitsEqual, BitsNotEqual, And, Or, Function) + + +# The fallowing table is generated using: +# python ast_gpio_parser.py data/ast2400-gpio.csv +# DO NOT MODIFY THE TABLE!!! +# Manual modification will be overridden!!! + +soc_gpio_table = { + 'A1': [ + Function('SD1WP#', BitsEqual(0x90, [0], 0x1)), + Function('SDA13', BitsEqual(0x90, [26], 0x1)), + Function('GPIOC7', None) + ], + 'A10': [ + Function('GPIOU0', BitsEqual(0xa0, [8], 0x1)), + Function('RMII2TXD0', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2TXD0', None) + ], + 'A11': [ + Function('GPIOV0', BitsEqual(0xa0, [16], 0x1)), + Function('RMII1CRSDV', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1RXD2', None) + ], + 'A12': [ + Function('GPIOT0', BitsEqual(0xa0, [0], 0x1)), + Function('RMII1TXEN', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1TXCK', None) + ], + 'A13': [ + Function('GPIOT5', BitsEqual(0xa0, [5], 0x1)), + Function('UNDEFINED5', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1TXD3', None) + ], + 'A14': [ + Function('SGPSCK', BitsEqual(0x84, [0], 0x1)), + Function('GPIOG0', None) + ], + 'A15': [ + Function('NRI3', BitsEqual(0x80, [19], 0x1)), + Function('GPIE2(Out)', Or(BitsEqual(0x8c, [13], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE3', None) + ], + 'A16': [ + Function('SD2CD#', BitsEqual(0x90, [1], 0x1)), + Function('GPID6(In)', Or(BitsEqual(0x8c, [11], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD6', None) + ], + 'A17': [ + Function('SD2DAT1', BitsEqual(0x90, [1], 0x1)), + Function('GPID2(Out)', Or(BitsEqual(0x8c, [9], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD3', None) + ], + 'A18': [ + Function('SD2CLK', BitsEqual(0x90, [1], 0x1)), + Function('GPID0(In)', Or(BitsEqual(0x8c, [8], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD0', None) + ], + 'A19': [ + Function('NRTS4', BitsEqual(0x80, [29], 0x1)), + Function('SIOSCI#', Or(BitsEqual(0xa4, [15], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOF5', None) + ], + 'A2': [ + Function('SD1DAT0', BitsEqual(0x90, [0], 0x1)), + Function('SCL11', BitsEqual(0x90, [24], 0x1)), + Function('GPIOC2', None) + ], + 'A20': [ + Function('NDSR4', BitsEqual(0x80, [26], 0x1)), + Function('SIOPWRGD', Or(BitsEqual(0xa4, [13], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOF2', None) + ], + 'A3': [ + Function('MDC2', BitsEqual(0x90, [2], 0x1)), + Function('TIMER7', BitsEqual(0x80, [6], 0x1)), + Function('GPIOA6', None) + ], + 'A4': [ + Function('TIMER3', BitsEqual(0x80, [2], 0x1)), + Function('GPIOA2', None) + ], + 'A5': [ + Function('MDIO1', BitsEqual(0x88, [31], 0x1)), + Function('GPIOR7', None) + ], + 'A6': [ + Function('ROMD14', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('TXD6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH6', None) + ], + 'A7': [ + Function('ROMD11', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('NRI6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH3', None) + ], + 'A8': [ + Function('ROMD8', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('NCTS6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH0', None) + ], + 'A9': [ + Function('GPIOV4', BitsEqual(0xa0, [20], 0x1)), + Function('RMII2RXD0', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2RXD0', None) + ], + 'AA1': [ + Function('VPIB8', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [30], 0x1))), + Function('TXD2', BitsEqual(0x84, [30], 0x1)), + Function('GPIOM6', None) + ], + 'AA2': [ + Function('VPIG2', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x88, [2], 0x1))), + Function('PWM2', BitsEqual(0x88, [2], 0x1)), + Function('GPION2', None) + ], + 'AA22': [ + Function('FLBUSY#', BitsEqual(0x84, [6], 0x1)), + Function('GPIOG6', None) + ], + 'AA3': [ + Function('VPIG6', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [6], 0x1))), + Function('PWM6', BitsEqual(0x88, [6], 0x1)), + Function('GPION6', None) + ], + 'AA4': [ + Function('VPIR0', And(BitsEqual(0x90, [5, 4], 0x3), BitsEqual(0x88, [10], 0x1))), + Function('GPIOO2/TACH2', None) + ], + 'AA5': [ + Function('VPIR3', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [13], 0x1))), + Function('GPIOO5/TACH5', None) + ], + 'AA6': [ + Function('VPIR9', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [19], 0x1))), + Function('GPIOP3/TACH11', None) + ], + 'AA7': [ + Function('BMCINT', BitsEqual(0x88, [22], 0x1)), + Function('GPIOP6/TACH14', None) + ], + 'AB1': [ + Function('VPIG3', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x88, [3], 0x1))), + Function('PWM3', BitsEqual(0x88, [3], 0x1)), + Function('GPION3', None) + ], + 'AB2': [ + Function('VPIG7', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [7], 0x1))), + Function('PWM7', BitsEqual(0x88, [7], 0x1)), + Function('GPION7', None) + ], + 'AB20': [ + Function('USB2_HDN', BitsEqual(0x90, [29], 0x1)), + Function('USB2_DN', None) + ], + 'AB21': [ + Function('USB2_HDP', BitsEqual(0x90, [29], 0x1)), + Function('USB2_DP', None) + ], + 'AB3': [ + Function('VPIR1', And(BitsEqual(0x90, [5, 4], 0x3), BitsEqual(0x88, [11], 0x1))), + Function('GPIOO3/TACH3', None) + ], + 'AB4': [ + Function('VPIR4', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [14], 0x1))), + Function('GPIOO6/TACH6', None) + ], + 'AB5': [ + Function('VPIR7', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [17], 0x1))), + Function('GPIOP1/TACH9', None) + ], + 'AB7': [ + Function('FLACK', BitsEqual(0x88, [23], 0x1)), + Function('GPIOP7/TACH15', None) + ], + 'B1': [ + Function('SCL4', BitsEqual(0x90, [17], 0x1)), + Function('GPIOQ2', None) + ], + 'B10': [ + Function('GPIOU1', BitsEqual(0xa0, [9], 0x1)), + Function('RMII2TXD1', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2TXD1', None) + ], + 'B11': [ + Function('GPIOU7', BitsEqual(0xa0, [15], 0x1)), + Function('RMII1RXD1', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1RXD1', None) + ], + 'B12': [ + Function('GPIOT1', BitsEqual(0xa0, [1], 0x1)), + Function('UNDEFINED3', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1TXCTL', None) + ], + 'B13': [ + Function('OSCCLK', BitsEqual(0x2c, [1], 0x1)), + Function('WDTRST1', BitsEqual(0x84, [4], 0x1)), + Function('GPIOG4', None) + ], + 'B14': [ + Function('RXD3', BitsEqual(0x80, [23], 0x1)), + Function('GPIE6(Out)', Or(BitsEqual(0x8c, [15], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE7', None) + ], + 'B15': [ + Function('NDSR3', BitsEqual(0x80, [18], 0x1)), + Function('GPIE2(In)', Or(BitsEqual(0x8c, [13], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE2', None) + ], + 'B16': [ + Function('SD2DAT3', BitsEqual(0x90, [1], 0x1)), + Function('GPID4(Out)', Or(BitsEqual(0x8c, [10], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD5', None) + ], + 'B17': [ + Function('SD2DAT0', BitsEqual(0x90, [1], 0x1)), + Function('GPID2(In)', Or(BitsEqual(0x8c, [9], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD2', None) + ], + 'B18': [ + Function('NDTR4', BitsEqual(0x80, [28], 0x1)), + Function('GPIOF4', None) + ], + 'B19': [ + Function('NDCD4', BitsEqual(0x80, [25], 0x1)), + Function('SIOPBI#', Or(BitsEqual(0xa4, [12], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOF1', None) + ], + 'B2': [ + Function('SD1CD#', BitsEqual(0x90, [0], 0x1)), + Function('SCL13', BitsEqual(0x90, [26], 0x1)), + Function('GPIOC6', None) + ], + 'B22': [ + Function('SPICS0#', BitsNotEqual(0x70, [13, 12], 0x0)), + Function('VBCS#', BitsEqual(0x70, [5], 0x1)), + Function('GPIOI4', None) + ], + 'B3': [ + Function('SD1CMD', BitsEqual(0x90, [0], 0x1)), + Function('SDA10', BitsEqual(0x90, [23], 0x1)), + Function('GPIOC1', None) + ], + 'B4': [ + Function('SDA9', BitsEqual(0x90, [22], 0x1)), + Function('TIMER6', BitsEqual(0x80, [5], 0x1)), + Function('GPIOA5', None) + ], + 'B5': [ + Function('MAC2LINK', BitsEqual(0x80, [1], 0x1)), + Function('GPIOA1', None) + ], + 'B6': [ + Function('ROMD13', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('NRTS6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH5', None) + ], + 'B7': [ + Function('ROMD10', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('NDSR6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH2', None) + ], + 'B9': [ + Function('GPIOV3', BitsEqual(0xa0, [19], 0x1)), + Function('UNDEFINED10', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2RXCTL', None) + ], + 'C1': [ + Function('SCL6', BitsEqual(0x90, [19], 0x1)), + Function('GPIOK2', None) + ], + 'C10': [ + Function('GPIOU2', BitsEqual(0xa0, [10], 0x1)), + Function('UNDEFINED7', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2TXD2', None) + ], + 'C11': [ + Function('GPIOU6', BitsEqual(0xa0, [14], 0x1)), + Function('RMII1RXD0', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1RXD0', None) + ], + 'C12': [ + Function('GPIOT2', BitsEqual(0xa0, [2], 0x1)), + Function('RMII1TXD0', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1TXD0', None) + ], + 'C13': [ + Function('SGPSI1', BitsEqual(0x84, [3], 0x1)), + Function('GPIOG3', None) + ], + 'C14': [ + Function('TXD3', BitsEqual(0x80, [22], 0x1)), + Function('GPIE6(In)', Or(BitsEqual(0x8c, [15], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE6', None) + ], + 'C15': [ + Function('NDCD3', BitsEqual(0x80, [17], 0x1)), + Function('GPIE0(Out)', Or(BitsEqual(0x8c, [12], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE1', None) + ], + 'C16': [ + Function('SD2DAT2', BitsEqual(0x90, [1], 0x1)), + Function('GPID4(In)', Or(BitsEqual(0x8c, [10], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD4', None) + ], + 'C17': [ + Function('RXD4', BitsEqual(0x80, [31], 0x1)), + Function('GPIOF7', None) + ], + 'C18': [ + Function('SPIDO', BitsNotEqual(0x70, [13, 12], 0x0)), + Function('VBDO', BitsEqual(0x70, [5], 0x1)), + Function('GPIOI6', None) + ], + 'C2': [ + Function('SDA3', BitsEqual(0x90, [16], 0x1)), + Function('GPIOQ1', None) + ], + 'C20': [ + Function('SYSDI', BitsEqual(0x70, [13], 0x1)), + Function('GPIOI3', None) + ], + 'C21': [ + Function('SIOS3#', Or(BitsEqual(0xa4, [8], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOY0', None) + ], + 'C22': [ + Function('SYSCS#', BitsEqual(0x70, [13], 0x1)), + Function('GPIOI0', None) + ], + 'C3': [ + Function('SD1DAT3', BitsEqual(0x90, [0], 0x1)), + Function('SDA12', BitsEqual(0x90, [25], 0x1)), + Function('GPIOC5', None) + ], + 'C4': [ + Function('SD1CLK', BitsEqual(0x90, [0], 0x1)), + Function('SCL10', BitsEqual(0x90, [23], 0x1)), + Function('GPIOC0', None) + ], + 'C5': [ + Function('SCL9', BitsEqual(0x90, [22], 0x1)), + Function('TIMER5', BitsEqual(0x80, [4], 0x1)), + Function('GPIOA4', None) + ], + 'C6': [ + Function('MDC1', BitsEqual(0x88, [30], 0x1)), + Function('GPIOR6', None) + ], + 'C7': [ + Function('ROMD9', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('NDCD6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH1', None) + ], + 'C8': [ + Function('GPIOV7', BitsEqual(0xa0, [23], 0x1)), + Function('RMII2RXER', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2RXD3', None) + ], + 'C9': [ + Function('GPIOV2', BitsEqual(0xa0, [18], 0x1)), + Function('RMII2RCLK', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2RXCK', None) + ], + 'D1': [ + Function('SDA7', BitsEqual(0x90, [20], 0x1)), + Function('GPIOK5', None) + ], + 'D10': [ + Function('GPIOU3', BitsEqual(0xa0, [11], 0x1)), + Function('UNDEFINED8', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2TXD3', None) + ], + 'D11': [ + Function('GPIOU5', BitsEqual(0xa0, [13], 0x1)), + Function('UNDEFINED9', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1RXCTL', None) + ], + 'D12': [ + Function('GPIOT3', BitsEqual(0xa0, [3], 0x1)), + Function('RMII1TXD1', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1TXD1', None) + ], + 'D13': [ + Function('SGPSI0', BitsEqual(0x84, [2], 0x1)), + Function('GPIOG2', None) + ], + 'D14': [ + Function('NRTS3', BitsEqual(0x80, [21], 0x1)), + Function('GPIE4(Out)', Or(BitsEqual(0x8c, [14], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE5', None) + ], + 'D15': [ + Function('NCTS3', BitsEqual(0x80, [16], 0x1)), + Function('GPIE0(In)', Or(BitsEqual(0x8c, [12], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE0', None) + ], + 'D16': [ + Function('SD2CMD', BitsEqual(0x90, [1], 0x1)), + Function('GPID0(Out)', Or(BitsEqual(0x8c, [8], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD1', None) + ], + 'D17': [ + Function('NRI4', BitsEqual(0x80, [27], 0x1)), + Function('SIOPBO#', Or(BitsEqual(0xa4, [14], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOF3', None) + ], + 'D18': [ + Function('NCTS4', BitsEqual(0x80, [24], 0x1)), + Function('GPIOF0', None) + ], + 'D19': [ + Function('SYSDO', BitsEqual(0x70, [13], 0x1)), + Function('GPIOI2', None) + ], + 'D2': [ + Function('SDA5', BitsEqual(0x90, [18], 0x1)), + Function('GPIOK1', None) + ], + 'D3': [ + Function('SCL3', BitsEqual(0x90, [16], 0x1)), + Function('GPIOQ0', None) + ], + 'D4': [ + Function('SD1DAT2', BitsEqual(0x90, [0], 0x1)), + Function('SCL12', BitsEqual(0x90, [25], 0x1)), + Function('GPIOC4', None) + ], + 'D5': [ + Function('MDIO2', BitsEqual(0x90, [2], 0x1)), + Function('TIMER8', BitsEqual(0x80, [7], 0x1)), + Function('GPIOA7', None) + ], + 'D6': [ + Function('MAC1LINK', BitsEqual(0x80, [0], 0x1)), + Function('GPIOA0', None) + ], + 'D7': [ + Function('ROMD12', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('NDTR6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH4', None) + ], + 'D8': [ + Function('GPIOV6', BitsEqual(0xa0, [22], 0x1)), + Function('RMII2CRSDV', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2RXD2', None) + ], + 'D9': [ + Function('GPIOT6', BitsEqual(0xa0, [6], 0x1)), + Function('RMII2TXEN', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2TXCK', None) + ], + 'E10': [ + Function('GPIOV1', BitsEqual(0xa0, [17], 0x1)), + Function('RMII1RXER', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1RXD3', None) + ], + 'E11': [ + Function('GPIOU4', BitsEqual(0xa0, [12], 0x1)), + Function('RMII1RCLK', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1RXCK', None) + ], + 'E12': [ + Function('GPIOT4', BitsEqual(0xa0, [4], 0x1)), + Function('UNDEFINED4', BitsEqual(0x70, [6], 0x0)), + Function('RGMII1TXD2', None) + ], + 'E13': [ + Function('SGPSLD', BitsEqual(0x84, [1], 0x1)), + Function('GPIOG1', None) + ], + 'E14': [ + Function('NDTR3', BitsEqual(0x80, [20], 0x1)), + Function('GPIE4(In)', Or(BitsEqual(0x8c, [14], 0x1), BitsEqual(0x70, [22], 0x1))), + Function('GPIOE4', None) + ], + 'E15': [ + Function('SD2WP#', BitsEqual(0x90, [1], 0x1)), + Function('GPID6(Out)', Or(BitsEqual(0x8c, [11], 0x1), BitsEqual(0x70, [21], 0x1))), + Function('GPIOD7', None) + ], + 'E16': [ + Function('TXD4', BitsEqual(0x80, [30], 0x1)), + Function('GPIOF6', None) + ], + 'E18': [ + Function('EXTRST#', And(BitsEqual(0x80, [15], 0x1), And(BitsEqual(0x90, [31], 0x0), BitsEqual(0x3c, [3], 0x1)))), + Function('SPICS1#', And(BitsEqual(0x80, [15], 0x1), BitsEqual(0x90, [31], 0x1))), + Function('GPIOB7', None) + ], + 'E19': [ + Function('LPCRST#', Or(BitsEqual(0x80, [12], 0x1), BitsEqual(0x70, [14], 0x1))), + Function('GPIOB4', None) + ], + 'E2': [ + Function('SCL7', BitsEqual(0x90, [20], 0x1)), + Function('GPIOK4', None) + ], + 'E20': [ + Function('SPIDI', BitsNotEqual(0x70, [13, 12], 0x0)), + Function('VBDI', BitsEqual(0x70, [5], 0x1)), + Function('GPIOI7', None) + ], + 'E3': [ + Function('SCL5', BitsEqual(0x90, [18], 0x1)), + Function('GPIOK0', None) + ], + 'E5': [ + Function('SD1DAT1', BitsEqual(0x90, [0], 0x1)), + Function('SDA11', BitsEqual(0x90, [24], 0x1)), + Function('GPIOC3', None) + ], + 'E6': [ + Function('TIMER4', BitsEqual(0x80, [3], 0x1)), + Function('GPIOA3', None) + ], + 'E7': [ + Function('ROMD15', Or(BitsEqual(0x90, [6], 0x1), BitsEqual(0x70, [4, 1, 0], 0x4))), + Function('RXD6', BitsEqual(0x90, [7], 0x1)), + Function('GPIOH7', None) + ], + 'E8': [ + Function('GPIOV5', BitsEqual(0xa0, [21], 0x1)), + Function('RMII2RXD1', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2RXD1', None) + ], + 'E9': [ + Function('GPIOT7', BitsEqual(0xa0, [7], 0x1)), + Function('UNDEFINED6', BitsEqual(0x70, [7], 0x0)), + Function('RGMII2TXCTL', None) + ], + 'F18': [ + Function('SALT4', BitsEqual(0x80, [11], 0x1)), + Function('GPIOB3', None) + ], + 'F20': [ + Function('SIOS5#', Or(BitsEqual(0xa4, [9], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOY1', None) + ], + 'F3': [ + Function('SDA8', BitsEqual(0x90, [21], 0x1)), + Function('GPIOK7', None) + ], + 'F4': [ + Function('SDA6', BitsEqual(0x90, [19], 0x1)), + Function('GPIOK3', None) + ], + 'F5': [ + Function('SDA4', BitsEqual(0x90, [17], 0x1)), + Function('GPIOQ3', None) + ], + 'G18': [ + Function('SYSCK', BitsEqual(0x70, [13], 0x1)), + Function('GPIOI1', None) + ], + 'G19': [ + Function('SPICK', BitsNotEqual(0x70, [13, 12], 0x0)), + Function('VBCK', BitsEqual(0x70, [5], 0x1)), + Function('GPIOI5', None) + ], + 'G20': [ + Function('SIOPWREQ#', Or(BitsEqual(0xa4, [10], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOY2', None) + ], + 'G5': [ + Function('SCL8', BitsEqual(0x90, [21], 0x1)), + Function('GPIOK6', None) + ], + 'H1': [ + Function('UNDEFINED2', BitsEqual(0x90, [28], 0x1)), + Function('GPIOQ7', None) + ], + 'H18': [ + Function('SALT3', BitsEqual(0x80, [10], 0x1)), + Function('GPIOB2', None) + ], + 'H2': [ + Function('UNDEFINED1', BitsEqual(0x90, [28], 0x1)), + Function('GPIOQ6', None) + ], + 'H20': [ + Function('LPCPME#', BitsEqual(0x80, [14], 0x1)), + Function('GPIOB6', None) + ], + 'H3': [ + Function('SDA14', BitsEqual(0x90, [27], 0x1)), + Function('GPIOQ5', None) + ], + 'H4': [ + Function('SCL14', BitsEqual(0x90, [27], 0x1)), + Function('GPIOQ4', None) + ], + 'J20': [ + Function('SALT2', BitsEqual(0x80, [9], 0x1)), + Function('GPIOB1', None) + ], + 'J21': [ + Function('SALT1', BitsEqual(0x80, [8], 0x1)), + Function('GPIOB0', None) + ], + 'J3': [ + Function('SGPMI', BitsEqual(0x84, [11], 0x1)), + Function('GPIOJ3', None) + ], + 'J4': [ + Function('SGPMLD', BitsEqual(0x84, [9], 0x1)), + Function('GPIOJ1', None) + ], + 'J5': [ + Function('SGPMCK', BitsEqual(0x84, [8], 0x1)), + Function('GPIOJ0', None) + ], + 'K18': [ + Function('ROMA23', And(BitsEqual(0x8c, [7], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR5', And(BitsEqual(0x8c, [7], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOS7', None) + ], + 'K20': [ + Function('SIOONCTRL#', Or(BitsEqual(0xa4, [11], 0x1), BitsEqual(0x70, [19], 0x0))), + Function('GPIOY3', None) + ], + 'K3': [ + Function('UB11_HDN2', BitsEqual(0x90, [3], 0x1)), + Function('UB11_DN', None) + ], + 'K4': [ + Function('UB11_HDP2', BitsEqual(0x90, [3], 0x1)), + Function('UB11_DP', None) + ], + 'K5': [ + Function('SGPMO', BitsEqual(0x84, [10], 0x1)), + Function('GPIOJ2', None) + ], + 'L1': [ + Function('GPIW4', BitsEqual(0xa0, [28], 0x1)), + Function('ADC4', None) + ], + 'L18': [ + Function('ROMA10', And(BitsEqual(0xa4, [24], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOG0', And(BitsEqual(0xa4, [24], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOAA0', None) + ], + 'L19': [ + Function('ROMA11', And(BitsEqual(0xa4, [25], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOG1', And(BitsEqual(0xa4, [25], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOAA1', None) + ], + 'L2': [ + Function('GPIW3', BitsEqual(0xa0, [27], 0x1)), + Function('ADC3', None) + ], + 'L20': [ + Function('ROMA12', And(BitsEqual(0xa4, [26], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOG2', And(BitsEqual(0xa4, [26], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOAA2', None) + ], + 'L21': [ + Function('ROMA13', And(BitsEqual(0xa4, [27], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOG3', And(BitsEqual(0xa4, [27], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOAA3', None) + ], + 'L22': [ + Function('ROMA22', And(BitsEqual(0x8c, [6], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR4', And(BitsEqual(0x8c, [6], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOS6', None) + ], + 'L3': [ + Function('GPIW2', BitsEqual(0xa0, [26], 0x1)), + Function('ADC2', None) + ], + 'L4': [ + Function('GPIW1', BitsEqual(0xa0, [25], 0x1)), + Function('ADC1', None) + ], + 'L5': [ + Function('GPIW0', BitsEqual(0xa0, [24], 0x1)), + Function('ADC0', None) + ], + 'M1': [ + Function('GPIX1', BitsEqual(0xa4, [1], 0x1)), + Function('ADC9', None) + ], + 'M18': [ + Function('ROMA19', And(BitsEqual(0xa8, [1], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR1', And(BitsEqual(0xa8, [1], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAB1', None) + ], + 'M19': [ + Function('ROMA17', And(BitsEqual(0xa4, [31], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOG7', And(BitsEqual(0xa4, [31], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAA7', None) + ], + 'M2': [ + Function('GPIX0', BitsEqual(0xa4, [0], 0x1)), + Function('ADC8', None) + ], + 'M20': [ + Function('ROMA18', And(BitsEqual(0xa8, [0], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR0', And(BitsEqual(0xa8, [0], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAB0', None) + ], + 'M21': [ + Function('ROMA8', And(BitsEqual(0xa4, [22], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB6', And(BitsEqual(0xa4, [22], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ6', None) + ], + 'M22': [ + Function('ROMA9', And(BitsEqual(0xa4, [23], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB7', And(BitsEqual(0xa4, [23], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ7', None) + ], + 'M3': [ + Function('GPIW7', BitsEqual(0xa0, [31], 0x1)), + Function('ADC7', None) + ], + 'M4': [ + Function('GPIW6', BitsEqual(0xa0, [30], 0x1)), + Function('ADC6', None) + ], + 'M5': [ + Function('GPIW5', BitsEqual(0xa0, [29], 0x1)), + Function('ADC5', None) + ], + 'N1': [ + Function('GPIX6', BitsEqual(0xa4, [6], 0x1)), + Function('ADC14', None) + ], + 'N18': [ + Function('ROMA15', And(BitsEqual(0xa4, [29], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOG5', And(BitsEqual(0xa4, [29], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAA5', None) + ], + 'N19': [ + Function('ROMA16', And(BitsEqual(0xa4, [30], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOG6', And(BitsEqual(0xa4, [30], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAA6', None) + ], + 'N2': [ + Function('GPIX5', BitsEqual(0xa4, [5], 0x1)), + Function('ADC13', None) + ], + 'N20': [ + Function('ROMA21', And(BitsEqual(0xa8, [3], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR3', And(BitsEqual(0xa8, [3], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAB3', None) + ], + 'N21': [ + Function('ROMWE#', BitsEqual(0x8c, [5], 0x1)), + Function('GPIOS5', None) + ], + 'N22': [ + Function('ROMA20', And(BitsEqual(0xa8, [2], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR2', And(BitsEqual(0xa8, [2], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAB2', None) + ], + 'N3': [ + Function('GPIX4', BitsEqual(0xa4, [4], 0x1)), + Function('ADC12', None) + ], + 'N4': [ + Function('GPIX3', BitsEqual(0xa4, [3], 0x1)), + Function('ADC11', None) + ], + 'N5': [ + Function('GPIX2', BitsEqual(0xa4, [2], 0x1)), + Function('ADC10', None) + ], + 'P18': [ + Function('ROMA3', And(BitsEqual(0xa4, [17], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB1', And(BitsEqual(0xa4, [17], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ1', None) + ], + 'P19': [ + Function('ROMA4', And(BitsEqual(0xa4, [18], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB2', And(BitsEqual(0xa4, [18], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ2', None) + ], + 'P20': [ + Function('ROMA5', And(BitsEqual(0xa4, [19], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB3', And(BitsEqual(0xa4, [19], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ3', None) + ], + 'P21': [ + Function('ROMA6', And(BitsEqual(0xa4, [20], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB4', And(BitsEqual(0xa4, [20], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ4', None) + ], + 'P22': [ + Function('ROMA7', And(BitsEqual(0xa4, [21], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB5', And(BitsEqual(0xa4, [21], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ5', None) + ], + 'P5': [ + Function('GPIX7', BitsEqual(0xa4, [7], 0x1)), + Function('ADC15', None) + ], + 'R18': [ + Function('ROMOE#', BitsEqual(0x8c, [4], 0x1)), + Function('GPIOS4', None) + ], + 'R22': [ + Function('ROMA2', And(BitsEqual(0xa4, [16], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOB0', And(BitsEqual(0xa4, [16], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOZ0', None) + ], + 'T1': [ + Function('DDCDAT', BitsEqual(0x84, [15], 0x1)), + Function('GPIOJ7', None) + ], + 'T18': [ + Function('ROMA14', And(BitsEqual(0xa4, [28], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOG4', And(BitsEqual(0xa4, [28], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOAA4', None) + ], + 'T19': [ + Function('ROMD5', And(BitsEqual(0x8c, [1], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOHS', And(BitsEqual(0x8c, [1], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOS1', None) + ], + 'T2': [ + Function('DDCCLK', BitsEqual(0x84, [14], 0x1)), + Function('GPIOJ6', None) + ], + 'T4': [ + Function('VGAHS', BitsEqual(0x84, [12], 0x1)), + Function('GPIOJ4', None) + ], + 'T5': [ + Function('VPIDE', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [17], 0x1))), + Function('NDCD1', BitsEqual(0x84, [17], 0x1)), + Function('GPIOL1', None) + ], + 'U1': [ + Function('NCTS1', BitsEqual(0x84, [16], 0x1)), + Function('GPIOL0', None) + ], + 'U18': [ + Function('FLWP#', BitsEqual(0x84, [7], 0x1)), + Function('GPIOG7', None) + ], + 'U19': [ + Function('ROMCS4#', BitsEqual(0x88, [27], 0x1)), + Function('GPIOR3', None) + ], + 'U2': [ + Function('VGAVS', BitsEqual(0x84, [13], 0x1)), + Function('GPIOJ5', None) + ], + 'U20': [ + Function('ROMD7', And(BitsEqual(0x8c, [3], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOCLK', And(BitsEqual(0x8c, [3], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOS3', None) + ], + 'U21': [ + Function('ROMD4', And(BitsEqual(0x8c, [0], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPODE', And(BitsEqual(0x8c, [0], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOS0', None) + ], + 'U3': [ + Function('VPIODD', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [18], 0x1))), + Function('NDSR1', BitsEqual(0x84, [18], 0x1)), + Function('GPIOL2', None) + ], + 'U4': [ + Function('VPIVS', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [20], 0x1))), + Function('NDTR1', BitsEqual(0x84, [20], 0x1)), + Function('GPIOL4', None) + ], + 'U5': [ + Function('VPIB1', And(BitsEqual(0x90, [5, 4], 0x3), BitsEqual(0x84, [23], 0x1))), + Function('RXD1', BitsEqual(0x84, [23], 0x1)), + Function('GPIOL7', None) + ], + 'V1': [ + Function('VPIHS', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [19], 0x1))), + Function('NRI1', BitsEqual(0x84, [19], 0x1)), + Function('GPIOL3', None) + ], + 'V2': [ + Function('VPICLK', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [21], 0x1))), + Function('NRTS1', BitsEqual(0x84, [21], 0x1)), + Function('GPIOL5', None) + ], + 'V20': [ + Function('ROMCS1#', BitsEqual(0x88, [24], 0x1)), + Function('GPIOR0', None) + ], + 'V21': [ + Function('ROMA24', And(BitsEqual(0x88, [28], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR6', And(BitsEqual(0x88, [28], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOR4', None) + ], + 'V22': [ + Function('ROMD6', And(BitsEqual(0x8c, [2], 0x1), BitsEqual(0x94, [1, 0], 0x0))), + Function('VPOVS', And(BitsEqual(0x8c, [2], 0x1), BitsNotEqual(0x94, [1, 0], 0x0))), + Function('GPIOS2', None) + ], + 'V3': [ + Function('VPIB2', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [24], 0x1))), + Function('NCTS2', BitsEqual(0x84, [24], 0x1)), + Function('GPIOM0', None) + ], + 'V4': [ + Function('VPIB5', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [27], 0x1))), + Function('NRI2', BitsEqual(0x84, [27], 0x1)), + Function('GPIOM3', None) + ], + 'V5': [ + Function('VPIB9', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [31], 0x1))), + Function('RXD2', BitsEqual(0x84, [31], 0x1)), + Function('GPIOM7', None) + ], + 'V6': [ + Function('VPIG8', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [8], 0x1))), + Function('GPIOO0/TACH0', None) + ], + 'V7': [ + Function('VPIR5', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [15], 0x1))), + Function('GPIOO7/TACH7', None) + ], + 'W1': [ + Function('VPIB0', And(BitsEqual(0x90, [5, 4], 0x3), BitsEqual(0x84, [22], 0x1))), + Function('TXD1', BitsEqual(0x84, [22], 0x1)), + Function('GPIOL6', None) + ], + 'W2': [ + Function('VPIB3', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [25], 0x1))), + Function('NDCD2', BitsEqual(0x84, [25], 0x1)), + Function('GPIOM1', None) + ], + 'W21': [ + Function('ROMCS2#', BitsEqual(0x88, [25], 0x1)), + Function('GPIOR1', None) + ], + 'W22': [ + Function('ROMA25', And(BitsEqual(0x88, [29], 0x1), BitsEqual(0x94, [1], 0x0))), + Function('VPOR7', And(BitsEqual(0x88, [29], 0x1), BitsEqual(0x94, [1], 0x1))), + Function('GPIOR5', None) + ], + 'W3': [ + Function('VPIB6', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [28], 0x1))), + Function('NDTR2', BitsEqual(0x84, [28], 0x1)), + Function('GPIOM4', None) + ], + 'W4': [ + Function('VPIG0', And(BitsEqual(0x90, [5, 4], 0x3), BitsEqual(0x88, [0], 0x1))), + Function('PWM0', BitsEqual(0x88, [0], 0x1)), + Function('GPION0', None) + ], + 'W5': [ + Function('VPIG4', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x88, [4], 0x1))), + Function('PWM4', BitsEqual(0x88, [4], 0x1)), + Function('GPION4', None) + ], + 'W6': [ + Function('VPIR2', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [12], 0x1))), + Function('GPIOO4/TACH4', None) + ], + 'W7': [ + Function('VPIR8', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [18], 0x1))), + Function('GPIOP2/TACH10', None) + ], + 'Y1': [ + Function('VPIB4', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [26], 0x1))), + Function('NDSR2', BitsEqual(0x84, [26], 0x1)), + Function('GPIOM2', None) + ], + 'Y2': [ + Function('VPIB7', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x84, [29], 0x1))), + Function('NRTS2', BitsEqual(0x84, [29], 0x1)), + Function('GPIOM5', None) + ], + 'Y21': [ + Function('USBCKI', BitsEqual(0x70, [23], 0x1)), + Function('WDTRST2', BitsEqual(0x84, [5], 0x1)), + Function('GPIOG5', None) + ], + 'Y22': [ + Function('ROMCS3#', BitsEqual(0x88, [26], 0x1)), + Function('GPIOR2', None) + ], + 'Y3': [ + Function('VPIG1', And(BitsEqual(0x90, [5, 4], 0x3), BitsEqual(0x88, [1], 0x1))), + Function('PWM1', BitsEqual(0x88, [1], 0x1)), + Function('GPION1', None) + ], + 'Y4': [ + Function('VPIG5', And(BitsNotEqual(0x90, [5, 4], 0x0), BitsEqual(0x88, [5], 0x1))), + Function('PWM5', BitsEqual(0x88, [5], 0x1)), + Function('GPION5', None) + ], + 'Y5': [ + Function('VPIG9', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [9], 0x1))), + Function('GPIOO1/TACH1', None) + ], + 'Y6': [ + Function('VPIR6', And(BitsEqual(0x90, [5, 4], 0x2), BitsEqual(0x88, [16], 0x1))), + Function('GPIOP0/TACH8', None) + ], +} diff --git a/meta-aspeed/recipes-utils/openbmc-gpio/files/ast_gpio_parser.py b/meta-aspeed/recipes-utils/openbmc-gpio/files/ast_gpio_parser.py new file mode 100644 index 0000000..acc4c1a --- /dev/null +++ b/meta-aspeed/recipes-utils/openbmc-gpio/files/ast_gpio_parser.py @@ -0,0 +1,204 @@ +#!/usr/bin/python -tt +# Copyright 2015-present Facebook. All Rights Reserved. +# +# This program file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import argparse +import csv +import logging +import re +import sys + +FUNC_SYMBOL = 'Function' +AND_SYMBOL = 'And' +OR_SYMBOL = 'Or' +BE_SYMBOL = 'BitsEqual' +BNE_SYMBOL = 'BitsNotEqual' + + +class CsvReader: + ''' + A class for parsing the CSV files containing the pin mapping data. + ''' + def __init__(self, path): + self.path = path + + fileobj = open(path, 'r') + self.reader = csv.reader(fileobj, delimiter=b',', quotechar=b'"') + + def next(self): + try: + line = self.reader.next() + except StopIteration: + return None + return line + + +class Expression(object): + def __init__(self, exp): + self.exp = exp + + def parse(self): + # Strap[4,1:0]=100 + m = re.match('([^\[]+)\[(.+)\](!*=)([01]+)', self.exp) + # ('Strap', '4,1:0', '=', '100') + try: + if len(m.groups()) != 4: + raise + scuname = m.group(1) + if scuname.lower() == 'strap': + scu = 0x70 + elif scuname.startswith('SCU'): + scu = int(scuname[3:], 16) + + bits = [] + for bit in m.group(2).split(','): + if ':' in bit: + # it is a range + s, _, e = bit.partition(':') + ss = int(s) + ee = int(e) + if ss < ee: + assert 0 <= ss and ee <= 31 + bits += range(ss, ee + 1) + else: + assert 0 <= ee and ss <= 31 + bits += range(ee, ss + 1) + else: + bits += [int(bit)] + if m.group(3) == '!=': + cond = BNE_SYMBOL + else: + cond = BE_SYMBOL + value = int(m.group(4), 2) + return '%s(0x%x, %s, 0x%x)' \ + % (cond, scu, sorted(bits, reverse=True), value) + except Exception as e: + logging.exception('Failed to parse expression "%s"', self.exp) + + +class Conditions(object): + def __init__(self, cond): + self.cond = re.sub('\s+', '', cond) + + def _next_condition_pos(self, cur): + for idx in range(cur, len(self.cond)): + c = self.cond[idx] + if c == '&' or c == '|': + return idx + return -1 + + def _get_expression(self, exp): + if exp == '': + return None + return Expression(exp).parse() + + def _parse(self, idx): + next_idx = self._next_condition_pos(idx + 1) + if next_idx == -1: + # end of string + return self._get_expression(self.cond[idx:]) + + prev = self._get_expression(self.cond[idx:next_idx]) + if self.cond[next_idx] == '&': + cond = AND_SYMBOL + else: + cond = OR_SYMBOL + return '%s(%s, %s)' % (cond, prev, self._parse(next_idx + 1)) + + def parse(self): + return self._parse(0) + + +class AstGPIO(object): + def __init__(self, data): + self.data = data + self.undefined_func = 1 + self.pins = {} + self.functions = set() + + def _parse_conditions(self, cond): + return Conditions(cond).parse() + + def _parse_funcs(self, parts): + func_fmt = FUNC_SYMBOL + '(\'{func}\', {cond})' + if len(parts) < 1: + return [] + # Unable to process SIORD + if 'SIORD' in ' '.join(parts): + logging.warning('Unable to process SIORD. Ignore') + return [] + func = parts[0] + if func == '': + # nothing after + return [] + if func == '-': + func = 'UNDEFINED%d' % self.undefined_func + self.undefined_func += 1 + assert func not in self.functions + self.functions.add(func) + if len(parts) == 1: + # just has the function name, the last function + return [func_fmt.format(func=func, cond=None)] + cond = self._parse_conditions(parts[1]) + return [func_fmt.format(func=func, cond=cond)] \ + + self._parse_funcs(parts[2:]) + + def parse(self): + while True: + line = self.data.next() + if line is None: + break + + logging.debug('Parsing line: %s' % line) + + # V21,ROMA24,SCU88[28]=1 & SCU94[1]=0,VPOR6,SCU88[28]=1 & SCU94[1]=1,GPIOR4 + pin = line[0] + if pin == "": + # empty line + continue + funcs = self._parse_funcs(line[1:]) + logging.debug('%s: %s' % (pin, funcs)) + assert pin not in self.pins + self.pins[pin] = funcs + + def print(self, out): + for pin in sorted(self.pins): + if len(self.pins[pin]) == 0: + logging.warning('Pin "%s" has no function defined. Skip' % pin) + continue + out.write(' \'%s\': [\n %s\n ],\n' + % (pin, ',\n '.join(self.pins[pin]))) + + +def main(): + ap = argparse.ArgumentParser() + ap.add_argument('data', help='The GPIO data file') + args = ap.parse_args() + + logging.basicConfig(level=logging.INFO, format='%(asctime)s: %(message)s') + + gpio = AstGPIO(CsvReader(args.data)) + gpio.parse() + gpio.print(sys.stdout) + + +rc = main() +sys.exit(rc) diff --git a/meta-aspeed/recipes-utils/openbmc-gpio/files/data/ast2400-gpio.csv b/meta-aspeed/recipes-utils/openbmc-gpio/files/data/ast2400-gpio.csv new file mode 100644 index 0000000..d41460e --- /dev/null +++ b/meta-aspeed/recipes-utils/openbmc-gpio/files/data/ast2400-gpio.csv @@ -0,0 +1,225 @@ +D6,MAC1LINK,SCU80[0]=1,GPIOA0,, +B5,MAC2LINK,SCU80[1]=1,GPIOA1,, +A4,TIMER3,SCU80[2]=1,GPIOA2,, +E6,TIMER4,SCU80[3]=1,GPIOA3,, +C5,SCL9,SCU90[22]=1,TIMER5,SCU80[4]=1,GPIOA4 +B4,SDA9,SCU90[22]=1,TIMER6,SCU80[5]=1,GPIOA5 +A3,MDC2,SCU90[2]=1,TIMER7,SCU80[6]=1,GPIOA6 +D5,MDIO2,SCU90[2]=1,TIMER8,SCU80[7]=1,GPIOA7 +J21,SALT1,SCU80[8]=1,GPIOB0,, +J20,SALT2,SCU80[9]=1,GPIOB1,, +H18,SALT3,SCU80[10]=1,GPIOB2,, +F18,SALT4,SCU80[11]=1,GPIOB3,, +E19,LPCRST#,SCU80[12]=1 | Strap[14]=1,GPIOB4,, +H19,LPCPD#,SCU80[13]=1 & SIORD30[1]=0,LPCSMI#,SCU80[13]=1 & SIORD30[1]=1,GPIOB5 +H20,LPCPME#,SCU80[14]=1,GPIOB6,, +E18,EXTRST#,SCU80[15]=1 & SCU90[31]=0 & SCU3C[3]=1,SPICS1#,SCU80[15]=1 & SCU90[31]=1,GPIOB7 +C4,SD1CLK,SCU90[0]=1,SCL10,SCU90[23]=1,GPIOC0 +B3,SD1CMD,SCU90[0]=1,SDA10,SCU90[23]=1,GPIOC1 +A2,SD1DAT0,SCU90[0]=1,SCL11,SCU90[24]=1,GPIOC2 +E5,SD1DAT1,SCU90[0]=1,SDA11,SCU90[24]=1,GPIOC3 +D4,SD1DAT2,SCU90[0]=1,SCL12,SCU90[25]=1,GPIOC4 +C3,SD1DAT3,SCU90[0]=1,SDA12,SCU90[25]=1,GPIOC5 +B2,SD1CD#,SCU90[0]=1,SCL13,SCU90[26]=1,GPIOC6 +A1,SD1WP#,SCU90[0]=1,SDA13,SCU90[26]=1,GPIOC7 +,,,,, +A18,SD2CLK,SCU90[1]=1,GPID0(In),SCU8C[8]=1 | Strap[21]=1,GPIOD0 +D16,SD2CMD,SCU90[1]=1,GPID0(Out),SCU8C[8]=1 | Strap[21]=1,GPIOD1 +B17,SD2DAT0,SCU90[1]=1,GPID2(In),SCU8C[9]=1 | Strap[21]=1,GPIOD2 +A17,SD2DAT1,SCU90[1]=1,GPID2(Out),SCU8C[9]=1 | Strap[21]=1,GPIOD3 +C16,SD2DAT2,SCU90[1]=1,GPID4(In),SCU8C[10]=1 | Strap[21]=1,GPIOD4 +B16,SD2DAT3,SCU90[1]=1,GPID4(Out),SCU8C[10]=1 | Strap[21]=1,GPIOD5 +A16,SD2CD#,SCU90[1]=1,GPID6(In),SCU8C[11]=1 | Strap[21]=1,GPIOD6 +E15,SD2WP#,SCU90[1]=1,GPID6(Out),SCU8C[11]=1 | Strap[21]=1,GPIOD7 +D15,NCTS3,SCU80[16]=1,GPIE0(In),SCU8C[12]=1 | Strap[22]=1,GPIOE0 +C15,NDCD3,SCU80[17]=1,GPIE0(Out),SCU8C[12]=1 | Strap[22]=1,GPIOE1 +B15,NDSR3,SCU80[18]=1,GPIE2(In),SCU8C[13]=1 | Strap[22]=1,GPIOE2 +A15,NRI3,SCU80[19]=1,GPIE2(Out),SCU8C[13]=1 | Strap[22]=1,GPIOE3 +E14,NDTR3,SCU80[20]=1,GPIE4(In),SCU8C[14]=1 | Strap[22]=1,GPIOE4 +D14,NRTS3,SCU80[21]=1,GPIE4(Out),SCU8C[14]=1 | Strap[22]=1,GPIOE5 +C14,TXD3,SCU80[22]=1,GPIE6(In),SCU8C[15]=1 | Strap[22]=1,GPIOE6 +B14,RXD3,SCU80[23]=1,GPIE6(Out),SCU8C[15]=1 | Strap[22]=1,GPIOE7 +D18,NCTS4,SCU80[24]=1,GPIOF0,, +B19,NDCD4,SCU80[25]=1,SIOPBI#,SCUA4[12]=1 | Strap[19]=0,GPIOF1 +A20,NDSR4,SCU80[26]=1,SIOPWRGD,SCUA4[13]=1 | Strap[19]=0,GPIOF2 +D17,NRI4,SCU80[27]=1,SIOPBO#,SCUA4[14]=1 | Strap[19]=0,GPIOF3 +B18,NDTR4,SCU80[28]=1,GPIOF4,, +A19,NRTS4,SCU80[29]=1,SIOSCI#,SCUA4[15]=1 | Strap[19]=0,GPIOF5 +E16,TXD4,SCU80[30]=1,GPIOF6,, +C17,RXD4,SCU80[31]=1,GPIOF7,, +A14,SGPSCK,SCU84[0]=1,GPIOG0,, +E13,SGPSLD,SCU84[1]=1,GPIOG1,, +D13,SGPSI0,SCU84[2]=1,GPIOG2,, +C13,SGPSI1,SCU84[3]=1,GPIOG3,, +,,,,, +B13,OSCCLK,SCU2C[1]=1,WDTRST1,SCU84[4]=1,GPIOG4 +Y21,USBCKI,Strap[23]=1,WDTRST2,SCU84[5]=1,GPIOG5 +AA22,FLBUSY#,SCU84[6]=1,GPIOG6,, +U18,FLWP#,SCU84[7]=1,GPIOG7,, +A8,ROMD8,"SCU90[6]=1 | Strap[4,1:0]=100",NCTS6,SCU90[7]=1,GPIOH0 +C7,ROMD9,"SCU90[6]=1 | Strap[4,1:0]=100",NDCD6,SCU90[7]=1,GPIOH1 +B7,ROMD10,"SCU90[6]=1 | Strap[4,1:0]=100",NDSR6,SCU90[7]=1,GPIOH2 +A7,ROMD11,"SCU90[6]=1 | Strap[4,1:0]=100",NRI6,SCU90[7]=1,GPIOH3 +D7,ROMD12,"SCU90[6]=1 | Strap[4,1:0]=100",NDTR6,SCU90[7]=1,GPIOH4 +B6,ROMD13,"SCU90[6]=1 | Strap[4,1:0]=100",NRTS6,SCU90[7]=1,GPIOH5 +A6,ROMD14,"SCU90[6]=1 | Strap[4,1:0]=100",TXD6,SCU90[7]=1,GPIOH6 +E7,ROMD15,"SCU90[6]=1 | Strap[4,1:0]=100",RXD6,SCU90[7]=1,GPIOH7 +C22,SYSCS#,Strap[13]=1,GPIOI0,, +G18,SYSCK,Strap[13]=1,GPIOI1,, +D19,SYSDO,Strap[13]=1,GPIOI2,, +C20,SYSDI,Strap[13]=1,GPIOI3,, +B22,SPICS0#,Strap[13:12]!=0,VBCS#,Strap[5]=1,GPIOI4 +G19,SPICK,Strap[13:12]!=0,VBCK,Strap[5]=1,GPIOI5 +C18,SPIDO,Strap[13:12]!=0,VBDO,Strap[5]=1,GPIOI6 +E20,SPIDI,Strap[13:12]!=0,VBDI,Strap[5]=1,GPIOI7 +J5,SGPMCK,SCU84[8]=1,GPIOJ0,, +J4,SGPMLD,SCU84[9]=1,GPIOJ1,, +K5,SGPMO,SCU84[10]=1,GPIOJ2,, +J3,SGPMI,SCU84[11]=1,GPIOJ3,, +T4,VGAHS,SCU84[12]=1,GPIOJ4,, +U2,VGAVS,SCU84[13]=1,GPIOJ5,, +T2,DDCCLK,SCU84[14]=1,GPIOJ6,, +T1,DDCDAT,SCU84[15]=1,GPIOJ7,, +,,,,, +E3,SCL5,SCU90[18]=1,GPIOK0,, +D2,SDA5,SCU90[18]=1,GPIOK1,, +C1,SCL6,SCU90[19]=1,GPIOK2,, +F4,SDA6,SCU90[19]=1,GPIOK3,, +E2,SCL7,SCU90[20]=1,GPIOK4,, +D1,SDA7,SCU90[20]=1,GPIOK5,, +G5,SCL8,SCU90[21]=1,GPIOK6,, +F3,SDA8,SCU90[21]=1,GPIOK7,, +U1,NCTS1,SCU84[16]=1,GPIOL0,, +T5,VPIDE,SCU90[5:4]!=0 & SCU84[17]=1,NDCD1,SCU84[17]=1,GPIOL1 +U3,VPIODD,SCU90[5:4]!=0 & SCU84[18]=1,NDSR1,SCU84[18]=1,GPIOL2 +V1,VPIHS,SCU90[5:4]!=0 & SCU84[19]=1,NRI1,SCU84[19]=1,GPIOL3 +U4,VPIVS,SCU90[5:4]!=0 & SCU84[20]=1,NDTR1,SCU84[20]=1,GPIOL4 +V2,VPICLK,SCU90[5:4]!=0 & SCU84[21]=1,NRTS1,SCU84[21]=1,GPIOL5 +W1,VPIB0,SCU90[5:4]=11 & SCU84[22]=1,TXD1,SCU84[22]=1,GPIOL6 +U5,VPIB1,SCU90[5:4]=11 & SCU84[23]=1,RXD1,SCU84[23]=1,GPIOL7 +V3,VPIB2,SCU90[5:4]!=0 & SCU84[24]=1,NCTS2,SCU84[24]=1,GPIOM0 +W2,VPIB3,SCU90[5:4]!=0 & SCU84[25]=1,NDCD2,SCU84[25]=1,GPIOM1 +Y1,VPIB4,SCU90[5:4]!=0 & SCU84[26]=1,NDSR2,SCU84[26]=1,GPIOM2 +V4,VPIB5,SCU90[5:4]!=0 & SCU84[27]=1,NRI2,SCU84[27]=1,GPIOM3 +W3,VPIB6,SCU90[5:4]!=0 & SCU84[28]=1,NDTR2,SCU84[28]=1,GPIOM4 +Y2,VPIB7,SCU90[5:4]!=0 & SCU84[29]=1,NRTS2,SCU84[29]=1,GPIOM5 +AA1,VPIB8,SCU90[5:4]!=0 & SCU84[30]=1,TXD2,SCU84[30]=1,GPIOM6 +V5,VPIB9,SCU90[5:4]!=0 & SCU84[31]=1,RXD2,SCU84[31]=1,GPIOM7 +W4,VPIG0,SCU90[5:4]=11 & SCU88[0]=1,PWM0,SCU88[0]=1,GPION0 +Y3,VPIG1,SCU90[5:4]=11 & SCU88[1]=1,PWM1,SCU88[1]=1,GPION1 +AA2,VPIG2,SCU90[5:4]!=0 & SCU88[2]=1,PWM2,SCU88[2]=1,GPION2 +AB1,VPIG3,SCU90[5:4]!=0 & SCU88[3]=1,PWM3,SCU88[3]=1,GPION3 +,,,,, +W5,VPIG4,SCU90[5:4]!=0 & SCU88[4]=1,PWM4,SCU88[4]=1,GPION4 +Y4,VPIG5,SCU90[5:4]!=0 & SCU88[5]=1,PWM5,SCU88[5]=1,GPION5 +AA3,VPIG6,SCU90[5:4]=10 & SCU88[6]=1,PWM6,SCU88[6]=1,GPION6 +AB2,VPIG7,SCU90[5:4]=10 & SCU88[7]=1,PWM7,SCU88[7]=1,GPION7 +V6,VPIG8,SCU90[5:4]=10 & SCU88[8]=1,GPIOO0/TACH0,, +Y5,VPIG9,SCU90[5:4]=10 & SCU88[9]=1,GPIOO1/TACH1,, +AA4,VPIR0,SCU90[5:4]=11 & SCU88[10]=1,GPIOO2/TACH2,, +AB3,VPIR1,SCU90[5:4]=11 & SCU88[11]=1,GPIOO3/TACH3,, +W6,VPIR2,SCU90[5:4]=10 & SCU88[12]=1,GPIOO4/TACH4,, +AA5,VPIR3,SCU90[5:4]=10 & SCU88[13]=1,GPIOO5/TACH5,, +AB4,VPIR4,SCU90[5:4]=10 & SCU88[14]=1,GPIOO6/TACH6,, +V7,VPIR5,SCU90[5:4]=10 & SCU88[15]=1,GPIOO7/TACH7,, +Y6,VPIR6,SCU90[5:4]=10 & SCU88[16]=1,GPIOP0/TACH8,, +AB5,VPIR7,SCU90[5:4]=10 & SCU88[17]=1,GPIOP1/TACH9,, +W7,VPIR8,SCU90[5:4]=10 & SCU88[18]=1,GPIOP2/TACH10,, +AA6,VPIR9,SCU90[5:4]=10 & SCU88[19]=1,GPIOP3/TACH11,, +AA7,BMCINT,SCU88[22]=1,GPIOP6/TACH14,, +AB7,FLACK,SCU88[23]=1,GPIOP7/TACH15,, +D3,SCL3,SCU90[16]=1,GPIOQ0,, +C2,SDA3,SCU90[16]=1,GPIOQ1,, +B1,SCL4,SCU90[17]=1,GPIOQ2,, +F5,SDA4,SCU90[17]=1,GPIOQ3,, +H4,SCL14,SCU90[27]=1,GPIOQ4,, +H3,SDA14,SCU90[27]=1,GPIOQ5,, +H2,-,SCU90[28]=1,GPIOQ6,, +H1,-,SCU90[28]=1,GPIOQ7,, +V20,ROMCS1#,SCU88[24]=1,GPIOR0,, +W21,ROMCS2#,SCU88[25]=1,GPIOR1,, +,,,,, +Y22,ROMCS3#,SCU88[26]=1,GPIOR2,, +U19,ROMCS4#,SCU88[27]=1,GPIOR3,, +V21,ROMA24,SCU88[28]=1 & SCU94[1]=0,VPOR6,SCU88[28]=1 & SCU94[1]=1,GPIOR4 +W22,ROMA25,SCU88[29]=1 & SCU94[1]=0,VPOR7,SCU88[29]=1 & SCU94[1]=1,GPIOR5 +C6,MDC1,SCU88[30]=1,GPIOR6, , +A5,MDIO1,SCU88[31]=1,GPIOR7, , +U21,ROMD4,SCU8C[0]=1 & SCU94[1:0]=0,VPODE,SCU8C[0]=1 & SCU94[1:0]!=0,GPIOS0 +T19,ROMD5,SCU8C[1]=1 & SCU94[1:0]=0,VPOHS,SCU8C[1]=1 & SCU94[1:0]!=0,GPIOS1 +V22,ROMD6,SCU8C[2]=1 & SCU94[1:0]=0,VPOVS,SCU8C[2]=1 & SCU94[1:0]!=0,GPIOS2 +U20,ROMD7,SCU8C[3]=1 & SCU94[1:0]=0,VPOCLK,SCU8C[3]=1 & SCU94[1:0]!=0,GPIOS3 +R18,ROMOE#,SCU8C[4]=1,GPIOS4, , +N21,ROMWE#,SCU8C[5]=1,GPIOS5, , +L22,ROMA22,SCU8C[6]=1 & SCU94[1]=0,VPOR4,SCU8C[6]=1 & SCU94[1]=1,GPIOS6 +K18,ROMA23,SCU8C[7]=1 & SCU94[1]=0,VPOR5,SCU8C[7]=1 & SCU94[1]=1,GPIOS7 +A12,GPIOT0,SCUA0[0]=1,RMII1TXEN,Strap[6]=0,RGMII1TXCK +B12,GPIOT1,SCUA0[1]=1,-,Strap[6]=0,RGMII1TXCTL +C12,GPIOT2,SCUA0[2]=1,RMII1TXD0,Strap[6]=0,RGMII1TXD0 +D12,GPIOT3,SCUA0[3]=1,RMII1TXD1,Strap[6]=0,RGMII1TXD1 +E12,GPIOT4,SCUA0[4]=1,-,Strap[6]=0,RGMII1TXD2 +A13,GPIOT5,SCUA0[5]=1,-,Strap[6]=0,RGMII1TXD3 +D9,GPIOT6,SCUA0[6]=1,RMII2TXEN,Strap[7]=0,RGMII2TXCK +E9,GPIOT7,SCUA0[7]=1,-,Strap[7]=0,RGMII2TXCTL +A10,GPIOU0,SCUA0[8]=1,RMII2TXD0,Strap[7]=0,RGMII2TXD0 +B10,GPIOU1,SCUA0[9]=1,RMII2TXD1,Strap[7]=0,RGMII2TXD1 +C10,GPIOU2,SCUA0[10]=1,-,Strap[7]=0,RGMII2TXD2 +D10,GPIOU3,SCUA0[11]=1,-,Strap[7]=0,RGMII2TXD3 +E11,GPIOU4,SCUA0[12]=1,RMII1RCLK,Strap[6]=0,RGMII1RXCK +D11,GPIOU5,SCUA0[13]=1,-,Strap[6]=0,RGMII1RXCTL +,,,,, +C11,GPIOU6,SCUA0[14]=1,RMII1RXD0,Strap[6]=0,RGMII1RXD0 +B11,GPIOU7,SCUA0[15]=1,RMII1RXD1,Strap[6]=0,RGMII1RXD1 +A11,GPIOV0,SCUA0[16]=1,RMII1CRSDV,Strap[6]=0,RGMII1RXD2 +E10,GPIOV1,SCUA0[17]=1,RMII1RXER,Strap[6]=0,RGMII1RXD3 +C9,GPIOV2,SCUA0[18]=1,RMII2RCLK,Strap[7]=0,RGMII2RXCK +B9,GPIOV3,SCUA0[19]=1,-,Strap[7]=0,RGMII2RXCTL +A9,GPIOV4,SCUA0[20]=1,RMII2RXD0,Strap[7]=0,RGMII2RXD0 +E8,GPIOV5,SCUA0[21]=1,RMII2RXD1,Strap[7]=0,RGMII2RXD1 +D8,GPIOV6,SCUA0[22]=1,RMII2CRSDV,Strap[7]=0,RGMII2RXD2 +C8,GPIOV7,SCUA0[23]=1,RMII2RXER,Strap[7]=0,RGMII2RXD3 +L5,GPIW0,SCUA0[24]=1,ADC0,, +L4,GPIW1,SCUA0[25]=1,ADC1,, +L3,GPIW2,SCUA0[26]=1,ADC2,, +L2,GPIW3,SCUA0[27]=1,ADC3,, +L1,GPIW4,SCUA0[28]=1,ADC4,, +M5,GPIW5,SCUA0[29]=1,ADC5,, +M4,GPIW6,SCUA0[30]=1,ADC6,, +M3,GPIW7,SCUA0[31]=1,ADC7,, +M2,GPIX0,SCUA4[0]=1,ADC8,, +M1,GPIX1,SCUA4[1]=1,ADC9,, +N5,GPIX2,SCUA4[2]=1,ADC10,, +N4,GPIX3,SCUA4[3]=1,ADC11,, +N3,GPIX4,SCUA4[4]=1,ADC12,, +N2,GPIX5,SCUA4[5]=1,ADC13,, +N1,GPIX6,SCUA4[6]=1,ADC14,, +P5,GPIX7,SCUA4[7]=1,ADC15,, +C21,SIOS3#,SCUA4[8]=1 | Strap[19]=0,GPIOY0,, +F20,SIOS5#,SCUA4[9]=1 | Strap[19]=0,GPIOY1,, +,,,,, +G20,SIOPWREQ#,SCUA4[10]=1 | Strap[19]=0,GPIOY2,, +K20,SIOONCTRL#,SCUA4[11]=1 | Strap[19]=0,GPIOY3,, +R22,ROMA2,SCUA4[16]=1 & SCU94[1:0]=0,VPOB0,SCUA4[16]=1 & SCU94[1:0]!=0,GPIOZ0 +P18,ROMA3,SCUA4[17]=1 & SCU94[1:0]=0,VPOB1,SCUA4[17]=1 & SCU94[1:0]!=0,GPIOZ1 +P19,ROMA4,SCUA4[18]=1 & SCU94[1:0]=0,VPOB2,SCUA4[18]=1 & SCU94[1:0]!=0,GPIOZ2 +P20,ROMA5,SCUA4[19]=1 & SCU94[1:0]=0,VPOB3,SCUA4[19]=1 & SCU94[1:0]!=0,GPIOZ3 +P21,ROMA6,SCUA4[20]=1 & SCU94[1:0]=0,VPOB4,SCUA4[20]=1 & SCU94[1:0]!=0,GPIOZ4 +P22,ROMA7,SCUA4[21]=1 & SCU94[1:0]=0,VPOB5,SCUA4[21]=1 & SCU94[1:0]!=0,GPIOZ5 +M21,ROMA8,SCUA4[22]=1 & SCU94[1:0]=0,VPOB6,SCUA4[22]=1 & SCU94[1:0]!=0,GPIOZ6 +M22,ROMA9,SCUA4[23]=1 & SCU94[1:0]=0,VPOB7,SCUA4[23]=1 & SCU94[1:0]!=0,GPIOZ7 +L18,ROMA10,SCUA4[24]=1 & SCU94[1:0]=0,VPOG0,SCUA4[24]=1 & SCU94[1:0]!=0,GPIOAA0 +L19,ROMA11,SCUA4[25]=1 & SCU94[1:0]=0,VPOG1,SCUA4[25]=1 & SCU94[1:0]!=0,GPIOAA1 +L20,ROMA12,SCUA4[26]=1 & SCU94[1:0]=0,VPOG2,SCUA4[26]=1 & SCU94[1:0]!=0,GPIOAA2 +L21,ROMA13,SCUA4[27]=1 & SCU94[1:0]=0,VPOG3,SCUA4[27]=1 & SCU94[1:0]!=0,GPIOAA3 +T18,ROMA14,SCUA4[28]=1 & SCU94[1]=0,VPOG4,SCUA4[28]=1 & SCU94[1]=1,GPIOAA4 +N18,ROMA15,SCUA4[29]=1 & SCU94[1]=0,VPOG5,SCUA4[29]=1 & SCU94[1]=1,GPIOAA5 +N19,ROMA16,SCUA4[30]=1 & SCU94[1]=0,VPOG6,SCUA4[30]=1 & SCU94[1]=1,GPIOAA6 +M19,ROMA17,SCUA4[31]=1 & SCU94[1]=0,VPOG7,SCUA4[31]=1 & SCU94[1]=1,GPIOAA7 +M20,ROMA18,SCUA8[0]=1 & SCU94[1]=0,VPOR0,SCUA8[0]=1 & SCU94[1]=1,GPIOAB0 +M18,ROMA19,SCUA8[1]=1 & SCU94[1]=0,VPOR1,SCUA8[1]=1 & SCU94[1]=1,GPIOAB1 +N22,ROMA20,SCUA8[2]=1 & SCU94[1]=0,VPOR2,SCUA8[2]=1 & SCU94[1]=1,GPIOAB2 +N20,ROMA21,SCUA8[3]=1 & SCU94[1]=0,VPOR3,SCUA8[3]=1 & SCU94[1]=1,GPIOAB3 +K4,UB11_HDP2,SCU90[3]=1,UB11_DP,, +K3,UB11_HDN2,SCU90[3]=1,UB11_DN,, +AB21,USB2_HDP,SCU90[29]=1,USB2_DP,, +AB20,USB2_HDN,SCU90[29]=1,USB2_DN,, diff --git a/meta-aspeed/recipes-utils/openbmc-gpio/files/soc_gpio.py b/meta-aspeed/recipes-utils/openbmc-gpio/files/soc_gpio.py new file mode 100644 index 0000000..ea3c8d3 --- /dev/null +++ b/meta-aspeed/recipes-utils/openbmc-gpio/files/soc_gpio.py @@ -0,0 +1,42 @@ +# Copyright 2015-present Facebook. All rights reserved. +# +# This program file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +import phymemory + + +_soc_reg_map = {} + + +class SCUReg(phymemory.PhyMemory): + SCU_REG_MAX = 0x1A4 + SCU_ADDR_BASE = 0x1E6E2000 + def __init__(self, reg): + assert 0 <= reg <= self.SCU_REG_MAX + self.reg = reg + super(SCUReg, self).__init__(self.SCU_ADDR_BASE + reg, 'SCU%X' % reg) + + +def soc_get_register(addr): + if addr in _soc_reg_map: + return _soc_reg_map[addr] + reg = SCUReg(addr) + _soc_reg_map[addr] = reg + return reg diff --git a/meta-aspeed/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend b/meta-aspeed/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend new file mode 100644 index 0000000..a87a8c9 --- /dev/null +++ b/meta-aspeed/recipes-utils/openbmc-gpio/openbmc-gpio_%.bbappend @@ -0,0 +1,23 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += " \ + file://soc_gpio.py \ + file://ast2400_gpio_table.py \ + " diff --git a/meta-aspeed/recipes-utils/soc-utils/files/COPYING b/meta-aspeed/recipes-utils/soc-utils/files/COPYING new file mode 100644 index 0000000..3912109 --- /dev/null +++ b/meta-aspeed/recipes-utils/soc-utils/files/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/meta-aspeed/recipes-utils/soc-utils/files/soc-utils.sh b/meta-aspeed/recipes-utils/soc-utils/files/soc-utils.sh new file mode 100644 index 0000000..33d772f --- /dev/null +++ b/meta-aspeed/recipes-utils/soc-utils/files/soc-utils.sh @@ -0,0 +1,20 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +scu_addr() { + echo $((0x1E6E2000 + 0x$1)) +} diff --git a/meta-aspeed/recipes-utils/soc-utils/openbmc-utils_%.bbappend b/meta-aspeed/recipes-utils/soc-utils/openbmc-utils_%.bbappend new file mode 100644 index 0000000..cb8d362 --- /dev/null +++ b/meta-aspeed/recipes-utils/soc-utils/openbmc-utils_%.bbappend @@ -0,0 +1,26 @@ +# Copyright 2014-present Facebook. All Rights Reserved. +# +# This program file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; version 2 of the License. +# +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program in a file named COPYING; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301 USA + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI += " \ + file://soc-utils.sh \ + " + +OPENBMC_UTILS_FILES += " \ + soc-utils.sh \ + " -- cgit v1.1