[device/arista]: Update (#2336)

* Update arista drivers submodule

* Ignore the possible timestamp warning in tar extraction

* Add verbosity toggle to boot0

Console logging is slow because of the 9600 baud rate.
Some time can be saved by decreasing the console verbosity.

* Add hook mechanism in boot0.

Support additional features in boot0 via hooks.
Hooks are unpacked and executed at post-install or pre-exec time.

* Fix 7170 sensors.conf file

Fix critical temperature settings for MAX6658 sensors

* Fix the random swap of storage devices

For arista 7050 switches running with linux 4.9, it is likely the device
name of flash drive (/dev/sda) and usb (/dev/sdb) randomly swap in kernel
booting, depending on which one is ready first. It breaks the expectation
that flash will be mounted as root by setting root=/dev/sda1. This patch
will correct ROOT to flash device refering to the path under block_flash.

* Fix 7170 fancontrol

* Do not remove aquota.user file in boot0

This file is a filesystem protected file used by EOS.
It can be simply removed and will make the SONiC installation failed if
not skipped.
This commit is contained in:
Samuel Angebault 2018-12-04 10:08:55 -08:00 committed by lguohan
parent aedfd6e708
commit 989b60059b
6 changed files with 149 additions and 63 deletions

View File

@ -1,10 +1,10 @@
INTERVAL=5 INTERVAL=5
DEVPATH=hwmon1=devices/pci0000:00/0000:00:1c.0/0000:06:00.0/i2c-8/8-004c hwmon3=devices/pci0000:ff/0000:ff:0b.3/i2c-93/93-0060 DEVPATH=hwmon2=devices/pci0000:00/0000:00:1c.0/0000:06:00.0/i2c-8/8-004c hwmon4=devices/pci0000:ff/0000:ff:0b.3/i2c-93/93-0060
DEVNAME=hwmon1=max6658 hwmon3=rook_cpld DEVNAME=hwmon2=max6658 hwmon4=rook_cpld
FCTEMPS=hwmon3/pwm4=hwmon1/temp1_input hwmon3/pwm3=hwmon1/temp1_input hwmon3/pwm2=hwmon1/temp1_input hwmon3/pwm1=hwmon1/temp1_input FCTEMPS=hwmon4/pwm4=hwmon2/temp1_input hwmon4/pwm3=hwmon2/temp1_input hwmon4/pwm2=hwmon2/temp1_input hwmon4/pwm1=hwmon2/temp1_input
FCFANS=hwmon3/pwm4=hwmon3/fan4_input hwmon3/pwm3=hwmon3/fan3_input hwmon3/pwm2=hwmon3/fan2_input hwmon3/pwm1=hwmon3/fan1_input FCFANS=hwmon4/pwm4=hwmon4/fan4_input hwmon4/pwm3=hwmon4/fan3_input hwmon4/pwm2=hwmon4/fan2_input hwmon4/pwm1=hwmon4/fan1_input
MINTEMP=hwmon3/pwm4=50 hwmon3/pwm3=50 hwmon3/pwm2=50 hwmon3/pwm1=50 MINTEMP=hwmon4/pwm4=50 hwmon4/pwm3=50 hwmon4/pwm2=50 hwmon4/pwm1=50
MINPWM=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 MINPWM=hwmon4/pwm4=128 hwmon4/pwm3=128 hwmon4/pwm2=128 hwmon4/pwm1=128
MAXTEMP=hwmon3/pwm4=60 hwmon3/pwm3=60 hwmon3/pwm2=60 hwmon3/pwm1=60 MAXTEMP=hwmon4/pwm4=60 hwmon4/pwm3=60 hwmon4/pwm2=60 hwmon4/pwm1=60
MINSTART=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 MINSTART=hwmon4/pwm4=128 hwmon4/pwm3=128 hwmon4/pwm2=128 hwmon4/pwm1=128
MINSTOP=hwmon3/pwm4=128 hwmon3/pwm3=128 hwmon3/pwm2=128 hwmon3/pwm1=128 MINSTOP=hwmon4/pwm4=128 hwmon4/pwm3=128 hwmon4/pwm2=128 hwmon4/pwm1=128

View File

@ -13,7 +13,11 @@ chip "max6658-i2c-8-4c"
set temp1_max 100 set temp1_max 100
set temp1_crit 110 set temp1_crit 110
set temp1_min -55
set temp2_max 100
set temp2_crit 110
set temp2_min -55
ignore temp2 ignore temp2
chip "dps1900-i2c-6-58" chip "dps1900-i2c-6-58"
@ -42,10 +46,12 @@ chip "max6658-i2c-81-4c"
label temp1 "Rear air temp1" label temp1 "Rear air temp1"
label temp2 "Rear air temp2" label temp2 "Rear air temp2"
set temp1_max 50 set temp1_max 70
set temp1_crit 60 set temp1_crit 80
set temp2_max 50 set temp1_min -55
set temp2_crit 60 set temp2_max 70
set temp2_crit 80
set temp2_min -55
chip "lm73-i2c-96-48" chip "lm73-i2c-96-48"
label temp1 "Front air temp" label temp1 "Front air temp"

View File

@ -32,6 +32,7 @@
# - KERNEL : relative path to the kernel to execute # - KERNEL : relative path to the kernel to execute
# - INITRD : relative path to the initrd to load # - INITRD : relative path to the initrd to load
# - CMDLINE : place to find the default kernel cmdline to use for the platform # - CMDLINE : place to find the default kernel cmdline to use for the platform
# - VERBOSE : setting it to 1 will enable debug traces
# #
# By default the boot0 script will behave for an Aboot based behavior. # By default the boot0 script will behave for an Aboot based behavior.
# Options can be provided to only run some features of this script. # Options can be provided to only run some features of this script.
@ -39,24 +40,29 @@
# Extra kernel parameters can be provided at runtime by the user by adding them # Extra kernel parameters can be provided at runtime by the user by adding them
# into a kernel-params file. # into a kernel-params file.
set -x
image_name="image-%%IMAGE_VERSION%%" image_name="image-%%IMAGE_VERSION%%"
dockerfs="{{ FILESYSTEM_DOCKERFS }}"
do_not_clean="do-not-clean" do_not_clean="do-not-clean"
kernel_params="kernel-params" kernel_params="kernel-params"
aboot_machine="arista_unknown" aboot_machine="arista_unknown"
info() { printf "%04.2f: $@\n" "$(cut -f1 -d' ' /proc/uptime)"; }
err() { info "Error: $@"; }
warn() { info "Warning: $@"; }
# extract mount point from the swi path, e.g., /mnt/flash/sonic.swi --> /mnt/flash # extract mount point from the swi path, e.g., /mnt/flash/sonic.swi --> /mnt/flash
if [ -z "$target_path" ]; then if [ -z "$target_path" ]; then
if [ -z "$swipath" ]; then if [ -z "$swipath" ]; then
echo "target_path= is required when swipath= is not provided" err "target_path= is required when swipath= is not provided"
exit 1 exit 1
fi fi
target_path=$(df "$swipath" | tail -1 | tr -s " " | cut -d ' ' -f6) target_path=$(df "$swipath" | tail -1 | tr -s " " | cut -d ' ' -f6)
fi fi
image_path="$target_path/$image_name" image_path="$target_path/$image_name"
hook_path="$image_path/platform/hooks"
data_path="$image_path/platform/data"
cmdline_base="$target_path/kernel-params-base" cmdline_base="$target_path/kernel-params-base"
cmdline_image="$image_path/kernel-cmdline" cmdline_image="$image_path/kernel-cmdline"
@ -65,6 +71,9 @@ boot_config="$target_path/boot-config"
bootconfigvars="KERNEL INITRD CONSOLESPEED PASSWORD NETDEV NETAUTO NETIP NETMASK NETGW NETDOMAIN NETDNS NETHW memtest" bootconfigvars="KERNEL INITRD CONSOLESPEED PASSWORD NETDEV NETAUTO NETIP NETMASK NETGW NETDOMAIN NETDNS NETHW memtest"
flash_re=" /mnt/flash| /host" flash_re=" /mnt/flash| /host"
# for backward compatibility with the sonic_upgrade= behavior
install="${install:-${sonic_upgrade:-}}"
parse_environment_config() { parse_environment_config() {
for n in ${bootconfigvars}; do for n in ${bootconfigvars}; do
eval v="\$$n" eval v="\$$n"
@ -81,6 +90,7 @@ clean_flash() {
[ $f != "boot-config" ] && [ $f != "boot-config" ] &&
[ $f != "$kernel_params" ] && [ $f != "$kernel_params" ] &&
[ $f != "$cmdline_base" ] && [ $f != "$cmdline_base" ] &&
[ $f != "aquota.user" ] &&
[ $f != "old_config" ] && [ $f != "old_config" ] &&
[ $f != "minigraph.xml" ] [ $f != "minigraph.xml" ]
then then
@ -110,7 +120,7 @@ update_next_boot() {
local default="$(get_boot_config SWI_DEFAULT)" local default="$(get_boot_config SWI_DEFAULT)"
if [ -z "$default" ]; then if [ -z "$default" ]; then
echo "warning: no variable SWI_DEFAULT available" warn "boot-config has no variable SWI_DEFAULT"
else else
update_boot_config SWI "$default" update_boot_config SWI "$default"
fi fi
@ -119,26 +129,29 @@ update_next_boot() {
extract_image() { extract_image() {
mkdir -p "$image_path" mkdir -p "$image_path"
info "Extracting swi content"
## Unzip the image except boot0 and dockerfs archive ## Unzip the image except boot0 and dockerfs archive
unzip -oq "$swipath" -x boot0 {{ FILESYSTEM_DOCKERFS }} -d "$image_path" unzip -oq "$swipath" -x boot0 "$dockerfs" -d "$image_path"
## detect rootfs type ## detect rootfs type
rootfs_type=`grep " $target_path " /proc/mounts | cut -d' ' -f3` rootfs_type=`grep " $target_path " /proc/mounts | cut -d' ' -f3`
info "Extracting $dockerfs from swi"
## vfat does not support symbol link ## vfat does not support symbol link
if [ -n "$sonic_upgrade" ] || [ "$rootfs_type" != "vfat" ]; then if [ -n "$install" ] || [ "$rootfs_type" != "vfat" ]; then
mkdir -p "$image_path/{{ DOCKERFS_DIR }}" mkdir -p "$image_path/{{ DOCKERFS_DIR }}"
if [ -n "$sonic_upgrade" ]; then if [ -n "$install" ]; then
TAR_EXTRA_OPTION="--numeric-owner" TAR_EXTRA_OPTION="--numeric-owner --warning=no-timestamp"
fi fi
## extract docker archive ## extract docker archive
unzip -oqp "$swipath" {{ FILESYSTEM_DOCKERFS }} | tar xzf - -C "$image_path/{{ DOCKERFS_DIR }}" $TAR_EXTRA_OPTION info "Unpacking $dockerfs"
unzip -oqp "$swipath" "$dockerfs" | tar xzf - -C "$image_path/{{ DOCKERFS_DIR }}" $TAR_EXTRA_OPTION
else else
## save dockerfs archive in the image directory ## save dockerfs archive in the image directory
unzip -oq "$swipath" {{ FILESYSTEM_DOCKERFS }} -d "$image_path" unzip -oq "$swipath" "$dockerfs" -d "$image_path"
echo "$target_path is $rootfs_type, extract {{ FILESYSTEM_DOCKERFS }} in later stage" info "Unpacking $dockerfs delayed to initrd because $target_path is $rootfs_type"
fi fi
## use new reduced-size boot swi ## use new reduced-size boot swi
@ -263,7 +276,7 @@ write_boot_configs() {
elif [ -f /sys/class/net/eth0/address ]; then elif [ -f /sys/class/net/eth0/address ]; then
echo "hwaddr_ma1=$(cat /sys/class/net/eth0/address)" >> /tmp/append echo "hwaddr_ma1=$(cat /sys/class/net/eth0/address)" >> /tmp/append
else else
echo "ERROR: Management port is not found." err "Management port not found."
fi fi
# use extra parameters from kernel-params hook if the file exists # use extra parameters from kernel-params hook if the file exists
@ -292,13 +305,34 @@ run_kexec() {
local kernel="${KERNEL:-$(find $image_path/boot -name 'vmlinuz-*' -type f | head -n 1)}" local kernel="${KERNEL:-$(find $image_path/boot -name 'vmlinuz-*' -type f | head -n 1)}"
local initrd="${INITRD:-$(find $image_path/boot -name 'initrd.img-*' -type f | head -n 1)}" local initrd="${INITRD:-$(find $image_path/boot -name 'initrd.img-*' -type f | head -n 1)}"
if ! $verbose; then
# Start showing systemd information from the first failing unit if any.
# systemd.show_status=false or quiet can be used to silence systemd entierly
cmdline="$cmdline systemd.show_status=auto"
fi
kexec --load --initrd="$initrd" --append="$cmdline" "$kernel" kexec --load --initrd="$initrd" --append="$cmdline" "$kernel"
[ -z "$testonly" ] || exit 0 [ -z "$testonly" ] || exit 0
echo "kexecing..." info "Kexecing..."
kexec --exec kexec --exec
} }
get_sorted_hooks() {
echo $(find "$1" -name '[0-9][0-9]-*' -type f)
}
run_hooks() {
if [ -d "$hook_path/$1" ]; then
for hook in $(get_sorted_hooks "$hook_path/$1"); do
if [ ! -z "$hook" ]; then
info "Running hook $hook"
. "$hook"
fi
done
fi
}
# In Aboot no option will be provided therefore these are the default values to use # In Aboot no option will be provided therefore these are the default values to use
in_aboot=true in_aboot=true
do_clean=true do_clean=true
@ -311,7 +345,7 @@ if [ -f "$target_path/$do_not_clean" ]; then
fi fi
# Parse the cmdline options (used from EOS or from SONiC) # Parse the cmdline options (used from EOS or from SONiC)
if [ ! -z "$install" ] || [ ! -z "$sonic_upgrade" ]; then if [ ! -z "$install" ]; then
# install from SONiC or EOS # install from SONiC or EOS
in_aboot=false in_aboot=false
do_clean=false do_clean=false
@ -326,11 +360,24 @@ elif [ $# -ne 0 ]; then
exit 1 exit 1
fi fi
# Verbosity can be defined by the caller, default to false otherwise
verbose=${verbose:-false}
if [ -f "$target_path/verbose-boot" ] ||
[ "$(get_boot_config VERBOSE)" = "1" ] ||
! $in_aboot; then
verbose=true
fi
# enable shell debug mode to get the most verbosity
if $verbose; then
set -x
fi
# install the image if newer # install the image if newer
if $do_install; then if $do_install; then
# we expect the swi to install to be a non empty file # we expect the swi to install to be a non empty file
if [ ! -s "$swipath" ]; then if [ ! -s "$swipath" ]; then
echo "The swipath= environment variable does not point to a valid SWI" err "The swipath= environment variable does not point to a valid SWI"
exit 1 exit 1
fi fi
@ -340,17 +387,25 @@ if $do_install; then
if [ "$GIT_REVISION" != "$LOCAL_IMAGEHASH" ] || [ ! -z "$force" ]; then if [ "$GIT_REVISION" != "$LOCAL_IMAGEHASH" ] || [ ! -z "$force" ]; then
if $do_clean; then if $do_clean; then
info "Cleaning flash content $target_path"
clean_flash clean_flash
fi fi
info "Installing image under $image_path"
extract_image extract_image
info "Generating boot-config, machine.conf and cmdline"
write_boot_configs write_boot_configs
run_hooks post-install
else
info "Using previously installed image"
fi fi
fi fi
# chainloading using kexec # chainloading using kexec
if $do_kexec; then if $do_kexec; then
run_hooks pre-kexec
update_next_boot update_next_boot
run_kexec run_kexec
fi fi

View File

@ -19,20 +19,25 @@ block_flash=''
aboot_flag='' aboot_flag=''
backup_file='' backup_file=''
# Get the fullpath of flash device, e.g., /dev/sda # Wait until get the fullpath of flash device, e.g., /dev/sda
get_flash_dev() { wait_get_flash_dev() {
for dev in $(ls /sys/block); do local try_rounds=30
local is_mmc=$(echo "$dev" | grep 'mmcblk.*boot.*' | cat) while [ $try_rounds -gt 0 ]; do
if [ -n "$is_mmc" ]; then for dev in $(ls /sys/block); do
continue local is_mmc=$(echo "$dev" | grep 'mmcblk.*boot.*' | cat)
fi if [ -n "$is_mmc" ]; then
local devid=$(realpath "/sys/block/$dev/device") continue
local is_device=$(echo "$devid" | grep '^/sys/devices/' | cat) fi
local is_flash=$(echo "$devid" | grep "$block_flash" | cat) local devid=$(realpath "/sys/block/$dev/device")
if [ -n "$is_device" -a -n "$is_flash" ]; then local is_device=$(echo "$devid" | grep '^/sys/devices/' | cat)
flash_dev="/dev/$dev" local is_flash=$(echo "$devid" | grep "$block_flash" | cat)
return 0 if [ -n "$is_device" -a -n "$is_flash" ]; then
fi flash_dev="/dev/$dev"
return 0
fi
done
sleep 1
try_rounds=$(( $try_rounds - 1 ))
done done
return 1 return 1
} }
@ -95,6 +100,22 @@ fixup_flash_permissions() {
setfacl -Rb "$flash_mnt" setfacl -Rb "$flash_mnt"
} }
# Update ROOT device referring to the path under block_flash
# This is for the occasional name swap between /dev/sda and /dev/sdb
update_root() {
# Check that root=/dev/*, ignoring any cases like root=UUID=*
[ "${ROOT#/dev}" = "${ROOT}" ] && return 0
# Replace the beginning chars of ROOT by the ones of flash_dev with same index
{% raw %}
prefix_length="${#flash_dev}"
{% endraw %}
part_id="${ROOT:$prefix_length}"
ROOT="$flash_dev$part_id"
echo "ROOT=$ROOT" > /conf/param.conf
}
# Extract kernel parameters # Extract kernel parameters
set -- $(cat /proc/cmdline) set -- $(cat /proc/cmdline)
for x in "$@"; do for x in "$@"; do
@ -111,10 +132,24 @@ for x in "$@"; do
;; ;;
esac esac
done done
root_dev="$ROOT"
#Check aboot and root_dev is vfat #Check aboot
[ -z "$aboot_flag" ] && exit 0 [ -z "$aboot_flag" ] && exit 0
# Get flash dev name
if [ -z "$block_flash" ]; then
echo "Error: flash device info is not provided"
exit 1
fi
if ! wait_get_flash_dev; then
echo "Error: flash device is not found"
exit 1
fi
# If root=/dev/*, update ROOT to the device under block_flash
update_root
root_dev="$ROOT"
if [ -z "$root_dev" ]; then if [ -z "$root_dev" ]; then
echo "Error: root device name is not provided" echo "Error: root device name is not provided"
exit 1 exit 1
@ -126,22 +161,12 @@ fi
# exit when the root is ext4 # exit when the root is ext4
if ! blkid | grep "$root_dev.*vfat" -q; then if ! blkid | grep "$root_dev.*vfat" -q; then
mkdir -p "$root_mnt" mkdir -p "$root_mnt"
mount -t ext4 "$root_dev" "$root_mnt" mount -t ext4 "$root_dev" "$root_mnt"
fixup_flash_permissions "$root_mnt" fixup_flash_permissions "$root_mnt"
umount "$root_mnt" umount "$root_mnt"
rmdir "$root_mnt" rmdir "$root_mnt"
exit 0 exit 0
fi
# Get flash dev name
if [ -z "$block_flash" ]; then
echo "Error: flash device info is not provided"
exit 1
fi
if ! get_flash_dev; then
echo "Error: flash device is not found"
exit 1
fi fi
# Check memory size for tmpfs # Check memory size for tmpfs

@ -1 +1 @@
Subproject commit 49088611fc5c339c8a8d18e78c354c16aca33704 Subproject commit 0fc0c23d8bb8826d6431f35aff12ad1a5e098395

@ -1 +1 @@
Subproject commit 49088611fc5c339c8a8d18e78c354c16aca33704 Subproject commit 0fc0c23d8bb8826d6431f35aff12ad1a5e098395