From feea1c9fd1578ccbec5426ef539cffb9533a3175 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Fri, 20 Nov 2015 20:54:24 +0000 Subject: [PATCH 1/4] updating buildroot to master --- packages/base/any/initrds/buildroot/builds/buildroot-mirror | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/base/any/initrds/buildroot/builds/buildroot-mirror b/packages/base/any/initrds/buildroot/builds/buildroot-mirror index 8290a626..5e1a5c1e 160000 --- a/packages/base/any/initrds/buildroot/builds/buildroot-mirror +++ b/packages/base/any/initrds/buildroot/builds/buildroot-mirror @@ -1 +1 @@ -Subproject commit 8290a6261aaa4af8e8a4b3cbd6c8bedd83622572 +Subproject commit 5e1a5c1ef7bac890845920809147ee2070dc96ea From 01a00b4815eb4e1f7f23147aff4e2cf7602b9f4f Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Sun, 22 Nov 2015 17:13:05 -0800 Subject: [PATCH 2/4] fixes for buildroot config, added onlbuilder and docker_shell --- docker_shell | 159 ++++++++++++++++++ onlbuilder | 145 ++++++++++++++++ .../buildroot/builds/buildroot.config-powerpc | 2 +- 3 files changed, 305 insertions(+), 1 deletion(-) create mode 100644 docker_shell create mode 100755 onlbuilder diff --git a/docker_shell b/docker_shell new file mode 100644 index 00000000..a1242a02 --- /dev/null +++ b/docker_shell @@ -0,0 +1,159 @@ +#!/usr/bin/python + +import os +import sys +import argparse +import datetime +import subprocess +import pwd +import logging +import re + +logging.basicConfig() +logger = logging.getLogger('docker_shell') +logger.setLevel(logging.INFO) + +g_dry = False + +def fatal(msg, rc=1): + logger.critical(msg) + sys.exit(rc) + +def execute(cmd, msg=None): + logger.debug('+ %s ...' % cmd) + rc = 0 + if not g_dry: + rc = os.system(cmd) + if rc == 0: + logger.debug('+ %s [OK]' % cmd) + else: + logger.debug('+ %s [FAILED (%d)]' % (cmd, rc)) + if msg: + fatal(msg) + else: + logger.debug('+ %s [DRY]' % cmd) + return rc + +class User(object): + + default_shell="/bin/bash" + default_user="root:0" + + def __init__(self, uspec): + + (self.name, c, rest) = uspec.partition(':') + self.validate_name() + + (self.uid, c, rest) = rest.partition(':') + self.validate_uid() + + (self.shell, c, rest) = rest.partition(':') + if self.shell == '': + self.shell = User.default_shell + if not os.path.exists(self.shell): + fatal("Requested shell '%s' does not exist." % self.shell) + + (self.home, c, rest) = rest.partition(':') + + logger.debug("User(%s) initialized." % self) + + def __str__(self): + return "%s:%s:%s" % (self.name, self.uid, self.shell) + + def validate_name(self): + NAME_REGEX=r"[a-z][-a-z0-9]*" + if re.match(NAME_REGEX, self.name) is None: + fatal("'%s' is not a valid username." % self.name) + logger.debug("username %s is validated." % self.name) + + def validate_uid(self): + try: + self.uid = int(self.uid) + logger.debug("uid %d is validated." % self.uid) + except: + if self.uid == '': + if self.name == 'root': + self.uid = 0 + else: + fatal("A user id is required for user '%s'" % self.name) + else: + fatal("'%s' is not a valid user id." % self.uid) + + + def add(self): + logger.debug("Process user %s ..." % self) + existing_user = None + try: + existing_user = pwd.getpwnam(self.name) + if existing_user and existing_user.pw_uid != self.uid: + fatal("User %s already exists with a different uid (%d).\n" % (self.name, existing_user.pw_uid)) + except KeyError: + logger.debug("User %s does not exist." % self.name) + + try: + existing_uid = pwd.getpwuid(self.uid) + if existing_uid and existing_uid.pw_name != self.name: + fatal("UID %d already exists with a different user (%s).\n" % (self.uid, existing_uid.pw_name)) + except KeyError: + logger.debug("UID %d does not exist." % self.uid) + + if existing_user: + logger.debug("User %s already exists." % self) + else: + logger.debug("Creating user %s ..." % (self)) + cmd = "useradd %s --uid %s --shell %s" % (self.name, self.uid, self.shell) + if self.home not in [ None, '' ]: + cmd += " -d %s" % (self.home) + execute(cmd, "User creation failed for user %s" % self) + + if not g_dry and self.name != 'root': + with open("/etc/sudoers.d/%s" % self.name, "w") as f: + f.write("%s ALL=(ALL:ALL) NOPASSWD:ALL\n" % self.name) + + +############################################################ + +ap = argparse.ArgumentParser("ONL Docker Shell Build and Development Container Init Script.") + +ap.add_argument("--user", "-u", + help="Run as the given user:uid. The user is created if necessary. The default is %s" % User.default_user, + default=User.default_user, + metavar="USERNAME:UID[:SHELL]") +ap.add_argument("--addusers", "-a", + help="Add additional users.", + nargs='+', + metavar="USERNAME:UID[:SHELL]", + default=[]) +ap.add_argument("--verbose", "-v", + help="Set verbose logging.", + action='store_true') +ap.add_argument("--start-cacher", + help="Start apt-cacher-ng in the container. It does not run by default.", + action='store_true') +ap.add_argument("--dry", + help="Dry run.", + action='store_true') +ap.add_argument('--command', '-c', + help="The command to run. All arguments after this option are considered part of the command.", + nargs='+', + default=["/bin/bash"]) + +ops = ap.parse_args() +opsdict = vars(ops) +g_dry = ops.dry + +if ops.verbose or ops.dry: + logger.setLevel(logging.DEBUG) + +g_user = User(ops.user) +g_user.add() + +for u in ops.addusers: + User(u).add() + +if ops.start_cacher: + execute("/etc/init.d/apt-cacher-ng start", "The apt-cacher-ng 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)) +execute(c) diff --git a/onlbuilder b/onlbuilder new file mode 100755 index 00000000..e8d98c1c --- /dev/null +++ b/onlbuilder @@ -0,0 +1,145 @@ +#!/usr/bin/python + +import os +import sys +import argparse +import datetime +import getpass +import subprocess +import logging +import pwd + +logging.basicConfig() +logger = logging.getLogger('onlbuilder') +logger.setLevel(logging.INFO) + +g_current_user = getpass.getuser() +g_current_uid = os.getuid() +g_timestamp = datetime.datetime.now().strftime("%Y-%m-%d.%H%M%S") + +g_default_image_name="opennetworklinux/builder7:1.0" +g_default_container_name = "%s_%s" % (g_current_user, g_timestamp) +g_default_user="%s:%s" % (g_current_user, g_current_uid) + +ap = argparse.ArgumentParser("ONL Docker Build") + +ap.add_argument("--dry", + help="Dry run.", + action='store_true') + +ap.add_argument("--verbose", "-v", + help="Verbose logging.", + action='store_true') + +ap.add_argument("--image", "-i", + help="The docker image to use. The default is %s." % g_default_image_name, + default=g_default_image_name) + +ap.add_argument("--exec", "-e", + help="Execute in running container instead of starting a new one.", + metavar='CONTAINER|NAME', + dest='exec_') + +ap.add_argument("--user", "-u", + help="Run as the given user:uid. Create if necessary. The default is you (%s)" % g_default_user, + default=g_default_user, + metavar='USERNAME:UID') + +ap.add_argument("--adduser", "-a", + help="Add additional user(s). These users will only be added to the container.", + nargs="+", + metavar='USENAME:UID') + +ap.add_argument("--name", "-n", + help="Set the container name. The default will be your username concatenated with the current timestamp (%s)." % g_default_container_name, + default=g_default_container_name) + +ap.add_argument("--workdir", "-w", + help="Set the working directory. The default will be the current working directory.", + default=os.getcwd()) + +ap.add_argument("--no-ssh", + help="Do not include current SSH Agent credentials. The default is to include them if present.", + action='store_true') + +ap.add_argument("--use-running", "-r", + help="Use an existing, matching, running container instead of starting a new one (if available).", + action='store_true'), + +ap.add_argument("--isolate", + help="Build isolation mode. Only the isolate directories are mounted, and a new network namespace is used. The --hostname becomes active in this mode.", + nargs='*') + +ap.add_argument("--hostname", + help="Change hostname in isolation mode.") +ap.add_argument("--non-interactive", + help="Non-interactive mode.", + action='store_true') + +ap.add_argument("--command", "-c", + help="Explicit command to run. All arguments after -c are considered to be part of the command.", + nargs='+', + default=['bash']) + +ops = ap.parse_args() + +if ops.verbose or ops.dry: + logger.setLevel(logging.DEBUG) + +logger.debug('arguments: %s\n' % vars(ops)) + +if ops.use_running: + sys.stderr.write("The --r option is not yet implemented.") + # Todo -- query running containers that match and set ops.exec_cid + sys.exit(1) + +g_ssh_options = '' +g_ssh_auth_sock = os.getenv('SSH_AUTH_SOCK') +if g_ssh_auth_sock and not ops.no_ssh: + g_ssh_dir = os.path.dirname(g_ssh_auth_sock) + g_ssh_options = '-v %s:%s -e SSH_AUTH_SOCK=%s' % (g_ssh_dir, g_ssh_dir, g_ssh_auth_sock) + +g_arg_d=vars(ops) + +g_arg_d['username'] = g_arg_d['user'].split(':')[0] +g_arg_d['ssh_options'] = g_ssh_options +g_arg_d['interactive'] = " " if ops.non_interactive else " -i " +g_arg_d['commands'] = " ".join(ops.command) + +# Get the home directory of the requested user. +try: + passwd = pwd.getpwnam(g_arg_d['username']) + g_arg_d['home'] = passwd.pw_dir +except KeyError: + # Not a local user. Just skip setting $HOME + pass + +if ops.exec_: + g_docker_arguments = "docker exec %(interactive)s -t %(exec_)s ~/OpenNetworkLinux/docker_shell --user %(user)s" % g_arg_d +else: + g_docker_arguments = "docker run --privileged %(interactive)s -t -e DOCKER_IMAGE=%(image)s --name %(name)s %(ssh_options)s -v /lib/modules:/lib/modules " % g_arg_d + + if ops.isolate is not None: + if len(ops.isolate) is 0: + ops.isolate.append(os.getcwd()) + + isolates = [ os.path.abspath(i) for i in ops.isolate ] + g_docker_arguments += " -e HOME=%s -w %s " % (isolates[0], isolates[0]) + for d in isolates: + g_docker_arguments += " -v %s:%s " % (d,d) + + if ops.hostname: + g_docker_arguments += " -h %s" % ops.hostname + + else: + # Development host mode + g_docker_arguments += "-e USER=%(username)s --net host -w %(workdir)s " % g_arg_d + if 'home' in g_arg_d: + g_docker_arguments += " -e HOME=%(home)s -v %(home)s:%(home)s" % g_arg_d + +g_docker_arguments += " %(image)s /bin/docker_shell --user %(user)s -c %(commands)s" % g_arg_d + +g_docker_arguments = " ".join(g_docker_arguments.split()) +logger.debug("running: %s" % g_docker_arguments) +if not ops.dry: + sys.exit(os.system(g_docker_arguments)) diff --git a/packages/base/any/initrds/buildroot/builds/buildroot.config-powerpc b/packages/base/any/initrds/buildroot/builds/buildroot.config-powerpc index f136ebbe..ec76348d 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="http://switch-nfs/export/buildroot-download-cache/dl" -BR2_PRIMARY_SITE_ONLY=y +BR2_PRIMARY_SITE_ONLY=n BR2_BACKUP_SITE="http://sources.buildroot.net/" BR2_KERNEL_MIRROR="http://www.kernel.org/pub/" BR2_GNU_MIRROR="http://ftp.gnu.org/pub/gnu" From 547e306b0589973a5d5cae5c1692c5c2a9843322 Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Fri, 18 Dec 2015 09:40:10 -0800 Subject: [PATCH 3/4] cleanup --- docker_shell | 159 --------------------------------------------------- onlbuilder | 145 ---------------------------------------------- 2 files changed, 304 deletions(-) delete mode 100644 docker_shell delete mode 100755 onlbuilder diff --git a/docker_shell b/docker_shell deleted file mode 100644 index a1242a02..00000000 --- a/docker_shell +++ /dev/null @@ -1,159 +0,0 @@ -#!/usr/bin/python - -import os -import sys -import argparse -import datetime -import subprocess -import pwd -import logging -import re - -logging.basicConfig() -logger = logging.getLogger('docker_shell') -logger.setLevel(logging.INFO) - -g_dry = False - -def fatal(msg, rc=1): - logger.critical(msg) - sys.exit(rc) - -def execute(cmd, msg=None): - logger.debug('+ %s ...' % cmd) - rc = 0 - if not g_dry: - rc = os.system(cmd) - if rc == 0: - logger.debug('+ %s [OK]' % cmd) - else: - logger.debug('+ %s [FAILED (%d)]' % (cmd, rc)) - if msg: - fatal(msg) - else: - logger.debug('+ %s [DRY]' % cmd) - return rc - -class User(object): - - default_shell="/bin/bash" - default_user="root:0" - - def __init__(self, uspec): - - (self.name, c, rest) = uspec.partition(':') - self.validate_name() - - (self.uid, c, rest) = rest.partition(':') - self.validate_uid() - - (self.shell, c, rest) = rest.partition(':') - if self.shell == '': - self.shell = User.default_shell - if not os.path.exists(self.shell): - fatal("Requested shell '%s' does not exist." % self.shell) - - (self.home, c, rest) = rest.partition(':') - - logger.debug("User(%s) initialized." % self) - - def __str__(self): - return "%s:%s:%s" % (self.name, self.uid, self.shell) - - def validate_name(self): - NAME_REGEX=r"[a-z][-a-z0-9]*" - if re.match(NAME_REGEX, self.name) is None: - fatal("'%s' is not a valid username." % self.name) - logger.debug("username %s is validated." % self.name) - - def validate_uid(self): - try: - self.uid = int(self.uid) - logger.debug("uid %d is validated." % self.uid) - except: - if self.uid == '': - if self.name == 'root': - self.uid = 0 - else: - fatal("A user id is required for user '%s'" % self.name) - else: - fatal("'%s' is not a valid user id." % self.uid) - - - def add(self): - logger.debug("Process user %s ..." % self) - existing_user = None - try: - existing_user = pwd.getpwnam(self.name) - if existing_user and existing_user.pw_uid != self.uid: - fatal("User %s already exists with a different uid (%d).\n" % (self.name, existing_user.pw_uid)) - except KeyError: - logger.debug("User %s does not exist." % self.name) - - try: - existing_uid = pwd.getpwuid(self.uid) - if existing_uid and existing_uid.pw_name != self.name: - fatal("UID %d already exists with a different user (%s).\n" % (self.uid, existing_uid.pw_name)) - except KeyError: - logger.debug("UID %d does not exist." % self.uid) - - if existing_user: - logger.debug("User %s already exists." % self) - else: - logger.debug("Creating user %s ..." % (self)) - cmd = "useradd %s --uid %s --shell %s" % (self.name, self.uid, self.shell) - if self.home not in [ None, '' ]: - cmd += " -d %s" % (self.home) - execute(cmd, "User creation failed for user %s" % self) - - if not g_dry and self.name != 'root': - with open("/etc/sudoers.d/%s" % self.name, "w") as f: - f.write("%s ALL=(ALL:ALL) NOPASSWD:ALL\n" % self.name) - - -############################################################ - -ap = argparse.ArgumentParser("ONL Docker Shell Build and Development Container Init Script.") - -ap.add_argument("--user", "-u", - help="Run as the given user:uid. The user is created if necessary. The default is %s" % User.default_user, - default=User.default_user, - metavar="USERNAME:UID[:SHELL]") -ap.add_argument("--addusers", "-a", - help="Add additional users.", - nargs='+', - metavar="USERNAME:UID[:SHELL]", - default=[]) -ap.add_argument("--verbose", "-v", - help="Set verbose logging.", - action='store_true') -ap.add_argument("--start-cacher", - help="Start apt-cacher-ng in the container. It does not run by default.", - action='store_true') -ap.add_argument("--dry", - help="Dry run.", - action='store_true') -ap.add_argument('--command', '-c', - help="The command to run. All arguments after this option are considered part of the command.", - nargs='+', - default=["/bin/bash"]) - -ops = ap.parse_args() -opsdict = vars(ops) -g_dry = ops.dry - -if ops.verbose or ops.dry: - logger.setLevel(logging.DEBUG) - -g_user = User(ops.user) -g_user.add() - -for u in ops.addusers: - User(u).add() - -if ops.start_cacher: - execute("/etc/init.d/apt-cacher-ng start", "The apt-cacher-ng 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)) -execute(c) diff --git a/onlbuilder b/onlbuilder deleted file mode 100755 index e8d98c1c..00000000 --- a/onlbuilder +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/python - -import os -import sys -import argparse -import datetime -import getpass -import subprocess -import logging -import pwd - -logging.basicConfig() -logger = logging.getLogger('onlbuilder') -logger.setLevel(logging.INFO) - -g_current_user = getpass.getuser() -g_current_uid = os.getuid() -g_timestamp = datetime.datetime.now().strftime("%Y-%m-%d.%H%M%S") - -g_default_image_name="opennetworklinux/builder7:1.0" -g_default_container_name = "%s_%s" % (g_current_user, g_timestamp) -g_default_user="%s:%s" % (g_current_user, g_current_uid) - -ap = argparse.ArgumentParser("ONL Docker Build") - -ap.add_argument("--dry", - help="Dry run.", - action='store_true') - -ap.add_argument("--verbose", "-v", - help="Verbose logging.", - action='store_true') - -ap.add_argument("--image", "-i", - help="The docker image to use. The default is %s." % g_default_image_name, - default=g_default_image_name) - -ap.add_argument("--exec", "-e", - help="Execute in running container instead of starting a new one.", - metavar='CONTAINER|NAME', - dest='exec_') - -ap.add_argument("--user", "-u", - help="Run as the given user:uid. Create if necessary. The default is you (%s)" % g_default_user, - default=g_default_user, - metavar='USERNAME:UID') - -ap.add_argument("--adduser", "-a", - help="Add additional user(s). These users will only be added to the container.", - nargs="+", - metavar='USENAME:UID') - -ap.add_argument("--name", "-n", - help="Set the container name. The default will be your username concatenated with the current timestamp (%s)." % g_default_container_name, - default=g_default_container_name) - -ap.add_argument("--workdir", "-w", - help="Set the working directory. The default will be the current working directory.", - default=os.getcwd()) - -ap.add_argument("--no-ssh", - help="Do not include current SSH Agent credentials. The default is to include them if present.", - action='store_true') - -ap.add_argument("--use-running", "-r", - help="Use an existing, matching, running container instead of starting a new one (if available).", - action='store_true'), - -ap.add_argument("--isolate", - help="Build isolation mode. Only the isolate directories are mounted, and a new network namespace is used. The --hostname becomes active in this mode.", - nargs='*') - -ap.add_argument("--hostname", - help="Change hostname in isolation mode.") -ap.add_argument("--non-interactive", - help="Non-interactive mode.", - action='store_true') - -ap.add_argument("--command", "-c", - help="Explicit command to run. All arguments after -c are considered to be part of the command.", - nargs='+', - default=['bash']) - -ops = ap.parse_args() - -if ops.verbose or ops.dry: - logger.setLevel(logging.DEBUG) - -logger.debug('arguments: %s\n' % vars(ops)) - -if ops.use_running: - sys.stderr.write("The --r option is not yet implemented.") - # Todo -- query running containers that match and set ops.exec_cid - sys.exit(1) - -g_ssh_options = '' -g_ssh_auth_sock = os.getenv('SSH_AUTH_SOCK') -if g_ssh_auth_sock and not ops.no_ssh: - g_ssh_dir = os.path.dirname(g_ssh_auth_sock) - g_ssh_options = '-v %s:%s -e SSH_AUTH_SOCK=%s' % (g_ssh_dir, g_ssh_dir, g_ssh_auth_sock) - -g_arg_d=vars(ops) - -g_arg_d['username'] = g_arg_d['user'].split(':')[0] -g_arg_d['ssh_options'] = g_ssh_options -g_arg_d['interactive'] = " " if ops.non_interactive else " -i " -g_arg_d['commands'] = " ".join(ops.command) - -# Get the home directory of the requested user. -try: - passwd = pwd.getpwnam(g_arg_d['username']) - g_arg_d['home'] = passwd.pw_dir -except KeyError: - # Not a local user. Just skip setting $HOME - pass - -if ops.exec_: - g_docker_arguments = "docker exec %(interactive)s -t %(exec_)s ~/OpenNetworkLinux/docker_shell --user %(user)s" % g_arg_d -else: - g_docker_arguments = "docker run --privileged %(interactive)s -t -e DOCKER_IMAGE=%(image)s --name %(name)s %(ssh_options)s -v /lib/modules:/lib/modules " % g_arg_d - - if ops.isolate is not None: - if len(ops.isolate) is 0: - ops.isolate.append(os.getcwd()) - - isolates = [ os.path.abspath(i) for i in ops.isolate ] - g_docker_arguments += " -e HOME=%s -w %s " % (isolates[0], isolates[0]) - for d in isolates: - g_docker_arguments += " -v %s:%s " % (d,d) - - if ops.hostname: - g_docker_arguments += " -h %s" % ops.hostname - - else: - # Development host mode - g_docker_arguments += "-e USER=%(username)s --net host -w %(workdir)s " % g_arg_d - if 'home' in g_arg_d: - g_docker_arguments += " -e HOME=%(home)s -v %(home)s:%(home)s" % g_arg_d - -g_docker_arguments += " %(image)s /bin/docker_shell --user %(user)s -c %(commands)s" % g_arg_d - -g_docker_arguments = " ".join(g_docker_arguments.split()) -logger.debug("running: %s" % g_docker_arguments) -if not ops.dry: - sys.exit(os.system(g_docker_arguments)) From 0123c4718de10174eb97c740e664fb121d00cacb Mon Sep 17 00:00:00 2001 From: Steven Noble Date: Fri, 18 Dec 2015 12:15:41 -0800 Subject: [PATCH 4/4] Initial import of the Accton AS7512-32x platform --- .../accton/x86-64-accton-as7512-32x/Makefile | 1 + .../x86-64-accton-as7512-32x/onlp/PKG.yml | 19 +++++++++++++++++ .../platform-config/Makefile | 1 + .../platform-config/r0/PKG.yml | 1 + .../platform-config/r0/src/lib/boot/grub.cfg | 21 +++++++++++++++++++ .../src/lib/boot/x86-64-accton-as7512-32x-r0 | 5 +++++ .../install/x86-64-accton-as7512-32x-r0.sh | 15 +++++++++++++ .../x86-64-accton-as7512-32x-r0/__init__.py | 16 ++++++++++++++ 8 files changed, 79 insertions(+) create mode 100644 packages/platforms/accton/x86-64-accton-as7512-32x/Makefile create mode 100644 packages/platforms/accton/x86-64-accton-as7512-32x/onlp/PKG.yml create mode 100644 packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/Makefile create mode 100644 packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/PKG.yml create mode 100644 packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/lib/boot/grub.cfg create mode 100644 packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/lib/boot/x86-64-accton-as7512-32x-r0 create mode 100644 packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/lib/install/x86-64-accton-as7512-32x-r0.sh create mode 100644 packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/python/x86-64-accton-as7512-32x-r0/__init__.py diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/Makefile b/packages/platforms/accton/x86-64-accton-as7512-32x/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as7512-32x/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/PKG.yml b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/PKG.yml new file mode 100644 index 00000000..4afeb0dd --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as7512-32x/onlp/PKG.yml @@ -0,0 +1,19 @@ +variables: + platform: x86-64-accton-as7512-32x-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 + +packages: + - name: onlp-${platform} + summary: ONLP Package for the ${platform} platform. + + files: + builds/lib/$BUILD_DIR/x86_64-linux-gnu/bin/libonlp-${platform}.so : ${install}/lib/ + builds/onlpdump/$BUILD_DIR/x86_64-linux-gnu/bin/onlpdump : ${install}/lib/bin/ + + changelog: Change changes changes., diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/Makefile b/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/Makefile new file mode 100644 index 00000000..003238cf --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/Makefile @@ -0,0 +1 @@ +include $(ONL)/make/pkg.mk \ No newline at end of file diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/PKG.yml b/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/PKG.yml new file mode 100644 index 00000000..e7c30ba8 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/PKG.yml @@ -0,0 +1 @@ +!include $ONL_TEMPLATES/platform-config-platform.yml ARCH=amd64 VENDOR=accton PLATFORM=x86-64-accton-as7512-32x-r0 diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/lib/boot/grub.cfg b/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/lib/boot/grub.cfg new file mode 100644 index 00000000..f3152ac3 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/lib/boot/grub.cfg @@ -0,0 +1,21 @@ +serial --port=0x2f8 --speed=115200 --word=8 --parity=no --stop=1 +terminal_input serial +terminal_output serial +set timeout=5 + +# boot onl +menuentry OpenNetworkLinux { + search --no-floppy --label --set=root ONL-BOOT + echo 'Loading Open Network Linux ...' + insmod gzio + insmod part_msdos + linux /kernel-3.2-deb7-x86_64-all nopat console=ttyS1,115200n8 onl_platform=x86-64-accton-as7512-32x-r0 + initrd /initrd-amd64 +} + +# Menu entry to chainload ONIE +menuentry ONIE { + search --no-floppy --label --set=root ONIE-BOOT + echo 'Loading ONIE ...' + chainloader +1 +} diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/lib/boot/x86-64-accton-as7512-32x-r0 b/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/lib/boot/x86-64-accton-as7512-32x-r0 new file mode 100644 index 00000000..f01ffc67 --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/lib/boot/x86-64-accton-as7512-32x-r0 @@ -0,0 +1,5 @@ +echo "pci0000:00/0000:00:14.0 ma1" >/etc/onl/net + +cp /dev/null /etc/onl/mounts +echo "LABEL=FLASH * flash" >> /etc/onl/mounts +echo "LABEL=FLASH2 * flash2" >> /etc/onl/mounts diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/lib/install/x86-64-accton-as7512-32x-r0.sh b/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/lib/install/x86-64-accton-as7512-32x-r0.sh new file mode 100644 index 00000000..1c7108fa --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/lib/install/x86-64-accton-as7512-32x-r0.sh @@ -0,0 +1,15 @@ +############################################################ +# +# +# Copyright 2013, 2014 BigSwitch Networks, Inc. +# +# +# +# +############################################################ +# Platform data goes here. + +platform_installer() { + # Standard isntallation to an available GPT partition + installer_standard_gpt_install /dev/sda +} diff --git a/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/python/x86-64-accton-as7512-32x-r0/__init__.py b/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/python/x86-64-accton-as7512-32x-r0/__init__.py new file mode 100644 index 00000000..f03fc79e --- /dev/null +++ b/packages/platforms/accton/x86-64-accton-as7512-32x/platform-config/r0/src/python/x86-64-accton-as7512-32x-r0/__init__.py @@ -0,0 +1,16 @@ +from onl.platform.base import * +from onl.platform.accton import * + +class OnlPlatform_x86_64_accton_as7512_32x_r0(OnlPlatformAccton): + + def model(self): + return "AS7512-32X" + + def platform(self): + return "x86-64-accton-as7512-32x-r0" + + def sys_oid_platform(self): + return ".7512.32" + + def baseconfig(self): + return True