Merge branch 'master' of github.com:opencomputeproject/OpenNetworkLinux into new_partitions

This commit is contained in:
Jeffrey Townsend
2016-04-13 15:24:32 -07:00
36 changed files with 535 additions and 76 deletions

View File

@@ -357,7 +357,7 @@ do_cleanup()
cat /var/log/onie.log > /dev/console
installer_say "Install failed. See log messages above for details"
grep "$workdir" /proc/mounts | cut -d' ' -f2 | sort -r | xargs -n 1 umount
grep "$workdir" /proc/mounts | cut -d' ' -f2 | sort -r | xargs -r -n 1 umount
cd /tmp
rm -fr "$workdir"

View File

@@ -7,7 +7,7 @@ ifndef ONL
$(error $$ONL is not defined)
endif
ifndef ONLPM_PY
ifndef ONLPM
ONLPM := $(ONL)/tools/onlpm.py
endif
@@ -26,16 +26,41 @@ export ONL_DEBIAN_SUITE_$(ONL_DEBIAN_SUITE)=1
export BUILD_DIR_BASE=BUILD/$(ONL_DEBIAN_SUITE)
# Generate manifest if necessary
export MODULEMANIFEST := $(shell $(BUILDER)/tools/mmg.py --dirs $(ONL) $(ONLPM_OPTION_PACKAGEDIRS) --out $(ONL)/make/module-manifest.mk --only-if-missing make)
#
# Default make options.
#
ONL_MAKE_FLAGS += --no-print-directory -s
ONL_MAKE := $(MAKE) $(ONL_MAKE_FLAGS)
ifeq ("$(origin V)", "command line")
VERBOSE := $(V)
endif
ifneq ($(VERBOSE),1)
# quiet settings
ONL_V_P := false
ONL_V_at := @
ONL_V_GEN = @set -e; echo GEN $@;
else
# verbose settings
ONL_V_P := :
endif
ifneq ($(VERBOSE),1)
ONL_MAKE_FLAGS += --no-print-directory -s
else
ONL_MAKE_FLAGS += V=1
endif
ONL_MAKE := $(MAKE) $(ONL_MAKE_FLAGS)
#
# Some build and autogen tools require these settings.

View File

@@ -17,41 +17,50 @@ ifndef ARCHES
ARCHES := amd64 powerpc armel all
endif
ONLPM_ENVIRONMENT = \
MAKE=$(MAKE) \
# THIS LINE INTENTIONALLY LEFT BLANK
ifneq ($(VERBOSE),1)
else
ONLPM_ENVIRONMENT += ONLPM_VERBOSE=1
endif
pkgall:
$(ONL_V_at) MAKE=$(MAKE) onlpm.py --build all --arches $(ARCHES)
$(ONL_V_GEN) $(ONLPM_ENVIRONMENT) $(ONLPM) $(ONLPM_OPTS) --build all --arches $(ARCHES)
clean:
$(ONL_V_at) MAKE=$(MAKE) onlpm.py --clean all --arches $(ARCHES)
$(ONL_V_GEN) $(ONLPM_ENVIRONMENT) $(ONLPM) $(ONLPM_OPTS) --clean all --arches $(ARCHES)
rebuild:
$(ONL_V_at) MAKE=$(MAKE) onlpm.py --rebuild-pkg-cache
$(ONL_V_GEN) $(ONLPM_ENVIRONMENT) $(ONLPM) $(ONLPM_OPTS) --rebuild-pkg-cache
#
# Check all package declarations.
#
check:
$(ONL_V_at) MAKE=$(MAKE) onlpm.py --packagedirs=`pwd` --no-pkg-cache
$(ONL_V_GEN) $(ONLPM_ENVIRONMENT) $(ONLPM) $(ONLPM_OPTS) --packagedirs=`pwd` --no-pkg-cache
subdir:
$(ONL_V_at) MAKE=$(MAKE) onlpm.py --packagedirs=`pwd` --build all --no-pkg-cache
$(ONL_V_GEN) $(ONLPM_ENVIRONMENT) $(ONLPM) $(ONLPM_OPTS) --packagedirs=`pwd` --build all --no-pkg-cache
#
# Package construction only (no build step)
#
pkg:
$(ONL_V_at) MAKE=$(MAKE) NOBUILD=1 onlpm.py --build all --arches $(ARCHES)
$(ONL_V_GEN) $(ONLPM_ENVIRONMENT) NOBUILD=1 $(ONLPM) $(ONLPM_OPTS) --build all --arches $(ARCHES)
#
# Generate a rule for all available packages
#
ALL_PACKAGES := $(shell onlpm.py --list-all)
ALL_PACKAGES := $(shell $(ONLPM_ENVIRONMENT) $(ONLPM) $(ONLPM_OPTS) --list-all)
define package_build_template
package-$(1):
$(ONL_V_at) onlpm.py --build $(2)
$(ONL_V_GEN) $(ONLPM_ENVIRONMENT) $(ONLPM) $(ONLPM_OPTS) --build $(2)
endef
$(foreach p,$(ALL_PACKAGES),$(eval $(call package_build_template,$(subst :,_,$(p)),$(p))))

