This commit is contained in:
Jeffrey Townsend
2015-11-19 22:45:38 +00:00
parent d57e2ac9ad
commit 45dee0c608
799 changed files with 76533 additions and 0 deletions

20
.gitignore vendored Normal file
View File

@@ -0,0 +1,20 @@
# Everything in the REPO directory is ignored by default.
# Build products
BUILD/
dependmodules.x
*.deb
*.cpio.gz
*.sqsh
*.pyc
# Package cache and lock files
.lock
.PKGs.cache
.PKGs.cache.lock
# Local module manifest.
.manifest.mk

1
REPO/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
extracts

11
REPO/Makefile Normal file
View File

@@ -0,0 +1,11 @@
help:
@echo "Targets:"
@echo " clean : Clean all extracts and debian packages."
clean:
@find packages -name "*.deb" -delete
@find packages -name Packages -delete
@find packages -name Packages.gz -delete
@rm -rf extracts

3
REPO/packages/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
*.deb
Packages
Packages.gz

View File

@@ -0,0 +1 @@
include $(ONL)/make/repo.mk

View File

@@ -0,0 +1 @@
include $(ONL)/make/repo.mk

View File

@@ -0,0 +1 @@
include $(ONL)/make/repo.mk

2
builds/swi/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*.swi
*.swi.md5sum

View File

@@ -0,0 +1,3 @@
ROOTFS_PACKAGE := onl-rootfs
include $(ONL)/make/config.amd64.mk
include $(ONL)/make/swi.mk

View File

@@ -0,0 +1,3 @@
ROOTFS_PACKAGE := onl-rootfs
include $(ONL)/make/config.powerpc.mk
include $(ONL)/make/swi.mk

2
make/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
version-onl.*

8
make/Makefile Normal file
View File

@@ -0,0 +1,8 @@
############################################################
#
# Convenience makefile for generating
# the local version variables.
#
versions.env:
$(ONL_V_at) $(MAKE) -f versions.mk ONL_VERSION_ENV_FILE=versions.env

10
make/config.amd64.mk Normal file
View File

@@ -0,0 +1,10 @@
############################################################
#
# Open Network Linux
#
############################################################
include $(ONL)/make/config.mk
export TOOLCHAIN := x86_64-linux-gnu
export ARCH := amd64

36
make/config.mk Normal file
View File

@@ -0,0 +1,36 @@
############################################################
#
# Open Network Linux Configuration Makefile
#
############################################################
ifndef ONL
$(error $$ONL is not defined)
endif
ifndef ONLPM_PY
ONLPM := $(ONL)/tools/onlpm.py
endif
ifndef BUILDER
# Builder is here
export BUILDER := $(ONL)/sm/infra/builder/unix
endif
#
# The default build directory for all infra:builder compilations is the following.
#
export BUILD_DIR_BASE=BUILD
# Generate manifest if necessary
export MODULEMANIFEST := $(shell $(ONL)/tools/scripts/manifest.sh $(ONL) $(BUILDER))
#
# Default make options.
#
ONL_MAKE_FLAGS += --no-print-directory -s
ONL_MAKE := $(MAKE) $(ONL_MAKE_FLAGS)
ONL_V_at := @

10
make/config.powerpc.mk Normal file
View File

@@ -0,0 +1,10 @@
############################################################
#
# Open Network Linux
#
############################################################
include $(ONL)/make/config.mk
export TOOLCHAIN := powerpc-linux-gnu
export ARCH := powerpc

166
make/kbuild.mk Normal file
View File

@@ -0,0 +1,166 @@
############################################################
# <bsn.cl fy=2015 v=onl>
#
# Copyright 2015 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# Prepare and build a kernel.
#
############################################################
ifndef ARCH
$(error $$ARCH must be set)
endif
#
# The kernel patchlevel.
#
ifndef K_PATCH_LEVEL
$(error $$K_PATCH_LEVEL must be set)
endif
#
# The kernel sublevel
#
ifndef K_SUB_LEVEL
$(error $$K_SUB_LEVEL must be set)
endif
#
# The directory containing the patches to be applied
# to the kernel sources.
#
ifndef K_PATCH_DIR
$(error $$K_PATCH_DIR must be set)
endif
#
# This is the directory that will receive the build targets.
# The kernel build tree is placed in this directory,
# as well as any custom copy targets.
#
ifndef K_TARGET_DIR
$(error $$K_TARGET_DIR not set)
endif
#
# This is the absolute path to the kernel configuration
# that should be used for this build.
#
ifndef K_CONFIG
$(error $$K_CONFIG not set)
endif
#
# This is the build target. bzImage, uImage, etc.
#
ifndef K_BUILD_TARGET
$(error $$K_BUILD_TARGET not set)
endif
############################################################
############################################################
ONL_KERNELS := $(ONL)/packages/base/any/kernels
K_VERSION := 3.$(K_PATCH_LEVEL).$(K_SUB_LEVEL)$(K_SUFFIX)
K_NAME := linux-$(K_VERSION)
ifndef K_ARCHIVE_EXT
K_ARCHIVE_EXT := tar.xz
endif
K_ARCHIVE_NAME := $(K_NAME).$(K_ARCHIVE_EXT)
K_ARCHIVE_PATH := $(ONL_KERNELS)/archives/$(K_ARCHIVE_NAME)
ifndef K_ARCHIVE_URL
K_ARCHIVE_URL := https://www.kernel.org/pub/linux/kernel/v3.x/$(K_ARCHIVE_NAME)
endif
K_SOURCE_DIR := $(K_TARGET_DIR)/$(K_NAME)
K_MBUILD_DIR := $(K_SOURCE_DIR)-mbuild
K_DTBS_DIR := $(K_SOURCE_DIR)-dtbs
#
# The kernel source archive. Download if not present.
#
$(K_ARCHIVE_PATH):
cd $(ONL_KERNELS)/archives && wget $(K_ARCHIVE_URL)
.PHONY : ksource kpatched
#
# The extracted kernel sources
#
$(K_SOURCE_DIR)/Makefile: $(K_ARCHIVE_PATH)
cd $(K_TARGET_DIR) && tar kxf $(K_ARCHIVE_PATH)
touch -c $(K_SOURCE_DIR)/Makefile
$(K_MAKE) mrproper
ksource: $(K_SOURCE_DIR)/Makefile
#
# The patched kernel sources
#
$(K_SOURCE_DIR)/.PATCHED: $(K_SOURCE_DIR)/Makefile
$(ONL)/tools/scripts/apply-patches.sh $(K_SOURCE_DIR) $(K_PATCH_DIR)
touch $(K_SOURCE_DIR)/.PATCHED
kpatched: $(K_SOURCE_DIR)/.PATCHED
#
# Setup the kernel and output directory for the build.
#
setup: $(K_SOURCE_DIR)/.PATCHED
cp $(K_CONFIG) $(K_SOURCE_DIR)/.config
#
# Kernel build command.
#
K_MAKE := $(MAKE) -C $(K_SOURCE_DIR)
#
# Build the kernel.
#
build: setup
+$(K_MAKE) $(K_BUILD_TARGET)
ifdef K_COPY_SRC
ifdef K_COPY_DST
cp $(K_SOURCE_DIR)/$(K_COPY_SRC) $(K_TARGET_DIR)/$(K_COPY_DST)
endif
endif
MODSYNCLIST := .config Module.symvers Makefile include scripts arch/x86/include arch/x86/Makefile arch/powerpc/include arch/powerpc/Makefile arch/powerpc/lib
mbuild: build
rm -rf $(K_MBUILD_DIR)
mkdir -p $(K_MBUILD_DIR)
$(foreach f,$(MODSYNCLIST),$(ONL)/tools/scripts/tree-copy.sh $(K_SOURCE_DIR) $(f) $(K_MBUILD_DIR);)
dtbs: mbuild
ifdef DTS_LIST
rm -rf $(K_DTBS_DIR)
mkdir -p $(K_DTBS_DIR)
$(foreach name,$(DTS_LIST),$(K_SOURCE_DIR)/scripts/dtc/dtc -I dts -O dtb -o $(K_DTBS_DIR)/$(name).dtb $(K_SOURCE_DIR)/arch/$(ARCH)/boot/dts/$(name).dts; )
endif
#
# This target can be used to manage the configuration file.
#
configure: setup
$(K_MAKE) menuconfig
cp $(K_SOURCE_DIR)/.config $(K_CONFIG)
.DEFAULT_GOAL := dtbs

53
make/pkg.mk Normal file
View File

@@ -0,0 +1,53 @@
############################################################
#
# pkg.mk
#
# Default rules for building packages.
#
# Build all package groups in the current subtree.
#
############################################################
include $(ONL)/make/config.mk
#
# Invoke onlpm to build all packages in the current
# directory tree.
#
pkgall:
$(ONL_V_at) MAKE=$(MAKE) onlpm.py --build all
clean:
$(ONL_V_at) MAKE=$(MAKE) onlpm.py --clean all
rebuild:
$(ONL_V_at) MAKE=$(MAKE) onlpm.py --rebuild-pkg-cache
#
# Check all package declarations.
#
check:
$(ONL_V_at) MAKE=$(MAKE) onlpm.py --packagedirs=`pwd` --no-pkg-cache
subdir:
$(ONL_V_at) MAKE=$(MAKE) onlpm.py --packagedirs=`pwd` --build all --no-pkg-cache
#
# Package construction only (no build step)
#
pkg:
$(ONL_V_at) MAKE=$(MAKE) NOBUILD=1 onlpm.py --build all
#
# Generate a rule for all available packages
#
ALL_PACKAGES := $(shell onlpm.py --list-all)
define package_build_template
package-$(1):
$(ONL_V_at) onlpm.py --build $(2)
endef
$(foreach p,$(ALL_PACKAGES),$(eval $(call package_build_template,$(subst :,_,$(p)),$(p))))

6
make/repo.mk Normal file
View File

@@ -0,0 +1,6 @@
PACKAGES := $(wildcard *.deb)
Packages: $(PACKAGES)
@echo "Updating Package Manifest..."
$(ONL_V_at) dpkg-scanpackages . > Packages

6
make/require-packages.mk Normal file
View File

@@ -0,0 +1,6 @@
include $(ONL)/make/config.mk
required_packages:
ifdef REQUIRED_PACKAGES
$(ONLPM) --require $(REQUIRED_PACKAGES)
endif

42
make/rfs.mk Normal file
View File

