Merge branch 'master' of github.com:opencomputeproject/OpenNetworkLinux

This commit is contained in:
Carl D. Roth
2016-04-14 12:59:43 -07:00
346 changed files with 899350 additions and 501 deletions

3
.gitignore vendored
View File

@@ -10,8 +10,7 @@ dependmodules.x
# Package cache and lock files
.lock
.PKGs.cache
.PKGs.cache.lock
.PKGs.cache*
# Local module manifest.
.manifest.mk

View File

@@ -1,4 +1,4 @@
############################################################
###########################################################
#
# Work in progress.
#
@@ -12,10 +12,10 @@ endif
include $(ONL)/make/config.mk
all: amd64 ppc
all: amd64 ppc arm
$(MAKE) -C REPO build-clean
onl-amd64 onl-x86 x86 x86_64 amd64:
onl-amd64 onl-x86 x86 x86_64 amd64: packages_base_all
$(MAKE) -C packages/base/amd64/kernels
$(MAKE) -C packages/base/amd64/initrds
$(MAKE) -C packages/base/amd64/onlp
@@ -25,7 +25,7 @@ onl-amd64 onl-x86 x86 x86_64 amd64:
$(MAKE) -C builds/amd64/swi
$(MAKE) -C builds/amd64/installer/legacy
onl-ppc ppc:
onl-ppc ppc: packages_base_all
$(MAKE) -C packages/base/powerpc/kernels
$(MAKE) -C packages/base/powerpc/initrds
$(MAKE) -C packages/base/powerpc/onlp
@@ -36,6 +36,33 @@ onl-ppc ppc:
$(MAKE) -C builds/powerpc/swi
$(MAKE) -C builds/powerpc/installer/legacy
ifdef ONL_DEBIAN_SUITE_jessie
arm_toolchain_check:
@which arm-linux-gnueabi-gcc || (/bin/echo -e "*\n* ERROR\n*\n* This container does not support building for the ARM architecture.\n* Please use opennetworklinux/onlbuilder8:1.2 later.\n*" && exit 1)
onl-arm arm: arm_toolchain_check packages_base_all
$(MAKE) -C packages/base/armel/kernels
$(MAKE) -C packages/base/armel/initrds
$(MAKE) -C packages/base/armel/onlp
$(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/legacy
else
onl-arm arm:
@/bin/echo -e "*\n* Warning\n*\n* ARM Architecture support is only available in Jessie builds. Please use onbuilder -8.\n*"
endif
packages_base_all:
$(MAKE) -C packages/base/all
rpc rebuild:
$(ONLPM) --rebuild-pkg-cache
@@ -58,3 +85,10 @@ docker: docker_check
# create an interative docker shell, for debugging builds
docker-debug: docker_check
@docker/tools/onlbuilder -$(VERSION) --isolate --hostname onlbuilder$(VERSION) --pull
versions:
$(ONL)/tools/make-versions.py --import-file=$(ONL)/tools/onlvi --class-name=OnlVersionImplementation --output-dir $(ONL)/make --force
relclean:
@find $(ONL)/RELEASE -name "ONL-*" -delete

View File

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

View File

@@ -1 +1,6 @@
*INSTALLER
kernel-*
initrd-*
lib/
usr/

View File

@@ -130,6 +130,9 @@ do_handle_disk()
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
@@ -143,8 +146,16 @@ do_handle_partitions()
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..."
;;
@@ -184,10 +195,15 @@ partition_gpt()
{
local start end part
installer_say "Creating 128MB for Open Network Linux boot"
start=$1; shift
############################################################
#
# ONL Boot Partition.
#
############################################################
installer_say "Creating 128MB for ONL Boot partition..."
end=$(( $start + 128 ))
echo "start=$start end=$end"
parted -s $DEV unit mb mkpart "ONL-BOOT" ext4 ${start} ${end} || return 1
if ! part=$(get_part_number $DEV "ONL-BOOT"); then
@@ -198,23 +214,59 @@ partition_gpt()
mkfs.ext4 -L "ONL-BOOT" ${DEV}${part}
start=$(( $end + 1 ))
installer_say "Creating /mnt/flash"
end=$(( $start + 128 ))
parted -s $DEV unit mb mkpart "FLASH" fat32 ${start} ${end} || return 1
if ! part=$(get_part_number $DEV "FLASH"); then
############################################################
#
# 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.vfat -n "FLASH" ${DEV}${part}
mkfs.ext4 -L "ONL-CONFIG" ${DEV}${part}
start=$(( $end + 1 ))
installer_say "Allocating remainder for /mnt/flash2"
parted -s $DEV unit mb mkpart "FLASH2" fat32 ${start} "100%" || return 1
if ! part=$(get_part_number $DEV "FLASH2"); then
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.vfat -n "FLASH2" ${DEV}${part}
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
}
@@ -231,8 +283,8 @@ installer_standard_gpt_install()
mkdir "$workdir/mnt"
if [ -f "${installer_dir}/boot-config" ]; then
installer_say "Installing boot-config"
mount LABEL="FLASH" "$workdir/mnt"
installer_say "Installing boot-config..."
mount LABEL="ONL-BOOT" "$workdir/mnt"
cp "${installer_dir}/boot-config" "$workdir/mnt/boot-config"
umount "$workdir/mnt"
fi
@@ -244,7 +296,7 @@ installer_standard_gpt_install()
SWIDST="$(basename ${SWISRC})"
fi
installer_say "Installing Open Network Linux Software Image (${SWIDST})..."
mount LABEL="FLASH2" "$workdir/mnt"
mount LABEL="ONL-IMAGES" "$workdir/mnt"
cp "${SWISRC}" "$workdir/mnt/${SWIDST}"
umount "$workdir/mnt"
fi

View File

@@ -1,4 +1,4 @@
NETDEV=ma1
NETAUTO=dhcp
BOOTMODE=SWI
SWI=flash2::latest
SWI=images::latest

View File

@@ -0,0 +1,43 @@
ifndef ARCH
$(error $$ARCH not set)
endif
THISDIR := $(dir $(lastword $(MAKEFILE_LIST)))
# Hardcoded to match ONL File naming conventions.
include $(ONL)/make/version-onl.mk
INSTALLER_NAME=$(FNAME_PRODUCT_VERSION)_ONL-OS_$(FNAME_BUILD_ID)_$(UARCH)_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/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
$(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

View File

@@ -1,4 +1,4 @@
NETDEV=ma1
NETAUTO=dhcp
BOOTMODE=SWI
SWI=flash2::latest
SWI=images::latest

View File

@@ -1,3 +1,4 @@
# -*- sh -*-
######################################################################
#
# lib.sh
@@ -122,11 +123,12 @@ 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}" "${installer_df}"
"${mkfs}" ${options} "${installer_df}"
installer_say "Format ${partition} complete."
rm "${installer_df}"
}
@@ -158,26 +160,60 @@ installer_umount_blockdev() {
# installer_blockdev_format <blockdev> <p1size> <p2size> <p3size>
#
# <blockdev> The block device name.
# <p1size> The size of the first partition.
# <p2size> The size of the second partition.
# <p3size> [Optional] The size of the third partition.
# If p3size is unset, the remainder of the device will be used
# for the third partition.
# <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
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}."
echo -e "o\nn\np\n1\n\n+${partition1size}\nn\np\n2\n\n+${partition2size}\nn\np\n3\n\n${partition3size}\np\nw\n" | fdisk /dev/${blockdev}
installer_partition_format ${blockdev} 1 mkdosfs
installer_partition_format ${blockdev} 2 mkdosfs
installer_partition_format ${blockdev} 3 mkdosfs
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}
installer_partition_format ${blockdev} 1 mkfs.ext2 "-L ONL-BOOT"
installer_partition_format ${blockdev} 2 mkfs.ext2 "-L ONL-CONFIG"
installer_partition_format ${blockdev} 3 mkfs.ext2 "-L ONL-IMAGES"
installer_partition_format ${blockdev} 4 mkfs.ext2 "-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
}
############################################################
@@ -311,15 +347,16 @@ installer_standard_blockdev_install () {
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}"
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}" 2
installer_platform_bootconfig "${blockdev}" 1
# Copy the packaged SWI to the third partition.
installer_platform_swi "${blockdev}" 3

View File

@@ -1,6 +1,19 @@
#!/bin/sh
IARCH="ppc"
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
@@ -69,7 +82,7 @@ fi
installer_say "Detected platform: ${installer_platform}"
. "${installer_dir}/ppc-install-lib"
. "${installer_dir}/fit-install-lib"
# Look for the platform installer directory.
installer_platform_dir="${installer_dir}/lib/platform-config/${installer_platform}"
@@ -97,7 +110,7 @@ fw_setenv_f_s "${envf}"
installer_say "Install finished. Rebooting to Open Network Linux."
sleep 3
reboot
exit
exit 0
# Do not add any additional whitespace after this point.
PAYLOAD_FOLLOWS

View File

@@ -7,6 +7,7 @@
- parted
- smartmontools
- grub2
- onl-upgrade