View File

@@ -1,22 +1,22 @@
/**************************************************************************//**
*
* <bsn.cl fy=2013 v=onl>
*
* Copyright 2013, 2014 BigSwitch Networks, Inc.
*
*
* Copyright 2013, 2014 BigSwitch Networks, Inc.
*
* Licensed under the Eclipse Public License, Version 1.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*
*
* </bsn.cl>
*
*****************************************************************************/
@@ -150,7 +150,7 @@ faultd_main(int argc, char* argv[])
aim_daemon_config_t config;
memset(&config, 0, sizeof(config));
aim_daemon_restart_config_init(&rconfig, 1, 1);
aim_daemon_restart_config_init(&rconfig, 1, 1, argv);
AIM_BITMAP_CLR(&rconfig.signal_restarts, SIGTERM);
AIM_BITMAP_CLR(&rconfig.signal_restarts, SIGKILL);
rconfig.maximum_restarts=0;

View File

@@ -39,6 +39,7 @@ buildroot-initrd-$(ARCH).cpio.gz: $(ONL_BUILDROOT)/.setup.done
chmod +x makedevs
$(ONL_BUILDROOT)/.setup.done:
mkdir -p $(ONL_BUILDROOT)/buildroot-mirror/dl
$(MAKE) -C $(ONL_BUILDROOT) setup
touch $(ONL_BUILDROOT)/.setup.done

View File

@@ -28,18 +28,53 @@ clean:
rm -rf $(BUILDROOT_ARCHDIRS)
setup:
setup: setup-pyroute2 setup-dnspython setup-libyaml setup-pyyaml setup-jq setup-pyparted
cp $(wildcard patches/busybox*.patch) $(BUILDROOT_SOURCE)/package/busybox/
cp $(wildcard patches/kexec*.patch) $(BUILDROOT_SOURCE)/package/kexec/
sed -i 's%^DOSFSTOOLS_SITE =.*%DOSFSTOOLS_SITE = http://downloads.openwrt.org/sources%' $(BUILDROOT_SOURCE)/package/dosfstools/dosfstools.mk
sed -i 's%^UEMACS_SITE =.*%UEMACS_SITE = http://www.kernel.org/pub/linux/kernel/uemacs%;s%^UEMACS_SOURCE =.*%UEMACS_SOURCE = em-$$(UEMACS_VERSION).tar.gz%' $(BUILDROOT_SOURCE)/package/uemacs/uemacs.mk
mkdir -p $(BUILDROOT_ARCHDIRS)
$(foreach a,$(ARCHS),cp buildroot.config-$(a) buildroot-$(a)/.config ;)
setup-jq:
mkdir -p $(BUILDROOT_SOURCE)/package/jq
cp patches/jq.mk $(BUILDROOT_SOURCE)/package/jq/jq.mk
cp patches/jq.Config.in $(BUILDROOT_SOURCE)/package/jq/Config.in
sed -i '/[/]jq[/]/d' $(BUILDROOT_SOURCE)/package/Config.in
sed -i '/[/]yajl[/]/a\source "package/jq/Config.in"' $(BUILDROOT_SOURCE)/package/Config.in
mkdir -p $(BUILDROOT_ARCHDIRS)
$(foreach a,$(ARCHS),cp buildroot.config-$(a) buildroot-$(a)/.config ;)
setup-pyroute2:
mkdir -p $(BUILDROOT_SOURCE)/package/python-pyroute2
cp patches/python-pyroute2.mk $(BUILDROOT_SOURCE)/package/python-pyroute2/python-pyroute2.mk
cp patches/python-pyroute2.Config.in $(BUILDROOT_SOURCE)/package/python-pyroute2/Config.in
sed -i '/[/]python-pyroute2[/]/d' $(BUILDROOT_SOURCE)/package/Config.in
sed -i '/[/]python-setuptools[/]/a\source "package/python-pyroute2/Config.in"' $(BUILDROOT_SOURCE)/package/Config.in
setup-dnspython:
mkdir -p $(BUILDROOT_SOURCE)/package/python-dnspython
cp patches/python-dnspython.mk $(BUILDROOT_SOURCE)/package/python-dnspython/python-dnspython.mk
cp patches/python-dnspython.Config.in $(BUILDROOT_SOURCE)/package/python-dnspython/Config.in
sed -i '/[/]python-dnspython[/]/d' $(BUILDROOT_SOURCE)/package/Config.in
sed -i '/[/]python-setuptools[/]/a\source "package/python-dnspython/Config.in"' $(BUILDROOT_SOURCE)/package/Config.in
setup-pyyaml:
mkdir -p $(BUILDROOT_SOURCE)/package/python-yaml
cp patches/python-yaml.mk $(BUILDROOT_SOURCE)/package/python-yaml/python-yaml.mk
cp patches/python-yaml.Config.in $(BUILDROOT_SOURCE)/package/python-yaml/Config.in
sed -i '/[/]python-yaml[/]/d' $(BUILDROOT_SOURCE)/package/Config.in
sed -i '/[/]python-setuptools[/]/a\source "package/python-yaml/Config.in"' $(BUILDROOT_SOURCE)/package/Config.in
setup-libyaml:
sed -i.bak -e '/LIBYAML_INSTALL_TARGET/d' $(BUILDROOT_SOURCE)/package/libyaml/libyaml.mk
sed -i.bak -e '/LIBYAML_VERSION/a\LIBYAML_INSTALL_TARGET = YES' $(BUILDROOT_SOURCE)/package/libyaml/libyaml.mk
setup-pyparted:
mkdir -p $(BUILDROOT_SOURCE)/package/python-pyparted
cp patches/python-pyparted.mk $(BUILDROOT_SOURCE)/package/python-pyparted/python-pyparted.mk
cp patches/python-pyparted.Config.in $(BUILDROOT_SOURCE)/package/python-pyparted/Config.in
cp patches/pyparted*.tar.bz2 $(BUILDROOT_SOURCE)/dl/.
sed -i '/[/]python-pyparted[/]/d' $(BUILDROOT_SOURCE)/package/Config.in
sed -i '/[/]python-setuptools[/]/a\source "package/python-pyparted/Config.in"' $(BUILDROOT_SOURCE)/package/Config.in
define buildroot_arch

