From 0f66be37cc7c679ee4b4abf94c6c005bb03590b9 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Mon, 10 Oct 2016 17:42:38 +0000 Subject: [PATCH 01/28] Latest --- packages/platforms-closed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platforms-closed b/packages/platforms-closed index 1fe8a60b..60d7d7fd 160000 --- a/packages/platforms-closed +++ b/packages/platforms-closed @@ -1 +1 @@ -Subproject commit 1fe8a60b83155758a44a62b3e6c89bac2bde7769 +Subproject commit 60d7d7fd9abd05ed5c9969ac48ebf40838c93116 From 559f0f1e93b5d9f8233f7a6b4e7b2719311e150a Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Mon, 10 Oct 2016 15:08:19 -0700 Subject: [PATCH 02/28] Latest --- packages/platforms-closed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platforms-closed b/packages/platforms-closed index 60d7d7fd..feff1c37 160000 --- a/packages/platforms-closed +++ b/packages/platforms-closed @@ -1 +1 @@ -Subproject commit 60d7d7fd9abd05ed5c9969ac48ebf40838c93116 +Subproject commit feff1c37eb206ac0fc3b8bcb5ab3514b693ed2df From 02df906749db8c15d4e70a34e4fa5ff7b6b0bc95 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Tue, 11 Oct 2016 20:30:35 +0000 Subject: [PATCH 03/28] The onl-pki script has moved. --- .../all/initrds/loader-initrd-files/src/bin/sysinit | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/sysinit b/packages/base/all/initrds/loader-initrd-files/src/bin/sysinit index 81d327e0..983b4799 100755 --- a/packages/base/all/initrds/loader-initrd-files/src/bin/sysinit +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/sysinit @@ -91,20 +91,15 @@ if [ ! -f /etc/onl/abort ]; then # Use default boot-config. cp /etc/onl/boot-config-default /etc/onl/boot-config fi - - # - # Initialize the /mnt/flash/boot area. - # - #mkdir -p /mnt/data/boot - #rm -rf /mnt/flash/boot/* fi # # Initialize PKI # -if [ -f /sbin/onl-pki ]; then - /sbin/onl-pki --init +ONL_PKI=/usr/bin/onl-pki +if [ -f "$ONL_PKI" ]; then + "$ONL_PKI" --init fi From f8d4662018d6c05cd5b2066ad6f31e29010940c0 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 12 Oct 2016 18:41:45 +0000 Subject: [PATCH 04/28] Latest --- sm/bigcode | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sm/bigcode b/sm/bigcode index fb78f3db..19fb14d8 160000 --- a/sm/bigcode +++ b/sm/bigcode @@ -1 +1 @@ -Subproject commit fb78f3dbac61413aec9b88f9dce14369ebaf68cf +Subproject commit 19fb14d8a5424284d2b082b65f4f5a269a587fd5 From ee0a5caea1187c3dbc02ed98e0e95160987ea5e6 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Thu, 13 Oct 2016 18:03:31 +0000 Subject: [PATCH 05/28] - Improve retry and timeout performance for the isch driver - adm1021 device detection option --- .../drivers-hwmon-adm1021-detect.patch | 29 +++++++++++++++ .../drivers-i2c-busses-i2c-isch-timeout.patch | 36 +++++++++++++++++++ .../kernels/3.2.65-1+deb7u2/patches/series | 2 ++ 3 files changed, 67 insertions(+) create mode 100644 packages/base/any/kernels/3.2.65-1+deb7u2/patches/drivers-hwmon-adm1021-detect.patch create mode 100644 packages/base/any/kernels/3.2.65-1+deb7u2/patches/drivers-i2c-busses-i2c-isch-timeout.patch diff --git a/packages/base/any/kernels/3.2.65-1+deb7u2/patches/drivers-hwmon-adm1021-detect.patch b/packages/base/any/kernels/3.2.65-1+deb7u2/patches/drivers-hwmon-adm1021-detect.patch new file mode 100644 index 00000000..079fb085 --- /dev/null +++ b/packages/base/any/kernels/3.2.65-1+deb7u2/patches/drivers-hwmon-adm1021-detect.patch @@ -0,0 +1,29 @@ +--- a/drivers/hwmon/adm1021.c 2014-12-14 08:24:02.000000000 -0800 ++++ b/drivers/hwmon/adm1021.c 2016-10-13 10:48:10.045055678 -0700 +@@ -105,6 +105,7 @@ static struct adm1021_data *adm1021_upda + /* (amalysh) read only mode, otherwise any limit's writing confuse BIOS */ + static int read_only; + ++static int detect = 1; + + static const struct i2c_device_id adm1021_id[] = { + { "adm1021", adm1021 }, +@@ -295,6 +296,9 @@ static int adm1021_detect(struct i2c_cli + "smbus byte data not supported!\n"); + return -ENODEV; + } ++ if(detect == 0) { ++ return -ENODEV; ++ } + + status = i2c_smbus_read_byte_data(client, ADM1021_REG_STATUS); + conv_rate = i2c_smbus_read_byte_data(client, +@@ -510,6 +514,8 @@ MODULE_LICENSE("GPL"); + + module_param(read_only, bool, 0); + MODULE_PARM_DESC(read_only, "Don't set any values, read only mode"); ++module_param(detect, bool, 1); ++MODULE_PARM_DESC(detect, "Enable or disable device detection."); + + module_init(sensors_adm1021_init) + module_exit(sensors_adm1021_exit) diff --git a/packages/base/any/kernels/3.2.65-1+deb7u2/patches/drivers-i2c-busses-i2c-isch-timeout.patch b/packages/base/any/kernels/3.2.65-1+deb7u2/patches/drivers-i2c-busses-i2c-isch-timeout.patch new file mode 100644 index 00000000..013b3725 --- /dev/null +++ b/packages/base/any/kernels/3.2.65-1+deb7u2/patches/drivers-i2c-busses-i2c-isch-timeout.patch @@ -0,0 +1,36 @@ +--- a/drivers/i2c/busses/i2c-isch.c 2014-12-14 08:24:02.000000000 -0800 ++++ b/drivers/i2c/busses/i2c-isch.c 2016-10-13 08:02:44.564840300 -0700 +@@ -47,7 +47,7 @@ + #define SMBBLKDAT (0x20 + sch_smba) + + /* Other settings */ +-#define MAX_TIMEOUT 500 ++#define MAX_RETRIES 5000 + + /* I2C constants */ + #define SCH_QUICK 0x00 +@@ -68,7 +68,7 @@ static int sch_transaction(void) + { + int temp; + int result = 0; +- int timeout = 0; ++ int retries = 0; + + dev_dbg(&sch_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, " + "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb(SMBHSTCNT), +@@ -100,12 +100,12 @@ static int sch_transaction(void) + outb(inb(SMBHSTCNT) | 0x10, SMBHSTCNT); + + do { +- msleep(1); ++ usleep_range(100, 200); + temp = inb(SMBHSTSTS) & 0x0f; +- } while ((temp & 0x08) && (timeout++ < MAX_TIMEOUT)); ++ } while ((temp & 0x08) && (retries++ < MAX_RETRIES)); + + /* If the SMBus is still busy, we give up */ +- if (timeout > MAX_TIMEOUT) { ++ if (retries > MAX_RETRIES) { + dev_err(&sch_adapter.dev, "SMBus Timeout!\n"); + result = -ETIMEDOUT; + } diff --git a/packages/base/any/kernels/3.2.65-1+deb7u2/patches/series b/packages/base/any/kernels/3.2.65-1+deb7u2/patches/series index 929c0e53..f93799e2 100644 --- a/packages/base/any/kernels/3.2.65-1+deb7u2/patches/series +++ b/packages/base/any/kernels/3.2.65-1+deb7u2/patches/series @@ -251,3 +251,5 @@ platform-accton-as7716_32x-device-drivers.patch driver-broadcom-tigon3.patch mgmt-port-init-config.patch arch-intel-reboot-cf9-cold.patch +drivers-hwmon-adm1021-detect.patch +drivers-i2c-busses-i2c-isch-timeout.patch From d47fa3a5a1d03c60017348241a4e8cef0c79fc51 Mon Sep 17 00:00:00 2001 From: Zi Zhou Date: Thu, 13 Oct 2016 17:19:31 -0700 Subject: [PATCH 06/28] Do not show CRC under System Information for "show version" --- .../base/all/vendor-config-onl/src/python/onl/platform/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/base/all/vendor-config-onl/src/python/onl/platform/base.py b/packages/base/all/vendor-config-onl/src/python/onl/platform/base.py index 19f6be9d..f9e0e20e 100644 --- a/packages/base/all/vendor-config-onl/src/python/onl/platform/base.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/platform/base.py @@ -45,7 +45,7 @@ class OnlInfoObject(object): @staticmethod def string(d, indent=DEFAULT_INDENT): - return "\n".join( sorted("%s%s: %s" % (indent,k,v) for k,v in d.iteritems() if not k.startswith('_') and d[k] is not None) ) + return "\n".join( sorted("%s%s: %s" % (indent,k,v) for k,v in d.iteritems() if not k.startswith('_') and d[k] is not None and k != 'CRC')) ############################################################ From da8ff83e0ee2dbf21da7072a6f0b5d01ae5350f6 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Thu, 13 Oct 2016 20:44:31 -0700 Subject: [PATCH 07/28] Kernel configuration options and updated at24 patch for kernel 3.16 --- .../configs/x86_64-all/x86_64-all.config | 29 ++++++++++++- ...-at24-fix-odd-length-two-byte-access.patch | 43 +++++++------------ 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/packages/base/any/kernels/3.16+deb8/configs/x86_64-all/x86_64-all.config b/packages/base/any/kernels/3.16+deb8/configs/x86_64-all/x86_64-all.config index 7a66710e..8546a1f2 100644 --- a/packages/base/any/kernels/3.16+deb8/configs/x86_64-all/x86_64-all.config +++ b/packages/base/any/kernels/3.16+deb8/configs/x86_64-all/x86_64-all.config @@ -818,6 +818,7 @@ CONFIG_NETFILTER_XT_TARGET_DSCP=y CONFIG_NETFILTER_XT_TARGET_HL=y CONFIG_NETFILTER_XT_TARGET_HMARK=y CONFIG_NETFILTER_XT_TARGET_IDLETIMER=y +# CONFIG_NETFILTER_XT_TARGET_LED is not set CONFIG_NETFILTER_XT_TARGET_LOG=y CONFIG_NETFILTER_XT_TARGET_MARK=y CONFIG_NETFILTER_XT_TARGET_NETMAP=y @@ -2116,7 +2117,18 @@ CONFIG_SENSORS_LM90=y # CONFIG_SENSORS_NCT6683 is not set # CONFIG_SENSORS_NCT6775 is not set # CONFIG_SENSORS_PCF8591 is not set -# CONFIG_PMBUS is not set +CONFIG_PMBUS=y +CONFIG_SENSORS_PMBUS=y +# CONFIG_SENSORS_ADM1275 is not set +# CONFIG_SENSORS_LM25066 is not set +# CONFIG_SENSORS_LTC2978 is not set +# CONFIG_SENSORS_MAX16064 is not set +# CONFIG_SENSORS_MAX34440 is not set +CONFIG_SENSORS_DNI_DPS460=y +# CONFIG_SENSORS_MAX8688 is not set +# CONFIG_SENSORS_UCD9000 is not set +CONFIG_SENSORS_UCD9200=y +# CONFIG_SENSORS_ZL6100 is not set # CONFIG_SENSORS_SHT15 is not set # CONFIG_SENSORS_SHT21 is not set # CONFIG_SENSORS_SHTC1 is not set @@ -2648,7 +2660,20 @@ CONFIG_LEDS_CLASS=y # # LED Triggers # -# CONFIG_LEDS_TRIGGERS is not set +CONFIG_LEDS_TRIGGERS=y +CONFIG_LEDS_TRIGGER_TIMER=y +# CONFIG_LEDS_TRIGGER_ONESHOT is not set +# CONFIG_LEDS_TRIGGER_HEARTBEAT is not set +# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set +# CONFIG_LEDS_TRIGGER_CPU is not set +CONFIG_LEDS_TRIGGER_GPIO=y +# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set + +# +# iptables trigger is under Netfilter config (LED target) +# +# CONFIG_LEDS_TRIGGER_TRANSIENT is not set +# CONFIG_LEDS_TRIGGER_CAMERA is not set # CONFIG_ACCESSIBILITY is not set # CONFIG_INFINIBAND is not set # CONFIG_EDAC is not set diff --git a/packages/base/any/kernels/3.16+deb8/patches/driver-at24-fix-odd-length-two-byte-access.patch b/packages/base/any/kernels/3.16+deb8/patches/driver-at24-fix-odd-length-two-byte-access.patch index 709220f3..6060b15e 100644 --- a/packages/base/any/kernels/3.16+deb8/patches/driver-at24-fix-odd-length-two-byte-access.patch +++ b/packages/base/any/kernels/3.16+deb8/patches/driver-at24-fix-odd-length-two-byte-access.patch @@ -1,29 +1,18 @@ -driver at24 fix odd length two byte access - -From: Cumulus Networks - -For I2C_SMBUS_WORD_DATA read accesses check if the access length is -one or two bytes. For transactions that have an odd length eventualy -we read 1 byte at the end to complete the request. - -The previous code always used a count of 2, which works fine if the -requested total length is even. If the requested length was odd, -however, the code would cause a kernel OOPS. - -The while (count) loop would go forever as count went from 1 to -1, -never becoming zero. Also the return buffer would overrun. - -This patch allows for reading an odd number of bytes in -I2C_SMBUS_WORD_DATA mode. ---- - drivers/misc/eeprom/at24.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c -index d87f77f..9e9256a 100644 ---- a/drivers/misc/eeprom/at24.c -+++ b/drivers/misc/eeprom/at24.c -@@ -192,7 +192,8 @@ static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, +--- a/drivers/misc/eeprom/at24.c 2016-10-06 12:45:49.290365545 +0000 ++++ b/drivers/misc/eeprom/at24.c 2016-10-06 12:47:08.630368526 +0000 +@@ -84,9 +84,9 @@ + * + * This value is forced to be a power of two so that writes align on pages. + */ +-static unsigned io_limit = 128; ++static unsigned io_limit = 32; + module_param(io_limit, uint, 0); +-MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 128)"); ++MODULE_PARM_DESC(io_limit, "Maximum bytes per I/O (default 32)"); + + /* + * Specs often allow 5 msec for a page write, sometimes 20 msec; +@@ -192,7 +192,8 @@ count = I2C_SMBUS_BLOCK_MAX; break; case I2C_SMBUS_WORD_DATA: @@ -33,7 +22,7 @@ index d87f77f..9e9256a 100644 break; case I2C_SMBUS_BYTE_DATA: count = 1; -@@ -237,7 +238,8 @@ static ssize_t at24_eeprom_read(struct at24_data *at24, char *buf, +@@ -237,7 +238,8 @@ status = i2c_smbus_read_word_data(client, offset); if (status >= 0) { buf[0] = status & 0xff; From a7d7dea1b5799f5f07f2432b361d210dc791655c Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Fri, 14 Oct 2016 18:07:35 +0000 Subject: [PATCH 08/28] Latest --- packages/platforms-closed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platforms-closed b/packages/platforms-closed index feff1c37..fe6a4b28 160000 --- a/packages/platforms-closed +++ b/packages/platforms-closed @@ -1 +1 @@ -Subproject commit feff1c37eb206ac0fc3b8bcb5ab3514b693ed2df +Subproject commit fe6a4b286335b1a286e41c562cff4a95a5497c2c From ea397909e55c7b854e7d4a22c83d1c1123cbca9d Mon Sep 17 00:00:00 2001 From: Sridhar Pitchai Date: Fri, 14 Oct 2016 16:36:45 -0700 Subject: [PATCH 09/28] Platform x86-64-agema-agc7648 without ONLP (#113) --- packages/platforms/agema/Makefile | 1 + .../platforms/agema/vendor-config/Makefile | 1 + .../platforms/agema/vendor-config/PKG.yml | 1 + .../src/python/agema/__init__.py | 7 ++++ packages/platforms/agema/x86-64/Makefile | 1 + .../x86-64/x86-64-agema-agc7648/Makefile | 1 + .../x86-64/x86-64-agema-agc7648/onlp/Makefile | 1 + .../x86-64/x86-64-agema-agc7648/onlp/PKG.yml | 15 ++++++++ .../platform-config/Makefile | 1 + .../platform-config/r0/Makefile | 1 + .../platform-config/r0/PKG.yml | 1 + .../r0/src/lib/x86-64-agc7648-r0.yml | 35 +++++++++++++++++++ .../src/python/x86_64_agc7648_r0/__init__.py | 8 +++++ 13 files changed, 74 insertions(+) create mode 100644 packages/platforms/agema/Makefile create mode 100644 packages/platforms/agema/vendor-config/Makefile create mode 100644 packages/platforms/agema/vendor-config/PKG.yml create mode 100644 packages/platforms/agema/vendor-config/src/python/agema/__init__.py create mode 100644 packages/platforms/agema/x86-64/Makefile create mode 100644 packages/platforms/agema/x86-64/x86-64-agema-agc7648/Makefile create mode 100644 packages/platforms/agema/x86-64/x86-64-agema-agc7648/onlp/Makefile create mode 100644 packages/platforms/agema/x86-64/x86-64-agema-agc7648/onlp/PKG.yml create mode 100644 packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/Makefile create mode 100644 packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/Makefile create mode 100644 packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/PKG.yml create mode 100644 packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/src/lib/x86-64-agc7648-r0.yml create mode 100644 packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/src/python/x86_64_agc7648_r0/__init__.py diff --git a/packages/platforms/agema/Makefile b/packages/platforms/agema/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/agema/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/agema/vendor-config/Makefile b/packages/platforms/agema/vendor-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/agema/vendor-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/agema/vendor-config/PKG.yml b/packages/platforms/agema/vendor-config/PKG.yml new file mode 100644 index 00000000..9cc81777 --- /dev/null +++ b/packages/platforms/agema/vendor-config/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-vendor.yml VENDOR=agema Vendor=Agema diff --git a/packages/platforms/agema/vendor-config/src/python/agema/__init__.py b/packages/platforms/agema/vendor-config/src/python/agema/__init__.py new file mode 100644 index 00000000..5e56e4a9 --- /dev/null +++ b/packages/platforms/agema/vendor-config/src/python/agema/__init__.py @@ -0,0 +1,7 @@ +#!/usr/bin/python + +from onl.platform.base import * + +class OnlPlatformAgema(OnlPlatformBase): + MANUFACTURER='Agema' + PRIVATE_ENTERPRISE_NUMBER=65530 diff --git a/packages/platforms/agema/x86-64/Makefile b/packages/platforms/agema/x86-64/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/agema/x86-64/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/agema/x86-64/x86-64-agema-agc7648/Makefile b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/Makefile new file mode 100644 index 00000000..dc1e7b86 --- /dev/null +++ b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk diff --git a/packages/platforms/agema/x86-64/x86-64-agema-agc7648/onlp/Makefile b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/onlp/Makefile new file mode 100644 index 00000000..dc1e7b86 --- /dev/null +++ b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/onlp/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk diff --git a/packages/platforms/agema/x86-64/x86-64-agema-agc7648/onlp/PKG.yml b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/onlp/PKG.yml new file mode 100644 index 00000000..46f47033 --- /dev/null +++ b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/onlp/PKG.yml @@ -0,0 +1,15 @@ +variables: + platform: x86-64-agc7648-r0 + install: /lib/platform-config/${platform}/onl + +common: + version: 1.0.0 + arch: amd64 + copyright: Copyright 2013, 2014, 2015 Big Switch Networks + maintainer: support@bigswitch.com + comment: dummy package for ONLP on Wedge +packages: + - name: onlp-${platform} + summary: ONLP Package for the ${platform} platform. + + changelog: initial version diff --git a/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/Makefile b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/Makefile new file mode 100644 index 00000000..dc1e7b86 --- /dev/null +++ b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk diff --git a/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/Makefile b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/Makefile new file mode 100644 index 00000000..dc1e7b86 --- /dev/null +++ b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk diff --git a/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/PKG.yml b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/PKG.yml new file mode 100644 index 00000000..e1d73496 --- /dev/null +++ b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=agema PLATFORM=x86-64-agc7648-r0 diff --git a/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/src/lib/x86-64-agc7648-r0.yml b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/src/lib/x86-64-agc7648-r0.yml new file mode 100644 index 00000000..79300f3f --- /dev/null +++ b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/src/lib/x86-64-agc7648-r0.yml @@ -0,0 +1,35 @@ +--- + +###################################################################### +# +# platform-config for x86_64-agc7648-r0 +# +# +###################################################################### + +x86-64-agc7648-r0: + + grub: + + serial: >- + --port=0x3f8 + --speed=115200 + --word=8 + --parity=0 + --stop=1 + + kernel: + <<: *kernel-3-18 + + args: >- + nopat + console=ttyS0,57600n8 + rd_NO_MD + rd_NO_LUKS + intel_iommu=off + + ##network + ## interfaces: + ## ma1: + ## name: ~ + ## syspath: pci0000:00/0000:00:14.0 diff --git a/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/src/python/x86_64_agc7648_r0/__init__.py b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/src/python/x86_64_agc7648_r0/__init__.py new file mode 100644 index 00000000..15e7d82b --- /dev/null +++ b/packages/platforms/agema/x86-64/x86-64-agema-agc7648/platform-config/r0/src/python/x86_64_agc7648_r0/__init__.py @@ -0,0 +1,8 @@ +from onl.platform.base import * +from onl.platform.accton import * + +class OnlPlatform_x86_64_agc7648_r0(OnlPlatformAgema, + OnlPlatformPortConfig_48x10_6x40): + MODEL="agc7648" + PLATFORM="x86-64-agc7648-r0" + SYS_OBJECT_ID=".7648.1" From 9f5633a7c062e6dd1c3536d9f9b646533c2bcfce Mon Sep 17 00:00:00 2001 From: Charlie Lewis Date: Fri, 14 Oct 2016 16:37:51 -0700 Subject: [PATCH 10/28] improve formatting of markdown for readibility (#108) --- docs/Building.md | 49 +++++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/docs/Building.md b/docs/Building.md index e66ab7ad..693f83b5 100644 --- a/docs/Building.md +++ b/docs/Building.md @@ -41,17 +41,17 @@ 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 + #> docker/tools/onlbuilder (-8) # enter the docker workspace #> apt-cacher-ng - #> source setup.env # pull in necessary environment variables + #> 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 -$ONL/RELEASE/$SUITE/$ARCH/ONL-2.*INSTALLER, i.e. -RELEASE/jessie/amd64/ONL-2.0.0_ONL-OS_2015-12-12.0252-ffce159_AMD64_INSTALLER +`$ONL/RELEASE/$SUITE/$ARCH/ONL-2.*INSTALLER`, i.e. +`RELEASE/jessie/amd64/ONL-2.0.0_ONL-OS_2015-12-12.0252-ffce159_AMD64_INSTALLER` and the SWI files (if you want them) are in -$ONL/RELEASE/$SUITE/$ARCH/ONL*.swi. i.e. -RELEASE/jessie/amd64/ONL-2.0.0_ONL-OS_2015-12-12.0252-ffce159_AMD64.swi +`$ONL/RELEASE/$SUITE/$ARCH/ONL*.swi`. i.e. +`RELEASE/jessie/amd64/ONL-2.0.0_ONL-OS_2015-12-12.0252-ffce159_AMD64.swi` @@ -69,13 +69,13 @@ Common docker related issues: - Beware that `apt-get install docker` installs a dock application not docker :-) You want the lxc-docker package instead. - Some versions of docker are unhappy if you use a local DNS caching resolver: - e.g., you have 127.0.0.1 in your /etc/resolv.conf - - if you have this, specify DNS="--dns 8.8.8.8" when you enter the docker environment + - if you have this, specify `DNS="--dns 8.8.8.8"` when you enter the docker environment - e.g., `make DNS="--dns 8.8.8.8" docker` Consider enabling builds for non-privileged users with: - `sudo usermod -aG docker $USER` -- If you run as non-root without this, you will get errors like "..: dial unix /var/run/docker.sock: permission denied" +- If you run as non-root without this, you will get errors like `..: dial unix /var/run/docker.sock: permission denied` - Building as root is fine as well (it immediately jumps into a root build shell), so this optional #Additional Build Details @@ -134,43 +134,47 @@ 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 @@ -182,21 +186,24 @@ 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: From a994cdb4eb85f526ef15bfb0b2181c88a6226759 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Tue, 18 Oct 2016 11:30:47 -0700 Subject: [PATCH 11/28] Latest --- packages/platforms-closed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platforms-closed b/packages/platforms-closed index fe6a4b28..5ae11894 160000 --- a/packages/platforms-closed +++ b/packages/platforms-closed @@ -1 +1 @@ -Subproject commit fe6a4b286335b1a286e41c562cff4a95a5497c2c +Subproject commit 5ae11894fd5667434ad8ce5e7ae4b17eaf06567b From a6aba0a15f8781584dfbe592ef2617b7da17f11d Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 19 Oct 2016 14:54:11 +0000 Subject: [PATCH 12/28] Generalize to all exceptions. --- .../all/vendor-config-onl/src/python/onl/install/BaseInstall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/base/all/vendor-config-onl/src/python/onl/install/BaseInstall.py b/packages/base/all/vendor-config-onl/src/python/onl/install/BaseInstall.py index eb25aa9f..bb60b0b7 100644 --- a/packages/base/all/vendor-config-onl/src/python/onl/install/BaseInstall.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/install/BaseInstall.py @@ -686,7 +686,7 @@ class UbootInstaller(SubprocessMixin, Base): return 0 self.log.warn("disk %s has wrong label %s", self.device, self.partedDisk.type) - except parted._ped.PartedException as ex: + except Exception as ex: self.log.error("cannot get partition table from %s: %s", self.device, str(ex)) From da76d91d182dc6d338968820e246edaf7c4a7342 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Wed, 19 Oct 2016 10:14:43 -0700 Subject: [PATCH 13/28] Updates docs for Wedge to include Wedge 100 (#115) --- docs/Building.md | 8 ++++---- docs/GettingStartedWedge.md | 31 ++++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/docs/Building.md b/docs/Building.md index 693f83b5..f4c02f7a 100644 --- a/docs/Building.md +++ b/docs/Building.md @@ -105,8 +105,8 @@ Adding/Removing packages from a SWI: The list of packages for a given SWI are in - $ONL/packages/base/any/rootfs/common/$ARCH-packages.yml # for $ARCH specific packages - $ONL/packages/base/any/rootfs/common/common-packages.yml # for $ARCH-independent packages + $ONL/packages/base/any/rootfs/$suite/common/$ARCH-packages.yml # for $ARCH specific packages + $ONL/packages/base/any/rootfs/$suite/common/common-packages.yml # for $ARCH-independent packages Build a software image (SWI) for all powerpc platforms: ------------------------------------------------------------ @@ -190,9 +190,9 @@ This message shows that your installation appears to be working correctly. Add yourself to the docker group: ``` -sudo gpasswd -a snoble docker +sudo gpasswd -a user1 docker -Adding user snoble to group docker +Adding user user1 to group docker ``` logout and log back in for the group to take effect: diff --git a/docs/GettingStartedWedge.md b/docs/GettingStartedWedge.md index 42fe39c9..2bfcd926 100644 --- a/docs/GettingStartedWedge.md +++ b/docs/GettingStartedWedge.md @@ -9,17 +9,20 @@ Once installed, ONL has a default account ("root") with a default password the root password before the system comes up. You will need to enable the network interface before you can run the FBOSS agent. -FBOSS is installed and set to run the configuration created for a OCP ONL +On the Wedge 40 FBOSS is installed and set to run the configuration created for a OCP ONL on Wedge Demo. This configuration sets up the first physical QSFP port of the wedge as 4 10G ports (via a break out cable) and configures vlans and ip addresses on them. +On the Wedge 100 FBOSS is installed and set to run a generic configuration that breaks all +ports into 25G (each 100G port is broken into 4 ports for a total of 128 ports) + ONIE Manual Install ------------------------------------------------ If your Accton Wedge does not have ONIE installed, you will need to install it before you can proceed. -1) Download the ONIE rescue image from http://opennetlinux.org/binaries/accton-wedge/onie-recovery-x86_64-accton_wedge_16x-r0.iso +1) Download the ONIE rescue image for the Wedge 40 from http://opennetlinux.org/binaries/accton-wedge/onie-recovery-x86_64-accton_wedge_16x-r0.iso for the Wedge 100 it is http://opennetlinux.org/binaries/accton-wedge/onie-recovery-x86-64-facebook-wedge100-r0.iso 2) Burn the image onto a USB (a USB with a minimum size of 256M is necessary) @@ -40,8 +43,8 @@ configuration menu linux installation, you will need to either reboot (if possible) or hit ctrl-x, exiting to the BMC and issue the "wedge_power reset" command to power-cycle the microserver, run sol.sh again and hit F2 when the BIOS status screen appears -10) One you are in the BIOS configuration, move to the boot screen and change -the boot mode from UEFI to Legacy +10) For the Wedge 40 Once you are in the BIOS configuration, move to the boot screen and change +the boot mode from UEFI to Legacy. For the Wedge 100 you will choose the non UEFI version of your USB disk. 11) In the boot device list, make sure that the USB is set to #1 @@ -56,13 +59,15 @@ reboot 16) *IMPORTANT* Remove the USB from the system before proceeding to the ONL install +17) On the Wedge 100 go back into the BIOS and set device P0 to be the main boot drive. + ONL Manual Install ------------------------------------------------ 1) Attach a serial terminal to the wedge 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-2.0.installer" +3) From the ONIE# prompt run "install_url http://opennetlinux.org/binaries/latest-DEB8-AMD64-installed.installer" 4) Wait for the install to finish and the system to reboot @@ -72,18 +77,23 @@ password "onl" 6) Configure the ma1 interface either via dhcp (dhclient ma1) or manually 7) Install fboss using the commands - + + For the Wedge 40 #> apt-get update #> apt-get install fboss + Or for the Wedge 100 + #> apt-get install fboss-w100 + 8) From the command prompt you can start fboss by using the command "service fboss_wedge_agent start" -9) The first time you start the fboss_wedge_agent service it will download -the OpenNSL library from the Broadcom github account. +9) On the Wedge 40 The first time you start the fboss_wedge_agent service it will download +the OpenNSL library from the Broadcom github account. On the Wedge 100, it OpenNSL is included +as a package. 10) Once the library is installed, fboss_wedge_agent will start, using the -default configuration located at /etc/fboss/ocp-demo.json +default configuration located at /etc/fboss/ocp-demo.json for the Wedge 40 or /etc/fboss/sample_config.json for the Wedge 100 11) You can confirm that the fboss_wedge_agent is running by issuing the command "service fboss_wedge_agent status" @@ -94,6 +104,9 @@ command "service fboss_wedge_agent status" Modifying The fboss_wedge_agent configuration ------------------------------------------------ + +The rest of this document is based on the Wedge 40 but the Wedge 100 is similar. + In the /etc/init.d/fboss_wedge_agent script, you will locate a section where the configuration file "FBOSS_DAEMON_OPTIONS" is set: From bbf09f51f3ae5e78913305af51ef33e53d2276f9 Mon Sep 17 00:00:00 2001 From: Sridhar Pitchai Date: Wed, 19 Oct 2016 10:15:03 -0700 Subject: [PATCH 14/28] Platform x86-64-alphanetworks-snx60a0-486f-r0 (#114) Fixing the console port --- .../r0/src/lib/x86-64-alphanetworks-snx60a0-486f-r0.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/platforms/alphanetworks/x86-64-alphanetworks-snx60a0-486f/platform-config/r0/src/lib/x86-64-alphanetworks-snx60a0-486f-r0.yml b/packages/platforms/alphanetworks/x86-64-alphanetworks-snx60a0-486f/platform-config/r0/src/lib/x86-64-alphanetworks-snx60a0-486f-r0.yml index d55b1cc0..abd98158 100644 --- a/packages/platforms/alphanetworks/x86-64-alphanetworks-snx60a0-486f/platform-config/r0/src/lib/x86-64-alphanetworks-snx60a0-486f-r0.yml +++ b/packages/platforms/alphanetworks/x86-64-alphanetworks-snx60a0-486f/platform-config/r0/src/lib/x86-64-alphanetworks-snx60a0-486f-r0.yml @@ -10,7 +10,7 @@ x86-64-alphanetworks-snx60a0-486f-r0: grub: serial: >- - --port=0x3f8 + --port=0x2f8 --speed=115200 --word=8 --parity=no @@ -21,5 +21,4 @@ x86-64-alphanetworks-snx60a0-486f-r0: args: >- nopat - console=ttyS0,115200n8 - + console=ttyS1,115200n8 From 6a97f85532f074032290ce6fba8448df39f825e8 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 19 Oct 2016 21:34:54 +0000 Subject: [PATCH 15/28] Onie and Loader infrastructure improvements - Loader and ONIE moved to importable classes for tool usage - OnieUpgradeBase updated. --- .../src/python/onl/upgrade/loader.py | 121 ++++++++++++++++++ .../src/python/onl/upgrade/onie.py | 59 +++++++++ .../src/python/onl/upgrade/ubase.py | 47 +++---- 3 files changed, 204 insertions(+), 23 deletions(-) create mode 100755 packages/base/all/vendor-config-onl/src/python/onl/upgrade/loader.py create mode 100755 packages/base/all/vendor-config-onl/src/python/onl/upgrade/onie.py diff --git a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/loader.py b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/loader.py new file mode 100755 index 00000000..10df045e --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/loader.py @@ -0,0 +1,121 @@ +#!/usr/bin/python +############################################################ +# +# ONL Loader Upgrade +# +############################################################ +import os +import sys +import fnmatch + +from onl.upgrade import ubase +from onl.sysconfig import sysconfig +from onl.mounts import OnlMountManager, OnlMountContextReadOnly, OnlMountContextReadWrite + +class LoaderUpgradeBase(ubase.BaseUpgrade): + name="loader" + Name="Loader" + title="Loader Upgrade Check" + atype="A Loader" + + current_version_key="Current Loader Version" + next_version_key="Next Loader Version" + + def auto_upgrade_default(self): + return sysconfig.upgrade.loader.auto + + def init_versions(self): + + # + # Current Loader version file. + # If this file doesn't exist then in-place upgrade is not supported. + # + ETC_LOADER_VERSIONS_JSON = sysconfig.upgrade.loader.versions + + # Upgrade Loader Version file. + NEXT_LOADER_VERSIONS_JSON = os.path.join(sysconfig.upgrade.loader.package.dir, "manifest.json") + + + self.current_version = self.load_json(ETC_LOADER_VERSIONS_JSON, + "RELEASE_ID", + None) + + self.next_version = self.load_json(NEXT_LOADER_VERSIONS_JSON, + "version", {}).get('RELEASE_ID', None) + + def summarize(self): + self.logger.info("Current Loader Version: %s" % self.current_version) + self.logger.info(" Next Loader Version: %s" % self.next_version) + self.logger.info("") + + + def upgrade_notes(self): + return """ + * A single reboot will be required to complete this upgrade. +""" + + +class LoaderUpgrade_Fit(LoaderUpgradeBase): + + def do_upgrade(self, forced=False): + + fit_image = None + for f in sysconfig.upgrade.loader.package.fit: + fp = os.path.join(sysconfig.upgrade.loader.package.dir, f) + if os.path.exists(fp): + fit_image = fp; + break + + if fit_image is None: + self.abort("The FIT upgrade image is missing. Upgrade cannot continue.") + + with OnlMountContextReadWrite("ONL-BOOT", self.logger) as d: + self.copyfile(fit_image, os.path.join(d.directory, "%s.itb" % (self.platform.platform()))) + + self.reboot() + + +class LoaderUpgrade_x86_64(LoaderUpgradeBase): + + def do_upgrade(self, forced=False): + + X86_64_UPGRADE_DIR=sysconfig.upgrade.loader.package.dir + X86_64_UPGRADE_KERNEL_PATTERNS = [ "kernel-*" ] + + with OnlMountContextReadWrite("ONL-BOOT", self.logger) as d: + for f in os.listdir(X86_64_UPGRADE_DIR): + for pattern in X86_64_UPGRADE_KERNEL_PATTERNS: + if fnmatch.fnmatch(f, pattern): + self.copyfile(os.path.join(X86_64_UPGRADE_DIR, f), os.path.join(d.directory, f)) + + initrd = None + for c in sysconfig.upgrade.loader.package.grub: + initrd = os.path.join(X86_64_UPGRADE_DIR, c) + if os.path.exists(initrd): + break + else: + initrd = None + + if initrd: + self.copyfile(initrd, os.path.join(d.directory, "%s.cpio.gz" % self.platform.platform())) + else: + self.abort("Initrd is missing. Upgrade cannot continue.") + + # Disabled until it can be resolved with the new installer. + #src = "/lib/platform-config/current/onl/boot/grub.cfg" + #dst = os.path.join(d.directory, "grub/grub.cfg") + #if os.path.exists(src): + # self.copyfile(src, dst) + + self.reboot() + + +import platform +arch = platform.machine() +LoaderUpgrade = None + +if arch in [ 'ppc', 'armv7l', 'aarch64', 'arm64' ]: + LoaderUpgrade = LoaderUpgrade_Fit +elif arch == 'x86_64': + LoaderUpgrade = LoaderUpgrade_x86_64 + diff --git a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/onie.py b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/onie.py new file mode 100755 index 00000000..a4f6beb2 --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/onie.py @@ -0,0 +1,59 @@ +#!/usr/bin/python -u + +import os +import sys + +from onl.upgrade import ubase +from onl.sysconfig import sysconfig +from onl.mounts import OnlMountManager, OnlMountContextReadOnly, OnlMountContextReadWrite + +class OnieUpgrade(ubase.BaseOnieUpgrade): + + name="onie" + Name="ONIE" + title="ONIE Upgrade Check" + atype="An ONIE" + + current_version_key="Current ONIE Version" + next_version_key="Next ONIE Version" + + def init_versions(self): + + # Get the current platform ONIE version + self.current_version = self.platform.onie_version() + self.next_version = None + self.updater = None + + self.manifest = self.load_json(os.path.join(sysconfig.upgrade.onie.package.dir, "manifest.json")) + + if self.manifest is None: + self.finish("No ONIE updater available for the current platform.") + + if 'onie-version' not in self.manifest: + self.finish("No ONIE version in the upgrade manifest.") + else: + self.next_version = self.manifest['onie-version'] + + if 'onie-updater' not in self.manifest: + self.finish("No ONIE updater in the upgrade manifest.") + + + def summarize(self): + self.logger.info("Current ONIE Version: %s" % self.current_version) + self.logger.info(" Next ONIE Version: %s" % self.manifest.get('onie-version')) + self.logger.info(" Updater: %s" % self.manifest.get('onie-updater')) + self.logger.info("") + + def upgrade_notes(self): + return """ + * The system will reboot into ONIE to complete the update, and then reboot to return to Switch Light +""" + + def do_upgrade(self, forced=False): + self.install_onie_updater(sysconfig.upgrade.onie.package.dir, + self.manifest['onie-updater']) + self.initiate_onie_update() + + def do_no_upgrade(self): + self.clean_onie_updater() + diff --git a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py index 68f3828f..af2b677d 100644 --- a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py @@ -15,7 +15,9 @@ import string import argparse import yaml from time import sleep + from onl.platform.current import OnlPlatform +from onl.mounts import OnlMountManager, OnlMountContextReadOnly, OnlMountContextReadWrite class BaseUpgrade(object): @@ -365,19 +367,19 @@ If you choose not to perform this upgrade booting cannot continue.""" % self.aty class BaseOnieUpgrade(BaseUpgrade): - ONIE_UPDATER_PATH = "/mnt/flash2/onie-updater" + ONIE_UPDATER_CONTEXT = "ONL-IMAGES" + ONIE_UPDATER_PATH = "/mnt/onl/images" def install_onie_updater(self, src_dir, updater): - if type(updater) is list: - # Copy all files in the list to /mnt/flash2 + with OnlMountContextReadWrite(self.ONIE_UPDATER_CONTEXT, logger=None): + if type(updater) is not list: + updater = [ updater ] + + # Copy all files in the list to ONIE_UPDATER_PATH for f in updater: src = os.path.join(src_dir, f) - dst = os.path.join("/mnt/flash2", f) + dst = os.path.join(self.ONIE_UPDATER_PATH, f) self.copyfile(src, dst) - else: - # Copy single updater to /mnt/flash2/onie-updater - src = os.path.join(src_dir, updater) - self.copyfile(src, self.ONIE_UPDATER_PATH) def initiate_onie_update(self): @@ -394,27 +396,26 @@ class BaseOnieUpgrade(BaseUpgrade): self.abort("Could not set ONIE Boot Mode to Update. Upgrade cannot continue.") self.umount(OB) - SL = "/mnt/sl-boot" - self.mount(SL, label="SL-BOOT") - with open("/mnt/sl-boot/grub/grub.cfg", "a") as f: - f.write("set default=ONIE\n") - self.umount(SL) + with OnlMountContextReadWrite("ONL-BOOT", logger=None): + with open("/mnt/onl/boot/grub/grub.cfg", "a") as f: + f.write("set default=ONIE\n") self.reboot() else: self.abort("Architecture %s unhandled." % self.arch) def clean_onie_updater(self): - if os.path.exists(self.ONIE_UPDATER_PATH): - self.logger.info("Removing previous onie-updater.") - os.remove(self.ONIE_UPDATER_PATH) + with OnlMountContextReadWrite(self.ONIE_UPDATER_CONTEXT, logger=None): + updater = os.path.join(self.ONIE_UPDATER_PATH, "onie-updater") + if os.path.exists(updater): + self.logger.info("Removing previous onie-updater.") + os.remove(updater) - -def upgrade_status(): - data = {} - if os.path.exists(BaseUpgrade.UPGRADE_STATUS_JSON): - with open(BaseUpgrade.UPGRADE_STATUS_JSON) as f: - data = json.load(f) - return data +# def upgrade_status(): +# data = {} +# if os.path.exists(BaseUpgrade.UPGRADE_STATUS_JSON): +# with open(BaseUpgrade.UPGRADE_STATUS_JSON) as f: +# data = json.load(f) +# return data From 23e6922e7191681ed79fb8ac4ea196cb9ac0b813 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 19 Oct 2016 21:36:00 +0000 Subject: [PATCH 16/28] Add default ONIE upgrade package settings. --- .../src/boot.d/60.upgrade-onie | 3 + .../src/boot.d/61.upgrade-onie | 55 -------- .../src/boot.d/62.upgrade-loader | 129 +----------------- .../src/etc/onl/sysconfig/00-defaults.yml | 3 + 4 files changed, 8 insertions(+), 182 deletions(-) create mode 100755 packages/base/all/vendor-config-onl/src/boot.d/60.upgrade-onie delete mode 100755 packages/base/all/vendor-config-onl/src/boot.d/61.upgrade-onie diff --git a/packages/base/all/vendor-config-onl/src/boot.d/60.upgrade-onie b/packages/base/all/vendor-config-onl/src/boot.d/60.upgrade-onie new file mode 100755 index 00000000..a6daef06 --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/boot.d/60.upgrade-onie @@ -0,0 +1,3 @@ +#!/usr/bin/python +from onl.upgrade.onie import OnieUpgrade +OnieUpgrade().main() diff --git a/packages/base/all/vendor-config-onl/src/boot.d/61.upgrade-onie b/packages/base/all/vendor-config-onl/src/boot.d/61.upgrade-onie deleted file mode 100755 index 5f0e8883..00000000 --- a/packages/base/all/vendor-config-onl/src/boot.d/61.upgrade-onie +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/python -u -from onl.upgrade import ubase - -class ONIE_Upgrade(ubase.BaseOnieUpgrade): - name="onie" - Name="ONIE" - title="ONIE Upgrade Check" - atype="An ONIE" - - current_version_key="Current ONIE Version" - next_version_key="Next ONIE Version" - - def init_versions(self): - - # Get the current platform ONIE version - self.current_version = self.platform.onie_version() - self.next_version = None - self.updater = None - - (udir, um, data) = self.platform.upgrade_manifest("onie") - self.udir = udir - self.data = data - - if data: - self.next_version = data.get('onie-version', None) - - if data: - self.updater = data.get('onie-updater', None) - - if self.updater is None: - self.finish("No ONIE updater available for the current platform.") - - def summarize(self): - self.logger.info("Current ONIE Version: %s" % self.current_version) - self.logger.info(" Next ONIE Version: %s" % self.next_version) - self.logger.info(" Force-Update: %s" % self.data['force-update']) - self.logger.info(" Updater: %s" % self.updater) - self.logger.info("") - - def upgrade_notes(self): - return """ - * The system will reboot into ONIE to complete the update, and then reboot to return to Switch Light -""" - - def do_upgrade(self, forced=False): - self.install_onie_updater(self.udir, self.updater) - self.initiate_onie_update() - - def do_no_upgrade(self): - self.clean_onie_updater() - - -if __name__ == '__main__': - ONIE_Upgrade().main() - diff --git a/packages/base/all/vendor-config-onl/src/boot.d/62.upgrade-loader b/packages/base/all/vendor-config-onl/src/boot.d/62.upgrade-loader index afe514df..02aa6d92 100755 --- a/packages/base/all/vendor-config-onl/src/boot.d/62.upgrade-loader +++ b/packages/base/all/vendor-config-onl/src/boot.d/62.upgrade-loader @@ -1,128 +1,3 @@ #!/usr/bin/python -############################################################ -# -# ONL Loader Upgrade -# -############################################################ -import os -import sys -import fnmatch -from onl.upgrade import ubase -from onl.sysconfig import sysconfig -from onl.mounts import OnlMountManager, OnlMountContextReadOnly, OnlMountContextReadWrite - -class Loader_Upgrade(ubase.BaseUpgrade): - name="loader" - Name="Loader" - title="Loader Upgrade Check" - atype="A Loader" - - current_version_key="Current Loader Version" - next_version_key="Next Loader Version" - - def auto_upgrade_default(self): - return sysconfig.upgrade.loader.auto - - def init_versions(self): - - # - # Current Loader version file. - # If this file doesn't exist then in-place upgrade is not supported. - # - ETC_LOADER_VERSIONS_JSON = sysconfig.upgrade.loader.versions - - # Upgrade Loader Version file. - NEXT_LOADER_VERSIONS_JSON = os.path.join(sysconfig.upgrade.loader.package.dir, "manifest.json") - - - self.current_version = self.load_json(ETC_LOADER_VERSIONS_JSON, - "RELEASE_ID", - None) - - self.next_version = self.load_json(NEXT_LOADER_VERSIONS_JSON, - "version", {}).get('RELEASE_ID', None) - - def summarize(self): - self.logger.info("Current Loader Version: %s" % self.current_version) - self.logger.info(" Next Loader Version: %s" % self.next_version) - self.logger.info("") - - - def upgrade_notes(self): - return """ - * A single reboot will be required to complete this upgrade. -""" - - -class Loader_Upgrade_FIT(Loader_Upgrade): - - def do_upgrade(self, forced=False): - - fit_image = None - for f in sysconfig.upgrade.loader.package.fit: - fp = os.path.join(sysconfig.upgrade.loader.package.dir, f) - if os.path.exists(fp): - fit_image = fp; - break - - if fit_image is None: - self.abort("The FIT upgrade image is missing. Upgrade cannot continue.") - - with OnlMountContextReadWrite("ONL-BOOT", self.logger) as d: - self.copyfile(fit_image, os.path.join(d.directory, "%s.itb" % (self.platform.platform()))) - - self.reboot() - - -class Loader_Upgrade_x86_64(Loader_Upgrade): - - def do_upgrade(self, forced=False): - - X86_64_UPGRADE_DIR=sysconfig.upgrade.loader.package.dir - X86_64_UPGRADE_KERNEL_PATTERNS = [ "kernel-*" ] - - with OnlMountContextReadWrite("ONL-BOOT", self.logger) as d: - for f in os.listdir(X86_64_UPGRADE_DIR): - for pattern in X86_64_UPGRADE_KERNEL_PATTERNS: - if fnmatch.fnmatch(f, pattern): - self.copyfile(os.path.join(X86_64_UPGRADE_DIR, f), os.path.join(d.directory, f)) - - initrd = None - for c in sysconfig.upgrade.loader.package.grub: - initrd = os.path.join(X86_64_UPGRADE_DIR, c) - if os.path.exists(initrd): - break - else: - initrd = None - - if initrd: - self.copyfile(initrd, os.path.join(d.directory, "%s.cpio.gz" % self.platform.platform())) - else: - self.abort("Initrd is missing. Upgrade cannot continue.") - - # Disabled until it can be resolved with the new installer. - #src = "/lib/platform-config/current/onl/boot/grub.cfg" - #dst = os.path.join(d.directory, "grub/grub.cfg") - #if os.path.exists(src): - # self.copyfile(src, dst) - - self.reboot() - - - - -if __name__ == '__main__': - import platform - - arch = platform.machine() - klass = None - - if arch in [ 'ppc', 'armv7l', 'aarch64', 'arm64' ]: - klass = Loader_Upgrade_FIT - elif arch == 'x86_64': - klass = Loader_Upgrade_x86_64 - else: - sys.stderr.write("Loader Upgrade: The current architecture (%s) is not supported for upgrade.\n" % arch) - - if klass: - klass().main() +from onl.upgrade.loader import LoaderUpgrade +LoaderUpgrade().main() diff --git a/packages/base/all/vendor-config-onl/src/etc/onl/sysconfig/00-defaults.yml b/packages/base/all/vendor-config-onl/src/etc/onl/sysconfig/00-defaults.yml index 6527b70d..be397533 100644 --- a/packages/base/all/vendor-config-onl/src/etc/onl/sysconfig/00-defaults.yml +++ b/packages/base/all/vendor-config-onl/src/etc/onl/sysconfig/00-defaults.yml @@ -19,6 +19,9 @@ installer: upgrade: onie: auto: advisory + package: + dir: /lib/platform-config/current/onl/upgrade/onie + loader: auto: advisory versions: /etc/onl/loader/versions.json From cbeb0f1192f099089249dfc57eae83b3fc7b9ca3 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Wed, 19 Oct 2016 21:51:01 -0700 Subject: [PATCH 17/28] Updates the Wedge 40 and 100 systems to use the 3.16 kernel (#117) --- .../platform-config/r0/src/lib/x86-64-accton-wedge-16x-r0.yml | 2 +- .../platform-config/r0/src/lib/x86-64-facebook-wedge100-r0.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/platforms/accton/x86-64/x86-64-accton-wedge-16x/platform-config/r0/src/lib/x86-64-accton-wedge-16x-r0.yml b/packages/platforms/accton/x86-64/x86-64-accton-wedge-16x/platform-config/r0/src/lib/x86-64-accton-wedge-16x-r0.yml index 133874d1..17765a92 100644 --- a/packages/platforms/accton/x86-64/x86-64-accton-wedge-16x/platform-config/r0/src/lib/x86-64-accton-wedge-16x-r0.yml +++ b/packages/platforms/accton/x86-64/x86-64-accton-wedge-16x/platform-config/r0/src/lib/x86-64-accton-wedge-16x-r0.yml @@ -18,7 +18,7 @@ x86-64-accton-wedge-16x-r0: --stop=1 kernel: - <<: *kernel-3-18 + <<: *kernel-3-16 args: >- nopat diff --git a/packages/platforms/accton/x86-64/x86-64-facebook-wedge100/platform-config/r0/src/lib/x86-64-facebook-wedge100-r0.yml b/packages/platforms/accton/x86-64/x86-64-facebook-wedge100/platform-config/r0/src/lib/x86-64-facebook-wedge100-r0.yml index fdcbd263..c80d99e7 100644 --- a/packages/platforms/accton/x86-64/x86-64-facebook-wedge100/platform-config/r0/src/lib/x86-64-facebook-wedge100-r0.yml +++ b/packages/platforms/accton/x86-64/x86-64-facebook-wedge100/platform-config/r0/src/lib/x86-64-facebook-wedge100-r0.yml @@ -18,7 +18,7 @@ x86-64-facebook-wedge100-r0: --stop=1 kernel: - <<: *kernel-3-18 + <<: *kernel-3-16 args: >- nopat From f61b2436f1f243263508737950c8e24564bfd236 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Thu, 20 Oct 2016 21:15:05 +0000 Subject: [PATCH 18/28] Commit the sysctl settings prior to first mount. --- packages/base/all/boot.d/src/50.initmounts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/base/all/boot.d/src/50.initmounts b/packages/base/all/boot.d/src/50.initmounts index 71f7410f..48717381 100755 --- a/packages/base/all/boot.d/src/50.initmounts +++ b/packages/base/all/boot.d/src/50.initmounts @@ -1,6 +1,10 @@ #!/bin/sh . /lib/lsb/init-functions + +# Apply the existing sysctl settings prior to first mount. +sysctl --quiet --system + log_action_begin_msg "Mounting filesystems..." onl-mounts -q mount all log_action_end_msg 0 From c227d90e8569074264497d77603a218dd1332cbb Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Thu, 20 Oct 2016 14:16:01 -0700 Subject: [PATCH 19/28] Add platform and firmware keys. --- .../vendor-config-onl/src/python/onl/platform/base.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/base/all/vendor-config-onl/src/python/onl/platform/base.py b/packages/base/all/vendor-config-onl/src/python/onl/platform/base.py index f9e0e20e..23163d29 100644 --- a/packages/base/all/vendor-config-onl/src/python/onl/platform/base.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/platform/base.py @@ -90,6 +90,10 @@ class OnieInfo(object): } +class PlatformInfo(object): + CPLD_VERSIONS='CPLD Versions' + + ############################################################ # # ONL Platform Base @@ -107,7 +111,7 @@ class OnlPlatformBase(object): def __init__(self): self.add_info_json("onie_info", "%s/onie-info.json" % self.basedir_onl(), OnieInfo, required=False) - self.add_info_json("platform_info", "%s/platform-info.json" % self.basedir_onl(), + self.add_info_json("platform_info", "%s/platform-info.json" % self.basedir_onl(), PlatformInfo, required=False) # Find the base platform config @@ -217,6 +221,9 @@ class OnlPlatformBase(object): def onie_version(self): return self.onie_info.ONIE_VERSION + def firmware_version(self): + return self.platform_info.CPLD_VERSIONS + def upgrade_manifest(self, type_, override_dir=None): if override_dir: m = os.path.join(override_dir, "manifest.json") From 09cb160ca6b17b630f4730d0f6fee8e55651953d Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Thu, 20 Oct 2016 21:18:24 +0000 Subject: [PATCH 20/28] Enable ONIE and Firmware Upgrade Package Support --- .../src/boot.d/61.upgrade-firmware | 3 ++ .../src/etc/onl/sysconfig/00-defaults.yml | 6 +++ .../src/python/onl/upgrade/firmware.py | 52 +++++++++++++++++++ .../src/python/onl/upgrade/onie.py | 33 +++--------- .../src/python/onl/upgrade/ubase.py | 22 +++++--- 5 files changed, 84 insertions(+), 32 deletions(-) create mode 100755 packages/base/all/vendor-config-onl/src/boot.d/61.upgrade-firmware create mode 100755 packages/base/all/vendor-config-onl/src/python/onl/upgrade/firmware.py diff --git a/packages/base/all/vendor-config-onl/src/boot.d/61.upgrade-firmware b/packages/base/all/vendor-config-onl/src/boot.d/61.upgrade-firmware new file mode 100755 index 00000000..aa23c80c --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/boot.d/61.upgrade-firmware @@ -0,0 +1,3 @@ +#!/usr/bin/python +from onl.upgrade.firmware import FirmwareUpgrade +FirmwareUpgrade().main() diff --git a/packages/base/all/vendor-config-onl/src/etc/onl/sysconfig/00-defaults.yml b/packages/base/all/vendor-config-onl/src/etc/onl/sysconfig/00-defaults.yml index be397533..5ec6effc 100644 --- a/packages/base/all/vendor-config-onl/src/etc/onl/sysconfig/00-defaults.yml +++ b/packages/base/all/vendor-config-onl/src/etc/onl/sysconfig/00-defaults.yml @@ -22,6 +22,11 @@ upgrade: package: dir: /lib/platform-config/current/onl/upgrade/onie + firmware: + auto: advisory + package: + dir: /lib/platform-config/current/onl/upgrade/firmware + loader: auto: advisory versions: /etc/onl/loader/versions.json @@ -36,6 +41,7 @@ upgrade: swi: auto: disabled + pki: key: name: key.pem diff --git a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/firmware.py b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/firmware.py new file mode 100755 index 00000000..e9a08088 --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/firmware.py @@ -0,0 +1,52 @@ +#!/usr/bin/python -u + +import os +import sys + +from onl.upgrade import ubase +from onl.sysconfig import sysconfig + +class FirmwareUpgrade(ubase.BaseOnieUpgrade): + + name="firmware" + Name="Firmware" + title="Firmware Upgrade Check" + atype="A firmware" + + current_version_key="Current Firmware Version" + next_version_key="Next Firmware Version" + + def init_versions(self): + + # Get the current platform firmware version + self.current_version = self.platform.firmware_version() + self.next_version = None + self.updater = None + self.load_manifest(os.path.join(sysconfig.upgrade.firmware.package.dir, "manifest.json")) + + def do_upgrade(self, forced=False): + self.install_onie_updater(sysconfig.upgrade.firmware.package.dir, + self.manifest['updater']) + self.initiate_onie_update() + + + def upgrade_notes(self): + notes = """ + * Two reboots will be required to complete this upgrade. + + * Do not turn the power off on this device until the upgrade is complete. + Disrupting power during the firmware upgrade may result in an unrecoverable system.""" + + duration = self.manifest.get("duration", None) + if duration: + notes = notes + """ + + * THIS UPGRADE WILL REQUIRE APPROXIMATELY %s MINUTES. + The system will reboot when completed.""" % duration + + return notes + + + def do_no_upgrade(self): + self.clean_onie_updater() + diff --git a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/onie.py b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/onie.py index a4f6beb2..fab08c0d 100755 --- a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/onie.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/onie.py @@ -5,7 +5,6 @@ import sys from onl.upgrade import ubase from onl.sysconfig import sysconfig -from onl.mounts import OnlMountManager, OnlMountContextReadOnly, OnlMountContextReadWrite class OnieUpgrade(ubase.BaseOnieUpgrade): @@ -23,37 +22,19 @@ class OnieUpgrade(ubase.BaseOnieUpgrade): self.current_version = self.platform.onie_version() self.next_version = None self.updater = None + self.load_manifest(os.path.join(sysconfig.upgrade.onie.package.dir, "manifest.json")) - self.manifest = self.load_json(os.path.join(sysconfig.upgrade.onie.package.dir, "manifest.json")) + def do_upgrade(self, forced=False): + self.install_onie_updater(sysconfig.upgrade.onie.package.dir, + self.manifest['updater']) + self.initiate_onie_update() - if self.manifest is None: - self.finish("No ONIE updater available for the current platform.") - - if 'onie-version' not in self.manifest: - self.finish("No ONIE version in the upgrade manifest.") - else: - self.next_version = self.manifest['onie-version'] - - if 'onie-updater' not in self.manifest: - self.finish("No ONIE updater in the upgrade manifest.") - - - def summarize(self): - self.logger.info("Current ONIE Version: %s" % self.current_version) - self.logger.info(" Next ONIE Version: %s" % self.manifest.get('onie-version')) - self.logger.info(" Updater: %s" % self.manifest.get('onie-updater')) - self.logger.info("") + def do_no_upgrade(self): + self.clean_onie_updater() def upgrade_notes(self): return """ * The system will reboot into ONIE to complete the update, and then reboot to return to Switch Light """ - def do_upgrade(self, forced=False): - self.install_onie_updater(sysconfig.upgrade.onie.package.dir, - self.manifest['onie-updater']) - self.initiate_onie_update() - - def do_no_upgrade(self): - self.clean_onie_updater() diff --git a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py index af2b677d..2b5f6c22 100644 --- a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py @@ -411,11 +411,21 @@ class BaseOnieUpgrade(BaseUpgrade): self.logger.info("Removing previous onie-updater.") os.remove(updater) + def load_manifest(self, path): + self.manifest = self.load_json(path) -# def upgrade_status(): -# data = {} -# if os.path.exists(BaseUpgrade.UPGRADE_STATUS_JSON): -# with open(BaseUpgrade.UPGRADE_STATUS_JSON) as f: -# data = json.load(f) -# return data + if self.manifest is None: + self.finish("No %s updater available for the current platform." % self.Name) + if 'version' not in self.manifest: + self.finish("No %s version in the upgrade manifest." % self.Name) + else: + self.next_version = self.manifest['version'] + + if 'updater' not in self.manifest: + self.finish("No %s updater in the upgrade manifest." % self.Name) + + def summarize(self): + self.logger.info("Current %s Version: %s" % (self.Name, self.current_version)) + self.logger.info(" Next %s Version: %s" % (self.Name, self.manifest.get('version'))) + self.logger.info("") From 71e0e08948cac789eb08e9b0cf85fc5da4a84700 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Fri, 21 Oct 2016 06:56:09 -0700 Subject: [PATCH 21/28] Latest --- packages/platforms-closed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platforms-closed b/packages/platforms-closed index 5ae11894..14f30a9e 160000 --- a/packages/platforms-closed +++ b/packages/platforms-closed @@ -1 +1 @@ -Subproject commit 5ae11894fd5667434ad8ce5e7ae4b17eaf06567b +Subproject commit 14f30a9e614fb075ae591838f9859eb1e3f188be From b3e2757b31f16c7e92d1504bcf9655227d6ea2ec Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Fri, 21 Oct 2016 16:02:32 +0000 Subject: [PATCH 22/28] Fix uninstallation. --- packages/base/all/vendor-config-onl/PKG.yml | 2 +- .../all/vendor-config-onl/src/sbin/uninstall | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+), 1 deletion(-) create mode 100755 packages/base/all/vendor-config-onl/src/sbin/uninstall diff --git a/packages/base/all/vendor-config-onl/PKG.yml b/packages/base/all/vendor-config-onl/PKG.yml index 3dc90ee8..0c0727bb 100644 --- a/packages/base/all/vendor-config-onl/PKG.yml +++ b/packages/base/all/vendor-config-onl/PKG.yml @@ -17,6 +17,6 @@ packages: - src/boot.d : /etc/boot.d - src/bin : /usr/bin - src/lib : /lib/vendor-config/onl - + - src/sbin : /sbin changelog: Changes diff --git a/packages/base/all/vendor-config-onl/src/sbin/uninstall b/packages/base/all/vendor-config-onl/src/sbin/uninstall new file mode 100755 index 00000000..8fe4742e --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/sbin/uninstall @@ -0,0 +1,59 @@ +#!/bin/sh +set -e + +uninstall_x86_64() +{ + # + # Set ONIE boot selection to uninstall + # + mkdir -p /mnt/onie-boot + mount -L ONIE-BOOT /mnt/onie-boot > /dev/null 2>&1 + + if [ "$1" = "factory" ]; then + /mnt/onie-boot/onie/tools/bin/onie-boot-mode -o uninstall + else + /mnt/onie-boot/onie/tools/bin/onie-boot-mode -o install + fi + + umount /mnt/onie-boot + + # + # Select ONIE as the boot default + # + onl-mounts mount boot --rw + echo "set default=ONIE" >> /mnt/onl/boot/grub/grub.cfg + onl-mounts mount boot +} + +uninstall_uboot() +{ + if [ "$1" = "factory" ]; then + fw_setenv onie_boot_reason uninstall + else + fw_setenv nos_bootcmd echo + fi +} + +uninstall() +{ + case `uname -m` in + x86_64) + uninstall_x86_64 $1 + ;; + ppc|armv7l) + uninstall_uboot $1 + ;; + *) + echo "Uninstall for the current architecture is not implemented. This is a bug." + exit 1 + ;; + esac +} + +############################################################ + +uninstall $1 +echo "The NOS will be removed at the next reboot." +exit 0 + + From 6b051c453300f226c82eb4e978bed3f2be8b5046 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Fri, 21 Oct 2016 18:12:33 +0000 Subject: [PATCH 23/28] Upgrade separation and cleanup. --- .../src/boot.d/60.upgrade-onie | 4 +-- .../src/boot.d/61.upgrade-firmware | 5 ++- .../src/boot.d/62.upgrade-loader | 4 +-- .../src/python/onl/upgrade/loader.py | 3 ++ .../src/python/onl/upgrade/onie.py | 1 - .../src/python/onl/upgrade/ubase.py | 35 ++++++++++++------- .../src/sbin/onl-upgrade-firmware | 3 ++ .../src/sbin/onl-upgrade-loader | 3 ++ .../src/sbin/onl-upgrade-onie | 3 ++ 9 files changed, 39 insertions(+), 22 deletions(-) create mode 100755 packages/base/all/vendor-config-onl/src/sbin/onl-upgrade-firmware create mode 100755 packages/base/all/vendor-config-onl/src/sbin/onl-upgrade-loader create mode 100755 packages/base/all/vendor-config-onl/src/sbin/onl-upgrade-onie diff --git a/packages/base/all/vendor-config-onl/src/boot.d/60.upgrade-onie b/packages/base/all/vendor-config-onl/src/boot.d/60.upgrade-onie index a6daef06..540e24d3 100755 --- a/packages/base/all/vendor-config-onl/src/boot.d/60.upgrade-onie +++ b/packages/base/all/vendor-config-onl/src/boot.d/60.upgrade-onie @@ -1,3 +1 @@ -#!/usr/bin/python -from onl.upgrade.onie import OnieUpgrade -OnieUpgrade().main() +/sbin/onl-upgrade-onie diff --git a/packages/base/all/vendor-config-onl/src/boot.d/61.upgrade-firmware b/packages/base/all/vendor-config-onl/src/boot.d/61.upgrade-firmware index aa23c80c..41880e16 100755 --- a/packages/base/all/vendor-config-onl/src/boot.d/61.upgrade-firmware +++ b/packages/base/all/vendor-config-onl/src/boot.d/61.upgrade-firmware @@ -1,3 +1,2 @@ -#!/usr/bin/python -from onl.upgrade.firmware import FirmwareUpgrade -FirmwareUpgrade().main() +/sbin/onl-upgrade-firmware + diff --git a/packages/base/all/vendor-config-onl/src/boot.d/62.upgrade-loader b/packages/base/all/vendor-config-onl/src/boot.d/62.upgrade-loader index 02aa6d92..f802031a 100755 --- a/packages/base/all/vendor-config-onl/src/boot.d/62.upgrade-loader +++ b/packages/base/all/vendor-config-onl/src/boot.d/62.upgrade-loader @@ -1,3 +1 @@ -#!/usr/bin/python -from onl.upgrade.loader import LoaderUpgrade -LoaderUpgrade().main() +/sbin/onl-upgrade-loader diff --git a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/loader.py b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/loader.py index 10df045e..6637c9a7 100755 --- a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/loader.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/loader.py @@ -43,6 +43,9 @@ class LoaderUpgradeBase(ubase.BaseUpgrade): self.next_version = self.load_json(NEXT_LOADER_VERSIONS_JSON, "version", {}).get('RELEASE_ID', None) + def prepare_upgrade(self): + pass + def summarize(self): self.logger.info("Current Loader Version: %s" % self.current_version) self.logger.info(" Next Loader Version: %s" % self.next_version) diff --git a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/onie.py b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/onie.py index fab08c0d..4cf81016 100755 --- a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/onie.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/onie.py @@ -17,7 +17,6 @@ class OnieUpgrade(ubase.BaseOnieUpgrade): next_version_key="Next ONIE Version" def init_versions(self): - # Get the current platform ONIE version self.current_version = self.platform.onie_version() self.next_version = None diff --git a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py index 2b5f6c22..86562b61 100644 --- a/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py +++ b/packages/base/all/vendor-config-onl/src/python/onl/upgrade/ubase.py @@ -41,6 +41,10 @@ class BaseUpgrade(object): self.platform = OnlPlatform() self.init() + self.current_version = None + self.next_version = None + self.init_versions() + def init(self): pass @@ -161,11 +165,16 @@ class BaseUpgrade(object): UPGRADE_STATUS_JSON = "/lib/platform-config/current/onl/upgrade.json" - def update_upgrade_status(self, key, value): + @staticmethod + def upgrade_status_get(): data = {} - if os.path.exists(self.UPGRADE_STATUS_JSON): - with open(self.UPGRADE_STATUS_JSON) as f: + if os.path.exists(BaseUpgrade.UPGRADE_STATUS_JSON): + with open(BaseUpgrade.UPGRADE_STATUS_JSON) as f: data = json.load(f) + return data + + def update_upgrade_status(self, key, value): + data = self.upgrade_status_get() data[key] = value with open(self.UPGRADE_STATUS_JSON, "w") as f: json.dump(data, f) @@ -177,6 +186,8 @@ class BaseUpgrade(object): def init_versions(self): raise Exception("init_versions() must be provided by the deriving class.") + def prepare_upgrade(self): + raise Exception("prepare_versions() must be provided by the deriving class.") # # Perform actual upgrade. Provided by derived class. @@ -192,9 +203,7 @@ class BaseUpgrade(object): def init_upgrade(self): - self.current_version = None - self.next_version = None - self.init_versions() + self.prepare_upgrade() self.update_upgrade_status(self.current_version_key, self.current_version) self.update_upgrade_status(self.next_version_key, self.next_version) @@ -411,20 +420,22 @@ class BaseOnieUpgrade(BaseUpgrade): self.logger.info("Removing previous onie-updater.") os.remove(updater) - def load_manifest(self, path): - self.manifest = self.load_json(path) - + def prepare_upgrade(self): if self.manifest is None: self.finish("No %s updater available for the current platform." % self.Name) - if 'version' not in self.manifest: + if self.next_version is None: self.finish("No %s version in the upgrade manifest." % self.Name) - else: - self.next_version = self.manifest['version'] if 'updater' not in self.manifest: self.finish("No %s updater in the upgrade manifest." % self.Name) + def load_manifest(self, path, required=True): + self.manifest = self.load_json(path) + self.next_version = None + if self.manifest: + self.next_version = self.manifest.get('version', None) + def summarize(self): self.logger.info("Current %s Version: %s" % (self.Name, self.current_version)) self.logger.info(" Next %s Version: %s" % (self.Name, self.manifest.get('version'))) diff --git a/packages/base/all/vendor-config-onl/src/sbin/onl-upgrade-firmware b/packages/base/all/vendor-config-onl/src/sbin/onl-upgrade-firmware new file mode 100755 index 00000000..aa23c80c --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/sbin/onl-upgrade-firmware @@ -0,0 +1,3 @@ +#!/usr/bin/python +from onl.upgrade.firmware import FirmwareUpgrade +FirmwareUpgrade().main() diff --git a/packages/base/all/vendor-config-onl/src/sbin/onl-upgrade-loader b/packages/base/all/vendor-config-onl/src/sbin/onl-upgrade-loader new file mode 100755 index 00000000..02aa6d92 --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/sbin/onl-upgrade-loader @@ -0,0 +1,3 @@ +#!/usr/bin/python +from onl.upgrade.loader import LoaderUpgrade +LoaderUpgrade().main() diff --git a/packages/base/all/vendor-config-onl/src/sbin/onl-upgrade-onie b/packages/base/all/vendor-config-onl/src/sbin/onl-upgrade-onie new file mode 100755 index 00000000..a6daef06 --- /dev/null +++ b/packages/base/all/vendor-config-onl/src/sbin/onl-upgrade-onie @@ -0,0 +1,3 @@ +#!/usr/bin/python +from onl.upgrade.onie import OnieUpgrade +OnieUpgrade().main() From a24beac4fd158844443a7cb0597772cdf2e8d077 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Tue, 25 Oct 2016 18:02:00 +0000 Subject: [PATCH 24/28] - DHCP Timeout support in the Loader environment When $NETAUTO=dhcp the transaction will now timeout after $NETRETRIES attempts. If the system has a local install or SWI then booting can continue. For systems which require DHCP to be functional before booting can continue (for example SWIs downloaded via URL rather than locally) then NETRETRIES=infinite should be set in the boot-config. NETRETRIES can be set to any number of attempts, or infinite. The default value is 5 attempts. - Wait for ma1 linkup in the loader A short wait has been introduced to allow ma1 to linkup prior to continuing. --- .../initrds/loader-initrd-files/src/bin/ifup | 56 ++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/packages/base/all/initrds/loader-initrd-files/src/bin/ifup b/packages/base/all/initrds/loader-initrd-files/src/bin/ifup index b9edbe67..eeef3eff 100644 --- a/packages/base/all/initrds/loader-initrd-files/src/bin/ifup +++ b/packages/base/all/initrds/loader-initrd-files/src/bin/ifup @@ -25,6 +25,7 @@ # Configure a network interface from settings in /etc/onl/NET # NETDEV: device name # NETAUTO: autoconfiguration method ("dhcp" or empty) +# NETRETRIES: autoconfiguration timeout # NETIP: IP address (/prefix optional for v4) # NETMASK: netmask (if NETIP has no prefix) # NETGW: default gateway IP address (optional) @@ -43,10 +44,39 @@ if [ "${NETHW}" ]; then ip link set dev ${NETDEV} addr ${NETHW} fi +# Default DHCP timeout is 10 requests in 10 seconds. +NETRETRIES_DEFAULT=10 +NETRETRIES=${NETRETRIES:-$NETRETRIES_DEFAULT} +if [ "$NETRETRIES" = "infinite" ]; then + NETRETRIES= +elif [ $(echo "$NETRETRIES" | tr -d '[:digit:]') ] || [ "$NETRETRIES" -lt 0 ]; then + echo "Warning: the NETRETRIES setting is currently '$NETRETRIES'. This is invalid and the default value of $NETRETRIES_DEFAULT will be used instead." + NETRETRIES=$NETRETRIES_DEFAULT +fi case "${NETAUTO}" in dhcp|auto) echo 1 >/proc/sys/net/ipv6/conf/${NETDEV}/autoconf - udhcpc -i ${NETDEV} + if [ -n "${NETRETRIES}" ]; then + if ! udhcpc --retries $NETRETRIES --now -i ${NETDEV}; then + echo "**********************************************************************" + echo "DHCP failed after $NETRETRIES attempts." + echo "**********************************************************************" + fi + else + while true; do + if udhcpc --retries $NETRETRIES_DEFAULT --now -i ${NETDEV}; then + break + fi + echo + echo "**********************************************************************" + echo "DHCP failed after $NETRETRIES_DEFAULT attempts." + echo "" + echo "No timeout is configured so DHCP requests will continue until successful." + echo " Press Ctrl-C to terminate and configure manually." + echo "" + echo "**********************************************************************" + done + fi ;; up) ifconfig "${NETDEV}" up @@ -87,3 +117,27 @@ for i in $(seq 30); do fi sleep 1 done +wait_link_up() +{ + local intf=$1 + local count=$2 + + local operstate="/sys/class/net/${intf}/operstate" + + echo "Waiting for link on ${intf}..." + local i=0 + [ -r $operstate ] && while [ $i -lt $count ] ; do + intf_operstate="$(cat $operstate)" + if [ "$intf_operstate" = "up" -o "$intf_operstate" = "unknown" ] ; then + echo "${intf}: up" + return 0 + fi + usleep 100000 + i=$(( $i + 1 )) + done + + echo "${intf}: down." + return 1 +} + +wait_link_up $NETDEV 100 From a707bec39a622d1d952d1e8d6de0cff3bacd8815 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Tue, 25 Oct 2016 18:07:26 +0000 Subject: [PATCH 25/28] New SYSTEM_COMPATIBILITY_VERSION (SCV) key This key is designed to indicate the overall system compatibility between different installations. For example, the system configuration in ONL2.0 is different from ONL 1.0 (partition scheme, loader/version management, etc) and attempting to boot a 1.0 switch image on a 2.0 system will not work properly. This key exists to facilitate operational compatibility and upgrade steps. When a switch image is booted against a loader with an SCV different than it expects then a full re-install will need to be performed in order to upgrade the system before that image can run. If the SCV is different then an in-place loader-upgrade cannot be performed either. The upgrade process will be updated to include an SCV check and perform a re-install. The loader upgrade sequence will be predicated on SCV equality. If the SCV is not equal after all upgrade operations then switch has the option of rebooting instead of continuing the init process. This will be configured through the sysconfig interface. --- tools/onlvi.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tools/onlvi.py b/tools/onlvi.py index d71be362..6bee3bbe 100644 --- a/tools/onlvi.py +++ b/tools/onlvi.py @@ -52,3 +52,6 @@ class OnlVersionImplementation(object): def V_FNAME_RELEASE_ID(self, data): return "%s-%s" % (self.V_VERSION_ID(data), self.V_FNAME_BUILD_ID(data)) + + def V_SYSTEM_COMPATIBILITY_VERSION(self, data): + return "2" From 77e9794feae7bc7d2a0076f9b00d93b661b5a8ae Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 26 Oct 2016 00:24:26 +0000 Subject: [PATCH 26/28] Latest --- packages/platforms-closed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platforms-closed b/packages/platforms-closed index 14f30a9e..679d73e9 160000 --- a/packages/platforms-closed +++ b/packages/platforms-closed @@ -1 +1 @@ -Subproject commit 14f30a9e614fb075ae591838f9859eb1e3f188be +Subproject commit 679d73e91d2e994c22eeb74aae902334c036e9a4 From 5e014134015797efcf57a99d85da49cece96dfd7 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 26 Oct 2016 07:42:20 -0700 Subject: [PATCH 27/28] No default boot configurations require network support in the loader. --- builds/amd64/installer/installed/builds/boot-config | 1 - builds/amd64/installer/swi/builds/boot-config | 1 - builds/arm64/installer/installed/builds/boot-config | 1 - builds/arm64/installer/swi/builds/boot-config | 1 - builds/armel/installer/installed/builds/boot-config | 1 - builds/armel/installer/swi/builds/boot-config | 1 - builds/powerpc/installer/installed/builds/boot-config | 1 - builds/powerpc/installer/swi/builds/boot-config | 1 - 8 files changed, 8 deletions(-) diff --git a/builds/amd64/installer/installed/builds/boot-config b/builds/amd64/installer/installed/builds/boot-config index 99685e0d..76125102 100644 --- a/builds/amd64/installer/installed/builds/boot-config +++ b/builds/amd64/installer/installed/builds/boot-config @@ -1,4 +1,3 @@ NETDEV=ma1 -NETAUTO=dhcp BOOTMODE=INSTALLED SWI=images::latest diff --git a/builds/amd64/installer/swi/builds/boot-config b/builds/amd64/installer/swi/builds/boot-config index 40fb0d31..bc868161 100644 --- a/builds/amd64/installer/swi/builds/boot-config +++ b/builds/amd64/installer/swi/builds/boot-config @@ -1,4 +1,3 @@ NETDEV=ma1 -NETAUTO=dhcp BOOTMODE=SWI SWI=images::latest diff --git a/builds/arm64/installer/installed/builds/boot-config b/builds/arm64/installer/installed/builds/boot-config index 99685e0d..76125102 100644 --- a/builds/arm64/installer/installed/builds/boot-config +++ b/builds/arm64/installer/installed/builds/boot-config @@ -1,4 +1,3 @@ NETDEV=ma1 -NETAUTO=dhcp BOOTMODE=INSTALLED SWI=images::latest diff --git a/builds/arm64/installer/swi/builds/boot-config b/builds/arm64/installer/swi/builds/boot-config index 40fb0d31..bc868161 100644 --- a/builds/arm64/installer/swi/builds/boot-config +++ b/builds/arm64/installer/swi/builds/boot-config @@ -1,4 +1,3 @@ NETDEV=ma1 -NETAUTO=dhcp BOOTMODE=SWI SWI=images::latest diff --git a/builds/armel/installer/installed/builds/boot-config b/builds/armel/installer/installed/builds/boot-config index 99685e0d..76125102 100644 --- a/builds/armel/installer/installed/builds/boot-config +++ b/builds/armel/installer/installed/builds/boot-config @@ -1,4 +1,3 @@ NETDEV=ma1 -NETAUTO=dhcp BOOTMODE=INSTALLED SWI=images::latest diff --git a/builds/armel/installer/swi/builds/boot-config b/builds/armel/installer/swi/builds/boot-config index 40fb0d31..bc868161 100644 --- a/builds/armel/installer/swi/builds/boot-config +++ b/builds/armel/installer/swi/builds/boot-config @@ -1,4 +1,3 @@ NETDEV=ma1 -NETAUTO=dhcp BOOTMODE=SWI SWI=images::latest diff --git a/builds/powerpc/installer/installed/builds/boot-config b/builds/powerpc/installer/installed/builds/boot-config index 99685e0d..76125102 100644 --- a/builds/powerpc/installer/installed/builds/boot-config +++ b/builds/powerpc/installer/installed/builds/boot-config @@ -1,4 +1,3 @@ NETDEV=ma1 -NETAUTO=dhcp BOOTMODE=INSTALLED SWI=images::latest diff --git a/builds/powerpc/installer/swi/builds/boot-config b/builds/powerpc/installer/swi/builds/boot-config index 40fb0d31..bc868161 100644 --- a/builds/powerpc/installer/swi/builds/boot-config +++ b/builds/powerpc/installer/swi/builds/boot-config @@ -1,4 +1,3 @@ NETDEV=ma1 -NETAUTO=dhcp BOOTMODE=SWI SWI=images::latest From 35d017c0f803f706c712d07135ad9c7300390a12 Mon Sep 17 00:00:00 2001 From: Jeffrey Townsend Date: Wed, 26 Oct 2016 19:34:37 +0000 Subject: [PATCH 28/28] Latest --- packages/platforms-closed | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/platforms-closed b/packages/platforms-closed index 679d73e9..3963bb7d 160000 --- a/packages/platforms-closed +++ b/packages/platforms-closed @@ -1 +1 @@ -Subproject commit 679d73e91d2e994c22eeb74aae902334c036e9a4 +Subproject commit 3963bb7d39ae6b61327793ef8839036f5e3a7fda