View File

@@ -0,0 +1,2 @@
- u-boot-tools
- onl-loader-fit

View File

@@ -0,0 +1,67 @@
# The default runlevel.
id:2:initdefault:
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si0::sysinit:/etc/boot.d/boot
si1::sysinit:/etc/init.d/rcS
# What to do in single-user mode.
~~:S:wait:/sbin/sulogin
# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
# Action on special keypress (ALT-UpArrow).
#kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."
# What to do when the power fails/returns.
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
# <id>:<runlevels>:<action>:<process>
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
# Example how to put a getty on a serial line (for a terminal)
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
# Example how to put a getty on a modem line.
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3

View File

@@ -0,0 +1,19 @@
mounts:
ONL-IMAGES:
mount: r
dir: /mnt/onl/images
fsck: true
ONL-DATA:
mount: w
dir: /mnt/onl/data
ONL-CONFIG:
mount: r
dir: /mnt/onl/config
fsck: true
ONL-BOOT:
mount: false
dir: /mnt/onl/boot
fsck: false

View File

@@ -4,6 +4,7 @@
#
############################################################
- u-boot-tools
- onl-loader-fit

View File

@@ -55,8 +55,6 @@ Configure:
- ${ONL}/builds/any/rootfs/${ONL_DEBIAN_SUITE}/common/overlay
update-rc.d:
- 'initdev defaults'
- 'onl-platform-baseconf defaults'
- 'faultd defaults'
- 'onlpd defaults'
- 'snmpd remove'

View File

@@ -7,6 +7,8 @@
- parted
- smartmontools
- grub2
- onl-upgrade

View File

@@ -0,0 +1,67 @@
# The default runlevel.
id:2:initdefault:
# Boot-time system configuration/initialization script.
# This is run first except when booting in emergency (-b) mode.
si0::sysinit:/etc/boot.d/boot
si1::sysinit:/etc/init.d/rcS
# What to do in single-user mode.
~~:S:wait:/sbin/sulogin
# /etc/init.d executes the S and K scripts upon change
# of runlevel.
#
# Runlevel 0 is halt.
# Runlevel 1 is single-user.
# Runlevels 2-5 are multi-user.
# Runlevel 6 is reboot.
l0:0:wait:/etc/init.d/rc 0
l1:1:wait:/etc/init.d/rc 1
l2:2:wait:/etc/init.d/rc 2
l3:3:wait:/etc/init.d/rc 3
l4:4:wait:/etc/init.d/rc 4
l5:5:wait:/etc/init.d/rc 5
l6:6:wait:/etc/init.d/rc 6
# Normally not reached, but fallthrough in case of emergency.
z6:6:respawn:/sbin/sulogin
# What to do when CTRL-ALT-DEL is pressed.
ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -r now
# Action on special keypress (ALT-UpArrow).
#kb::kbrequest:/bin/echo "Keyboard Request--edit /etc/inittab to let this work."
# What to do when the power fails/returns.
pf::powerwait:/etc/init.d/powerfail start
pn::powerfailnow:/etc/init.d/powerfail now
po::powerokwait:/etc/init.d/powerfail stop
# /sbin/getty invocations for the runlevels.
#
# The "id" field MUST be the same as the last
# characters of the device (after "tty").
#
# Format:
# <id>:<runlevels>:<action>:<process>
#
# Note that on most Debian systems tty7 is used by the X Window System,
# so if you want to add more getty's go ahead but skip tty7 if you run X.
#
1:2345:respawn:/sbin/getty 38400 tty1
2:23:respawn:/sbin/getty 38400 tty2
3:23:respawn:/sbin/getty 38400 tty3
4:23:respawn:/sbin/getty 38400 tty4
5:23:respawn:/sbin/getty 38400 tty5
6:23:respawn:/sbin/getty 38400 tty6
# Example how to put a getty on a serial line (for a terminal)
#
#T0:23:respawn:/sbin/getty -L ttyS0 9600 vt100
#T1:23:respawn:/sbin/getty -L ttyS1 9600 vt100
# Example how to put a getty on a modem line.
#
#T3:23:respawn:/sbin/mgetty -x0 -s 57600 ttyS3

View File

@@ -0,0 +1,19 @@
mounts:
ONL-IMAGES:
mount: r
dir: /mnt/onl/images
fsck: true
ONL-DATA:
mount: w
dir: /mnt/onl/data
ONL-CONFIG:
mount: r
dir: /mnt/onl/config
fsck: true
ONL-BOOT:
mount: false
dir: /mnt/onl/boot
fsck: false

View File

@@ -4,7 +4,7 @@
#
############################################################
- u-boot-tools
- onl-loader-fit

View File

@@ -55,8 +55,6 @@ Configure:
- ${ONL}/builds/any/rootfs/${ONL_DEBIAN_SUITE}/common/overlay
update-rc.d:
- 'initdev defaults'
- 'onl-platform-baseconf defaults'
- 'faultd defaults'
- 'onlpd defaults'
- 'snmpd remove'

1
builds/armel/Makefile Normal file
View File

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

View File

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

View File

@@ -0,0 +1 @@
!include $ONL/builds/any/installer/legacy/APKG.yml ARCH=armel

View File

@@ -0,0 +1,3 @@
*INSTALLER
fit-install*
boot-config

View File

@@ -0,0 +1,2 @@
include $(ONL)/make/config.armel.mk
include $(ONL)/builds/any/installer/legacy/fit/builds/Makefile

View File

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

View File

@@ -0,0 +1 @@
!include $ONL/builds/any/rootfs/APKG.yml ARCH=armel

2
builds/armel/rootfs/builds/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*.d/
manifest.json

View File

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

View File

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

1
builds/armel/swi/PKG.yml Normal file
View File

@@ -0,0 +1 @@
!include $ONL/builds/any/swi/APKG.yml ARCH=armel

1
builds/armel/swi/builds/.gitignore vendored Normal file
View File

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

View File

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

View File

@@ -1 +1,3 @@
*INSTALLER
fit-install*
boot-config

View File

