Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions build_debian.sh
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,8 @@ sudo cp files/initramfs-tools/union-mount $FILESYSTEM_ROOT/etc/initramfs-tools/s
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/union-mount
sudo cp files/initramfs-tools/varlog $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/varlog
sudo cp files/initramfs-tools/swi2bin $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/swi2bin
sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/swi2bin
# Management interface (eth0) dhcp can be optionally turned off (during a migration from another NOS to SONiC)
#sudo cp files/initramfs-tools/mgmt-intf-dhcp $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp
#sudo chmod +x $FILESYSTEM_ROOT/etc/initramfs-tools/scripts/init-bottom/mgmt-intf-dhcp
Expand Down Expand Up @@ -454,12 +456,14 @@ if [[ $TARGET_BOOTLOADER == grub ]]; then
( cd $FILESYSTEM_ROOT; sudo rm -f $basename_deb_packages )

if [[ $CONFIGURED_ARCH == amd64 ]]; then
GRUB_PKG=grub-pc-bin
GRUB_PKGS='grub-efi-amd64-bin grub-pc-bin'
elif [[ $CONFIGURED_ARCH == arm64 ]]; then
GRUB_PKG=grub-efi-arm64-bin
GRUB_PKGS=grub-efi-arm64-bin
fi

sudo cp $debs_path/${GRUB_PKG}*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/grub
for grub_pkg in $GRUB_PKGS; do
sudo cp $debs_path/${grub_pkg}*.deb $FILESYSTEM_ROOT/$PLATFORM_DIR/grub
done
fi

## Disable kexec supported reboot which was installed by default
Expand Down
2 changes: 2 additions & 0 deletions device/arista/x86_64-arista_7060x6_16pe_384c/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARISTA_SID="Redstart*Moby"
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=snd_hda_intel,hdaudio,amd_sfh"
2 changes: 2 additions & 0 deletions device/arista/x86_64-arista_7060x6_32pe/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARISTA_SID="*MorandaP"
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=snd_hda_intel,hdaudio,amd_sfh"
2 changes: 2 additions & 0 deletions device/arista/x86_64-arista_7060x6_64pe/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARISTA_SID="Shearwater*QuicksilverP"
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=snd_hda_intel,hdaudio"
2 changes: 2 additions & 0 deletions device/arista/x86_64-arista_7060x6_64pe_b/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARISTA_SID="Redstart*QuicksilverP512"
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=snd_hda_intel,hdaudio,amd_sfh"
2 changes: 2 additions & 0 deletions device/arista/x86_64-arista_720dt_48s/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARISTA_SID="PikeIslandZ PikeIslandZ-F PikeIslandZ-R PikeIslandZ-F PikeIslandZ-R"
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX=""
2 changes: 2 additions & 0 deletions device/arista/x86_64-arista_720dt_48s_mgx/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARISTA_SID="PikeIslandZ-MGX"
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX=""
2 changes: 2 additions & 0 deletions device/arista/x86_64-arista_7280r4_32qf_32df/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARISTA_SID="*CitrineDd"
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=snd_hda_intel,hdaudio,amd_sfh"
2 changes: 2 additions & 0 deletions device/arista/x86_64-arista_7280r4k_32qf_32df/installer.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ARISTA_SID="*CitrineDdBk"
ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=snd_hda_intel,hdaudio,amd_sfh"
4 changes: 3 additions & 1 deletion dockers/docker-platform-monitor/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ RUN apt-get update && \
pciutils \
nvme-cli \
ethtool \
xxd
xxd \
python3-yaml \
python3-bottle
{% if sonic_asic_platform == 'mellanox' %}
RUN apt-get install -y dbus
{% endif %}
Expand Down
1 change: 1 addition & 0 deletions files/initramfs-tools/modules
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ nls_cp437
nls_utf8
nvme
zstd
efivarfs
159 changes: 159 additions & 0 deletions files/initramfs-tools/swi2bin
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
#!/bin/sh -e
# This hook is the 2nd stage of the swi2bin installation

PREREQS=""