@@ -0,0 +1,42 @@
############################################################
#
# Common rules for invoking the onlrfs script.
#
# See $(ONL)/tools/onlrfs.py
#
############################################################
ifndef ARCH
$(error $$ARCH must be specified)
endif
ifndef RFS_CONFIG
$(error $$RFS_CONFIG must be set to the RFS yaml configuration file)
endif
ifndef RFS_DIR
$(error $$RFS_DIR must be set)
endif
RFS_COMMAND := $(ONL)/tools/onlrfs.py --arch $(ARCH) --config $(RFS_CONFIG) --dir $(RFS_DIR)
ifdef RFS_CPIO
RFS_COMMAND += --cpio $(RFS_CPIO)
endif
ifdef RFS_SQUASH
RFS_COMMAND += --squash $(RFS_SQUASH)
endif
RFS:
$(ONL_V_at) rm -rf manifest.json
$(ONL_V_at) $(RFS_COMMAND)
$(ONL_V_at) [ -f $(RFS_DIR)/etc/onl/rootfs/manifest.json ] && cp $(RFS_DIR)/etc/onl/rootfs/manifest.json .
clean:
$(ONL_V_at) sudo rm -rf $(RFS_DIR)
$(ONL_v_at) rm -rf $(RFS_CPIO) $(RFS_SQUASH)
show-packages:
$(ONL_V_at) $(RFS_COMMAND) --show-packages

19
make/subdirs.mk Normal file
View File