View File

@@ -608,7 +608,7 @@ BR2_PACKAGE_PYTHON_BZIP2=y
# BR2_PACKAGE_PYTHON_CURSES is not set
# BR2_PACKAGE_PYTHON_PYEXPAT is not set
BR2_PACKAGE_PYTHON_READLINE=y
# BR2_PACKAGE_PYTHON_SSL is not set
BR2_PACKAGE_PYTHON_SSL=y
# BR2_PACKAGE_PYTHON_UNICODEDATA is not set
# BR2_PACKAGE_PYTHON_SQLITE is not set
BR2_PACKAGE_PYTHON_ZLIB=y
@@ -629,6 +629,10 @@ BR2_PACKAGE_PYTHON_ZLIB=y
# BR2_PACKAGE_PYTHON_PYPARSING is not set
# BR2_PACKAGE_PYTHON_SERIAL is not set
# BR2_PACKAGE_PYTHON_SETUPTOOLS is not set
BR2_PACKAGE_PYTHON_DNSPYTHON=y
BR2_PACKAGE_PYTHON_PYROUTE2=y
BR2_PACKAGE_PYTHON_YAML=y
BR2_PACKAGE_PYTHON_PYPARTED=y
# BR2_PACKAGE_RUBY is not set
# BR2_PACKAGE_TCL is not set
@@ -979,7 +983,7 @@ BR2_PACKAGE_READLINE=y
# BR2_PACKAGE_LIBROXML is not set
# BR2_PACKAGE_LIBXML2 is not set
# BR2_PACKAGE_LIBXSLT is not set
# BR2_PACKAGE_LIBYAML is not set
BR2_PACKAGE_LIBYAML=y
# BR2_PACKAGE_MXML is not set
#

View File

@@ -611,7 +611,7 @@ BR2_PACKAGE_PYTHON_BZIP2=y
# BR2_PACKAGE_PYTHON_CURSES is not set
# BR2_PACKAGE_PYTHON_PYEXPAT is not set
BR2_PACKAGE_PYTHON_READLINE=y
# BR2_PACKAGE_PYTHON_SSL is not set
BR2_PACKAGE_PYTHON_SSL=y
# BR2_PACKAGE_PYTHON_UNICODEDATA is not set
# BR2_PACKAGE_PYTHON_SQLITE is not set
BR2_PACKAGE_PYTHON_ZLIB=y
@@ -632,6 +632,10 @@ BR2_PACKAGE_PYTHON_ZLIB=y
# BR2_PACKAGE_PYTHON_PYPARSING is not set
# BR2_PACKAGE_PYTHON_SERIAL is not set
# BR2_PACKAGE_PYTHON_SETUPTOOLS is not set
BR2_PACKAGE_PYTHON_DNSPYTHON=y
BR2_PACKAGE_PYTHON_PYROUTE2=y
BR2_PACKAGE_PYTHON_YAML=y
BR2_PACKAGE_PYTHON_PYPARTED=y
# BR2_PACKAGE_RUBY is not set
# BR2_PACKAGE_TCL is not set
@@ -971,7 +975,7 @@ BR2_PACKAGE_READLINE=y
# BR2_PACKAGE_LIBROXML is not set
# BR2_PACKAGE_LIBXML2 is not set
# BR2_PACKAGE_LIBXSLT is not set
# BR2_PACKAGE_LIBYAML is not set
BR2_PACKAGE_LIBYAML=y
# BR2_PACKAGE_MXML is not set
#