@@ -1,37 +1,2 @@
include $(ONL)/make/config.powerpc.mk
# Hardcoded to match ONL File naming conventions.
include $(ONL)/make/version-onl.mk
INSTALLER_NAME=$(FNAME_PRODUCT_VERSION)_ONL-OS_$(FNAME_BUILD_ID)_$(UARCH)_INSTALLER
FIT_IMAGE_ALL := $(shell $(ONLPM) --find-file onl-loader-fit:powerpc onl-loader-fit.itb)
# Fixme -- should come from the FIT manifest, not the initrd manifest
PLATFORMS := $(shell $(ONLPM) --platform-manifest onl-loader-initrd:powerpc)
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):powerpc .;)
# Fixme
ifndef NO_SWI
$(ONLPM) --extract-dir onl-swi:powerpc .
mv ./usr/share/onl/packages/powerpc/onl-swi/*.swi .
endif
rm -rf ./usr
$(ONL_V_at)cp /dev/null $(MKSHAR_PERMS)
$(ONL_V_at) cp $(ONL)/make/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 ppc-installer.sh ppc-install-lib *.itb lib *.swi version-onl.sh boot-config
$(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
include $(ONL)/builds/any/installer/legacy/fit/builds/Makefile

View File

@@ -0,0 +1,16 @@
FROM opennetworklinux/builder8:1.1
MAINTAINER Jeffrey Townsend <jeffrey.townsend@bigswitch.com>
RUN dpkg --add-architecture armel
RUN apt-get update && apt-get install -y \
crossbuild-essential-armel \
gcc-arm-linux-gnueabi
RUN xapt -a armel libedit-dev ncurses-dev libsensors4-dev libwrap0-dev libssl-dev libsnmp-dev
#
# Docker shell and other container tools.
#
COPY docker_shell /bin/docker_shell
COPY container-id /bin/container-id

View File

@@ -0,0 +1,19 @@
VERSION=1.2
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)

View File

@@ -18,7 +18,7 @@ g_current_uid = os.getuid()
g_timestamp = datetime.datetime.now().strftime("%Y-%m-%d.%H%M%S")
g_builder7_image_name="opennetworklinux/builder7:1.1"
g_builder8_image_name="opennetworklinux/builder8:1.1"
g_builder8_image_name="opennetworklinux/builder8:1.2"
g_default_image_name=g_builder7_image_name
g_default_container_name = "%s_%s" % (g_current_user, g_timestamp)

9
make/config.armel.mk Normal file
View File

@@ -0,0 +1,9 @@
############################################################
#
# Open Network Linux
#
############################################################
include $(ONL)/make/config.mk
export TOOLCHAIN := arm-linux-gnueabi
export ARCH := armel
export UARCH := ARMEL

View File

@@ -22,6 +22,7 @@ endif
ifndef ONL_DEBIAN_SUITE
$(error "The $$ONL_DEBIAN_SUITE value is not set. Please source $$ONL/setup.env")
endif
export ONL_DEBIAN_SUITE_$(ONL_DEBIAN_SUITE)=1
export BUILD_DIR_BASE=BUILD/$(ONL_DEBIAN_SUITE)

View File

@@ -144,9 +144,13 @@ build: setup
+$(K_MAKE) $(K_BUILD_TARGET)
ifdef K_COPY_SRC
ifdef K_COPY_DST
ifdef K_COPY_GZIP
gzip -c $(K_SOURCE_DIR)/$(K_COPY_SRC) > $(K_TARGET_DIR)/$(K_COPY_DST)
else
cp $(K_SOURCE_DIR)/$(K_COPY_SRC) $(K_TARGET_DIR)/$(K_COPY_DST)
endif
endif
endif
MODSYNCLIST := .config Module.symvers Makefile include scripts arch/x86/include arch/x86/Makefile arch/powerpc/include arch/powerpc/Makefile arch/powerpc/lib

View File

@@ -14,7 +14,7 @@ include $(ONL)/make/config.mk
# directory tree.
#
ifndef ARCHES
ARCHES := amd64 powerpc all
ARCHES := amd64 powerpc armel all
endif
ONLPM_ENVIRONMENT = \

View File

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

View File

@@ -0,0 +1,16 @@
common:
arch: all
version: 1.0.0
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
packages:
- name: onl-bootd
version: 1.0.0
summary: Open Network Linux Boot Stage
files:
- src : /etc/boot.d
changelog: Change changes changes.,

View File

@@ -1,14 +1,5 @@
#!/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"
@@ -21,6 +12,8 @@ if [ -d /sys/class/ubi ]; then
fi
( cd /sys/class/net; for d in *; do /sbin/initnetdev $d add; done )
initmounts
log_action_end_msg 0
log_action_begin_msg "Mounting filesystems"
initmounts -q
log_action_end_msg 0

View File

@@ -0,0 +1,23 @@
#!/bin/sh
############################################################
#
# Initial boot setup. Required before running
# any concurrent service initialization in rcS
#
# This is designed to support early setup, platform,
# and upgrade operations.
#
############################################################
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
for script in `ls /etc/boot.d/[0-9]* | sort`; do
$script
done
#
# Wait for console to flush prior to starting rc.S
#
sleep 1

View File

@@ -26,8 +26,6 @@ packages:
summary: Open Network Linux System Loader Common Initscripts
files:
src/bin/initblockdev : /sbin/
src/bin/initmounts : /sbin/
src/bin/initnetdev : /sbin/
changelog: Change changes changes.,

View File

@@ -23,9 +23,9 @@ field "$ONL_PLATFORM" " Platform: $ONL_PLATFORM"
field "MA1_ADDR" " ma1: $MA1_ADDR"
echo "*"
echo "************************************************************"
if [ -f /mnt/flash/boot-config ]; then
if [ -f /etc/onl/boot-config ]; then
msg_info "boot-config"
cat /mnt/flash/boot-config
cat /etc/onl/boot-config
else
if [ -f /bin/boot-config.py ]; then

View File

@@ -49,7 +49,7 @@ Usage: $0 [-h|--help] [-t|--testonly] [--rootfs ROOTFS] --cache LOCATION [SWI]
format of the SWI argument:
DEV:PATH
/mnt/DEV/PATH
/mnt/onl/DEV/PATH
Loads a SWI file from local storage device DEV (e.g. flash).
http://[USER:PASSWORD@]SERVER[:PORT]/PATH
ftp://[USER:PASSWORD@]SERVER[:PORT]/PATH
@@ -111,18 +111,18 @@ case "${SWI}" in
fi
;;
*)
# Parse dev:file or dev:/file or /mnt/dev/file
parselocal='s#\(\([^:/]*\):/\?\|/mnt/\([^/]*\)/\)\?\(.*\)#dev="\2\3" file="\4"#p'
# Parse dev:file or dev:/file or /mnt/onl/dev/file
parselocal='s#\(\([^:/]*\):/\?\|/mnt/onl/\([^/]*\)/\)\?\(.*\)#dev="\2\3" file="\4"#p'
eval $(echo "${SWI}" | sed -n "${parselocal}")
if [ "${dev}" ] ; then
# Wait for /mnt/dev to show up
waitforblockdev "/mnt/${dev}"
:
else
# Assume file is relative, parse absolutified file
eval $(realpath "${file}" | sed -n "${parselocal}")
SWI="${dev}:${file}"
fi
swipath="/mnt/${dev}/${file}"
swipath="/mnt/onl/${dev}/${file}"
[ -f "${swipath}" ] || { echo "${SWI} not found or not a file"; exit 1; }
;;
esac

View File

@@ -53,7 +53,6 @@ while read -r l; do
esac
done
# Populate platform-specific settings
. /lib/platform-detect
@@ -62,46 +61,23 @@ if [ ! -f /etc/onl/abort ]; then
# Tell kernel to invoke mdev when devices are added or removed
echo /sbin/mdev >/proc/sys/kernel/hotplug
# Initialize any block and net devices already present
( cd /sys/class/block; for d in *; do initblockdev $d add; done )
if [ -d /sys/class/ubi ]; then
( cd /sys/class/ubi; for d in *; do initblockdev $d add; done )
fi
# Initialize net devices
( cd /sys/class/net; for d in *; do initnetdev $d add; done )
# Initialize platform mounts
initmounts
# Perform recovery if necessary; reboot automatically
if /bin/recover; then
initmounts
else
restoreconsole
echo "Recovery failed."
echo "Press CR now to exit sysinit and access the loader shell."
echo "Otherwise, the system will reboot in 3s."
if read -t 3 prompt; then
trap - EXIT
exit
fi
reboot -f
fi
initmounts -q
if [ -f /etc/issue ]; then
cat /etc/issue
fi
waitforblockdev /mnt/flash
sleep 1 # wait for external block devices to be mounted
[ ! -f /mnt/flash/boot-config ] || cat /mnt/flash/boot-config >>/etc/onl/boot-config
[ ! -f /mnt/onl/boot/boot-config ] || cat /mnt/onl/boot/boot-config >>/etc/onl/boot-config
#
# Initialize the /mnt/flash/boot area.
#
mkdir -p /mnt/flash/boot
rm -rf /mnt/flash/boot/*
#mkdir -p /mnt/data/boot
#rm -rf /mnt/flash/boot/*
fi

View File

@@ -14,11 +14,11 @@ if [ ! "${SWI}" ]; then
exit 200
fi
if [ "${SWI}" = "flash2::latest" ]; then
# Boot the latest (by mtime) SWI in the flash2 partition.
SWI=`ls /mnt/flash2/*.swi -t | head -n1`
if [ "${SWI}" = "images::latest" ]; then
# Boot the latest (by mtime) SWI in the images partition.
SWI=`ls /mnt/onl/images/*.swi -t | head -n1`
if [ -z "${SWI}" ]; then
msg_error "No SWI available in /mnt/flash2. SWI booting cannot continue."
msg_error "No SWI available in /mnt/onl/images. SWI booting cannot continue."
exit 200
fi
fi

View File

@@ -0,0 +1,19 @@
mounts:
ONL-IMAGES:
mount: w
dir: /mnt/onl/images
fsck: true
ONL-DATA:
mount: w
dir: /mnt/onl/data
ONL-CONFIG:
mount: r
dir: /mnt/onl/config
fsck: true
ONL-BOOT:
mount: r
dir: /mnt/onl/boot
fsck: false

View File

@@ -13,21 +13,16 @@
/etc/passwd f 644 0 0 - - - - -
/bin/autoboot f 755 0 0 - - - - -
/bin/boot f 755 0 0 - - - - -
/bin/discoverbootconf f 755 0 0 - - - - -
/bin/help f 755 0 0 - - - - -
/bin/ifget f 755 0 0 - - - - -
/bin/ifup f 755 0 0 - - - - -
/bin/initblockdev f 755 0 0 - - - - -
/bin/initnetdev f 755 0 0 - - - - -
/bin/login f 755 0 0 - - - - -
/bin/netconf f 755 0 0 - - - - -
/bin/recover f 755 0 0 - - - - -
/bin/swiinfo f 755 0 0 - - - - -
/bin/switchroot f 755 0 0 - - - - -
/bin/sysinit f 755 0 0 - - - - -
/bin/udhcpc f 755 0 0 - - - - -
/bin/waitforblockdev f 755 0 0 - - - - -
/bin/wipe f 755 0 0 - - - - -
/bin/zcip f 755 0 0 - - - - -
/lib/udhcpc-script f 755 0 0 - - - - -
/lib/zcip-script f 755 0 0 - - - - -

View File

@@ -41,20 +41,25 @@ else
rm -f /tmp/rootfs
uarch=`uname -m`
ARCH_LIST=
case $uarch in
ppc)
ARCH_LIST="ppc powerpc"
;;
x86_64)
ARCH_LIST="x86_64 amd64"
;;
armv7l)
ARCH_LIST="armel"
;;
*)
;;
esac
if [ "$uarch" == "ppc" ]; then
# Try both rootfs-ppc and rootfs-powerpc
for arch in ppc powerpc; do
unzip -pq "${swipath}" "rootfs-$arch.sqsh" >/tmp/rootfs
[ ! -s /tmp/rootfs ] || break
done
elif [ "$uarch" == "x86_64" ]; then
# Try both rootfs-amd64 and rootfs-x86_64
for arch in x86_64 amd64; do
unzip -pq "${swipath}" "rootfs-$arch.sqsh" >/tmp/rootfs
[ ! -s /tmp/rootfs ] || break
done
fi
for arch in $ARCH_LIST; do
unzip -pq "${swipath}" "rootfs-$arch.sqsh" >/tmp/rootfs
[ ! -s /tmp/rootfs ] || break
done
if [ ! -s /tmp/rootfs ]; then
echo "${swipath} does not contain a rootfs image for the current architecture ($uarch). Booting cannot continue."

View File

@@ -1,6 +1,6 @@
packages:
- name: onl-vendor-config-onl
depends: python-yaml
depends: [ python-yaml, onl-bootd ]
version: 1.0.0
arch: all
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
@@ -9,7 +9,21 @@ packages:
files:
src/python/onl : $PY_INSTALL/onl
src/init.d : /etc/init.d
src/boot.d : /etc/boot.d
src/bin : /usr/bin
changelog: Changes
- name: onl-vendor-config-onl-loader
version: 1.0.0
arch: all
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
summary: ONL Base Configuration Package (Loader)
files:
src/python/onl : /usr/lib/python2.7/onl
src/bin/initmounts : /bin/initmounts
changelog: Changes

View File

@@ -0,0 +1,3 @@
#!/usr/bin/python
from onl.mounts import OnlMountManager
OnlMountManager.main()

View File

@@ -0,0 +1,55 @@
#!/usr/bin/python -u
from onl.upgrade import ubase
class ONIE_Upgrade(ubase.BaseOnieUpgrade):
name="onie"
Name="ONIE"
title="ONIE Upgrade Check"
atype="An ONIE"
current_version_key="Current ONIE Version"
next_version_key="Next ONIE Version"
def init_versions(self):
# Get the current platform ONIE version
self.current_version = self.platform.onie_version()
self.next_version = None
self.updater = None
(udir, um, data) = self.platform.upgrade_manifest("onie")
self.udir = udir
self.data = data
if data:
self.next_version = data.get('onie-version', None)
if data:
self.updater = data.get('onie-updater', None)
if self.updater is None:
self.finish("No ONIE updater available for the current platform.")
def summarize(self):
self.logger.info("Current ONIE Version: %s" % self.current_version)
self.logger.info(" Next ONIE Version: %s" % self.next_version)
self.logger.info(" Force-Update: %s" % self.data['force-update'])
self.logger.info(" Updater: %s" % self.updater)
self.logger.info("")
def upgrade_notes(self):
return """
* The system will reboot into ONIE to complete the update, and then reboot to return to Switch Light
"""
def do_upgrade(self, forced=False):
self.install_onie_updater(self.udir, self.updater)
self.initiate_onie_update()
def do_no_upgrade(self):
self.clean_onie_updater()
if __name__ == '__main__':
ONIE_Upgrade().main()

View File

@@ -0,0 +1,151 @@
#!/usr/bin/python
############################################################
#
# ONL Loader Upgrade
#
############################################################
import os
import sys
import fnmatch
from onl.upgrade import ubase
class Loader_Upgrade(ubase.BaseUpgrade):
name="loader"
Name="Loader"
title="Loader Upgrade Check"
atype="A Loader"
current_version_key="Current Loader Version"
next_version_key="Next Loader Version"
def 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"
# Upgrade Loader Version file.
NEXT_LOADER_VERSIONS_JSON = "/etc/onl/upgrade/%s/manifest.json" % self.parch
self.current_version = self.load_json(ETC_LOADER_VERSIONS_JSON,
"RELEASE_ID",
None)
self.next_version = self.load_json(NEXT_LOADER_VERSIONS_JSON,
"version", {}).get('RELEASE_ID', None)
def summarize(self):
self.logger.info("Current Loader Version: %s" % self.current_version)
self.logger.info(" Next Loader Version: %s" % self.next_version)
self.logger.info("")
def upgrade_notes(self):
return """
* A single reboot will be required to complete this upgrade.
"""
class Loader_Upgrade_FIT(Loader_Upgrade):
def do_upgrade(self, forced=False):
FIT_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
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:
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)
self.reboot()
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-*" ]
#
# Mount the ONL-BOOT partition
#
mdir="/mnt/onl-boot"
self.mount(mdir, label="ONL-BOOT")
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))
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
arch = platform.machine()
klass = None
if arch in [ 'ppc', 'armv7l' ]:
klass = Loader_Upgrade_FIT
elif arch == 'x86_64':
klass = Loader_Upgrade_x86_64
else:
sys.stderr.write("Loader Upgrade: The current architecture (%s) is not supported for upgrade.\n" % arch)
if klass:
klass().main()

View File

@@ -0,0 +1,153 @@
#!/usr/bin/python
import os
import sys
import platform
import subprocess
import logging
import time
import json
import yaml
class OnlMountManager(object):
def __init__(self, mdata, logger):
if os.path.exists(mdata):
mdata = yaml.load(open(mdata, "r"));
self.mdata = mdata
self.logger = logger
# Needed to avoid ugly warnings from fsck
if not os.path.exists('/etc/mtab'):
open("/etc/mtab", 'w').close();
def checkmount(self, directory):
with open("/proc/mounts") as f:
return directory in f.read()
def mount(self, device, directory, mode='r', timeout=5):
self.logger.debug("Mounting %s -> %s %s" % (device, directory, mode))
try:
subprocess.check_call("mount -%s %s %s" % (mode, device, directory), shell=True)
except subrocess.CalledProcessError, e:
self.logger("Mount failed: '%s'" % e.output)
return False
# If requested, wait for the mount to complete.
while(timeout > 0):
if self.checkmount(directory):
break
time.sleep(1)
timeout-=1
if self.checkmount(directory):
self.logger.info("%s is now mounted @ %s" % (device, directory))
return True
else:
self.logger.info("%s failed to report in /proc/mounts." % (directory))
def mountall(self, all_=False, fsck=None, timeout=5):
for (k, v) in self.mdata['mounts'].iteritems():
#
# Make the mount point for future use.
#
if not os.path.isdir(v['dir']):
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']))
#
# If its currently mounted we should unmount first.
#
if 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: " % (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
if 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 all_:
v['mount'] = 'w'
mount = v.get('mount', None)
if mount:
if mount in ['r', 'w']:
self.mount(v['device'], v['dir'], mode=mount, timeout=v.get('timeout', 5))
else:
self.logger("Mount %s has an invalid mount mode (%s)" % (k, mount))
@staticmethod
def main():
import argparse
logging.basicConfig()
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("--quiet", "-q", action='store_true')
ops = ap.parse_args();
logger = logging.getLogger("initmounts")
if ops.verbose:
logger.setLevel(logging.DEBUG)
elif ops.quiet:
logger.setLevel(logging.ERROR)
else:
logger.setLevel(logging.INFO)
mm = OnlMountManager(ops.mtab, logger)
if ops.rw:
mm.mountall(all_=True, fsck=False)
else:
mm.mountall()

View File

@@ -105,6 +105,16 @@ class OnlPlatformBase(object):
self.add_info_json("platform_info", "%s/platform-info.json" % self.basedir_onl(),
required=False)
# Load the platform config yaml file
y = os.path.join(self.basedir_onl(), "%s.yml" % self.platform())
if os.path.exists(y):
self.platform_config = yaml.load(open(y))
if self.platform() in self.platform_config:
self.platform_config = self.platform_config[self.platform()]
else:
self.platform_config = {}
def add_info_dict(self, name, d, klass=None):
setattr(self, name, OnlInfoObject(d, klass))
@@ -191,6 +201,20 @@ class OnlPlatformBase(object):
self.sys_oid_vendor() +
self.sys_oid_platform());
def onie_version(self):
return self.onie_info.ONIE_VERSION
def upgrade_manifest(self, type_, override_dir=None):
if override_dir:
m = os.path.join(override_dir, "manifest.json")
else:
m = os.path.join(self.basedir_onl(), "upgrade", type_, "manifest.json")
if os.path.exists(m):
return (os.path.dirname(m), m, json.load(file(m)))
else:
return (None, None, None)
def new_device(self, driver, addr, bus, devdir):
if not os.path.exists(os.path.join(bus, devdir)):

View File

@@ -31,7 +31,9 @@ def baseconfig():
HOST_TYPES = [ 'powerpc-linux-gnu',
'i486-linux-gnu',
'i386-linux-gnu',
'x86_64-linux-gnu' ]
'x86_64-linux-gnu',
'arm-linux-gnueabi',
]
for ht in HOST_TYPES:
if os.path.exists('/lib/%s' % ht):
@@ -68,6 +70,3 @@ def baseconfig():
msg("Setting up base platform configuration for %s: done\n" %
platform.platform())

View File

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

View File

@@ -0,0 +1,427 @@
############################################################
#
# Upgrade Base Classes
#
############################################################
import logging
import logging.handlers
import platform as pp
import subprocess
import os
import sys
import shutil
import json
import string
import argparse
from time import sleep
from onl.platform.current import OnlPlatform
class BaseUpgrade(object):
# Customized by deriving class
name = None
Name = None
atype = None
current_version_key = None
next_version_key = None
def __init__(self):
if not (self.name and self.Name and self.atype and self.title and
self.current_version_key and self.next_version_key):
raise Exception("Name descriptors must be provided by deriving class.")
self.init_logger()
self.init_argparser()
self.load_config()
self.arch = pp.machine()
self.parch = dict(ppc='powerpc', x86_64='amd64', armv7l='armel')[self.arch]
self.platform = OnlPlatform()
#
# 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
def init_logger(self):
fmt = '%(asctime)s.%(msecs)d %(levelname)s %(name)s: %(message)s'
datefmt="%Y-%m-%d %H:%M:%S"
formatter = logging.Formatter(fmt, datefmt)
logging.basicConfig(format=fmt, datefmt=datefmt)
self.logger = logging.getLogger(string.rjust("%s-upgrade" % self.name, 16))
self.logger.setLevel(logging.INFO)
if os.getenv("DEBUG"):
self.logger.setLevel(logging.DEBUG)
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("--summarize", action='store_true', help="Summarize only, no upgrades.")
def banner(self):
self.logger.info("************************************************************")
self.logger.info("* %s" % self.title)
self.logger.info("************************************************************")
self.logger.info("")
def finish(self, message=None, rc=0):
if message:
self.logger.info("")
if rc == 0:
self.logger.info(message)
else:
self.logger.error(message)
self.logger.info("")
self.logger.info("************************************************************")
self.update_upgrade_status(self.current_version_key, self.current_version)
self.update_upgrade_status(self.next_version_key, self.next_version)
# Flush stdout
sleep(.1)
sys.exit(rc)
def abort(self, message=None, rc=1):
if message:
message = "Error: %s" % message
self.finish(message, rc)
def fw_getenv(self, var):
FW_PRINTENV="/usr/bin/fw_printenv"
if os.path.exists(FW_PRINTENV):
try:
if var:
return subprocess.check_output("%s -n %s" % FW_PRINTENV, stderr=subprocess.STDOUT);
else:
variables = {}
for v in subprocess.check_output("/usr/bin/fw_printenv", shell=True).split('\n'):
(name, eq, value) = v.partition('=')
variables[name] = value
return variables
except Exception, e:
return None
else:
return None
def fw_setenv(self, var, value):
FW_SETENV="/usr/bin/fw_setenv"
if os.system("%s %s %s" % (FW_SETENV, var, value)) != 0:
self.abort("Error setting environment variable %s=%s. Upgrade cannot continue." % (var, value))
def copyfile(self, src, dst):
self.logger.info("Installing %s -> %s..." % (src, dst))
if not os.path.exists(src):
self.abort("Source file '%s' does not exist." % src)
try:
shutil.copyfile(src, dst)
except Exception, e:
self.abort("Exception while copying: %s" % e)
def reboot(self):
if self.ops.no_reboot:
self.finish("[ No Reboot ]")
elif self.ops.check:
self.finish("[ Check Abort ]")
else:
self.logger.info("The system will reboot to complete the update.")
sleep(1)
os.system("sync")
sleep(1)
while True:
os.system("reboot -f")
sleep(30)
self.abort("The system did not reboot as expected.")
def load_json(self, fname, key=None, default=None):
if os.path.exists(fname):
with open(fname) as f:
data = json.load(f)
if key:
return data.get(key, default)
else:
return data
else:
return default
UPGRADE_STATUS_JSON = "/lib/platform-config/current/upgrade.json"
def update_upgrade_status(self, key, value):
data = {}
if os.path.exists(self.UPGRADE_STATUS_JSON):
with open(self.UPGRADE_STATUS_JSON) as f:
data = json.load(f)
data[key] = value
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()
#
def init_versions(self):
raise Exception("init_versions() must be provided by the deriving class.")
#
# Perform actual upgrade. Provided by derived class.
#
def do_upgrade(self, forced=False):
raise Exception("do_upgrade() must be provided by the deriving class.")
#
# Perform any clean up necessary if the system is current (no upgrade required.)
#
def do_no_upgrade(self):
pass
def init_upgrade(self):
self.current_version = None
self.next_version = None
self.init_versions()
self.update_upgrade_status(self.current_version_key, self.current_version)
self.update_upgrade_status(self.next_version_key, self.next_version)
def summarize(self):
pass
def __upgrade_prompt(self, instructions, default="yes"):
valid = {"yes": True, "y": True, "ye": True,
"no": False, "n": False}
if default is None:
prompt = " [y/n] "
elif default == "yes":
prompt = " [Y/n] "
elif default == "no":
prompt = " [y/N] "
else:
raise ValueError("invalid default answer: '%s'" % default)
notes = self.upgrade_notes()
if notes:
instructions = instructions + "\n" + notes + "\n"
instructions = "\n\n" + instructions + "\n\nStart the upgrade? "
while True:
sys.stdout.write(instructions + prompt)
choice = raw_input().lower()
if default is not None and choice == '':
return valid[default]
elif choice in valid:
return valid[choice]
else:
sys.stdout.write("Please respond with 'yes' or 'no' "
"(or 'y' or 'n').\n")
def upgrade_prompt(self, instructions, default='yes'):
try:
return self.__upgrade_prompt(instructions, default)
except Exception, e:
self.logger.error("")
self.logger.error("Exception: %s" % e)
self.abort("No upgrade will be performed.")
return False
except KeyboardInterrupt:
return False
def upgrade_notes(self):
raise Exception("Must be provided by derived class.")
def __upgrade_advisory(self):
if not self.ops.enable:
self.finish("%s updates are not enabled." % self.Name)
self.__do_upgrade()
self.finish()
def __upgrade_force(self):
self.logger.info("This system is configured for automatic %s updates." % self.Name)
self.__do_upgrade()
self.finish()
def __do_upgrade(self):
if self.ops.check:
self.finish("[ Check abort. ]")
self.do_upgrade()
def __upgrade_optional(self):
instructions = """%s upgrade should be performed before continuing for optimal
performance on this system.
While it is recommended that you perform this upgrade it is optional and you
may continue booting for testing purposes at this time.
Please note that you will be asked again each time at boot to perform
this upgrade. Automatic booting will not be possible until the upgrade
is performed.""" % self.atype
if self.upgrade_prompt(instructions) == True:
self.__do_upgrade()
self.finish()
else:
self.finish("Upgrade cancelled.")
def __upgrade_required(self):
instructions = """%s upgrade must be performed before the software can run on this system.
If you choose not to perform this upgrade booting cannot continue.""" % self.atype
if self.upgrade_prompt(instructions) == True:
self.__do_upgrade()
self.finish()
else:
self.logger.info("The system cannot continue without performing %s update. The system will now reboot if you would like to take alternative actions." % self.atype)
self.reboot()
def __upgrade(self):
self.logger.info("%s upgrade is required." % self.atype)
auto_upgrade = self.ops.auto_upgrade
#
# auto-upgrade modes are:
# advisory : Advisory only. This is the default.
# force : Perform the upgrade automatically.
# optional : Ask the user whether an upgrade should be performed.
# required : Ask the user whether an upgrade should be performed.
# Reboot if the answer is 'no'.
#
if auto_upgrade == 'advisory':
self.__upgrade_advisory()
elif auto_upgrade == 'force':
self.__upgrade_force();
elif auto_upgrade == 'optional':
self.__upgrade_optional()
elif auto_upgrade == 'required':
self.__upgrade_required()
else:
self.abort("auto-upgrade mode '%s' is not supported." % auto_upgrade)
def upgrade_check(self):
if self.current_version == self.next_version:
# Versions match. Only continue if forced.
if self.ops.force:
self.logger.info("%s version %s is current." % (self.Name,
self.current_version))
self.logger.info("[ Upgrade Forced. ]")
else:
self.logger.info("%s version %s is current." % (self.Name,
self.current_version))
self.do_no_upgrade()
self.finish()
if self.next_version:
self.__upgrade()
def mount(self, location, partition=None, label=None):
if not os.path.isdir(location):
os.makedirs(location)
if partition:
cmd = "mount %s %s " % (partition,location)
name = partition
if label:
cmd = "mount LABEL=%s %s" % (label, location)
name = label
if os.system(cmd) != 0:
self.abort("Could not mount %s @ %s. Upgrade cannot continue." % (name, location))
def umount(self, location):
if os.system("umount %s" % location) != 0:
self.abort("Could not unmount %s. Upgrade cannot continue." % location)
def main(self):
self.ops = self.ap.parse_args()
self.banner()
self.init_upgrade()
self.summarize()
if not self.ops.summarize:
self.upgrade_check()
class BaseOnieUpgrade(BaseUpgrade):
ONIE_UPDATER_PATH = "/mnt/flash2/onie-updater"
def install_onie_updater(self, src_dir, updater):
if type(updater) is list:
# Copy all files in the list to /mnt/flash2
for f in updater:
src = os.path.join(src_dir, f)
dst = os.path.join("/mnt/flash2", f)
self.copyfile(src, dst)
else:
# Copy single updater to /mnt/flash2/onie-updater
src = os.path.join(src_dir, updater)
self.copyfile(src, self.ONIE_UPDATER_PATH)
def initiate_onie_update(self):
self.logger.info("Initiating %s Update." % self.Name)
if self.arch == 'ppc':
# Initiate update
self.fw_setenv('onie_boot_reason', 'update')
self.reboot()
elif self.arch == 'x86_64':
OB = "/mnt/onie-boot"
self.mount(OB, label="ONIE-BOOT")
if os.system("/mnt/onie-boot/onie/tools/bin/onie-boot-mode -o update") != 0:
self.abort("Could not set ONIE Boot Mode to Update. Upgrade cannot continue.")
self.umount(OB)
SL = "/mnt/sl-boot"
self.mount(SL, label="SL-BOOT")
with open("/mnt/sl-boot/grub/grub.cfg", "a") as f:
f.write("set default=ONIE\n")
self.umount(SL)
self.reboot()
else:
self.abort("Architecture %s unhandled." % self.arch)
def clean_onie_updater(self):
if os.path.exists(self.ONIE_UPDATER_PATH):
self.logger.info("Removing previous onie-updater.")
os.remove(self.ONIE_UPDATER_PATH)

View File

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

View File

@@ -0,0 +1,22 @@
prerequisites:
packages:
- onl-kernel-3.9.6-x86-64-all:amd64
- onl-kernel-3.2-deb7-x86-64-all:amd64
- onl-kernel-3.18-x86-64-all:amd64
- onl-loader-initrd:amd64
common:
arch: amd64
version: 1.0.0
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
packages:
- name: onl-upgrade
version: 1.0.0
summary: Open Network Linux Upgrade package for AMD64 platforms.
files:
builds/files : /etc/onl/upgrade/amd64
changelog: Change changes changes.,

View File

@@ -0,0 +1 @@
files

View File

@@ -0,0 +1,18 @@
include $(ONL)/make/config.amd64.mk
# All amd64 kernels
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) \
# Loader initrd
INITRD := $(shell $(ONLPM) --find-file onl-loader-initrd:amd64 onl-loader-initrd-amd64.cpio.gz)
MANIFEST := $(shell $(ONLPM) --find-file onl-loader-initrd:amd64 manifest.json)
all:
mkdir -p files
cp $(KERNELS) files
cp $(INITRD) files/initrd-amd64
cp $(MANIFEST) files

View File

@@ -1,22 +1,22 @@
/**************************************************************************//**
*
* <bsn.cl fy=2013 v=onl>
*
* Copyright 2013, 2014 BigSwitch Networks, Inc.
*
*
* Copyright 2013, 2014 BigSwitch Networks, Inc.
*
* Licensed under the Eclipse Public License, Version 1.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*
*
* </bsn.cl>
*
*****************************************************************************/
@@ -150,7 +150,7 @@ faultd_main(int argc, char* argv[])
aim_daemon_config_t config;
memset(&config, 0, sizeof(config));
aim_daemon_restart_config_init(&rconfig, 1, 1);
aim_daemon_restart_config_init(&rconfig, 1, 1, argv);
AIM_BITMAP_CLR(&rconfig.signal_restarts, SIGTERM);
AIM_BITMAP_CLR(&rconfig.signal_restarts, SIGKILL);
rconfig.maximum_restarts=0;