@@ -0,0 +1,19 @@
############################################################
# <bsn.cl fy=2014 v=none>
# </bsn.cl>
############################################################
include $(ONL)/make/config.mk
ifndef DIRECTORIES
DIRECTORIES := $(notdir $(wildcard $(CURDIR)/*))
endif
FILTER := make Makefile Makefile~ $(FILTER)
DIRECTORIES := $(filter-out $(FILTER),$(DIRECTORIES))
all $(MAKECMDGOALS):
+$(ONL_V_at) $(foreach d,$(DIRECTORIES),$(ONL_MAKE) -C $(d) $(MAKECMDGOALS) || exit 1;)

26
make/swi.mk Normal file
View File

@@ -0,0 +1,26 @@
ifndef ARCH
$(error $$ARCH is not set)
endif
ifndef ROOTFS_PACKAGE
$(error $$ROOTFS_PACKAGE not set.)
endif
ifdef REBUILD_RFS
FORCE_OPTION = --force
endif
LINK_OPTIONS := $(FORCE_OPTION) --link-file $(ROOTFS_PACKAGE):$(ARCH) rootfs-$(ARCH).sqsh . --link-file $(ROOTFS_PACKAGE):$(ARCH) manifest.json .
ifndef FILENAMER
FILENAMER := $(ONL)/tools/filenamer.py
endif
swi: FORCE
$(ONL_V_at) $(ONLPM) $(LINK_OPTIONS)
$(ONL_V_at) zip -n rootfs-$(ARCH).sqsh - rootfs-$(ARCH).sqsh manifest.json > $@
$(ONL_V_at) mv $@ `$(FILENAMER) --type swi --manifest manifest.json $@`
$(ONL_V_at) for f in `ls *.swi`; do md5sum $$f > $$f.md5sum; done
$(ONL_V_at) rm -rf rootfs-$(ARCH).sqsh manifest.json
$(ONL_V_at) ls *.swi
FORCE:

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1,36 @@
common:
arch: all
version: 1.0.0
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
packages:
- name: onl-loader-initrd-files
version: 1.0.0
summary: Open Network Linux System Loader Source Files
files:
- src/bin : /bin
- src/etc : /etc
- src/lib : /lib
- $ONL/make/version-onl.sh : /etc/onl/loader/versions.sh
- $ONL/make/version-onl.json : /etc/onl/loader/versions.json
- $ONL/make/version-onl.mk : /etc/onl/loader/versions.mk
changelog: Change changes changes.,
- name: onl-loader-initscripts
version: 1.0.0
summary: Open Network Linux System Loader Common Initscripts
files:
src/bin/initblockdev : /sbin/
src/bin/initmounts : /sbin/
src/bin/initnetdev : /sbin/
changelog: Change changes changes.,

View File

@@ -0,0 +1,121 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=none>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
#
#
# </bsn.cl>
############################################################
#
# autoboot
#
# Automatic boot sequence.
#
############################################################
. /lib/msgs
if [ -f /etc/onl/abort ]; then
sleep 3
exit 1
fi
#
# The maximum number of times we will retry autobooting before
# rebooting the system.
#
AUTOBOOT_MAX=50
AUTOBOOT_COUNTER=/var/run/autoboot.count
tryagain() {
# The timeout call to the boot script does not always kill stalled wgets properly.
# If there are any lingering wgets because of a timeout in downloading
# lets make sure they die a proper death.
killall -9 wget > /dev/null 2>&1
# Get the current retry count.
autoboot_count=0
if [ -f "$AUTOBOOT_COUNTER" ]; then
. "$AUTOBOOT_COUNTER"
fi
let "autoboot_count=autoboot_count+1"
echo "autoboot_count=$autoboot_count" > "$AUTOBOOT_COUNTER"
if [ "$autoboot_count" -gt "$AUTOBOOT_MAX" ]; then
# Reboot
msg_info "The Maximum number of autoboot attempts has been reached. Restarting..."
sleep 3
reboot
fi
exec $0 "$@"
}
if [ "$1" != "now" ]; then
if [ -f /bin/banner ]; then
/bin/banner
if [ -f /etc/onl/abort ]; then
sleep 3
exit 1
fi
fi
echo
echo
echo "Press Control-C now to enter the interactive loader shell."
sleep 3
echo
msg_info "Starting Autoboot"
fi
#
# Apply any network settings indicated in the boot-config.
#
msg_info "Configuring Interfaces"
if ! ifup; then
msg_error "The network settings indicated in the boot-config could not be applied."
echo $(cat /etc/onl/NET)
echo
tryagain
fi
#
# Bootmode selection.
#
if [ ! -f /etc/onl/BOOTMODE ]; then
msg_error "There is no BOOTMODE setting. Autobooting cannot continue."
exit 1
fi
BOOTMODE=$(cat /etc/onl/BOOTMODE)
if [ ! "$BOOTMODE" ]; then
msg_error "The BOOTMODE setting is empty. Autobooting cannot continue."
exit 1
fi
BOOTMODE=$(echo $BOOTMODE | tr '[:upper:]' '[:lower:]')
msg_info "BOOTMODE is $BOOTMODE."
if [ -f "/bootmodes/$BOOTMODE" ]; then
"/bootmodes/$BOOTMODE"
rv=$?
#
# If successful the BOOTMODE handler should not even return.
# If we get here its because of some sort of error.
#
if [ $rv -eq 0 ]; then
msg_error "The $BOOTMODE boot handler returned successfully. This is likely a bug. Autobooting cannot continue."
exit 1
elif [ $rv -eq 200 ]; then
msg_error "The $BOOTMODE boot handler indicates an unrecoverable error. Autobooting cannot continue."
exit 1
else
# Potentially recoverable error. Continue trying.
tryagain
fi
else
msg_error "BOOTMODE $BOOTMODE is not implemented. Autobooting cannot continue."
exit 1
fi

View File

@@ -0,0 +1,42 @@
#!/bin/sh
. /lib/msgs
. /lib/customize.sh
field()
{
if [ -n "$1" ]; then
echo "* $2"
fi
}
ONL_PLATFORM=$(cat /etc/onl/platform)
MA1_ADDR=$(ifconfig ma1 | awk '/HWaddr/ { print tolower($5)}')
echo "************************************************************"
echo "*"
echo "* $LOADER_SYSTEM_NAME $LOADER_LOADER_NAME"
echo "* "
field "$VERSION_ID" " Version: $VERSION_ID"
field "$VERSION_ID" " Id: $BUILD_ID"
echo "*"
field "$ONL_PLATFORM" " Platform: $ONL_PLATFORM"
field "MA1_ADDR" " ma1: $MA1_ADDR"
echo "*"
echo "************************************************************"
if [ -f /mnt/flash/boot-config ]; then
msg_info "boot-config"
cat /mnt/flash/boot-config
else
if [ -f /bin/boot-config.py ]; then
if /bin/boot-config.py configure; then
echo "The system will now reboot to apply your configuration."
reboot
else
echo "The boot-config script failed." >> /etc/onl/abort
fi
else
msg_info "No boot-config"
fi
fi

View File

@@ -0,0 +1,149 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# boot
#
# Handle booting SWI image locators.
#
############################################################
set -e
unset testonly help cache
while [ "$1" ]; do
case "$1" in
-h|--help) help=1 ;;
-t|--testonly) testonly=1 ;;
--cache) shift; cache="$1" ;;
*) break ;;
esac
shift
done
SWI=$1
mkdir -p /etc/onl
if [ ! "${SWI}" ] || [ "${help}" ]; then
cat <<EOF
Usage: $0 [-h|--help] [-t|--testonly] [--rootfs ROOTFS] --cache LOCATION [SWI]
Loads and boots a software image (SWI). The load method depends on the
format of the SWI argument:
DEV:PATH
/mnt/DEV/PATH
Loads a SWI file from local storage device DEV (e.g. flash).
http://[USER:PASSWORD@]SERVER[:PORT]/PATH
ftp://[USER:PASSWORD@]SERVER[:PORT]/PATH
ssh|scp://USER:PASSWORD[:PORT]@SERVER/PATH
tftp://SERVER[:PORT]/PATH
Downloads a SWI file via HTTP, FTP, SSH or TFTP.
nfs://SERVER[:PORT]/PATH
If PATH is a file, mounts the parent directory via NFS and loads the
SWI file. If PATH is a directory, mounts the directory and loads
the SWI without unpacking (PATH must end with / and the directory
must contain an unpacked SWI).
EOF
exit 1
fi
shift
[ ! "${testonly}" ] || set -x
unset swipath host port dir file dev user password
case "${SWI}" in
http:*|ftp:*)
echo "Downloading ${SWI}"
wget -O /tmp/swi0 "${SWI}"
mv /tmp/swi0 /tmp/swi
swipath=/tmp/swi
;;
scp:*|ssh:*)
echo "Downloading ${SWI}"
eval $(echo "${SWI}" | sed -n 's#\(scp\|ssh\)://\([^:]*\):\([^@]*\)@\([^/:]*\)\(:\([0-9]\+\)\)\?/\(.*\)#user="\2" password="\3" host="\4" port="\6" file="\7"#p')
[ "${port}" ] || port=22
DROPBEAR_PASSWORD="${password}" dbclient -y -p ${port} -l "${user}" "${host}" "cat /${file}" >/tmp/swi0
mv /tmp/swi0 /tmp/swi
swipath=/tmp/swi
;;
tftp:*)
echo "Downloading ${SWI}"
eval $(echo "${SWI}" | sed -n 's#tftp://\([^/:]*\|\[[^]/]*\]\)\(:\([0-9]\+\)\)\?/\(.*\)#host="\1" port="\3" file="\4"#p')
tftp -g -r "${file}" -l /tmp/swi0 "${host}" ${port}
mv /tmp/swi0 /tmp/swi
swipath=/tmp/swi
;;
nfs:*)
eval $(echo "${SWI}" | sed -n 's#nfs://\([^/:]*\|\[[^]/]*\]\)\(:\([0-9]\+\)\)\?\(.*\)/\(.*\)#host="\1" port="\3" dir="\4" file="\5"#p')
[ "${dir}" ] || dir=/
[ "${port}" ] || port=0
echo "Mounting nfs://${host}:${port}${dir}"
umount -l /tmp/nfs 2>/dev/null || :
mkdir -p /tmp/nfs
mount -t nfs -o "nolock,port=${port}" "${host}:${dir}" /tmp/nfs
if [ "${file}" ]; then
swipath="/tmp/nfs/${file}"
[ ! -d ${swipath} ] || { echo "${SWI} must be a SWI file (use ${SWI}/ for a SWI directory)"; exit 1; }
else
swipath=/tmp/nfs
[ -d "${swipath}/${rootfs}" ] || { echo "${SWI}${rootfs} must be an unpacked rootfs"; exit 1; }
mount -t nfs -o "nolock,port=${port}" "${host}:${dir}/${rootfs}" "${swipath}/${rootfs}"
fi
;;
*)
# Parse dev:file or dev:/file or /mnt/dev/file
parselocal='s#\(\([^:/]*\):/\?\|/mnt/\([^/]*\)/\)\?\(.*\)#dev="\2\3" file="\4"#p'
eval $(echo "${SWI}" | sed -n "${parselocal}")
if [ "${dev}" ] ; then
# Wait for /mnt/dev to show up
waitforblockdev "/mnt/${dev}"
else
# Assume file is relative, parse absolutified file
eval $(realpath "${file}" | sed -n "${parselocal}")
SWI="${dev}:${file}"
fi
swipath="/mnt/${dev}/${file}"
[ -f "${swipath}" ] || { echo "${SWI} not found or not a file"; exit 1; }
;;
esac
echo "SWI=${SWI}" >/etc/onl/boot-config
echo "CONSOLESPEED=$(stty speed)" >>/etc/onl/boot-config
PASSWORD=$(cat /etc/onl/PASSWORD)
[ ! "${PASSWORD}" ] || echo "PASSWORD=${PASSWORD}" >>/etc/onl/boot-config
if [ "${swipath#/tmp/nfs}" != "${swipath}" ]; then
ifget
cat /etc/onl/NET >>/etc/onl/boot-config
fi
#
# Cache the SWI if necessary.
#
if [ -n "$cache" ]; then
python /bin/swicache.py "${swipath}" "${cache}"
fi
. /lib/boot1
echo "Boot failed"
exit 1

View File

@@ -0,0 +1,119 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# discoverbootconf
#
# Discover the current boot configuration.
#
############################################################
. /lib/loader-functions || exit 1
intf=$1
if [ ! ${intf} ]; then
echo "Usage: $0 INTERFACE"
exit 1
fi
if ! ifconfig ${intf} >/dev/null 2>&1; then
echo "Interface ${intf} not found; can't discover boot configuration"
exit 1
fi
ifconfig ${intf} up
ip route add to 224.0.0.0/4 dev ${intf}
zcip ${intf}
rm -f /tmp/udhcpc.boot_file /tmp/udhcpc.pid
udhcpc -i ${intf} -b -t 1 -A 3
trap "exit 1" SIGINT
trap "kill \$(cat /tmp/udhcpc.pid); ifconfig ${intf} down" EXIT
macaddr=$(ifconfig ${intf} | awk '/HWaddr/ { print tolower($5) }')
platform=$(cat /etc/onl/platform)
# see if we are in (or if we want to be in) ZTN mode
# retrieve the cached state of the previous swi
swi_url_orig=$(sed -n -e 's/^SWI=\(.*\)/\1/p' /etc/onl/boot-config)
case "$swi_url_orig" in
"")
ZTN=1
swi_url_orig="flash2:.ztn-onl.swi"
;;
flash2:.ztn-onl.swi)
ZTN=1
;;
/mnt/flash2/.ztn-onl.swi)
ZTN=1
swi_url_orig="flash2:.ztn-onl.swi"
;;
esac
if [ "$ZTN" ]; then
waitforblockdev /mnt/flash2
if [ -f /mnt/flash2/.ztn-onl.swi ]; then
swi_md5_orig=$(md5sum /mnt/flash2/.ztn-onl.swi 2>/dev/null | awk '{print $1}')
fi
if [ -f /mnt/flash2/.ztn-startup-config ]; then
cfg_md5_orig=$(md5sum /mnt/flash2/.ztn-startup-config 2>/dev/null | awk '{print $1}')
fi
fi
while true; do
echo "Looking for boot configuration; press Control-C to stop"
dsc_dhcp_boot $intf $macaddr && exit
if [ "$ZTN" ]; then
# borrow liberally from ONIE (rootconf/default/bin/discover)
# ha ha, the wget IPv6 link local syntax is screwy
# (and also does not match upstream GNU wget)
ping6 -I ${intf} -c 3 ff02::1 > /dev/null 2>&1
neighs6=$(ip -6 neigh show | awk '{printf("%s%%'$intf'\n", $1)}')
ping -I ${intf} -w 2 -c 3 -q 255.255.255.255 > /dev/null 2>&1
neighs=$(ip -4 neigh show | awk '{print $1}')
fi
for a in $neighs6 $neighs; do
dsc_swi_manifest $macaddr $a && exit
done
bootservers=$(cat /tmp/udhcpc.boot_file 2>/dev/null)
for a in ${bootservers} ff02::fb 224.0.0.251; do
dsc_dnssd $macaddr $a && exit
done
done
# Local variables:
# indent-tabs-mode: nil
# sh-basic-offset: 4
# End:

View File

@@ -0,0 +1,50 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# help
#
# Loader Help
#
############################################################
cat <<EOF
Commonly-used loader commands
ls Prints a list of the files in the current working directory
cd Changes the current working directory
cp Copies a file
more Prints the contents of a file one page at a time
vi Edits a text file
boot Boots a SWI
swiinfo Prints information about a SWI
recover Recovers the factory-default configuration
reboot Reboots the switch
netconf Configures a network interface manually (IPv4 or IPv6)
udhcpc Configures a network interface automatically via DHCP (IPv4 only)
wget Transfers a file from an HTTP or FTP server
scp Transfers a file to or from a server running SSH
Run 'command -h' for brief help on a specific command.
See http://busybox.net/ for additional help on many commands.
EOF

View File

@@ -0,0 +1,49 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# ifget
#
# Scrape network interface settings into /etc/onl/NET
#
############################################################
: >/etc/onl/NET
NETDEV=$(ip -o link show up | sed -n -e '/LOOPBACK/d' -e 's/^[0-9]\+: \([^:]\+\): .*/\1/p' | head -n 1)
[ "${NETDEV}" ] || exit 0
echo "NETDEV=${NETDEV}" >>/etc/onl/NET
if [ -f /tmp/udhcpc.pid ]; then
echo "NETAUTO=dhcp" >>/etc/onl/NET
else
set -- $(ip -o addr show dev ${NETDEV} | sed -n 's/^[0-9]\+: [^ ]\+ \+\([^ ]\+ [^ ]\+\) scope global.*/\1/p' | tail -n 1)
echo "NETIP=$2" >>/etc/onl/NET
if [ "$1" ]; then
echo "NETGW=$(ip -o -f $1 route show | sed -n 's/^default via \([^ ]\+\).*/\1/p')" >>/etc/onl/NET
fi
if [ -f /etc/resolv.conf ]; then
echo "NETDOMAIN=$(sed -n 's/search \+\([a-zA-Z0-9\.-]\+\).*/\1/p' /etc/resolv.conf)" >>/etc/onl/NET
echo "NETDNS=$(sed -n 's/nameserver \+\([0-9\.]\+\).*/\1/p' /etc/resolv.conf)" >>/etc/onl/NET
fi
fi
echo "NETHW=$(ip -o link show dev ${NETDEV} | sed -n 's/^.*link\/ether \([0-9a-fA-F:]\+\).*/\1/p')" >>/etc/onl/NET

View File

@@ -0,0 +1,89 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# ifup
#
# Configure a network interface from settings in /etc/onl/NET
# NETDEV: device name
# NETAUTO: autoconfiguration method ("dhcp" or empty)
# NETIP: IP address (/prefix optional for v4)
# NETMASK: netmask (if NETIP has no prefix)
# NETGW: default gateway IP address (optional)
# NETDOMAIN: DNS default domain (optional)
# NETDNS: DNS server IP address (optional)
# NETHW: hardware (MAC) address (optional)
#
############################################################
unset NETDEV NETAUTO NETIP NETMASK NETGW NETDOMAIN NETDNS NETHW
. /etc/onl/NET
[ "${NETDEV}" ] || exit
if [ "${NETHW}" ]; then
ip link set dev ${NETDEV} addr ${NETHW}
fi
case "${NETAUTO}" in
dhcp|auto)
echo 1 >/proc/sys/net/ipv6/conf/${NETDEV}/autoconf
udhcpc -i ${NETDEV}
;;
up)
ifconfig "${NETDEV}" up
;;
*)
if [ "${NETIP}" ] && [ "${NETMASK}" ] && [ "${NETIP#*/}" = "${NETIP}" ]; then
NETIP=${NETIP}/$(ipcalc -p -s ${NETIP} ${NETMASK} | sed -n 's/PREFIX=//p')
fi
ip link set ${NETDEV} down
echo 0 >/proc/sys/net/ipv6/conf/${NETDEV}/autoconf
ip addr flush dev ${NETDEV}
if [ "${NETIP}" ]; then
ip addr add ${NETIP} dev ${NETDEV}
fi
ip link set ${NETDEV} up
if [ "${NETGW}" ]; then
ip route add default via ${NETGW}
fi
>/etc/resolv.conf
if [ "${NETDOMAIN}" ]; then
echo "search ${NETDOMAIN}" >>/etc/resolv.conf
fi
if [ "${NETDNS}" ]; then
echo "nameserver ${NETDNS}" >>/etc/resolv.conf
fi
;;
esac
#
# If no network settings were applied, bring the interface up for link-local usage.
#
grep -q down "/sys/class/net/${NETDEV}/operstate" || ifconfig "${NETDEV}" up
for i in $(seq 30); do
(ip -o -6 addr list dev ${NETDEV} | grep tentative >/dev/null) || break
if [ $i = 5 ]; then
echo "Waiting for IPv6 duplicate address detection to complete..."
fi
sleep 1
done