View File

@@ -586,7 +586,7 @@ BR2_PACKAGE_PYTHON_BZIP2=y
# BR2_PACKAGE_PYTHON_CURSES is not set
# BR2_PACKAGE_PYTHON_PYEXPAT is not set
BR2_PACKAGE_PYTHON_READLINE=y
# BR2_PACKAGE_PYTHON_SSL is not set
BR2_PACKAGE_PYTHON_SSL=y
# BR2_PACKAGE_PYTHON_UNICODEDATA is not set
# BR2_PACKAGE_PYTHON_SQLITE is not set
BR2_PACKAGE_PYTHON_ZLIB=y
@@ -607,6 +607,10 @@ BR2_PACKAGE_PYTHON_ZLIB=y
# BR2_PACKAGE_PYTHON_PYPARSING is not set
# BR2_PACKAGE_PYTHON_SERIAL is not set
# BR2_PACKAGE_PYTHON_SETUPTOOLS is not set
BR2_PACKAGE_PYTHON_DNSPYTHON=y
BR2_PACKAGE_PYTHON_PYROUTE2=y
BR2_PACKAGE_PYTHON_YAML=y
BR2_PACKAGE_PYTHON_PYPARTED=y
# BR2_PACKAGE_RUBY is not set
# BR2_PACKAGE_TCL is not set
@@ -947,7 +951,7 @@ BR2_PACKAGE_READLINE=y
# BR2_PACKAGE_LIBROXML is not set
# BR2_PACKAGE_LIBXML2 is not set
# BR2_PACKAGE_LIBXSLT is not set
# BR2_PACKAGE_LIBYAML is not set
BR2_PACKAGE_LIBYAML=y
# BR2_PACKAGE_MXML is not set
#

View File

@@ -0,0 +1,5 @@
config BR2_PACKAGE_PYTHON_DNSPYTHON
bool "python-dnspython"
depends on BR2_PACKAGE_PYTHON
help
Include the 'dnspython' Python library

View File

@@ -0,0 +1,25 @@
######################################################################
##
## dnspython.mk
##
######################################################################
PYTHON_DNSPYTHON_VERSION = 1.12.0
PYTHON_DNSPYTHON_SOURCE = dnspython-$(PYTHON_DNSPYTHON_VERSION).tar.gz
PYTHON_DNSPYTHON_SITE = http://www.dnspython.org/kits/1.12.0/
PYTHON_DNSPYTHON_INSTALL_STAGING = NO
PYTHON_DNSPYTHON_INSTALL_TARGET = YES
PYTHON_DNSPYTHON_LICENSE = BSD-style
PYTHON_DNSPYTHON_LICENSE_FILES = LICENSE
PYTHON_DNSPYTHON_DEPENDENCIES = python
define PYTHON_DNSPYTHON_BUILD_CMDS
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build)
endef
define PYTHON_DNSPYTHON_INSTALL_TARGET_CMDS
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
endef
$(eval $(generic-package))

View File

@@ -0,0 +1,6 @@
config BR2_PACKAGE_PYTHON_PYBLKID
bool "python-pyblkid"
depends on BR2_PACKAGE_PYTHON
depends on BR2_PACKAGE_UTIL_LINUX
help
Include the 'pyblkid' Python library

View File

@@ -0,0 +1,41 @@
######################################################################
##
## python-pyblkid.mk
##
######################################################################
PYTHON_PYBLKID_VERSION = 0.0.1
PYTHON_PYBLKID_SOURCE = pyblkid-$(PYTHON_PYBLKID_VERSION).tar.bz2
PYTHON_PYBLKID_INSTALL_STAGING = NO
PYTHON_PYBLKID_INSTALL_TARGET = YES
PYTHON_PYBLKID_LICENSE = GPL
PYTHON_PYBLKID_LICENSE_FILES = COPYING
PYTHON_PYBLKID_DEPENDENCIES = python util-linux
PYTHON_PYBLKID_INCLUDES = \
--include-dirs $(STAGING_DIR)/usr/include:$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR) \
# THIS LINE INTENTIONALLY LEFT BLANK
PYTHON_PYBLKID_LIBDIRS = \
--library-dirs $(STAGING_DIR)/usr/lib \
# THIS LINE INTENTIONALLY LEFT BLANK
# see python-mad.mk
PYTHON_PYBLKID_ENVIRONMENT = \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS)" \
LDSHARED="$(TARGET_CC) -shared" \
LDFLAGS="$(TARGET_LDFLAGS)" \
# THIS LINE INTENTIONALLY LEFT BLANK
define PYTHON_PYBLKID_BUILD_CMDS
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build_py)
(cd $(@D); $(PYTHON_PYBLKID_ENVIRONMENT) $(HOST_DIR)/usr/bin/python setup.py build_ext $(PYTHON_PYBLKID_INCLUDES) $(PYTHON_PYBLKID_LIBDIRS))
endef
define PYTHON_PYBLKID_INSTALL_TARGET_CMDS
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr --install-scripts=$(TARGET_DIR)/usr/bin)
endef
$(eval $(generic-package))