prereqs() { echo "$PREREQS"; }

case $1 in
prereqs)
prereqs
exit 0
;;
esac

perform_swi2bin=false
verbose=false

for x in $(cat /proc/cmdline); do
case "$x" in
arista.swi2bin=verbose)
perform_swi2bin=true
verbose=true
;;
arista.swi2bin|arista.swi2bin=*)
perform_swi2bin=true
;;
esac
done

if ! $perform_swi2bin; then
exit 0
fi

if $verbose; then
set -x
fi

log() {
echo "[+] $@"
}

is_bin_signed() {
test "$(tail -n 1 "$1")" = "-----END CMS-----"
}

log "Entering initrd phase of installation"

nosname=SONiC-OS
image_name="$(cat /proc/cmdline | sed -e 's/.*loop=\(\S*\)\/.*/\1/')"

bin_signed=false
if is_bin_signed "$rootmnt/host/$image_name/sonic.bin"; then
bin_signed=true
fi

log "Mounting root filesystem"
rootdir=/install-root
installtmp=/tmp/install
rwdir="$installtmp/rw"
workdir="$installtmp/workdir"

mkdir -p "$rootdir"
mkdir -p "$installtmp"

mount -t tmpfs none "$installtmp"
mkdir -p "$rwdir"
mkdir -p "$workdir"

mount -n -o "lowerdir=$rootmnt,upperdir=$rwdir,workdir=$workdir" -t overlay root-overlay "$rootdir"
mount -o bind "$rootmnt/host" "$rootdir/host"
mount -t proc proc "$rootdir/proc"
mount -t devtmpfs udev "$rootdir/dev"
mount -t sysfs sysfs "$rootdir/sys"

log "Installing grub"
espdev="$(blkid --label ESP)"
blkdev="/dev/$(basename "$(readlink -f "/sys/class/block/$(basename "$espdev")/..")")"
esppartnum="$(echo "$espdev" | grep -Eo '[0-9]+$')"

mkdir -p "$rootdir/boot"
mount -o bind "$rootmnt/host/$image_name/boot" "$rootdir/boot"
mkdir -p "$rootdir/boot/efi"
mount "$espdev" "$rootdir/boot/efi"

# ensure grub folder exists
mkdir -p "$rootdir/host/grub"

# mounting efivarfs which is necessary for efitools to work
mount -t efivarfs efivarfs "$rootdir/sys/firmware/efi/efivars"

# installing grub packages from platform.tar.gz
chroot "$rootdir" sh -c "dpkg -i /host/$image_name/platform/grub/*"

# install grub-efi on /boot/efi/SONiC-OS and configuration on /host/grub/
chroot "$rootdir" grub-install \
--target=x86_64-efi \
--boot-directory=/host \
--efi-directory=/boot/efi \
--bootloader-id=$nosname

if $bin_signed; then
log "Installing signed shim/grub/mm"

# installing signed grub, shim, mm and other efi tools
mkdir -p "$rootdir/boot/efi/EFI/$nosname"
cp "$rootdir/host/$image_name/boot/"*.efi "$rootdir/boot/efi/EFI/$nosname"

# creating new EFI boot entry
chroot "$rootdir" efibootmgr \
--create \
--quiet \
--label "$nosname" \
--disk "$blkdev" \
--part "$esppartnum" \
--loader "/EFI/$nosname/shimx64.efi"
fi

# FIXME: populate fake entry in grub.cfg to allow the installer to find the /host
# partition
grubentry="SONiC-OS-$(echo "$image_name" | cut -c7-)"
cat > "$rootdir/host/grub/grub.cfg" <<EOF
menuentry '$grubentry' {
# root=$ROOT rw
}
EOF

log "Running SONiC installer"

chroot "$rootdir" bash "/host/$image_name/sonic.bin"

# FIXME: remove fake grub entry
sed -i "/^menuentry .$grubentry./,/}/d" "$rootdir/host/grub/grub.cfg"

sync

log "Cleaning up behind installer"