View File

@@ -0,0 +1,82 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# initblockdev
#
# Initialize all block mounts for the platform.
#
############################################################
set -e
exec 9<$0
flock -x 9
case $2 in
add)
eval $(echo $1 | sed "s#^\(mmcblk[0-9]*\|ubi[0-9]*_[0-9]*\|mtdblock[0-9]*\|[a-z]*\)\(p[0-9]*\|[0-9]*\).*#dev='\1' part='\2'#")
devid=
if [ -e /sys/class/ubi/${dev}/device ]; then
eval $(realpath /sys/class/ubi/${dev}/device | sed "s#/sys/devices/\(.*\)#devid='\1'#")
fi
if [ -e /sys/class/block/${dev}/device ]; then
eval $(realpath /sys/class/block/${dev}/device | sed "s#/sys/devices/\(.*\)#devid='\1'#")
fi
while read i n; do
expr match "$i" "#" >/dev/null && continue || :
[ -n "${devid}" ] && expr match "${devid}" "$i" >/dev/null && mount=/mnt/$n && break || :
expr match "@${dev}" "$i" >/dev/null && mount=/mnt/$n && break || :
done </etc/onl/block
[ -n "${mount}" ]
if [ "$(dd if=/dev/${dev}${part} bs=1 count=6 2>/dev/null)" = "070701" ]; then
mount=${mount}-recover
else
mkdir -p ${mount}
[ $(stat -c %D ${mount}) = $(stat -c %D /mnt) ]
if [ "$(dd if=/dev/${dev}${part} bs=1 skip=82 count=5 2>/dev/null)" = "FAT32" ] \
|| [ "$(dd if=/dev/${dev}${part} bs=1 skip=54 count=5 2>/dev/null)" = "FAT16" ]; then
if [ ! -e /etc/onl/kdump ]; then
# Try to repair FAT filesystem automatically to prevent further
# damage (but skip it in kdump to save time and memory)
if dosfsck -a /dev/${dev}${part} >/dev/null 2>&1; then
:
else
dosfsck -n /dev/${dev}${part} >/dev/null 2>&1
fi
dosfsck -a /dev/${dev}${part} >/dev/null 2>&1 || :
fi
mount -o flush,dirsync,noatime,umask=0007 /dev/${dev}${part} ${mount} 2>/dev/null
else
mount -o noatime /dev/${dev}${part} ${mount} 2>/dev/null
fi
fi
echo -e "devid='${devid}'\ndev='${dev}'\npart='${part}'" >${mount}.conf
;;
remove)
mtab=$(mktemp /tmp/tmp.XXXXXX)
cp /proc/mounts ${mtab}
while read dev mount x; do
if [ /dev/$1 = "${dev}" ]; then
rm -f ${mount}.conf
umount -l ${mount} 2>/dev/null || :
fi
done <${mtab}
rm -f ${mtab}
;;
esac

View File

@@ -0,0 +1,275 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=none>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
#
#
# </bsn.cl>
############################################################
#
# initmounts
#
# Mount all mount points listed in /etc/onl/mounts
#
# Each line in /etc/onl/mounts is in the following syntax:
#
# /dev/sda sda mount-point
# - wait for /dev/sda to appear,
# then mount /dev/sda as /mnt/mount-point
#
# /dev/sda * mount-point
# - wait for block device /dev/sda to appear,
# then mount /dev/sda as /mnt/mount-point
# (infer /dev/sda from the left-hand path specification)
#
# block/sda sda mount-point
# block/sda * mount-point
# SYSDEV=block/sda sda mount-point
# SYSDEV=block/sda * mount-point
# - wait for /sys/block/sda to appear,
# then mount /mnt/sda as /mnt/mnt-point
#
# LABEL=MYDEV * mount-point
# LABEL="MYDEV" * mount-point
# - wait for a partition with the given label to appear
# (via polling 'blkid')
# then mount as /mnt/mnt-point
#
# UUID=some-uuid * mount-point
# UUID="some-uuid" * mount-point
# - wait for a partition with the given UUID to appear
# (via polling 'blkid')
# then mount as /mnt/mnt-point
#
# - multiple lines mapping to the same mount point can
# be listed in /etc/onl/mounts, the first one that
# is valid wins
#
# - initmounts exits with code zero (success)
# if each mount point is mounted once
#
# - initmounts exits with non-zero (failure)
# if un-mounted mount points are still remaining after 10s
#
############################################################
exec 9<$0
flock -x 9
CR="
"
PATH=$PATH:/sbin:/usr/sbin
recover="fsck"
try_mount_block()
{
local dev devpart mount
dev=$1; shift
devpart=$1; shift
mount=$1; shift
if test -b "$dev"; then
if test "$devpart" = "*"; then
devpart=`echo "$dev" | sed -e 's/^.*[/]//' `
fi
test -d /mnt/$mount || mkdir -p /mnt/$mount
if test "$recover" = "fsck"; then
if dosfsck -a /dev/$devpart; then
:
else
dosfsck -n /dev/$devpart || return
fi
else
dosfsck -n /dev/$devpart || return
fi
mount -o noatime /dev/$devpart /mnt/$mount || return
echo "mounted /dev/$devpart --> /mnt/$mount"
fi
}
try_mount_sysdev()
{
local syspath devpart mount
syspath=$1; shift
devpart=$1; shift
mount=$1; shift
if test -e /sys/$syspath; then
if test "$devpart" = "*"; then
devpart=`echo "$syspath" | sed -e 's/^.*[/]//' `
fi
test -d /mnt/$mount || mkdir -p /mnt/$mount
if test "$recover" = "fsck"; then
if dosfsck -a /dev/$devpart; then
:
else
dosfsck -n /dev/$devpart || return
fi
else
dosfsck -n /dev/$devpart || return
fi
mount -o noatime /dev/$devpart /mnt/$mount || return
echo "mounted /dev/$devpart --> /mnt/$mount"
fi
}
try_mount_label()
{
local label devpart mount
label=$1; shift
devpart=$1; shift
mount=$1; shift
local ifs dummy line dev
ifs=$IFS; IFS=$CR
for line in `blkid`; do
IFS=$ifs
case " $line " in
*" LABEL=${label} "*)
dev=`echo "$line" | sed -e 's/:.*//'`
break
;;
*" LABEL=\"${label}\" "*)
dev=`echo "$line" | sed -e 's/:.*//'`
break
;;
esac
done
IFS=$ifs
if test "$dev"; then
try_mount_block "$dev" "$devpart" "$mount"
fi
}
try_mount_uuid()
{
local uuid devpart mount
uuid=$1; shift
devpart=$1; shift
mount=$1; shift
local ifs dummy line dev
ifs=$IFS; IFS=$CR
for line in `blkid`; do
IFS=$ifs
case " $line " in
*" UUID=${uuid} "*)
dev=`echo "$line" | sed -e 's/:.*//'`
break
;;
*" UUID=\"${label}\" "*)
dev=`echo "$uuid" | sed -e 's/:.*//'`
break
;;
esac
done
IFS=$ifs
if test "$dev"; then
try_mount_block "$dev" "$devpart" "$mount"
fi
}
try_mount()
{
local devspec devpart mount
devspec=$1; shift
devpart=$1; shift
mount=$1; shift
if grep " /mnt/$mount " /proc/mounts 1>/dev/null; then
return
fi
local sysdev label uuid
case "$devspec" in
/dev/*)
try_mount_block "$devspec" "$devpart" "$mount"
;;
block/*)
try_mount_sysdev "$devspec" "$devpart" "$mount"
;;
SYSDEV=\"*\")
sysdev=`echo "$devspec" | sed -e 's/SYSDEV=\"\(.*\)\"/\1/'`
try_mount_sysdev "$sysdev" "$devpart" "$mount"
;;
SYSDEV=*)
sysdev=`echo "$devspec" | sed -e 's/SYSDEV=\(.*\)/\1/'`
try_mount_sysdev "$sysdev" "$devpart" "$mount"
;;
LABEL=\"*\")
label=`echo "$devspec" | sed -e 's/LABEL=\"\(.*\)\"/\1/'`
try_mount_label "$label" "$devpart" "$mount"
;;
LABEL=*)
label=`echo "$devspec" | sed -e 's/LABEL=\(.*\)/\1/'`
try_mount_label "$label" "$devpart" "$mount"
;;
UUID=\"*\")
uuid=`echo "$devspec" | sed -e 's/UUID=\"\(.*\)\"/\1/'`
try_mount_uuid "$uuid" "$devpart" "$mount"
;;
UUID=*)
uuid=`echo "$devspec" | sed -e 's/UUID=\(.*\)/\1/'`
try_mount_uuid "$uuid" "$devpart" "$mount"
;;
*)
echo "*** invalid block specifier: $devspec" 1>&2
;;
esac
}
visit_onl_mounts()
{
local fn rest
fn=$1; shift
rest="$@"
local ifs dummy line remain
remain=0
ifs=$IFS; IFS=$CR
for line in $(cat /etc/onl/mounts); do
IFS=$ifs
set -f
set dummy $line; shift
devspec=$1; shift
devpart=$1; shift
mount=$1; shift
grep " /mnt/$mount " /proc/mounts 1>/dev/null && continue
remain=1
eval $fn "$devspec" "$devpart" "$mount" $rest
set +f
done
IFS=$ifs
return $remain
}
if test -f /etc/onl/mounts; then
timeout=10
while test $timeout -gt 0; do
if visit_onl_mounts try_mount; then
echo "Found all mounts."
exit 0
fi
sleep 1
timeout=$(( $timeout - 1 ))
done
if test "$timeout" -eq 0; then
echo "Timed out waiting for block devices"
exit 1
fi
fi

View File

@@ -0,0 +1,52 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# initnetdev
#
# Initialize management interfaces specified in /etc/onl/net
#
# This maps the platform's management interface to well-known
# interface names (such as ma1)
#
############################################################
set -e
exec 9<$0
flock -x 9
case $2 in
add)
dev=$1
devid=
if [ -e /sys/class/net/${dev}/device ]; then
eval $(realpath /sys/class/net/${dev}/device | sed 's#/sys/devices/\(.*\)#devid=\1#')
fi
while read i n; do
expr match "$i" "#" >/dev/null && continue || :
[ -n "${devid}" ] && expr match "${devid}" "$i" >/dev/null && name=$n && break || :
expr match "@${dev}" "$i" >/dev/null && name=$n && break || :
done </etc/onl/net
[ -n "${name}" ]
if ! ip link show "${name}" 2>&1 > /dev/null; then
ip link set dev ${dev} name ${name}
fi
;;
esac

View File

@@ -0,0 +1,49 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# login
#
############################################################
trap '' SIGINT
if (
set -e
PASSWORD=$(cat /etc/onl/PASSWORD)
[ -z "${PASSWORD}" ] || checkpass -p "Password:" "${PASSWORD}"
)
then
# Authenticated succeeded
trap - SIGINT
exec sh --login
else
# Authentication failed
echo "Authentication failed."
exit 1
fi

View File

@@ -0,0 +1,61 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# netconf
#
#
# User configuration of the management interface.
#
############################################################
[ "$1" = "-h" ] && { echo "Manually configures a management Ethernet interface"; exit; }
echo "Management network interface configuration tool"
echo "(Press Control-C to cancel)"
echo ""
unset NETDEV NETIP NETMASK NETGW NETDOMAIN NETDNS
read -p "Which interface (blank for ma1)? " NETDEV
[ "${NETDEV}" ] || NETDEV=ma1
while [ ! "${NETIP}" ]; do
read -p "IP address (/prefix optional for v4)? " NETIP
done
if [ "${NETIP#*/}" = "${NETIP}" ]; then
while [ ! "${NETMASK}" ]; do
read -p "Netmask? " NETMASK
done
fi
read -p "Default gateway IP address (blank for none)? " NETGW
read -p "DNS IP address (blank for none)? " NETDNS
read -p "DNS default domain (blank for none)? " NETDOMAIN
echo ""
echo "Configuring interface ${NETDEV}"
echo "NETDEV=${NETDEV}" >/etc/onl/NET
echo "NETIP=${NETIP}" >>/etc/onl/NET
echo "NETMASK=${NETMASK}" >>/etc/onl/NET
echo "NETGW=${NETGW}" >>/etc/onl/NET
echo "NETDOMAIN=${NETDOMAIN}" >>/etc/onl/NET
echo "NETDNS=${NETDNS}" >>/etc/onl/NET
ifup