View File

@@ -0,0 +1,6 @@
config BR2_PACKAGE_PYTHON_PYPARTED
bool "python-pyparted"
depends on BR2_PACKAGE_PYTHON
depends on BR2_PACKAGE_PARTED
help
Include the 'pyparted' Python library

View File

@@ -0,0 +1,42 @@
######################################################################
##
## python-pyparted.mk
##
######################################################################
PYTHON_PYPARTED_VERSION = 3.10.7
PYTHON_PYPARTED_SOURCE = pyparted-$(PYTHON_PYPARTED_VERSION).tar.bz2
##PYTHON_PYPARTED_SITE = http://pyyaml.org/download/pyyaml/
PYTHON_PYPARTED_INSTALL_STAGING = NO
PYTHON_PYPARTED_INSTALL_TARGET = YES
PYTHON_PYPARTED_LICENSE = GPL
PYTHON_PYPARTED_LICENSE_FILES = COPYING
PYTHON_PYPARTED_DEPENDENCIES = python parted
PYTHON_PYPARTED_INCLUDES = \
--include-dirs $(STAGING_DIR)/usr/include:$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR) \
# THIS LINE INTENTIONALLY LEFT BLANK
PYTHON_PYPARTED_LIBDIRS = \
--library-dirs $(STAGING_DIR)/usr/lib \
# THIS LINE INTENTIONALLY LEFT BLANK
# see python-mad.mk
PYTHON_PYPARTED_ENVIRONMENT = \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS)" \
LDSHARED="$(TARGET_CC) -shared" \
LDFLAGS="$(TARGET_LDFLAGS)" \
# THIS LINE INTENTIONALLY LEFT BLANK
define PYTHON_PYPARTED_BUILD_CMDS
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build_py)
(cd $(@D); $(PYTHON_PYPARTED_ENVIRONMENT) $(HOST_DIR)/usr/bin/python setup.py build_ext $(PYTHON_PYPARTED_INCLUDES) $(PYTHON_PYPARTED_LIBDIRS))
endef
define PYTHON_PYPARTED_INSTALL_TARGET_CMDS
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
endef
$(eval $(generic-package))

View File

@@ -0,0 +1,5 @@
config BR2_PACKAGE_PYTHON_PYROUTE2
bool "python-pyroute2"
depends on BR2_PACKAGE_PYTHON
help
Include the 'pyroute2' Python library

View File

@@ -0,0 +1,29 @@
######################################################################
##
## pyroute2.mk
##
######################################################################
PYTHON_PYROUTE2_VERSION = 0.3.14
PYTHON_PYROUTE2_SOURCE = pyroute2-$(PYTHON_PYROUTE2_VERSION).tar.gz
PYTHON_PYROUTE2_SITE = https://pypi.python.org/packages/source/p/pyroute2/
PYTHON_PYROUTE2_LICENSE = GPLv2+ and Apache v2
PYTHON_PYROUTE2_LICENSE_FILES = \
READEME.licence.md \
LICENSE.GPL.v2 \
LICENSE.Apache.v2 \
# THIS LINE INTENTIONALLY LEFT BLANK
PYTHON_PYROUTE2_INSTALL_STAGING = NO
PYTHON_PYROUTE2_INSTALL_TARGET = YES
PYTHON_PYROUTE2_DEPENDENCIES = python
define PYTHON_PYROUTE2_BUILD_CMDS
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build)
endef
define PYTHON_PYROUTE2_INSTALL_TARGET_CMDS
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
endef
$(eval $(generic-package))

View File

@@ -0,0 +1,5 @@
config BR2_PACKAGE_PYTHON_YAML
bool "python-yaml"
depends on BR2_PACKAGE_PYTHON
help
Include the 'PyYAML' Python library

View File

