From 4daf6ea0643f49310afced915201309e6d1249d1 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Fri, 29 Jan 2016 11:14:38 -0800 Subject: [PATCH 01/55] Update Building.md Updated docker instructions for clarity --- docs/Building.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/Building.md b/docs/Building.md index 951dfee3..b8c91e80 100644 --- a/docs/Building.md +++ b/docs/Building.md @@ -12,29 +12,36 @@ ONL builds with Docker so the only requirements on the build system is: - docker # to grab the build workspace - binfmt-support # kernel support for ppc builds - About 40G of disk free space # to build all images +- At least 4G of ram and 4G of swap # compilation is memory intensive All of the testing is done with Debian, other Linux distributions may work, but we suggest using Debian 8. - # apt-get install lxc-docker binfmt-support + # apt-get install binfmt-support + then follow the instructions at: https://docs.docker.com/engine/installation/debian/ Build ONL Summary ------------------------------------------------------------ -The easiest way to build is to use the autobuild script: +The easiest way to build is to use the make docker command: #> git clone https://github.com/opencomputeproject/OpenNetworkLinux - #> tools/autobuild/build.sh + #> make docker This will build a Debian 7 based ONL from the master branch -To build a Debian 8 based ONL simply run: +To build a Debian 8 based ONL run: - #> tools/autobuild/build.sh -8 + #> git clone https://github.com/opencomputeproject/OpenNetworkLinux + #> cd OpenNetworkLinux + #> export VERSION=8 + #> make docker + If you would like to build by hand you can do the following: #> git clone https://github.com/opencomputeproject/OpenNetworkLinux #> cd OpenNetworkLinux - #> make docker # enter the docker workspace + #> docker/tools/onlbuilder (-8) # enter the docker workspace + #> source setup.env # pull in necessary environment variables #> make amd64 ppc # make onl for $platform (currently amd64 or powerpc) The resulting ONIE installers are in @@ -50,9 +57,6 @@ RELEASE/jessie/amd64/ONL-2.0.0_ONL-OS_2015-12-12.0252-ffce159_AMD64.swi Docker installer oneliner (for reference: see docker.com for details) - # apt-get install -y lxc-docker -or - # wget -qO- https://get.docker.com/ | sh From fc8d40d190c257187c31d46f5e109e5ad7ac2ee3 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Fri, 29 Jan 2016 11:16:06 -0800 Subject: [PATCH 02/55] Update Building.md Added cd to OpenNetworkLinux for building with Docker Debian 7 image. --- docs/Building.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/Building.md b/docs/Building.md index b8c91e80..abe095d7 100644 --- a/docs/Building.md +++ b/docs/Building.md @@ -24,6 +24,7 @@ Build ONL Summary The easiest way to build is to use the make docker command: #> git clone https://github.com/opencomputeproject/OpenNetworkLinux + #> cd OpenNetworkLinux #> make docker This will build a Debian 7 based ONL from the master branch From 08d7b653d858597bb7e4e5e066066263c4ef86d8 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Fri, 29 Jan 2016 22:28:34 +0000 Subject: [PATCH 03/55] Fix parallel build invocations. --- .../base/amd64/kernels/kernel-3.18-x68-64-all/builds/Makefile | 2 +- .../amd64/kernels/kernel-3.2-deb7-x86-64-all/builds/Makefile | 2 +- .../kernels/kernel-3.2-deb7-powerpc-e500v-all/builds/Makefile | 2 +- .../kernels/legacy/kernel-3.8.13-powerpc-e500mc/builds/Makefile | 2 +- .../kernels/legacy/kernel-3.9.6-powerpc-e500v/builds/Makefile | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/base/amd64/kernels/kernel-3.18-x68-64-all/builds/Makefile b/packages/base/amd64/kernels/kernel-3.18-x68-64-all/builds/Makefile index be55d0e3..e0bc3251 100644 --- a/packages/base/amd64/kernels/kernel-3.18-x68-64-all/builds/Makefile +++ b/packages/base/amd64/kernels/kernel-3.18-x68-64-all/builds/Makefile @@ -13,7 +13,7 @@ THIS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) include $(ONL)/make/config.mk kernel: - $(MAKE) -C $(ONL)/packages/base/any/kernels/3.18.25/configs/x86_64-all K_TARGET_DIR=$(THIS_DIR) -j + $(MAKE) -C $(ONL)/packages/base/any/kernels/3.18.25/configs/x86_64-all K_TARGET_DIR=$(THIS_DIR) $(ONL_MAKE_PARALLEL) clean: rm -rf linux-3.18.25 linux-3.18.25-mbuild diff --git a/packages/base/amd64/kernels/kernel-3.2-deb7-x86-64-all/builds/Makefile b/packages/base/amd64/kernels/kernel-3.2-deb7-x86-64-all/builds/Makefile index 2174869e..61fc5d43 100644 --- a/packages/base/amd64/kernels/kernel-3.2-deb7-x86-64-all/builds/Makefile +++ b/packages/base/amd64/kernels/kernel-3.2-deb7-x86-64-all/builds/Makefile @@ -13,7 +13,7 @@ THIS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) include $(ONL)/make/config.mk kernel: - $(MAKE) -C $(ONL)/packages/base/any/kernels/3.2.65-1+deb7u2/configs/x86_64-all K_TARGET_DIR=$(THIS_DIR) -j + $(MAKE) -C $(ONL)/packages/base/any/kernels/3.2.65-1+deb7u2/configs/x86_64-all K_TARGET_DIR=$(THIS_DIR) $(ONL_MAKE_PARALLEL) clean: rm -rf linux-3.2.65-1+deb7u2 linux-3.2.65-1+deb7u2-mbuild diff --git a/packages/base/powerpc/kernels/kernel-3.2-deb7-powerpc-e500v-all/builds/Makefile b/packages/base/powerpc/kernels/kernel-3.2-deb7-powerpc-e500v-all/builds/Makefile index cf4d94b3..81e28185 100644 --- a/packages/base/powerpc/kernels/kernel-3.2-deb7-powerpc-e500v-all/builds/Makefile +++ b/packages/base/powerpc/kernels/kernel-3.2-deb7-powerpc-e500v-all/builds/Makefile @@ -13,7 +13,7 @@ THIS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) include $(ONL)/make/config.mk kernel: - $(MAKE) -C $(ONL)/packages/base/any/kernels/3.2.65-1+deb7u2/configs/powerpc-e500v-all K_TARGET_DIR=$(THIS_DIR) K_COPY_DST=kernel-3.2-deb7-powerpc-e500v-all.bin.gz + $(MAKE) -C $(ONL)/packages/base/any/kernels/3.2.65-1+deb7u2/configs/powerpc-e500v-all K_TARGET_DIR=$(THIS_DIR) K_COPY_DST=kernel-3.2-deb7-powerpc-e500v-all.bin.gz $(ONL_MAKE_PARALLEL) clean: rm -rf linux-3.2.65-1+deb7u2 linux-3.2.65-1+deb7u2-mbuild linux-3.2.65-1+deb7u2-dtbs diff --git a/packages/base/powerpc/kernels/legacy/kernel-3.8.13-powerpc-e500mc/builds/Makefile b/packages/base/powerpc/kernels/legacy/kernel-3.8.13-powerpc-e500mc/builds/Makefile index 0343af53..007fc38c 100644 --- a/packages/base/powerpc/kernels/legacy/kernel-3.8.13-powerpc-e500mc/builds/Makefile +++ b/packages/base/powerpc/kernels/legacy/kernel-3.8.13-powerpc-e500mc/builds/Makefile @@ -24,7 +24,7 @@ KERNEL_DIR := $(ONL)/packages/base/any/kernels/legacy/linux-3.8.13 $(COMPDIR)/kernel-e500mc: $(KERNEL_DIR)/arch/powerpc/configs/$(DEFCONFIG) mkdir -p $(COMPDIR)/linux-build-e500mc - $(MAKE) -C $(KERNEL_DIR) $(DEFCONFIG) ARCH=powerpc O=$(COMPDIR)/linux-build-e500mc + $(MAKE) -C $(KERNEL_DIR) $(DEFCONFIG) ARCH=powerpc O=$(COMPDIR)/linux-build-e500mc $(ONL_MAKE_PARALLEL) PATH=$$PATH:$(SWITCHLIGHT)/tools $(MAKE) -C $(KERNEL_DIR) uImage ARCH=powerpc O=$(COMPDIR)/linux-build-e500mc powerpc-linux-gnu-strip -o $(COMPDIR)/kernel-e500mc $(COMPDIR)/linux-build-e500mc/vmlinux cp $(COMPDIR)/linux-build-e500mc/vmlinux.bin.gz $(COMPDIR)/kernel-e500mc.bin.gz diff --git a/packages/base/powerpc/kernels/legacy/kernel-3.9.6-powerpc-e500v/builds/Makefile b/packages/base/powerpc/kernels/legacy/kernel-3.9.6-powerpc-e500v/builds/Makefile index 18a8659f..ff57b59c 100644 --- a/packages/base/powerpc/kernels/legacy/kernel-3.9.6-powerpc-e500v/builds/Makefile +++ b/packages/base/powerpc/kernels/legacy/kernel-3.9.6-powerpc-e500v/builds/Makefile @@ -24,7 +24,7 @@ KERNEL_DIR := $(ONL)/packages/base/any/kernels/legacy/linux-3.9.6 $(BUILD_POWERPC_LINUX_85XX)/kernel-85xx: $(KERNEL_DIR)/arch/powerpc/configs/85xx/onl_mpc85xx_defconfig mkdir -p $(BUILD_POWERPC_LINUX_85XX)/linux-build-85xx - $(MAKE) -C $(KERNEL_DIR) 85xx/onl_mpc85xx_defconfig ARCH=powerpc O=$(BUILD_POWERPC_LINUX_85XX)/linux-build-85xx + $(MAKE) -C $(KERNEL_DIR) 85xx/onl_mpc85xx_defconfig ARCH=powerpc O=$(BUILD_POWERPC_LINUX_85XX)/linux-build-85xx $(ONL_MAKE_PARALLEL) PATH=$$PATH:$(SWITCHLIGHT)/tools $(MAKE) -C $(KERNEL_DIR) uImage ARCH=powerpc O=$(BUILD_POWERPC_LINUX_85XX)/linux-build-85xx powerpc-linux-gnu-strip -o $(BUILD_POWERPC_LINUX_85XX)/kernel-85xx $(BUILD_POWERPC_LINUX_85XX)/linux-build-85xx/vmlinux cp $(BUILD_POWERPC_LINUX_85XX)/linux-build-85xx/vmlinux.bin.gz $(BUILD_POWERPC_LINUX_85XX)/kernel-85xx.bin.gz From b2b66c98857cc1fc107bcabe2e4d4e253b7c21e4 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Fri, 29 Jan 2016 22:28:51 +0000 Subject: [PATCH 04/55] Include parallel make flags. --- tools/onlpm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/onlpm.py b/tools/onlpm.py index d1b5854b..6301a9aa 100755 --- a/tools/onlpm.py +++ b/tools/onlpm.py @@ -506,7 +506,7 @@ 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', "") + target + cmd = MAKE + ' -C ' + bp + " " + os.environ.get('ONLPM_MAKE_OPTIONS', "") + " " + os.environ.get('ONL_MAKE_PARALLEL', "") + " " + target onlu.execute(cmd, ex=OnlPackageError('%s failed.' % operation)) From 2f05cf31b87fbfafef244a09726017aa07fd7dba Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Fri, 29 Jan 2016 22:29:24 +0000 Subject: [PATCH 05/55] Set global parallel make options to -j16 --- setup.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.env b/setup.env index ca010660..bbe964a8 100755 --- a/setup.env +++ b/setup.env @@ -20,7 +20,7 @@ export PATH="$ONL/tools/scripts:$ONL/tools:$PATH" # Parallel Make Jobs # Default parallel build settings -# export MAKEFLAGS="-j64" +export ONL_MAKE_PARALLEL=-j16 # Version files $ONL/tools/make-versions.py --import-file=$ONL/tools/onlvi --class-name=OnlVersionImplementation --output-dir $ONL/make From 04d8775ee35a6bd8df85f7de5a80ce3261b146d4 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Fri, 29 Jan 2016 15:11:48 -0800 Subject: [PATCH 06/55] updated buildroot configs to include SquashFS support --- .../initrds/buildroot/builds/buildroot.config-powerpc | 10 +++++++--- .../initrds/buildroot/builds/buildroot.config-x86_64 | 8 ++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/base/any/initrds/buildroot/builds/buildroot.config-powerpc b/packages/base/any/initrds/buildroot/builds/buildroot.config-powerpc index 74334564..a493261a 100644 --- a/packages/base/any/initrds/buildroot/builds/buildroot.config-powerpc +++ b/packages/base/any/initrds/buildroot/builds/buildroot.config-powerpc @@ -1,6 +1,6 @@ # # Automatically generated make config: don't edit -# Buildroot 2013.02-rc2-dirty Configuration +# Buildroot 2013.02-rc2-g5e1a5c1-dirty Configuration # BR2_HAVE_DOT_CONFIG=y # BR2_arm is not set @@ -85,7 +85,7 @@ BR2_HOST_DIR="$(BASE_DIR)/host" # Mirrors and Download locations # BR2_PRIMARY_SITE="$(BUILDROOTMIRROR)" -BR2_PRIMARY_SITE_ONLY=n +# BR2_PRIMARY_SITE_ONLY is not set BR2_BACKUP_SITE="https://raw.githubusercontent.com/opennetworklinux/buildroot-download-cache/master/dl" BR2_KERNEL_MIRROR="http://www.kernel.org/pub/" BR2_GNU_MIRROR="http://ftp.gnu.org/pub/gnu" @@ -482,7 +482,11 @@ BR2_PACKAGE_MTD_UBIRMVOL=y BR2_PACKAGE_MTD_UBIUPDATEVOL=y # BR2_PACKAGE_NFS_UTILS is not set # BR2_PACKAGE_NTFS_3G is not set -# BR2_PACKAGE_SQUASHFS is not set +BR2_PACKAGE_SQUASHFS=y +BR2_PACKAGE_SQUASHFS_GZIP=y +# BR2_PACKAGE_SQUASHFS_LZMA is not set +# BR2_PACKAGE_SQUASHFS_LZO is not set +# BR2_PACKAGE_SQUASHFS_XZ is not set # BR2_PACKAGE_SSHFS is not set # BR2_PACKAGE_UNIONFS is not set # BR2_PACKAGE_XFSPROGS is not set diff --git a/packages/base/any/initrds/buildroot/builds/buildroot.config-x86_64 b/packages/base/any/initrds/buildroot/builds/buildroot.config-x86_64 index 0f008093..6194cb4a 100644 --- a/packages/base/any/initrds/buildroot/builds/buildroot.config-x86_64 +++ b/packages/base/any/initrds/buildroot/builds/buildroot.config-x86_64 @@ -1,6 +1,6 @@ # # Automatically generated make config: don't edit -# Buildroot 2013.02-rc2-dirty Configuration +# Buildroot 2013.02-rc2-g5e1a5c1-dirty Configuration # BR2_HAVE_DOT_CONFIG=y BR2_ARCH_IS_64=y @@ -456,7 +456,11 @@ BR2_PACKAGE_MTD_UBIRMVOL=y BR2_PACKAGE_MTD_UBIUPDATEVOL=y # BR2_PACKAGE_NFS_UTILS is not set # BR2_PACKAGE_NTFS_3G is not set -# BR2_PACKAGE_SQUASHFS is not set +BR2_PACKAGE_SQUASHFS=y +BR2_PACKAGE_SQUASHFS_GZIP=y +# BR2_PACKAGE_SQUASHFS_LZMA is not set +# BR2_PACKAGE_SQUASHFS_LZO is not set +# BR2_PACKAGE_SQUASHFS_XZ is not set # BR2_PACKAGE_SSHFS is not set # BR2_PACKAGE_UNIONFS is not set # BR2_PACKAGE_XFSPROGS is not set From dd900edaf8cdb79355405616e96a536f8e1af1de Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Fri, 29 Jan 2016 15:13:36 -0800 Subject: [PATCH 07/55] Add 3.18 kernel to installed kernel list --- builds/amd64/installer/legacy/builds/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/builds/amd64/installer/legacy/builds/Makefile b/builds/amd64/installer/legacy/builds/Makefile index 2425e304..158cbf6c 100644 --- a/builds/amd64/installer/legacy/builds/Makefile +++ b/builds/amd64/installer/legacy/builds/Makefile @@ -1,7 +1,8 @@ include $(ONL)/make/config.amd64.mk KERNELS := $(shell $(ONLPM) --find-file onl-kernel-3.9.6-x86-64-all:amd64 kernel-3.9.6-x86-64-all) \ - $(shell $(ONLPM) --find-file onl-kernel-3.2-deb7-x86-64-all:amd64 kernel-3.2-deb7-x86_64-all) + $(shell $(ONLPM) --find-file onl-kernel-3.2-deb7-x86-64-all:amd64 kernel-3.2-deb7-x86_64-all) \ + $(shell $(ONLPM) --find-file onl-kernel-3.18-x86-64-all:amd64 kernel-3.18-x86_64-all) INITRD := $(shell $(ONLPM) --find-file onl-loader-initrd:amd64 onl-loader-initrd-amd64.cpio.gz) PLATFORMS := $(shell $(ONLPM) --platform-manifest onl-loader-initrd:amd64) From f6763b2c1660f18cf8495b7d14ed33e391e6c9b4 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Fri, 29 Jan 2016 15:14:47 -0800 Subject: [PATCH 08/55] Updated 3.18 kernel configuration to include USBNET for Wedge BMC --- .../configs/x86_64-all/x86_64-all.config | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/packages/base/any/kernels/3.18.25/configs/x86_64-all/x86_64-all.config b/packages/base/any/kernels/3.18.25/configs/x86_64-all/x86_64-all.config index 6a45564b..0f87091b 100644 --- a/packages/base/any/kernels/3.18.25/configs/x86_64-all/x86_64-all.config +++ b/packages/base/any/kernels/3.18.25/configs/x86_64-all/x86_64-all.config @@ -1656,8 +1656,39 @@ CONFIG_USB_NET_DRIVERS=y # CONFIG_USB_PEGASUS is not set # CONFIG_USB_RTL8150 is not set # CONFIG_USB_RTL8152 is not set -# CONFIG_USB_USBNET is not set +CONFIG_USB_USBNET=y +# CONFIG_USB_NET_AX8817X is not set +# CONFIG_USB_NET_AX88179_178A is not set +CONFIG_USB_NET_CDCETHER=y +# CONFIG_USB_NET_CDC_EEM is not set +CONFIG_USB_NET_CDC_NCM=y +# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set +# CONFIG_USB_NET_CDC_MBIM is not set +# CONFIG_USB_NET_DM9601 is not set +# CONFIG_USB_NET_SR9700 is not set +# CONFIG_USB_NET_SR9800 is not set +# CONFIG_USB_NET_SMSC75XX is not set +# CONFIG_USB_NET_SMSC95XX is not set +# CONFIG_USB_NET_GL620A is not set +CONFIG_USB_NET_NET1080=y +# CONFIG_USB_NET_PLUSB is not set +# CONFIG_USB_NET_MCS7830 is not set +# CONFIG_USB_NET_RNDIS_HOST is not set +CONFIG_USB_NET_CDC_SUBSET=y +# CONFIG_USB_ALI_M5632 is not set +# CONFIG_USB_AN2720 is not set +CONFIG_USB_BELKIN=y +# CONFIG_USB_ARMLINUX is not set +# CONFIG_USB_EPSON2888 is not set +# CONFIG_USB_KC2190 is not set +CONFIG_USB_NET_ZAURUS=y +# CONFIG_USB_NET_CX82310_ETH is not set +# CONFIG_USB_NET_KALMIA is not set +# CONFIG_USB_NET_QMI_WWAN is not set +# CONFIG_USB_NET_INT51X1 is not set # CONFIG_USB_IPHETH is not set +# CONFIG_USB_SIERRA_NET is not set +# CONFIG_USB_VL600 is not set # CONFIG_WLAN is not set # From 668af73f38dc744a37d4edba2c3c833bf7e29a16 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Mon, 1 Feb 2016 10:20:32 -0800 Subject: [PATCH 09/55] updated buildroot primary mirror to github, set primary mirror only in buildroot configuration files --- .../base/any/initrds/buildroot/builds/buildroot.config-powerpc | 2 +- .../base/any/initrds/buildroot/builds/buildroot.config-x86_64 | 2 +- setup.env | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/base/any/initrds/buildroot/builds/buildroot.config-powerpc b/packages/base/any/initrds/buildroot/builds/buildroot.config-powerpc index a493261a..3d6f2bd3 100644 --- a/packages/base/any/initrds/buildroot/builds/buildroot.config-powerpc +++ b/packages/base/any/initrds/buildroot/builds/buildroot.config-powerpc @@ -85,7 +85,7 @@ BR2_HOST_DIR="$(BASE_DIR)/host" # Mirrors and Download locations # BR2_PRIMARY_SITE="$(BUILDROOTMIRROR)" -# BR2_PRIMARY_SITE_ONLY is not set +BR2_PRIMARY_SITE_ONLY=y BR2_BACKUP_SITE="https://raw.githubusercontent.com/opennetworklinux/buildroot-download-cache/master/dl" BR2_KERNEL_MIRROR="http://www.kernel.org/pub/" BR2_GNU_MIRROR="http://ftp.gnu.org/pub/gnu" diff --git a/packages/base/any/initrds/buildroot/builds/buildroot.config-x86_64 b/packages/base/any/initrds/buildroot/builds/buildroot.config-x86_64 index 6194cb4a..4cd85df1 100644 --- a/packages/base/any/initrds/buildroot/builds/buildroot.config-x86_64 +++ b/packages/base/any/initrds/buildroot/builds/buildroot.config-x86_64 @@ -60,7 +60,7 @@ BR2_HOST_DIR="$(BASE_DIR)/host" # Mirrors and Download locations # BR2_PRIMARY_SITE="$(BUILDROOTMIRROR)" -# BR2_PRIMARY_SITE_ONLY is not set +BR2_PRIMARY_SITE_ONLY=y BR2_BACKUP_SITE="https://raw.githubusercontent.com/opennetworklinux/buildroot-download-cache/master/dl" BR2_KERNEL_MIRROR="http://www.kernel.org/pub/" BR2_GNU_MIRROR="http://ftp.gnu.org/pub/gnu" diff --git a/setup.env b/setup.env index bbe964a8..57c6aa21 100755 --- a/setup.env +++ b/setup.env @@ -31,7 +31,7 @@ export ONLPM_OPTION_INCLUDE_ENV_JSON="$ONL/make/version-onl.json" # # buildroot download mirror. We suggest you setup a local repository containing these contents for faster local builds. # -export BUILDROOTMIRROR=${BUILDROOTMIRROR:-"http://buildroot.hw.bigswitch.com/dl"} +export BUILDROOTMIRROR=${BUILDROOTMIRROR:-"https://raw.githubusercontent.com/opennetworklinux/buildroot-download-cache/master/dl"} # These submodules are required for almost everything. $ONL/tools/submodules.py $ONL sm/infra From 5bfe3ceaac09d0e0ae12b339e146122f583dfef1 Mon Sep 17 00:00:00 2001 From: Rob Sherwood Date: Tue, 2 Feb 2016 13:05:04 -0800 Subject: [PATCH 10/55] added `make docker-debug` target --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 07e150db..f053489a 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ # ############################################################ ifneq ($(MAKECMDGOALS),docker) +ifneq ($(MAKECMDGOALS),docker-debug) ifndef ONL $(error Please source the setup.env script at the root of the ONL tree) @@ -30,6 +31,7 @@ rpc rebuild: $(ONLPM) --rebuild-pkg-cache endif +endif .PHONY: docker @@ -43,3 +45,7 @@ docker_check: docker: docker_check @docker/tools/onlbuilder -$(VERSION) --isolate --hostname onlbuilder$(VERSION) --pull --autobuild --non-interactive + +# create an interative docker shell, for debugging builds +docker-debug: docker_check + @docker/tools/onlbuilder -$(VERSION) --isolate --hostname onlbuilder$(VERSION) --pull From b2004243e1184fbc9744756cc831d8d330fe4a91 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Tue, 2 Feb 2016 21:52:08 +0000 Subject: [PATCH 11/55] Add onlp as a proper prerequisite. --- packages/base/any/onlp-snmpd/APKG.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/base/any/onlp-snmpd/APKG.yml b/packages/base/any/onlp-snmpd/APKG.yml index 6e70c5f4..d931723e 100644 --- a/packages/base/any/onlp-snmpd/APKG.yml +++ b/packages/base/any/onlp-snmpd/APKG.yml @@ -1,3 +1,6 @@ +prerequisites: + packages: [ "onlp:$ARCH" ] + common: arch: $ARCH version: 1.0.0 From 1e21a2350bff784e1cc58dad1caaf340524d6512 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Tue, 2 Feb 2016 14:56:22 -0800 Subject: [PATCH 12/55] Updates to docker_shell to setup binfmt --- docker/tools/docker_shell | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docker/tools/docker_shell b/docker/tools/docker_shell index 9c49883e..7ad78047 100755 --- a/docker/tools/docker_shell +++ b/docker/tools/docker_shell @@ -154,6 +154,17 @@ for u in ops.addusers: if ops.start_cacher: execute("/etc/init.d/apt-cacher-ng start", "The apt-cacher-ng service could not be started.") +logger.debug("checking if qemu-ppc exists") + +if os.path.isfile("/proc/sys/fs/binfmt_misc/qemu-ppc"): + logger.debug("qemu-ppc already exists") +else: + if os.path.ismount("/proc/sys/fs/binfmt_misc"): + execute("sudo /etc/init.d/binfmt-support start", "The binfmt-support service could not be started.") + else: + execute("sudo mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc", "The binfmt_misc system could not be mounted.") + execute("sudo /etc/init.d/binfmt-support start", "The binfmt-support service could not be started.") + # Fixme: change this to os.execvp() c = "/usr/bin/sudo -E -u %s %s" % (g_user.name, " ".join(ops.command)) sys.exit(execute(c)) From a9371065859c1a44addfb1c8363940bba6d84f32 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Tue, 2 Feb 2016 23:23:36 +0000 Subject: [PATCH 13/55] updated per capveg suggestions --- docker/tools/docker_shell | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/docker/tools/docker_shell b/docker/tools/docker_shell index 7ad78047..6376b7b1 100755 --- a/docker/tools/docker_shell +++ b/docker/tools/docker_shell @@ -159,11 +159,9 @@ logger.debug("checking if qemu-ppc exists") if os.path.isfile("/proc/sys/fs/binfmt_misc/qemu-ppc"): logger.debug("qemu-ppc already exists") else: - if os.path.ismount("/proc/sys/fs/binfmt_misc"): - execute("sudo /etc/init.d/binfmt-support start", "The binfmt-support service could not be started.") - else: - execute("sudo mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc", "The binfmt_misc system could not be mounted.") - execute("sudo /etc/init.d/binfmt-support start", "The binfmt-support service could not be started.") + if not os.path.ismount("/proc/sys/fs/binfmt_misc"): + execute("sudo mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc", "The binfmt_misc system could not be mounted.") + execute("sudo /etc/init.d/binfmt-support start", "The binfmt-support service could not be started.") # Fixme: change this to os.execvp() c = "/usr/bin/sudo -E -u %s %s" % (g_user.name, " ".join(ops.command)) From 8690f135d9d3ffb7c66d928922e9b361793fb2be Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 3 Feb 2016 17:22:29 +0000 Subject: [PATCH 14/55] QSFP Driver Fix. --- ...form-accton-as5812_54t-device-drivers.patch | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/packages/base/any/kernels/3.2.65-1+deb7u2/patches/platform-accton-as5812_54t-device-drivers.patch b/packages/base/any/kernels/3.2.65-1+deb7u2/patches/platform-accton-as5812_54t-device-drivers.patch index 5281309c..dfe66f46 100644 --- a/packages/base/any/kernels/3.2.65-1+deb7u2/patches/platform-accton-as5812_54t-device-drivers.patch +++ b/packages/base/any/kernels/3.2.65-1+deb7u2/patches/platform-accton-as5812_54t-device-drivers.patch @@ -1533,7 +1533,7 @@ new file mode 100644 index 0000000..0985c80 --- /dev/null +++ b/drivers/misc/eeprom/accton_as5812_54t_sfp.c -@@ -0,0 +1,332 @@ +@@ -0,0 +1,318 @@ +/* + * An hwmon driver for accton as5812_54t sfp + * @@ -1768,20 +1768,6 @@ index 0000000..0985c80 + return result; +} + -+static int convert_cpld_present_value_in_port_order(int value) -+{ -+ int ret = 0; -+ -+ ret |= (value & BIT_INDEX(0)) << 5; -+ ret |= (value & BIT_INDEX(1)) << 1; -+ ret |= (value & BIT_INDEX(2)) >> 1; -+ ret |= (value & BIT_INDEX(3)) << 1; -+ ret |= (value & BIT_INDEX(4)) >> 4; -+ ret |= (value & BIT_INDEX(5)) >> 2; -+ -+ return ret; -+} -+ +static struct as5812_54t_sfp_data *as5812_54t_sfp_update_device(struct device *dev, int update_eeprom) +{ + struct i2c_client *client = to_i2c_client(dev); @@ -1812,7 +1798,7 @@ index 0000000..0985c80 + dev_dbg(&client->dev, "cpld(0x60) reg(0x22) err %d\n", status); + } + else { -+ data->status = convert_cpld_present_value_in_port_order(status); /* (u32)status */ ++ data->status = status & 0x3F; /* (u32)status */ + } + + if (update_eeprom) { From aabf40fbf2fda81ac58f0a86705a35a6b1334fd0 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 3 Feb 2016 09:41:44 -0800 Subject: [PATCH 15/55] LAtest --- packages/platforms-closed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platforms-closed b/packages/platforms-closed index 52a6f7f8..ca6abea5 160000 --- a/packages/platforms-closed +++ b/packages/platforms-closed @@ -1 +1 @@ -Subproject commit 52a6f7f8d5357a3ae2e4550b4ffff7cd5a38f3b8 +Subproject commit ca6abea54088ad74ad2fe044a39522224ac90a5d From e0873255eca036aebc8841a3528bf3e9657675d2 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Thu, 4 Feb 2016 12:41:15 -0800 Subject: [PATCH 16/55] report initial fan/psu failed state to syslog pull 21 from onlp --- .../src/onlp/module/src/platform_manager.c | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/packages/base/any/onlp/src/onlp/module/src/platform_manager.c b/packages/base/any/onlp/src/onlp/module/src/platform_manager.c index f724e9d6..a2a884b2 100644 --- a/packages/base/any/onlp/src/onlp/module/src/platform_manager.c +++ b/packages/base/any/onlp/src/onlp/module/src/platform_manager.c @@ -273,6 +273,7 @@ platform_psus_notify__(void) static onlp_oid_t psu_oid_table[ONLP_OID_TABLE_SIZE] = {0}; static onlp_psu_info_t psu_info_table[ONLP_OID_TABLE_SIZE]; int i = 0; + static int flag[ONLP_OID_TABLE_SIZE] = {0}; if(psu_oid_table[0] == 0) { /* We haven't retreived the system PSU oids yet. */ @@ -302,6 +303,26 @@ platform_psus_notify__(void) continue; } + /* report initial failed state */ + if ( !flag[i] ) { + if ( !(pi.status & 0x1) ) { + AIM_SYSLOG_WARN("PSU is not present.", + "The given PSU is not present.", + "PSU %d is not present.", pid); + } + if ( pi.status & ONLP_PSU_STATUS_FAILED ) { + AIM_SYSLOG_CRIT("PSU has failed.", + "The given PSU has failed.", + "PSU %d has failed.", pid); + } + if ((pi.status & 0x01) && !(pi.status & ONLP_PSU_STATUS_FAILED) && (pi.status & ONLP_PSU_STATUS_UNPLUGGED)) { + AIM_SYSLOG_WARN("PSU power cord not plugged.", + "The given PSU does not have power cord plugged.", + "PSU %d power cord not plugged.", pid); + } + flag[i] = 1; + } + /* * Log any presences or failure transitions. */ @@ -363,6 +384,7 @@ platform_fans_notify__(void) static onlp_oid_t fan_oid_table[ONLP_OID_TABLE_SIZE] = {0}; static onlp_fan_info_t fan_info_table[ONLP_OID_TABLE_SIZE]; int i = 0; + static int flag[ONLP_OID_TABLE_SIZE] = {0}; if(fan_oid_table[0] == 0) { /* We haven't retreived the system FAN oids yet. */ @@ -392,6 +414,21 @@ platform_fans_notify__(void) continue; } + /* report initial failed state */ + if ( !flag[i] ) { + if ( !(fi.status & 0x1) ) { + AIM_SYSLOG_WARN("Fan is not present.", + "The given Fan is not present.", + "Fan %d is not present.", fid); + } + if ( fi.status & ONLP_FAN_STATUS_FAILED ) { + AIM_SYSLOG_CRIT("Fan has failed.", + "The given fan has failed.", + "Fan %d has failed.", fid); + } + flag[i] = 1; + } + /* * Log any presences or failure transitions. */ From 0864c30d4db4083676eaf79f1e58109a0ceff596 Mon Sep 17 00:00:00 2001 From: Rob Sherwood Date: Fri, 5 Feb 2016 10:02:01 -0800 Subject: [PATCH 17/55] Skeleton OOM_shim package for OCP Demo --- packages/base/amd64/oom_shim/Makefile | 1 + packages/base/amd64/oom_shim/PKG.yml | 2 ++ packages/base/amd64/oom_shim/builds/Makefile | 3 ++ packages/base/any/oom_shim/APKG.yml | 32 ++++++++++++++++++++ packages/base/any/oom_shim/builds/Makefile | 9 ++++++ packages/base/any/oom_shim/src/oom_shim.c | 7 +++++ 6 files changed, 54 insertions(+) create mode 100644 packages/base/amd64/oom_shim/Makefile create mode 100644 packages/base/amd64/oom_shim/PKG.yml create mode 100644 packages/base/amd64/oom_shim/builds/Makefile create mode 100644 packages/base/any/oom_shim/APKG.yml create mode 100644 packages/base/any/oom_shim/builds/Makefile create mode 100644 packages/base/any/oom_shim/src/oom_shim.c diff --git a/packages/base/amd64/oom_shim/Makefile b/packages/base/amd64/oom_shim/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/amd64/oom_shim/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/base/amd64/oom_shim/PKG.yml b/packages/base/amd64/oom_shim/PKG.yml new file mode 100644 index 00000000..d8f9b23f --- /dev/null +++ b/packages/base/amd64/oom_shim/PKG.yml @@ -0,0 +1,2 @@ +!include $ONL/packages/base/any/oom_shim/APKG.yml ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu + diff --git a/packages/base/amd64/oom_shim/builds/Makefile b/packages/base/amd64/oom_shim/builds/Makefile new file mode 100644 index 00000000..a6c9d258 --- /dev/null +++ b/packages/base/amd64/oom_shim/builds/Makefile @@ -0,0 +1,3 @@ +include $(ONL)/make/config.amd64.mk +include $(ONL)/packages/base/any/oom_shim/builds/Makefile + diff --git a/packages/base/any/oom_shim/APKG.yml b/packages/base/any/oom_shim/APKG.yml new file mode 100644 index 00000000..e8490b9b --- /dev/null +++ b/packages/base/any/oom_shim/APKG.yml @@ -0,0 +1,32 @@ +############################################################ +# +# OOM SHIM +# +# Requires: ARCH, TOOLCHAIN +# +############################################################ +variables: + libdir: /lib/${TOOLCHAIN} + +common: + arch: $ARCH + version: 1.0.0 + copyright: Copyright 2016 Big Switch Networks + maintainer: support@bigswitch.com + + + +packages: + - name: oom_shim + version: 1.0.0 + summary: Open Optical Module Wrapper library around ONLP + provides: [ oom_shim ] + + files: + builds/$BUILD_DIR/${TOOLCHAIN}/liboom_shim.so : $libdir/ + + changelog: Initial code for 2016 OCP Demo + + + + diff --git a/packages/base/any/oom_shim/builds/Makefile b/packages/base/any/oom_shim/builds/Makefile new file mode 100644 index 00000000..8bc9a7f5 --- /dev/null +++ b/packages/base/any/oom_shim/builds/Makefile @@ -0,0 +1,9 @@ +include $(ONL)/make/any.mk + + +liboom_shim.so: + @$(CC) -o liboom_shim.so -shared -PIC liboom_shim.c + +.PHONY: deb +deb: + $(MAKE) -C deb diff --git a/packages/base/any/oom_shim/src/oom_shim.c b/packages/base/any/oom_shim/src/oom_shim.c new file mode 100644 index 00000000..5e866c30 --- /dev/null +++ b/packages/base/any/oom_shim/src/oom_shim.c @@ -0,0 +1,7 @@ +#include + +int test_func(int argc) +{ + + printf("Looks like it works...\n"); +} From fa29d183b7b20fecaac979b26f153f16a0690a95 Mon Sep 17 00:00:00 2001 From: Rob Sherwood Date: Fri, 5 Feb 2016 10:24:14 -0800 Subject: [PATCH 18/55] Skeleton guide for development in our Make system --- docs/dev.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 docs/dev.md diff --git a/docs/dev.md b/docs/dev.md new file mode 100644 index 00000000..77130458 --- /dev/null +++ b/docs/dev.md @@ -0,0 +1,16 @@ +==== FIXME === +Finish this doc + +== Adding a new package + +* Create most of the files in the 'any' architecture for cross compiling +* Copy the directory structure from an existing package + * APKG.yml goes into the $(ONL)/packages/base/any/foo/ directory + * PKG.yml goes into the $(ONL)/packages/base/$ARCH/foo directory + * Create for each $ARCH you intend to support +* Put code in $(ONL)/packages/base/any/foo/src +* Put package specific Makefiles in $(ONL)/packages/base/any/builds + +* Run `make rebuild` in $(ONL)/packages/base/$ARCH/foo to rebuild the package cache + * particularly if you see an error like: + """ERROR:onlpm:'Package all does not exist.'""" From acea7ab90c447bbd30520b931461cf892d05cfd0 Mon Sep 17 00:00:00 2001 From: Rob Sherwood Date: Fri, 5 Feb 2016 18:53:19 -0800 Subject: [PATCH 19/55] Made the OOM-shim package makefile work --- packages/base/any/oom_shim/builds/Makefile | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/base/any/oom_shim/builds/Makefile b/packages/base/any/oom_shim/builds/Makefile index 8bc9a7f5..8f2d99a4 100644 --- a/packages/base/any/oom_shim/builds/Makefile +++ b/packages/base/any/oom_shim/builds/Makefile @@ -1,9 +1,27 @@ include $(ONL)/make/any.mk +ifndef TOOLCHAIN +$(error Must define $$TOOLCHAIN to use this Makefile) +endif -liboom_shim.so: - @$(CC) -o liboom_shim.so -shared -PIC liboom_shim.c +ifndef RELEASE +$(warn Assuming RELEASE is wheezy -- FIXME) +RELEASE=wheezy +endif + +PACKAGE=oom_shim + +OUTDIR=$(ONL)/packages/base/$(ARCH)/$(PACKAGE)/builds/BUILD/$(RELEASE)/$(TOOLCHAIN) + +VPATH=$(ONL)/packages/base/any/$(PACKAGE)/src + +$(OUTDIR)/liboom_shim.so: oom_shim.c + @mkdir -p $(OUTDIR) || true + @$(CC) -o $(OUTDIR)/liboom_shim.so -shared -fPIC $+ .PHONY: deb deb: $(MAKE) -C deb + +clean: + rm -rf $(OUTDIR) From 43e1405c40dd93b33928714f9d8294b99849316c Mon Sep 17 00:00:00 2001 From: Rohit Malaga Date: Mon, 8 Feb 2016 11:44:44 -0800 Subject: [PATCH 20/55] Adding powerpc version of oom_shim --- packages/base/powerpc/oom_shim/Makefile | 1 + packages/base/powerpc/oom_shim/PKG.yml | 2 ++ packages/base/powerpc/oom_shim/builds/Makefile | 3 +++ 3 files changed, 6 insertions(+) create mode 100644 packages/base/powerpc/oom_shim/Makefile create mode 100644 packages/base/powerpc/oom_shim/PKG.yml create mode 100644 packages/base/powerpc/oom_shim/builds/Makefile diff --git a/packages/base/powerpc/oom_shim/Makefile b/packages/base/powerpc/oom_shim/Makefile new file mode 100644 index 00000000..dc1e7b86 --- /dev/null +++ b/packages/base/powerpc/oom_shim/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk diff --git a/packages/base/powerpc/oom_shim/PKG.yml b/packages/base/powerpc/oom_shim/PKG.yml new file mode 100644 index 00000000..74562b35 --- /dev/null +++ b/packages/base/powerpc/oom_shim/PKG.yml @@ -0,0 +1,2 @@ +!include $ONL/packages/base/any/oom_shim/APKG.yml ARCH=powerpc TOOLCHAIN=powerpc-linux-gnu + diff --git a/packages/base/powerpc/oom_shim/builds/Makefile b/packages/base/powerpc/oom_shim/builds/Makefile new file mode 100644 index 00000000..dbb8572e --- /dev/null +++ b/packages/base/powerpc/oom_shim/builds/Makefile @@ -0,0 +1,3 @@ +include $(ONL)/make/config.powerpc.mk +include $(ONL)/packages/base/any/oom_shim/builds/Makefile + From 10271c420ef53b3e8b4ae25936f1c5fe83a5fe75 Mon Sep 17 00:00:00 2001 From: Rohit Malaga Date: Mon, 8 Feb 2016 12:12:38 -0800 Subject: [PATCH 21/55] Change the library name to liboom_south --- packages/base/amd64/oom_shim/Makefile | 2 +- packages/base/any/oom_shim/APKG.yml | 2 +- packages/base/any/oom_shim/builds/Makefile | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/base/amd64/oom_shim/Makefile b/packages/base/amd64/oom_shim/Makefile index 003238cf..dc1e7b86 100644 --- a/packages/base/amd64/oom_shim/Makefile +++ b/packages/base/amd64/oom_shim/Makefile @@ -1 +1 @@ -include $(ONL)/make/pkg.mk \ No newline at end of file +include $(ONL)/make/pkg.mk diff --git a/packages/base/any/oom_shim/APKG.yml b/packages/base/any/oom_shim/APKG.yml index e8490b9b..04023976 100644 --- a/packages/base/any/oom_shim/APKG.yml +++ b/packages/base/any/oom_shim/APKG.yml @@ -23,7 +23,7 @@ packages: provides: [ oom_shim ] files: - builds/$BUILD_DIR/${TOOLCHAIN}/liboom_shim.so : $libdir/ + builds/$BUILD_DIR/${TOOLCHAIN}/liboom_south.so : $libdir/ changelog: Initial code for 2016 OCP Demo diff --git a/packages/base/any/oom_shim/builds/Makefile b/packages/base/any/oom_shim/builds/Makefile index 8f2d99a4..2cfc08d9 100644 --- a/packages/base/any/oom_shim/builds/Makefile +++ b/packages/base/any/oom_shim/builds/Makefile @@ -15,9 +15,9 @@ OUTDIR=$(ONL)/packages/base/$(ARCH)/$(PACKAGE)/builds/BUILD/$(RELEASE)/$(TOOLCHA VPATH=$(ONL)/packages/base/any/$(PACKAGE)/src -$(OUTDIR)/liboom_shim.so: oom_shim.c +$(OUTDIR)/liboom_south.so: oom_shim.c @mkdir -p $(OUTDIR) || true - @$(CC) -o $(OUTDIR)/liboom_shim.so -shared -fPIC $+ + @$(CC) -o $(OUTDIR)/liboom_south.so -shared -fPIC $+ .PHONY: deb deb: From 90c8fddb755903cea079cd971b87b4a673ecdaa6 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Tue, 9 Feb 2016 17:15:07 -0800 Subject: [PATCH 22/55] Update Dockerfile fixing whitespace issue line 131 --- docker/images/builder8/1.0/Dockerfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docker/images/builder8/1.0/Dockerfile b/docker/images/builder8/1.0/Dockerfile index b0772495..d1486635 100644 --- a/docker/images/builder8/1.0/Dockerfile +++ b/docker/images/builder8/1.0/Dockerfile @@ -127,8 +127,7 @@ RUN echo 'APT::Get::AllowUnauthenticated "true";\nAPT::Get::Assume-Yes "true";' dpkg -i texinfo_4.13a.dfsg.1-10_amd64.deb && \ wget "http://ftp.us.debian.org/debian/pool/main/e/emdebian-crush/xapt_2.2.19_all.deb" && \ dpkg -i xapt_2.2.19_all.deb && \ - - xapt -a powerpc libedit-dev ncurses-dev libsensors4-dev libwrap0-dev libssl-dev libsnmp-dev + xapt -a powerpc libedit-dev ncurses-dev libsensors4-dev libwrap0-dev libssl-dev libsnmp-dev # update-alternatives --install /usr/bin/powerpc-linux-gnu-gcc powerpc-linux-gnu-gcc 10 && # From 33bb8c0690eb1fdc693283ffa35f06bcf2f00303 Mon Sep 17 00:00:00 2001 From: Rob Sherwood Date: Fri, 12 Feb 2016 09:19:29 -0800 Subject: [PATCH 23/55] Changed OOM_SHIM package to module formatted code --- .../amd64/{oom_shim => oom-shim}/Makefile | 0 packages/base/amd64/oom-shim/PKG.yml | 2 + packages/base/amd64/oom-shim/builds/Makefile | 3 + .../base/amd64/oom-shim/builds/oom_shim.mk | 10 ++ packages/base/amd64/oom_shim/PKG.yml | 2 - packages/base/amd64/oom_shim/builds/Makefile | 3 - .../base/any/{oom_shim => oom-shim}/APKG.yml | 4 +- packages/base/any/oom-shim/builds/Makefile | 53 +++++++ packages/base/any/oom-shim/src/Makefile | 4 + .../base/any/oom-shim/src/module/auto/make.mk | 28 ++++ .../any/oom-shim/src/module/auto/oom_shim.yml | 86 ++++++++++++ .../src/module/inc/oom-shim/oom-shim.h | 0 .../src/module/inc/oom_shim/oom-shim.h | 0 packages/base/any/oom-shim/src/module/make.mk | 30 ++++ .../src/module}/src/oom_shim.c | 0 packages/base/any/oom-shim/src/oom_shim.mk | 12 ++ packages/base/any/oom-shim/src/utest/_make.mk | 28 ++++ packages/base/any/oom-shim/src/utest/main.c | 131 ++++++++++++++++++ packages/base/any/oom_shim/builds/Makefile | 27 ---- 19 files changed, 389 insertions(+), 34 deletions(-) rename packages/base/amd64/{oom_shim => oom-shim}/Makefile (100%) create mode 100644 packages/base/amd64/oom-shim/PKG.yml create mode 100644 packages/base/amd64/oom-shim/builds/Makefile create mode 100644 packages/base/amd64/oom-shim/builds/oom_shim.mk delete mode 100644 packages/base/amd64/oom_shim/PKG.yml delete mode 100644 packages/base/amd64/oom_shim/builds/Makefile rename packages/base/any/{oom_shim => oom-shim}/APKG.yml (85%) create mode 100644 packages/base/any/oom-shim/builds/Makefile create mode 100644 packages/base/any/oom-shim/src/Makefile create mode 100644 packages/base/any/oom-shim/src/module/auto/make.mk create mode 100644 packages/base/any/oom-shim/src/module/auto/oom_shim.yml create mode 100644 packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h create mode 100644 packages/base/any/oom-shim/src/module/inc/oom_shim/oom-shim.h create mode 100644 packages/base/any/oom-shim/src/module/make.mk rename packages/base/any/{oom_shim => oom-shim/src/module}/src/oom_shim.c (100%) create mode 100644 packages/base/any/oom-shim/src/oom_shim.mk create mode 100644 packages/base/any/oom-shim/src/utest/_make.mk create mode 100644 packages/base/any/oom-shim/src/utest/main.c delete mode 100644 packages/base/any/oom_shim/builds/Makefile diff --git a/packages/base/amd64/oom_shim/Makefile b/packages/base/amd64/oom-shim/Makefile similarity index 100% rename from packages/base/amd64/oom_shim/Makefile rename to packages/base/amd64/oom-shim/Makefile diff --git a/packages/base/amd64/oom-shim/PKG.yml b/packages/base/amd64/oom-shim/PKG.yml new file mode 100644 index 00000000..7f4f460d --- /dev/null +++ b/packages/base/amd64/oom-shim/PKG.yml @@ -0,0 +1,2 @@ +!include $ONL/packages/base/any/oom-shim/APKG.yml ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu + diff --git a/packages/base/amd64/oom-shim/builds/Makefile b/packages/base/amd64/oom-shim/builds/Makefile new file mode 100644 index 00000000..66500cec --- /dev/null +++ b/packages/base/amd64/oom-shim/builds/Makefile @@ -0,0 +1,3 @@ +include $(ONL)/make/config.amd64.mk +include $(ONL)/packages/base/any/oom-shim/builds/Makefile + diff --git a/packages/base/amd64/oom-shim/builds/oom_shim.mk b/packages/base/amd64/oom-shim/builds/oom_shim.mk new file mode 100644 index 00000000..88c00283 --- /dev/null +++ b/packages/base/amd64/oom-shim/builds/oom_shim.mk @@ -0,0 +1,10 @@ + +############################################################################### +# +# Inclusive Makefile for the oom_shim module. +# +# Autogenerated 2016-02-12 17:14:48.789289 +# +############################################################################### +oom_shim_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) + diff --git a/packages/base/amd64/oom_shim/PKG.yml b/packages/base/amd64/oom_shim/PKG.yml deleted file mode 100644 index d8f9b23f..00000000 --- a/packages/base/amd64/oom_shim/PKG.yml +++ /dev/null @@ -1,2 +0,0 @@ -!include $ONL/packages/base/any/oom_shim/APKG.yml ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu - diff --git a/packages/base/amd64/oom_shim/builds/Makefile b/packages/base/amd64/oom_shim/builds/Makefile deleted file mode 100644 index a6c9d258..00000000 --- a/packages/base/amd64/oom_shim/builds/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -include $(ONL)/make/config.amd64.mk -include $(ONL)/packages/base/any/oom_shim/builds/Makefile - diff --git a/packages/base/any/oom_shim/APKG.yml b/packages/base/any/oom-shim/APKG.yml similarity index 85% rename from packages/base/any/oom_shim/APKG.yml rename to packages/base/any/oom-shim/APKG.yml index e8490b9b..6a54841f 100644 --- a/packages/base/any/oom_shim/APKG.yml +++ b/packages/base/any/oom-shim/APKG.yml @@ -17,13 +17,13 @@ common: packages: - - name: oom_shim + - name: oom-shim version: 1.0.0 summary: Open Optical Module Wrapper library around ONLP provides: [ oom_shim ] files: - builds/$BUILD_DIR/${TOOLCHAIN}/liboom_shim.so : $libdir/ + builds/$BUILD_DIR/${TOOLCHAIN}/bin/liboom-south.so : $libdir/ changelog: Initial code for 2016 OCP Demo diff --git a/packages/base/any/oom-shim/builds/Makefile b/packages/base/any/oom-shim/builds/Makefile new file mode 100644 index 00000000..484d66aa --- /dev/null +++ b/packages/base/any/oom-shim/builds/Makefile @@ -0,0 +1,53 @@ +# -*- Makefile -*- +############################################################ +# +# +# Copyright 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. +# +# +############################################################ +# +# +############################################################ +include $(ONL)/make/any.mk + +MODULE := oom_shim +include $(BUILDER)/standardinit.mk + +DEPENDMODULES := AIM onlplib onlp oom_shim cjson cjson_util sff IOF timer_wheel OS + + +include $(BUILDER)/dependmodules.mk + +SHAREDLIB := liboom-south.so +$(SHAREDLIB)_TARGETS := $(ALL_TARGETS) +include $(BUILDER)/so.mk + +.DEFAULT_GOAL := sharedlibs + +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_CTOR_DTOR=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 +GLOBAL_CFLAGS += -DONLP_CONFIG_API_LOCK_GLOBAL_SHARED=1 +GLOBAL_CFLAGS += -DONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT=1 + +GLOBAL_CFLAGS += -fPIC +GLOBAL_LINK_LIBS += -lpthread $(LIBONLP_PLATFORM) $(LIBONLP_PLATFORM_DEFAULTS) + +include $(BUILDER)/targets.mk + +.PHONY: deb +deb: + $(MAKE) -C deb diff --git a/packages/base/any/oom-shim/src/Makefile b/packages/base/any/oom-shim/src/Makefile new file mode 100644 index 00000000..ee296946 --- /dev/null +++ b/packages/base/any/oom-shim/src/Makefile @@ -0,0 +1,4 @@ +include $(ONL)/make/config.mk +MODULE := oom_shim +AUTOMODULE := oom_shim +include $(BUILDER)/definemodule.mk diff --git a/packages/base/any/oom-shim/src/module/auto/make.mk b/packages/base/any/oom-shim/src/module/auto/make.mk new file mode 100644 index 00000000..9dac4629 --- /dev/null +++ b/packages/base/any/oom-shim/src/module/auto/make.mk @@ -0,0 +1,28 @@ +############################################################ +# +# +# 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. +# +# +############################################################ +# +# faultd Autogeneration +# +############################################################ +oom_shim_AUTO_DEFS := module/auto/oom_shim.yml +oom_shim_AUTO_DIRS := module/inc/oom_shim module/src +include $(BUILDER)/auto.mk + diff --git a/packages/base/any/oom-shim/src/module/auto/oom_shim.yml b/packages/base/any/oom-shim/src/module/auto/oom_shim.yml new file mode 100644 index 00000000..32557d9e --- /dev/null +++ b/packages/base/any/oom-shim/src/module/auto/oom_shim.yml @@ -0,0 +1,86 @@ +############################################################ +# +# +# 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. +# +# +############################################################ +# +# faultd Autogeneration Definitions. +# +############################################################ + +cdefs: &cdefs +- OOM_SHIM_CONFIG_INCLUDE_LOGGING: + doc: "Include or exclude logging." + default: 1 +- OOM_SHIM_CONFIG_LOG_OPTIONS_DEFAULT: + doc: "Default enabled log options." + default: AIM_LOG_OPTIONS_DEFAULT +- OOM_SHIM_CONFIG_LOG_BITS_DEFAULT: + doc: "Default enabled log bits." + default: AIM_LOG_BITS_DEFAULT +- OOM_SHIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT: + doc: "Default enabled custom log bits." + default: 0 +- OOM_SHIM_CONFIG_PORTING_STDLIB: + doc: "Default all porting macros to use the C standard libraries." + default: 1 +- OOM_SHIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS: + doc: "Include standard library headers for stdlib porting macros." + default: OOM_SHIM_CONFIG_PORTING_STDLIB +- OOM_SHIM_CONFIG_INCLUDE_UCLI: + doc: "Include generic uCli support." + default: 0 +- OOM_SHIM_CONFIG_PIPE_NAME_DEFAULT: + doc: "Default named pipe." + default: "\"/var/run/faultd.pipe\"" +- OOM_SHIM_CONFIG_BINARY_SIZE: + doc: "Maximum binary name size." + default: 255 +- OOM_SHIM_CONFIG_BACKTRACE_SIZE_MAX: + doc: "Maximum backtrace size." + default: 32 +- OOM_SHIM_CONFIG_SERVICE_PIPES_MAX: + doc: "Maximum number of simulatanous service pipes." + default: 8 +- OOM_SHIM_CONFIG_BACKTRACE_SYMBOLS_SIZE: + doc: "Maximum backtrace symbols size" + default: 4096 +- OOM_SHIM_CONFIG_INCLUDE_MAIN: + doc: "Include faultd_main() for standard faultd daemon build." + default: 0 +- OOM_SHIM_CONFIG_INCLUDE_AIM_MAIN: + doc: "Include aim_main() as faultd_main()." + default: OOM_SHIM_CONFIG_INCLUDE_MAIN +- OOM_SHIM_CONFIG_MAIN_PIPENAME: + doc: "Default pipename used by faultd_main() if included." + default: "\"/var/run/faultd.fifo\"" + + +definitions: + cdefs: + OOM_SHIM_CONFIG_HEADER: + defs: *cdefs + basename: faultd_config + + portingmacro: + OOM_SHIM: + macros: + - memset + - memcpy + - strncpy + - strlen diff --git a/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h b/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h new file mode 100644 index 00000000..e69de29b diff --git a/packages/base/any/oom-shim/src/module/inc/oom_shim/oom-shim.h b/packages/base/any/oom-shim/src/module/inc/oom_shim/oom-shim.h new file mode 100644 index 00000000..e69de29b diff --git a/packages/base/any/oom-shim/src/module/make.mk b/packages/base/any/oom-shim/src/module/make.mk new file mode 100644 index 00000000..b6ec73a3 --- /dev/null +++ b/packages/base/any/oom-shim/src/module/make.mk @@ -0,0 +1,30 @@ +############################################################ +# +# +# 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. +# +# +############################################################ +# +# +# +############################################################ + +THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST))) +oom_shim_INCLUDES := -I $(THIS_DIR)inc +oom_shim_INTERNAL_INCLUDES := -I $(THIS_DIR)src +oom_shim_DEPENDMODULE_ENTRIES := init:oom_shim ucli:oom_shim + diff --git a/packages/base/any/oom_shim/src/oom_shim.c b/packages/base/any/oom-shim/src/module/src/oom_shim.c similarity index 100% rename from packages/base/any/oom_shim/src/oom_shim.c rename to packages/base/any/oom-shim/src/module/src/oom_shim.c diff --git a/packages/base/any/oom-shim/src/oom_shim.mk b/packages/base/any/oom-shim/src/oom_shim.mk new file mode 100644 index 00000000..dde86cf9 --- /dev/null +++ b/packages/base/any/oom-shim/src/oom_shim.mk @@ -0,0 +1,12 @@ + +############################################################################### +# +# Inclusive Makefile for the oom-shim module. +# +# Autogenerated 2016-02-12 16:50:50.721882 +# +############################################################################### +oom-shim_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +include $(oom-shim_BASEDIR)/module/make.mk +include $(oom-shim_BASEDIR)/utest/_make.mk + diff --git a/packages/base/any/oom-shim/src/utest/_make.mk b/packages/base/any/oom-shim/src/utest/_make.mk new file mode 100644 index 00000000..43139d4c --- /dev/null +++ b/packages/base/any/oom-shim/src/utest/_make.mk @@ -0,0 +1,28 @@ +############################################################ +# +# +# 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. +# +# +############################################################ +# +# +# +############################################################ + +UMODULE := oom_shim +UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +include $(BUILDER)/utest.mk diff --git a/packages/base/any/oom-shim/src/utest/main.c b/packages/base/any/oom-shim/src/utest/main.c new file mode 100644 index 00000000..e7e9e030 --- /dev/null +++ b/packages/base/any/oom-shim/src/utest/main.c @@ -0,0 +1,131 @@ +/************************************************************ + * + * + * 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. + * + * + ************************************************************ + * + * + * + ***********************************************************/ +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +/** + * Base functionality unit tests. + */ +#define __TRY(_prefix, _expr, _suffix) \ + do { \ + int _rv; \ + fprintf(stderr, "%s%s...%s", _prefix, #_expr, _suffix); \ + fflush(stderr); \ + _rv = _expr ; \ + fprintf(stderr, "%s%s...%d\n", _prefix, #_expr, _rv); \ + fflush(stderr); \ + if(_rv < 0) { \ + AIM_DIE("%s%s: failed: %d", #_expr, _rv); \ + } \ + } while(0) + +#define __TRYNR(_prefix, _expr, _suffix) \ + do { \ + fprintf(stderr, "%s%s...%s", _prefix, #_expr, _suffix); \ + fflush(stderr); \ + _expr ; \ + fprintf(stderr, "%s%s...Done\n", _prefix, #_expr); \ + fflush(stderr); \ + } while(0) + +#define TRY(_expr) __TRY(" ", _expr, "\r") +#define TRYNR(_expr) ___TRYNR(" ", _expr, "\r") +#define TEST(_expr) __TRYNR("", _expr, "\n"); + +/** + * Test Shared Locks + */ +void +shlock_test(void) +{ + onlp_shlock_t* lock = NULL; + + TRY(onlp_shlock_create(0xEEEF, &lock, "utest-lock:%d", 1)); + TRY(onlp_shlock_take(lock)); + TRY(onlp_shlock_give(lock)); + TRY(onlp_shlock_take(lock)); + TRY(onlp_shlock_give(lock)); + TRY(onlp_shlock_global_take()); + TRY(onlp_shlock_global_give()); + TRY(onlp_shlock_global_take()); + TRY(onlp_shlock_global_give()); + if(strcmp("utest-lock:1", onlp_shlock_name(lock))) { + AIM_DIE("lock name does not match (%s)", onlp_shlock_name(lock)); + } +} + +/** + * Test ONIE parsing + */ +void +onie_test(void) +{ + /* TODO */ +} + +int +iter__(onlp_oid_t oid, void* cookie) +{ + onlp_oid_hdr_t hdr; + onlp_oid_hdr_get(oid, &hdr); + printf("OID: 0x%x, D='%s'\n", oid, hdr.description); + return 0; +} + +#include +#include +#include +#include + +int +aim_main(int argc, char* argv[]) +{ + // TEST(shlock_test()); + + /* Example Platform Dump */ + onlp_init(); + onlp_platform_dump(&aim_pvs_stdout, ONLP_OID_DUMP_F_RECURSE); + onlp_oid_iterate(0, 0, iter__, NULL); + onlp_platform_show(&aim_pvs_stdout, ONLP_OID_SHOW_F_RECURSE|ONLP_OID_SHOW_F_EXTENDED); + + if(argv[1] && !strcmp("manage", argv[1])) { + onlp_sys_platform_manage_start(); + printf("Sleeping...\n"); + sleep(10); + printf("Stopping...\n"); + onlp_sys_platform_manage_stop(); + printf("Stopped.\n"); + } + return 0; +} diff --git a/packages/base/any/oom_shim/builds/Makefile b/packages/base/any/oom_shim/builds/Makefile deleted file mode 100644 index 8f2d99a4..00000000 --- a/packages/base/any/oom_shim/builds/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -include $(ONL)/make/any.mk - -ifndef TOOLCHAIN -$(error Must define $$TOOLCHAIN to use this Makefile) -endif - -ifndef RELEASE -$(warn Assuming RELEASE is wheezy -- FIXME) -RELEASE=wheezy -endif - -PACKAGE=oom_shim - -OUTDIR=$(ONL)/packages/base/$(ARCH)/$(PACKAGE)/builds/BUILD/$(RELEASE)/$(TOOLCHAIN) - -VPATH=$(ONL)/packages/base/any/$(PACKAGE)/src - -$(OUTDIR)/liboom_shim.so: oom_shim.c - @mkdir -p $(OUTDIR) || true - @$(CC) -o $(OUTDIR)/liboom_shim.so -shared -fPIC $+ - -.PHONY: deb -deb: - $(MAKE) -C deb - -clean: - rm -rf $(OUTDIR) From ad843891f1714cb798ff50f228a9592ee78f1774 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Fri, 12 Feb 2016 20:06:19 +0000 Subject: [PATCH 24/55] removed extra brackets from __init__.py for AS7512 --- .../r0/src/python/x86_64_accton_as7512_32x_r0/__init__.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/platforms/accton/x86-64/x86-64-accton-as7512-32x/platform-config/r0/src/python/x86_64_accton_as7512_32x_r0/__init__.py b/packages/platforms/accton/x86-64/x86-64-accton-as7512-32x/platform-config/r0/src/python/x86_64_accton_as7512_32x_r0/__init__.py index 3c1e7385..8ff578c9 100644 --- a/packages/platforms/accton/x86-64/x86-64-accton-as7512-32x/platform-config/r0/src/python/x86_64_accton_as7512_32x_r0/__init__.py +++ b/packages/platforms/accton/x86-64/x86-64-accton-as7512-32x/platform-config/r0/src/python/x86_64_accton_as7512_32x_r0/__init__.py @@ -98,7 +98,5 @@ class OnlPlatform_x86_64_accton_as7512_32x_r0(OnlPlatformAccton): self.new_i2c_device('as7512_32x_sfp30', 0x50, 47) self.new_i2c_device('as7512_32x_sfp31', 0x50, 48) self.new_i2c_device('as7512_32x_sfp32', 0x50, 49) - ] - ) return True From 24de625e7df44864866a648b8c811b03b693de9d Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Fri, 12 Feb 2016 13:36:52 -0800 Subject: [PATCH 25/55] Set BUILDROOTMIRROR from the command line. --- tools/autobuild/build.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/autobuild/build.sh b/tools/autobuild/build.sh index bf999f80..627a6273 100755 --- a/tools/autobuild/build.sh +++ b/tools/autobuild/build.sh @@ -9,7 +9,7 @@ ONL="$(realpath $(dirname $AUTOBUILD_SCRIPT)/../../)" # Default build branch BUILD_BRANCH=master -while getopts ":b:s:d:u:p:vc78" opt; do +while getopts ":b:s:d:u:p:vc78r:" opt; do case $opt in 7) ONLB_OPTIONS=--7 @@ -32,6 +32,9 @@ while getopts ":b:s:d:u:p:vc78" opt; do v) set -x ;; + r) + export BUILDROOTMIRROR=$OPTARG + ;; *) ;; esac From 39efb16178fb805ac65512801bd8e0273683493a Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Fri, 12 Feb 2016 14:39:53 -0800 Subject: [PATCH 26/55] Make build order explicit until the ONLPM dependency processing can be improved. --- Makefile | 12 ++++++++++-- packages/base/amd64/initrds/Makefile | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) create mode 100644 packages/base/amd64/initrds/Makefile diff --git a/Makefile b/Makefile index f053489a..6dea21b2 100644 --- a/Makefile +++ b/Makefile @@ -16,13 +16,21 @@ all: amd64 ppc $(MAKE) -C REPO build-clean onl-amd64 onl-x86 x86 x86_64 amd64: - $(MAKE) -C packages/base ARCHES=amd64,all + $(MAKE) -C packages/base/amd64/kernels + $(MAKE) -C packages/base/amd64/initrds + $(MAKE) -C packages/base/amd64/onlp + $(MAKE) -C packages/base/amd64/onlp-snmpd + $(MAKE) -C packages/base/amd64/faultd $(MAKE) -C builds/amd64/rootfs $(MAKE) -C builds/amd64/swi $(MAKE) -C builds/amd64/installer/legacy onl-ppc ppc: - $(MAKE) -C packages/base ARCHES=powerpc,all + $(MAKE) -C packages/base/powerpc/kernels + $(MAKE) -C packages/base/powerpc/initrds + $(MAKE) -C packages/base/powerpc/onlp + $(MAKE) -C packages/base/powerpc/onlp-snmpd + $(MAKE) -C packages/base/powerpc/faultd $(MAKE) -C builds/powerpc/rootfs $(MAKE) -C builds/powerpc/swi $(MAKE) -C builds/powerpc/installer/legacy diff --git a/packages/base/amd64/initrds/Makefile b/packages/base/amd64/initrds/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/base/amd64/initrds/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file From 32c390a249a90289230b501c092e0a93f757aa4f Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Sat, 13 Feb 2016 01:08:04 +0000 Subject: [PATCH 27/55] Add FIT packages. --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index 6dea21b2..553bb85f 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,7 @@ onl-ppc ppc: $(MAKE) -C packages/base/powerpc/onlp $(MAKE) -C packages/base/powerpc/onlp-snmpd $(MAKE) -C packages/base/powerpc/faultd + $(MAKE) -C packages/base/powerpc/fit $(MAKE) -C builds/powerpc/rootfs $(MAKE) -C builds/powerpc/swi $(MAKE) -C builds/powerpc/installer/legacy From db33fcf48d400233dfb3561bb628b1559dd55fa0 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Fri, 12 Feb 2016 18:49:46 -0800 Subject: [PATCH 28/55] Attempt to exit. --- .bashrc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.bashrc b/.bashrc index 1bbf65dd..4b10822c 100644 --- a/.bashrc +++ b/.bashrc @@ -13,8 +13,11 @@ . setup.env +set -e + if [ -n "$ONL_AUTOBUILD" ]; then make all + exit 0 else echo Ready to build OpenNetworkLinux. fi From 9ed539ab94c90c61816a0aa530e73a90d785bfb5 Mon Sep 17 00:00:00 2001 From: Rohit Malaga Date: Sun, 14 Feb 2016 14:59:05 -0800 Subject: [PATCH 29/55] Remove unwanted directory --- packages/base/any/oom_shim/builds/Makefile | 27 ------------------- packages/base/powerpc/oom_shim/Makefile | 1 - packages/base/powerpc/oom_shim/PKG.yml | 2 -- .../base/powerpc/oom_shim/builds/Makefile | 3 --- 4 files changed, 33 deletions(-) delete mode 100644 packages/base/any/oom_shim/builds/Makefile delete mode 100644 packages/base/powerpc/oom_shim/Makefile delete mode 100644 packages/base/powerpc/oom_shim/PKG.yml delete mode 100644 packages/base/powerpc/oom_shim/builds/Makefile diff --git a/packages/base/any/oom_shim/builds/Makefile b/packages/base/any/oom_shim/builds/Makefile deleted file mode 100644 index 2cfc08d9..00000000 --- a/packages/base/any/oom_shim/builds/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -include $(ONL)/make/any.mk - -ifndef TOOLCHAIN -$(error Must define $$TOOLCHAIN to use this Makefile) -endif - -ifndef RELEASE -$(warn Assuming RELEASE is wheezy -- FIXME) -RELEASE=wheezy -endif - -PACKAGE=oom_shim - -OUTDIR=$(ONL)/packages/base/$(ARCH)/$(PACKAGE)/builds/BUILD/$(RELEASE)/$(TOOLCHAIN) - -VPATH=$(ONL)/packages/base/any/$(PACKAGE)/src - -$(OUTDIR)/liboom_south.so: oom_shim.c - @mkdir -p $(OUTDIR) || true - @$(CC) -o $(OUTDIR)/liboom_south.so -shared -fPIC $+ - -.PHONY: deb -deb: - $(MAKE) -C deb - -clean: - rm -rf $(OUTDIR) diff --git a/packages/base/powerpc/oom_shim/Makefile b/packages/base/powerpc/oom_shim/Makefile deleted file mode 100644 index dc1e7b86..00000000 --- a/packages/base/powerpc/oom_shim/Makefile +++ /dev/null @@ -1 +0,0 @@ -include $(ONL)/make/pkg.mk diff --git a/packages/base/powerpc/oom_shim/PKG.yml b/packages/base/powerpc/oom_shim/PKG.yml deleted file mode 100644 index 74562b35..00000000 --- a/packages/base/powerpc/oom_shim/PKG.yml +++ /dev/null @@ -1,2 +0,0 @@ -!include $ONL/packages/base/any/oom_shim/APKG.yml ARCH=powerpc TOOLCHAIN=powerpc-linux-gnu - diff --git a/packages/base/powerpc/oom_shim/builds/Makefile b/packages/base/powerpc/oom_shim/builds/Makefile deleted file mode 100644 index dbb8572e..00000000 --- a/packages/base/powerpc/oom_shim/builds/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -include $(ONL)/make/config.powerpc.mk -include $(ONL)/packages/base/any/oom_shim/builds/Makefile - From 92614d923b32aa4e2a0a9afcc0af99894e71c871 Mon Sep 17 00:00:00 2001 From: Rob Sherwood Date: Sun, 14 Feb 2016 16:32:53 -0800 Subject: [PATCH 30/55] Added oom-shim to list of packages to install by default --- builds/any/rootfs/jessie/common/common-packages.yml | 2 +- builds/any/rootfs/wheezy/common/common-packages.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/builds/any/rootfs/jessie/common/common-packages.yml b/builds/any/rootfs/jessie/common/common-packages.yml index b92a757f..74ef19c4 100644 --- a/builds/any/rootfs/jessie/common/common-packages.yml +++ b/builds/any/rootfs/jessie/common/common-packages.yml @@ -69,4 +69,4 @@ - onl-faultd - onl-loader-initscripts - onlp-snmpd - +- oom-shim diff --git a/builds/any/rootfs/wheezy/common/common-packages.yml b/builds/any/rootfs/wheezy/common/common-packages.yml index e5803d7f..5857b0f2 100644 --- a/builds/any/rootfs/wheezy/common/common-packages.yml +++ b/builds/any/rootfs/wheezy/common/common-packages.yml @@ -68,5 +68,6 @@ - onl-faultd - onl-loader-initscripts - onlp-snmpd +- oom-shim From a3f983f652c8049c0f6314d2209084fa7befec44 Mon Sep 17 00:00:00 2001 From: Rohit Malaga Date: Tue, 16 Feb 2016 06:11:23 -0800 Subject: [PATCH 31/55] Adding powerpc changes --- packages/base/any/oom-shim/APKG.yml | 4 --- packages/base/any/oom-shim/builds/Makefile | 5 +++- .../src/module/inc/oom_shim/oom-shim.h | 0 .../base/any/oom-shim/src/module/src/Makefile | 30 +++++++++++++++++++ packages/base/any/oom-shim/src/oom_shim.mk | 12 ++++---- packages/base/powerpc/oom-shim/Makefile | 1 + packages/base/powerpc/oom-shim/PKG.yml | 2 ++ .../base/powerpc/oom-shim/builds/Makefile | 3 ++ .../base/powerpc/oom-shim/builds/oom-shim.mk | 10 +++++++ 9 files changed, 57 insertions(+), 10 deletions(-) delete mode 100644 packages/base/any/oom-shim/src/module/inc/oom_shim/oom-shim.h create mode 100644 packages/base/any/oom-shim/src/module/src/Makefile create mode 100644 packages/base/powerpc/oom-shim/Makefile create mode 100644 packages/base/powerpc/oom-shim/PKG.yml create mode 100644 packages/base/powerpc/oom-shim/builds/Makefile create mode 100644 packages/base/powerpc/oom-shim/builds/oom-shim.mk diff --git a/packages/base/any/oom-shim/APKG.yml b/packages/base/any/oom-shim/APKG.yml index 21caf002..6a54841f 100644 --- a/packages/base/any/oom-shim/APKG.yml +++ b/packages/base/any/oom-shim/APKG.yml @@ -23,11 +23,7 @@ packages: provides: [ oom_shim ] files: -<<<<<<< HEAD:packages/base/any/oom_shim/APKG.yml - builds/$BUILD_DIR/${TOOLCHAIN}/liboom_south.so : $libdir/ -======= builds/$BUILD_DIR/${TOOLCHAIN}/bin/liboom-south.so : $libdir/ ->>>>>>> 33bb8c0690eb1fdc693283ffa35f06bcf2f00303:packages/base/any/oom-shim/APKG.yml changelog: Initial code for 2016 OCP Demo diff --git a/packages/base/any/oom-shim/builds/Makefile b/packages/base/any/oom-shim/builds/Makefile index 484d66aa..0ccc185a 100644 --- a/packages/base/any/oom-shim/builds/Makefile +++ b/packages/base/any/oom-shim/builds/Makefile @@ -29,6 +29,9 @@ include $(BUILDER)/standardinit.mk DEPENDMODULES := AIM onlplib onlp oom_shim cjson cjson_util sff IOF timer_wheel OS +#LIBONLP_PLATFORM_DEFAULTS := ../onlp-platform-defaults/$(BUILD_DIR)/bin/libonlp-platform-defaults.so +#LIBONLP_PLATFORM := ../onlp-platform/$(BUILD_DIR)/bin/libonlp-platform.so +LIBONLP := $(shell $(ONLPM) --find-file onlp:$(ARCH) libonlp.so) include $(BUILDER)/dependmodules.mk @@ -44,7 +47,7 @@ GLOBAL_CFLAGS += -DONLP_CONFIG_API_LOCK_GLOBAL_SHARED=1 GLOBAL_CFLAGS += -DONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT=1 GLOBAL_CFLAGS += -fPIC -GLOBAL_LINK_LIBS += -lpthread $(LIBONLP_PLATFORM) $(LIBONLP_PLATFORM_DEFAULTS) +GLOBAL_LINK_LIBS += -lpthread $(LIBONLP) include $(BUILDER)/targets.mk diff --git a/packages/base/any/oom-shim/src/module/inc/oom_shim/oom-shim.h b/packages/base/any/oom-shim/src/module/inc/oom_shim/oom-shim.h deleted file mode 100644 index e69de29b..00000000 diff --git a/packages/base/any/oom-shim/src/module/src/Makefile b/packages/base/any/oom-shim/src/module/src/Makefile new file mode 100644 index 00000000..87a73132 --- /dev/null +++ b/packages/base/any/oom-shim/src/module/src/Makefile @@ -0,0 +1,30 @@ +############################################################ +# +# +# 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. +# +# +############################################################ +# +# Local source generation targets. +# +############################################################ + +include ../../../../init.mk + +ucli: + $(SUBMODULE_BIGCODE)/tools/uclihandlers.py onlpie_ucli.c + diff --git a/packages/base/any/oom-shim/src/oom_shim.mk b/packages/base/any/oom-shim/src/oom_shim.mk index dde86cf9..106445d0 100644 --- a/packages/base/any/oom-shim/src/oom_shim.mk +++ b/packages/base/any/oom-shim/src/oom_shim.mk @@ -1,12 +1,14 @@ ############################################################################### # -# Inclusive Makefile for the oom-shim module. +# Inclusive Makefile for the oom_shim module. # -# Autogenerated 2016-02-12 16:50:50.721882 +# Autogenerated 2016-02-16 12:05:28.510482 # ############################################################################### -oom-shim_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) -include $(oom-shim_BASEDIR)/module/make.mk -include $(oom-shim_BASEDIR)/utest/_make.mk +oom_shim_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +include $(oom_shim_BASEDIR)/module/make.mk +include $(oom_shim_BASEDIR)/module/auto/make.mk +include $(oom_shim_BASEDIR)/module/src/make.mk +include $(oom_shim_BASEDIR)/utest/_make.mk diff --git a/packages/base/powerpc/oom-shim/Makefile b/packages/base/powerpc/oom-shim/Makefile new file mode 100644 index 00000000..dc1e7b86 --- /dev/null +++ b/packages/base/powerpc/oom-shim/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk diff --git a/packages/base/powerpc/oom-shim/PKG.yml b/packages/base/powerpc/oom-shim/PKG.yml new file mode 100644 index 00000000..9fe09577 --- /dev/null +++ b/packages/base/powerpc/oom-shim/PKG.yml @@ -0,0 +1,2 @@ +!include $ONL/packages/base/any/oom-shim/APKG.yml ARCH=powerpc TOOLCHAIN=powerpc-linux-gnu + diff --git a/packages/base/powerpc/oom-shim/builds/Makefile b/packages/base/powerpc/oom-shim/builds/Makefile new file mode 100644 index 00000000..ee3b6e85 --- /dev/null +++ b/packages/base/powerpc/oom-shim/builds/Makefile @@ -0,0 +1,3 @@ +include $(ONL)/make/config.powerpc.mk +include $(ONL)/packages/base/any/oom-shim/builds/Makefile + diff --git a/packages/base/powerpc/oom-shim/builds/oom-shim.mk b/packages/base/powerpc/oom-shim/builds/oom-shim.mk new file mode 100644 index 00000000..4815edcf --- /dev/null +++ b/packages/base/powerpc/oom-shim/builds/oom-shim.mk @@ -0,0 +1,10 @@ + +############################################################################### +# +# Inclusive Makefile for the oom-shim module. +# +# Autogenerated 2016-02-15 20:59:29.632190 +# +############################################################################### +oom-shim_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) + From 8748ee2f4f8915fd2b6c2668da0b1147b77893a3 Mon Sep 17 00:00:00 2001 From: Rohit Malaga Date: Tue, 16 Feb 2016 06:23:06 -0800 Subject: [PATCH 32/55] Adding Powerpc minor changes --- .../base/amd64/oom-shim/builds/oom_shim.mk | 2 +- .../base/any/oom-shim/src/module/src/make.mk | 29 +++++++++++++++++++ .../builds/{oom-shim.mk => oom_shim.mk} | 6 ++-- 3 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 packages/base/any/oom-shim/src/module/src/make.mk rename packages/base/powerpc/oom-shim/builds/{oom-shim.mk => oom_shim.mk} (52%) diff --git a/packages/base/amd64/oom-shim/builds/oom_shim.mk b/packages/base/amd64/oom-shim/builds/oom_shim.mk index 88c00283..c119b5fc 100644 --- a/packages/base/amd64/oom-shim/builds/oom_shim.mk +++ b/packages/base/amd64/oom-shim/builds/oom_shim.mk @@ -3,7 +3,7 @@ # # Inclusive Makefile for the oom_shim module. # -# Autogenerated 2016-02-12 17:14:48.789289 +# Autogenerated 2016-02-16 14:17:39.946619 # ############################################################################### oom_shim_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) diff --git a/packages/base/any/oom-shim/src/module/src/make.mk b/packages/base/any/oom-shim/src/module/src/make.mk new file mode 100644 index 00000000..973f1ce3 --- /dev/null +++ b/packages/base/any/oom-shim/src/module/src/make.mk @@ -0,0 +1,29 @@ +############################################################ +# +# +# 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. +# +# +############################################################ +# +# +# +############################################################ + +LIBRARY := oom_shim +$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST))) +#$(LIBRARY)_LAST := 1 +include $(BUILDER)/lib.mk diff --git a/packages/base/powerpc/oom-shim/builds/oom-shim.mk b/packages/base/powerpc/oom-shim/builds/oom_shim.mk similarity index 52% rename from packages/base/powerpc/oom-shim/builds/oom-shim.mk rename to packages/base/powerpc/oom-shim/builds/oom_shim.mk index 4815edcf..04cfe7c1 100644 --- a/packages/base/powerpc/oom-shim/builds/oom-shim.mk +++ b/packages/base/powerpc/oom-shim/builds/oom_shim.mk @@ -1,10 +1,10 @@ ############################################################################### # -# Inclusive Makefile for the oom-shim module. +# Inclusive Makefile for the oom_shim module. # -# Autogenerated 2016-02-15 20:59:29.632190 +# Autogenerated 2016-02-16 14:18:46.799062 # ############################################################################### -oom-shim_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +oom_shim_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) From b13e14d6e4c51b5810d0f90d40b79ddbeabc2df5 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Tue, 16 Feb 2016 13:25:03 -0800 Subject: [PATCH 33/55] updated onlbuilder7/8 to v1.1 adding new programs --- docker/images/builder7/1.1/Dockerfile | 12 ++++++++++++ docker/images/builder7/1.1/Makefile | 20 ++++++++++++++++++++ docker/images/builder8/1.1/Dockerfile | 12 ++++++++++++ docker/images/builder8/1.1/Makefile | 19 +++++++++++++++++++ docker/tools/onlbuilder | 4 ++-- 5 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 docker/images/builder7/1.1/Dockerfile create mode 100644 docker/images/builder7/1.1/Makefile create mode 100644 docker/images/builder8/1.1/Dockerfile create mode 100644 docker/images/builder8/1.1/Makefile diff --git a/docker/images/builder7/1.1/Dockerfile b/docker/images/builder7/1.1/Dockerfile new file mode 100644 index 00000000..e3813a49 --- /dev/null +++ b/docker/images/builder7/1.1/Dockerfile @@ -0,0 +1,12 @@ +FROM opennetworklinux/builder7:1.0 +MAINTAINER Rob Sherwood + +RUN apt-get update && apt-get install -y \ + libpcap-dev \ + telnet \ + gdb +# +# Docker shell and other container tools. +# +COPY docker_shell /bin/docker_shell +COPY container-id /bin/container-id diff --git a/docker/images/builder7/1.1/Makefile b/docker/images/builder7/1.1/Makefile new file mode 100644 index 00000000..df7a8449 --- /dev/null +++ b/docker/images/builder7/1.1/Makefile @@ -0,0 +1,20 @@ +VERSION=1.1 +USER=opennetworklinux +REPO=builder7 + +TOOLS=../../../tools/docker_shell ../../../tools/container-id + +build: check_version + cp $(TOOLS) . + docker build -t $(USER)/$(REPO):$(VERSION) . + rm -rf $(notdir $(TOOLS)) + +# +# Todo: Query remote repository to see if the request version already exists to avoid accidental overwrites +# when a new image is built but the VERSION variable is not updated. +# +check_version: + + +push: + docker push $(USER)/$(REPO):$(VERSION) diff --git a/docker/images/builder8/1.1/Dockerfile b/docker/images/builder8/1.1/Dockerfile new file mode 100644 index 00000000..69fea361 --- /dev/null +++ b/docker/images/builder8/1.1/Dockerfile @@ -0,0 +1,12 @@ +FROM opennetworklinux/builder8:1.0 +MAINTAINER Rob Sherwood + +RUN apt-get update && apt-get install -y \ + libpcap-dev \ + telnet \ + gdb +# +# Docker shell and other container tools. +# +COPY docker_shell /bin/docker_shell +COPY container-id /bin/container-id diff --git a/docker/images/builder8/1.1/Makefile b/docker/images/builder8/1.1/Makefile new file mode 100644 index 00000000..7b0835d2 --- /dev/null +++ b/docker/images/builder8/1.1/Makefile @@ -0,0 +1,19 @@ +VERSION=1.1 +USER=opennetworklinux +REPO=builder8 + +TOOLS=../../../tools/docker_shell ../../../tools/container-id + +build: check_version + cp $(TOOLS) . + docker build -t $(USER)/$(REPO):$(VERSION) . + rm -rf $(notdir $(TOOLS)) + +# +# Todo: Query remote repository to see if the request version already exists to avoid accidental overwrites +# when a new image is built but the VERSION variable is not updated. +# +check_version: + +push: + docker push $(USER)/$(REPO):$(VERSION) diff --git a/docker/tools/onlbuilder b/docker/tools/onlbuilder index 04ec4ae4..1795fdfc 100755 --- a/docker/tools/onlbuilder +++ b/docker/tools/onlbuilder @@ -17,8 +17,8 @@ g_current_user = getpass.getuser() g_current_uid = os.getuid() g_timestamp = datetime.datetime.now().strftime("%Y-%m-%d.%H%M%S") -g_builder7_image_name="opennetworklinux/builder7:1.0" -g_builder8_image_name="opennetworklinux/builder8:1.0" +g_builder7_image_name="opennetworklinux/builder7:1.1" +g_builder8_image_name="opennetworklinux/builder8:1.1" g_default_image_name=g_builder7_image_name g_default_container_name = "%s_%s" % (g_current_user, g_timestamp) From 2e225f1533b2e86e9dde11261ba154557312a376 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 17 Feb 2016 17:23:03 +0000 Subject: [PATCH 34/55] Bump version. --- docker/tools/PKG.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/tools/PKG.yml b/docker/tools/PKG.yml index 9ad2770d..1c6f35a8 100644 --- a/docker/tools/PKG.yml +++ b/docker/tools/PKG.yml @@ -1,6 +1,6 @@ common: arch: all - version: 1.0.0 + version: 1.1.0 copyright: Copyright 2013, 2014, 2015 Big Switch Networks maintainer: support@bigswitch.com From 2c1b790aaee3651c1c05d6753bfc2037c18cdd62 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 17 Feb 2016 09:27:58 -0800 Subject: [PATCH 35/55] Mount the current working directory in addition to $HOME by default. Previously only $HOME was mounted in developer mode. Now $HOME and $CWD are both mounted for convenience. This can be disabled using the --no-mount-current option. --- docker/tools/onlbuilder | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docker/tools/onlbuilder b/docker/tools/onlbuilder index 1795fdfc..4f963519 100755 --- a/docker/tools/onlbuilder +++ b/docker/tools/onlbuilder @@ -96,6 +96,10 @@ ap.add_argument("--volumes", metavar='DIRECTORY', default=[]) +ap.add_argument("--no-mount-current", + help="Do not mount the current working directory. The default is the current working directory and $HOME", + action='store_true') + ap.add_argument("--autobuild", help="Automatic build in isolation mode.", action='store_true') @@ -159,6 +163,11 @@ if ops.exec_: else: ops.volumes += [ '/lib/modules' ] + + if not ops.no_mount_current: + # Add the current working directory to the volume list. + ops.volumes.append(os.getcwd()) + g_arg_d['volume_options'] = " ".join( [ " -v %s:%s " % (v, v) for v in ops.volumes ] ) g_docker_arguments = "docker run --privileged %(interactive)s -t -e DOCKER_IMAGE=%(image)s --name %(name)s %(ssh_options)s %(volume_options)s " % g_arg_d From bd9d9c8b21dfcd1e6597e42c99451c6dbdbd2549 Mon Sep 17 00:00:00 2001 From: Rob Sherwood Date: Fri, 19 Feb 2016 03:03:33 -0800 Subject: [PATCH 36/55] OOM-SHIM: Read page A2 from dom For OOM OCP demo. --- .../any/oom-shim/src/module/src/oom_shim.c | 31 ++++++++++--------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/packages/base/any/oom-shim/src/module/src/oom_shim.c b/packages/base/any/oom-shim/src/module/src/oom_shim.c index c997aadc..0c4ac7a4 100644 --- a/packages/base/any/oom-shim/src/module/src/oom_shim.c +++ b/packages/base/any/oom-shim/src/module/src/oom_shim.c @@ -85,34 +85,35 @@ int oom_get_portlist(oom_port_t portlist[], int listsize){ int oom_get_memory_sff(oom_port_t* port, int address, int page, int offset, int len, uint8_t* data){ - int rv,cur_offset; + int rv; unsigned int port_num; uint8_t* idprom = NULL; port_num = (unsigned int)(uintptr_t)port->handle; port_num -= 1; - rv = onlp_sfp_eeprom_read(port_num, &idprom);/*place holder implementation until onlp_sfp_eeprom_read() can be improved to handle subpages*/ - if(rv < 0) { - aim_printf(&aim_pvs_stdout, "Error reading eeprom: %{onlp_status}\n"); - return -1; - } -#if SFF_EEPROM_DATA_DEBUG == 1 - aim_printf(&aim_pvs_stdout, "eeprom:\n%{data}\n", idprom, 256);/*print the hex data for debugging purpose*/ -#endif + if (offset >= 256) + return -1; /* out of range */ + + /** + * place holder implementation until onlp_sfp_eeprom_read() + * can be improved to handle partial page gets + **/ if (address == 0xa0) { - cur_offset = SFF_A0_BASE; + rv = onlp_sfp_eeprom_read(port_num, &idprom); } else if (address == 0xa2) { - cur_offset = SFF_A2_BASE; + rv = onlp_sfp_dom_read(port_num, &idprom); } else { aim_printf(&aim_pvs_stdout, "Error invalid address: 0x%02x\n", address); return -EINVAL; } - cur_offset += page * 128; - cur_offset += offset; - - memcpy(data, &idprom[cur_offset], len); + + if(rv < 0) { + aim_printf(&aim_pvs_stdout, "Error reading eeprom: %{onlp_status}\n"); + return -1; + } + memcpy(data, &idprom[offset], len); aim_free(idprom); return 0; From a1abf8c36c5f5dbe99c9d0f9c2764d34803f26f6 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Fri, 19 Feb 2016 15:33:35 -0800 Subject: [PATCH 37/55] Updated HCL, Building and Porting Guide --- docs/Building.md | 84 +++++++++++++++++++++++++++++++++++++++ docs/PortingGuide.md | 7 ++-- docs/SupportedHardware.md | 74 +++++++++++++++++++++++----------- 3 files changed, 138 insertions(+), 27 deletions(-) diff --git a/docs/Building.md b/docs/Building.md index abe095d7..e66ab7ad 100644 --- a/docs/Building.md +++ b/docs/Building.md @@ -42,6 +42,7 @@ If you would like to build by hand you can do the following: #> git clone https://github.com/opencomputeproject/OpenNetworkLinux #> cd OpenNetworkLinux #> docker/tools/onlbuilder (-8) # enter the docker workspace + #> apt-cacher-ng #> source setup.env # pull in necessary environment variables #> make amd64 ppc # make onl for $platform (currently amd64 or powerpc) @@ -127,3 +128,86 @@ This installer image can be served to ONIE on Quanta or Accton platforms: #> ls *INSTALLER ONL-2.0.0_ONL-OS_2015-12-12.0252-ffce159_PPC_INSTALLER #> + +Example setup on new Debian 8.2 installation +------------------------------------------------------------ +Install sudo and add yourself to the sudoers: + +As root: + +apt-get install sudo + +vi /etc/sudoers.d/username + +Add the line: + +username ALL=(ALL:ALL) ALL + +Add the docker key: + +sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D + +gpg: key 2C52609D: public key "Docker Release Tool (releasedocker) " imported +gpg: Total number processed: 1 +gpg: imported: 1 (RSA: 1) + +Install necessary items, make, binfmt-support and apt-transport-https (for docker): + +sudo apt-get install apt-transport-https make binfmt-support + +Add the docker repository to your system: + +sudo vi /etc/apt/sources.list.d/docker.list + +Add the following line to the file: + +deb https://apt.dockerproject.org/repo debian-jessie main + +Install Docker: + +sudo apt-get update + +sudo apt-get install docker-engine + +Test Docker: + +sudo docker run hello-world + +Unable to find image 'hello-world:latest' locally +latest: Pulling from library/hello-world +b901d36b6f2f: Pull complete +0a6ba66e537a: Pull complete +Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7 +Status: Downloaded newer image for hello-world:latest + +Hello from Docker. +This message shows that your installation appears to be working correctly. + +Add yourself to the docker group: + +sudo gpasswd -a snoble docker + +Adding user snoble to group docker + +logout and log back in for the group to take effect: + +Clone the OpenNetworkLinux repository: + +git clone https://github.com/opencomputeproject/OpenNetworkLinux.git + +Cloning into 'OpenNetworkLinux'... +Checking connectivity... done. + +Build OpenNetworkLinux: + + #> cd OpenNetworkLinux/ + #> make docker + #> Pulling opennetworklinux/builder7:1.0… + +Or: + + #> docker/tools/onlbuilder + #> source setup.env + #> apt-cacher-ng + #> make onl-x86 onl-ppc + diff --git a/docs/PortingGuide.md b/docs/PortingGuide.md index 5d62a084..f1a65ae5 100644 --- a/docs/PortingGuide.md +++ b/docs/PortingGuide.md @@ -5,9 +5,10 @@ Open Network Linux has a number of internal APIs to simplify porting to new hardware. To support a new switch/device, there are three large software components -that need device-specific drivers: +that need device-specific drivers (information only known by the manufacturer +of the switch/device): -1. The ONL/ONIE installer -- how to actually install and boot ONL using ONIE +1. The ONL/ONIE installer -- how to install and boot ONL using ONIE 2. The ONLP platform drivers -- how to manage hardware once ONL is running 3. Any packet forwarding device specific settings (e.g., front panel port mappings, pre-emphesis settings) @@ -69,7 +70,7 @@ directory structure for the installer driver is as follows: # specific ONL OS abstractions (see below) ./$platform/$release/src/lib/install/$platform.sh # Script called from installer.sh to partition # and install ONL and setup boot params (see below) - ./$platform/src/python/$plaform/__init__.py # Platform specific python library (see below) + ./$platform/src/python/$platform/__init__.py # Platform specific python library (see below) ONL Installer src/boot drivers ------------------------------ diff --git a/docs/SupportedHardware.md b/docs/SupportedHardware.md index 9a4f9752..c8bdbbfd 100644 --- a/docs/SupportedHardware.md +++ b/docs/SupportedHardware.md @@ -9,13 +9,12 @@ Quanta - + - - - - - + + + +
Device Ports CPU Forwarding Support Status
Device Ports CPU Forwarding ONL Certified In Lab ORC OF-DPA OpenNSL SAI
QuantaMesh T1048-LB9 48x1G + 4x10G FreeScale P2020 Broadcom BCM56534 (Firebolt3) Supported and Tested
QuantaMesh T1048-LB9A 48x1G + 4x10G FreeScale P2020 Broadcom BCM56534 (Firebolt3) Supported, no ONIE, not regularly tested
QuantaMesh T3048-LY2 48x10G + 4x40G FreeScale P2020 Broadcom BCM56846 (Trident+) Supported and Tested
QuantaMesh T3048-LY8 48x10G + 6x40G Intel Rangely C2758 x86 Broadcom BCM56854 (Trident2) Supported and run in the lab
QuantaMesh T5032-LY6 32x40G Intel Rangely C2758 x86 Broadcom BCM56850 (Trident2) Supported and run in the lab
QuantaMesh T1048-LB9 48x1G + 4x10G FreeScale P2020 Broadcom BCM56534 (Firebolt3) Yes Yes Yes Yes No No
QuantaMesh T3048-LY2 48x10G + 4x40G FreeScale P2020 Broadcom BCM56846 (Trident+) Yes Yes Yes Yes No No
QuantaMesh T3048-LY8 48x10G + 6x40G Intel Rangely C2758 x86 Broadcom BCM56854 (Trident2) Yes* No No No No No
QuantaMesh T5032-LY6 32x40G Intel Rangely C2758 x86 Broadcom BCM56850 (Trident2) Yes* No No No No No
@@ -24,18 +23,20 @@ Accton/Edge-Core - + - - - - - - - - - - + + + + + + + + + + + +
Device Ports CPU Forwarding Support Status
Device Ports CPU Forwarding ONL Certified In Lab ORC OF-DPA OpenNSL SAI
Accton AS4600-54T 48x1G + 4x10G FreeScale P2020 Broadcom BCM56540 (Apollo2) Supported and Tested
Accton AS5600-52X 48x10G + 4x40G FreeScale P2020 Broadcom BCM56846 (Trident+) Supported and Tested
Accton AS5610-52X 48x10G + 4x40G FreeScale P2020 Broadcom BCM56846 (Trident+) Supported and Tested
Accton AS5710-54X 48x10G + 6x40G FreeScale P2041 Broadcom BCM56854 (Trident2) Supported and Tested
Accton AS6700-32X 32x40G FreeScale P2041 Broadcom BCM56850 (Trident2) Supported and Tested
Accton AS5712-54X 48x10G + 6x40G Intel Rangely C2538 x86 Broadcom BCM56854 (Trident2) Supported and Tested
Accton AS6712-32X 32x40G Intel Rangely C2538 x86 Broadcom BCM56850 (Trident2) Supported and Tested
Accton AS5812-54T 48x10G + 6x40G Intel Rangely C2538 x86 Broadcom BCM56864 (Trident2+) Supported
Accton AS5812-54X 48x10G + 6x40G Intel Rangely C2538 x86 Broadcom BCM56864 (Trident2+) Supported
Accton AS6812-32X 32x40G Intel Rangely C2538 x86 Broadcom BCM56864 (Trident2+) Supported
Accton AS4600-54T 48x1G + 4x10G FreeScale P2020 Broadcom BCM56540 (Apollo2) Yes Yes Yes Yes No No
Accton AS5600-52X 48x10G + 4x40G FreeScale P2020 Broadcom BCM56846 (Trident+) Yes Yes Yes Yes No No
Accton AS5610-52X 48x10G + 4x40G FreeScale P2020 Broadcom BCM56846 (Trident+) Yes Yes Yes Yes No No
Accton AS5710-54X 48x10G + 6x40G FreeScale P2041 Broadcom BCM56854 (Trident2) Yes Yes Yes Yes No No
Accton AS6700-32X 32x40G FreeScale P2041 Broadcom BCM56850 (Trident2) Yes Yes Yes Yes No No
Accton AS5712-54X 48x10G + 6x40G Intel Rangely C2538 x86 Broadcom BCM56854 (Trident2) Yes Yes Yes No No No
Accton AS6712-32X 32x40G Intel Rangely C2538 x86 Broadcom BCM56850 (Trident2) Yes Yes Yes No No No
Accton AS5812-54T 48x10G + 6x40G Intel Rangely C2538 x86 Broadcom BCM56864 (Trident2+) Yes Yes No No No No
Accton AS5812-54X 48x10G + 6x40G Intel Rangely C2538 x86 Broadcom BCM56864 (Trident2+) Yes Yes No No No No
Accton AS6812-32X 32x40G Intel Rangely C2538 x86 Broadcom BCM56864 (Trident2+) Yes Yes No No No No
Accton AS7712-32X 32x100G Intel Rangely C2538 x86 Broadcom BCM56960 (Tomahawk) Yes Yes Yes No No No
Accton Wedge-16X 16x40G Intel Rangely C2550 x86 Broadcom BCM56864 (Trident2+) Work In Progress** Yes No No Yes No
DNI/Agema @@ -43,9 +44,9 @@ DNI/Agema - + - +
Device Ports CPU Forwarding Support Status
Device Ports CPU Forwarding ONL Certified In Lab ORC OF-DPA OpenNSL SAI
AG-7448CU 48x10G + 4x40G FreeScale P2020 Broadcom BCM56845 (Trident) Supported and Tested
AG-7448CU 48x10G + 4x40G FreeScale P2020 Broadcom BCM56845 (Trident) Yes Yes Yes No No No
Dell @@ -53,10 +54,35 @@ Dell - + - - - - + + + +
Device Ports CPU Forwarding Support Status
Device Ports CPU Forwarding ONL Certified In Lab ORC OF-DPA OpenNSL SAI
S4810-ON 48x10G + 4x40G FreeScale P2020 Broadcom BCM56845 (Trident) Supported and Tested
S4048-ON 48x10G + 6x40G Intel Atom C2338 Broadcom BCM56854 (Trident2) Supported and Tested
S6000-ON 32x40G Intel Atom S1220 Broadcom BCM56850 (Trident2) Supported and Tested
S4810-ON 48x10G + 4x40G FreeScale P2020 Broadcom BCM56845 (Trident) Yes Yes Yes No No No
S4048-ON 48x10G + 6x40G Intel Atom C2338 Broadcom BCM56854 (Trident2) Yes Yes Yes No No No
S6000-ON 32x40G Intel Atom S1220 Broadcom BCM56850 (Trident2) Yes Yes Yes No No No
z9100-ON 32x100G Intel Broadcom BCM56960 (Tomahawk) Yes Yes No No No No
+ +Interface Masters Technologies, Inc. +--- + + + + + + + + + + +
Device Ports CPU Forwarding ONL Certified In Lab ORC OF-DPA OpenNSL SAI
Niagara 2948X12XLm 48x10G + 12x40G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** No No Yes*** No No
Niagara 2960X6XLm 60x10G + 6x40G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** No No Yes*** No No
Niagara 2972Xm 72x10G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** Yes No Yes*** No No
Niagara 2932XL 32x40G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** No No Yes*** No No
Niagara 2948X6XL 48x10G + 6x40G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** No No Yes*** No No
+ +Notes: +--- + +ONL Certified means that the system runs ONIE, is able to install a generic version of ONL and has the ONL Platform drivers necessary to manage the system. + +\* Systems no longer in the lab cannot be certified post removal + +\** Developing ONL Platform Drivers + +\*** Vendor provided From bdd89e40d0bec35655f44221e5d580ed63f3a971 Mon Sep 17 00:00:00 2001 From: Rob Sherwood Date: Fri, 19 Feb 2016 21:09:47 -0800 Subject: [PATCH 38/55] oom-shim: commented out stray debug statement --- packages/base/any/oom-shim/src/module/src/oom_shim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/base/any/oom-shim/src/module/src/oom_shim.c b/packages/base/any/oom-shim/src/module/src/oom_shim.c index 0c4ac7a4..b2d5be61 100644 --- a/packages/base/any/oom-shim/src/module/src/oom_shim.c +++ b/packages/base/any/oom-shim/src/module/src/oom_shim.c @@ -69,7 +69,7 @@ int oom_get_portlist(oom_port_t portlist[], int listsize){ rv = onlp_sfp_is_present(port); if(rv == 0){ - aim_printf(&aim_pvs_stdout, "module %d is not present\n", port); + /* aim_printf(&aim_pvs_stdout, "module %d is not present\n", port);*/ pptr->oom_class = OOM_PORT_CLASS_UNKNOWN; continue; } From 073eb6c7fd0737f8205549ee626aa4a81e3b6f60 Mon Sep 17 00:00:00 2001 From: Rohit Malaga Date: Sat, 20 Feb 2016 07:10:12 -0800 Subject: [PATCH 39/55] oom-shim get portlist --- .../src/module/inc/oom-shim/oom-shim.h | 1 + .../src/module/inc/oom-shim/oom_south.h | 230 ++++++++++++++++++ .../base/any/oom-shim/src/module/src/Makefile | 2 +- .../any/oom-shim/src/module/src/oom_shim.c | 101 +++++++- 4 files changed, 330 insertions(+), 4 deletions(-) create mode 100644 packages/base/any/oom-shim/src/module/inc/oom-shim/oom_south.h diff --git a/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h b/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h index e69de29b..0925b787 100644 --- a/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h +++ b/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h @@ -0,0 +1 @@ +#define MAXPORTS 6 diff --git a/packages/base/any/oom-shim/src/module/inc/oom-shim/oom_south.h b/packages/base/any/oom-shim/src/module/inc/oom-shim/oom_south.h new file mode 100644 index 00000000..fef10e0c --- /dev/null +++ b/packages/base/any/oom-shim/src/module/inc/oom-shim/oom_south.h @@ -0,0 +1,230 @@ +/****************************** +* +* Southbound API definition for +* Open Optical Monitoring (OOM) initiative under the +* umbrella of OCP. +* +* Copyright 2015 Finisar Inc. +* +* LIKELY TO CHANGE, no promises of compatibility with future +* versions is made or implied +* +* Version: 0.4, January 28, 2016 (added oom_get_port(n)) +* Author: Don Bollinger +* +*******************************/ + +#include + +/* Discovery definitions */ + +/* + * list of valid port types + * Values are from SFF-8436 spec (rev 4.8, page 74) + * note OOM_PORT_TYPE_NOT_PRESENT to indicate no + * module is present in this port + */ + +typedef enum oom_port_class_e { + OOM_PORT_CLASS_UNKNOWN = 0x00, + OOM_PORT_CLASS_SFF = 0x01, + OOM_PORT_CLASS_CFP = 0x02, +} oom_port_class_t; + + +/* Define the elements of a port + * Note: seq_num is an implementation defined magic + * number to detect that the module + * on this port has been removed/inserted since this + * port was last accessed + * port_flags is implementation dependent, for use + * by the underlying NOS and switch + * port_flags should NOT be used or modified by the + * decode layer or above + */ +typedef struct oom_port_s { + void *handle; /* opaque handle for this port */ + oom_port_class_t oom_class; /* class is SFF or CFP */ + char name[32]; /* 32 bytes for a human readable name */ +} oom_port_t; + + +/* + * get the list of available ports, as an array + * of oom_port_t structs. 'listsize' indicates the + * number of ports that will fit in the portlist[] array. + * + * If there are listsize or fewer ports, and the portlist[] + * array is new or out of date, then the shim populates + * the portlist structure, and returns 0 (success). + * + * If the portlist structure is already current, then the + * shim does not modify portlist[], and returns 1 (no change). + * This is intended as a way to poll for changes to the ports + * (eg modules added, deleted, replaced, etc) + * + * If there are more than listize ports, the shim + * returns -ENOMEM, to indicate that a larger portlist[] + * array is required. + * + * If called as oom_get_portlist(NULL, 0), then the shim will + * return the number of ports, ie the minimum value of listsize. Note + * that some implementations can dynamically add ports, so the return + * value is a very good hint, but not a guarantee as to the required + * size of the portlist[] structure. + */ +int oom_get_portlist(oom_port_t portlist[], int listsize); + + +/* Read/write control "PINS" function definitions */ + +/* note that these 'control pins' functions are in limbo right + * now, and may not be implemented until later, if at all. + * Developers of "southbound shims" may choose to delay + * implementation of oom_{get, set}_function() + */ + +/* list of functions that can be controlled */ +typedef enum oom_functions_e { + OOM_FUNCTIONS_TX_FAULT, + OOM_FUNCTIONS_TX_DISABLE, + OOM_FUNCTIONS_MODULE_ABSENT, + OOM_FUNCTIONS_RS0, + OOM_FUNCTIONS_RS1, + /* more control functions to be defined here */ + OOM_FUNCTIONS_RXLOSS_OF_SIG, + OOM_FUNCTIONS_LAST = OOM_FUNCTIONS_RXLOSS_OF_SIG, + OOM_FUNCTIONS_COUNT, + OOM_FUNCTIONS_INVALID = -1, +} oom_functions_t; + +/* + * read a function + * rv will be 1 for asserted or enabled, 0 if not + * returns 0 on success, or negative error code + */ +int oom_get_function(oom_port_t* port, oom_functions_t function, int* rv); + +/* + * write a function + * value should be 1 for asserted or enabled, 0 if not + * returns 0 on success, or negative error code + */ +int oom_set_function(oom_port_t* port, oom_functions_t function, int value); + + +/* Read/write EEPROM definitions */ + +/* + * read EEPROM + * address: the 2-wire (i2c) address, per the SFF specs, + * eg A0h, A2h, A8h, etc. (160, 162, 168 respectively.) + * Note that this address points to 256 bytes of data. + * Bytes 0-127 are intrinsic to this address space. + * Bytes 128-255 are the contents of the "page" selected + * in byte 127. (The page select byte will be written by + * the driver as part of this call. DO NOT explicitly + * set byte 127 to select a page.) + * Thus there are 256 pages (based on one + * byte of page select in byte 127). ONE of these pages + * can be accessed in an EEPROM read, and the content + * of that page will be at offset 128-255 of the address + * space. Page contents starts at offset=128. It is NOT + * necessary to read the first 128 bytes of the address + * space to access the page contents in the second 128 + * bytes. See the specs for a further description of + * this access architecture, and the content of each page. + * Note: Bytes 0-127 do not depend on the value of page. + * Reading 256 bytes, starting at offset 0, will read both + * the lower half of the address space, AND the page selected. + * page: page of EEPROM to read from + * offset: byte location within the address space to begin + * transferring data from. Remember, offset 0-127 reference + * the first 128 bytes of "address" range. Their contents + * do not depend on the value of page. Page content begins + * at offset=128. + * len: the number of bytes to be read + * note that (offset + len) must be no more than 256, as + * there are only 256 bytes of data available at A0, A2, etc + * data: receives the memory contents + * returns: the number of bytes read, or a + * negative error code + */ +int oom_get_memory_sff(oom_port_t* port, int address, int page, int offset, int len, uint8_t* data); + + +/* + * write EEPROM + * address: the 2-wire (i2c) address, per the SFF specs, + * eg A0h, A2h, A8h, etc. (160, 162, 168 respectively.) + * Note that this address points to 256 bytes of data. + * Bytes 0-127 are intrinsic to this address space. + * Bytes 128-255 are the contents of the "page" selected + * in byte 127. (The page select byte will be written by + * the driver as part of this call. DO NOT explicitly + * set byte 127 to select a page.) + * Thus there are 256 pages (based on one + * byte of page select in byte 127). ONE of these pages + * can be accessed in an EEPROM write, and data written + * to that page must be written to offset 128-255 of the + * address space. + * Page contents starts at offset=128. It is NOT + * necessary to write the first 128 bytes of the address + * space to access the page contents in the second 128 + * bytes. See the specs for a further description of + * this access architecture, and the content of each page. + * Note: Writes to bytes 0-127 will go to the lower half + * of the address space, and do not depend on the + * value of page. Writing 256 bytes, starting at offset 0, + * will write both the lower half of the address space AND + * the page selected. + * page: page of EEPROM to write to + * offset: byte location within the address space to begin + * transferring data from. Remember, offset 0-127 reference + * the first 128 bytes of "address" range. Their contents + * do not depend on the value of page. Page content begins + * at offset=128. + * len: the number of bytes to be written + * note that (offset + len) must be no more than 256, as + * there are only 256 bytes of address space at A0, A2, etc + * data: data to be written to memory + * returns: the number of bytes written, or a + * negative error code + */ +int oom_set_memory_sff(oom_port_t* port, int address, int page, int offset, int len, uint8_t* data); + +/* + * read 16 bit oriented EEPROM + * CFP modules (for example) do not use 2-wire (i2c) addresses + * nor do they use the page table scheme of SFP, XFP, QSFP, etc + * their EEPROM is addressed in 16 bit words, in a 32K word + * linear address space from 8000hex to FFFFhex + * (0000-7FFF are reserved for IEEE 802.3 use) + * the interface below is for these types of modules + * port: an OOM port structure + * address: address between 0x8000 and 0xFFFF to begin read + * Each consecutive address is a 16 bit "register" + * (not an 8 bit byte) + * len: number of 16 bit "registers" to read + * data: receives the memory contents + * returns the number of words read, or a negative error code + */ +int oom_get_memory_cfp(oom_port_t* port, int address, int len, uint16_t* data); + +/* + * write 16 bit oriented EEPROM + * CFP modules (for example) do not use 2-wire (i2c) addresses + * nor do they use the page table scheme of SFP, XFP, QSFP, etc + * their EEPROM is addressed in 16 bit words, in a 32K word + * linear address space from 8000hex to FFFFhex + * (0000-7FFF are reserved for IEEE 802.3 use) + * the interface below is for these types of modules + * port: an OOM port structure + * address: address between 0x8000 and 0xFFFF to begin write + * Each consecutive address is a 16 bit "register" + * (not an 8 bit byte) + * len: number of 16 bit "registers" to write + * data: data to be written to memory + * returns the number of words written, or a negative error code + */ +int oom_set_memory_cfp(oom_port_t* port, int address, int len, uint16_t* data); diff --git a/packages/base/any/oom-shim/src/module/src/Makefile b/packages/base/any/oom-shim/src/module/src/Makefile index 87a73132..1259eda6 100644 --- a/packages/base/any/oom-shim/src/module/src/Makefile +++ b/packages/base/any/oom-shim/src/module/src/Makefile @@ -26,5 +26,5 @@ include ../../../../init.mk ucli: - $(SUBMODULE_BIGCODE)/tools/uclihandlers.py onlpie_ucli.c + $(SUBMODULE_BIGCODE)/tools/uclihandlers.py oom_shim_ucli.c diff --git a/packages/base/any/oom-shim/src/module/src/oom_shim.c b/packages/base/any/oom-shim/src/module/src/oom_shim.c index 5e866c30..535a8a85 100644 --- a/packages/base/any/oom-shim/src/module/src/oom_shim.c +++ b/packages/base/any/oom-shim/src/module/src/oom_shim.c @@ -1,7 +1,102 @@ +/************************************************************ + * + * + * Copyright 2016 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. + * + * + ************************************************************ + * + * + * + ***********************************************************/ #include +#include +#include +#include +#include +#include +#include +#include -int test_func(int argc) -{ +int Initialized = 0; - printf("Looks like it works...\n"); +/*Initializing the SFP and ONLP modules*/ +void __oom_shim_module_init__(void) { + onlp_init(); + Initialized = 1; +} + +/*Gets the portlist of the SFP ports on the switch*/ +int oom_get_portlist(oom_port_t portlist[], int listsize){ + + int port,i=0; + oom_port_t* pptr; + + if(Initialized == 0){ + __oom_shim_module_init__(); + } + + onlp_sfp_bitmap_t bitmap; + onlp_sfp_bitmap_t_init(&bitmap); + onlp_sfp_bitmap_get(&bitmap); + + if ((portlist == NULL) && (listsize == 0)){ /* asking # of ports */ + if(AIM_BITMAP_COUNT(&bitmap) == 0){ + printf("No SFPs on this platform.\n"); + return 0; + } + else + return AIM_BITMAP_COUNT(&bitmap); + } + + AIM_BITMAP_ITER(&bitmap, port){ + int rv; + uint8_t* data; + + pptr = &portlist[i]; + pptr->handle = (void *)(uintptr_t)port; + pptr->oom_class = OOM_PORT_CLASS_SFF; + sprintf(pptr->name, "port%d", port); + i++; + + rv = onlp_sfp_is_present(port); + if(rv == 0){ + printf("module %d is not present\n", port); + continue; + } + + if(rv < 0){ + printf("%4d Error\n", port); + continue; + } + + rv = onlp_sfp_eeprom_read(port, &data); + + if(rv < 0){ + printf("%4d Error}\n", port); + continue; + } + + sff_info_t sff; + sff_info_init(&sff, data); + if(!sff.supported) { + printf("%13d UNK\n", port); + continue; + } + printf("The sfp_type is : %-14s",sff.sfp_type_name); + } + return 0; } From 3972559344603eca0566688d44f3f3a7494daff9 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Sat, 20 Feb 2016 11:36:59 -0800 Subject: [PATCH 40/55] Updated information on Z9100 --- docs/SupportedHardware.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/SupportedHardware.md b/docs/SupportedHardware.md index c8bdbbfd..875166a0 100644 --- a/docs/SupportedHardware.md +++ b/docs/SupportedHardware.md @@ -59,7 +59,7 @@ Dell S4810-ON 48x10G + 4x40G FreeScale P2020 Broadcom BCM56845 (Trident) Yes Yes Yes No No No S4048-ON 48x10G + 6x40G Intel Atom C2338 Broadcom BCM56854 (Trident2) Yes Yes Yes No No No S6000-ON 32x40G Intel Atom S1220 Broadcom BCM56850 (Trident2) Yes Yes Yes No No No - z9100-ON 32x100G Intel Broadcom BCM56960 (Tomahawk) Yes Yes No No No No + Z9100-ON 32x100G Intel Atom C2538 Broadcom BCM56960 (Tomahawk) Yes Yes No No No No Interface Masters Technologies, Inc. From 578accbef3dbd69779086a3161f4a9d85aea1a8a Mon Sep 17 00:00:00 2001 From: Rohit Magala Date: Sat, 20 Feb 2016 16:39:24 -0800 Subject: [PATCH 41/55] copying Rohit's new GettingStared changes from old ONL --- docs/GettingStarted.md | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/docs/GettingStarted.md b/docs/GettingStarted.md index a676b3bb..33940d3f 100644 --- a/docs/GettingStarted.md +++ b/docs/GettingStarted.md @@ -109,9 +109,8 @@ Now press RETURN here to jump into ONIE''s manual installer mode. You should se Then simply download the latest ONL installer for the appropriate architecture (powerpc or amd64) from the website and run it. - ONIE:/ # install_url http://opennetlinux.org/binaries/latest-amd64.installer + ONIE:/ # install_url http://opennetlinux.org/binaries/latest-$ARCH.installer - ONIE:/ # install_url http://opennetlinux.org/binaries/latest-powerpc.installer Connecting to opennetlinux.org (107.170.237.53:80) Open Network Installer running under ONIE. Installer Version: Open Network Linux e148b7a (powerpc.all,2014.05.21.18.57,e148b7a90131c07eb8d49f74316baf8f2aae92c6) @@ -123,7 +122,26 @@ architecture (powerpc or amd64) from the website and run it. ... +Note: +1) If there is different OS(other than ONL) running on the switch. +Then halt the booting process at U-boot mode, Then check for the ONIE +details in the environment(=> printenv). Open the ONIE in rescue mode, +while ONIE has many different installation modes, +we recommend the rescue mode for doing a manual (read: via console) +because it disables the automatic ONIE server discovery. +Then run (=> run onie_rescue) command to take you to the ONIE environment. + +2) For development purpose, to load freshly build ONL installer from directly ONIE. +Run a http server from the build machine (example:python -m SimpleHTTPServer 8000) and access it as, + + + example: ONIE:/ # install_url http://buildmachineIPAddress:/path/to/directory/onl-09b7bba-powerpc-all.2016.02.05.05.17.installer # update for specific file/date/build + +Also, you can use install via scp with two steps, + + example: ONIE:/ # scp [username]@buildmachineIPAddress:/path/to/directory/onl-09b7bba-powerpc-all.2016.02.05.05.17.installer ONL.installer # update for specific file/date/build + ONIE:/ # sh ONL.installer ONL NFS Root Directory ------------------------------------------------ From 25b360c7e4964ece60d3aadcba5e581210f3f64a Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Sat, 20 Feb 2016 18:58:19 -0800 Subject: [PATCH 42/55] Updated SupportedHardware to include IMT supporting OpenNSL --- docs/SupportedHardware.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/SupportedHardware.md b/docs/SupportedHardware.md index 875166a0..4c13c69e 100644 --- a/docs/SupportedHardware.md +++ b/docs/SupportedHardware.md @@ -69,11 +69,11 @@ Interface Masters Technologies, Inc. Device Ports CPU Forwarding ONL Certified In Lab ORC OF-DPA OpenNSL SAI - Niagara 2948X12XLm 48x10G + 12x40G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** No No Yes*** No No - Niagara 2960X6XLm 60x10G + 6x40G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** No No Yes*** No No - Niagara 2972Xm 72x10G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** Yes No Yes*** No No - Niagara 2932XL 32x40G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** No No Yes*** No No - Niagara 2948X6XL 48x10G + 6x40G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** No No Yes*** No No + Niagara 2948X12XLm 48x10G + 12x40G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** No No Yes*** Yes*** No + Niagara 2960X6XLm 60x10G + 6x40G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** No No Yes*** Yes*** No + Niagara 2972Xm 72x10G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** Yes No Yes*** Yes*** No + Niagara 2932XL 32x40G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** No No Yes*** Yes*** No + Niagara 2948X6XL 48x10G + 6x40G Intel/AMD x86 Broadcom BCM56850 (Trident2) Work In Progress** No No Yes*** Yes No Notes: From bdb687c6447bcaab82c7d41d6375ab78cb5fba0e Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Mon, 22 Feb 2016 10:40:32 -0800 Subject: [PATCH 43/55] Updates to Accton OpenNSL and OFDPA support --- docs/SupportedHardware.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/SupportedHardware.md b/docs/SupportedHardware.md index 4c13c69e..37ecc38f 100644 --- a/docs/SupportedHardware.md +++ b/docs/SupportedHardware.md @@ -25,17 +25,17 @@ Accton/Edge-Core Device Ports CPU Forwarding ONL Certified In Lab ORC OF-DPA OpenNSL SAI - Accton AS4600-54T 48x1G + 4x10G FreeScale P2020 Broadcom BCM56540 (Apollo2) Yes Yes Yes Yes No No + Accton AS4600-54T 48x1G + 4x10G FreeScale P2020 Broadcom BCM56540 (Apollo2) Yes Yes Yes Yes Yes*** No Accton AS5600-52X 48x10G + 4x40G FreeScale P2020 Broadcom BCM56846 (Trident+) Yes Yes Yes Yes No No Accton AS5610-52X 48x10G + 4x40G FreeScale P2020 Broadcom BCM56846 (Trident+) Yes Yes Yes Yes No No - Accton AS5710-54X 48x10G + 6x40G FreeScale P2041 Broadcom BCM56854 (Trident2) Yes Yes Yes Yes No No + Accton AS5710-54X 48x10G + 6x40G FreeScale P2041 Broadcom BCM56854 (Trident2) Yes Yes Yes Yes Yes*** No Accton AS6700-32X 32x40G FreeScale P2041 Broadcom BCM56850 (Trident2) Yes Yes Yes Yes No No - Accton AS5712-54X 48x10G + 6x40G Intel Rangely C2538 x86 Broadcom BCM56854 (Trident2) Yes Yes Yes No No No - Accton AS6712-32X 32x40G Intel Rangely C2538 x86 Broadcom BCM56850 (Trident2) Yes Yes Yes No No No + Accton AS5712-54X 48x10G + 6x40G Intel Rangely C2538 x86 Broadcom BCM56854 (Trident2) Yes Yes Yes Yes*** Yes*** No + Accton AS6712-32X 32x40G Intel Rangely C2538 x86 Broadcom BCM56850 (Trident2) Yes Yes Yes Yes*** Yes*** No Accton AS5812-54T 48x10G + 6x40G Intel Rangely C2538 x86 Broadcom BCM56864 (Trident2+) Yes Yes No No No No Accton AS5812-54X 48x10G + 6x40G Intel Rangely C2538 x86 Broadcom BCM56864 (Trident2+) Yes Yes No No No No Accton AS6812-32X 32x40G Intel Rangely C2538 x86 Broadcom BCM56864 (Trident2+) Yes Yes No No No No - Accton AS7712-32X 32x100G Intel Rangely C2538 x86 Broadcom BCM56960 (Tomahawk) Yes Yes Yes No No No + Accton AS7712-32X 32x100G Intel Rangely C2538 x86 Broadcom BCM56960 (Tomahawk) Yes Yes Yes Yes*** Yes*** No Accton Wedge-16X 16x40G Intel Rangely C2550 x86 Broadcom BCM56864 (Trident2+) Work In Progress** Yes No No Yes No From f1ef1e26b34e2397b2fc939c58a707afbeffb89a Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Mon, 22 Feb 2016 11:06:30 -0800 Subject: [PATCH 44/55] Changes to Accton OpenNSL and OFDPA support --- docs/SupportedHardware.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/SupportedHardware.md b/docs/SupportedHardware.md index 37ecc38f..b399a586 100644 --- a/docs/SupportedHardware.md +++ b/docs/SupportedHardware.md @@ -25,11 +25,11 @@ Accton/Edge-Core Device Ports CPU Forwarding ONL Certified In Lab ORC OF-DPA OpenNSL SAI - Accton AS4600-54T 48x1G + 4x10G FreeScale P2020 Broadcom BCM56540 (Apollo2) Yes Yes Yes Yes Yes*** No - Accton AS5600-52X 48x10G + 4x40G FreeScale P2020 Broadcom BCM56846 (Trident+) Yes Yes Yes Yes No No - Accton AS5610-52X 48x10G + 4x40G FreeScale P2020 Broadcom BCM56846 (Trident+) Yes Yes Yes Yes No No - Accton AS5710-54X 48x10G + 6x40G FreeScale P2041 Broadcom BCM56854 (Trident2) Yes Yes Yes Yes Yes*** No - Accton AS6700-32X 32x40G FreeScale P2041 Broadcom BCM56850 (Trident2) Yes Yes Yes Yes No No + Accton AS4600-54T 48x1G + 4x10G FreeScale P2020 Broadcom BCM56540 (Apollo2) Yes Yes Yes Yes*** Yes*** No + Accton AS5600-52X 48x10G + 4x40G FreeScale P2020 Broadcom BCM56846 (Trident+) Yes Yes Yes No No No + Accton AS5610-52X 48x10G + 4x40G FreeScale P2020 Broadcom BCM56846 (Trident+) Yes Yes Yes No No No + Accton AS5710-54X 48x10G + 6x40G FreeScale P2041 Broadcom BCM56854 (Trident2) Yes Yes Yes Yes*** Yes*** No + Accton AS6700-32X 32x40G FreeScale P2041 Broadcom BCM56850 (Trident2) Yes Yes Yes No No No Accton AS5712-54X 48x10G + 6x40G Intel Rangely C2538 x86 Broadcom BCM56854 (Trident2) Yes Yes Yes Yes*** Yes*** No Accton AS6712-32X 32x40G Intel Rangely C2538 x86 Broadcom BCM56850 (Trident2) Yes Yes Yes Yes*** Yes*** No Accton AS5812-54T 48x10G + 6x40G Intel Rangely C2538 x86 Broadcom BCM56864 (Trident2+) Yes Yes No No No No From b2564128f899e82239649fba3bf25a5840a25287 Mon Sep 17 00:00:00 2001 From: Rohit Malaga Date: Tue, 23 Feb 2016 14:50:28 -0800 Subject: [PATCH 45/55] cleaning code --- .../src/module/inc/oom-shim/oom-shim.h | 2 +- .../src/module/inc/oom-shim/oom_internal.h | 6 +++ .../oom-shim/src/module/src/oom_internal.c | 28 ++++++++++++++ .../any/oom-shim/src/module/src/oom_shim.c | 38 +++++++++++++++---- 4 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 packages/base/any/oom-shim/src/module/inc/oom-shim/oom_internal.h create mode 100644 packages/base/any/oom-shim/src/module/src/oom_internal.c diff --git a/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h b/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h index 0925b787..f83e8035 100644 --- a/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h +++ b/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h @@ -1 +1 @@ -#define MAXPORTS 6 +#define MAXPORTS 512 diff --git a/packages/base/any/oom-shim/src/module/inc/oom-shim/oom_internal.h b/packages/base/any/oom-shim/src/module/inc/oom-shim/oom_internal.h new file mode 100644 index 00000000..67bb0618 --- /dev/null +++ b/packages/base/any/oom-shim/src/module/inc/oom-shim/oom_internal.h @@ -0,0 +1,6 @@ +#ifndef OOM_INTERNAL_H_ +#define OOM_INTERNAL_H_ + +extern void print_block_hex(uint8_t* buf); + +#endif diff --git a/packages/base/any/oom-shim/src/module/src/oom_internal.c b/packages/base/any/oom-shim/src/module/src/oom_internal.c new file mode 100644 index 00000000..0059479d --- /dev/null +++ b/packages/base/any/oom-shim/src/module/src/oom_internal.c @@ -0,0 +1,28 @@ +/* + * Internal OOM functions + */ + +#include +#include + +void print_block_hex(uint8_t* buf) +{ + int j, k; + uint8_t* bufptr8; + uint32_t tempintchar; + + bufptr8 = buf; + for (j = 0; j < 8; j++) { + printf(" " ); + for (k = 0; k < 19; k++) { + if ((k % 5) == 4) { + printf(" "); + } else { + tempintchar = *bufptr8; + printf("%.2X", tempintchar); + bufptr8++; + } + } + printf("\n"); + } +} diff --git a/packages/base/any/oom-shim/src/module/src/oom_shim.c b/packages/base/any/oom-shim/src/module/src/oom_shim.c index 535a8a85..14c1275b 100644 --- a/packages/base/any/oom-shim/src/module/src/oom_shim.c +++ b/packages/base/any/oom-shim/src/module/src/oom_shim.c @@ -30,6 +30,7 @@ #include #include #include +#include int Initialized = 0; @@ -68,7 +69,7 @@ int oom_get_portlist(oom_port_t portlist[], int listsize){ pptr = &portlist[i]; pptr->handle = (void *)(uintptr_t)port; - pptr->oom_class = OOM_PORT_CLASS_SFF; + pptr->oom_class = OOM_PORT_CLASS_UNKNOWN; sprintf(pptr->name, "port%d", port); i++; @@ -79,24 +80,47 @@ int oom_get_portlist(oom_port_t portlist[], int listsize){ } if(rv < 0){ - printf("%4d Error\n", port); + aim_printf(&aim_pvs_stdout, "%4d Error %{onlp_status}\n", port, rv); continue; } rv = onlp_sfp_eeprom_read(port, &data); if(rv < 0){ - printf("%4d Error}\n", port); + aim_printf(&aim_pvs_stdout, "%4d Error %{onlp_status}\n", port, rv); continue; } sff_info_t sff; sff_info_init(&sff, data); - if(!sff.supported) { - printf("%13d UNK\n", port); - continue; + + if(sff.supported) { + pptr->oom_class = OOM_PORT_CLASS_SFF; } - printf("The sfp_type is : %-14s",sff.sfp_type_name); } return 0; } + +int oom_get_function(oom_port_t* port, oom_functions_t function, int* rv){ + return -1; +} + +int oom_get_memory_sff(oom_port_t* port, int address, int page, int offset, int len, uint8_t* data){ + int rv; + unsigned int port_num; + uint8_t* idprom = NULL; + + port_num = (unsigned int)(uintptr_t)port->handle; + rv = onlp_sfp_eeprom_read(port_num, &idprom); + if(rv < 0) { + aim_printf(&aim_pvs_stdout, "Error reading eeprom: %{onlp_status}\n"); + } + else { + aim_printf(&aim_pvs_stdout, "eeprom:\n%{data}\n", idprom, 128); + aim_free(idprom); + } + return 0; +} +int oom_get_memory_cfp(oom_port_t* port, int address, int len, uint16_t* data){ + return -1; +} From b568a271d78cafe21121c2a204e3c2c0a636c277 Mon Sep 17 00:00:00 2001 From: Rohit Malaga Date: Wed, 24 Feb 2016 07:07:40 -0800 Subject: [PATCH 46/55] implemented oom_get_memory_sff --- .../src/module/inc/oom-shim/oom-shim.h | 12 ++++ .../any/oom-shim/src/module/src/oom_shim.c | 66 ++++++++++++++----- 2 files changed, 60 insertions(+), 18 deletions(-) diff --git a/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h b/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h index f83e8035..5833c849 100644 --- a/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h +++ b/packages/base/any/oom-shim/src/module/inc/oom-shim/oom-shim.h @@ -1 +1,13 @@ #define MAXPORTS 512 +#define SFF_A0_BASE 0x0 +#define SFF_A2_BASE 0x100 + +/** + * SFF_EEPROM_DATA_DEBUG + * For printing the eeprom hex data for debugging. + */ + + +#ifndef SFF_EEPROM_DATA_DEBUG +#define SFF_EEPROM_DATA_DEBUG 0 +#endif diff --git a/packages/base/any/oom-shim/src/module/src/oom_shim.c b/packages/base/any/oom-shim/src/module/src/oom_shim.c index 14c1275b..8c3c37aa 100644 --- a/packages/base/any/oom-shim/src/module/src/oom_shim.c +++ b/packages/base/any/oom-shim/src/module/src/oom_shim.c @@ -22,22 +22,21 @@ * * ***********************************************************/ -#include -#include #include #include #include #include #include #include -#include -int Initialized = 0; -/*Initializing the SFP and ONLP modules*/ +/* +* Initializing the SFP and ONLP modules +* compiler calls this function while compiling +*/ + void __oom_shim_module_init__(void) { onlp_init(); - Initialized = 1; } /*Gets the portlist of the SFP ports on the switch*/ @@ -46,9 +45,6 @@ int oom_get_portlist(oom_port_t portlist[], int listsize){ int port,i=0; oom_port_t* pptr; - if(Initialized == 0){ - __oom_shim_module_init__(); - } onlp_sfp_bitmap_t bitmap; onlp_sfp_bitmap_t_init(&bitmap); @@ -75,7 +71,7 @@ int oom_get_portlist(oom_port_t portlist[], int listsize){ rv = onlp_sfp_is_present(port); if(rv == 0){ - printf("module %d is not present\n", port); + aim_printf(&aim_pvs_stdout, "module %d is not present\n", port); continue; } @@ -101,12 +97,9 @@ int oom_get_portlist(oom_port_t portlist[], int listsize){ return 0; } -int oom_get_function(oom_port_t* port, oom_functions_t function, int* rv){ - return -1; -} int oom_get_memory_sff(oom_port_t* port, int address, int page, int offset, int len, uint8_t* data){ - int rv; + int rv,cur_offset; unsigned int port_num; uint8_t* idprom = NULL; @@ -114,13 +107,50 @@ int oom_get_memory_sff(oom_port_t* port, int address, int page, int offset, int rv = onlp_sfp_eeprom_read(port_num, &idprom); if(rv < 0) { aim_printf(&aim_pvs_stdout, "Error reading eeprom: %{onlp_status}\n"); + return -1; } - else { - aim_printf(&aim_pvs_stdout, "eeprom:\n%{data}\n", idprom, 128); - aim_free(idprom); + +#if SFF_EEPROM_DATA_DEBUG == 1 + aim_printf(&aim_pvs_stdout, "eeprom:\n%{data}\n", idprom, 256);/*print the hex data for debugging purpose*/ +#endif + + if (address == 0xa0) { + cur_offset = SFF_A0_BASE; + } else if (address == 0xa2) { + cur_offset = SFF_A2_BASE; + } else { + aim_printf(&aim_pvs_stdout, "Error invalid address: 0x%02x\n", address); + return -EINVAL; } + cur_offset += page * 128; + cur_offset += offset; + + memcpy(data, &idprom[cur_offset], len); + aim_free(idprom); + return 0; } -int oom_get_memory_cfp(oom_port_t* port, int address, int len, uint16_t* data){ + +int oom_get_function(oom_port_t* port, oom_functions_t function, int* rv){ + //not implemented + return -1; +} + +int oom_get_memory_cfp(oom_port_t* port, int address, int len, uint16_t* data){ + //not implemented + return -1; +} + +int oom_set_memory_sff(oom_port_t* port, int address, int page, int offset, int len, uint8_t* data){ + //not implemented + return -1; +} + +int oom_set_function(oom_port_t* port, oom_functions_t function, int value){ + //not implemented + return -1; +} +int oom_set_memory_cfp(oom_port_t* port, int address, int len, uint16_t* data){ + //not implemented return -1; } From bc1af1f586a50dad1c783054e6d72df8c9a1da66 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 24 Feb 2016 17:20:10 +0000 Subject: [PATCH 47/55] Some build and autogen tools require these settings. --- make/config.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/make/config.mk b/make/config.mk index 9f4109a9..4721ddae 100644 --- a/make/config.mk +++ b/make/config.mk @@ -35,3 +35,11 @@ export MODULEMANIFEST := $(shell $(BUILDER)/tools/mmg.py --dirs $(ONL) $(ONLPM_O ONL_MAKE_FLAGS += --no-print-directory -s ONL_MAKE := $(MAKE) $(ONL_MAKE_FLAGS) ONL_V_at := @ + +# +# Some build and autogen tools require these settings. +# +export SUBMODULE_INFRA := $(ONL)/sm/infra +export SUBMODULE_BIGCODE := $(ONL)/sm/bigcode + + From 38a36dd96baf099abc09c9976923ab5e77b63127 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 24 Feb 2016 17:20:41 +0000 Subject: [PATCH 48/55] Convert to local infra. --- .../base/any/onlp/src/onlp/module/src/Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/base/any/onlp/src/onlp/module/src/Makefile b/packages/base/any/onlp/src/onlp/module/src/Makefile index 3033edf5..27348ddb 100644 --- a/packages/base/any/onlp/src/onlp/module/src/Makefile +++ b/packages/base/any/onlp/src/onlp/module/src/Makefile @@ -1,28 +1,28 @@ ############################################################ # -# -# Copyright 2014, 2015 Big Switch Networks, Inc. -# +# +# 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. -# +# # ############################################################ # # Local source generation targets. # ############################################################ -include ../../../../init.mk +include $(ONL)/make/config.mk ucli: $(SUBMODULE_BIGCODE)/tools/uclihandlers.py onlp_ucli.c From 4d7b8f9e17da4a776e9f76f12281cb1a50f39197 Mon Sep 17 00:00:00 2001 From: Rohit Malaga Date: Wed, 24 Feb 2016 11:06:41 -0800 Subject: [PATCH 49/55] including suggestions by Rob --- .../any/oom-shim/src/module/src/oom_shim.c | 27 +++++-------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/packages/base/any/oom-shim/src/module/src/oom_shim.c b/packages/base/any/oom-shim/src/module/src/oom_shim.c index 8c3c37aa..c997aadc 100644 --- a/packages/base/any/oom-shim/src/module/src/oom_shim.c +++ b/packages/base/any/oom-shim/src/module/src/oom_shim.c @@ -52,7 +52,6 @@ int oom_get_portlist(oom_port_t portlist[], int listsize){ if ((portlist == NULL) && (listsize == 0)){ /* asking # of ports */ if(AIM_BITMAP_COUNT(&bitmap) == 0){ - printf("No SFPs on this platform.\n"); return 0; } else @@ -61,38 +60,25 @@ int oom_get_portlist(oom_port_t portlist[], int listsize){ AIM_BITMAP_ITER(&bitmap, port){ int rv; - uint8_t* data; pptr = &portlist[i]; - pptr->handle = (void *)(uintptr_t)port; - pptr->oom_class = OOM_PORT_CLASS_UNKNOWN; - sprintf(pptr->name, "port%d", port); + pptr->handle = (void *)(uintptr_t)port+1; + pptr->oom_class = OOM_PORT_CLASS_SFF; + sprintf(pptr->name, "port%d", port+1); i++; rv = onlp_sfp_is_present(port); if(rv == 0){ aim_printf(&aim_pvs_stdout, "module %d is not present\n", port); + pptr->oom_class = OOM_PORT_CLASS_UNKNOWN; continue; } if(rv < 0){ aim_printf(&aim_pvs_stdout, "%4d Error %{onlp_status}\n", port, rv); + pptr->oom_class = OOM_PORT_CLASS_UNKNOWN; continue; } - - rv = onlp_sfp_eeprom_read(port, &data); - - if(rv < 0){ - aim_printf(&aim_pvs_stdout, "%4d Error %{onlp_status}\n", port, rv); - continue; - } - - sff_info_t sff; - sff_info_init(&sff, data); - - if(sff.supported) { - pptr->oom_class = OOM_PORT_CLASS_SFF; - } } return 0; } @@ -104,7 +90,8 @@ int oom_get_memory_sff(oom_port_t* port, int address, int page, int offset, int uint8_t* idprom = NULL; port_num = (unsigned int)(uintptr_t)port->handle; - rv = onlp_sfp_eeprom_read(port_num, &idprom); + port_num -= 1; + rv = onlp_sfp_eeprom_read(port_num, &idprom);/*place holder implementation until onlp_sfp_eeprom_read() can be improved to handle subpages*/ if(rv < 0) { aim_printf(&aim_pvs_stdout, "Error reading eeprom: %{onlp_status}\n"); return -1; From c5370db4011adb6a735b1e3d2ecfe2cec1abff31 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Thu, 25 Feb 2016 20:39:18 +0000 Subject: [PATCH 50/55] Updated Wedge Getting Started Guide --- docs/GettingStartedWedge.md | 39 +++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/docs/GettingStartedWedge.md b/docs/GettingStartedWedge.md index bf608275..fb479df2 100644 --- a/docs/GettingStartedWedge.md +++ b/docs/GettingStartedWedge.md @@ -62,16 +62,19 @@ ONL Manual Install 2) Boot switch and choose "ONIE: Rescue" to go to ONIE''s interactive mode -3) From the ONIE# prompt run "install_url http://opennetlinux.org/binaries/latest-wedge.installer" +3) From the ONIE# prompt run "install_url http://opennetlinux.org/binaries/latest-wedge-2.0.installer" 4) Wait for the install to finish and the system to reboot 5) One the onl login prompt appears login with the username root and the password "onl" -6) You can now change the root password +6) Configure the ma1 interface either via dhcp (dhclient ma1) or manually -7) Configure the ma1 interface either via dhcp (dhclient ma1) or manually +7) Install fboss using the commands + + #> apt-get update + #> apt-get install fboss 8) From the command prompt you can start fboss by using the command "service fboss_wedge_agent start" @@ -126,19 +129,35 @@ Now press RETURN here to jump into ONIE''s manual installer mode. You should se Then simply download the latest ONL wedge installer from the website and run it. - ONIE:/ # install_url http://opennetlinux.org/binaries/latest-wedge.installer + ONIE:/ # install_url http://opennetlinux.org/binaries/latest-wedge-2.0.installer Connecting to opennetlinux.org (107.170.237.53:80) Open Network Installer running under ONIE. - Installer Version: Open Network Linux 019421c (amd64.all,2015.11.17.06.23,019421c116940d87d5a41100d1b8a64cbba50252) - Detected platform: x86-64-accton-wedge-16x-r0 - Installing in standalone mode. - Unpacking Open Network Linux installer files... + Installing Open Network Linux Software Image (ONL-2.0.0_ONL-OS_2016-02-12.2304-b9b7e50_AMD64.swi)... + Installation finished. No error reported. + Install finished. Rebooting to Open Network Linux. ... Connecting tty=ttyS1 with /sbin/pgetty - Open Network Linux 019421c (amd64.all,2015.11.17.06.23,019421c116940d87d5a41100d1b8a64cbba50252) + Debian GNU/Linux 8 localhost ttyS1 - onl-wedge login: + localhost login: root + Password: + Linux localhost 3.2.65-1+deb7u2-OpenNetworkLinux #1 SMP Fri Feb 12 23:10:15 UTC 2016 x86_64 + root@localhost:~# apt-get update + root@localhost:~# apt-get install fboss + WARNING: The following packages cannot be authenticated! + folly wangle fbthrift fboss-py fboss-core fboss + Install these packages without verification? [y/N] y + + root@localhost:~# service fboss_wedge_agent start + [....] Starting Facebook FBOSS agent: fboss_wedge_agent + Error: OpenNSL library not found, attempting to grab from GitHub + Saving to: ‘/usr/local/lib/libopennsl.so.1’ + + OpenNSL library succesfully installed + [ ok --- Loading linux-kernel-bde linux-user-bde linux-bcm-knet ; Creating devices . + root@localhost:~# service fboss_wedge_agent status + [ ok ] fboss_wedge_agent is running. From f542469ef784390c2ddb0f2f707f6e3eb5b05b8b Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Tue, 1 Mar 2016 16:33:02 -0800 Subject: [PATCH 51/55] Latest --- sm/infra | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sm/infra b/sm/infra index 810633d3..19f74c74 160000 --- a/sm/infra +++ b/sm/infra @@ -1 +1 @@ -Subproject commit 810633d3fc6b07e6b03428489fc84ef51a160753 +Subproject commit 19f74c743cd8d4c990640d0340fb295da428a0a8 From 1ad77c0774be365efb2542173258f7b6748c7e5a Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 2 Mar 2016 00:35:11 +0000 Subject: [PATCH 52/55] The latest AIM module has updated link requirements. --- packages/base/any/faultd/builds/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/base/any/faultd/builds/Makefile b/packages/base/any/faultd/builds/Makefile index 4f07a942..5f767564 100644 --- a/packages/base/any/faultd/builds/Makefile +++ b/packages/base/any/faultd/builds/Makefile @@ -47,5 +47,5 @@ GLOBAL_CFLAGS += -DFAULTD_CONFIG_INCLUDE_MAIN=1 GLOBAL_CFLAGS += -DFAULTD_CONFIG_INCLUDE_AIM_MAIN=1 GLOBAL_CFLAGS += -g -GLOBAL_LINK_LIBS += -lpthread +GLOBAL_LINK_LIBS += -lpthread -lrt From 891eff09deca8a32bb47357dc27aaa3556bfd88f Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 2 Mar 2016 01:58:47 +0000 Subject: [PATCH 53/55] Platform Manager Enhancements - Run onlpd in platform manager mode. - onlpd service init. - Add onlpd service to rfs builds. --- packages/base/any/onlp/APKG.yml | 2 + packages/base/any/onlp/builds/onlp/Makefile | 2 + packages/base/any/onlp/builds/onlpd/Makefile | 5 +- .../any/onlp/src/onlp/module/inc/onlp/sys.h | 21 +++-- .../any/onlp/src/onlp/module/src/onlp_main.c | 91 ++++++++++++++++++- .../src/onlp/module/src/platform_manager.c | 25 ++++- 6 files changed, 130 insertions(+), 16 deletions(-) diff --git a/packages/base/any/onlp/APKG.yml b/packages/base/any/onlp/APKG.yml index c9e3fbb4..b0d91c6a 100644 --- a/packages/base/any/onlp/APKG.yml +++ b/packages/base/any/onlp/APKG.yml @@ -26,6 +26,8 @@ packages: builds/onlp-platform-defaults/$BUILD_DIR/${TOOLCHAIN}/bin/libonlp-platform-defaults.so : $libdir/ builds/onlpd/$BUILD_DIR/${TOOLCHAIN}/bin/onlpd : $bindir/ + init: $ONL/packages/base/any/onlp/src/onlpd.init + changelog: Change changes changes., diff --git a/packages/base/any/onlp/builds/onlp/Makefile b/packages/base/any/onlp/builds/onlp/Makefile index f2918840..fb0df874 100644 --- a/packages/base/any/onlp/builds/onlp/Makefile +++ b/packages/base/any/onlp/builds/onlp/Makefile @@ -44,6 +44,8 @@ GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_CTOR_DTOR=1 GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 GLOBAL_CFLAGS += -DONLP_CONFIG_API_LOCK_GLOBAL_SHARED=1 GLOBAL_CFLAGS += -DONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_PVS_SYSLOG=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_DAEMONIZE=1 GLOBAL_CFLAGS += -fPIC GLOBAL_LINK_LIBS += -lpthread $(LIBONLP_PLATFORM) $(LIBONLP_PLATFORM_DEFAULTS) diff --git a/packages/base/any/onlp/builds/onlpd/Makefile b/packages/base/any/onlp/builds/onlpd/Makefile index 0a3a9d49..258bd9f7 100644 --- a/packages/base/any/onlp/builds/onlpd/Makefile +++ b/packages/base/any/onlp/builds/onlpd/Makefile @@ -40,8 +40,11 @@ LIBONLP_SO := ../onlp/$(BUILD_DIR)/bin/libonlp.so GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1 GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_DAEMONIZE=1 +GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_PVS_SYSLOG=1 + GLOBAL_LINK_LIBS += $(LIBONLP_SO) -Wl,--unresolved-symbols=ignore-in-shared-libs -GLOBAL_LINK_LIBS += -lpthread -lm +GLOBAL_LINK_LIBS += -lpthread -lm -lrt include $(BUILDER)/targets.mk diff --git a/packages/base/any/onlp/src/onlp/module/inc/onlp/sys.h b/packages/base/any/onlp/src/onlp/module/inc/onlp/sys.h index 1d9029ee..8d12781f 100644 --- a/packages/base/any/onlp/src/onlp/module/inc/onlp/sys.h +++ b/packages/base/any/onlp/src/onlp/module/inc/onlp/sys.h @@ -1,21 +1,21 @@ /************************************************************ * - * - * Copyright 2014, 2015 Big Switch Networks, Inc. - * + * + * 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. - * + * * ************************************************************ * @@ -96,12 +96,17 @@ int onlp_sys_vioctl(int code, va_list vargs); /** * @brief Start the platform management thread. */ -int onlp_sys_platform_manage_start(void); +int onlp_sys_platform_manage_start(int block); /** * @brief Stop the platform management thread. */ -int onlp_sys_platform_manage_stop(void); +int onlp_sys_platform_manage_stop(int block); + +/** + * @brief Join the platform management thread. + */ +int onlp_sys_platform_manage_join(void); /** * @brief Perform any pending platform management activities. diff --git a/packages/base/any/onlp/src/onlp/module/src/onlp_main.c b/packages/base/any/onlp/src/onlp/module/src/onlp_main.c index f1343487..990d8a54 100644 --- a/packages/base/any/onlp/src/onlp/module/src/onlp_main.c +++ b/packages/base/any/onlp/src/onlp/module/src/onlp_main.c @@ -28,6 +28,10 @@ #include #include #include +#include +#include + +static void platform_manager_daemon__(const char* pidfile); /** * Human-readable SFP inventory. @@ -165,10 +169,12 @@ onlpdump_main(int argc, char* argv[]) int x = 0; int S = 0; int l = 0; + int M = 0; + char* pidfile = NULL; const char* O = NULL; const char* t = NULL; - while( (c = getopt(argc, argv, "srehdojmipxlSt:O:")) != -1) { + while( (c = getopt(argc, argv, "srehdojmM:ipxlSt:O:")) != -1) { switch(c) { case 's': show=1; break; @@ -180,6 +186,7 @@ onlpdump_main(int argc, char* argv[]) case 'o': o=1; break; case 'x': x=1; break; case 'm': m=1; break; + case 'M': M=1; pidfile = optarg; break; case 'i': i=1; break; case 'p': p=1; show=-1; break; case 't': t = optarg; break; @@ -190,6 +197,11 @@ onlpdump_main(int argc, char* argv[]) } } + if(M) { + platform_manager_daemon__(pidfile); + exit(0); + } + if(help) { printf("Usage: %s [OPTIONS]\n", argv[0]); printf(" -d Use dump(). This is the default.\n"); @@ -200,6 +212,7 @@ onlpdump_main(int argc, char* argv[]) printf(" -x Dump Platform Info only.\n"); printf(" -j Dump ONIE data in JSON format.\n"); printf(" -m Run platform manager.\n"); + printf(" -M Run as platform manager daemon.\n"); printf(" -i Iterate OIDs.\n"); printf(" -p Show SFP presence.\n"); printf(" -t Decode TlvInfo data.\n"); @@ -302,10 +315,10 @@ onlpdump_main(int argc, char* argv[]) if(m) { printf("Running the platform manager for 600 seconds...\n"); - onlp_sys_platform_manage_start(); + onlp_sys_platform_manage_start(0); sleep(600); printf("Stopping the platform manager.\n"); - onlp_sys_platform_manage_stop(); + onlp_sys_platform_manage_stop(1); } if(p) { @@ -323,3 +336,75 @@ onlpdump_main(int argc, char* argv[]) return 0; } + +#if AIM_CONFIG_INCLUDE_DAEMONIZE == 1 + +#include +#include +#include +#include + +void +sighandler__(int signal) +{ + onlp_sys_platform_manage_stop(0); +} + +static void +platform_manager_daemon__(const char* pidfile) +{ + 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_BITMAP_CLR(&rconfig.signal_restarts, SIGTERM); + AIM_BITMAP_CLR(&rconfig.exit_restarts, 0); + rconfig.maximum_restarts=50; + rconfig.pvs = NULL; + config.wd = "/"; + + aim_daemonize(&config, &rconfig); + aim_log_handler_basic_init_all("onlpd", + "/var/log/onlpd.log", + 1024*1024, + 99); + if(pidfile) { + FILE* fp = fopen(pidfile, "w"); + if(fp == NULL) { + int e = errno; + aim_printf(aim_pvs_syslog, "fatal: open(%s): %s\n", + pidfile, strerror(e)); + aim_printf(&aim_pvs_stderr, "fatal: open(%s): %s\n", + pidfile, strerror(e)); + + /* Don't attempt restart */ + raise(SIGTERM); + } + fprintf(fp, "%d\n", getpid()); + fclose(fp); + } + + /** Signal handler for terminating the platform manager */ + signal(SIGTERM, sighandler__); + + /** Start and block in platform manager. */ + onlp_sys_platform_manage_start(1); + + /** Terminated via signal. Cleanup and exit. */ + onlp_sys_platform_manage_stop(1); + + aim_log_handler_basic_denit_all(); + exit(0); +} + + +#else +static void +platform_manager_daemon__(const char* pidfile) +{ + fprintf(stderr, "Daemon mode not supported in this build."); + exit(1); +} +#endif diff --git a/packages/base/any/onlp/src/onlp/module/src/platform_manager.c b/packages/base/any/onlp/src/onlp/module/src/platform_manager.c index a2a884b2..16684832 100644 --- a/packages/base/any/onlp/src/onlp/module/src/platform_manager.c +++ b/packages/base/any/onlp/src/onlp/module/src/platform_manager.c @@ -228,7 +228,7 @@ onlp_sys_platform_manage_thread__(void* vctrl) } int -onlp_sys_platform_manage_start(void) +onlp_sys_platform_manage_start(int block) { onlp_sys_platform_manage_init(); @@ -250,22 +250,39 @@ onlp_sys_platform_manage_start(void) return -1; } + if(block) { + onlp_sys_platform_manage_join(); + } + return 0; } int -onlp_sys_platform_manage_stop(void) +onlp_sys_platform_manage_stop(int block) { if(control__.eventfd > 0) { uint64_t zero = 1; /* Tell the thread to exit */ write(control__.eventfd, &zero, sizeof(zero)); - /* Wait for the thread to terminate */ - pthread_join(control__.thread, NULL); + + if(block) { + onlp_sys_platform_manage_join(); + } } return 0; } +int +onlp_sys_platform_manage_join(void) +{ + if(control__.eventfd > 0) { + /* Wait for the thread to terminate */ + pthread_join(control__.thread, NULL); + close(control__.eventfd); + control__.eventfd = -1; + } + return 0; +} static int platform_psus_notify__(void) From b14ce8a6488f4ba923403ec589c940bb508fbfc2 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 2 Mar 2016 02:00:05 +0000 Subject: [PATCH 54/55] Initial. --- packages/base/any/onlp/src/onlpd.init | 67 +++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 packages/base/any/onlp/src/onlpd.init diff --git a/packages/base/any/onlp/src/onlpd.init b/packages/base/any/onlp/src/onlpd.init new file mode 100644 index 00000000..99165b56 --- /dev/null +++ b/packages/base/any/onlp/src/onlpd.init @@ -0,0 +1,67 @@ +#!/bin/sh + +### BEGIN INIT INFO +# Provides: onlpd +# Required-Start: $syslog +# Required-Stop: $syslog +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Start ONLP Platform Agent +# Description: ONLP PLATFORM AGENTX +### END INIT INFO + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +. /lib/lsb/init-functions + +DAEMON=/bin/onlpd +PIDFILE=/var/run/onlpd.pid +ONLP_SNMPD_OPTS="-M $PIDFILE" +QUIET= + +test -x $DAEMON || exit 5 + +RUNASUSER=root +UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true + +case $1 in + start) + log_daemon_msg "Starting ONLP Platform Agent" "onlpd" + if [ -z "$UGID" ]; then + log_failure_msg "user \"$RUNASUSER\" does not exist" + exit 1 + fi + start-stop-daemon --start $QUIET --oknodo --pidfile $PIDFILE --startas $DAEMON -- $ONLP_SNMPD_OPTS $ONLP_SNMPD_EXTRA_OPTS + status=$? + log_end_msg $status + ;; + stop) + log_daemon_msg "Stopping ONLP Platform Agent" "onlpd" + start-stop-daemon --stop $QUIET --oknodo --pidfile $PIDFILE + log_end_msg $? + rm -f $PIDFILE + ;; + restart|force-reload) + $0 stop && sleep 2 && $0 start + ;; + try-restart) + if $0 status >/dev/null; then + $0 restart + else + exit 0 + fi + ;; + reload) + log_daemon_msg "Reloading ONLP Platform Agent" "onlpd" + start-stop-daemon --stop $QUIET --oknodo --pidfile $PIDFILE --signal 1 + status=$? + log_end_msg $status + ;; + status) + status_of_proc $DAEMON "ONLP Platform Agent" + ;; + *) + echo "Usage: $0 {start|stop|restart|try-restart|force-reload|reload|status}" + exit 2 + ;; +esac From e265c9a5b9c49f39a87726a9ae51011ed82a0a65 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 2 Mar 2016 02:00:38 +0000 Subject: [PATCH 55/55] Add onlpd --- builds/any/rootfs/jessie/standard/standard.yml | 1 + builds/any/rootfs/wheezy/standard/standard.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/builds/any/rootfs/jessie/standard/standard.yml b/builds/any/rootfs/jessie/standard/standard.yml index 82e08834..785a2638 100644 --- a/builds/any/rootfs/jessie/standard/standard.yml +++ b/builds/any/rootfs/jessie/standard/standard.yml @@ -58,6 +58,7 @@ Configure: - 'initdev defaults' - 'onl-platform-baseconf defaults' - 'faultd defaults' + - 'onlpd defaults' - 'snmpd remove' - 'onlp-snmpd remove' - 'ssh defaults' diff --git a/builds/any/rootfs/wheezy/standard/standard.yml b/builds/any/rootfs/wheezy/standard/standard.yml index e7abdcc4..16567372 100644 --- a/builds/any/rootfs/wheezy/standard/standard.yml +++ b/builds/any/rootfs/wheezy/standard/standard.yml @@ -58,6 +58,7 @@ Configure: - 'initdev defaults' - 'onl-platform-baseconf defaults' - 'faultd defaults' + - 'onlpd defaults' - 'snmpd remove' - 'onlp-snmpd remove' - 'ssh defaults'