View File

@@ -0,0 +1,65 @@
#!/usr/bin/python
import argparse
import os
import sys
import hashlib
import shutil
import logging
logging.basicConfig()
logger = logging.getLogger("swicache")
logger.setLevel(logging.INFO)
def filehash(fname, blocksize=1024*1024):
h = hashlib.sha1()
with open(fname,'rb') as f:
block = 0
while block != b'':
block = f.read(blocksize)
h.update(block)
return h.hexdigest()
def write_hash(fname, digest):
open(fname, "w").write(digest)
def read_hash(fname):
return open(fname).read()
ap = argparse.ArgumentParser(description="SWI Cacher")
ap.add_argument("src")
ap.add_argument("dst")
ap.add_argument("--force", action='store_true')
ops = ap.parse_args()
# Generate hash of the source file
logger.info("Generating hash for %s..." % ops.src)
src_hash = filehash(ops.src)
logger.info("Generated hash for %s: %s" % (ops.src, src_hash))
dst_hash_file = "%s.md5sum" % ops.dst
if not ops.force:
if os.path.exists(ops.dst) and os.path.exists(dst_hash_file):
# Destination exists and the hash file exists.
dst_hash = read_hash(dst_hash_file)
if dst_hash == src_hash:
# Src and destination are the same.
logger.info("Cache file is up to date.")
sys.exit(0)
#
# Either force==True, a destination file is missing, or the
# current file is out of date.
#
logger.info("Updating %s --> %s, %s" % (ops.src, ops.dst, src_hash))
if not os.path.isdir(os.path.dirname(ops.dst)):
os.makedirs(os.path.dirname(ops.dst))
shutil.copyfile(ops.src, ops.dst)
write_hash(dst_hash_file, src_hash);
logger.info("Syncing...")
os.system("sync")
logger.info("Done.")

View File

@@ -0,0 +1,35 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# swiinfo
#
# Get the version information from the given SWI.
#
############################################################
set -e
[ -n "$1" ] && [ "$1" != "-h" ] || { echo "Usage: $0 SWI"; exit 1; }
swi=$1
rm -f /tmp/version
unzip -l ${swi}
echo
unzip -pq ${swi} version

View File

@@ -0,0 +1,60 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# switchroot
#
# This script is a wrapper for busybox switch_root, which works only if:
# - executed as PID 1 (i.e. replacing init)
# - /init is a regular file
# - /newroot is a tmpfs or ramfs
# - /newroot is a different filesystem from /
#
# The only way to execute as PID 1 with busybox init is to invoke it via
# the restart action in the inittab.
#
############################################################
# Unmount all filesystems except / and anything under /newroot
mtab=$(mktemp /tmp/tmp.XXXXXX)
cp /proc/mounts ${mtab}
while read dev mount x; do
case "${mount}" in
/|/proc|/sys|/dev|/newroot|/newroot/*)
;;
*)
rm -f "${mount}".conf
umount -l "${mount}" 2>/dev/null
;;
esac
done <${mtab}
rm -f ${mtab}
mount --move /proc /newroot/proc
mount --move /sys /newroot/sys
mount --move /dev /newroot/dev
# Switch to /newroot if possible, else re-execute /init
if [ -x /newroot/sbin/init ]; then
exec switch_root -c /dev/console /newroot /sbin/init
else
exec /init
fi

View File

@@ -0,0 +1,156 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# sysinit
#
# Busybox sysinit script.
#
############################################################
# Suppress console output until baud rate is set
exec 4>&1 1>/tmp/sysinit.out 2>&1
restoreconsole() { cat /tmp/sysinit.out 1>&4; exec 1>&4 2>&4; >/tmp/sysinit.out; }
trap "restoreconsole; reboot -f" EXIT
# Mount special filesystems
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -o remount,size=1M /dev
# Grab cmdline settings
touch /etc/onl/boot-config
tr -s " " "\n" </proc/cmdline |
while read -r l; do
n=${l%%=*}
[ "$l" = "${l#*=}" ] && v= || v="${l#*=}"
case $n in
onl_*)
filename="$(echo $n | sed s/^onl_//)"
echo "$v" > "/etc/onl/$filename"
;;
esac
done
# Populate platform-specific settings
. /lib/platform-detect
if [ ! -f /etc/onl/abort ]; then
# Tell kernel to invoke mdev when devices are added or removed
echo /sbin/mdev >/proc/sys/kernel/hotplug
# Initialize any block and net devices already present
( cd /sys/class/block; for d in *; do initblockdev $d add; done )
if [ -d /sys/class/ubi ]; then
( cd /sys/class/ubi; for d in *; do initblockdev $d add; done )
fi
( cd /sys/class/net; for d in *; do initnetdev $d add; done )
# Initialize platform mounts
initmounts
# Perform recovery if necessary; reboot automatically
if /bin/recover; then
initmounts
else
restoreconsole
echo "Recovery failed."
echo "Press CR now to exit sysinit and access the loader shell."
echo "Otherwise, the system will reboot in 3s."
if read -t 3 prompt; then
trap - EXIT
exit
fi
reboot -f
fi
if [ -f /etc/issue ]; then
cat /etc/issue
fi
waitforblockdev /mnt/flash
sleep 1 # wait for external block devices to be mounted
[ ! -f /mnt/flash/boot-config ] || cat /mnt/flash/boot-config >>/etc/onl/boot-config
#
# Initialize the /mnt/flash/boot area.
#
mkdir -p /mnt/flash/boot
rm -rf /mnt/flash/boot/*
fi
#
# Initialize PKI
#
if [ -f /sbin/init-pki ]; then
/sbin/init-pki
fi
# Parse settings
touch /etc/onl/SWI /etc/onl/CONSOLESPEED /etc/onl/PASSWORD /etc/onl/NET /etc/onl/BOOTMODE /etc/onl/BOOTPARAMS
while read -r l; do
n=${l%%=*}
[ "$l" = "${l#*=}" ] && v= || v="${l#*=}"
case $n in
CONSOLESPEED)
echo "$v" >/etc/onl/CONSOLESPEED
;;
PASSWORD)
echo "$v" >/etc/onl/PASSWORD
;;
NET*)
echo "$l" >>/etc/onl/NET
;;
BOOTMODE)
echo "$v" >/etc/onl/BOOTMODE
;;
*)
if [ -n "$n" ]; then
echo "$n=$v" >> /etc/onl/BOOTPARAMS
fi
;;
esac
done </etc/onl/boot-config
# Set console baud rate and restore output
CONSOLESPEED=$(cat /etc/onl/CONSOLESPEED)
if [ "${CONSOLESPEED}" ]; then
stty ${CONSOLESPEED}
fi
stty sane pass8 -ixon -cstopb
restoreconsole
# By this point PASSWORD must be set in /etc/onl/PASSWORD so /bin/login
# can authenticate the user
trap - EXIT
# Local variables:
# sh-basic-offset: 4
# End:

View File

@@ -0,0 +1,29 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# udhcp
#
############################################################
. /lib/customize.sh
kill $(cat /tmp/udhcpc.pid 2>/dev/null) 2>/dev/null
exec busybox udhcpc -V $ONL_UDHCPC_VENDOR -p /tmp/udhcpc.pid -s /lib/udhcpc-script "$@"

View File

@@ -0,0 +1,36 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# waitforblockdev
#
# Wait for a block device to appear on $1, time out after
# 10 seconds
#
############################################################
local i=10
while [ $i -gt 0 ]; do
grep -q " "$1" " /proc/mounts && break
sleep 1
let i--
done
[ $i -gt 0 ] || { echo "Timed out waiting for $1"; exit 1; }

View File

@@ -0,0 +1,31 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=none>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
#
#
# </bsn.cl>
############################################################
#
# waitforsysdev
#
# Wait for a sys device to appear (as $1), time out after
# a specified interval (10s by default)
#
############################################################
dev=$1; shift
if test $# -gt 0; then
timeout=$1; shift
else
timeout=10
fi
local i=$timeout
while test $i -gt 0; do
find /sys/devices | grep $dev 1>/dev/null && break
sleep 1
i=$(( $i - 1 ))
done
[ $i -gt 0 ] || { echo "Timed out waiting for $dev"; exit 1; }

View File

@@ -0,0 +1,36 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# wipe
#
############################################################
set -e
echo "All data on /mnt/flash will be erased; type \"yes\" and press Enter to proceed,"
echo -n "or just press Enter to cancel: "
read arg
[ "${arg}" = "yes" ] || exit 1
echo "Erasing /mnt/flash"
cd /
rm -rf /mnt/flash/* /mnt/flash/.[^.]* /mnt/flash/..?*
cd /mnt/flash
recover

View File

@@ -0,0 +1,27 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# zcip
#
############################################################
exec busybox zcip "$1" /lib/zcip-script

View File

@@ -0,0 +1,35 @@
############################################################
#
# Bootmode: SWI
#
# Boot a SWI URL from the SWI BOOTPARAM value.
#
############################################################
. /lib/msgs
. /etc/onl/BOOTPARAMS
if [ ! "${SWI}" ]; then
msg_error "No SWI specified in the boot configuration. SWI booting cannot continue."
# Do not continue the autoboot sequence, nothing can be resolved automatically here.
exit 200
fi
if [ "${SWI}" = "flash2::latest" ]; then
# Boot the latest (by mtime) SWI in the flash2 partition.
SWI=`ls /mnt/flash2/*.swi -t | head -n1`
if [ -z "${SWI}" ]; then
msg_error "No SWI available in /mnt/flash2. SWI booting cannot continue."
exit 200
fi
fi
#
# The SWI setting can be a list of URLs
#
for url in $SWI; do
msg_info "Trying ${url}..."
timeout -t 60 boot "${url}" && exit 0
done
exit 1

View File

@@ -0,0 +1,6 @@
jffs2
ubifs
vfat
ext4
ext3
ext2

View File

@@ -0,0 +1,2 @@
root:x:0:
tty:x:5:

View File

@@ -0,0 +1 @@
127.0.0.1 localhost

View File

@@ -0,0 +1,12 @@
# Run /bin/sysinit without a controlling tty so that job control
# cannot be used to circumvent password security
::sysinit:/bin/sysinit
# Try booting automatically, start a shell if user interrupts it
::wait:-/bin/autoboot
::wait:-/bin/login
::wait:/bin/umount -a -r
::wait:/sbin/reboot -f
# Try to switch to rootfs if init receives SIGHUP or SIGQUIT
::restart:/bin/switchroot

View File

@@ -0,0 +1,4 @@
[hs]d[a-z]+[0-9]* 0:0 0660 */bin/initblockdev ${MDEV} ${ACTION:-add}
mmcblk[0-9]+ 0:0 0660 */bin/initblockdev ${MDEV} ${ACTION:-add}
mmcblk[0-9]+p[0-9]+ 0:0 0660 */bin/initblockdev ${MDEV} ${ACTION:-add}
eth[0-9]+ 0:0 0660 */bin/initnetdev ${MDEV} ${ACTION:-add}