View File

@@ -0,0 +1,19 @@
prerequisites:
packages:
- onl-buildroot-initrd:$ARCH
common:
arch: $ARCH
version: 1.0.0
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
packages:
- name: onl-buildroot-fit
version: 1.0.0
summary: Open Network Linux FIT Buildroot Image for $ARCH
files:
builds/onl-buildroot-fit.itb : $$PKG_INSTALL/
changelog: Change changes changes.,

View File

@@ -0,0 +1,13 @@
ifndef ARCH
$(error $$ARCH not set)
endif
.PHONY: onl-buildroot-fit.itb onl-buildroot-fit.its
onl-buildroot-fit.itb:
$(ONL)/tools/flat-image-tree.py --initrd onl-buildroot-initrd:$(ARCH),onl-buildroot-initrd-$(ARCH).cpio.gz --arch $(ARCH) --add-platform all --itb $@
onl-buildroot-fit.its:
$(ONL)/tools/flat-image-tree.py --initrd onl-buildroot-initrd:$(ARCH),onl-buildroot-initrd-$(ARCH).cpio.gz --arch $(ARCH) --add-platform all --its $@
its: onl-buildroot-fit.its

View File

@@ -0,0 +1,20 @@
prerequisites:
packages:
- onl-loader-initrd:$ARCH
common:
arch: $ARCH
version: 1.0.0
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com
packages:
- name: onl-loader-fit
version: 1.0.0
summary: Open Network Linux FIT Loader Image for $ARCH
files:
builds/onl-loader-fit.itb : /etc/onl/upgrade/$ARCH/
builds/manifest.json : /etc/onl/upgrade/$ARCH/
changelog: Change changes changes.,