@@ -0,0 +1,42 @@
######################################################################
##
## python-yaml.mk
##
######################################################################
PYTHON_YAML_VERSION = 3.11
PYTHON_YAML_SOURCE = PyYAML-$(PYTHON_YAML_VERSION).tar.gz
PYTHON_YAML_SITE = http://pyyaml.org/download/pyyaml/
PYTHON_YAML_INSTALL_STAGING = NO
PYTHON_YAML_INSTALL_TARGET = YES
PYTHON_YAML_LICENSE = MIT
PYTHON_YAML_LICENSE_FILES = LICENSE
PYTHON_YAML_DEPENDENCIES = python libyaml
PYTHON_YAML_INCLUDES = \
--include-dirs $(STAGING_DIR)/usr/include:$(STAGING_DIR)/usr/include/python$(PYTHON_VERSION_MAJOR) \
# THIS LINE INTENTIONALLY LEFT BLANK
PYTHON_YAML_LIBDIRS = \
--library-dirs $(STAGING_DIR)/usr/lib \
# THIS LINE INTENTIONALLY LEFT BLANK
# see python-mad.mk
PYTHON_YAML_ENVIRONMENT = \
CC="$(TARGET_CC)" \
CFLAGS="$(TARGET_CFLAGS)" \
LDSHARED="$(TARGET_CC) -shared" \
LDFLAGS="$(TARGET_LDFLAGS)" \
# THIS LINE INTENTIONALLY LEFT BLANK
define PYTHON_YAML_BUILD_CMDS
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py build_py)
(cd $(@D); $(PYTHON_YAML_ENVIRONMENT) $(HOST_DIR)/usr/bin/python setup.py build_ext $(PYTHON_YAML_INCLUDES) $(PYTHON_YAML_LIBDIRS))
endef
define PYTHON_YAML_INSTALL_TARGET_CMDS
(cd $(@D); $(HOST_DIR)/usr/bin/python setup.py install --prefix=$(TARGET_DIR)/usr)
endef
$(eval $(generic-package))

View File