View File

@@ -0,0 +1 @@
root:x:0:0:root:/root:/bin/sh

View File

@@ -0,0 +1,21 @@
#!/bin/sh
. /lib/customize.sh
PS1=${ONL_PROMPT:-"loader# "}
if [ -f /etc/onl/abort ]; then
PS1="loader(aborted)# "
echo
echo "************************************************************"
echo "*** Booting cannot continue."
echo "***"
echo "*** $(cat /etc/onl/abort)"
echo "***"
echo "************************************************************"
echo
fi
echo
echo "Welcome to the $ONL_SYSTEM_NAME $ONL_SYSTEM_LOADER_NAME shell."
echo "Type 'help' for command help."
echo

View File

@@ -0,0 +1,33 @@
# See package/makedevs/README for details
#
# This device table is used to assign proper ownership and permissions
# on various files. It doesn't create any device file, as it is used
# in both static device configurations (where /dev/ is static) and in
# dynamic configurations (where devtmpfs, mdev or udev are used).
#
# <name> <type> <mode> <uid> <gid> <major> <minor> <start> <inc> <count>
/dev d 755 0 0 - - - - -
/tmp d 1777 0 0 - - - - -
/etc d 755 0 0 - - - - -
/etc/shadow f 600 0 0 - - - - -
/etc/passwd f 644 0 0 - - - - -
/bin/autoboot f 755 0 0 - - - - -
/bin/boot f 755 0 0 - - - - -
/bin/discoverbootconf f 755 0 0 - - - - -
/bin/help f 755 0 0 - - - - -
/bin/ifget f 755 0 0 - - - - -
/bin/ifup f 755 0 0 - - - - -
/bin/initblockdev f 755 0 0 - - - - -
/bin/initnetdev f 755 0 0 - - - - -
/bin/login f 755 0 0 - - - - -
/bin/netconf f 755 0 0 - - - - -
/bin/recover f 755 0 0 - - - - -
/bin/swiinfo f 755 0 0 - - - - -
/bin/switchroot f 755 0 0 - - - - -
/bin/sysinit f 755 0 0 - - - - -
/bin/udhcpc f 755 0 0 - - - - -
/bin/waitforblockdev f 755 0 0 - - - - -
/bin/wipe f 755 0 0 - - - - -
/bin/zcip f 755 0 0 - - - - -
/lib/udhcpc-script f 755 0 0 - - - - -
/lib/zcip-script f 755 0 0 - - - - -

View File

@@ -0,0 +1 @@
root::10933:0:99999:7:::

View File