View File

@@ -0,0 +1,14 @@
ifndef ARCH
$(error $$ARCH must be set)
endif
.PHONY: onl-loader-fit.itb onl-loader-fit.its
onl-loader-fit.itb:
$(ONL)/tools/flat-image-tree.py --initrd onl-loader-initrd:$(ARCH),onl-loader-initrd-$(ARCH).cpio.gz --arch $(ARCH) --add-platform initrd --itb $@
$(ONLPM) --copy-file onl-loader-initrd:$(ARCH) manifest.json .
onl-loader-fit.its:
$(ONL)/tools/flat-image-tree.py --initrd onl-loader-initrd:$(ARCH),onl-loader-initrd-$(ARCH).cpio.gz --arch $(ARCH) --add-platform initrd --its $@
its: onl-loader-fit.its

View File

@@ -39,6 +39,7 @@ buildroot-initrd-$(ARCH).cpio.gz: $(ONL_BUILDROOT)/.setup.done
chmod +x makedevs
$(ONL_BUILDROOT)/.setup.done:
mkdir -p $(ONL_BUILDROOT)/buildroot-mirror/dl
$(MAKE) -C $(ONL_BUILDROOT) setup
touch $(ONL_BUILDROOT)/.setup.done

View File

@@ -1,3 +1,4 @@
.setup.done
buildroot-powerpc
buildroot-x86_64
buildroot-arm

