mirror of
https://github.com/Telecominfraproject/OpenNetworkLinux.git
synced 2025-12-25 09:17:08 +00:00
Merge branch 'master' of github.com:opencomputeproject/OpenNetworkLinux
Conflicts: builds/any/installer/grub/builds/Makefile builds/any/installer/uboot/builds/Makefile packages/base/all/initrds/loader-initrd-files/src/lib/boot1 packages/base/all/vendor-config-onl/PKG.yml packages/base/all/vendor-config-onl/src/python/onl/mounts/__init__.py
This commit is contained in:
13
Makefile
13
Makefile
@@ -21,9 +21,7 @@ onl-amd64 onl-x86 x86 x86_64 amd64: packages_base_all
|
||||
$(MAKE) -C packages/base/amd64/onlp
|
||||
$(MAKE) -C packages/base/amd64/onlp-snmpd
|
||||
$(MAKE) -C packages/base/amd64/faultd
|
||||
$(MAKE) -C builds/amd64/rootfs
|
||||
$(MAKE) -C builds/amd64/swi
|
||||
$(MAKE) -C builds/amd64/installer
|
||||
$(MAKE) -C builds/amd64
|
||||
|
||||
onl-ppc ppc: packages_base_all
|
||||
$(MAKE) -C packages/base/powerpc/kernels
|
||||
@@ -32,10 +30,7 @@ onl-ppc ppc: packages_base_all
|
||||
$(MAKE) -C packages/base/powerpc/onlp-snmpd
|
||||
$(MAKE) -C packages/base/powerpc/faultd
|
||||
$(MAKE) -C packages/base/powerpc/fit
|
||||
$(MAKE) -C builds/powerpc/rootfs
|
||||
$(MAKE) -C builds/powerpc/swi
|
||||
$(MAKE) -C builds/powerpc/installer
|
||||
|
||||
$(MAKE) -C builds/powerpc
|
||||
|
||||
ifdef ONL_DEBIAN_SUITE_jessie
|
||||
|
||||
@@ -49,9 +44,7 @@ onl-arm arm: arm_toolchain_check packages_base_all
|
||||
$(MAKE) -C packages/base/armel/onlp-snmpd
|
||||
$(MAKE) -C packages/base/armel/faultd
|
||||
$(MAKE) -C packages/base/armel/fit
|
||||
$(MAKE) -C builds/armel/rootfs
|
||||
$(MAKE) -C builds/armel/swi
|
||||
$(MAKE) -C builds/armel/installer
|
||||
$(MAKE) -C builds/armel
|
||||
else
|
||||
|
||||
onl-arm arm:
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
DIRECTORIES := rootfs swi installer
|
||||
include $(ONL)/make/subdirs.mk
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
!include $ONL/builds/any/installer/legacy/APKG.yml ARCH=amd64
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
*INSTALLER
|
||||
kernel-*
|
||||
initrd-*
|
||||
lib/
|
||||
usr/
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
include $(ONL)/make/config.amd64.mk
|
||||
|
||||
KERNELS := $(shell $(ONLPM) --find-file onl-kernel-3.9.6-x86-64-all:amd64 kernel-3.9.6-x86-64-all) \
|
||||
$(shell $(ONLPM) --find-file onl-kernel-3.2-deb7-x86-64-all:amd64 kernel-3.2-deb7-x86_64-all) \
|
||||
$(shell $(ONLPM) --find-file onl-kernel-3.18-x86-64-all:amd64 kernel-3.18-x86_64-all)
|
||||
|
||||
INITRD := $(shell $(ONLPM) --find-file onl-loader-initrd:amd64 onl-loader-initrd-amd64.cpio.gz)
|
||||
PLATFORMS := $(shell $(ONLPM) --platform-manifest onl-loader-initrd:amd64)
|
||||
|
||||
MKSHAR = $(ONL)/tools/mkshar
|
||||
MKSHAR_OPTS = --lazy --unzip-pad --fixup-perms autoperms.sh
|
||||
MKSHAR_PERMS = autoperms.sh
|
||||
|
||||
|
||||
# Hardcoded to match ONL File naming conventions.
|
||||
include $(ONL)/make/versions/version-onl.mk
|
||||
INSTALLER_NAME=$(FNAME_PRODUCT_VERSION)_ONL-OS_$(FNAME_BUILD_ID)_$(UARCH)_LEGACY_INSTALLER
|
||||
|
||||
|
||||
|
||||
__installer:
|
||||
$(ONL_V_at)rm -rf *INSTALLER* *.md5sum
|
||||
$(foreach k,$(KERNELS),cp $(k) .;)
|
||||
$(ONL_V_at)cp $(INITRD) initrd-amd64
|
||||
$(foreach p,$(PLATFORMS), $(ONLPM) --extract-dir onl-platform-config-$(p):amd64 .;)
|
||||
# Fixme
|
||||
$(ONLPM) --extract-dir onl-swi:amd64 .
|
||||
mv ./usr/share/onl/packages/amd64/onl-swi/*.swi .
|
||||
rm -rf ./usr
|
||||
$(ONL_V_at)cp /dev/null $(MKSHAR_PERMS)
|
||||
$(ONL_V_at) cp $(ONL)/make/versions/version-onl.sh .
|
||||
$(ONL_V_at)echo "#!/bin/sh" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -e" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -x" >> $(MKSHAR_PERMS)
|
||||
$(MKSHAR) $(MKSHAR_OPTS) "$(INSTALLER_NAME)" $(ONL)/tools/scripts/sfx.sh.in amd64-installer.sh $(notdir $(KERNELS)) initrd-amd64 lib *.swi version-onl.sh boot-config
|
||||
$(ONL_V_at)rm -rf ./lib ./usr kernel-* initrd-amd64 $(ZTN_MANIFEST) *.swi version-onl.sh autoperms.sh
|
||||
md5sum "$(INSTALLER_NAME)" | awk '{ print $$1 }' > "$(INSTALLER_NAME).md5sum"
|
||||
|
||||
|
||||
shar installer: installer
|
||||
|
||||
clean:
|
||||
rm -f *.swi *.installer $(notdir $(KERNELS)) initrd-amd64
|
||||
@@ -1,437 +0,0 @@
|
||||
#!/bin/sh
|
||||
############################################################
|
||||
# <bsn.cl fy=2013 v=none>
|
||||
#
|
||||
# Copyright 2013, 2014 BigSwitch Networks, Inc.
|
||||
#
|
||||
#
|
||||
#
|
||||
# </bsn.cl>
|
||||
############################################################
|
||||
#
|
||||
# Open Network Linux Installation Script for AMD64.
|
||||
#
|
||||
# The purpose of this script is to automatically install Open Network Linux
|
||||
# on the target system.
|
||||
#
|
||||
# This script is ONIE-compatible.
|
||||
#
|
||||
# This script is can be run under a manual boot of the Open Network Linux
|
||||
# Loader as the execution environment for platforms that do not
|
||||
# support ONIE.
|
||||
#
|
||||
############################################################
|
||||
|
||||
IARCH="x86_64"
|
||||
ARCH=`uname -m`
|
||||
if [ "$ARCH" != "$IARCH" ]; then
|
||||
echo
|
||||
echo "------------------------------------"
|
||||
echo "Installer Architecture: $IARCH"
|
||||
echo "Target Architecture: $ARCH"
|
||||
echo
|
||||
echo "This installer cannot be used on this"
|
||||
echo "target."
|
||||
echo
|
||||
echo "------------------------------------"
|
||||
sleep 5
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
############################################################
|
||||
#
|
||||
# Installation utility functions
|
||||
#
|
||||
############################################################
|
||||
|
||||
CR="
|
||||
"
|
||||
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
DEV=
|
||||
START_MB=
|
||||
|
||||
visit_parted()
|
||||
{
|
||||
local dev diskfn partfn rest
|
||||
dev=$1; shift
|
||||
diskfn=$1; shift
|
||||
partfn=$1; shift
|
||||
rest="$@"
|
||||
|
||||
local ifs ifs2 dummy
|
||||
ifs=$IFS; IFS=$CR
|
||||
for line in `parted -m $dev unit mb print`; do
|
||||
IFS=$ifs
|
||||
|
||||
line=`echo "$line" | sed -e 's/[;]$//'`
|
||||
|
||||
case "$line" in
|
||||
/dev/*)
|
||||
ifs2=$IFS; IFS=:
|
||||
set dummy $line
|
||||
IFS=$ifs2
|
||||
|
||||
local dev sz model lbsz pbsz typ modelname flags
|
||||
shift
|
||||
dev=$1; shift
|
||||
sz=$1; shift
|
||||
model=$1; shift
|
||||
lbsz=$1; shift
|
||||
pbsz=$1; shift
|
||||
typ=$1; shift
|
||||
modelname=$1; shift
|
||||
flags=$1; shift
|
||||
|
||||
eval $diskfn "$dev" "$sz" "$model" "$typ" "$flags" $rest || return 1
|
||||
|
||||
;;
|
||||
[0-9]:*)
|
||||
ifs2=$IFS; IFS=:
|
||||
set dummy $line
|
||||
IFS=$ifs2
|
||||
|
||||
local part start end sz fs label flags
|
||||
shift
|
||||
part=$1; shift
|
||||
start=$1; shift
|
||||
end=$1; shift
|
||||
sz=$1; shift
|
||||
fs=$1; shift
|
||||
label=$1; shift
|
||||
flags=$label
|
||||
|
||||
eval $partfn "$part" "$start" "$end" "$sz" "$fs" "$label" "$flags" $rest || return 1
|
||||
|
||||
;;
|
||||
|
||||
*) continue ;;
|
||||
esac
|
||||
|
||||
done
|
||||
IFS=$ifs
|
||||
}
|
||||
|
||||
do_handle_disk()
|
||||
{
|
||||
local dev sz model typ flags
|
||||
dev=$1; shift
|
||||
sz=$1; shift
|
||||
model=$1; shift
|
||||
typ=$1; shift
|
||||
flags=$1; shift
|
||||
|
||||
if test "$typ" != "gpt"; then
|
||||
installer_say "*** invalid partition table: $typ"
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
ONL_CONFIG_TARBALL=/tmp/onl_config.tgz
|
||||
ONL_CONFIG_MOUNTPOINT=/mnt/onl_config_partition
|
||||
|
||||
do_handle_partitions()
|
||||
{
|
||||
local part start end sz fs label flags
|
||||
part=$1; shift
|
||||
start=$1; shift
|
||||
end=$1; shift
|
||||
sz=$1; shift
|
||||
fs=$1; shift
|
||||
label=$1; shift
|
||||
flags=$1; shift
|
||||
|
||||
installer_say "Examining $DEV part $part"
|
||||
|
||||
case "$label" in
|
||||
ONL-CONFIG)
|
||||
installer_say "Preserving the contents of the existing ONL-CONFIG partition..."
|
||||
rm -rf $ONL_CONFIG_MOUNTPOINT
|
||||
mkdir -p $ONL_CONFIG_MOUNTPOINT
|
||||
mount $DEV$part $ONL_CONFIG_MOUNTPOINT
|
||||
tar -C $ONL_CONFIG_MOUNTPOINT -cvzf $ONL_CONFIG_TARBALL .
|
||||
umount $ONL_CONFIG_MOUNTPOINT
|
||||
parted $DEV rm $part || return 1
|
||||
;;
|
||||
ONIE-BOOT|GRUB-BOOT|*-DIAG)
|
||||
installer_say "Partition $DEV$part: $label: Preserving..."
|
||||
;;
|
||||
*)
|
||||
installer_say "Partition $DEV$part: $label: Deleting..."
|
||||
parted $DEV rm $part || return 1
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
get_free_space()
|
||||
{
|
||||
local free start
|
||||
free=`parted -s $DEV unit mb p free | grep Free | tail -1`
|
||||
echo $free | awk '{print $1}' | tr "MB" " "
|
||||
}
|
||||
|
||||
get_part_number()
|
||||
{
|
||||
local dev name part
|
||||
dev=$1; shift
|
||||
name=$1; shift
|
||||
part=$(parted -s $DEV unit mb p all | grep $name | awk {'print $1'})
|
||||
if [ -z "$part" ]; then
|
||||
installer_say "Failed to discover the partition number for $name"
|
||||
return 1
|
||||
else
|
||||
echo $part
|
||||
return 0
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
partition_gpt()
|
||||
{
|
||||
local start end part
|
||||
|
||||
start=$1; shift
|
||||
|
||||
############################################################
|
||||
#
|
||||
# ONL Boot Partition.
|
||||
#
|
||||
############################################################
|
||||
installer_say "Creating 128MB for ONL Boot partition..."
|
||||
end=$(( $start + 128 ))
|
||||
|
||||
parted -s $DEV unit mb mkpart "ONL-BOOT" ext4 ${start} ${end} || return 1
|
||||
if ! part=$(get_part_number $DEV "ONL-BOOT"); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
parted -s $DEV set $part boot on || return 1
|
||||
mkfs.ext4 -L "ONL-BOOT" ${DEV}${part}
|
||||
start=$(( $end + 1 ))
|
||||
|
||||
|
||||
|
||||
############################################################
|
||||
#
|
||||
# ONL Configuration Partition.
|
||||
#
|
||||
############################################################
|
||||
installer_say "Creating 128MB ONL Configuration partition..."
|
||||
end=$(( $start + 128 ))
|
||||
parted -s $DEV unit mb mkpart "ONL-CONFIG" ext4 ${start} ${end} || return 1
|
||||
if ! part=$(get_part_number $DEV "ONL-CONFIG"); then
|
||||
return 1
|
||||
fi
|
||||
mkfs.ext4 -L "ONL-CONFIG" ${DEV}${part}
|
||||
start=$(( $end + 1 ))
|
||||
|
||||
if [ -f $ONL_CONFIG_TARBALL ]; then
|
||||
installer_say "Restoring the contents of the ONL-CONFIG partition..."
|
||||
rm -rf $ONL_CONFIG_MOUNTPOINT
|
||||
mkdir -p $ONL_CONFIG_MOUNTPOINT
|
||||
mount $DEV$part $ONL_CONFIG_MOUNTPOINT
|
||||
tar -C $ONL_CONFIG_MOUNTPOINT -xvzf $ONL_CONFIG_TARBALL
|
||||
umount $ONL_CONFIG_MOUNTPOINT
|
||||
fi
|
||||
|
||||
############################################################
|
||||
#
|
||||
# ONL Image Partition.
|
||||
#
|
||||
############################################################
|
||||
installer_say "Creating 1G ONL Image partition..."
|
||||
end=$(( $start + 1024 ))
|
||||
|
||||
parted -s $DEV unit mb mkpart "ONL-IMAGES" ext4 ${start} ${end} || return 1
|
||||
if ! part=$(get_part_number $DEV "ONL-IMAGES"); then
|
||||
return 1
|
||||
fi
|
||||
mkfs.ext4 -L "ONL-IMAGES" ${DEV}${part}
|
||||
start=$(( $end + 1 ))
|
||||
|
||||
|
||||
|
||||
############################################################
|
||||
#
|
||||
# ONL Root Partition.
|
||||
#
|
||||
############################################################
|
||||
installer_say "Creating the ONL Data partition..."
|
||||
parted -s $DEV unit mb mkpart "ONL-DATA" ext4 ${start} "100%" || return 1
|
||||
if ! part=$(get_part_number $DEV "ONL-DATA"); then
|
||||
return 1
|
||||
fi
|
||||
mkfs.ext4 -L "ONL-DATA" ${DEV}${part}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
||||
installer_standard_gpt_install()
|
||||
{
|
||||
DEV=$1; shift
|
||||
|
||||
if [ -z $DEV ]; then
|
||||
# Install NOS to the same block device as ONIE image
|
||||
DEV=$(blkid | grep ONIE-BOOT | awk '{print $1}' | sed -e 's/[1-9][0-9]*:.*$//' | sed -e 's/\([0-9]\)\(p\)/\1/' | head -n 1)
|
||||
[ -b "$DEV" ] || {
|
||||
echo "Error: Unable to determine the block device to install NOS"
|
||||
exit 1
|
||||
}
|
||||
fi
|
||||
|
||||
visit_parted $DEV do_handle_disk do_handle_partitions || return 1
|
||||
partition_gpt $(get_free_space) || return 1
|
||||
|
||||
installer_say "Installing boot files..."
|
||||
mkdir "$workdir/mnt"
|
||||
|
||||
if [ -f "${installer_dir}/boot-config" ]; then
|
||||
installer_say "Installing boot-config..."
|
||||
mount LABEL="ONL-BOOT" "$workdir/mnt"
|
||||
cp "${installer_dir}/boot-config" "$workdir/mnt/boot-config"
|
||||
umount "$workdir/mnt"
|
||||
fi
|
||||
|
||||
SWISRC=`ls ${installer_dir}/*.swi`
|
||||
|
||||
if test -f "${SWISRC}"; then
|
||||
if test ! "${SWIDST}"; then
|
||||
SWIDST="$(basename ${SWISRC})"
|
||||
fi
|
||||
installer_say "Installing Open Network Linux Software Image (${SWIDST})..."
|
||||
mount LABEL="ONL-IMAGES" "$workdir/mnt"
|
||||
cp "${SWISRC}" "$workdir/mnt/${SWIDST}"
|
||||
umount "$workdir/mnt"
|
||||
fi
|
||||
|
||||
installer_say "Installing kernels"
|
||||
mount LABEL=ONL-BOOT -t ext4 "$workdir/mnt"
|
||||
echo ${installer_dir}
|
||||
cp ${installer_dir}/kernel-* "$workdir/mnt/"
|
||||
cp "${installer_dir}/initrd-amd64" "$workdir/mnt/."
|
||||
mkdir "$workdir/mnt/grub"
|
||||
cp "${installer_platform_dir}/onl/boot/grub.cfg" "$workdir/mnt/grub/grub.cfg"
|
||||
|
||||
installer_say "Installing GRUB"
|
||||
grub-install --boot-directory="$workdir/mnt" $DEV
|
||||
|
||||
# leave the GRUB directory mounted,
|
||||
# so we can manipulate the GRUB environment
|
||||
BOOTDIR="$workdir/mnt"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
set -e
|
||||
cd $(dirname $0)
|
||||
|
||||
installer_script=${0##*/}
|
||||
installer_zip=$1
|
||||
|
||||
BOOTDIR=/mnt/onie-boot
|
||||
# initial boot partition (onie)
|
||||
|
||||
# Pickup ONIE defines for this machine.
|
||||
if test -r /etc/machine.conf; then . /etc/machine.conf; fi
|
||||
|
||||
#
|
||||
# Installation environment setup.
|
||||
#
|
||||
if test "${onie_platform}"; then
|
||||
:
|
||||
else
|
||||
echo "Missing onie_platform (invalid /etc/machine.conf)" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Running under ONIE, most likely in the background in installer mode.
|
||||
# Our messages have to be sent to the console directly, not to stdout.
|
||||
installer_say()
|
||||
{
|
||||
echo "$@" > /dev/console
|
||||
}
|
||||
|
||||
workdir=$(mktemp -d -t install-XXXXXX)
|
||||
|
||||
# Installation failure message.
|
||||
do_cleanup()
|
||||
{
|
||||
installer_say "Install failed."
|
||||
cat /var/log/onie.log > /dev/console
|
||||
installer_say "Install failed. See log messages above for details"
|
||||
|
||||
grep "$workdir" /proc/mounts | cut -d' ' -f2 | sort -r | xargs -r -n 1 umount
|
||||
cd /tmp
|
||||
rm -fr "$workdir"
|
||||
|
||||
sleep 3
|
||||
#reboot
|
||||
}
|
||||
|
||||
trap "do_cleanup" 0 1
|
||||
|
||||
if test -z "${installer_platform}"; then
|
||||
# Our platform identifiers are equal to the ONIE platform identifiers without underscores:
|
||||
installer_platform=`echo ${onie_platform} | tr "_" "-"`
|
||||
installer_arch=${onie_arch}
|
||||
fi
|
||||
installer_say "Open Network Linux installer running under ONIE."
|
||||
|
||||
#
|
||||
# Remount tmpfs larger if possible.
|
||||
# We will be doing all of our work out of /tmp
|
||||
#
|
||||
mount -o remount,size=1024M /tmp || true
|
||||
|
||||
# Unpack our distribution
|
||||
installer_say "Unpacking Open Network Linux installer files..."
|
||||
installer_dir=`pwd`
|
||||
if test "$SFX_PAD"; then
|
||||
# ha ha, busybox cannot exclude multiple files
|
||||
unzip $installer_zip -x $SFX_PAD
|
||||
elif test "$SFX_UNZIP"; then
|
||||
unzip $installer_zip -x $installer_script
|
||||
else
|
||||
dd if=$installer_zip bs=$SFX_BLOCKSIZE skip=$SFX_BLOCKS \
|
||||
| unzip - -x $installer_script
|
||||
fi
|
||||
|
||||
if [ -f "${installer_dir}/versions.sh" ]; then
|
||||
. "${installer_dir}/versions.sh"
|
||||
installer_say "${VERSION_STRING} Installer"
|
||||
fi
|
||||
|
||||
installer_say "Detected platform: ${installer_platform}"
|
||||
|
||||
# Look for the platform installer directory.
|
||||
installer_platform_dir="${installer_dir}/lib/platform-config/${installer_platform}"
|
||||
if test -d "${installer_platform_dir}"; then
|
||||
# Source the installer scriptlet
|
||||
. "${installer_platform_dir}/onl/install/${installer_platform}.sh"
|
||||
else
|
||||
installer_say "This installer does not support the ${installer_platform} platform."
|
||||
installer_say "Available platforms are:"
|
||||
list=`ls "${installer_dir}/lib/platform-config"`
|
||||
installer_say "${list}"
|
||||
installer_say "Installation cannot continue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The platform script must provide this function. This performs the actual install for the platform.
|
||||
platform_installer
|
||||
|
||||
trap - 0 1
|
||||
installer_say "Install finished. Rebooting to Open Network Linux."
|
||||
sleep 3
|
||||
#reboot
|
||||
|
||||
exit
|
||||
|
||||
# Do not add any additional whitespace after this point.
|
||||
PAYLOAD_FOLLOWS
|
||||
@@ -1,4 +0,0 @@
|
||||
NETDEV=ma1
|
||||
NETAUTO=dhcp
|
||||
BOOTMODE=SWI
|
||||
SWI=images::latest
|
||||
@@ -6,92 +6,12 @@ ifndef BOOTMODE
|
||||
$(error $$BOOTMODE not set)
|
||||
endif
|
||||
|
||||
ONLPLATFORM = python $(ONL)/tools/onlplatform.py
|
||||
PLATFORMS := $(shell $(ONLPM) --platform-manifest onl-loader-initrd:$(ARCH))
|
||||
|
||||
MKSHAR = $(ONL)/tools/mkshar
|
||||
MKSHAR_OPTS = --lazy --unzip-pad --fixup-perms autoperms.sh
|
||||
MKSHAR_PERMS = autoperms.sh
|
||||
|
||||
# Hardcoded to match ONL File naming conventions.
|
||||
include $(ONL)/make/versions/version-onl.mk
|
||||
INSTALLER_NAME=$(FNAME_PRODUCT_VERSION)_ONL-OS_$(FNAME_BUILD_ID)_$(UARCH)_$(BOOTMODE)_INSTALLER
|
||||
|
||||
ifeq ($(ARCH), amd64)
|
||||
INSTALLER_ARCH = x86_64
|
||||
else
|
||||
INSTALLER_ARCH = $(ARCH)
|
||||
endif
|
||||
|
||||
__installer: __installer_platform_files __installer_swi_files
|
||||
$(ONL_V_at)rm -rf *INSTALLER* *.md5sum
|
||||
$(ONL_V_at)cp /dev/null installer.sh
|
||||
$(ONL_V_at): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
set dummy *.cpio.gz; initrd="$$2" ;\
|
||||
sed \
|
||||
-e 's^@ONLVERSION@^$(VERSION_STRING)^g' \
|
||||
-e "s^@INITRD_ARCHIVE@^$$initrd^g" \
|
||||
-e 's^@INITRD_OFFSET@^^g' \
|
||||
-e 's^@INITRD_SIZE@^^g' \
|
||||
-e 's^@ARCH@^$(INSTALLER_ARCH)^g' \
|
||||
$(ONL)/builds/any/installer/installer.sh.in \
|
||||
>> installer.sh
|
||||
$(ONL_V_at)echo "PAYLOAD_FOLLOWS" >> installer.sh
|
||||
$(ONL_V_at)cp /dev/null $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)cp $(ONL)/make/versions/version-onl.sh .
|
||||
$(ONL_V_at)echo "#!/bin/sh" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -e" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -x" >> $(MKSHAR_PERMS)
|
||||
$(MKSHAR) $(MKSHAR_OPTS) "$(INSTALLER_NAME)" $(ONL)/tools/scripts/sfx.sh.in installer.sh kernel-* onl-loader-initrd-* *.swi version-onl.sh boot-config
|
||||
$(ONL_V_at)rm -rf installer.sh kernel-* onl-loader-initrd-* $(ZTN_MANIFEST) *.swi version-onl.sh autoperms.sh
|
||||
__installer:
|
||||
$(ONL)/tools/mkinstaller.py --arch $(ARCH) --boot-config boot-config --initrd onl-loader-initrd:$(ARCH) onl-loader-initrd-$(ARCH).cpio.gz --swi onl-swi:$(ARCH) --out $(INSTALLER_NAME)
|
||||
md5sum "$(INSTALLER_NAME)" | awk '{ print $$1 }' > "$(INSTALLER_NAME).md5sum"
|
||||
|
||||
__installer_platform_files:
|
||||
$(ONL_V_GEN): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
l="$(PLATFORMS)"; for p in $$l; do \
|
||||
src=$$($(ONLPLATFORM) $$p $(ARCH) kernel 2>/dev/null) || : ;\
|
||||
if test "$$src"; then \
|
||||
dst=$${src##*/} ;\
|
||||
if test "$dst" -ot Makefile; then \
|
||||
: ;\
|
||||
else \
|
||||
echo "Staging $$dst for $$p" ;\
|
||||
cp "$$src" "$$dst" ;\
|
||||
fi ;\
|
||||
fi ;\
|
||||
src=$$($(ONLPLATFORM) $$p $(ARCH) initrd 2>/dev/null) || : ;\
|
||||
if test "$$src"; then \
|
||||
dst=$${src##*/} ;\
|
||||
if test "$dst" -ot Makefile; then \
|
||||
: ;\
|
||||
else \
|
||||
echo "Staging $$dst for $$p" ;\
|
||||
cp "$$src" "$$dst" ;\
|
||||
fi ;\
|
||||
fi ;\
|
||||
done ;\
|
||||
:
|
||||
|
||||
ifndef NO_SWI
|
||||
__installer_swi_files:
|
||||
$(ONL_V_GEN): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
swidir=$$(mktemp -d $(PWD)/swi-d-XXXXXX) ;\
|
||||
$(ONLPM) --extract-dir onl-swi:$(ARCH) $$swidir ;\
|
||||
mv $$swidir/usr/share/onl/packages/$(ARCH)/onl-swi/*.swi . ;\
|
||||
rm -fr $$swidir ;\
|
||||
:
|
||||
else
|
||||
__installer_swi_files:
|
||||
$(ONL_V_GEN):
|
||||
endif
|
||||
|
||||
shar installer: installer
|
||||
|
||||
clean:
|
||||
rm -f *.swi *.installer $(notdir $(KERNELS)) *initrd*.cpio.gz
|
||||
|
||||
@@ -9,16 +9,7 @@
|
||||
# </bsn.cl>
|
||||
############################################################
|
||||
#
|
||||
# SwitchLight Installation Script for PPC.
|
||||
#
|
||||
# The purpose of this script is to automatically install SwitchLight
|
||||
# on the target system.
|
||||
#
|
||||
# This script is ONIE-compatible.
|
||||
#
|
||||
# This script is can be run under a manual boot of the SwitchLight
|
||||
# Loader as the execution environment for platforms that do not
|
||||
# support ONIE.
|
||||
# Open Network Linux Installation Script
|
||||
#
|
||||
############################################################
|
||||
|
||||
@@ -160,7 +151,7 @@ visit_proc_mounts() {
|
||||
local ifs line dummy fn rest sts
|
||||
fn=$1; shift
|
||||
rest="$@"
|
||||
|
||||
|
||||
ifs=$IFS; IFS=$CR
|
||||
for line in $(cat /proc/mounts); do
|
||||
IFS=$ifs
|
||||
|
||||
@@ -1,27 +0,0 @@
|
||||
variables:
|
||||
!include $ONL/make/versions/version-onl.yml
|
||||
|
||||
prerequisites:
|
||||
broken: true
|
||||
packages: [ "onl-swi:$ARCH" ]
|
||||
|
||||
common:
|
||||
arch: $ARCH
|
||||
version: $FNAME_RELEASE_ID
|
||||
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
|
||||
maintainer: support@bigswitch.com
|
||||
|
||||
packages:
|
||||
- name: onl-legacy-installer
|
||||
summary: Open Network Linux $ARCH Legacy Installer
|
||||
|
||||
files:
|
||||
builds/*INSTALLER : $$PKG_INSTALL/
|
||||
builds/*.md5sum : $$PKG_INSTALL/
|
||||
|
||||
changelog: Change changes changes.,
|
||||
|
||||
|
||||
release:
|
||||
- builds/*INSTALLER : $ARCH/
|
||||
- builds/*.md5sum : $ARCH/
|
||||
@@ -1,43 +0,0 @@
|
||||
ifndef ARCH
|
||||
$(error $$ARCH not set)
|
||||
endif
|
||||
|
||||
THISDIR := $(dir $(lastword $(MAKEFILE_LIST)))
|
||||
|
||||
# Hardcoded to match ONL File naming conventions.
|
||||
include $(ONL)/make/versions/version-onl.mk
|
||||
INSTALLER_NAME=$(FNAME_PRODUCT_VERSION)_ONL-OS_$(FNAME_BUILD_ID)_$(UARCH)_LEGACY_INSTALLER
|
||||
|
||||
FIT_IMAGE_ALL := $(shell $(ONLPM) --find-file onl-loader-fit:$(ARCH) onl-loader-fit.itb)
|
||||
|
||||
# Fixme -- should come from the FIT manifest, not the initrd manifest
|
||||
PLATFORMS := $(shell $(ONLPM) --platform-manifest onl-loader-initrd:$(ARCH))
|
||||
|
||||
MKSHAR = $(ONL)/tools/mkshar
|
||||
MKSHAR_OPTS = --lazy --unzip-pad
|
||||
MKSHAR_PERMS = autoperms.sh
|
||||
|
||||
__installer:
|
||||
$(ONL_V_at)rm -rf *INSTALLER* *.md5sum
|
||||
$(ONL_V_at)cp $(FIT_IMAGE_ALL) .
|
||||
$(foreach p,$(PLATFORMS), $(ONLPM) --extract-dir onl-platform-config-$(p):$(ARCH) .;)
|
||||
# Fixme
|
||||
ifndef NO_SWI
|
||||
$(ONLPM) --extract-dir onl-swi:$(ARCH) .
|
||||
mv ./usr/share/onl/packages/$(ARCH)/onl-swi/*.swi .
|
||||
endif
|
||||
rm -rf ./usr
|
||||
$(ONL_V_at)cp /dev/null $(MKSHAR_PERMS)
|
||||
$(ONL_V_at) cp $(ONL)/make/versions/version-onl.sh .
|
||||
$(ONL_V_at)echo "#!/bin/sh" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -e" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -x" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)sed s/@@IARCH@@/$(ARCH)/g $(THISDIR)/fit-installer.sh > fit-installer.sh
|
||||
$(ONL_V_at)sed s/@@IARCH@@/$(ARCH)/g $(THISDIR)/fit-install-lib > fit-install-lib
|
||||
$(ONL_V_at)cp $(THISDIR)/boot-config .
|
||||
$(MKSHAR) $(MKSHAR_OPTS) "$(INSTALLER_NAME)" $(ONL)/tools/scripts/sfx.sh.in fit-installer.sh fit-install-lib *.itb lib *.swi version-onl.sh boot-config $(INSTALLER_EXTRA_FILES)
|
||||
$(ONL_V_at)rm -rf ./lib *.swi version-onl.sh autoperms.sh *.itb
|
||||
md5sum "$(INSTALLER_NAME)" | awk '{ print $$1 }' > "$(INSTALLER_NAME).md5sum"
|
||||
|
||||
|
||||
shar installer: __installer
|
||||
@@ -1,4 +0,0 @@
|
||||
NETDEV=ma1
|
||||
NETAUTO=dhcp
|
||||
BOOTMODE=SWI
|
||||
SWI=images::latest
|
||||
@@ -1,412 +0,0 @@
|
||||
# -*- sh -*-
|
||||
######################################################################
|
||||
#
|
||||
# lib.sh
|
||||
#
|
||||
# Common files for install/recovery
|
||||
#
|
||||
######################################################################
|
||||
|
||||
############################################################
|
||||
#
|
||||
# Installation Utility Functions
|
||||
#
|
||||
############################################################
|
||||
|
||||
case "`/usr/sbin/fw_setenv --help 2>&1`" in
|
||||
*"-f"*"Force update"*)
|
||||
fw_setenv_dash_f="-f"
|
||||
;;
|
||||
esac
|
||||
|
||||
fw_setenv_f_s() {
|
||||
local f
|
||||
f=$1; shift
|
||||
|
||||
/usr/sbin/fw_setenv ${fw_setenv_dash_f} -s "$f"
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_create_device_file <blockdev> <partno>
|
||||
# <blockdev> The block device name
|
||||
# <partno> The partition number.
|
||||
#
|
||||
# Set the global variable 'installer_df' with the name of
|
||||
# the created device file.
|
||||
#
|
||||
# We can't always rely on the existance of a partition's
|
||||
# device file after the device has been formatted.
|
||||
#
|
||||
# This function creates the appropriate device file
|
||||
# for a given block partition to avoid this problem.
|
||||
#
|
||||
#
|
||||
|
||||
installer_create_device_file() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
|
||||
# Determine the device major number for the given block device:
|
||||
local major=`ls -l /dev/${blockdev} | tr "," " " | awk '{print $5}'`
|
||||
|
||||
# Create a new device file matching the given partition
|
||||
installer_df=$(mktemp)
|
||||
rm ${installer_df}
|
||||
mknod "${installer_df}" b "${major}" "${partno}"
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_partition_cp <blockdev> <partno> <src> <dst>
|
||||
#
|
||||
# <blockdev> The block device name
|
||||
# <partno> The partition number
|
||||
# <src> The local source filename
|
||||
# <dst> The destination filename
|
||||
#
|
||||
# Copy the source file to the given partition.
|
||||
# The partition must be formatted/mountable.
|
||||
#
|
||||
############################################################
|
||||
|
||||
installer_partition_cp() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
local src=$3
|
||||
local dst=$4
|
||||
|
||||
installer_create_device_file ${blockdev} ${partno}
|
||||
mkdir -p "${installer_df}.mount"
|
||||
mount "${installer_df}" "${installer_df}.mount"
|
||||
cp "${src}" "${installer_df}.mount/${dst}"
|
||||
umount "${installer_df}.mount"
|
||||
rm "${installer_df}"
|
||||
rmdir "${installer_df}.mount"
|
||||
}
|
||||
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_partition_dd <blockdev> <partno> <src>
|
||||
#
|
||||
# <blockdev> The block device name
|
||||
# <partno> The partition number.
|
||||
# <src> The source file.
|
||||
#
|
||||
# 'dd' the contents of the src file directly to the given partition.
|
||||
#
|
||||
############################################################
|
||||
|
||||
installer_partition_dd() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
local src=$3
|
||||
|
||||
# installer_partition_dd <blockdev> <partno> <src>
|
||||
installer_create_device_file ${blockdev} ${partno}
|
||||
dd if=${src} of="${installer_df}" bs=1024
|
||||
rm "${installer_df}"
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_partition_format <blockdev> <partno> <mkfs>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
# <partno> The partition number.
|
||||
# <mkfs> The formatting tool.
|
||||
#
|
||||
############################################################
|
||||
|
||||
installer_partition_format() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
local mkfs=$3
|
||||
local options=$4
|
||||
local partition="$1$2"
|
||||
|
||||
installer_say "Format ${partition}..."
|
||||
installer_create_device_file ${blockdev} ${partno}
|
||||
"${mkfs}" ${options} "${installer_df}"
|
||||
installer_say "Format ${partition} complete."
|
||||
rm "${installer_df}"
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_umount_blockdev <blockdev>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
#
|
||||
# Unmount all partitions of the given blockdevice.
|
||||
#
|
||||
# Required to avoid errors when repartitioning block
|
||||
# devices that are currently mounted.
|
||||
#
|
||||
############################################################
|
||||
|
||||
installer_umount_blockdev() {
|
||||
local blockdev=$1
|
||||
local mounts=`cat /proc/mounts | grep ${blockdev} | awk '{print $2}'`
|
||||
if [ "$mounts" ]; then
|
||||
umount $mounts || :
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_blockdev_format <blockdev> <p1size> <p2size> <p3size>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
# <p1size> The size of the boot partition.
|
||||
# <p2size> The size of the config partition.
|
||||
# <p3size> The size of the image partition.
|
||||
# <p4size> [Optional] The size of the data partition.
|
||||
# If p4size is unset, the remainder of the device will be used
|
||||
# for the data partition.
|
||||
#
|
||||
############################################################
|
||||
ONL_CONFIG_TARBALL=/tmp/onl_config.tgz
|
||||
ONL_CONFIG_MOUNTPOINT=/mnt/onl_config_partition
|
||||
|
||||
installer_blockdev_format() {
|
||||
local blockdev=$1
|
||||
local partition1size=$2
|
||||
local partition2size=$3
|
||||
local partition3size=$4
|
||||
local partition4size=$5
|
||||
|
||||
if [ -n "$ONL_BOOT_SIZE" ]; then
|
||||
echo "Using ONL_BOOT_SIZE override ($ONL_BOOT_SIZE)"
|
||||
partition1size=$ONL_BOOT_SIZE
|
||||
fi
|
||||
|
||||
|
||||
|
||||
onl_config_partition=$(blkid | grep ONL-CONFIG | awk '{print $1}' | tr -d ':')
|
||||
|
||||
#
|
||||
# If an ONL-CONFIG partition exists, we need to save and restore its contents.
|
||||
#
|
||||
if [ -n "$onl_config_partition" ]; then
|
||||
installer_say "Preserving the contents of the existing ONL-CONFIG partition..."
|
||||
rm -rf $ONL_CONFIG_MOUNTPOINT
|
||||
mkdir -p $ONL_CONFIG_MOUNTPOINT
|
||||
echo mount "$onl_config_partition" $ONL_CONFIG_MOUNTPOINT
|
||||
mount "$onl_config_partition" $ONL_CONFIG_MOUNTPOINT
|
||||
tar -C $ONL_CONFIG_MOUNTPOINT -cvzf $ONL_CONFIG_TARBALL .
|
||||
umount $ONL_CONFIG_MOUNTPOINT
|
||||
fi
|
||||
|
||||
|
||||
|
||||
installer_umount_blockdev ${blockdev}
|
||||
installer_say "Formatting ${blockdev} as ${partition1size}:${partition2size}:${partition3size}:${partition4size}."
|
||||
echo -e "o\nn\np\n1\n\n+${partition1size}\nn\np\n2\n\n+${partition2size}\nn\np\n3\n\n+${partition3size}\nn\np\n4\n\n${partition4size}\np\nw\n" | fdisk /dev/${blockdev}
|
||||
|
||||
|
||||
_mkfs="mkfs.ext2"
|
||||
_archtools="${installer_dir}/`uname -m`"
|
||||
if [ -f "${_archtools}/mkfs.ext2" ]; then
|
||||
chmod a+x ${_archtools}/*
|
||||
echo "Using installer archtools mkfs.ext2..."
|
||||
_mkfs="${_archtools}/mkfs.ext2"
|
||||
ls -l "${_archtools}"
|
||||
fi
|
||||
|
||||
installer_partition_format ${blockdev} 1 $_mkfs "-L ONL-BOOT"
|
||||
installer_partition_format ${blockdev} 2 $_mkfs "-L ONL-CONFIG"
|
||||
installer_partition_format ${blockdev} 3 $_mkfs "-L ONL-IMAGES"
|
||||
installer_partition_format ${blockdev} 4 $_mkfs "-L ONL-DATA"
|
||||
|
||||
if [ -f $ONL_CONFIG_TARBALL ]; then
|
||||
installer_say "Restoring the contents of the existing ONL-CONFIG partition..."
|
||||
installer_create_device_file ${blockdev} 2
|
||||
mkdir -p "${installer_df}.mount"
|
||||
mount "${installer_df}" "${installer_df}.mount"
|
||||
tar -C "${installer_df}.mount" -xvzf $ONL_CONFIG_TARBALL
|
||||
umount "${installer_df}.mount"
|
||||
rm "${installer_df}"
|
||||
rmdir "${installer_df}.mount"
|
||||
rm $ONL_CONFIG_TARBALL
|
||||
fi
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_platform_loader <blockdev> <partno>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
# <partno> The partition number.
|
||||
#
|
||||
# Install the platform loader to the given partition.
|
||||
#
|
||||
# The default is to copy the loader to the partition's filesystem.
|
||||
# If 'platform_loader_raw' is specified by the platform, the
|
||||
# loader will be written directly to the partition instead.
|
||||
#
|
||||
############################################################
|
||||
installer_platform_loader() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
|
||||
|
||||
if [ -f "${installer_dir}/${installer_platform}.itb" ]; then
|
||||
#
|
||||
# Platform-specfic FIT Image already provided.
|
||||
#
|
||||
local loader="${installer_dir}/${installer_platform}.itb"
|
||||
|
||||
elif [ -f "${installer_dir}/onl-loader-fit.itb" ]; then
|
||||
#
|
||||
# Common FIT image.
|
||||
#
|
||||
local loader="${installer_dir}/onl-loader-fit.itb";
|
||||
else
|
||||
installer_say "There is not FIT image available in the installer. This is a bug."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Cannonical name for all ITB files for each platform
|
||||
# is <platform>.itb.
|
||||
#
|
||||
# This allows you to use the ONL platform configuration settings
|
||||
# with your own initrd with constant and consistent naming.
|
||||
#
|
||||
loaderdst="${installer_platform}.itb"
|
||||
|
||||
installer_say "Installing the Open Network Linux Loader..."
|
||||
|
||||
if [ "${platform_loader_raw}" ]; then
|
||||
installer_partition_dd ${blockdev} ${partno} ${loader}
|
||||
else
|
||||
installer_partition_cp ${blockdev} ${partno} ${loader} ${loaderdst}
|
||||
fi
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_platform_bootconfig <blockdev> <partno>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
# <partno> The partition number.
|
||||
#
|
||||
# Generate and write the platform boot-config file
|
||||
# into the given partition.
|
||||
#
|
||||
############################################################
|
||||
|
||||
installer_platform_bootconfig() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
|
||||
#
|
||||
# Is there a static boot-config in the installer package?
|
||||
#
|
||||
if [ -f "${installer_dir}/boot-config" ]; then
|
||||
installer_say "Writing boot-config."
|
||||
installer_partition_cp ${blockdev} ${partno} "${installer_dir}/boot-config"
|
||||
fi
|
||||
|
||||
#
|
||||
# Unless the installer contains a boot-config
|
||||
# file it will have to be generated by the first-boot
|
||||
# script in the Loader.
|
||||
#
|
||||
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_platform_swi <blockdev> <partno>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
# <partno> The partition number.
|
||||
#
|
||||
# Install the SWI to the given partition.
|
||||
#
|
||||
############################################################
|
||||
|
||||
installer_platform_swi() {
|
||||
local blockdev=$1
|
||||
local partno=$2
|
||||
|
||||
SWISRC=`ls ${installer_dir}/*.swi`
|
||||
|
||||
if [ -f "${SWISRC}" ]; then
|
||||
if [ ! ${SWIDST} ]; then
|
||||
SWIDST="$(basename ${SWISRC})"
|
||||
fi
|
||||
installer_say "Installing Open Network Linux Software Image (${SWIDST})..."
|
||||
installer_partition_cp ${blockdev} ${partno} ${SWISRC} ${SWIDST}
|
||||
else
|
||||
installer_say "No Open Network Linux Software Image available for installation. Post-install ZTN installation will be required."
|
||||
fi
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_standard_blockdev_install <blockdev> <p1size> <p2size> <p3size>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
# <p1size> The size of the loader partition.
|
||||
# <p2size> The size of the /mnt/flash partition.
|
||||
# <p3size> The size of the /mnt/flash2 partition.
|
||||
#
|
||||
# Performs a standard installation for the platform.
|
||||
# Most platform installers will just call this function with the appropriate arguments.
|
||||
#
|
||||
############################################################
|
||||
installer_standard_blockdev_install () {
|
||||
local blockdev=$1
|
||||
local p1size=$2
|
||||
local p2size=$3
|
||||
local p3size=$4
|
||||
local p4size=$5
|
||||
|
||||
# Standard 3-partition format for loader, /mnt/flash, and /mnt/flash2
|
||||
installer_blockdev_format "${blockdev}" "${p1size}" "${p2size}" "${p3size}" "${p4size}"
|
||||
|
||||
# Copy the platform loader to the first partition.
|
||||
installer_platform_loader "${blockdev}" 1
|
||||
|
||||
# Set the boot-config file
|
||||
installer_platform_bootconfig "${blockdev}" 1
|
||||
|
||||
# Copy the packaged SWI to the third partition.
|
||||
installer_platform_swi "${blockdev}" 3
|
||||
|
||||
sync
|
||||
installer_umount_blockdev "${blockdev}"
|
||||
}
|
||||
|
||||
############################################################
|
||||
#
|
||||
# installer_standard_blockdev_install <blockdev> <p1size> <p2size> <p3size>
|
||||
#
|
||||
# <blockdev> The block device name.
|
||||
#
|
||||
# Performs a standard recovery for the platform.
|
||||
#
|
||||
############################################################
|
||||
installer_standard_blockdev_recovery() {
|
||||
local blockdev=$1
|
||||
|
||||
# Standard 3-partition format for loader, /mnt/flash, and /mnt/flash2
|
||||
installer_umount_blockdev ${blockdev}
|
||||
installer_say "Re-formatting ${blockdev}."
|
||||
installer_partition_format ${blockdev} 2 mkdosfs
|
||||
installer_partition_format ${blockdev} 3 mkdosfs
|
||||
|
||||
sync
|
||||
installer_umount_blockdev "${blockdev}"
|
||||
}
|
||||
|
||||
##############################
|
||||
#
|
||||
# End of lib.sh
|
||||
#
|
||||
##############################
|
||||
@@ -1,116 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
IARCH=@@IARCH@@
|
||||
|
||||
# Convert build architecture to local architecture
|
||||
case $IARCH in
|
||||
powerpc)
|
||||
IARCH=ppc
|
||||
;;
|
||||
armel)
|
||||
IARCH=armv7l
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
ARCH=`uname -m`
|
||||
if [ "$ARCH" != "$IARCH" ]; then
|
||||
echo
|
||||
echo "------------------------------------"
|
||||
echo "Installer Architecture: $IARCH"
|
||||
echo "Target Architecture: $ARCH"
|
||||
echo
|
||||
echo "This installer cannot be used on this"
|
||||
echo "target."
|
||||
echo
|
||||
echo "------------------------------------"
|
||||
sleep 5
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -e
|
||||
cd $(dirname $0)
|
||||
|
||||
|
||||
installer_script=${0##*/}
|
||||
installer_zip=$1
|
||||
|
||||
if [ -f /etc/machine.conf ]; then
|
||||
. /etc/machine.conf
|
||||
|
||||
# Running under ONIE, most likely in the background in installer mode.
|
||||
# Our messages have to be sent to the console directly, not to stdout.
|
||||
installer_say() {
|
||||
echo "$@" > /dev/console
|
||||
}
|
||||
# Installation failure message.
|
||||
trap 'installer_say "Install failed.; cat /var/log/onie.log > /dev/console; installer_say "Install failed. See log messages above for details"; sleep 3; reboot' EXIT
|
||||
|
||||
if [ -z "${installer_platform}" ]; then
|
||||
# Our platform identifiers are equal to the ONIE platform identifiers without underscores:
|
||||
installer_platform=`echo ${onie_platform} | tr "_" "-"`
|
||||
installer_arch=${onie_arch}
|
||||
fi
|
||||
fi
|
||||
|
||||
#
|
||||
# Remount tmpfs larger if possible.
|
||||
# We will be doing all of our work out of /tmp
|
||||
#
|
||||
mount -o remount,size=1024M /tmp || true
|
||||
|
||||
|
||||
# Unpack our distribution
|
||||
installer_say "Unpacking Open Network Linux installer files..."
|
||||
installer_dir=`pwd`
|
||||
if test "$SFX_PAD"; then
|
||||
# ha ha, busybox cannot exclude multiple files
|
||||
unzip $installer_zip -x $SFX_PAD
|
||||
elif test "$SFX_UNZIP"; then
|
||||
unzip $installer_zip -x $installer_script
|
||||
else
|
||||
dd if=$installer_zip bs=$SFX_BLOCKSIZE skip=$SFX_BLOCKS \
|
||||
| unzip - -x $installer_script
|
||||
fi
|
||||
|
||||
|
||||
if [ -f "${installer_dir}/versions.sh" ]; then
|
||||
. "${installer_dir}/versions.sh"
|
||||
installer_say "${VERSION_STRING} Installer"
|
||||
fi
|
||||
|
||||
installer_say "Detected platform: ${installer_platform}"
|
||||
|
||||
. "${installer_dir}/fit-install-lib"
|
||||
|
||||
# Look for the platform installer directory.
|
||||
installer_platform_dir="${installer_dir}/lib/platform-config/${installer_platform}"
|
||||
if [ -d "${installer_platform_dir}" ]; then
|
||||
# Source the installer scriptlet
|
||||
ONL_PLATFORM=${installer_platform}
|
||||
. "${installer_platform_dir}/onl/install/${installer_platform}.sh"
|
||||
else
|
||||
installer_say "This installer does not support the ${installer_platform} platform."
|
||||
installer_say "Available platforms are:"
|
||||
list=`ls ${installer_dir}/lib/platform-config`
|
||||
installer_say "${list}"
|
||||
installer_say "Installation cannot continue."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The platform script must provide this function. This performs the actual install for the platform.
|
||||
platform_installer
|
||||
|
||||
installer_say "Configuring system to boot Open Network Linux..."
|
||||
envf=/tmp/.env
|
||||
cp /dev/null "${envf}"
|
||||
echo "nos_bootcmd ${platform_bootcmd}" >> "${envf}"
|
||||
fw_setenv_f_s "${envf}"
|
||||
installer_say "Install finished. Rebooting to Open Network Linux."
|
||||
sleep 3
|
||||
reboot
|
||||
exit 0
|
||||
|
||||
# Do not add any additional whitespace after this point.
|
||||
PAYLOAD_FOLLOWS
|
||||
@@ -6,109 +6,12 @@ ifndef BOOTMODE
|
||||
$(error $$BOOTMODE not set)
|
||||
endif
|
||||
|
||||
ONLPLATFORM = python $(ONL)/tools/onlplatform.py
|
||||
PLATFORMS := $(shell $(ONLPM) --platform-manifest onl-loader-initrd:$(ARCH))
|
||||
|
||||
MKSHAR = $(ONL)/tools/mkshar
|
||||
MKSHAR_OPTS = --lazy --unzip-pad --fixup-perms autoperms.sh
|
||||
MKSHAR_PERMS = autoperms.sh
|
||||
|
||||
VONLDIR = $(ONL)/packages/base/all/vendor-config-onl
|
||||
PYFIT = $(VONLDIR)/src/bin/pyfit
|
||||
PYFIT_ENVIRONMENT = PYTHONPATH=$(VONLDIR)/src/python
|
||||
|
||||
# Hardcoded to match ONL File naming conventions.
|
||||
include $(ONL)/make/versions/version-onl.mk
|
||||
INSTALLER_NAME=$(FNAME_PRODUCT_VERSION)_ONL-OS_$(FNAME_BUILD_ID)_$(UARCH)_$(BOOTMODE)_INSTALLER
|
||||
|
||||
# default fit image can be used as the canonical location for the initrd
|
||||
FIT_IMAGE_ALL := $(shell $(ONLPM) --find-file onl-loader-fit:$(ARCH) onl-loader-fit.itb)
|
||||
INITRD := $(shell $(ONLPM) --find-file onl-loader-initrd:$(ARCH) onl-loader-initrd-$(ARCH).cpio.gz)
|
||||
INITRD_BOUNDS := $(shell $(PYFIT_ENVIRONMENT) $(PYFIT) -v offset $(FIT_IMAGE_ALL) --initrd)
|
||||
__installer:
|
||||
$(ONL)/tools/mkinstaller.py --arch $(ARCH) --boot-config boot-config --fit onl-loader-fit:$(ARCH) onl-loader-fit.itb --swi onl-swi:$(ARCH) --out $(INSTALLER_NAME)
|
||||
md5sum "$(INSTALLER_NAME)" | awk '{ print $$1 }' > "$(INSTALLER_NAME).md5sum"
|
||||
|
||||
__installer: installer.sh __installer_fit_files __installer_platform_files __installer_swi_files
|
||||
$(ONL_V_at)rm -rf *INSTALLER* *.md5sum
|
||||
$(ONL_V_at)cp /dev/null $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)cp $(ONL)/make/versions/version-onl.sh .
|
||||
$(ONL_V_at)echo "#!/bin/sh" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -e" >> $(MKSHAR_PERMS)
|
||||
$(ONL_V_at)echo "set -x" >> $(MKSHAR_PERMS)
|
||||
$(MKSHAR) $(MKSHAR_OPTS) "$(INSTALLER_NAME)" $(ONL)/tools/scripts/sfx.sh.in installer.sh *.swi *.itb version-onl.sh boot-config
|
||||
$(ONL_V_at)rm -rf installer.sh *.itb *.swi version-onl.sh autoperms.sh
|
||||
$(ONL_V_at)md5sum "$(INSTALLER_NAME)" | awk '{ print $$1 }' > "$(INSTALLER_NAME).md5sum"
|
||||
|
||||
installer.sh: Makefile $(ONL)/builds/any/installer/installer.sh.in
|
||||
$(ONL_V_GEN)cp /dev/null $@
|
||||
$(ONL_V_at): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
if test "$(INITRD_BOUNDS)"; then \
|
||||
a="$(FIT_IMAGE_ALL)"; a=$${a##*/} ;\
|
||||
else \
|
||||
a="$(INITRD)"; i=$${a##*/} ;\
|
||||
fi ;\
|
||||
set dummy $(INITRD_BOUNDS); start=$$2; end=$$3; sz=$$(($$end - $$start + 1)) ;\
|
||||
sed \
|
||||
-e 's^@ONLVERSION@^$(VERSION_STRING)^g' \
|
||||
-e "s^@INITRD_ARCHIVE@^$${a}^g" \
|
||||
-e "s^@INITRD_OFFSET@^$$start^g" \
|
||||
-e "s^@INITRD_SIZE@^$$sz^g" \
|
||||
-e 's^@ARCH@^$(ARCH)^g' \
|
||||
$(ONL)/builds/any/installer/installer.sh.in \
|
||||
>> $@
|
||||
$(ONL_V_at)echo "PAYLOAD_FOLLOWS" >> $@
|
||||
|
||||
__installer_fit_files:
|
||||
$(ONL_V_GEN): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
src=$(FIT_IMAGE_ALL) ;\
|
||||
dst=$${src##*/} ;\
|
||||
if test "$$dst" -nt Makefile; then \
|
||||
: ;\
|
||||
else \
|
||||
echo "Staging $$dst" ;\
|
||||
cp $$src $$dst ;\
|
||||
fi ;\
|
||||
:
|
||||
|
||||
##############################
|
||||
#
|
||||
# optionally include custom itb files for each platform
|
||||
#
|
||||
##############################
|
||||
|
||||
__installer_platform_files:
|
||||
$(ONL_V_GEN): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
l="$(PLATFORMS)"; for p in $$l; do \
|
||||
echo "Looking for an ITB specific to $$p, ignore errors..." ;\
|
||||
src=$$($(ONLPLATFORM) $$p $(ARCH) itb) 2>/dev/null || : ;\
|
||||
if test "$$src"; then :; else continue; fi ;\
|
||||
dst=$${src##*/} ;\
|
||||
echo "Found $$dst" ;\
|
||||
if test "$$dst" -nt Makefile; then continue; fi ;\
|
||||
echo "Staging $$dst for $$p" ;\
|
||||
cp "$$src" "$$dst" ;\
|
||||
done ;\
|
||||
:
|
||||
|
||||
__installer_swi_files:
|
||||
ifndef NO_SWI
|
||||
$(ONL_V_GEN): ;\
|
||||
set -e ;\
|
||||
if $(ONL_V_P); then set -x; fi ;\
|
||||
swidir=$$(mktemp -d $(PWD)/swi-d-XXXXXX) ;\
|
||||
$(ONLPM) --extract-dir onl-swi:$(ARCH) $$swidir ;\
|
||||
mv $$swidir/usr/share/onl/packages/$(ARCH)/onl-swi/*.swi . ;\
|
||||
rm -fr $$swidir ;\
|
||||
:
|
||||
else
|
||||
$(ONL_V_GEN):
|
||||
endif
|
||||
|
||||
shar installer: installer
|
||||
|
||||
clean:
|
||||
rm -f *.swi *.installer *.cpio.gz
|
||||
|
||||
@@ -75,3 +75,4 @@
|
||||
- unzip
|
||||
- onl-mibs
|
||||
- openssl
|
||||
- gdb
|
||||
11
builds/any/rootfs/jessie/common/amd64-onl-packages.yml
Normal file
11
builds/any/rootfs/jessie/common/amd64-onl-packages.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-upgrade
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
1
builds/any/rootfs/jessie/common/armel-base-packages.yml
Normal file
1
builds/any/rootfs/jessie/common/armel-base-packages.yml
Normal file
@@ -0,0 +1 @@
|
||||
- u-boot-tools
|
||||
9
builds/any/rootfs/jessie/common/armel-onl-packages.yml
Normal file
9
builds/any/rootfs/jessie/common/armel-onl-packages.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
- u-boot-tools
|
||||
- onl-loader-fit
|
||||
@@ -1,26 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
### BEGIN INIT INFO
|
||||
# Provides: initdev
|
||||
# Required-Start:
|
||||
# Required-Stop:
|
||||
# Default-Start: S
|
||||
# Default-Stop:
|
||||
# Short-Description: Set up block and net devices
|
||||
### END INIT INFO
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
log_action_begin_msg "Setting up block and net devices"
|
||||
|
||||
ln -snf /proc/mounts /etc/mtab
|
||||
|
||||
( cd /sys/class/block; for d in *; do /sbin/initblockdev $d add; done )
|
||||
if [ -d /sys/class/ubi ]; then
|
||||
( cd /sys/class/ubi; for d in *; do /sbin/initblockdev $d add; done )
|
||||
fi
|
||||
( cd /sys/class/net; for d in *; do /sbin/initnetdev $d add; done )
|
||||
|
||||
initmounts
|
||||
|
||||
log_action_end_msg 0
|
||||
@@ -1,19 +1,19 @@
|
||||
mounts:
|
||||
ONL-IMAGES:
|
||||
mount: r
|
||||
mount: ro
|
||||
dir: /mnt/onl/images
|
||||
fsck: true
|
||||
|
||||
ONL-DATA:
|
||||
mount: w
|
||||
mount: rw
|
||||
dir: /mnt/onl/data
|
||||
|
||||
ONL-CONFIG:
|
||||
mount: false
|
||||
mount: ro
|
||||
dir: /mnt/onl/config
|
||||
fsck: true
|
||||
|
||||
ONL-BOOT:
|
||||
mount: false
|
||||
mount: ro
|
||||
dir: /mnt/onl/boot
|
||||
fsck: false
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
C: US
|
||||
ST: CA
|
||||
O: Open Compute Project
|
||||
localityName: Santa Clara
|
||||
commonName: Networking
|
||||
organizationalUnitName: Open Network Linux
|
||||
emailAddress: support@bigswitch.com
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/bin/bash
|
||||
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'#")
|
||||
if [ -e /etc/onl/recover ]; then
|
||||
recover=$(cat /etc/onl/recover)
|
||||
fi
|
||||
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
|
||||
if [ "$recover" = "fsck" ]; 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
|
||||
else
|
||||
dosfsck -n /dev/${dev}${part} >/dev/null 2>&1
|
||||
fi
|
||||
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
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
############################################################
|
||||
- u-boot-tools
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
|
||||
9
builds/any/rootfs/jessie/common/powerpc-onl-packages.yml
Normal file
9
builds/any/rootfs/jessie/common/powerpc-onl-packages.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
@@ -7,9 +7,13 @@
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
variables:
|
||||
!include $ONL/make/versions/version-onl.yml
|
||||
|
||||
Packages: &Packages
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/common-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/all-base-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-base-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-onl-packages.yml
|
||||
- !script $ONL/tools/onl-platform-pkgs.py ${PLATFORM_LIST}
|
||||
|
||||
Multistrap:
|
||||
@@ -88,6 +92,13 @@ Configure:
|
||||
root:
|
||||
password: onl
|
||||
|
||||
manifest:
|
||||
version: $ONL/make/versions/version-onl.json
|
||||
platforms: $PLATFORM_LIST
|
||||
manifests:
|
||||
'/etc/onl/rootfs/manifest.json' :
|
||||
version : $ONL/make/versions/version-onl.json
|
||||
platforms : $PLATFORM_LIST
|
||||
|
||||
issue: $VERSION_STRING
|
||||
|
||||
files:
|
||||
remove:
|
||||
- /etc/motd
|
||||
|
||||
@@ -74,3 +74,4 @@
|
||||
- unzip
|
||||
- onl-mibs
|
||||
- openssl
|
||||
- gdb
|
||||
11
builds/any/rootfs/wheezy/common/amd64-onl-packages.yml
Normal file
11
builds/any/rootfs/wheezy/common/amd64-onl-packages.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-upgrade
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
mounts:
|
||||
ONL-IMAGES:
|
||||
mount: r
|
||||
mount: ro
|
||||
dir: /mnt/onl/images
|
||||
fsck: true
|
||||
|
||||
ONL-DATA:
|
||||
mount: w
|
||||
mount: rw
|
||||
dir: /mnt/onl/data
|
||||
|
||||
ONL-CONFIG:
|
||||
mount: false
|
||||
mount: ro
|
||||
dir: /mnt/onl/config
|
||||
fsck: true
|
||||
|
||||
ONL-BOOT:
|
||||
mount: false
|
||||
mount: ro
|
||||
dir: /mnt/onl/boot
|
||||
fsck: false
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
C: US
|
||||
ST: CA
|
||||
O: Open Compute Project
|
||||
localityName: Santa Clara
|
||||
commonName: Networking
|
||||
organizationalUnitName: Open Network Linux
|
||||
emailAddress: support@bigswitch.com
|
||||
@@ -1 +0,0 @@
|
||||
SUBSYSTEM=="block", RUN+="/sbin/initblockdev $kernel $env{ACTION}"
|
||||
@@ -1 +0,0 @@
|
||||
SUBSYSTEM=="net", RUN+="/sbin/initnetdev $kernel $env{ACTION}"
|
||||
@@ -1,62 +0,0 @@
|
||||
#!/bin/bash
|
||||
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'#")
|
||||
if [ -e /etc/onl/recover ]; then
|
||||
recover=$(cat /etc/onl/recover)
|
||||
fi
|
||||
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
|
||||
if [ "$recover" = "fsck" ]; 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
|
||||
else
|
||||
dosfsck -n /dev/${dev}${part} >/dev/null 2>&1
|
||||
fi
|
||||
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
|
||||
@@ -4,7 +4,7 @@
|
||||
#
|
||||
############################################################
|
||||
- u-boot-tools
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
|
||||
9
builds/any/rootfs/wheezy/common/powerpc-onl-packages.yml
Normal file
9
builds/any/rootfs/wheezy/common/powerpc-onl-packages.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
############################################################
|
||||
#
|
||||
# These packages are specific to the ONL root filesystem build.
|
||||
#
|
||||
############################################################
|
||||
- onl-loader-fit
|
||||
|
||||
|
||||
|
||||
@@ -7,9 +7,13 @@
|
||||
#
|
||||
#
|
||||
############################################################
|
||||
variables:
|
||||
!include $ONL/make/versions/version-onl.yml
|
||||
|
||||
Packages: &Packages
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/common-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/all-base-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-base-packages.yml
|
||||
- !include $ONL/builds/any/rootfs/$ONL_DEBIAN_SUITE/common/${ARCH}-onl-packages.yml
|
||||
- !script $ONL/tools/onl-platform-pkgs.py ${PLATFORM_LIST}
|
||||
|
||||
Multistrap:
|
||||
@@ -90,6 +94,14 @@ Configure:
|
||||
root:
|
||||
password: onl
|
||||
|
||||
manifest:
|
||||
version: $ONL/make/versions/version-onl.json
|
||||
platforms: $PLATFORM_LIST
|
||||
manifests:
|
||||
'/etc/onl/rootfs/manifest.json' :
|
||||
version : $ONL/make/versions/version-onl.json
|
||||
platforms : $PLATFORM_LIST
|
||||
|
||||
issue: $VERSION_STRING
|
||||
|
||||
files:
|
||||
remove:
|
||||
- /etc/motd
|
||||
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
DIRECTORIES := rootfs swi installer
|
||||
include $(ONL)/make/subdirs.mk
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
!include $ONL/builds/any/installer/legacy/APKG.yml ARCH=armel
|
||||
@@ -1,3 +0,0 @@
|
||||
*INSTALLER
|
||||
fit-install*
|
||||
boot-config
|
||||
@@ -1,2 +0,0 @@
|
||||
include $(ONL)/make/config.armel.mk
|
||||
include $(ONL)/builds/any/installer/legacy/fit/builds/Makefile
|
||||
@@ -1 +1,2 @@
|
||||
include $(ONL)/make/pkg.mk
|
||||
DIRECTORIES := rootfs swi installer
|
||||
include $(ONL)/make/subdirs.mk
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
!include $ONL/builds/any/installer/legacy/APKG.yml ARCH=powerpc
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
*INSTALLER
|
||||
fit-install*
|
||||
boot-config
|
||||
@@ -1,3 +0,0 @@
|
||||
INSTALLER_EXTRA_FILES=ppc
|
||||
include $(ONL)/make/config.powerpc.mk
|
||||
include $(ONL)/builds/any/installer/legacy/fit/builds/Makefile
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,3 +0,0 @@
|
||||
#!/bin/sh
|
||||
export LD_LIBRARY_PATH=$( cd $( dirname -- "$0" ) > /dev/null ; pwd )
|
||||
$LD_LIBRARY_PATH/mke2fs $@
|
||||
2
docker/images/builder7/1.2/README
Normal file
2
docker/images/builder7/1.2/README
Normal file
@@ -0,0 +1,2 @@
|
||||
The dockerfile for this image was lost.
|
||||
The image history is present.
|
||||
19
docker/images/builder7/1.2/history
Normal file
19
docker/images/builder7/1.2/history
Normal file
@@ -0,0 +1,19 @@
|
||||
IMAGE CREATED CREATED BY SIZE
|
||||
30af21fbfb6f33404c14ffca74f5c4b6c2ea499afc3c6575ed8f8c4b250e9eb8 7 weeks ago /bin/sh -c #(nop) COPY file:85997e087b4d5e00e0a04bc193670e88f3c679ec6566c2578232f8771d2fa460 in /bin/container-id 245 B
|
||||
f98ca0bcc821f3c29e55e3b04ac59f9d070884394a5bde7d08da2ea1f677dd42 7 weeks ago /bin/sh -c #(nop) COPY file:740656dd6897213f5de86c1bcab56a5cfb1bcef3b78fcfd9205997f03892c9cf in /bin/docker_shell 5.516 kB
|
||||
c66fd0d67ccbe7adb1872e42fc001fc1e685d9d3f6906ad6c55a74e357fba5fe 7 weeks ago /bin/sh -c wget http://www.opennetlinux.org/tarballs/wheezy-usr-buildroot-toolchains-x86_64.tgz && tar -C / -xvzf wheezy-usr-buildroot-toolchains-x86_64.tgz && rm wheezy-usr-buildroot-toolchains-x86_64.tgz 232.5 MB
|
||||
ef9ba8bae44eda8b581f3bf250c8d234b49ac9786861ee832dda20d360c1ef3b 7 weeks ago /bin/sh -c wget http://www.opennetlinux.org/tarballs/wheezy-usr-buildroot-toolchains-powerpc.tgz && tar -C / -xvzf wheezy-usr-buildroot-toolchains-powerpc.tgz && rm wheezy-usr-buildroot-toolchains-powerpc.tgz 206.4 MB
|
||||
eade002eb617afb5e9f5973fe44cc7b0b6895a0f6ec994a6b4e59f181fbff541 7 weeks ago /bin/sh -c #(nop) MAINTAINER Jeffrey Townsend <jeffrey.townsend@bigswitch.com> 0 B
|
||||
f3f8c756d44cae02a081e8fa25fe699b62839367f84f3ed0c8cdac0d0cb61c71 5 months ago /bin/sh -c #(nop) COPY file:da995763fa1e4587d7dc435522b7b86c3f915fab6fc820983e694e9aa13996a9 in /bin/container-id 245 B
|
||||
d3e2d8d3e6d0dfd2a2777bd4b5e4d4e7869c3795df33e718f25d1628d464a9d0 5 months ago /bin/sh -c #(nop) COPY file:102693745a139d309880bf2d29cbc9a19c08da85eab1df85b7bf9f6c8df6e51f in /bin/docker_shell 5.516 kB
|
||||
758afffd3cf70037eba181d24c6bc80766c903951d80f1330994f348f342b2ff 5 months ago /bin/sh -c apt-get update && apt-get install -y libpcap-dev telnet gdb 167.8 MB
|
||||
0cfd9081af7ec27350c53ee7b6a620bf430cbe773dd27d1f67b877c869edfb21 5 months ago /bin/sh -c #(nop) MAINTAINER Rob Sherwood <rob.sherwood@bigswitch.com> 0 B
|
||||
faaf7e26ce801e59638274f4fd1e6142cec53cfab98b523724c5e4b5e36d66ee 8 months ago /bin/sh -c #(nop) COPY file:9a22523afe2cf74d3d155f6c0abcc5e60eb02fbf3a8c0caf3bc31646e67b4a44 in /bin/container-id 245 B
|
||||
9cc7bb19af34cc4782649727bd2f266ac58ac24b41e33ec44baffd58a6e7cae7 8 months ago /bin/sh -c #(nop) COPY file:2e453fbe7ebda297f827a3d6bd4803e5ea310b9531d6faeb9d5932016b152065 in /bin/docker_shell 5.075 kB
|
||||
04a9de616cb5e1c1426736b1efb5d7e7c204230713cf6a85499586e601ee6b93 8 months ago /bin/sh -c ln -s /usr/bin/ar /usr/bin/x86_64-linux-gnu-ar && ln -s /usr/bin/ld /usr/bin/x86_64-linux-gnu-ld && ln -s /usr/bin/objcopy /usr/bin/x86_64-linux-gnu-objcopy 38 B
|
||||
a520f12148816eb7d4cabd139dea1075ec20e6e9ab8c0271ec31d6f9c3d12d32 8 months ago /bin/sh -c cp /usr/include/linux/i2c-dev.h /usr/include/linux/i2c-devices.h && cp /usr/include/linux/i2c-dev.h /usr/powerpc-linux-gnu/include/linux/i2c-devices.h 21.16 kB
|
||||
da6496888f80287d340259ae0e22b8e7de8325aaa0dfbcce033569e7ecc7ff10 8 months ago /bin/sh -c echo 'APT::Get::AllowUnauthenticated "true";\nAPT::Get::Assume-Yes "true";' | tee /etc/apt/apt.conf.d/99opennetworklinux && echo "deb http://apt.opennetlinux.org/debian/ unstable main" | tee /etc/apt/sources.list.d/opennetlinux.list && dpkg --add-architecture powerpc && apt-get update && apt-get install -y binutils-powerpc-linux-gnu=2.22-7.1 gcc-4.7-powerpc-linux-gnu libc6-dev-powerpc-cross libgomp1-powerpc-cross=4.7.2-4 && xapt -a powerpc libedit-dev ncurses-dev libsensors4-dev libwrap0-dev libssl-dev libsnmp-dev libevent-dev libpam-dev && update-alternatives --install /usr/bin/powerpc-linux-gnu-gcc powerpc-linux-gnu-gcc /usr/bin/powerpc-linux-gnu-gcc-4.7 10 && rm /etc/apt/apt.conf.d/docker-* && wget "https://launchpad.net/ubuntu/+source/qemu/1.4.0+dfsg-1expubuntu3/+build/4336762/+files/qemu-user-static_1.4.0%2Bdfsg-1expubuntu3_amd64.deb" && dpkg -i qemu-user-static_1.4.0+dfsg-1expubuntu3_amd64.deb && apt-get install python-pyroute2 274.2 MB
|
||||
0c9fb97f33634b850ee1ed630cfc0eed2b0993377c7d3b19f60914a2f66f7c6e 8 months ago /bin/sh -c apt-get update && apt-get install -y apt apt-cacher-ng apt-file apt-utils autoconf automake1.9 autotools-dev bash-completion bc bind9-host binfmt-support binfmt-support bison bsdmainutils build-essential ccache cdbs cpio debhelper debhelper debhelper device-tree-compiler devscripts devscripts dialog dosfstools dpkg-sig emacs file flex gcc genisoimage ifupdown iproute iputils-ping kmod less libc6-dev libedit-dev libevent-dev libi2c-dev libpam-dev libsnmp-dev libtool locales lsof make mingetty mtd-utils mtools multistrap nano ncurses-dev netbase net-tools nfs-common openssh-server pkg-config pkg-config procps psmisc python python-dnspython python-yaml qemu qemu-user-static realpath realpath rsyslog rubygems screen squashfs-tools sshpass sudo syslinux texinfo=4.13a.dfsg.1-10 traceroute uboot-mkimage vim-tiny wget xapt zile zip && gem install --version 1.3.3 fpm 956.9 MB
|
||||
8e0c035bb531a1311ab2e24f5b798edf89f20cd878ad4e1b8cf297b9b5afd410 9 months ago /bin/sh -c #(nop) MAINTAINER Rob Sherwood <rob.sherwood@bigswitch.com> 0 B
|
||||
bbe78c1a5a535fac669e3225d5c3bb4396b6b2f9decb560ffb6351396da8c345 11 months ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B
|
||||
9d3ceacde91b4c7d6c1275032adb558d668afd5489c007f3512b39793ddf992d 11 months ago /bin/sh -c #(nop) ADD file:f7eb3ddd8c7f33332cd94564ec171306ffa490836953449b9b9c506085ec8745 in / 84.97 MB
|
||||
2
docker/images/builder8/1.3/README
Normal file
2
docker/images/builder8/1.3/README
Normal file
@@ -0,0 +1,2 @@
|
||||
The dockerfile for this image was lost.
|
||||
The image history is present.
|
||||
29
docker/images/builder8/1.3/history
Normal file
29
docker/images/builder8/1.3/history
Normal file
@@ -0,0 +1,29 @@
|
||||
IMAGE CREATED CREATED BY SIZE
|
||||
32155706d5a8ea8c642edaff8cf6ca93756c43f06b0df4ba6358fbd9b7241748 7 weeks ago /bin/sh -c #(nop) COPY file:64fe2c9e1b5e36e5a5dccdaf3f46ba7ca2894e6437f6d6c42efe0eb3ced9ab69 in /bin/container-id 245 B
|
||||
da02890b2ba05440f2c7c1790ec9606c67ef946c1be1079652003ff47abc0683 7 weeks ago /bin/sh -c #(nop) COPY file:bbb3d40c93cd76b97c89e7bb34769a865d9ede5ce8311ad573125ae39a87f144 in /bin/docker_shell 5.516 kB
|
||||
2a270cef9f88c6789cef1fc734edf02ea8fd7fc407a61a496d47d66fb776e3e1 7 weeks ago /bin/sh -c wget http://www.opennetlinux.org/tarballs/jessie-usr-buildroot-toolchains-arm.tgz && tar -C / -xvzf jessie-usr-buildroot-toolchains-arm.tgz && rm jessie-usr-buildroot-toolchains-arm.tgz 197.4 MB
|
||||
f6bd6aa6112ff8e5f2f90392bb776e70f975a7c38ffa42363ad625e91d96ec87 7 weeks ago /bin/sh -c wget http://www.opennetlinux.org/tarballs/jessie-usr-buildroot-toolchains-x86_64.tgz && tar -C / -xvzf jessie-usr-buildroot-toolchains-x86_64.tgz && rm jessie-usr-buildroot-toolchains-x86_64.tgz 231.9 MB
|
||||
460d6894f02cf961cb0ef04c37286eef20e302dda25caaeb9e8f31aca087cc05 7 weeks ago /bin/sh -c wget http://www.opennetlinux.org/tarballs/jessie-usr-buildroot-toolchains-powerpc.tgz && tar -C / -xvzf jessie-usr-buildroot-toolchains-powerpc.tgz && rm jessie-usr-buildroot-toolchains-powerpc.tgz 206.1 MB
|
||||
2f1497573f9992b50dc67a588c64a4b142c60c19dc71476b29ed356cec23f657 3 months ago /bin/sh -c #(nop) MAINTAINER Jeffrey Townsend <jeffrey.townsend@bigswitch.com> 0 B
|
||||
dd52538e115b7afacd317aa629ae589640b563259c4dd3b0205141570b9e4fc0 3 months ago /bin/sh -c #(nop) COPY file:3ba8c73d2c1c05687b3a9ed061ce0ba68b3b3bcd3cc38d3b7872460ab20ef914 in /bin/container-id 245 B
|
||||
1007bbaff6641c6f94b31bf8004d176a533fed98e02b1889d8546e2466de7685 3 months ago /bin/sh -c #(nop) COPY file:903a436a017d07edc14f3ad4155896e29fd20610cc268b25ef9dc566a2f67b67 in /bin/docker_shell 5.516 kB
|
||||
2549711b6dfbd5c675cd06d04a0f90d77e4681cd0f15236aded81dad9becacf7 3 months ago /bin/sh -c xapt -a armel libedit-dev ncurses-dev libsensors4-dev libwrap0-dev libssl-dev libsnmp-dev 37.56 MB
|
||||
d7b8911f99c278cce14adefb8739999022d588412cb5a48649dad01859f74d56 3 months ago /bin/sh -c apt-get update && apt-get install -y crossbuild-essential-armel gcc-arm-linux-gnueabi 450.9 MB
|
||||
9d20ee8ab8a191f032def4397108e496f3d8c4823364b57296d115ad4183f27e 3 months ago /bin/sh -c dpkg --add-architecture armel 20 B
|
||||
ffd59e478462bacdf142af97a881d5e23453e02d5d64c9b5cf8144f89e02d353 3 months ago /bin/sh -c #(nop) MAINTAINER Jeffrey Townsend <jeffrey.townsend@bigswitch.com> 0 B
|
||||
ad29f01f615f9477ed907ce7ff7dc4a55e0386e82614fcd134e0f6aca5b27c49 5 months ago /bin/sh -c #(nop) COPY file:841e3ae1b2e756363b64ba137881521b0e5e7dbe353fb76d62c967df8168092e in /bin/container-id 245 B
|
||||
798fb45e3298c2a7fc374a17f4cd58148a6fb86f60e08a3e2ae0c227bc5c273e 5 months ago /bin/sh -c #(nop) COPY file:4c9660a24f51d28840aff28a6c89d7db3c6225c4bedbb9eebdf28a19e88551cd in /bin/docker_shell 5.516 kB
|
||||
36b95e0bcd35619fdaab0de30fab19918347e53316657387d9c4ec8de4bc6cfd 5 months ago /bin/sh -c apt-get update && apt-get install -y libpcap-dev telnet gdb 263.9 MB
|
||||
d1496c23e0ad410c13b466930f75ef98d5e23905791405da907f92808439831d 5 months ago /bin/sh -c #(nop) MAINTAINER Rob Sherwood <rob.sherwood@bigswitch.com> 0 B
|
||||
95d70986f9d6276424d3080d0d34f16a048bb0371580e3298d630b17dbe4609a 7 months ago /bin/sh -c apt-get install libboost-all-dev cmake 354.9 MB
|
||||
ddb8d8aeac58a06f066bef825e6a27b0c72ff76835b0f571ad18a7c89bd93d40 7 months ago /bin/sh -c apt-get install -y libstdc++6=4.9.2-10 --force-yes 69.68 MB
|
||||
09c7586cd496e865e594be70edfc83184f6e0552cb3ca9230c2f615331a93d68 7 months ago /bin/sh -c #(nop) COPY file:7cdbf54404b60a9d04a792bc0e9dcad6f49e612f48f8c6c402ee2dcf5688da69 in /bin/container-id 245 B
|
||||
172f3bf0f3c43c34bd3303e6eb23359cc419831b8e6eac8ab90dd4b5aa600985 7 months ago /bin/sh -c #(nop) COPY file:77ace793edabe2a1c51ae29ff2eb52f6d6f46a86af4cf14cb2c413c0ff49d06e in /bin/docker_shell 5.075 kB
|
||||
3c36ab092f6b85d75ffb756fad930b987fc8fbc8aa900dc22f01fedf7d202edc 7 months ago /bin/sh -c rm /etc/apt/apt.conf.d/docker-* && wget "https://launchpad.net/ubuntu/+source/qemu/1.4.0+dfsg-1expubuntu3/+build/4336762/+files/qemu-user-static_1.4.0%2Bdfsg-1expubuntu3_amd64.deb" && dpkg -i qemu-user-static_1.4.0+dfsg-1expubuntu3_amd64.deb 94.05 MB
|
||||
cdb182045934be9bb9275ec8e9dcc7613594b8a91ab5e60a04b62d11e1c157be 7 months ago /bin/sh -c cp /usr/include/linux/i2c-dev.h /usr/include/linux/i2c-devices.h && cp /usr/include/linux/i2c-dev.h /usr/powerpc-linux-gnu/include/linux/i2c-devices.h 20.83 kB
|
||||
9158d08b1793b1fc8a1d8e15bf19f23dc0fa13a1347a6c238225cb09f5e9e1d3 7 months ago /bin/sh -c echo 'APT::Get::AllowUnauthenticated "true";\nAPT::Get::Assume-Yes "true";' | tee /etc/apt/apt.conf.d/99opennetworklinux && echo "deb http://apt.opennetlinux.org/debian/ unstable main" | tee /etc/apt/sources.list.d/opennetlinux.list && curl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add - && echo "deb http://emdebian.org/tools/debian/ jessie main" | tee /etc/apt/sources.list.d/embedian-jessie.list && dpkg --add-architecture powerpc && apt-get update && apt-get install -y binutils-powerpc-linux-gnu libc6-dev-powerpc-cross crossbuild-essential-powerpc cross-gcc-dev folly fbthrift wangle libgomp1-powerpc-cross && wget "http://ftp.us.debian.org/debian/pool/main/t/texinfo/texinfo_4.13a.dfsg.1-10_amd64.deb" && dpkg -i texinfo_4.13a.dfsg.1-10_amd64.deb && wget "http://ftp.us.debian.org/debian/pool/main/e/emdebian-crush/xapt_2.2.19_all.deb" && dpkg -i xapt_2.2.19_all.deb && xapt -a powerpc libedit-dev ncurses-dev libsensors4-dev libwrap0-dev libssl-dev libsnmp-dev 406 MB
|
||||
49e279dabd91678fba86bd6687e6261a7b611f6e219648fff0a66bb933dc3c1d 7 months ago /bin/sh -c gem install --version 1.3.3 fpm 21.03 MB
|
||||
49791c55ca44c73bf01888322bd5f020347b761c1c7f809c38301877a79d67af 7 months ago /bin/sh -c apt-get update && apt-get install -y apt apt-cacher-ng apt-file apt-utils autoconf automake autotools-dev bash-completion bc bind9-host binfmt-support binfmt-support bison bsdmainutils build-essential ccache cdbs cpio debhelper debhelper debhelper device-tree-compiler devscripts devscripts dialog dosfstools dpkg-sig emacs file flex gcc genisoimage git ifupdown iproute iputils-ping isolinux kmod less libc6-dev libcurl4-nss-dev libdouble-conversion-dev libedit-dev libevent-dev libgoogle-glog-dev libi2c-dev libkrb5-dev libnuma-dev libsasl2-dev libsnappy-dev libpam-dev libsnmp-dev libssl-dev libstdc++6=4.9.2-10 libtool locales lsof make mingetty mtd-utils mtools multistrap nano ncurses-dev netbase net-tools nfs-common openssh-server pkg-config pkg-config procps psmisc python python-debian python-dnspython python-yaml qemu qemu-user-static realpath realpath rsyslog ruby ruby-dev rubygems screen squashfs-tools sshpass sudo syslinux-utils traceroute u-boot-tools vim-tiny wget zile zip 1.213 GB
|
||||
f6fd2198e086ea420c1b995d62c73f3626b25163b58c36fff23b1d33cba65476 9 months ago /bin/sh -c #(nop) MAINTAINER Rob Sherwood <rob.sherwood@bigswitch.com> 0 B
|
||||
58016a5acc80ae6bbee80c4c0ebf82fa0b17ad83a7c332b43420a5ac4daf1c78 9 months ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B
|
||||
e2a4fb18da48c71baa73583c05c06ecf1a27486ea0ec08ca3458ddd4647a1894 9 months ago /bin/sh -c #(nop) ADD file:fd73312d29edb04f9cf107eb2488342984471d1798ea66ba6067f91d13f76fdf in / 125.2 MB
|
||||
22
docker/images/builder8/1.4/Dockerfile
Normal file
22
docker/images/builder8/1.4/Dockerfile
Normal file
@@ -0,0 +1,22 @@
|
||||
############################################################
|
||||
#
|
||||
# Update with ONIE build dependencies.
|
||||
#
|
||||
############################################################
|
||||
FROM opennetworklinux/builder8:1.3
|
||||
MAINTAINER Jeffrey Townsend <jeffrey.townsend@bigswitch.com>
|
||||
|
||||
RUN apt-get update && apt-get install -y \
|
||||
stgit \
|
||||
gperf \
|
||||
gawk \
|
||||
automake \
|
||||
libexpat1-dev \
|
||||
libtool-bin \
|
||||
xorriso
|
||||
|
||||
#
|
||||
# Docker shell and other container tools.
|
||||
#
|
||||
COPY docker_shell /bin/docker_shell
|
||||
COPY container-id /bin/container-id
|
||||
19
docker/images/builder8/1.4/Makefile
Normal file
19
docker/images/builder8/1.4/Makefile
Normal file
@@ -0,0 +1,19 @@
|
||||
VERSION=1.4
|
||||
USER=opennetworklinux
|
||||
REPO=builder8
|
||||
|
||||
TOOLS=../../../tools/docker_shell ../../../tools/container-id
|
||||
|
||||
build: check_version
|
||||
cp $(TOOLS) .
|
||||
docker build -t $(USER)/$(REPO):$(VERSION) .
|
||||
rm -rf $(notdir $(TOOLS))
|
||||
|
||||
#
|
||||
# Todo: Query remote repository to see if the request version already exists to avoid accidental overwrites
|
||||
# when a new image is built but the VERSION variable is not updated.
|
||||
#
|
||||
check_version:
|
||||
|
||||
push:
|
||||
docker push $(USER)/$(REPO):$(VERSION)
|
||||
@@ -31,7 +31,7 @@ Accton/Edge-Core
|
||||
<tr> <td> Accton AS5610-52X <td> 48x10G + 4x40G <td> FreeScale P2020 <td> Broadcom BCM56846 (Trident+) <td> Yes <td> Yes <td> Yes <td> No <td> No <td> No </tr>
|
||||
<tr> <td> Accton AS5710-54X <td> 48x10G + 6x40G <td> FreeScale P2041 <td> Broadcom BCM56854 (Trident2) <td> Yes <td> Yes <td> Yes <td> Yes*** <td> Yes*** <td> No </tr>
|
||||
<tr> <td> Accton AS6700-32X <td> 32x40G <td> FreeScale P2041 <td> Broadcom BCM56850 (Trident2) <td> Yes <td> Yes <td> Yes <td> No <td> No <td> No </tr>
|
||||
<tr> <td> Accton AS5512-54X <td> 48x10G + 6x40G <td> Intel Rangeley C2538 x86 <td> MediaTek MT3257 <td> No <td> No <td> No <td> No <td> No <td> No </tr>
|
||||
<tr> <td> Accton AS5512-54X <td> 48x10G + 6x40G <td> Intel Rangeley C2538 x86 <td> MediaTek/Nephos MT3258 <td> No <td> No <td> No <td> No <td> No <td> No </tr>
|
||||
<tr> <td> Accton AS5712-54X <td> 48x10G + 6x40G <td> Intel Rangeley C2538 x86 <td> Broadcom BCM56854 (Trident2) <td> Yes <td> Yes <td> Yes <td> Yes*** <td> Yes*** <td> No </tr>
|
||||
<tr> <td> Accton AS6712-32X <td> 32x40G <td> Intel Rangeley C2538 x86 <td> Broadcom BCM56850 (Trident2) <td> Yes <td> Yes <td> Yes <td> Yes*** <td> Yes*** <td> No </tr>
|
||||
<tr> <td> Accton AS5812-54T <td> 48x10G + 6x40G <td> Intel Rangeley C2538 x86 <td> Broadcom BCM56864 (Trident2+) <td> Yes <td> Yes <td> No <td> No <td> No <td> No </tr>
|
||||
@@ -40,6 +40,7 @@ Accton/Edge-Core
|
||||
<tr> <td> Accton AS7712-32X <td> 32x100G <td> Intel Rangeley C2538 x86 <td> Broadcom BCM56960 (Tomahawk) <td> Yes <td> Yes <td> Yes <td> Yes*** <td> Yes*** <td> No </tr>
|
||||
<tr> <td> Accton AS7716-32X <td> 32x100G <td> Intel Xeon D-1518 x86 <td> Broadcom BCM56960 (Tomahawk) <td> Yes <td> Yes <td> No <td> Yes*** <td> Yes*** <td> No </tr>
|
||||
<tr> <td> Accton Wedge-16X <td> 16x40G <td> Intel Rangeley C2550 x86 <td> Broadcom BCM56864 (Trident2+) <td> Work In Progress** <td> Yes <td> No <td> No <td> Yes <td> No </tr>
|
||||
<tr> <td> Accton (FB) Wedge 100 <td> 32x100G <td> Intel Bay Trail E3845 x86 <td> Broadcom BCM56960 (Tomahawk) <td> Work In Progress** <td> Yes <td> No <td> No <td> Yes <td> No </tr>
|
||||
</table>
|
||||
|
||||
DNI/Agema
|
||||
|
||||
@@ -27,7 +27,7 @@ export ONL_DEBIAN_SUITE_$(ONL_DEBIAN_SUITE)=1
|
||||
export BUILD_DIR_BASE=BUILD/$(ONL_DEBIAN_SUITE)
|
||||
|
||||
# Generate manifest if necessary
|
||||
export MODULEMANIFEST := $(shell $(BUILDER)/tools/mmg.py --dirs $(ONL) $(ONLPM_OPTION_PACKAGEDIRS) --out $(ONL)/make/module-manifest.mk --only-if-missing make)
|
||||
export MODULEMANIFEST := $(shell $(BUILDER)/tools/mmg.py $(ONL)/make/mmg.yml $(ONL) --only-if-missing)
|
||||
|
||||
# Generate versions if necessary.
|
||||
$(shell $(ONL)/tools/make-versions.py --import-file=$(ONL)/tools/onlvi --class-name=OnlVersionImplementation --output-dir $(ONL)/make/versions)
|
||||
|
||||
@@ -153,7 +153,8 @@ endif
|
||||
endif
|
||||
|
||||
|
||||
MODSYNCLIST := .config Module.symvers Makefile include scripts arch/x86/include arch/x86/Makefile arch/powerpc/include arch/powerpc/Makefile arch/powerpc/lib
|
||||
MODSYNCLIST_DEFAULT := .config Module.symvers Makefile include scripts arch/x86/include arch/x86/Makefile arch/powerpc/include arch/powerpc/Makefile arch/powerpc/lib arch/arm/include arch/arm/Makefile arch/arm/lib
|
||||
MODSYNCLIST := $(MODSYNCLIST_DEFAULT) $(MODSYNCLIST_EXTRA)
|
||||
|
||||
mbuild: build
|
||||
rm -rf $(K_MBUILD_DIR)
|
||||
|
||||
9
make/mmg.yml
Normal file
9
make/mmg.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
directories:
|
||||
- .
|
||||
|
||||
manifest: make/module-manifest.mk
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -28,10 +28,14 @@ ifdef RFS_SQUASH
|
||||
RFS_COMMAND += --squash $(RFS_SQUASH)
|
||||
endif
|
||||
|
||||
ifndef RFS_MANIFEST
|
||||
RFS_MANIFEST := etc/onl/rootfs/manifest.json
|
||||
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 .
|
||||
$(ONL_V_at) [ -f $(RFS_DIR)/$(RFS_MANIFEST) ] && cp $(RFS_DIR)/$(RFS_MANIFEST) .
|
||||
|
||||
clean:
|
||||
$(ONL_V_at) sudo rm -rf $(RFS_DIR)
|
||||
|
||||
@@ -2,5 +2,5 @@
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
log_action_begin_msg "Mounting filesystems..."
|
||||
initmounts -q
|
||||
onl-mounts -q mount all
|
||||
log_action_end_msg 0
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
if [ -f /usr/bin/pki ]; then
|
||||
/usr/bin/pki --init
|
||||
if [ -f /usr/bin/onl-pki ]; then
|
||||
/usr/bin/onl-pki --init
|
||||
fi
|
||||
|
||||
|
||||
|
||||
15
packages/base/all/boot.d/src/52.rc.boot
Executable file
15
packages/base/all/boot.d/src/52.rc.boot
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
############################################################
|
||||
#
|
||||
# If any rc.boot scripts are present in any mounted
|
||||
# partition they will be executed at boot time.
|
||||
#
|
||||
############################################################
|
||||
for dir in boot config images data; do
|
||||
script=/mnt/onl/$dir/rc.boot
|
||||
if [ -x "$script" ]; then
|
||||
echo "Executing $script..."
|
||||
$script
|
||||
fi
|
||||
done
|
||||
16
packages/base/all/boot.d/src/53.install-debs
Executable file
16
packages/base/all/boot.d/src/53.install-debs
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
############################################################
|
||||
PACKAGE_DIR=/mnt/onl/data/install-debs
|
||||
PACKAGE_LIST="$PACKAGE_DIR/list"
|
||||
|
||||
if [ -e "$PACKAGE_LIST" ]; then
|
||||
for package in $(cat $PACKAGE_LIST); do
|
||||
echo "Installing packages $package..."
|
||||
if ! dpkg -i "$PACKAGE_DIR/$package"; then
|
||||
echo "Failed."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
@@ -193,7 +193,12 @@ if test "${mode_install}${mode_overlay}"; then
|
||||
|
||||
mkdir -p "$destdir/etc/onl"
|
||||
|
||||
cp -R /etc/onl/* "$destdir/etc/onl/."
|
||||
for thing in /etc/onl/*; do
|
||||
if test $thing != "sysconfig"; then
|
||||
cp -R $thing "$destdir/etc/onl/."
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -f /etc/fw_env.config ]; then
|
||||
cat /etc/fw_env.config > "$destdir/etc/fw_env.config"
|
||||
fi
|
||||
|
||||
@@ -69,8 +69,11 @@ if [ ! -f /etc/onl/abort ]; then
|
||||
# Initialize net devices
|
||||
( cd /sys/class/net; for d in *; do initnetdev $d add; done )
|
||||
|
||||
# Initialize platform mounts
|
||||
initmounts -q
|
||||
# FS Checks
|
||||
onl-mounts fsck all
|
||||
|
||||
# Mounts
|
||||
onl-mounts -q mount all
|
||||
|
||||
# Initialize U-Boot environment
|
||||
if [ -s /proc/device-tree/model ]; then
|
||||
@@ -100,8 +103,8 @@ fi
|
||||
#
|
||||
# Initialize PKI
|
||||
#
|
||||
if [ -f /sbin/pki ]; then
|
||||
/sbin/pki --init
|
||||
if [ -f /sbin/onl-pki ]; then
|
||||
/sbin/onl-pki --init
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
mounts:
|
||||
ONL-IMAGES:
|
||||
mount: w
|
||||
mount: rw
|
||||
dir: /mnt/onl/images
|
||||
fsck: true
|
||||
|
||||
ONL-DATA:
|
||||
mount: w
|
||||
mount: rw
|
||||
dir: /mnt/onl/data
|
||||
fsck: true
|
||||
|
||||
ONL-CONFIG:
|
||||
mount: false
|
||||
mount: ro
|
||||
dir: /mnt/onl/config
|
||||
fsck: true
|
||||
|
||||
ONL-BOOT:
|
||||
mount: w
|
||||
mount: rw
|
||||
dir: /mnt/onl/boot
|
||||
fsck: false
|
||||
fsck: true
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
C: US
|
||||
ST: CA
|
||||
O: Open Compute Project
|
||||
localityName: Santa Clara
|
||||
commonName: Networking
|
||||
organizationalUnitName: Open Network Linux
|
||||
emailAddress: support@bigswitch.com
|
||||
@@ -8,19 +8,13 @@ packages:
|
||||
summary: ONL Base Configuration Package
|
||||
|
||||
files:
|
||||
src/python/onl : $PY_INSTALL/onl
|
||||
src/boot.d : /etc/boot.d
|
||||
src/bin/initubootenv: /sbin/initubootenv
|
||||
src/bin/initmounts: /sbin/initmounts
|
||||
src/bin/initnetdev: /sbin/initnetdev
|
||||
src/bin/pki : /sbin/pki
|
||||
src/bin/loader-shell: /usr/bin/loader-shell
|
||||
src/bin/onie-shell: /usr/bin/onie-shell
|
||||
src/bin/onl-platform-show: /usr/bin/onl-platform-show
|
||||
src/bin/onl-install: /usr/bin/onl-install
|
||||
src/bin/onl-recover: /usr/bin/onl-recover
|
||||
src/bin/pyfit: /usr/bin/pyfit
|
||||
src/lib : /lib/vendor-config/onl
|
||||
- src/python/onl : $PY_INSTALL/onl
|
||||
- $ONL/tools/onlyaml.py : $PY_INSTALL/onl/onlyaml/__init__.py
|
||||
- src/etc : /etc
|
||||
- src/boot.d : /etc/boot.d
|
||||
- src/bin : /usr/bin
|
||||
- src/lib : /lib/vendor-config/onl
|
||||
|
||||
|
||||
changelog: Changes
|
||||
|
||||
@@ -33,10 +27,12 @@ packages:
|
||||
summary: ONL Base Configuration Package (Loader)
|
||||
|
||||
files:
|
||||
src/python/onl : $PY_INSTALL/onl
|
||||
src/bin/initmounts : /bin/initmounts
|
||||
src/bin/initubootenv : /bin/initubootenv
|
||||
src/bin/initnetdev : /bin/initnetdev
|
||||
src/bin/pki : /sbin/pki
|
||||
- src/python/onl : $PY_INSTALL/onl
|
||||
- $ONL/tools/onlyaml.py : $PY_INSTALL/onl/onlyaml/__init__.py
|
||||
- src/etc : /etc
|
||||
- src/bin/onl-mounts : /bin/onl-mounts
|
||||
- src/bin/initubootenv : /bin/initubootenv
|
||||
- src/bin/initnetdev : /bin/initnetdev
|
||||
- src/bin/onl-pki : /sbin/onl-pki
|
||||
|
||||
changelog: Changes
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/usr/bin/python
|
||||
from onl.mounts import OnlMountManager
|
||||
OnlMountManager.main()
|
||||
OnlMountManager.main('onl-mounts')
|
||||
3
packages/base/all/vendor-config-onl/src/bin/onl-pki
Executable file
3
packages/base/all/vendor-config-onl/src/bin/onl-pki
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/python
|
||||
from onl.pki import OnlPki
|
||||
OnlPki.main()
|
||||
14
packages/base/all/vendor-config-onl/src/bin/onl-sysconfig
Executable file
14
packages/base/all/vendor-config-onl/src/bin/onl-sysconfig
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/python
|
||||
import os
|
||||
import sys
|
||||
from onl.sysconfig import sysconfig
|
||||
import yaml
|
||||
|
||||
if len(sys.argv) == 2:
|
||||
try:
|
||||
print yaml.dump((eval("sysconfig.%s" % sys.argv[1])), default_flow_style=False)
|
||||
except AttributeError, e:
|
||||
print "Path %s is not in the config." % sys.argv[1]
|
||||
else:
|
||||
print sysconfig['OnlSystemConfig'].dump()
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/python
|
||||
from onl.pki import OnlPKI
|
||||
OnlPKI.main()
|
||||
@@ -8,6 +8,8 @@ import os
|
||||
import sys
|
||||
import fnmatch
|
||||
from onl.upgrade import ubase
|
||||
from onl.sysconfig import sysconfig
|
||||
from onl.mounts import OnlMountManager, OnlMountContextReadOnly, OnlMountContextReadWrite
|
||||
|
||||
class Loader_Upgrade(ubase.BaseUpgrade):
|
||||
name="loader"
|
||||
@@ -18,15 +20,20 @@ class Loader_Upgrade(ubase.BaseUpgrade):
|
||||
current_version_key="Current Loader Version"
|
||||
next_version_key="Next Loader Version"
|
||||
|
||||
def auto_upgrade_default(self):
|
||||
return sysconfig.upgrade.loader.auto
|
||||
|
||||
def init_versions(self):
|
||||
|
||||
#
|
||||
# Current Loader version file.
|
||||
# If this file doesn't exist then in-place upgrade is not supported.
|
||||
#
|
||||
ETC_LOADER_VERSIONS_JSON = "/etc/onl/loader/versions.json"
|
||||
ETC_LOADER_VERSIONS_JSON = sysconfig.upgrade.loader.versions
|
||||
|
||||
# Upgrade Loader Version file.
|
||||
NEXT_LOADER_VERSIONS_JSON = "/etc/onl/upgrade/%s/manifest.json" % self.parch
|
||||
NEXT_LOADER_VERSIONS_JSON = os.path.join(sysconfig.upgrade.loader.package.dir, "manifest.json")
|
||||
|
||||
|
||||
self.current_version = self.load_json(ETC_LOADER_VERSIONS_JSON,
|
||||
"RELEASE_ID",
|
||||
@@ -51,55 +58,18 @@ class Loader_Upgrade_FIT(Loader_Upgrade):
|
||||
|
||||
def do_upgrade(self, forced=False):
|
||||
|
||||
FIT_UPGRADE_IMAGE_PLATFORM="/etc/onl/upgrade/%s/%s.itb" % (self.parch, self.platform.platform())
|
||||
FIT_UPGRADE_IMAGE_ALL="/etc/onl/upgrade/%s/onl-loader-fit.itb" % (self.parch)
|
||||
FIT_LOADER_IMAGE_NAME="%s.itb" % self.platform.platform()
|
||||
|
||||
fit_image = None
|
||||
for f in sysconfig.upgrade.loader.package.fit_images:
|
||||
fp = os.path.join(sysconfig.upgrade.loader.package.dir, f)
|
||||
if os.path.exists(fp):
|
||||
fit_image = fp;
|
||||
break
|
||||
|
||||
if os.path.exists(FIT_UPGRADE_IMAGE_PLATFORM):
|
||||
fit_image = FIT_UPGRADE_IMAGE_PLATFORM
|
||||
elif os.path.exists(FIT_UPGRADE_IMAGE_ALL):
|
||||
fit_image = FIT_UPGRADE_IMAGE_ALL
|
||||
else:
|
||||
if fit_image is None:
|
||||
self.abort("The FIT upgrade image is missing. Upgrade cannot continue.")
|
||||
|
||||
#
|
||||
# The platform configuration file will describe which partition
|
||||
# and which format should be used to store the FIT image.
|
||||
#
|
||||
partition = None
|
||||
raw = False
|
||||
pc = self.platform.platform_config
|
||||
|
||||
if pc:
|
||||
if 'loader' in pc and pc['loader']:
|
||||
if 'partition' in pc['loader']:
|
||||
partition = pc['loader']['partition']
|
||||
else:
|
||||
self.abort("No partition listed in the loader section of the platform configuration.")
|
||||
raw = pc['loader'].get('raw', False)
|
||||
else:
|
||||
self.abort("No loader section listed in the platform configuration.")
|
||||
else:
|
||||
self.abort("No platform configuration.")
|
||||
|
||||
if raw:
|
||||
#
|
||||
# The loader file is written raw to the given partition.
|
||||
#
|
||||
print "Writing %s to %s..." % (fit_image, partition)
|
||||
if os.system("dd of=%s if=%s" % (partition, fit_image)) != 0:
|
||||
self.abort("Failure writing loader data to partition %s." % (partition))
|
||||
|
||||
else:
|
||||
#
|
||||
# Mount the loader partition and rewrite the loader image.
|
||||
#
|
||||
mdir="/mnt/upgrade/loader"
|
||||
self.mount(mdir, partition=partition)
|
||||
self.copyfile(fit_image, os.path.join(mdir, FIT_LOADER_IMAGE_NAME))
|
||||
self.umount(mdir)
|
||||
with OnlMountContextReadWrite("ONL-BOOT", self.logger) as d:
|
||||
self.copyfile(fit_image, os.path.join(d.directory, "%s.itb" % (self.platform.platform())))
|
||||
|
||||
self.reboot()
|
||||
|
||||
@@ -108,32 +78,26 @@ class Loader_Upgrade_x86_64(Loader_Upgrade):
|
||||
|
||||
def do_upgrade(self, forced=False):
|
||||
|
||||
X86_64_UPGRADE_DIR="/etc/onl/upgrade/%s/" % (self.parch)
|
||||
X86_64_UPGRADE_PATTERNS = [ "kernel-*", "initrd-*" ]
|
||||
X86_64_UPGRADE_DIR=sysconfig.upgrade.loader.package.dir
|
||||
X86_64_UPGRADE_PATTERNS = [ "kernel-*", "*initrd*" ]
|
||||
|
||||
#
|
||||
# Mount the ONL-BOOT partition
|
||||
#
|
||||
mdir="/mnt/onl-boot"
|
||||
self.mount(mdir, label="ONL-BOOT")
|
||||
with OnlMountContextReadWrite("ONL-BOOT", self.logger) as d:
|
||||
for f in os.listdir(X86_64_UPGRADE_DIR):
|
||||
for pattern in X86_64_UPGRADE_PATTERNS:
|
||||
if fnmatch.fnmatch(f, pattern):
|
||||
self.copyfile(os.path.join(X86_64_UPGRADE_DIR, f), os.path.join(d.directory, f))
|
||||
|
||||
for f in os.listdir(X86_64_UPGRADE_DIR):
|
||||
for pattern in X86_64_UPGRADE_PATTERNS:
|
||||
if fnmatch.fnmatch(f, pattern):
|
||||
self.copyfile(os.path.join(X86_64_UPGRADE_DIR, f), os.path.join(mdir, f))
|
||||
# Disabled until it can be resolved with the new installer.
|
||||
#src = "/lib/platform-config/current/onl/boot/grub.cfg"
|
||||
#dst = os.path.join(d.directory, "grub/grub.cfg")
|
||||
#if os.path.exists(src):
|
||||
# self.copyfile(src, dst)
|
||||
|
||||
src = "/lib/platform-config/current/onl/boot/grub.cfg"
|
||||
dst = os.path.join(mdir, "grub/grub.cfg")
|
||||
if os.path.exists(src):
|
||||
self.copyfile(src, dst)
|
||||
|
||||
self.umount(mdir)
|
||||
self.reboot()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import platform
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
############################################################
|
||||
#
|
||||
# ONL Default System Configuration.
|
||||
#
|
||||
# These provide the base default values for all sysconfig keys.
|
||||
#
|
||||
############################################################
|
||||
installer:
|
||||
menu_name: "\"Open Network Linux\""
|
||||
os_name: Open Network Linux
|
||||
|
||||
upgrade:
|
||||
onie:
|
||||
auto: advisory
|
||||
loader:
|
||||
auto: advisory
|
||||
versions: /etc/onl/loader/versions.json
|
||||
package:
|
||||
dir: /etc/onl/upgrade/$PARCH
|
||||
fit_images:
|
||||
- $PLATFORM.itb
|
||||
- onl-loader-fit.itb
|
||||
|
||||
pki:
|
||||
key:
|
||||
name: key.pem
|
||||
len: 2048
|
||||
cert:
|
||||
name: certificate
|
||||
csr:
|
||||
fields:
|
||||
C: US
|
||||
ST: CA
|
||||
O: Open Compute Project
|
||||
localityName: Santa Clara
|
||||
commonName: Networking
|
||||
organizationalUnitName: Open Network Linux
|
||||
emailAddress: support@bigswitch.com
|
||||
cdays: 3600
|
||||
@@ -19,17 +19,10 @@ default:
|
||||
# this is mostly to *reject* invalid disk labels,
|
||||
# since we will never create our own
|
||||
|
||||
initrd-amd64: &initrd-amd64
|
||||
=: onl-loader-initrd-amd64.cpio.gz
|
||||
package: onl-loader-initrd:amd64
|
||||
|
||||
initrd:
|
||||
<<: *initrd-amd64
|
||||
|
||||
kernel-3.2: &kernel-3-2
|
||||
=: kernel-3.2-deb7-x86_64-all
|
||||
package: onl-kernel-3.2-deb7-x86-64-all:amd64
|
||||
|
||||
|
||||
kernel-3.9.6: &kernel-3-9-6
|
||||
=: kernel-3.9.6-x86-64-all
|
||||
package: onl-kernel-3.9.6-x86-64-all:amd64
|
||||
@@ -39,7 +32,7 @@ default:
|
||||
package: onl-kernel-3.18-x86-64-all:amd64
|
||||
|
||||
# pick one of the above kernels
|
||||
kernel:
|
||||
kernel:
|
||||
<<: *kernel-3-2
|
||||
|
||||
# GRUB command line arguments for 'serial' declaration
|
||||
@@ -70,10 +63,10 @@ default:
|
||||
##args: >-
|
||||
## nopat
|
||||
## console=ttyS0,115200n8
|
||||
|
||||
|
||||
##device: /dev/vda
|
||||
### install to a specific block device
|
||||
|
||||
|
||||
device: ONIE-BOOT
|
||||
# install to the device that contains the ONIE-BOOT partition
|
||||
# (query using parted and/or blkid)
|
||||
@@ -103,7 +96,7 @@ default:
|
||||
##- ONL-CONFIG: 128MiB
|
||||
##- ONL-IMAGES: 384MiB
|
||||
##- ONL-DATA: 100%
|
||||
|
||||
|
||||
network:
|
||||
|
||||
# remap interface names on boot (loader only)
|
||||
@@ -114,7 +107,7 @@ default:
|
||||
# this should work for most systems
|
||||
ma1:
|
||||
name: eth0
|
||||
|
||||
|
||||
# for other wierd corner cases
|
||||
##ma1:
|
||||
## name: ~
|
||||
|
||||
@@ -19,6 +19,7 @@ from InstallUtils import MountContext, BlkidParser, PartedParser
|
||||
from InstallUtils import ProcMountsParser
|
||||
|
||||
import onl.YamlUtils
|
||||
from onl.sysconfig import sysconfig
|
||||
|
||||
class Base:
|
||||
|
||||
@@ -363,9 +364,9 @@ terminal_input serial
|
||||
terminal_output serial
|
||||
set timeout=5
|
||||
|
||||
menuentry OpenNetworkLinux {
|
||||
menuentry %(boot_menu_entry)s {
|
||||
search --no-floppy --label --set=root ONL-BOOT
|
||||
echo 'Loading Open Network Linux ...'
|
||||
echo 'Loading %(boot_loading_name)s ...'
|
||||
insmod gzio
|
||||
insmod part_msdos
|
||||
linux /%(kernel)s %(args)s onl_platform=%(platform)s
|
||||
@@ -476,22 +477,26 @@ class GrubInstaller(SubprocessMixin, Base):
|
||||
|
||||
kernel = self.im.platformConf['grub']['kernel']
|
||||
ctx['kernel'] = kernel['='] if type(kernel) == dict else kernel
|
||||
|
||||
initrd = self.im.platformConf['grub']['initrd']
|
||||
ctx['initrd'] = initrd['='] if type(initrd) == dict else initrd
|
||||
|
||||
ctx['args'] = self.im.platformConf['grub']['args']
|
||||
ctx['platform'] = self.im.installerConf.installer_platform
|
||||
ctx['serial'] = self.im.platformConf['grub']['serial']
|
||||
|
||||
ctx['boot_menu_entry'] = sysconfig.installer.menu_name
|
||||
ctx['boot_loading_name'] = sysconfig.installer.os_name
|
||||
|
||||
files = []
|
||||
for f in set(os.listdir(self.im.installerConf.installer_dir) + self.zf.namelist()):
|
||||
if 'initrd' in f and 'cpio' in f:
|
||||
ctx['initrd'] = f
|
||||
files.append(f)
|
||||
if 'kernel' in f:
|
||||
files.append(f)
|
||||
|
||||
cf = GRUB_TPL % ctx
|
||||
|
||||
self.log.info("Installing kernel")
|
||||
dev = self.blkidParts['ONL-BOOT']
|
||||
|
||||
files = set(os.listdir(self.im.installerConf.installer_dir) + self.zf.namelist())
|
||||
files = [b for b in files if b.startswith('kernel-') or b.startswith('onl-loader-initrd-')]
|
||||
|
||||
with MountContext(dev.device, log=self.log) as ctx:
|
||||
def _cp(b):
|
||||
dst = os.path.join(ctx.dir, b)
|
||||
@@ -600,8 +605,7 @@ class UbootInstaller(SubprocessMixin, Base):
|
||||
% self.platformConf['loader']['loadaddr'])
|
||||
cmds.append("setenv onl_platform %s"
|
||||
% self.installerConf.installer_platform)
|
||||
itb = self.platformConf['flat_image_tree']['itb']
|
||||
if type(itb) == dict: itb = itb['=']
|
||||
itb = "%s.itb" % self.installerConf.installer_platform
|
||||
cmds.append("setenv onl_itb %s" % itb)
|
||||
for item in self.platformConf['loader']['setenv']:
|
||||
k, v = list(item.items())[0]
|
||||
@@ -695,7 +699,7 @@ class UbootInstaller(SubprocessMixin, Base):
|
||||
self.log.info("Installing ONL loader %s --> %s:%s...",
|
||||
loaderBasename, dev.device, loaderBasename)
|
||||
with MountContext(dev.device, log=self.log) as ctx:
|
||||
dst = os.path.join(ctx.dir, loaderBasename)
|
||||
dst = os.path.join(ctx.dir, "%s.itb" % self.im.installerConf.installer_platform)
|
||||
self.installerCopy(loaderBasename, dst)
|
||||
|
||||
return 0
|
||||
|
||||
@@ -10,54 +10,151 @@ import yaml
|
||||
import tempfile
|
||||
import shutil
|
||||
|
||||
class OnlMountManager(object):
|
||||
def __init__(self, mdata, logger):
|
||||
class MountManager(object):
|
||||
|
||||
if os.path.exists(mdata):
|
||||
mdata = yaml.load(open(mdata, "r"));
|
||||
|
||||
self.mdata = mdata
|
||||
def __init__(self, logger):
|
||||
self.read_proc_mounts()
|
||||
self.logger = logger
|
||||
if self.logger is None:
|
||||
self.logger = logging.getLogger('onl:mounts')
|
||||
|
||||
# Needed to avoid ugly warnings from fsck
|
||||
if not os.path.exists('/etc/mtab'):
|
||||
open("/etc/mtab", 'w').close();
|
||||
def read_proc_mounts(self):
|
||||
self.mounts = {}
|
||||
with open('/proc/mounts') as mounts:
|
||||
for line in mounts.readlines():
|
||||
(dev, dir_, type_, options, a, b) = line.split()
|
||||
self.mounts[dir_] = dict(dev=dev, mode=options.split(',')[0])
|
||||
|
||||
def is_mounted(self, device, directory):
|
||||
self.read_proc_mounts()
|
||||
if directory in self.mounts and self.mounts[directory]['dev'] == device:
|
||||
return self.mounts[directory]
|
||||
return None
|
||||
|
||||
def checkmount(self, directory):
|
||||
with open("/proc/mounts") as f:
|
||||
return directory in f.read()
|
||||
|
||||
def checkroot(self, dev):
|
||||
pat = "%s / " % dev
|
||||
with open("/proc/mounts") as f:
|
||||
return pat in f.read()
|
||||
def is_dev_mounted(self, device):
|
||||
self.read_proc_mounts()
|
||||
for (k, v) in self.mounts.iteritems():
|
||||
if v['dev'] == device:
|
||||
return True
|
||||
return False
|
||||
|
||||
def mount(self, device, directory, mode='r', timeout=5):
|
||||
self.logger.debug("Mounting %s -> %s %s" % (device, directory, mode))
|
||||
|
||||
mountargs = [ str(mode) ]
|
||||
current = self.is_mounted(device, directory)
|
||||
if current:
|
||||
if current['mode'] == mode:
|
||||
# Already mounted as requested.
|
||||
self.logger.debug("%s already mounted @ %s with mode %s. Doing nothing." % (device, directory, mode))
|
||||
return True
|
||||
elif device == current['dir']:
|
||||
# Already mounted, at a different location (e.g. '/'), but not in the requested mode.
|
||||
self.logger.debug("%s mounted @ %s (%s) with mode %s. It will be remounted %s.",
|
||||
device, directory, current['dir'], current['mode'], mode)
|
||||
mountargs.append('remount')
|
||||
directory = current['dir']
|
||||
else:
|
||||
# Already mounted, but not in the requested mode.
|
||||
self.logger.debug("%s mounted @ %s with mode %s. It will be remounted %s." % (device, directory, current['mode'], mode))
|
||||
mountargs.append('remount')
|
||||
else:
|
||||
# Not mounted at all.
|
||||
self.logger.debug("%s not mounted @ %s. It will be mounted %s" % (device, directory, mode))
|
||||
|
||||
try:
|
||||
subprocess.check_call("mount -%s %s %s" % (mode, device, directory), shell=True)
|
||||
cmd = "mount -o %s %s %s" % (','.join(mountargs), device, directory)
|
||||
self.logger.debug("+ %s" % cmd)
|
||||
subprocess.check_call(cmd, shell=True)
|
||||
except subprocess.CalledProcessError, e:
|
||||
self.logger.error("Mount failed: '%s'" % e.output)
|
||||
return False
|
||||
|
||||
# If requested, wait for the mount to complete.
|
||||
while(timeout > 0):
|
||||
if self.checkmount(directory):
|
||||
if self.is_mounted(device, directory):
|
||||
break
|
||||
time.sleep(1)
|
||||
timeout-=1
|
||||
|
||||
if self.checkmount(directory):
|
||||
self.logger.info("%s is now mounted @ %s" % (device, directory))
|
||||
current = self.is_mounted(device, directory)
|
||||
if current:
|
||||
self.logger.debug("%s is now mounted @ %s %s" % (device, directory, current['mode']))
|
||||
return True
|
||||
else:
|
||||
self.logger.info("%s failed to report in /proc/mounts." % (directory))
|
||||
self.logger.error("%s failed to report in /proc/mounts." % (directory))
|
||||
|
||||
def umount(self, device, directory):
|
||||
current = self.is_mounted(device, directory)
|
||||
if not current:
|
||||
self.logger.error("umount: %s is not mounted @ %s" % (device, directory))
|
||||
return False
|
||||
|
||||
try:
|
||||
out = subprocess.check_output("umount %s" % directory, shell=True)
|
||||
self.logger.debug("%s @ %s has been unmounted." % (device, directory))
|
||||
self.read_proc_mounts()
|
||||
return True
|
||||
|
||||
except subprocess.CalledProcessError,e:
|
||||
self.logger.error("Could not unmount %s @ %s: %s" % (device, directory, e.output))
|
||||
|
||||
|
||||
|
||||
def mountall(self, all_=False, fsck=None, timeout=5):
|
||||
for (k, v) in self.mdata['mounts'].iteritems():
|
||||
class MountContext(object):
|
||||
def __init__(self, device, directory, mode, logger):
|
||||
self.mm = MountManager(logger)
|
||||
self.device = device
|
||||
self.directory = directory
|
||||
self.mode = mode
|
||||
|
||||
def __enter__(self):
|
||||
self.status = self.mm.is_mounted(self.device, self.directory)
|
||||
self.mm.mount(self.device, self.directory, self.mode)
|
||||
return self
|
||||
|
||||
def __exit__(self, eType, eValue, eTrace):
|
||||
if self.status:
|
||||
self.mm.mount(self.device, self.directory, self.status['mode'])
|
||||
else:
|
||||
self.mm.umount(self.device, self.directory)
|
||||
|
||||
|
||||
class OnlMountManager(object):
|
||||
def __init__(self, mdata="/etc/mtab.yml", logger=None):
|
||||
self.mm = MountManager(logger)
|
||||
|
||||
if os.path.exists(mdata):
|
||||
mdata = yaml.load(open(mdata, "r"));
|
||||
|
||||
self.mdata = mdata
|
||||
self.logger = logger if logger else logging.getLogger(self.__class__.__name__)
|
||||
|
||||
# Needed to avoid ugly warnings from fsck
|
||||
if not os.path.exists('/etc/mtab'):
|
||||
os.system("ln -s /proc/mounts /etc/mtab")
|
||||
|
||||
self.missing = None
|
||||
|
||||
def init(self, timeout=5):
|
||||
for(k, v) in self.mdata['mounts'].iteritems():
|
||||
#
|
||||
# Get the partition device for the given label.
|
||||
# The timeout logic is here to handle waiting for the
|
||||
# block devices to arrive at boot.
|
||||
#
|
||||
while timeout >= 0:
|
||||
try:
|
||||
v['device'] = subprocess.check_output("blkid -L %s" % k, shell=True).strip()
|
||||
break
|
||||
except subprocess.CalledProcessError:
|
||||
self.logger.debug("Block label %s does not yet exist..." % k)
|
||||
time.sleep(1)
|
||||
timeout -= 1
|
||||
|
||||
if 'device' not in v:
|
||||
self.logger.error("Timeout waiting for block label %s after %d seconds." % (k, timeout))
|
||||
self.missing = k
|
||||
return False
|
||||
|
||||
#
|
||||
# Make the mount point for future use.
|
||||
@@ -66,90 +163,164 @@ class OnlMountManager(object):
|
||||
self.logger.debug("Make directory '%s'..." % v['dir'])
|
||||
os.makedirs(v['dir'])
|
||||
|
||||
#
|
||||
# Get the partition device.
|
||||
# The timeout logic is here to handle waiting for the
|
||||
# block devices to arrive at boot.
|
||||
#
|
||||
while timeout > 0:
|
||||
try:
|
||||
v['device'] = subprocess.check_output("blkid -L %s" % k, shell=True).strip()
|
||||
break
|
||||
except subprocess.CalledProcessError:
|
||||
self.logger.debug("Block label %s does not yet exist..." % k)
|
||||
time.sleep(1)
|
||||
timeout -= 1
|
||||
|
||||
if 'device' not in v:
|
||||
self.logger.error("Timeout waiting for block label %s after %d seconds." % (k, timeout))
|
||||
continue;
|
||||
|
||||
self.logger.debug("%s @ %s" % (k, v['device']))
|
||||
|
||||
isRoot = self.checkroot(v['device'])
|
||||
# if this device is current the root device,
|
||||
# ignore any umount/mount/fsck shenanigans
|
||||
def __fsck(self, label, device):
|
||||
self.logger.info("Running fsck on %s [ %s ]..." % (label, device))
|
||||
cmd = "fsck.ext4 -p %s" % (device)
|
||||
self.logger.debug(cmd)
|
||||
try:
|
||||
out = subprocess.check_output(cmd, shell=True)
|
||||
self.logger.info("%s [ %s ] is clean." % (device, label))
|
||||
return True
|
||||
except subprocess.CalledProcessError, e:
|
||||
self.logger.error("fsck failed: %s" % e.output)
|
||||
return False
|
||||
|
||||
#
|
||||
# If its currently mounted we should unmount first.
|
||||
#
|
||||
if not isRoot and self.checkmount(v['device']):
|
||||
self.logger.info("%s is currently mounted." % (k))
|
||||
try:
|
||||
out = subprocess.check_output("umount %s" % v['device'], shell=True)
|
||||
self.logger.info("%s now unmounted." % (k))
|
||||
except subprocess.CalledProcessError,e:
|
||||
self.logger.error("Could not unmount %s @ %s: %s" % (k, v['device'], e.output))
|
||||
continue
|
||||
#
|
||||
# FS Checks
|
||||
#
|
||||
if fsck is not None:
|
||||
# Override fsck setting with given value
|
||||
self.logger.debug("Overriding fsck settings for %s with %s" % (k, fsck))
|
||||
v['fsck'] = fsck
|
||||
def __label_entry(self, label, emsg=True):
|
||||
|
||||
if not isRoot and v.get('fsck', False):
|
||||
try:
|
||||
self.logger.info("Running fsck on %s [ %s ]..." % (k, v['device']))
|
||||
cmd = "fsck.ext4 -p %s" % (v['device'])
|
||||
self.logger.debug(cmd)
|
||||
try:
|
||||
out = subprocess.check_output(cmd, shell=True)
|
||||
self.logger.info("%s [ %s ] is clean." % (v['device'], k))
|
||||
except subprocess.CalledProcessError, e:
|
||||
self.logger.error("fsck failed: %s" % e.output)
|
||||
except subprocess.CalledProcessError, e:
|
||||
# Todo - recovery options
|
||||
raise
|
||||
if label in self.mdata['mounts']:
|
||||
return self.mdata['mounts'][label]
|
||||
|
||||
if emsg:
|
||||
self.logger.error("Label %s does not exist." % label)
|
||||
|
||||
if all_:
|
||||
v['mount'] = 'w'
|
||||
return None
|
||||
|
||||
mount = v.get('mount', None)
|
||||
if not isRoot and mount:
|
||||
if mount in ['r', 'w']:
|
||||
self.mount(v['device'], v['dir'], mode=mount, timeout=v.get('timeout', 5))
|
||||
def validate_labels(self, labels):
|
||||
|
||||
if type(labels) is str:
|
||||
labels = labels.split(',')
|
||||
elif type(labels) is dict:
|
||||
labels = [ labels.keys() ]
|
||||
elif type(labels) is list:
|
||||
pass
|
||||
else:
|
||||
raise ValueError("invalid labels argument.")
|
||||
|
||||
if 'all' in labels:
|
||||
labels = filter(lambda l: l != 'all', labels) + self.mdata['mounts'].keys()
|
||||
|
||||
rv = []
|
||||
for l in list(set(labels)):
|
||||
if self.__label_entry("ONL-%s" % l.upper(), False):
|
||||
rv.append("ONL-%s" % l.upper())
|
||||
elif self.__label_entry(l.upper(), False):
|
||||
rv.append(l.upper())
|
||||
elif self.__label_entry(l):
|
||||
rv.append(l)
|
||||
else:
|
||||
pass
|
||||
|
||||
return rv;
|
||||
|
||||
def fsck(self, labels, force=False):
|
||||
labels = self.validate_labels(labels)
|
||||
for label in labels:
|
||||
m = self.__label_entry(label)
|
||||
if force or m.get('fsck', False):
|
||||
if not self.mm.is_dev_mounted(m['device']):
|
||||
self.__fsck(label, m['device'])
|
||||
else:
|
||||
self.logger("Mount %s has an invalid mount mode (%s)" % (k, mount))
|
||||
self.logger.error("%s (%s) is mounted." % (label, m['device']))
|
||||
|
||||
|
||||
def mount(self, labels, mode=None):
|
||||
labels = self.validate_labels(labels)
|
||||
for label in labels:
|
||||
m = self.__label_entry(label)
|
||||
mmode = mode
|
||||
if mmode is None:
|
||||
mmode = m.get('mount', False)
|
||||
if mmode:
|
||||
self.mm.mount(m['device'], m['dir'], mmode)
|
||||
|
||||
|
||||
|
||||
def umount(self, labels, all_=False):
|
||||
labels = self.validate_labels(labels)
|
||||
for label in labels:
|
||||
m = self.__label_entry(label)
|
||||
if self.mm.is_mounted(m['device'], m['dir']):
|
||||
if all_ or m.get('mount', False) is False:
|
||||
self.mm.umount(m['device'], m['dir'])
|
||||
|
||||
|
||||
|
||||
############################################################
|
||||
#
|
||||
# CLI Support
|
||||
#
|
||||
############################################################
|
||||
@staticmethod
|
||||
def cmdMount(args, register=False):
|
||||
if register:
|
||||
p = args.add_parser('mount')
|
||||
p.add_argument("labels", nargs='+', metavar='LABEL')
|
||||
p.add_argument("--rw", help='Ignore the mtab setting and mount all labels read/write.', action='store_true')
|
||||
p.add_argument("--ro", help='Ignore the mtab setting and mount all labels read-only.', action='store_true')
|
||||
p.set_defaults(func=OnlMountManager.cmdMount)
|
||||
else:
|
||||
if args.rw:
|
||||
mode = 'rw'
|
||||
elif args.ro:
|
||||
mode = 'ro'
|
||||
else:
|
||||
mode = None
|
||||
|
||||
o = OnlMountManager(args.mtab, args.logger)
|
||||
o.init()
|
||||
o.mount(args.labels, mode=mode)
|
||||
|
||||
|
||||
@staticmethod
|
||||
def main():
|
||||
def cmdFsck(args, register=False):
|
||||
if register:
|
||||
p = args.add_parser('fsck')
|
||||
p.add_argument("labels", nargs='+', metavar='LABEL')
|
||||
p.add_argument("--force", help='Ignore the mtab setting and run fsck on given labels.', action='store_true')
|
||||
p.set_defaults(func=OnlMountManager.cmdFsck)
|
||||
else:
|
||||
o = OnlMountManager(args.mtab, args.logger)
|
||||
o.init()
|
||||
o.fsck(args.labels, args.force)
|
||||
|
||||
@staticmethod
|
||||
def cmdUnmount(args, register=False):
|
||||
if register:
|
||||
p = args.add_parser('unmount')
|
||||
p.add_argument("labels", nargs='+', metavar='LABEL')
|
||||
p.add_argument("--all", help="Ignore the mtab setting and unmount all labels.", action='store_true')
|
||||
p.set_defaults(func=OnlMountManager.cmdUnmount)
|
||||
else:
|
||||
o = OnlMountManager(args.mtab, args.logger)
|
||||
o.init()
|
||||
o.umount(args.labels, args.all)
|
||||
|
||||
@staticmethod
|
||||
def initCommands(parser):
|
||||
sp = parser.add_subparsers()
|
||||
for attr in dir(OnlMountManager):
|
||||
if attr.startswith('cmd'):
|
||||
getattr(OnlMountManager, attr)(sp, register=True)
|
||||
|
||||
@staticmethod
|
||||
def main(name):
|
||||
import argparse
|
||||
|
||||
logging.basicConfig()
|
||||
logger = logging.getLogger(name)
|
||||
|
||||
ap = argparse.ArgumentParser(description="ONL Mount Manager.");
|
||||
ap = argparse.ArgumentParser(description="ONL Mount Manager.")
|
||||
ap.add_argument("--mtab", default="/etc/mtab.yml")
|
||||
ap.add_argument("--rw", action='store_true')
|
||||
ap.add_argument("--verbose", "-v", action='store_true')
|
||||
ap.add_argument("--verbose", "-m", action='store_true')
|
||||
ap.add_argument("--quiet", "-q", action='store_true')
|
||||
|
||||
OnlMountManager.initCommands(ap)
|
||||
ap.set_defaults(logger=logger)
|
||||
|
||||
ops = ap.parse_args();
|
||||
|
||||
logger = logging.getLogger("initmounts")
|
||||
if ops.verbose:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
elif ops.quiet:
|
||||
@@ -157,160 +328,29 @@ class OnlMountManager(object):
|
||||
else:
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
mm = OnlMountManager(ops.mtab, logger)
|
||||
if ops.rw:
|
||||
mm.mountall(all_=True, fsck=False)
|
||||
else:
|
||||
mm.mountall()
|
||||
ops.func(ops)
|
||||
|
||||
|
||||
|
||||
############################################################
|
||||
#
|
||||
# Fix this stuff
|
||||
#
|
||||
############################################################
|
||||
class ServiceMixin(object):
|
||||
class OnlMountContext(MountContext):
|
||||
def __init__(self, label, mode, logger):
|
||||
mm = OnlMountManager()
|
||||
mm.init()
|
||||
labels = mm.validate_labels(label)
|
||||
if not labels:
|
||||
raise ValueError("Label '%s' doesn't exist." % label)
|
||||
MountContext.__init__(self,
|
||||
mm.mdata['mounts'][labels[0]]['device'],
|
||||
mm.mdata['mounts'][labels[0]]['dir'],
|
||||
mode,
|
||||
logger)
|
||||
|
||||
def _execute(self, cmd, root=False, ex=True):
|
||||
self.logger.debug("Executing: %s" % cmd)
|
||||
if root is True and os.getuid() != 0:
|
||||
cmd = "sudo " + cmd
|
||||
try:
|
||||
subprocess.check_call(cmd, shell=True)
|
||||
except Exception, e:
|
||||
if ex:
|
||||
self.logger.error("Command failed: %s" % e)
|
||||
raise
|
||||
else:
|
||||
return e.returncode
|
||||
|
||||
def _raise(self, msg, klass):
|
||||
self.logger.critical(msg)
|
||||
raise klass(msg)
|
||||
|
||||
class DataMount(ServiceMixin):
|
||||
|
||||
def __init__(self, partition, logger=None):
|
||||
self.partition = partition
|
||||
self.logger = logger
|
||||
|
||||
self.mountpoint = None
|
||||
self.mounted = False
|
||||
|
||||
if os.path.isabs(partition) and not os.path.exists(partition):
|
||||
# Implicitly a bind mount. It may not exist yet, so create it
|
||||
os.makedirs(partition)
|
||||
|
||||
if os.path.exists(partition):
|
||||
# Bind mount
|
||||
self.device = None
|
||||
else:
|
||||
self.device = subprocess.check_output("blkid | grep %s | awk '{print $1}' | tr -d ':'" % self.partition, shell=True).strip()
|
||||
if self.device is None or len(self.device) is 0:
|
||||
self._raise("Data partition %s does not exist." % self.partition,
|
||||
RuntimeError)
|
||||
self.logger.debug("device is %s" % self.device)
|
||||
|
||||
def _mount(self):
|
||||
if self.device:
|
||||
self._execute("mount %s %s" % (self.device, self.mountdir()), root=True)
|
||||
else:
|
||||
self._execute("mount --bind %s %s" % (self.partition,
|
||||
self.mountdir()), root=True)
|
||||
self.mounted = True
|
||||
|
||||
def _umount(self):
|
||||
mounted, self.mounted = self.mounted, False
|
||||
if mounted:
|
||||
self._execute("umount %s" % self.mountpoint, root=True)
|
||||
mountpoint, self.mountpoint = self.mountpoint, None
|
||||
if mountpoint and os.path.exists(mountpoint):
|
||||
self.logger.debug("+ /bin/rmdir %s", mountpoint)
|
||||
os.rmdir(mountpoint)
|
||||
|
||||
def __enter__(self):
|
||||
self._mount()
|
||||
return self
|
||||
|
||||
def __exit__(self, type_, value, traceback):
|
||||
self._umount()
|
||||
|
||||
def mountdir(self):
|
||||
if self.mountpoint is None:
|
||||
self.mountpoint = tempfile.mkdtemp(prefix="pki-", suffix=".d")
|
||||
self.logger.debug("mountpoint is %s" % self.mountpoint)
|
||||
return self.mountpoint
|
||||
class OnlMountContextReadOnly(OnlMountContext):
|
||||
def __init__(self, label, logger):
|
||||
OnlMountContext.__init__(self, label, "ro", logger)
|
||||
|
||||
|
||||
class OnlDataStore(ServiceMixin):
|
||||
|
||||
# Data partition containing the persistant store
|
||||
DATA_PARTITION='ONL-CONFIG'
|
||||
|
||||
# Persistant directory on DATA_PARTITION
|
||||
P_DIR=None
|
||||
|
||||
# Runtime directory in the root filesystem
|
||||
R_DIR=None
|
||||
|
||||
def __init__(self, logger=None):
|
||||
|
||||
if logger is None:
|
||||
logging.basicConfig()
|
||||
logger = logging.getLogger(str(self.__class__))
|
||||
logger.setLevel(logging.WARN)
|
||||
|
||||
self.logger = logger
|
||||
|
||||
self.mount = DataMount(self.DATA_PARTITION, logger=self.logger)
|
||||
|
||||
if self.P_DIR is None:
|
||||
raise AttributeError("P_DIR must be set in the derived class.")
|
||||
|
||||
if self.R_DIR is None:
|
||||
raise ValueError("R_DIR must be set in the derived class.")
|
||||
|
||||
# The R_DIR is accessed here
|
||||
self.r_dir = self.R_DIR
|
||||
|
||||
self.logger.debug("persistant dir: %s" % self.p_dir)
|
||||
self.logger.debug(" runtime dir: %s" % self.r_dir)
|
||||
|
||||
@property
|
||||
def p_dir(self):
|
||||
return os.path.join(self.mount.mountdir(), self.P_DIR)
|
||||
|
||||
def _sync_dir(self, src, dst):
|
||||
self.logger.debug("Syncing store from %s -> %s" % (src, dst))
|
||||
if os.path.exists(dst):
|
||||
shutil.rmtree(dst)
|
||||
|
||||
if not os.path.exists(src):
|
||||
os.makedirs(src)
|
||||
|
||||
shutil.copytree(src, dst)
|
||||
|
||||
def init_runtime(self):
|
||||
with self.mount:
|
||||
self._sync_dir(self.p_dir, self.r_dir)
|
||||
|
||||
def commit_runtime(self):
|
||||
with self.mount:
|
||||
self._sync_dir(self.r_dir, self.p_dir)
|
||||
|
||||
def diff(self):
|
||||
with self.mount:
|
||||
rv = self._execute("diff -rNq %s %s" % (self.p_dir, self.r_dir), ex=False)
|
||||
return rv == 0
|
||||
|
||||
def ls(self):
|
||||
with self.mount:
|
||||
self._execute("cd %s && find ." % (self.p_dir))
|
||||
|
||||
def rm(self, filename):
|
||||
with self.mount:
|
||||
os.unlink(os.path.join(self.p_dir, filename))
|
||||
os.unlink(os.path.join(r_dir, filename))
|
||||
|
||||
class OnlMountContextReadWrite(OnlMountContext):
|
||||
def __init__(self, label, logger):
|
||||
OnlMountContext.__init__(self, label, "rw", logger)
|
||||
|
||||
|
||||
@@ -13,83 +13,85 @@ import shutil
|
||||
import subprocess
|
||||
import tempfile
|
||||
import yaml
|
||||
from onl.mounts import OnlMountManager, OnlMountContextReadOnly, OnlMountContextReadWrite
|
||||
from onl.sysconfig import sysconfig
|
||||
from onl.util import *
|
||||
|
||||
from onl.mounts import OnlDataStore
|
||||
|
||||
class OnlPKI(OnlDataStore):
|
||||
P_DIR='private'
|
||||
R_DIR='/private'
|
||||
|
||||
PRIVATE_KEY='key.pem'
|
||||
CERTIFICATE='certificate'
|
||||
class OnlPkiContextReadWrite(OnlMountContextReadWrite):
|
||||
def __init__(self, logger):
|
||||
OnlMountContextReadWrite.__init__(self, "ONL-CONFIG", logger)
|
||||
|
||||
KLEN=2048
|
||||
CDAYS=3650
|
||||
class OnlPkiContextReadOnly(OnlMountContextReadOnly):
|
||||
def __init__(self, logger):
|
||||
OnlMountContextReadOnly.__init__(self, "ONL-CONFIG", logger)
|
||||
|
||||
CSR_FILE='/etc/onl/config/csr.yml'
|
||||
|
||||
class OnlPki(OnlServiceMixin):
|
||||
"""Initialize the ONL-CONFIG::PKI credentials."""
|
||||
|
||||
CONFIG_PKI_DIR="/mnt/onl/config/pki"
|
||||
|
||||
def __init__(self, logger=None):
|
||||
OnlDataStore.__init__(self, logger)
|
||||
self.kpath = os.path.join(self.R_DIR, self.PRIVATE_KEY)
|
||||
self.cpath = os.path.join(self.R_DIR, self.CERTIFICATE)
|
||||
self.logger = logger
|
||||
|
||||
def init_cert(self, force=False):
|
||||
if not os.path.exists(self.cpath) or force:
|
||||
self.logger.info("Generating self-signed certificate...")
|
||||
if self.logger is None:
|
||||
self.logger = logging.getLogger("ONL:PKI")
|
||||
|
||||
#
|
||||
# The csr.yml file allows the system integrator to customize
|
||||
# the fields for the certificate.
|
||||
#
|
||||
fdict = {}
|
||||
try:
|
||||
fdict = yaml.load(open(self.CSR_FILE))
|
||||
except Exception, e:
|
||||
self.logger.error(e);
|
||||
self.kpath = os.path.join(self.CONFIG_PKI_DIR,
|
||||
sysconfig.pki.key.name)
|
||||
|
||||
csr = tempfile.NamedTemporaryFile(prefix="pki-", suffix=".csr", delete=False)
|
||||
csr.close()
|
||||
|
||||
fields = [ "%s=%s" % (k, v) for k,v in fdict.iteritems() ]
|
||||
subject = "/" + "/".join(fields)
|
||||
self.logger.debug("Subject: '%s'", subject)
|
||||
self.logger.debug("CSR: %s", csr.name)
|
||||
self._execute("""openssl req -new -batch -subj "%s" -key %s -out %s""" % (
|
||||
subject, self.kpath, csr.name))
|
||||
self._execute("""openssl x509 -req -days %s -in %s -signkey %s -out %s""" % (
|
||||
self.CDAYS,
|
||||
csr.name, self.kpath, self.cpath))
|
||||
os.unlink(csr.name)
|
||||
else:
|
||||
self.logger.info("Using existing certificate.")
|
||||
|
||||
def init_key(self, force=False):
|
||||
if not os.path.exists(self.kpath) or force:
|
||||
self.logger.info("Generating private key...")
|
||||
cmd = "openssl genrsa -out %s %s" % (self.kpath, self.KLEN)
|
||||
self._execute(cmd)
|
||||
self.init_cert(force=True)
|
||||
else:
|
||||
self.logger.info("Using existing private key.")
|
||||
self.cpath = os.path.join(self.CONFIG_PKI_DIR,
|
||||
sysconfig.pki.cert.name)
|
||||
|
||||
def init(self, force=False):
|
||||
self.init_key(force=force)
|
||||
self.init_cert(force=force)
|
||||
self.commit_runtime()
|
||||
|
||||
def init_key(self, force=False):
|
||||
with OnlPkiContextReadOnly(self.logger):
|
||||
if not os.path.exists(self.kpath) or force:
|
||||
self.logger.info("Generating private key...")
|
||||
cmd = "openssl genrsa -out %s %s" % (self.kpath, sysconfig.pki.key.len)
|
||||
with OnlPkiContextReadWrite(self.logger):
|
||||
if not os.path.isdir(self.CONFIG_PKI_DIR):
|
||||
os.makedirs(self.CONFIG_PKI_DIR)
|
||||
self._execute(cmd)
|
||||
self.init_cert(force=True)
|
||||
else:
|
||||
self.logger.info("Using existing private key.")
|
||||
|
||||
def init_cert(self, force=False):
|
||||
with OnlPkiContextReadOnly(self.logger):
|
||||
if not os.path.exists(self.cpath) or force:
|
||||
self.logger.info("Generating self-signed certificate...")
|
||||
csr = tempfile.NamedTemporaryFile(prefix="pki-", suffix=".csr", delete=False)
|
||||
csr.close()
|
||||
fields = [ "%s=%s" % (k, v) for k,v in sysconfig.pki.cert.csr.fields.iteritems() ]
|
||||
subject = "/" + "/".join(fields)
|
||||
self.logger.debug("Subject: '%s'", subject)
|
||||
self.logger.debug("CSR: %s", csr.name)
|
||||
with OnlPkiContextReadWrite(self.logger):
|
||||
if not os.path.isdir(self.CONFIG_PKI_DIR):
|
||||
os.makedirs(self.CONFIG_PKI_DIR)
|
||||
self._execute("""openssl req -new -batch -subj "%s" -key %s -out %s""" % (
|
||||
subject, self.kpath, csr.name))
|
||||
self._execute("""openssl x509 -req -days %s -sha256 -in %s -signkey %s -out %s""" % (
|
||||
sysconfig.pki.cert.csr.cdays,
|
||||
csr.name, self.kpath, self.cpath))
|
||||
os.unlink(csr.name)
|
||||
else:
|
||||
self.logger.info("Using existing certificate.")
|
||||
|
||||
@staticmethod
|
||||
def main():
|
||||
ap = argparse.ArgumentParser(description="ONL PKI Management")
|
||||
ap.add_argument("--init", action='store_true', help="Initialize /private and PKI files if necessary.")
|
||||
ap.add_argument("--init", action='store_true', help="Initialize PKI files (if necessary)")
|
||||
ap.add_argument("--regen-cert", action='store_true', help="Regenerate certificate.")
|
||||
ap.add_argument("--force", "-f", action='store_true', help="Force regeneration of the key and certificate during initialization (--init)")
|
||||
ap.add_argument("--commit", action='store_true', help="Commit the runtime /private directory to the persistant storage.")
|
||||
ap.add_argument("--ls", action='store_true', help="List contents of the peristant directory.")
|
||||
ap.add_argument("--quiet", "-q", action='store_true', help="Quiet output.")
|
||||
ap.add_argument("--verbose", "-v", action='store_true', help="Verbose output.")
|
||||
ap.add_argument("--part", help='Override Data Partition (testing only).')
|
||||
ap.add_argument("--rd", help='Override /private runtime directory (testing only)')
|
||||
|
||||
ops = ap.parse_args()
|
||||
|
||||
@@ -103,27 +105,10 @@ class OnlPKI(OnlDataStore):
|
||||
else:
|
||||
logger.setLevel(logging.INFO)
|
||||
|
||||
if ops.part:
|
||||
OnlPKI.DATA_PARTITION=ops.part
|
||||
|
||||
if ops.rd:
|
||||
OnlPKI.R_DIR=ops.rd
|
||||
|
||||
pki = OnlPKI(logger)
|
||||
pki = OnlPki(logger)
|
||||
|
||||
if ops.init:
|
||||
pki.init_runtime()
|
||||
pki.init_key(force=ops.force)
|
||||
pki.init_cert(force=ops.force)
|
||||
pki.commit_runtime()
|
||||
|
||||
elif ops.regen_cert:
|
||||
pki.init_cert(force=True)
|
||||
pki.commit_runtime()
|
||||
|
||||
elif ops.commit:
|
||||
pki.commit_runtime()
|
||||
elif ops.ls:
|
||||
pki.ls()
|
||||
else:
|
||||
pki.diff()
|
||||
|
||||
@@ -13,9 +13,9 @@ import pprint
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
|
||||
import yaml
|
||||
import onl.YamlUtils
|
||||
import subprocess
|
||||
|
||||
class OnlInfoObject(object):
|
||||
DEFAULT_INDENT=" "
|
||||
@@ -173,14 +173,8 @@ class OnlPlatformBase(object):
|
||||
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.")
|
||||
return self.PLATFORM
|
||||
|
||||
def baseplatform(self):
|
||||
p = self.platform()
|
||||
@@ -188,8 +182,7 @@ class OnlPlatformBase(object):
|
||||
return p
|
||||
|
||||
def description(self):
|
||||
return "%s %s (%s)" % (self.manufacturer(), self.model(),
|
||||
self.platform())
|
||||
return "%s %s" % (self.MANUFACTURER, self.MODEL)
|
||||
|
||||
def serialnumber(self):
|
||||
return self.onie_info.SERIAL_NUMBER
|
||||
@@ -200,31 +193,26 @@ class OnlPlatformBase(object):
|
||||
|
||||
|
||||
# ONL Platform Information Tree
|
||||
def opit_oid(self):
|
||||
return "1.3.6.1.4.1.37538.2.1000"
|
||||
def platform_info_oid(self):
|
||||
return "1.3.6.1.4.1.42623.1.1"
|
||||
|
||||
# ONL Platform Information General Tree
|
||||
def opitg_oid(self):
|
||||
return self.opit_oid() + ".1"
|
||||
def platform_info_general_oid(self):
|
||||
return self.platform_info_oid() + ".1"
|
||||
|
||||
# ONL Platform Information General Sys Tree
|
||||
def opitg_sys_oid(self):
|
||||
return self.opitg_oid() + ".1"
|
||||
def platform_info_general_sys_oid(self):
|
||||
return self.platform_info_general_oid() + ".1"
|
||||
|
||||
# ONL Platform Information Vendor Tree
|
||||
def opitv_oid(self):
|
||||
return self.opit_oid() + ".2"
|
||||
|
||||
def sys_oid_vendor(self):
|
||||
return ".37538"
|
||||
def platform_info_vendor_oid(self):
|
||||
return self.platform_info_oid() + ".2"
|
||||
|
||||
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());
|
||||
return "%s.%s%s" % (self.platform_info_vendor_oid(), self.PRIVATE_ENTERPRISE_NUMBER, self.SYS_OBJECT_ID)
|
||||
|
||||
def onie_version(self):
|
||||
return self.onie_info.ONIE_VERSION
|
||||
@@ -269,20 +257,24 @@ class OnlPlatformBase(object):
|
||||
# is ma1 and lo
|
||||
return 2
|
||||
|
||||
def environment(self):
|
||||
yamlstr = subprocess.check_output(['/bin/onlpd', '-r', '-y'])
|
||||
data = yaml.load(yamlstr);
|
||||
return data
|
||||
|
||||
def __str__(self):
|
||||
s = """Manufacturer: %s
|
||||
Model: %s
|
||||
Platform: %s
|
||||
Description: %s
|
||||
s = """Model: %s
|
||||
Manufacturer: %s
|
||||
Ports: %s (%s)
|
||||
System Object Id: %s
|
||||
System Information:
|
||||
%s
|
||||
%s
|
||||
""" % (
|
||||
self.manufacturer(),
|
||||
self.model(),
|
||||
self.platform(),
|
||||
self.description(),
|
||||
self.MODEL,
|
||||
self.MANUFACTURER,
|
||||
self.PORT_COUNT,
|
||||
self.PORT_CONFIG,
|
||||
self.sys_object_id(),
|
||||
str(self.onie_info),
|
||||
str(self.platform_info),
|
||||
@@ -298,7 +290,22 @@ Warning: %s
|
||||
return s
|
||||
|
||||
|
||||
class OnlPlatformPortConfig_48x1_4x10(object):
|
||||
PORT_COUNT=52
|
||||
PORT_CONFIG="48x1 + 4x10"
|
||||
|
||||
class OnlPlatformPortConfig_48x10_4x40(object):
|
||||
PORT_COUNT=52
|
||||
PORT_CONFIG="48x10 + 4x40"
|
||||
|
||||
class OnlPlatformPortConfig_48x10_6x40(object):
|
||||
PORT_COUNT=54
|
||||
PORT_CONFIG="48x10 + 6x40"
|
||||
|
||||
class OnlPlatformPortConfig_32x40(object):
|
||||
PORT_COUNT=32
|
||||
PORT_CONFIG="32x40"
|
||||
|
||||
class OnlPlatformPortConfig_32x100(object):
|
||||
PORT_COUNT=32
|
||||
PORT_CONFIG="32x100"
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
############################################################
|
||||
#
|
||||
# ONL System Configuration
|
||||
#
|
||||
############################################################
|
||||
import os
|
||||
import sys
|
||||
import yaml
|
||||
import types
|
||||
import onl.onlyaml
|
||||
import onl.util
|
||||
import platform as pp
|
||||
from onl.platform.current import OnlPlatform
|
||||
|
||||
class DotDict(dict):
|
||||
""" Access keys in a nested dictionary using dot notation """
|
||||
|
||||
def __getattr__(self, attr):
|
||||
item = self.get(attr, None)
|
||||
|
||||
if item is None:
|
||||
raise AttributeError("'%s' object has no attribute '%s'" % (type(self), attr))
|
||||
|
||||
if type(item) == types.DictType:
|
||||
item = DotDict(item)
|
||||
|
||||
return item
|
||||
|
||||
__setattr__= dict.__setitem__
|
||||
__delattr__= dict.__delitem__
|
||||
|
||||
|
||||
class OnlSystemConfig(object):
|
||||
SYSTEM_CONFIG_DIR = '/etc/onl/sysconfig'
|
||||
|
||||
def __init__(self):
|
||||
|
||||
platform = OnlPlatform()
|
||||
self.variables = {}
|
||||
self.variables['PLATFORM'] = platform.platform()
|
||||
self.variables['ARCH'] = pp.machine()
|
||||
self.variables['PARCH'] = dict(ppc='powerpc',
|
||||
x86_64='amd64',
|
||||
armv7l='armel')[pp.machine()]
|
||||
|
||||
self.config = {}
|
||||
for f in sorted(os.listdir(self.SYSTEM_CONFIG_DIR)):
|
||||
if f.endswith('.yml'):
|
||||
d = onl.onlyaml.loadf(os.path.join(self.SYSTEM_CONFIG_DIR, f), self.variables)
|
||||
self.config = onl.util.dmerge(self.config, d)
|
||||
|
||||
self.config['pc'] = platform.platform_config
|
||||
|
||||
def dump(self):
|
||||
return yaml.dump(self.config, default_flow_style=False)
|
||||
|
||||
x = OnlSystemConfig()
|
||||
sysconfig = DotDict(x.config)
|
||||
sysconfig['OnlSystemConfig'] = x
|
||||
@@ -13,6 +13,7 @@ import shutil
|
||||
import json
|
||||
import string
|
||||
import argparse
|
||||
import yaml
|
||||
from time import sleep
|
||||
from onl.platform.current import OnlPlatform
|
||||
|
||||
@@ -36,32 +37,11 @@ class BaseUpgrade(object):
|
||||
self.arch = pp.machine()
|
||||
self.parch = dict(ppc='powerpc', x86_64='amd64', armv7l='armel')[self.arch]
|
||||
self.platform = OnlPlatform()
|
||||
self.init()
|
||||
|
||||
def init(self):
|
||||
pass
|
||||
|
||||
#
|
||||
# TODO.
|
||||
#
|
||||
# DEFAULT_CONFIG = {
|
||||
# "auto-upgrade" : "advisory",
|
||||
# }
|
||||
#
|
||||
# CONFIG_FILES = [
|
||||
# "/etc/boot.d/upgrade/.upgrade-config.json",
|
||||
# "/mnt/flash/override-upgrade-config.json"
|
||||
# ]
|
||||
#
|
||||
# def load_config(self):
|
||||
# self.config = self.DEFAULT_CONFIG
|
||||
# for f in self.CONFIG_FILES:
|
||||
# if os.path.exists(f):
|
||||
# self.config.update(json.load(file(f)))
|
||||
#
|
||||
# self.logger.debug("Loaded Configuration:\n%s\n" % (json.dumps(self.config, indent=2)))
|
||||
#
|
||||
# if self.name in self.config:
|
||||
# self.config = self.config['name']
|
||||
#
|
||||
# self.logger.debug("Final Configuration:\n%s\n" % (json.dumps(self.config, indent=2)))
|
||||
#
|
||||
def load_config(self):
|
||||
pass
|
||||
|
||||
@@ -78,13 +58,17 @@ class BaseUpgrade(object):
|
||||
if os.getenv("DEBUG"):
|
||||
self.logger.setLevel(logging.DEBUG)
|
||||
|
||||
|
||||
def auto_upgrade_default(self):
|
||||
return "advisory"
|
||||
|
||||
def init_argparser(self):
|
||||
self.ap = argparse.ArgumentParser("%s-upgrade" % self.name)
|
||||
self.ap.add_argument("--enable", action='store_true', help="Enable updates.")
|
||||
self.ap.add_argument("--force", action='store_true', help="Force update.")
|
||||
self.ap.add_argument("--no-reboot", action='store_true', help="Don't reboot.")
|
||||
self.ap.add_argument("--check", action='store_true', help="Check only.")
|
||||
self.ap.add_argument("--auto-upgrade", help="Override auto-upgrade mode.", default='advisory')
|
||||
self.ap.add_argument("--auto-upgrade", help="Override auto-upgrade mode.", default=self.auto_upgrade_default())
|
||||
self.ap.add_argument("--summarize", action='store_true', help="Summarize only, no upgrades.")
|
||||
|
||||
def banner(self):
|
||||
@@ -173,7 +157,7 @@ class BaseUpgrade(object):
|
||||
return default
|
||||
|
||||
|
||||
UPGRADE_STATUS_JSON = "/lib/platform-config/current/upgrade.json"
|
||||
UPGRADE_STATUS_JSON = "/lib/platform-config/current/onl/upgrade.json"
|
||||
|
||||
def update_upgrade_status(self, key, value):
|
||||
data = {}
|
||||
@@ -184,7 +168,6 @@ class BaseUpgrade(object):
|
||||
with open(self.UPGRADE_STATUS_JSON, "w") as f:
|
||||
json.dump(data, f)
|
||||
|
||||
|
||||
#
|
||||
# Initialize self.current_version, self.next_Version
|
||||
# and anything required for summarize()
|
||||
@@ -425,3 +408,13 @@ class BaseOnieUpgrade(BaseUpgrade):
|
||||
if os.path.exists(self.ONIE_UPDATER_PATH):
|
||||
self.logger.info("Removing previous onie-updater.")
|
||||
os.remove(self.ONIE_UPDATER_PATH)
|
||||
|
||||
|
||||
|
||||
def upgrade_status():
|
||||
data = {}
|
||||
if os.path.exists(BaseUpgrade.UPGRADE_STATUS_JSON):
|
||||
with open(BaseUpgrade.UPGRADE_STATUS_JSON) as f:
|
||||
data = json.load(f)
|
||||
return data
|
||||
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
import subprocess
|
||||
|
||||
class OnlServiceMixin(object):
|
||||
def _execute(self, cmd, root=False, ex=True):
|
||||
self.logger.debug("Executing: %s" % cmd)
|
||||
if root is True and os.getuid() != 0:
|
||||
cmd = "sudo " + cmd
|
||||
try:
|
||||
subprocess.check_call(cmd, shell=True)
|
||||
except Exception, e:
|
||||
if ex:
|
||||
self.logger.error("Command failed: %s" % e)
|
||||
raise
|
||||
else:
|
||||
return e.returncode
|
||||
|
||||
def _raise(self, msg, klass):
|
||||
self.logger.critical(msg)
|
||||
raise klass(msg)
|
||||
|
||||
|
||||
def dmerge(d1, d2):
|
||||
"""
|
||||
dictionary merge.
|
||||
|
||||
d1 is the default source. Leaf values from d2 will override.
|
||||
|
||||
d1 is the 'default' source; leaf values from d2 will override.
|
||||
Returns the merged tree.
|
||||
|
||||
Set a leaf in d2 to None to create a tombstone (discard any key
|
||||
from d1).
|
||||
|
||||
if a (sub) key in d1, d2 differ in type (dict vs. non-dict) then
|
||||
the merge will proceed with the non-dict promoted to a dict using
|
||||
the default-key schema ('='). Consumers of this function should be
|
||||
prepared to handle such keys.
|
||||
"""
|
||||
merged = {}
|
||||
q = [(d1, d2, merged)]
|
||||
while True:
|
||||
if not q: break
|
||||
c1, c2, c3 = q.pop(0)
|
||||
# add in non-overlapping keys
|
||||
# 'None' keys from p2 are tombstones
|
||||
s1 = set(c1.keys())
|
||||
s2 = set(c2.keys())
|
||||
|
||||
for k in s1.difference(s2):
|
||||
v = c1[k]
|
||||
if type(v) == dict:
|
||||
c3.setdefault(k, {})
|
||||
q.append((v, {}, c3[k],))
|
||||
else:
|
||||
c3.setdefault(k, v)
|
||||
|
||||
for k in s2.difference(s1):
|
||||
v = c2[k]
|
||||
if v is None: continue
|
||||
if type(v) == dict:
|
||||
c3.setdefault(k, {})
|
||||
q.append(({}, v, c3[k],))
|
||||
else:
|
||||
c3.setdefault(k, v)
|
||||
|
||||
# handle overlapping keys
|
||||
for k in s1.intersection(s2):
|
||||
v1 = c1[k]
|
||||
v2 = c2[k]
|
||||
|
||||
if v2 is None: continue
|
||||
|
||||
# two dicts, key-by-key reconciliation required
|
||||
if type(v1) == dict and type(v2) == dict:
|
||||
c3.setdefault(k, {})
|
||||
q.append((v1, v2, c3[k],))
|
||||
continue
|
||||
|
||||
# two non-dicts, p2 wins
|
||||
if type(v1) != dict and type(v2) != dict:
|
||||
c3[k] = v2
|
||||
continue
|
||||
|
||||
if type(v1) != dict:
|
||||
v1 = { '=' : v1, }
|
||||
if type(v2) != dict:
|
||||
v2 = { '=' : v2, }
|
||||
c3.setdefault(k, {})
|
||||
q.append((v1, v2, c3[k],))
|
||||
|
||||
return merged
|
||||
@@ -0,0 +1,37 @@
|
||||
import json
|
||||
|
||||
class OnlVersionManifest(object):
|
||||
def __init__(self, manifest):
|
||||
self.version = json.load(open(manifest))
|
||||
|
||||
if 'version' in self.version:
|
||||
self.version = self.version['version']
|
||||
|
||||
def __getattr__(self, name):
|
||||
if name in self.version:
|
||||
return self.version[name]
|
||||
else:
|
||||
raise AttributeError("version key '%s' does not exist." % name)
|
||||
|
||||
class OnlVersionBase(OnlVersionManifest):
|
||||
def __init__(self):
|
||||
OnlVersionManifest.__init__(self, self.MANIFEST)
|
||||
|
||||
class OnlRootfsVersion(OnlVersionBase):
|
||||
MANIFEST='/etc/onl/rootfs/manifest.json'
|
||||
|
||||
class OnlLoaderVersion(OnlVersionBase):
|
||||
MANIFEST='/etc/onl/loader/manifest.json'
|
||||
|
||||
#
|
||||
# Expected usage:
|
||||
#
|
||||
# import onl.versions
|
||||
#
|
||||
# print onl.versions.rootfs.BUILD_TIMESTAMP
|
||||
#
|
||||
|
||||
rootfs = OnlRootfsVersion()
|
||||
loader = OnlLoaderVersion()
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ MANIFEST := $(shell $(ONLPM) --find-file onl-loader-initrd:amd64 manifest.json)
|
||||
all:
|
||||
mkdir -p files
|
||||
cp $(KERNELS) files
|
||||
cp $(INITRD) files/initrd-amd64
|
||||
cp $(INITRD) files
|
||||
cp $(MANIFEST) files
|
||||
|
||||
|
||||
|
||||
1
packages/base/any/faultd/src/.module
Normal file
1
packages/base/any/faultd/src/.module
Normal file
@@ -0,0 +1 @@
|
||||
name: faultd
|
||||
@@ -31,6 +31,8 @@ clean:
|
||||
setup: setup-pyroute2 setup-dnspython setup-libyaml setup-pyyaml setup-jq setup-pyparted
|
||||
cp $(wildcard patches/busybox*.patch) $(BUILDROOT_SOURCE)/package/busybox/
|
||||
cp $(wildcard patches/kexec*.patch) $(BUILDROOT_SOURCE)/package/kexec/
|
||||
cp $(wildcard patches/openssl*.patch) $(BUILDROOT_SOURCE)/package/openssl/
|
||||
rm $(BUILDROOT_SOURCE)/package/openssl/openssl-do-not-build-docs.patch
|
||||
sed -i 's%^DOSFSTOOLS_SITE =.*%DOSFSTOOLS_SITE = http://downloads.openwrt.org/sources%' $(BUILDROOT_SOURCE)/package/dosfstools/dosfstools.mk
|
||||
sed -i 's%^UEMACS_SITE =.*%UEMACS_SITE = http://www.kernel.org/pub/linux/kernel/uemacs%;s%^UEMACS_SOURCE =.*%UEMACS_SOURCE = em-$$(UEMACS_VERSION).tar.gz%' $(BUILDROOT_SOURCE)/package/uemacs/uemacs.mk
|
||||
mkdir -p $(BUILDROOT_ARCHDIRS)
|
||||
|
||||
@@ -0,0 +1,354 @@
|
||||
http://rt.openssl.org/Ticket/Display.html?id=2084
|
||||
|
||||
--- a/Makefile.org
|
||||
+++ b/Makefile.org
|
||||
@@ -247,17 +247,17 @@
|
||||
build_libs: build_crypto build_ssl build_engines
|
||||
|
||||
build_crypto:
|
||||
- @dir=crypto; target=all; $(BUILD_ONE_CMD)
|
||||
+ +@dir=crypto; target=all; $(BUILD_ONE_CMD)
|
||||
-build_ssl:
|
||||
+build_ssl: build_crypto
|
||||
- @dir=ssl; target=all; $(BUILD_ONE_CMD)
|
||||
+ +@dir=ssl; target=all; $(BUILD_ONE_CMD)
|
||||
-build_engines:
|
||||
+build_engines: build_crypto
|
||||
- @dir=engines; target=all; $(BUILD_ONE_CMD)
|
||||
+ +@dir=engines; target=all; $(BUILD_ONE_CMD)
|
||||
-build_apps:
|
||||
+build_apps: build_libs
|
||||
- @dir=apps; target=all; $(BUILD_ONE_CMD)
|
||||
+ +@dir=apps; target=all; $(BUILD_ONE_CMD)
|
||||
-build_tests:
|
||||
+build_tests: build_libs
|
||||
- @dir=test; target=all; $(BUILD_ONE_CMD)
|
||||
+ +@dir=test; target=all; $(BUILD_ONE_CMD)
|
||||
-build_tools:
|
||||
+build_tools: build_libs
|
||||
- @dir=tools; target=all; $(BUILD_ONE_CMD)
|
||||
+ +@dir=tools; target=all; $(BUILD_ONE_CMD)
|
||||
|
||||
all_testapps: build_libs build_testapps
|
||||
build_testapps:
|
||||
@@ -497,9 +497,9 @@
|
||||
dist_pem_h:
|
||||
(cd crypto/pem; $(MAKE) -e $(BUILDENV) pem.h; $(MAKE) clean)
|
||||
|
||||
-install: all install_docs install_sw
|
||||
+install: install_sw
|
||||
|
||||
-install_sw:
|
||||
+install_dirs:
|
||||
@$(PERL) $(TOP)/util/mkdir-p.pl $(INSTALL_PREFIX)$(INSTALLTOP)/bin \
|
||||
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR) \
|
||||
$(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines \
|
||||
@@ -508,6 +508,13 @@
|
||||
$(INSTALL_PREFIX)$(OPENSSLDIR)/misc \
|
||||
$(INSTALL_PREFIX)$(OPENSSLDIR)/certs \
|
||||
$(INSTALL_PREFIX)$(OPENSSLDIR)/private
|
||||
+ @$(PERL) $(TOP)/util/mkdir-p.pl \
|
||||
+ $(INSTALL_PREFIX)$(MANDIR)/man1 \
|
||||
+ $(INSTALL_PREFIX)$(MANDIR)/man3 \
|
||||
+ $(INSTALL_PREFIX)$(MANDIR)/man5 \
|
||||
+ $(INSTALL_PREFIX)$(MANDIR)/man7
|
||||
+
|
||||
+install_sw: install_dirs
|
||||
@set -e; headerlist="$(EXHEADER)"; for i in $$headerlist;\
|
||||
do \
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
@@ -511,7 +511,7 @@
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
- @set -e; target=install; $(RECURSIVE_BUILD_CMD)
|
||||
+ +@set -e; target=install; $(RECURSIVE_BUILD_CMD)
|
||||
@set -e; liblist="$(LIBS)"; for i in $$liblist ;\
|
||||
do \
|
||||
if [ -f "$$i" ]; then \
|
||||
@@ -593,12 +600,7 @@
|
||||
done; \
|
||||
done
|
||||
|
||||
-install_docs:
|
||||
- @$(PERL) $(TOP)/util/mkdir-p.pl \
|
||||
- $(INSTALL_PREFIX)$(MANDIR)/man1 \
|
||||
- $(INSTALL_PREFIX)$(MANDIR)/man3 \
|
||||
- $(INSTALL_PREFIX)$(MANDIR)/man5 \
|
||||
- $(INSTALL_PREFIX)$(MANDIR)/man7
|
||||
+install_docs: install_dirs
|
||||
@pod2man="`cd ./util; ./pod2mantest $(PERL)`"; \
|
||||
here="`pwd`"; \
|
||||
filecase=; \
|
||||
--- a/Makefile.shared
|
||||
+++ b/Makefile.shared
|
||||
@@ -105,6 +105,7 @@ LINK_SO= \
|
||||
SHAREDFLAGS="$${SHAREDFLAGS:-$(CFLAGS) $(SHARED_LDFLAGS)}"; \
|
||||
LIBPATH=`for x in $$LIBDEPS; do echo $$x; done | sed -e 's/^ *-L//;t' -e d | uniq`; \
|
||||
LIBPATH=`echo $$LIBPATH | sed -e 's/ /:/g'`; \
|
||||
+ [ -e $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX ] && exit 0; \
|
||||
LD_LIBRARY_PATH=$$LIBPATH:$$LD_LIBRARY_PATH \
|
||||
$${SHAREDCMD} $${SHAREDFLAGS} \
|
||||
-o $$SHLIB$$SHLIB_SOVER$$SHLIB_SUFFIX \
|
||||
@@ -122,6 +124,7 @@ SYMLINK_SO= \
|
||||
done; \
|
||||
fi; \
|
||||
if [ -n "$$SHLIB_SOVER" ]; then \
|
||||
+ [ -e "$$SHLIB$$SHLIB_SUFFIX" ] || \
|
||||
( $(SET_X); rm -f $$SHLIB$$SHLIB_SUFFIX; \
|
||||
ln -s $$prev $$SHLIB$$SHLIB_SUFFIX ); \
|
||||
fi; \
|
||||
--- a/crypto/Makefile
|
||||
+++ b/crypto/Makefile
|
||||
@@ -85,11 +85,11 @@
|
||||
@if [ -z "$(THIS)" ]; then $(MAKE) -f $(TOP)/Makefile reflect THIS=$@; fi
|
||||
|
||||
subdirs:
|
||||
- @target=all; $(RECURSIVE_MAKE)
|
||||
+ +@target=all; $(RECURSIVE_MAKE)
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
|
||||
- @target=files; $(RECURSIVE_MAKE)
|
||||
+ +@target=files; $(RECURSIVE_MAKE)
|
||||
|
||||
links:
|
||||
@$(PERL) $(TOP)/util/mklink.pl ../include/openssl $(EXHEADER)
|
||||
@@ -100,7 +100,7 @@
|
||||
# lib: $(LIB): are splitted to avoid end-less loop
|
||||
lib: $(LIB)
|
||||
@touch lib
|
||||
-$(LIB): $(LIBOBJ)
|
||||
+$(LIB): $(LIBOBJ) | subdirs
|
||||
$(AR) $(LIB) $(LIBOBJ)
|
||||
$(RANLIB) $(LIB) || echo Never mind.
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
fi
|
||||
|
||||
libs:
|
||||
- @target=lib; $(RECURSIVE_MAKE)
|
||||
+ +@target=lib; $(RECURSIVE_MAKE)
|
||||
|
||||
install:
|
||||
@[ -n "$(INSTALLTOP)" ] # should be set by top Makefile...
|
||||
@@ -119,7 +119,7 @@
|
||||
(cp $$i $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i; \
|
||||
chmod 644 $(INSTALL_PREFIX)$(INSTALLTOP)/include/openssl/$$i ); \
|
||||
done;
|
||||
- @target=install; $(RECURSIVE_MAKE)
|
||||
+ +@target=install; $(RECURSIVE_MAKE)
|
||||
|
||||
lint:
|
||||
@target=lint; $(RECURSIVE_MAKE)
|
||||
--- a/engines/Makefile
|
||||
+++ b/engines/Makefile
|
||||
@@ -72,7 +72,7 @@
|
||||
|
||||
all: lib subdirs
|
||||
|
||||
-lib: $(LIBOBJ)
|
||||
+lib: $(LIBOBJ) | subdirs
|
||||
@if [ -n "$(SHARED_LIBS)" ]; then \
|
||||
set -e; \
|
||||
for l in $(LIBNAMES); do \
|
||||
@@ -89,7 +89,7 @@
|
||||
|
||||
subdirs:
|
||||
echo $(EDIRS)
|
||||
- @target=all; $(RECURSIVE_MAKE)
|
||||
+ +@target=all; $(RECURSIVE_MAKE)
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
|
||||
@@ -128,7 +128,7 @@
|
||||
mv -f $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx.new $(INSTALL_PREFIX)$(INSTALLTOP)/$(LIBDIR)/engines/$$pfx$$l$$sfx ); \
|
||||
done; \
|
||||
fi
|
||||
- @target=install; $(RECURSIVE_MAKE)
|
||||
+ +@target=install; $(RECURSIVE_MAKE)
|
||||
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
--- a/test/Makefile
|
||||
+++ b/test/Makefile
|
||||
@@ -123,7 +123,7 @@
|
||||
tags:
|
||||
ctags $(SRC)
|
||||
|
||||
-tests: exe apps $(TESTS)
|
||||
+tests: exe $(TESTS)
|
||||
|
||||
apps:
|
||||
@(cd ..; $(MAKE) DIRS=apps all)
|
||||
@@ -365,109 +365,109 @@
|
||||
link_app.$${shlib_target}
|
||||
|
||||
$(RSATEST)$(EXE_EXT): $(RSATEST).o $(DLIBCRYPTO)
|
||||
- @target=$(RSATEST); $(BUILD_CMD)
|
||||
+ +@target=$(RSATEST); $(BUILD_CMD)
|
||||
|
||||
$(BNTEST)$(EXE_EXT): $(BNTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(BNTEST); $(BUILD_CMD)
|
||||
+ +@target=$(BNTEST); $(BUILD_CMD)
|
||||
|
||||
$(ECTEST)$(EXE_EXT): $(ECTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(ECTEST); $(BUILD_CMD)
|
||||
+ +@target=$(ECTEST); $(BUILD_CMD)
|
||||
|
||||
$(EXPTEST)$(EXE_EXT): $(EXPTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(EXPTEST); $(BUILD_CMD)
|
||||
+ +@target=$(EXPTEST); $(BUILD_CMD)
|
||||
|
||||
$(IDEATEST)$(EXE_EXT): $(IDEATEST).o $(DLIBCRYPTO)
|
||||
- @target=$(IDEATEST); $(BUILD_CMD)
|
||||
+ +@target=$(IDEATEST); $(BUILD_CMD)
|
||||
|
||||
$(MD2TEST)$(EXE_EXT): $(MD2TEST).o $(DLIBCRYPTO)
|
||||
- @target=$(MD2TEST); $(BUILD_CMD)
|
||||
+ +@target=$(MD2TEST); $(BUILD_CMD)
|
||||
|
||||
$(SHATEST)$(EXE_EXT): $(SHATEST).o $(DLIBCRYPTO)
|
||||
- @target=$(SHATEST); $(BUILD_CMD)
|
||||
+ +@target=$(SHATEST); $(BUILD_CMD)
|
||||
|
||||
$(SHA1TEST)$(EXE_EXT): $(SHA1TEST).o $(DLIBCRYPTO)
|
||||
- @target=$(SHA1TEST); $(BUILD_CMD)
|
||||
+ +@target=$(SHA1TEST); $(BUILD_CMD)
|
||||
|
||||
$(SHA256TEST)$(EXE_EXT): $(SHA256TEST).o $(DLIBCRYPTO)
|
||||
- @target=$(SHA256TEST); $(BUILD_CMD)
|
||||
+ +@target=$(SHA256TEST); $(BUILD_CMD)
|
||||
|
||||
$(SHA512TEST)$(EXE_EXT): $(SHA512TEST).o $(DLIBCRYPTO)
|
||||
- @target=$(SHA512TEST); $(BUILD_CMD)
|
||||
+ +@target=$(SHA512TEST); $(BUILD_CMD)
|
||||
|
||||
$(RMDTEST)$(EXE_EXT): $(RMDTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(RMDTEST); $(BUILD_CMD)
|
||||
+ +@target=$(RMDTEST); $(BUILD_CMD)
|
||||
|
||||
$(MDC2TEST)$(EXE_EXT): $(MDC2TEST).o $(DLIBCRYPTO)
|
||||
- @target=$(MDC2TEST); $(BUILD_CMD)
|
||||
+ +@target=$(MDC2TEST); $(BUILD_CMD)
|
||||
|
||||
$(MD4TEST)$(EXE_EXT): $(MD4TEST).o $(DLIBCRYPTO)
|
||||
- @target=$(MD4TEST); $(BUILD_CMD)
|
||||
+ +@target=$(MD4TEST); $(BUILD_CMD)
|
||||
|
||||
$(MD5TEST)$(EXE_EXT): $(MD5TEST).o $(DLIBCRYPTO)
|
||||
- @target=$(MD5TEST); $(BUILD_CMD)
|
||||
+ +@target=$(MD5TEST); $(BUILD_CMD)
|
||||
|
||||
$(HMACTEST)$(EXE_EXT): $(HMACTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(HMACTEST); $(BUILD_CMD)
|
||||
+ +@target=$(HMACTEST); $(BUILD_CMD)
|
||||
|
||||
$(WPTEST)$(EXE_EXT): $(WPTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(WPTEST); $(BUILD_CMD)
|
||||
+ +@target=$(WPTEST); $(BUILD_CMD)
|
||||
|
||||
$(RC2TEST)$(EXE_EXT): $(RC2TEST).o $(DLIBCRYPTO)
|
||||
- @target=$(RC2TEST); $(BUILD_CMD)
|
||||
+ +@target=$(RC2TEST); $(BUILD_CMD)
|
||||
|
||||
$(BFTEST)$(EXE_EXT): $(BFTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(BFTEST); $(BUILD_CMD)
|
||||
+ +@target=$(BFTEST); $(BUILD_CMD)
|
||||
|
||||
$(CASTTEST)$(EXE_EXT): $(CASTTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(CASTTEST); $(BUILD_CMD)
|
||||
+ +@target=$(CASTTEST); $(BUILD_CMD)
|
||||
|
||||
$(RC4TEST)$(EXE_EXT): $(RC4TEST).o $(DLIBCRYPTO)
|
||||
- @target=$(RC4TEST); $(BUILD_CMD)
|
||||
+ +@target=$(RC4TEST); $(BUILD_CMD)
|
||||
|
||||
$(RC5TEST)$(EXE_EXT): $(RC5TEST).o $(DLIBCRYPTO)
|
||||
- @target=$(RC5TEST); $(BUILD_CMD)
|
||||
+ +@target=$(RC5TEST); $(BUILD_CMD)
|
||||
|
||||
$(DESTEST)$(EXE_EXT): $(DESTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(DESTEST); $(BUILD_CMD)
|
||||
+ +@target=$(DESTEST); $(BUILD_CMD)
|
||||
|
||||
$(RANDTEST)$(EXE_EXT): $(RANDTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(RANDTEST); $(BUILD_CMD)
|
||||
+ +@target=$(RANDTEST); $(BUILD_CMD)
|
||||
|
||||
$(DHTEST)$(EXE_EXT): $(DHTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(DHTEST); $(BUILD_CMD)
|
||||
+ +@target=$(DHTEST); $(BUILD_CMD)
|
||||
|
||||
$(DSATEST)$(EXE_EXT): $(DSATEST).o $(DLIBCRYPTO)
|
||||
- @target=$(DSATEST); $(BUILD_CMD)
|
||||
+ +@target=$(DSATEST); $(BUILD_CMD)
|
||||
|
||||
$(METHTEST)$(EXE_EXT): $(METHTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(METHTEST); $(BUILD_CMD)
|
||||
+ +@target=$(METHTEST); $(BUILD_CMD)
|
||||
|
||||
$(SSLTEST)$(EXE_EXT): $(SSLTEST).o $(DLIBSSL) $(DLIBCRYPTO)
|
||||
- @target=$(SSLTEST); $(FIPS_BUILD_CMD)
|
||||
+ +@target=$(SSLTEST); $(FIPS_BUILD_CMD)
|
||||
|
||||
$(ENGINETEST)$(EXE_EXT): $(ENGINETEST).o $(DLIBCRYPTO)
|
||||
- @target=$(ENGINETEST); $(BUILD_CMD)
|
||||
+ +@target=$(ENGINETEST); $(BUILD_CMD)
|
||||
|
||||
$(EVPTEST)$(EXE_EXT): $(EVPTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(EVPTEST); $(BUILD_CMD)
|
||||
+ +@target=$(EVPTEST); $(BUILD_CMD)
|
||||
|
||||
$(ECDSATEST)$(EXE_EXT): $(ECDSATEST).o $(DLIBCRYPTO)
|
||||
- @target=$(ECDSATEST); $(BUILD_CMD)
|
||||
+ +@target=$(ECDSATEST); $(BUILD_CMD)
|
||||
|
||||
$(ECDHTEST)$(EXE_EXT): $(ECDHTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(ECDHTEST); $(BUILD_CMD)
|
||||
+ +@target=$(ECDHTEST); $(BUILD_CMD)
|
||||
|
||||
$(IGETEST)$(EXE_EXT): $(IGETEST).o $(DLIBCRYPTO)
|
||||
- @target=$(IGETEST); $(BUILD_CMD)
|
||||
+ +@target=$(IGETEST); $(BUILD_CMD)
|
||||
|
||||
$(JPAKETEST)$(EXE_EXT): $(JPAKETEST).o $(DLIBCRYPTO)
|
||||
- @target=$(JPAKETEST); $(BUILD_CMD)
|
||||
+ +@target=$(JPAKETEST); $(BUILD_CMD)
|
||||
|
||||
$(ASN1TEST)$(EXE_EXT): $(ASN1TEST).o $(DLIBCRYPTO)
|
||||
- @target=$(ASN1TEST); $(BUILD_CMD)
|
||||
+ +@target=$(ASN1TEST); $(BUILD_CMD)
|
||||
|
||||
$(SRPTEST)$(EXE_EXT): $(SRPTEST).o $(DLIBCRYPTO)
|
||||
- @target=$(SRPTEST); $(BUILD_CMD)
|
||||
+ +@target=$(SRPTEST); $(BUILD_CMD)
|
||||
|
||||
#$(AESTEST).o: $(AESTEST).c
|
||||
# $(CC) -c $(CFLAGS) -DINTERMEDIATE_VALUE_KAT -DTRACE_KAT_MCT $(AESTEST).c
|
||||
@@ -480,7 +480,7 @@
|
||||
# fi
|
||||
|
||||
dummytest$(EXE_EXT): dummytest.o $(DLIBCRYPTO)
|
||||
- @target=dummytest; $(BUILD_CMD)
|
||||
+ +@target=dummytest; $(BUILD_CMD)
|
||||
|
||||
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||
|
||||
--- a/crypto/objects/Makefile
|
||||
+++ b/crypto/objects/Makefile
|
||||
@@ -44,11 +44,11 @@ obj_dat.h: obj_dat.pl obj_mac.h
|
||||
# objects.pl both reads and writes obj_mac.num
|
||||
obj_mac.h: objects.pl objects.txt obj_mac.num
|
||||
$(PERL) objects.pl objects.txt obj_mac.num obj_mac.h
|
||||
- @sleep 1; touch obj_mac.h; sleep 1
|
||||
|
||||
-obj_xref.h: objxref.pl obj_xref.txt obj_mac.num
|
||||
+# This doesn't really need obj_mac.h, but since that rule reads & writes
|
||||
+# obj_mac.num, we can't run in parallel with it.
|
||||
+obj_xref.h: objxref.pl obj_xref.txt obj_mac.num obj_mac.h
|
||||
$(PERL) objxref.pl obj_mac.num obj_xref.txt > obj_xref.h
|
||||
- @sleep 1; touch obj_xref.h; sleep 1
|
||||
|
||||
files:
|
||||
$(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO
|
||||
67
packages/base/any/kernels/3.18.25/patches/driver-support-intel-igb-bcm54616-phy.patch
vendored
Normal file
67
packages/base/any/kernels/3.18.25/patches/driver-support-intel-igb-bcm54616-phy.patch
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
diff --git a/drivers/net/ethernet/intel/igb/e1000_82575.c b/drivers/net/ethernet/intel/igb/e1000_82575.c
|
||||
index 051ea94..2a04baa 100644
|
||||
--- a/drivers/net/ethernet/intel/igb/e1000_82575.c
|
||||
+++ b/drivers/net/ethernet/intel/igb/e1000_82575.c
|
||||
@@ -286,6 +286,9 @@ static s32 igb_init_phy_params_82575(struct e1000_hw *hw)
|
||||
phy->ops.set_d3_lplu_state = igb_set_d3_lplu_state_82580;
|
||||
phy->ops.force_speed_duplex = igb_phy_force_speed_duplex_m88;
|
||||
break;
|
||||
+ case BCM54616_E_PHY_ID:
|
||||
+ phy->type = e1000_phy_bcm54616;
|
||||
+ break;
|
||||
default:
|
||||
ret_val = -E1000_ERR_PHY;
|
||||
goto out;
|
||||
@@ -1550,6 +1553,7 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw)
|
||||
case e1000_i350:
|
||||
case e1000_i210:
|
||||
case e1000_i211:
|
||||
+ case e1000_i354:
|
||||
phpm_reg = rd32(E1000_82580_PHY_POWER_MGMT);
|
||||
phpm_reg &= ~E1000_82580_PM_GO_LINKD;
|
||||
wr32(E1000_82580_PHY_POWER_MGMT, phpm_reg);
|
||||
@@ -1593,6 +1597,8 @@ static s32 igb_setup_copper_link_82575(struct e1000_hw *hw)
|
||||
case e1000_phy_82580:
|
||||
ret_val = igb_copper_link_setup_82580(hw);
|
||||
break;
|
||||
+ case e1000_phy_bcm54616:
|
||||
+ break;
|
||||
default:
|
||||
ret_val = -E1000_ERR_PHY;
|
||||
break;
|
||||
diff --git a/drivers/net/ethernet/intel/igb/e1000_defines.h b/drivers/net/ethernet/intel/igb/e1000_defines.h
|
||||
index 217f813..5322fbf 100644
|
||||
--- a/drivers/net/ethernet/intel/igb/e1000_defines.h
|
||||
+++ b/drivers/net/ethernet/intel/igb/e1000_defines.h
|
||||
@@ -860,6 +860,7 @@
|
||||
#define M88_VENDOR 0x0141
|
||||
#define I210_I_PHY_ID 0x01410C00
|
||||
#define M88E1543_E_PHY_ID 0x01410EA0
|
||||
+#define BCM54616_E_PHY_ID 0x3625D10
|
||||
|
||||
/* M88E1000 Specific Registers */
|
||||
#define M88E1000_PHY_SPEC_CTRL 0x10 /* PHY Specific Control Register */
|
||||
diff --git a/drivers/net/ethernet/intel/igb/e1000_hw.h b/drivers/net/ethernet/intel/igb/e1000_hw.h
|
||||
index 2003b37..d82c96b 100644
|
||||
--- a/drivers/net/ethernet/intel/igb/e1000_hw.h
|
||||
+++ b/drivers/net/ethernet/intel/igb/e1000_hw.h
|
||||
@@ -128,6 +128,7 @@ enum e1000_phy_type {
|
||||
e1000_phy_ife,
|
||||
e1000_phy_82580,
|
||||
e1000_phy_i210,
|
||||
+ e1000_phy_bcm54616,
|
||||
};
|
||||
|
||||
enum e1000_bus_type {
|
||||
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
|
||||
index e0f3664..013c1f1 100644
|
||||
--- a/drivers/net/ethernet/intel/igb/igb_main.c
|
||||
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
|
||||
@@ -108,6 +108,7 @@ static const struct pci_device_id igb_pci_tbl[] = {
|
||||
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_COPPER), board_82575 },
|
||||
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82575EB_FIBER_SERDES), board_82575 },
|
||||
{ PCI_VDEVICE(INTEL, E1000_DEV_ID_82575GB_QUAD_COPPER), board_82575 },
|
||||
+ { PCI_VDEVICE(INTEL, E1000_DEV_ID_I354_SGMII), board_82575 },
|
||||
/* required last entry */
|
||||
{0, }
|
||||
};
|
||||
@@ -1 +1,2 @@
|
||||
aufs.patch
|
||||
driver-support-intel-igb-bcm54616-phy.patch
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
name: onlp_snmp
|
||||
1
packages/base/any/onlp/src/onlp/.module
Normal file
1
packages/base/any/onlp/src/onlp/.module
Normal file
@@ -0,0 +1 @@
|
||||
name: onlp
|
||||
@@ -0,0 +1 @@
|
||||
name: onlp_platform_defaults
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user