@@ -0,0 +1,105 @@
# -*- sh -*-
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# boot1
#
# Copies/mounts rootfs from swi and switches root
#
######################################################################
mkdir -p /newroot
umount -l /newroot 2>/dev/null || :
if [ -d "${swipath}" ]; then
# rootfs is a directory
mount --bind "${swipath}/${rootfs}" /newroot
else
# rootfs is a squashfs
echo "Booting: ${swipath}"
mkdir -p /newroot.lower /newroot.upper
umount -l /newroot.lower 2>/dev/null || :
umount -l /newroot.upper 2>/dev/null || :
rm -f /tmp/rootfs
uarch=`uname -m`
if [ "$uarch" == "ppc" ]; then
# Try both rootfs-ppc and rootfs-powerpc
for arch in ppc powerpc; do
unzip -pq "${swipath}" "rootfs-$arch.sqsh" >/tmp/rootfs
[ ! -s /tmp/rootfs ] || break
done
elif [ "$uarch" == "x86_64" ]; then
# Try both rootfs-amd64 and rootfs-x86_64
for arch in x86_64 amd64; do
unzip -pq "${swipath}" "rootfs-$arch.sqsh" >/tmp/rootfs
[ ! -s /tmp/rootfs ] || break
done
fi
if [ ! -s /tmp/rootfs ]; then
echo "${swipath} does not contain a rootfs image for the current architecture ($uarch). Booting cannot continue."
exit 1
fi
mount -t squashfs -o loop /tmp/rootfs /newroot.lower
mount -t tmpfs -o size=15%,mode=0755 none /newroot.upper
mount -t overlayfs -o lowerdir=/newroot.lower,upperdir=/newroot.upper none /newroot
fi
mkdir -p /newroot/etc/onl
cp -R /etc/onl/* /newroot/etc/onl
if [ -f /etc/fw_env.config ]; then
cat /etc/fw_env.config >/newroot/etc/fw_env.config
fi
unzip -oq "${swipath}" swi-data.tar.gz -d /tmp
# Install any SWI data packages.
if [ -s /tmp/swi-data.tar.gz ]; then
echo "Installing SWI data into /boot..."
tar -C /newroot/boot -xzf /tmp/swi-data.tar.gz
else
echo "No SWI data to install."
fi
# If there is a SWI version file put it in /etc/onl/swi_version
unzip -oq "${swipath}" version -d /tmp
if [ -f /tmp/version ]; then
cp /tmp/version /newroot/etc/onl/swi_version
fi
#
# The file /lib/boot-custom can be provided by customized builds to
# add functionality before the root is switched.
#
if [ -f /lib/boot-custom ]; then
. /lib/boot-custom
fi
echo "Switching rootfs" # limit 16 chars since serial buffer is not flushed
kill -QUIT 1 # exec /bin/switchroot as PID 1
sleep 30
# Local variables:
# sh-basic-offset: 4
# End:

View File

@@ -0,0 +1,11 @@
LOADER_LOADER_NAME="Loader"
LOADER_PROMPT="loader# "
LOADER_UDHCPC_VENDOR="onl"
LOADER_SYSTEM_NAME="Open Network Linux"
if [ -f /etc/onl/loader/versions.sh ]; then
. /etc/onl/loader/versions.sh
fi

View File

@@ -0,0 +1,39 @@
#-*-sh-*-
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# kdump
#
# TODO: turn off the phys to prevent network loops?
# TODO: trigger watchdog?
#
############################################################
waitforblockdev /mnt/flash || exit
echo "Entered kernel crash handler"
if ! vmcore-dmesg /proc/vmcore >/tmp/kernelcrash; then
echo "vmcore-dmesg failed; cannot dump kernel crash log"
return
fi
mkdir -p /mnt/flash/debug
cp /tmp/kernelcrash /mnt/flash/debug/ && echo "Wrote /mnt/flash/debug/kernelcrash"
echo "Last 50 lines of kernel crash log:"
tail -50 /mnt/flash/debug/kernelcrash

View File

@@ -0,0 +1,212 @@
# -*- sh -*-
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
#
# loader-functions
#
# Loader support routines.
#
############################################################
##############################
#
# dsc_dhcp_boot INTF
#
# Grovel through the dhcp lease (udhcp) for a boot file entry.
# Return '0' for success (discovery can cease)
# Return '2' for undetermined (continue discovery)
# Anything else is an error
#
##############################
dsc_dhcp_boot()
{
local intf macaddr bootservers
intf=$1; shift
macaddr=$1; shift
bootservers=$(cat /tmp/udhcpc.boot_file 2>/dev/null)
case "$bootservers" in
SWI=*)
echo "Discovered boot configuration from DHCP"
echo "${bootservers#SWI=}" | sed "s/__macaddr__/${macaddr}/g;s/__platform__/${platform}/g" >/etc/onl/SWI
echo "NETDEV=${intf}" >/etc/onl/NET
echo "NETAUTO=dhcp" >>/etc/onl/NET
return 0
;;
esac
# else, nothing to see here
return 2
}
##############################
#
# dsc_swi_manifest
#
# Download a SWI manifest and its components.
# Return '0' for success (discovery can cease)
# Return '2' for undetermined (continue discovery)
# Anything else is an error
#
# Enviromnent:
# $swi_md5_orig
# $cfg_md5_orig
#
##############################
dsc_swi_manifest()
{
local macaddr neigh
macaddr=$1; shift
neigh=$1; shift
local url
local swi_url_mf swi_md5_new swi_md5_dl
local cfg_url_mf cfg_md5_new cfg_md5_dl
rm -f /tmp/mf0 /tmp/swi0 /tmp/cfg0
url="http://${neigh}/ztn/switch/${macaddr}/switch_light_manifest"
echo "Trying $url"
wget -O /tmp/mf0 "$url" 1>/dev/null 2>&1
test $? -eq 0 || return 2
echo "Discovered ONL manifest from neighbor discovery ($neigh)"
swi_url_mf=$(jq -M -r '.swi_url' < /tmp/mf0)
test "$swi_url_mf" || return 2
# see if there is a locally-cached SWI
swi_md5_new=$(jq -M -r '.swi_md5' < /tmp/mf0)
if [ "$swi_md5_new" = "$swi_md5_orig" ]; then
echo "Using cached ZTN SWI ($swi_url_orig)"
else
echo "Downloading new ZTN SWI $swi_url_mf"
wget -O /tmp/swi0 "$swi_url_mf" 1>/dev/null 2>&1
test $? -eq 0 || return 2
swi_md5_dl=$(md5sum /tmp/swi0 | awk '{print $1}')
if [ "$swi_md5_dl" != "$swi_md5_new" ]; then
echo "MD5 mismatch in downloaded SWI"
return 2
fi
fi
# Try to get a startup-config too
cfg_url_mf=$(jq -M -r '.startup_config_url' < /tmp/mf0)
if [ "$cfg_url_mf" ]; then
cfg_md5_new=$(jq -M -r '.startup_config_md5' < /tmp/mf0)
if [ "$cfg_md5_orig" = "$cfg_md5_new" ]; then
echo "Using cached ZTN startup-config"
else
echo "Downloading new startup-config $cfg_url_mf"
wget -O /tmp/cfg0 "$cfg_url_mf" 1>/dev/null 2>&1
test $? -eq 0 || return 2
cfg_md5_dl=$(md5sum /tmp/cfg0 | awk '{print $1}')
if [ "$cfg_md5_dl" != "$cfg_md5_new" ]; then
echo "MD5 mismatch in downloaded startup-config"
return 2
fi
fi
fi
if [ -f /tmp/swi0 ]; then
echo "Caching ZTN SWI $swi_url_mf --> /mnt/flash2/.ztn-onl.swi"
rm -f /mnt/flash2/.ztn-onl.swi
mv /tmp/swi0 /mnt/flash2/.ztn-onl.swi
fi
echo "$swi_url_orig" > /etc/onl/SWI
echo "$swi_url_mf" > /mnt/flash2/.ztn-onl.swi.url
# startup-config is optional here
if [ -f /tmp/cfg0 ]; then
echo "Caching ZTN startup-config $cfg_url_mf --> /mnt/flash2/.ztn-startup-config"
rm -f /mnt/flash2/.ztn-startup-config
mv /tmp/cfg0 /mnt/flash2/.ztn-startup-config
fi
if [ "$cfg_url_mf" ]; then
echo "$cfg_url_mf" > /mnt/flash2/.ztn-startup-config.url
else
rm -f /mnt/flash2/.ztn-startup-config /mnt/flash2/.ztn-startup-config.url
fi
return 0
}
##############################
#
# dsc_dsnssd
#
# Try to discover switch config (net and/or SWI) from DNS-SD
#
##############################
dsc_dnssd()
{
local macaddr dns
macaddr=$1; shift
dns=$1; shift
local txt word key val
echo "Trying $dns"
txt=$(dig +short +time=5 +tries=1 @$dns -p5353 ${macaddr}._slconfig._udp.local TXT)
test $? -eq 0 || return 2
echo "Discovered boot configuration from DNS-SD"
cp /dev/null /etc/onl/NET
for word in $txt; do
# words may be quoted
word=$(expr "$word" : '["]\?\(.*[^"]\)["]\?')
case "$word" in
*=*)
key=${word%%=*}; val=${word#$key=}
;;
*)
key=$word; val=
;;
esac
case "$key" in
SWI)
echo "$val" >/etc/onl/SWI
;;
NET*)
echo "$val" >> /etc/onl/NET
;;
FLASH)
echo "Getting flash::${val}..."
mkdir -p /tmp/flash
cd /tmp/flash && wget "$val"
mv /tmp/flash/* /mnt/flash
rmdir /tmp/flash
;;
esac
done
# valid DNS-SD config for this platform, stop here
return 0
}
# Local variables:
# mode: sh
# indent-tabs-mode: nil
# sh-basic-offset: 4
# End:

View File

@@ -0,0 +1,25 @@
# -*- sh -*-
############################################################
#
# Message logging.
#
############################################################
msg_info()
{
echo "[ $@ ]"
}
msg_error()
{
echo
echo "************************************************************"
echo " ERROR "
echo
echo " $@"
echo
echo "************************************************************"
echo
sleep 1
}

View File

@@ -0,0 +1,87 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# platform-detect
#
# This script attempts to detect the current platform.
#
# Under normal circumstances the platform installer
# will have already set the platform in the boot arguments.
#
# This is a fallback for older platforms, corrupt
# boot arguments, or possible detection of misconfiguration.
#
############################################################
. /lib/msgs
platform_priority_detect() {
if [ ! -f /etc/onl/platform ]; then
for d in `find /lib/platform-config -name $1`; do
chmod +x ${d}
${d}
if [ -f /etc/onl/platform ]; then
echo "platform auto-detect: $(cat /etc/onl/platform)"
break
fi
done
fi
}
############################################################
#
# Priority0 detection.
#
# Any platforms that want to preempt other platform detection
# routines should be named detect0.sh
#
platform_priority_detect detect0.sh
############################################################
#
# Normal priority detection.
platform_priority_detect detect.sh
############################################################
#
# Voluntary deprioritization wrt existing platforms.
platform_priority_detect detect1.sh
if [ ! -f /etc/onl/platform ]; then
echo "unknown" > /etc/onl/platform
fi
touch /etc/onl/net /etc/onl/block /etc/onl/mounts
platform="$(cat /etc/onl/platform)"
if [ -d /lib/platform-config/${platform} ]; then
# Grab and source the platform boot configuration file
x=/lib/platform-config/${platform}/onl/boot/${platform}
if [ -f $x ]; then
. $x
else
echo "The platform boot configuration for the current platform is broken, invalid, or missing." > /etc/onl/abort
fi
else
echo "The current platform (${platform}) is not supported in this version." > /etc/onl/abort
fi

View File

@@ -0,0 +1,41 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# udhcpc-script
#
############################################################
[ "${interface}" ] || exit
case "$1" in
deconfig)
ifconfig ${interface} 0.0.0.0
;;
renew|bound)
ifconfig ${interface} ${ip} netmask ${subnet}
[ ! "${router}" ] || ip route add default via ${router}
: >/etc/resolv.conf
[ ! "${domain}" ] || echo "search ${domain}" >>/etc/resolv.conf
[ ! "${dns}" ] || echo "nameserver ${dns}" >>/etc/resolv.conf
[ ! "${boot_file}" ] || echo "${boot_file}" >/tmp/udhcpc.boot_file
;;
esac

View File

@@ -0,0 +1,36 @@
#!/bin/sh
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# zcip-script
#
############################################################
[ "${interface}" ] || exit
case "$1" in
deconfig)
ifconfig ${interface}:0 down
;;
config)
ifconfig ${interface}:0 ${ip} netmask 255.255.0.0
;;
esac

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1,15 @@
packages:
- name: onl-vendor-config-onl
depends: python-yaml
version: 1.0.0
arch: all
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
summary: ONL Base Configuration Package
files:
src/python/onl : $PY_INSTALL/onl
src/init.d : /etc/init.d
src/bin : /usr/bin
changelog: Changes

View File

@@ -0,0 +1,4 @@
#!/usr/bin/python
from onl.platform.current import OnlPlatform
print OnlPlatform()

View File

@@ -0,0 +1,17 @@
#!/usr/bin/python
### BEGIN INIT INFO
# Provides: onl-platform-baseconf
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Set up ONL Platform
### END INIT INFO
from onl.platform.baseconfig import baseconfig
baseconfig()

View File

@@ -0,0 +1,9 @@
############################################################
# <bsn.cl fy=2013 v=none>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
#
#
# </bsn.cl>
############################################################

View File

@@ -0,0 +1,9 @@
############################################################
# <bsn.cl fy=2013 v=none>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
#
#
# </bsn.cl>
############################################################

View File

@@ -0,0 +1,249 @@
#!/usr/bin/python
############################################################
# <bsn.cl fy=2013 v=none>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
#
#
# </bsn.cl>
############################################################
import pprint
import yaml
import json
import os
class OnlInfoObject(object):
DEFAULT_INDENT=" "
def __init__(self, d, klass=None):
self._data = d
if klass:
for (m,n) in klass.__dict__.iteritems():
if m == m.upper():
setattr(self, m, None)
for (k,v) in d.iteritems():
for (m,n) in klass.__dict__.iteritems():
if n == k:
setattr(self, m, v);
break
def __getattr__(self, name):
if name in self._data:
return self._data[name]
else:
return None
def __str__(self, indent=DEFAULT_INDENT):
"""String representation of the information container."""
return OnlInfoObject.string(self._data, indent)
@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) )
############################################################
#
# System-specific information keys.
# These represent information about a particular box.
#
############################################################
class OnieInfo(object):
PRODUCT_NAME='Product Name'
PART_NUMBER='Part Number'
SERIAL_NUMBER='Serial Number'
MAC_ADDRESS='MAC'
MAC_RANGE='MAC Range'
MANUFACTURER='Manufacturer'
MANUFACTURE_DATE='Manufacture Date'
VENDOR='Vendor'
PLATFORM_NAME='Platform Name'
DEVICE_VERSION='Device Version'
LABEL_REVISION='Label Revision'
COUNTRY_CODE='Country Code'
DIAG_VERSION='Diag Version'
SERVICE_TAG='Service Tag'
ONIE_VERSION='ONIE Version'
oids = {
PRODUCT_NAME : '.1',
PART_NUMBER : '.2',
SERIAL_NUMBER : '.3',
MAC_ADDRESS : '.4',
MAC_RANGE : '.5',
MANUFACTURER : '.6',
MANUFACTURE_DATE : '.7',
VENDOR : '.8',
PLATFORM_NAME : '.9',
DEVICE_VERSION : '.10',
LABEL_REVISION : '.11',
COUNTRY_CODE : '.12',
DIAG_VERSION : '.13',
SERVICE_TAG : '.14',
ONIE_VERSION : '.15',
}
############################################################
#
# ONL Platform Base
# Baseclass for all OnlPlatform objects.
#
############################################################
class OnlPlatformBase(object):
CONFIG_DIR='/lib/platform-config'
CURRENT_DIR=os.path.join(CONFIG_DIR, 'current')
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(),
required=False)
def add_info_dict(self, name, d, klass=None):
setattr(self, name, OnlInfoObject(d, klass))
def add_info_json(self, name, f, klass=None, required=True):
if os.path.exists(f):
d = json.load(file(f))
self.add_info_dict(name, d, klass)
elif required:
raise RuntimeError("A required system file (%s) is missing." % f)
def load_configs(self, reload=False):
if reload or hasattr(self, 'configs') is False:
self.configs = {}
for subsys in os.listdir(self.basedir()):
cpath = os.path.join(self.basedir(), subsys, "configs")
if os.path.isdir(cpath):
for config in os.listdir(cpath):
with file(os.path.join(cpath, config)) as f:
if not subsys in self.configs:
self.configs[subsys] = {}
self.configs[subsys][config] = json.load(f)
def basedir(self):
return os.path.join(self.CONFIG_DIR, self.platform())
def basedir_onl(self):
return os.path.join(self.basedir(), 'onl')
def baseconfig(self):
return True
def manufacturer(self):
raise Exception("Manufacturer is not set.")
def model(self):
raise Exception("Model is not set.")
def platform(self):
raise Exception("Platform is not set.")
def description(self):
return "%s %s (%s)" % (self.manufacturer(), self.model(),
self.platform())
def serialnumber(self):
return self.onie_info.SERIAL_NUMBER
def hw_description(self):
return "%s (%s)" % (self.onie_info.PRODUCT_NAME,
self.onie_info.PART_NUMBER)
# ONL Platform Information Tree
def opit_oid(self):
return "1.3.6.1.4.1.37538.2.1000"
# ONL Platform Information General Tree
def opitg_oid(self):
return self.opit_oid() + ".1"
# ONL Platform Information General Sys Tree
def opitg_sys_oid(self):
return self.opitg_oid() + ".1"
# ONL Platform Information Vendor Tree
def opitv_oid(self):
return self.opit_oid() + ".2"
def sys_oid_vendor(self):
return ".37538"
def sys_oid_platform(self):
raise Exception("sys_oid_platform() is not set.")
def sys_object_id(self):
return ( self.opitv_oid() +
self.sys_oid_vendor() +
self.sys_oid_platform());
def new_device(self, driver, addr, bus, devdir):
if not os.path.exists(os.path.join(bus, devdir)):
try:
with open("%s/new_device" % bus, "w") as f:
f.write("%s 0x%x\n" % (driver, addr))
except Exception, e:
print "Unexpected error initialize device %s:0x%x:%s: %s" % (driver, addr, bus, e)
else:
print("Device %s:%x:%s already exists." % (driver, addr, bus))
def new_devices(self, new_device_list):
for (driver, addr, bus, devdir) in new_device_list:
self.new_device(driver, addr, bus, devdir)
def new_i2c_device(self, driver, addr, bus_number):
bus = '/sys/bus/i2c/devices/i2c-%d' % bus_number
devdir = "%d-%4.4x" % (bus_number, addr)
return self.new_device(driver, addr, bus, devdir)
def new_i2c_devices(self, new_device_list):
for (driver, addr, bus_number) in new_device_list:
self.new_i2c_device(driver, addr, bus_number)
def ifnumber(self):
# The default assumption for any platform
# is ma1 and lo
return 2
def __str__(self):
s = """Manufacturer: %s
Model: %s
Platform: %s
Description: %s
System Object Id: %s
System Information:
%s
%s
""" % (
self.manufacturer(),
self.model(),
self.platform(),
self.description(),
self.sys_object_id(),
str(self.onie_info),
str(self.platform_info),
)
if hasattr(self, 'warning'):
s += """
Warning: %s
""" % (self.warning())
return s

View File

@@ -0,0 +1,66 @@
############################################################
#
# Platform Base Configuration
#
############################################################
import sys
import os
from onl.platform.base import OnlPlatformBase
from onl.platform.current import OnlPlatform
import shutil
def msg(s, fatal=False):
sys.stderr.write(s)
sys.stderr.flush()
if fatal:
sys.exit(1)
def baseconfig():
platform=OnlPlatform()
msg("Setting up base ONL platform configuration for %s...\n" %
platform.platform())
if os.path.exists(OnlPlatform.CURRENT_DIR):
os.unlink(OnlPlatform.CURRENT_DIR)
os.symlink(platform.basedir(), OnlPlatform.CURRENT_DIR)
DEB_GNU_HOST_TYPE = None
HOST_TYPES = [ 'powerpc-linux-gnu',
'i486-linux-gnu',
'i386-linux-gnu',
'x86_64-linux-gnu' ]
for ht in HOST_TYPES:
if os.path.exists('/lib/%s' % ht):
DEB_GNU_HOST_TYPE=ht
break
if DEB_GNU_HOST_TYPE is None:
msg("Could not determine the current host type.\n", fatal=True)
DEFAULT_ONLP_LIB = "/lib/%s/libonlp-platform.so" % DEB_GNU_HOST_TYPE
PLATFORM_ONLP_LIB = "%s/lib/libonlp-%s.so" % (platform.basedir_onl(), platform.platform())
if os.path.exists(PLATFORM_ONLP_LIB):
if os.path.exists(DEFAULT_ONLP_LIB):
os.unlink(DEFAULT_ONLP_LIB)
os.symlink(PLATFORM_ONLP_LIB, DEFAULT_ONLP_LIB)
ONLPDUMP = "%s/bin/onlpdump" % (platform.basedir_onl())
if not platform.baseconfig():
msg("*** platform class baseconfig failed.\n", fatal=True)
if os.path.exists(ONLPDUMP):
os.system("%s -i > %s/oids" % (ONLPDUMP,platform.basedir_onl()))
os.system("%s -o -j > %s/onie-info.json" % (ONLPDUMP, platform.basedir_onl()))
os.system("%s -x -j > %s/platform-info.json" % (ONLPDUMP, platform.basedir_onl()))
msg("Setting up base platform configuration for %s: done\n" %
platform.platform())

View File

@@ -0,0 +1,33 @@
#!/usr/bin/python
############################################################
# <bsn.cl fy=2013 v=none>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
#
#
# </bsn.cl>
############################################################
#
# This file provides the container for the
# platform-specific class provided by the files in the
# platform-config packages.
#
############################################################
import importlib
def import_subsystem_platform_class(subsystem='onl', klass='OnlPlatform'):
# Determine the current platform name.
with open("/etc/onl/platform", 'r') as f:
platform=f.read().strip()
platform_module = platform.replace('-', '_')
# Import the platform module
m = importlib.import_module('%s.platform.%s' % (subsystem, platform_module))
return getattr(m, '%s_%s' % (klass, platform_module))
OnlPlatform = import_subsystem_platform_class()

View File

@@ -0,0 +1,24 @@
#!/usr/bin/python
############################################################
#
# Common commandline main implementation for platform
# testing.
#
############################################################
import argparse
def main(platform):
ap = argparse.ArgumentParser(description="ONL Platform tool.")
ap.add_argument("--info", action='store_true')
ap.add_argument("--env", action='store_true')
ops = ap.parse_args()
if ops.info:
print platform
if ops.env:
print platform.get_environment()

1
packages/base/amd64/faultd/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1,5 @@
!include $ONL/packages/base/any/faultd/APKG.yml ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu

View File

@@ -0,0 +1,2 @@
faultd.mk
faultd-module.mk

View File

@@ -0,0 +1,3 @@
include $(ONL)/make/config.amd64.mk
include $(ONL)/packages/base/any/faultd/builds/Makefile

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1 @@
!include $ONL/packages/base/any/initrds/loader/APKG.yml ARCH=amd64

View File

@@ -0,0 +1,3 @@
loader-rootfs
buildroot-makedevs
manifest.json

View File

@@ -0,0 +1,2 @@
include $(ONL)/make/config.amd64.mk
include $(ONL)/packages/base/any/initrds/loader/builds/Makefile

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1,2 @@
!include $ONL/packages/base/any/onlp/APKG.yml ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu

View File

@@ -0,0 +1 @@
libonlp-module.mk

View File

@@ -0,0 +1,3 @@
DIRECTORIES := onlp-platform-defaults onlp-platform onlp
include $(ONL)/make/subdirs.mk

View File

@@ -0,0 +1 @@
libonlp-platform-defaults-module.mk

View File

@@ -0,0 +1,2 @@
include $(ONL)/make/config.amd64.mk
include $(ONL)/packages/base/any/onlp/builds/onlp-platform-defaults/Makefile

View File

@@ -0,0 +1 @@
libonlp-platform-module.mk

View File

@@ -0,0 +1,3 @@
include $(ONL)/make/config.amd64.mk
include $(ONL)/packages/base/any/onlp/builds/onlp-platform/Makefile

View File

@@ -0,0 +1,3 @@
include $(ONL)/make/config.amd64.mk
include $(ONL)/packages/base/any/onlp/builds/onlp/Makefile

1
packages/base/amd64/rootfs/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
*.d/

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1 @@
!include $ONL/packages/base/any/rootfs/APKG.yml ARCH=amd64

View File

@@ -0,0 +1 @@
manifest.json

View File

@@ -0,0 +1,16 @@
include $(ONL)/make/config.amd64.mk
#
# Default to include all available amd64 platforms.
# You override this with you own list or yaml file.
#
export PLATFORM_LIST=$(shell onlpm --list-platforms --arch amd64 --csv )
RFS_CONFIG := $(ONL)/packages/base/any/rootfs/standard/standard.yml
RFS_DIR := rootfs-amd64.d
RFS_CPIO := rootfs-amd64.cpio.gz
RFS_SQUASH := rootfs-amd64.sqsh
include $(ONL)/make/rfs.mk

View File

@@ -0,0 +1,22 @@
common:
arch: $ARCH
version: 1.0.0
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
packages:
- name: onl-faultd
version: 1.0.0
summary: Fault Reporting Daemon
provides: [ faultd ]
files:
builds/$BUILD_DIR/${TOOLCHAIN}/bin/faultd.bin : /usr/bin/faultd
init: ${ONL}/packages/base/any/faultd/faultd.init
changelog: Change changes changes.,

Some files were not shown because too many files have changed in this diff Show More