View File

@@ -16,7 +16,7 @@ include $(ONL)/make/config.mk
#
# We build for these architectures
#
ARCHS := powerpc x86_64
ARCHS := powerpc x86_64 arm
BUILDROOT_ARCHDIRS := $(foreach a,$(ARCHS),buildroot-$(a))
BUILDROOT_SOURCE := buildroot-mirror

File diff suppressed because it is too large Load Diff

View File

@@ -551,7 +551,7 @@ CONFIG_FEATURE_DMESG_PRETTY=y
# CONFIG_FEATURE_GPT_LABEL is not set
# CONFIG_FEATURE_FDISK_ADVANCED is not set
# CONFIG_FINDFS is not set
# CONFIG_FLOCK is not set
CONFIG_FLOCK=y
CONFIG_FREERAMDISK=y
# CONFIG_FSCK_MINIX is not set
# CONFIG_MKFS_EXT2 is not set

View File

@@ -22,6 +22,7 @@ $(TARGET):
$(ONLPM) --copy-file onl-buildroot-initrd:$(ARCH) onl-buildroot-initrd-$(ARCH).cpio.gz .
sudo rm -rf $(ROOT) && mkdir $(ROOT)
$(ONLPM) --sudo --force --extract-dir onl-loader-initrd-files:all $(ROOT)
$(ONLPM) --sudo --force --extract-dir onl-vendor-config-onl-loader:all $(ROOT)
$(ONLPM) --sudo $(foreach p,$(PLATFORM_PACKAGES),--extract-dir $(p) $(ROOT))
$(ONLPM) --sudo --force --extract-dir onl-vendor-config-onl:all $(ROOT)
$(ONL)/tools/sjson.py --kj version $(ONL)/make/version-onl.json --kl platforms $(PLATFORMS) --kv arch $(ARCH) --out manifest.json

View File