# unmounting chroot paths
umount "$rootdir/sys/firmware/efi/efivars"
umount "$rootdir/boot/efi"
umount "$rootdir/boot"
umount "$rootdir/sys"
umount "$rootdir/dev"
umount "$rootdir/proc"
umount "$rootdir/host"
umount "$rootdir"

# unmounting other paths
mkdir -p /tmp/host
mount -o move "$rootmnt/host" /tmp/host
umount "$rootmnt"
rm -rf "/tmp/host/$image_name"
umount /tmp/host

log "Done installing, rebooting..."

sync

echo b > /proc/sysrq-trigger
2 changes: 1 addition & 1 deletion files/initramfs-tools/varlog
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh -e

PREREQS=""
PREREQS="swi2bin"

prereqs() { echo "$PREREQS"; }

Expand Down
1 change: 1 addition & 0 deletions installer/default_platform.conf
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,7 @@ menuentry '$demo_grub_entry' {
if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
insmod part_msdos
insmod ext2
insmod efi_gop
$GRUB_CFG_LINUX_CMD /$image_dir/boot/vmlinuz-6.12.41+deb13-sonic-${arch} root=$grub_cfg_root rw $GRUB_CMDLINE_LINUX \
net.ifnames=0 biosdevname=0 \
loop=$image_dir/$FILESYSTEM_SQUASHFS loopfstype=squashfs \
Expand Down
4 changes: 3 additions & 1 deletion platform/broadcom/one-image.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ $(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
$(SONIC_ONE_IMAGE)_INSTALLS += $(PDDF_PLATFORM_MODULE)
$(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
$(SONIC_ONE_IMAGE)_INSTALLS += $(FLASHROM)
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(DELL_S6000_PLATFORM_MODULE) \
$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += \
$(ARISTA_PLATFORM_MODULE_ALL) \
$(DELL_S6000_PLATFORM_MODULE) \
$(DELL_Z9264F_PLATFORM_MODULE) \
$(DELL_S5212F_PLATFORM_MODULE) \
$(DELL_S5224F_PLATFORM_MODULE) \
Expand Down
11 changes: 11 additions & 0 deletions platform/broadcom/platform-modules-arista.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@ ARISTA_PLATFORM_MODULE_VERSION = 1.0

export ARISTA_PLATFORM_MODULE_VERSION

ARISTA_PLATFORMS = $(subst device/arista/,, $(wildcard device/arista/x86_64-arista_[0-9]*))

export ARISTA_PLATFORMS

ARISTA_PLATFORM_MODULE = sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb
$(ARISTA_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-arista
$(ARISTA_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
SONIC_DPKG_DEBS += $(ARISTA_PLATFORM_MODULE)

ARISTA_PLATFORM_MODULE_ALL = sonic-platform-arista-all_$(ARISTA_PLATFORM_MODULE_VERSION)_amd64.deb
$(ARISTA_PLATFORM_MODULE_ALL)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-arista
$(ARISTA_PLATFORM_MODULE_ALL)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
$(ARISTA_PLATFORM_MODULE_ALL)_PLATFORM = $(ARISTA_PLATFORMS)
SONIC_DPKG_DEBS += $(ARISTA_PLATFORM_MODULE_ALL)

ARISTA_PLATFORM_MODULE_PYTHON3 = python3-sonic-platform-arista_$(ARISTA_PLATFORM_MODULE_VERSION)_all.deb
$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_PYTHON3)))

Expand All @@ -19,6 +29,7 @@ ARISTA_PLATFORM_MODULE_LIBS = sonic-platform-arista-libs_$(ARISTA_PLATFORM_MODUL
$(eval $(call add_extra_package,$(ARISTA_PLATFORM_MODULE),$(ARISTA_PLATFORM_MODULE_LIBS)))

export ARISTA_PLATFORM_MODULE \
ARISTA_PLATFORM_MODULE_ALL \
ARISTA_PLATFORM_MODULE_PYTHON3 \
ARISTA_PLATFORM_MODULE_DRIVERS \
ARISTA_PLATFORM_MODULE_LIBS
Expand Down
Loading