@@ -31,7 +31,7 @@
#include <AIM/aim_log_handler.h>
#include <syslog.h>
static void platform_manager_daemon__(const char* pidfile);
static void platform_manager_daemon__(const char* pidfile, char** argv);
/**
* Human-readable SFP inventory.
@@ -246,7 +246,7 @@ onlpdump_main(int argc, char* argv[])
onlp_init();
if(M) {
platform_manager_daemon__(pidfile);
platform_manager_daemon__(pidfile, argv);
exit(0);
}
@@ -361,14 +361,14 @@ sighandler__(int signal)
}
static void
platform_manager_daemon__(const char* pidfile)
platform_manager_daemon__(const char* pidfile, char** argv)
{
aim_pvs_t* aim_pvs_syslog = NULL;
aim_daemon_restart_config_t rconfig;
aim_daemon_config_t config;
memset(&config, 0, sizeof(config));
aim_daemon_restart_config_init(&rconfig, 1, 1);
aim_daemon_restart_config_init(&rconfig, 1, 1, argv);
AIM_BITMAP_CLR(&rconfig.signal_restarts, SIGTERM);
AIM_BITMAP_CLR(&rconfig.exit_restarts, 0);
rconfig.maximum_restarts=50;
@@ -412,9 +412,9 @@ platform_manager_daemon__(const char* pidfile)
#else
static void
platform_manager_daemon__(const char* pidfile)
platform_manager_daemon__(const char* pidfile, char** argv)
{
fprintf(stderr, "Daemon mode not supported in this build.");
fprintf(stderr, "Daemon mode not supported in this build.\n");
exit(1);
}
#endif

View File

@@ -30,18 +30,80 @@
#include "onlplib_log.h"
#include <onlp/onlp.h>
#include <errno.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <sys/stat.h>
/**
* @brief Connects to a unix domain socket.
* @param path The socket path.
*/
static int
ds_connect__(const char* path)
{
int fd;
struct sockaddr_un addr;
if( (fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) {
AIM_LOG_ERROR("socket: %{errno}", errno);
return -1;
}
memset(&addr, 0, sizeof(addr));
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, path, sizeof(addr.sun_path)-1);
if(connect(fd, (struct sockaddr*)&addr, sizeof(addr)) == 0) {
return fd;
}
else {
return ONLP_STATUS_E_MISSING;
}
}
/**
* @brief Open a file or domain socket.
* @param dst Receives the full filename (for logging purposes).
* @param flags The open flags.
* @param fmt Format specifier.
* @param vargs Format specifier arguments.
*/
static int
vopen__(char** dst, int flags, const char* fmt, va_list vargs)
{
int fd;
struct stat sb;
char fname[PATH_MAX];
ONLPLIB_VSNPRINTF(fname, sizeof(fname)-1, fmt, vargs);
if(dst) {
*dst = aim_strdup(fname);
}
if(stat(fname, &sb) == -1) {
return ONLP_STATUS_E_MISSING;
}
if(S_ISSOCK(sb.st_mode)) {
fd = ds_connect__(fname);
}
else {
fd = open(fname, flags);
}
return (fd > 0) ? fd : ONLP_STATUS_E_MISSING;
}
int
onlp_file_vread(uint8_t* data, int max, int* len, const char* fmt, va_list vargs)
{
int fd;
char fname[PATH_MAX];
char* fname = NULL;
int rv;
ONLPLIB_VSNPRINTF(fname, sizeof(fname)-1, fmt, vargs);
if ((fd = open(fname, O_RDONLY)) == -1) {
rv = ONLP_STATUS_E_MISSING;
if ((fd = vopen__(&fname, O_RDONLY, fmt, vargs)) < 0) {
rv = fd;
}
else {
if ((*len = read(fd, data, max)) <= 0) {
@@ -53,6 +115,7 @@ onlp_file_vread(uint8_t* data, int max, int* len, const char* fmt, va_list vargs
}
close(fd);
}
aim_free(fname);
return rv;
}
@@ -124,14 +187,12 @@ int
onlp_file_vwrite(uint8_t* data, int len, const char* fmt, va_list vargs)
{
int fd;
char fname[PATH_MAX];
char* fname = NULL;
int rv;
int wlen;
ONLPLIB_VSNPRINTF(fname, sizeof(fname)-1, fmt, vargs);
if ((fd = open(fname, O_WRONLY)) == -1) {
rv = ONLP_STATUS_E_MISSING;
if ((fd = vopen__(&fname, O_WRONLY, fmt, vargs)) < 0) {
rv = fd;
}
else {
if ((wlen = write(fd, data, len)) != len) {
@@ -143,6 +204,7 @@ onlp_file_vwrite(uint8_t* data, int len, const char* fmt, va_list vargs)
}
close(fd);
}
aim_free(fname);
return rv;
}
@@ -211,11 +273,12 @@ int
onlp_file_vopen(int flags, int log, const char* fmt, va_list vargs)
{
int rv;
char fname[PATH_MAX];
ONLPLIB_VSNPRINTF(fname, sizeof(fname)-1, fmt, vargs);
rv = open(fname, flags);
char* fname;
rv = vopen__(&fname, flags, fmt, vargs);
if(rv < 0 && log) {
AIM_LOG_ERROR("failed to open file %s (0x%x): %{errno}", fname, flags, errno);
}
aim_free(fname);
return rv;
}

View File

@@ -74,7 +74,7 @@ onlp_sysi_oids_get(onlp_oid_t* table, int max)
/* 1 Fan */
*e++ = ONLP_FAN_ID_CREATE(1);
/* 8 Thermal sensors */
/* 9 Thermal sensors */
*e++ = ONLP_THERMAL_ID_CREATE(1);
*e++ = ONLP_THERMAL_ID_CREATE(2);
*e++ = ONLP_THERMAL_ID_CREATE(3);
@@ -83,6 +83,7 @@ onlp_sysi_oids_get(onlp_oid_t* table, int max)
*e++ = ONLP_THERMAL_ID_CREATE(6);
*e++ = ONLP_THERMAL_ID_CREATE(7);
*e++ = ONLP_THERMAL_ID_CREATE(8);
*e++ = ONLP_THERMAL_ID_CREATE(11);
/* 5 LEDs */
*e++ = ONLP_LED_ID_CREATE(1);

View File

@@ -28,6 +28,7 @@
#include <string.h>
#include <unistd.h>
#include "platform_lib.h"
#include <onlplib/file.h>
/* i2c device info */
#define I2C_PSU_BUS_ID 0
@@ -222,7 +223,10 @@ static onlp_thermal_info_t tinfo[] = {
},
{ { ONLP_THERMAL_ID_CREATE(10), "PSU-2 Thermal Sensor 1", ONLP_PSU_ID_CREATE(2)}, 0x1,
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
}
},
{ { ONLP_THERMAL_ID_CREATE(11), "Switch Thermal Sensor", 0}, 0x1,
ONLP_THERMAL_CAPS_ALL, 0, ONLP_THERMAL_THRESHOLD_INIT_DEFAULTS
},
};
/*
@@ -275,6 +279,26 @@ onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info)
}
}
if (ONLP_OID_ID_GET(id) == 11) {
/* Switch Thermal Sensor */
char* fname = "/var/run/broadcom/temp0";
int rv = onlp_file_read_int(&info->mcelsius, fname);
if(rv >= 0) {
/** Present and running */
info->status |= 1;
ret = 0;
}
else if(rv == ONLP_STATUS_E_MISSING) {
/** No switch management process running. */
info->status = 0;
ret = 0;
}
else {
/** Other error. */
ret = ONLP_STATUS_E_INTERNAL;
}
}
/* Close PSU channel
*/
as5610_52x_i2c0_pca9548_channel_set(0);

View File

@@ -51,6 +51,9 @@ class OnlPlatform_x86_64_accton_as5812_54t_r0(OnlPlatformAccton):
('lm75', 0x48, 15),
('lm75', 0x49, 16),
('lm75', 0x4a, 17),
# System EEPROM
('24c02', 0x57, 1),
]
)
return True

View File

@@ -58,6 +58,9 @@ class OnlPlatform_x86_64_accton_as5812_54x_r0(OnlPlatformAccton):
('lm75', 0x48, 61),
('lm75', 0x49, 62),
('lm75', 0x4a, 63),
# System EEPROM
('24c02', 0x57, 1),
]
)
return True