@@ -1048,12 +1048,12 @@ CONFIG_EEPROM_AT25=y
# CONFIG_EEPROM_LEGACY is not set
# CONFIG_EEPROM_MAX6875 is not set
CONFIG_EEPROM_ACCTON_AS5712_54x_SFP=y
CONFIG_EEPROM_ACCTON_AS5812_54x_SFP=y
CONFIG_EEPROM_ACCTON_AS5812_54t_SFP=y
CONFIG_EEPROM_ACCTON_AS6712_32x_SFP=y
CONFIG_EEPROM_ACCTON_AS6812_32x_SFP=y
CONFIG_EEPROM_ACCTON_AS7512_32x_SFP=y
CONFIG_EEPROM_ACCTON_AS7712_32x_SFP=y
CONFIG_EEPROM_ACCTON_AS5812_54x_SFP=y
CONFIG_EEPROM_ACCTON_AS6812_32x_SFP=y
CONFIG_EEPROM_ACCTON_AS5812_54t_SFP=y
CONFIG_EEPROM_93CX6=y
# CONFIG_EEPROM_93XX46 is not set
CONFIG_EEPROM_SFF_8436=y
@@ -1617,8 +1617,8 @@ CONFIG_I2C_MUX=y
# Multiplexer I2C Chip support
#
CONFIG_I2C_MUX_ACCTON_AS5712_54x_CPLD=y
CONFIG_I2C_MUX_ACCTON_AS5812_54x_CPLD=y
CONFIG_I2C_MUX_ACCTON_AS6712_32x_CPLD=y
CONFIG_I2C_MUX_ACCTON_AS5812_54x_CPLD=y
CONFIG_I2C_MUX_ACCTON_AS6812_32x_CPLD=y
CONFIG_I2C_MUX_GPIO=y
CONFIG_I2C_MUX_PCA9541=y
@@ -1913,20 +1913,20 @@ CONFIG_SENSORS_W83781D=y
CONFIG_SENSORS_CPR_4011_4MXX=y
CONFIG_SENSORS_ACCTON_AS5712_54x_FAN=y
CONFIG_SENSORS_ACCTON_AS5712_54x_PSU=y
CONFIG_SENSORS_ACCTON_AS5812_54x_FAN=y
CONFIG_SENSORS_ACCTON_AS5812_54x_PSU=y
CONFIG_SENSORS_ACCTON_AS5812_54t_FAN=y
CONFIG_SENSORS_ACCTON_AS5812_54t_PSU=y
CONFIG_SENSORS_ACCTON_AS6712_32x_FAN=y
CONFIG_SENSORS_ACCTON_AS6712_32x_PSU=y
CONFIG_SENSORS_ACCTON_AS6812_32x_FAN=y
CONFIG_SENSORS_ACCTON_AS6812_32x_PSU=y
CONFIG_SENSORS_ACCTON_I2C_CPLD=y
CONFIG_SENSORS_ACCTON_AS7512_32x_FAN=y
CONFIG_SENSORS_ACCTON_AS7512_32x_PSU=y
CONFIG_SENSORS_YM2651Y=y
CONFIG_SENSORS_ACCTON_AS7712_32x_FAN=y
CONFIG_SENSORS_ACCTON_AS7712_32x_PSU=y
CONFIG_SENSORS_YM2651Y=y
CONFIG_SENSORS_ACCTON_AS5812_54x_FAN=y
CONFIG_SENSORS_ACCTON_AS5812_54x_PSU=y
CONFIG_SENSORS_ACCTON_AS6812_32x_FAN=y
CONFIG_SENSORS_ACCTON_AS6812_32x_PSU=y
CONFIG_SENSORS_ACCTON_AS5812_54t_FAN=y
CONFIG_SENSORS_ACCTON_AS5812_54t_PSU=y
#
# ACPI drivers
@@ -1935,7 +1935,59 @@ CONFIG_SENSORS_YM2651Y=y
# CONFIG_SENSORS_ATK0110 is not set
CONFIG_THERMAL=y
CONFIG_THERMAL_HWMON=y
# CONFIG_WATCHDOG is not set
CONFIG_WATCHDOG=y
CONFIG_WATCHDOG_CORE=y
# CONFIG_WATCHDOG_NOWAYOUT is not set
#
# Watchdog Device Drivers
#
# CONFIG_SOFT_WATCHDOG is not set
# CONFIG_ACQUIRE_WDT is not set
# CONFIG_ADVANTECH_WDT is not set
# CONFIG_ALIM1535_WDT is not set
# CONFIG_ALIM7101_WDT is not set
# CONFIG_F71808E_WDT is not set
# CONFIG_SP5100_TCO is not set
# CONFIG_SC520_WDT is not set
# CONFIG_SBC_FITPC2_WATCHDOG is not set
# CONFIG_EUROTECH_WDT is not set
# CONFIG_IB700_WDT is not set
# CONFIG_IBMASR is not set
# CONFIG_WAFER_WDT is not set
# CONFIG_I6300ESB_WDT is not set
CONFIG_ITCO_WDT=y
# CONFIG_ITCO_VENDOR_SUPPORT is not set
# CONFIG_IT8712F_WDT is not set
# CONFIG_IT87_WDT is not set
# CONFIG_HP_WATCHDOG is not set
# CONFIG_SC1200_WDT is not set
# CONFIG_PC87413_WDT is not set
# CONFIG_NV_TCO is not set
# CONFIG_60XX_WDT is not set
# CONFIG_SBC8360_WDT is not set
# CONFIG_CPU5_WDT is not set
# CONFIG_SMSC_SCH311X_WDT is not set
# CONFIG_SMSC37B787_WDT is not set
# CONFIG_W83627HF_WDT is not set
# CONFIG_W83697HF_WDT is not set
# CONFIG_W83697UG_WDT is not set
# CONFIG_W83877F_WDT is not set
# CONFIG_W83977F_WDT is not set
# CONFIG_MACHZ_WDT is not set
# CONFIG_SBC_EPX_C3_WATCHDOG is not set
# CONFIG_XEN_WDT is not set
#
# PCI-based Watchdog Cards
#
# CONFIG_PCIPCWATCHDOG is not set
# CONFIG_WDTPCI is not set
#
# USB-based Watchdog Cards
#
# CONFIG_USBPCWATCHDOG is not set
CONFIG_SSB_POSSIBLE=y
#
@@ -1999,6 +2051,7 @@ CONFIG_MFD_CORE=y
# CONFIG_EZX_PCAP is not set
# CONFIG_MFD_CS5535 is not set
# CONFIG_MFD_TIMBERDALE is not set
CONFIG_LPC_ICH=y
CONFIG_LPC_SCH=y
# CONFIG_MFD_RDC321X is not set
# CONFIG_MFD_JANZ_CMODIO is not set
@@ -2247,19 +2300,18 @@ CONFIG_LEDS_CLASS=y
# LED drivers
#
CONFIG_LEDS_ACCTON_AS5712_54x=y
CONFIG_LEDS_ACCTON_AS5812_54x=y
CONFIG_LEDS_ACCTON_AS5812_54t=y
CONFIG_LEDS_ACCTON_AS6712_32x=y
CONFIG_LEDS_ACCTON_AS6812_32x=y
CONFIG_LEDS_ACCTON_AS7512_32x=y
CONFIG_LEDS_ACCTON_AS7712_32x=y
CONFIG_LEDS_ACCTON_AS5812_54x=y
CONFIG_LEDS_ACCTON_AS6812_32x=y
CONFIG_LEDS_ACCTON_AS5812_54t=y
# CONFIG_LEDS_LM3530 is not set
# CONFIG_LEDS_PCA9532 is not set
# CONFIG_LEDS_GPIO is not set
# CONFIG_LEDS_LP3944 is not set
# CONFIG_LEDS_LP5521 is not set
# CONFIG_LEDS_LP5523 is not set
# CONFIG_LEDS_CLEVO_MAIL is not set
# CONFIG_LEDS_PCA955X is not set
# CONFIG_LEDS_DAC124S085 is not set
# CONFIG_LEDS_BD2802 is not set
@@ -2395,7 +2447,6 @@ CONFIG_X86_PLATFORM_DEVICES=y
# CONFIG_INTEL_IPS is not set
# CONFIG_IBM_RTL is not set
# CONFIG_XO15_EBOOK is not set
# CONFIG_SAMSUNG_Q10 is not set
CONFIG_X86_64_DELL_S6000_S1220_R0=y
#

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -42,14 +42,6 @@ index ea97f4a..818dd01 100644
obj-$(CONFIG_SENSORS_AD7314) += ad7314.o
obj-$(CONFIG_SENSORS_AD7414) += ad7414.o
obj-$(CONFIG_SENSORS_AD7418) += ad7418.o
@@ -141,7 +143,6 @@ obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o
obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o
obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o
obj-$(CONFIG_SENSORS_QUANTA_LY_HWMON) += quanta-ly-hwmon.o
-obj-$(CONFIG_SENSORS_YM2651Y) += ym2651y.o
obj-$(CONFIG_PMBUS) += pmbus/
diff --git a/drivers/hwmon/accton_as5812_54x_fan.c b/drivers/hwmon/accton_as5812_54x_fan.c
new file mode 100644
index 0000000..3e25db1

View File

@@ -244,3 +244,5 @@ platform-accton-as7712_32x-device-drivers.patch
platform-accton-as5812_54x-device-drivers.patch
platform-accton-as6812_32x-device-drivers.patch
platform-accton-as5812_54t-device-drivers.patch
driver-mfd-lpc-ich.patch
driver-watchdog-itco-wd.patch

View File

@@ -0,0 +1,2 @@
linux-3.2.71*
kernel-3.2*

View File

@@ -0,0 +1,41 @@
############################################################
# <bsn.cl fy=2015 v=onl>
#
# Copyright 2015 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
THIS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
include $(ONL)/make/config.mk
ifndef K_TARGET_DIR
K_TARGET_DIR := $(THIS_DIR)
endif
include ../../kconfig.mk
K_CONFIG := arm-iproc-all.config
K_BUILD_TARGET := Image
K_COPY_SRC := arch/arm/boot/Image
K_COPY_GZIP := 1
ifndef K_COPY_DST
K_COPY_DST := kernel-3.2-deb7-arm-iproc-all.bin.gz
endif
export ARCH=arm
DTS_LIST := accton_as4610_54
include $(ONL)/make/kbuild.mk

View File

@@ -0,0 +1,27 @@
############################################################
# <bsn.cl fy=2015 v=onl>
#
# Copyright 2015 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
THIS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
K_MAJOR_VERSION := 3
K_PATCH_LEVEL := 2
K_SUB_LEVEL := 71
K_SUFFIX :=
K_PATCH_DIR := $(THIS_DIR)/patches

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,4 @@
#!/bin/bash
set -e
rm "${1}/drivers/staging/ft1000/ft1000-pcmcia/ft1000.img"
rm "${1}/drivers/staging/ft1000/ft1000-usb/ft3000.img"

View File

@@ -0,0 +1,2 @@
prepare.sh
kernel-3.2.71.patch

View File

@@ -74,13 +74,16 @@ cdefs: &cdefs
default: 1
- ONLP_CONFIG_API_LOCK_GLOBAL_SHARED:
doc: "If 0, the API lock is a simple semaphore. If 1, the API lock is a global shared mutex."
default: 0
default: 1
- ONLP_CONFIG_API_LOCK_TIMEOUT:
doc: "The maximum amount of time (in usecs) to wait while attempting to acquire the API lock. Failure to acquire is fatal. A value of zero disables this feature. "
default: 60000000
- ONLP_CONFIG_INFO_STR_MAX:
doc: "The maximum size of static information string buffers."
default: 64
- ONLP_CONFIG_INCLUDE_THERMAL_THRESHOLDS:
doc: "Include thermal threshold reporting."
default: 1
# Error codes
onlp_status: &onlp_status

View File

@@ -211,7 +211,7 @@
#ifndef ONLP_CONFIG_API_LOCK_GLOBAL_SHARED
#define ONLP_CONFIG_API_LOCK_GLOBAL_SHARED 0
#define ONLP_CONFIG_API_LOCK_GLOBAL_SHARED 1
#endif
/**
@@ -234,6 +234,16 @@
#define ONLP_CONFIG_INFO_STR_MAX 64
#endif
/**
* ONLP_CONFIG_INCLUDE_THERMAL_THRESHOLDS
*
* Include thermal threshold reporting. */
#ifndef ONLP_CONFIG_INCLUDE_THERMAL_THRESHOLDS
#define ONLP_CONFIG_INCLUDE_THERMAL_THRESHOLDS 1
#endif
/**

View File

@@ -71,6 +71,34 @@ int onlp_sfpi_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst);
*/
int onlp_sfpi_eeprom_read(int port, uint8_t data[256]);
/**
* @brief Read a byte from an address on the given SFP port's bus.
* @param port The port number.
* @param devaddr The device address.
* @param addr The address.
*/
int onlp_sfpi_dev_readb(int port, uint8_t devaddr, uint8_t addr);
/**
* @brief Write a byte to an address on the given SFP port's bus.
*/
int onlp_sfpi_dev_writeb(int port, uint8_t devaddr, uint8_t addr, uint8_t value);
/**
* @brief Read a byte from an address on the given SFP port's bus.
* @param port The port number.
* @param devaddr The device address.
* @param addr The address.
* @returns The word if successful, error otherwise.
*/
int onlp_sfpi_dev_readw(int port, uint8_t devaddr, uint8_t addr);
/**
* @brief Write a byte to an address on the given SFP port's bus.
*/
int onlp_sfpi_dev_writew(int port, uint8_t devaddr, uint8_t addr, uint16_t value);
/**
* @brief Read the SFP DOM EEPROM.
* @param port The port number.

View File

@@ -154,4 +154,9 @@ int onlp_sysi_platform_info_get(onlp_platform_info_t* info);
*/
void onlp_sysi_platform_info_free(onlp_platform_info_t* info);
/**
* @brief Builtin platform debug tool.
*/
int onlp_sysi_debug(aim_pvs_t* pvs, int argc, char** argv);
#endif /* __ONLP_SYSI_H__ */

View File

@@ -143,6 +143,36 @@ int onlp_sfp_denit(void);
*/
int onlp_sfp_rx_los_bitmap_get(onlp_sfp_bitmap_t* dst);
/**
* @brief Read a byte from an address on the given SFP port's bus.
* @param port The port number.
* @param devaddr The device address.
* @param addr The address.
*/
int onlp_sfp_dev_readb(int port, uint8_t devaddr, uint8_t addr);
/**
* @brief Write a byte to an address on the given SFP port's bus.
*/
int onlp_sfp_dev_writeb(int port, uint8_t devaddr, uint8_t addr, uint8_t value);
/**
* @brief Read a byte from an address on the given SFP port's bus.
* @param port The port number.
* @param devaddr The device address.
* @param addr The address.
*/
int onlp_sfp_dev_readw(int port, uint8_t devaddr, uint8_t addr);
/**
* @brief Write a byte to an address on the given SFP port's bus.
*/
int onlp_sfp_dev_writew(int port, uint8_t devaddr, uint8_t addr, uint16_t value);
/**
* @brief Dump the status of all SFPs
* @param pvs The output pvs.

View File

@@ -117,4 +117,6 @@ int onlp_sys_platform_manage_join(void);
void onlp_sys_platform_manage_now(void);
int onlp_sys_debug(aim_pvs_t* pvs, int argc, char** argv);
#endif /* __ONLP_SYS_H_ */

View File

@@ -244,14 +244,29 @@ onlp_fan_show(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags)
int rv;
iof_t iof;
onlp_fan_info_t fi;
int yaml;
onlp_oid_show_iof_init_default(&iof, pvs, flags);
rv = onlp_fan_info_get(oid, &fi);
iof_push(&iof, "Fan %d", ONLP_OID_ID_GET(oid));
yaml = flags & ONLP_OID_SHOW_F_YAML;
if(yaml) {
iof_push(&iof, "- ");
iof_iprintf(&iof, "Name: Fan %d", ONLP_OID_ID_GET(oid));
}
else {
iof_push(&iof, "Fan %d", ONLP_OID_ID_GET(oid));
}
if(rv < 0) {
onlp_oid_info_get_error(&iof, rv);
if(yaml) {
iof_iprintf(&iof, "State: Error");
iof_iprintf(&iof, "Error: %{onlp_status}", rv);
} else {
onlp_oid_info_get_error(&iof, rv);
}
}
else {
onlp_oid_show_description(&iof, &fi.hdr);
@@ -259,10 +274,10 @@ onlp_fan_show(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags)
/* Present */
iof_iprintf(&iof, "State: Present");
if(fi.status & ONLP_FAN_STATUS_FAILED) {
iof_iprintf(&iof, "Status: FAILED");
iof_iprintf(&iof, "Status: Failed");
}
else {
iof_iprintf(&iof, "Status: Running.");
iof_iprintf(&iof, "Status: Running");
if(fi.model[0]) {
iof_iprintf(&iof, "Model: %s", fi.model);
}
@@ -270,16 +285,16 @@ onlp_fan_show(onlp_oid_t oid, aim_pvs_t* pvs, uint32_t flags)
iof_iprintf(&iof, "SN: %s", fi.serial);
}
if(fi.caps & ONLP_FAN_CAPS_GET_RPM) {
iof_iprintf(&iof, "RPM: %d.", fi.rpm);
iof_iprintf(&iof, "RPM: %d", fi.rpm);
}
if(fi.caps & ONLP_FAN_CAPS_GET_PERCENTAGE) {
iof_iprintf(&iof, "Speed: %d%%.", fi.percentage);
iof_iprintf(&iof, "Speed: %d%%", fi.percentage);
}
if(fi.status & ONLP_FAN_STATUS_B2F) {
iof_iprintf(&iof, "Airflow: Back-to-Front.");
iof_iprintf(&iof, "Airflow: Back-to-Front");
}
if(fi.status & ONLP_FAN_STATUS_F2B) {
iof_iprintf(&iof, "Airflow: Front-to-Back.");
iof_iprintf(&iof, "Airflow: Front-to-Back");
}
}
}

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