View File

@@ -1,29 +1,10 @@
############################################################
# <bsn.cl fy=2014 v=onl>
#
# Copyright 2014, 2015 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
#
#
############################################################
include $(ONL)/make/config.mk
include ../../init.mk
MODULE := x86_64_kvm_x86_64
AUTOMODULE := x86_64_kvm_x86_64
include $(BUILDER)/definemodule.mk

View File

@@ -8,7 +8,7 @@ menuentry OpenNetworkLinux {
echo 'Loading Open Network Linux ...'
insmod gzio
insmod part_msdos
linux /kernel-3.2-deb7-x86_64-all nopat console=ttyS0,115200n8 onl_platform=x86-64-kvm-x86-64-r0
linux /kernel-3.9.6-x86-64-all nopat console=ttyS0,115200n8 onl_platform=x86-64-kvm-x86-64-r0
initrd /initrd-amd64
}

View File

@@ -11,5 +11,5 @@
platform_installer() {
# Standard isntallation to an available GPT partition
installer_standard_gpt_install /dev/sda
installer_standard_gpt_install /dev/vda
}

View File

@@ -39,3 +39,8 @@ $ONL/tools/submodules.py $ONL sm/bigcode
# Export the current debian suite
export ONL_DEBIAN_SUITE=$(lsb_release -c -s)
# Enable local post-merge githook
if [ ! -f $ONL/.git/hooks/post-merge ]; then
cp $ONL/tools/scripts/post-merge.hook $ONL/.git/hooks/post-merge
fi

68
tools/newmodule.py Executable file
View File

@@ -0,0 +1,68 @@
#!/usr/bin/env python
################################################################
#
# Copyright 2013, Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
################################################################
#
# This script generates a new code module and unit test build
# for this repository.
#
################################################################
import sys
import os
# The root of the repository
ROOT = os.path.realpath("%s/.." % (os.path.dirname(__file__)))
# Import infra
sys.path.append("%s/sm/infra/builder/unix/tools" % ROOT)
# Import bigcode
sys.path.append("%s/sm/bigcode/tools" % ROOT)
from modulegen import *
#
# Import uCli support
#
from uclimod import *
if __name__ == "__main__":
# Generate the module in the current directory.
ModuleGenerator.modulesBaseDir = "."
# Use ONL config.mk in generated makefiles
GModuleMake.INIT_MK="$(ONL)/make/config.mk"
ModuleUnitTestTargetMake.INIT_MK="$(ONL)/make/config.mk"
#
# Make it happen.
#
ModuleGenerator.main(globals().copy())
# Make sure the manifest gets regenerated.
os.system("rm -rf %s/make/module-manifest.mk" % ROOT)

View File

@@ -201,7 +201,7 @@ class OnlPackage(object):
if type(self.pkg[key]) != type_:
raise OnlPackageError("key '%s' is the wrong type (%s should be %s)" % (
key, type(pkg[key]), type_))
key, type(self.pkg[key]), type_))
return True
@@ -373,6 +373,9 @@ class OnlPackage(object):
raise OnlPackageError("Post-install script '%s' does not exist." % self.pkg['post-install'])
command = command + "--after-install %s" % self.pkg['post-install']
if logger.level < logging.INFO:
command = command + "--verbose "
onlu.execute(command)
# Grab the package from the workdir. There can be only one.
@@ -506,7 +509,8 @@ class OnlPackageGroup(object):
for bp in buildpaths:
if os.path.exists(bp):
MAKE = os.environ.get('MAKE', "make")
cmd = MAKE + ' -C ' + bp + " " + os.environ.get('ONLPM_MAKE_OPTIONS', "") + " " + os.environ.get('ONL_MAKE_PARALLEL', "") + " " + target
V = " V=1 " if logger.level < logging.INFO else ""
cmd = MAKE + V + ' -C ' + bp + " " + os.environ.get('ONLPM_MAKE_OPTIONS', "") + " " + os.environ.get('ONL_MAKE_PARALLEL', "") + " " + target
onlu.execute(cmd,
ex=OnlPackageError('%s failed.' % operation))
@@ -1051,6 +1055,10 @@ if __name__ == '__main__':
for j in ops.include_env_json.split(':'):
data = json.load(open(j))
for (k, v) in data.iteritems():
try:
v = v.encode('ascii')
except UnicodeEncodeError:
pass
os.environ[k] = v
#

15
tools/scripts/post-merge.hook Executable file
View File

@@ -0,0 +1,15 @@
#!/bin/bash
############################################################
#
# Every time a merge is performed we should invalidate
# the module manifest.
#
############################################################
mm="$GIT_DIR/../make/module-manifest.mk"
if [ -f "$mm" ]; then
echo "Removing module manifest after merge..."
rm "$mm"
fi