diff --git a/build_debian.sh b/build_debian.sh index 6af128f8e7d..895f3457b14 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -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 @@ -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 diff --git a/device/arista/x86_64-arista_7060x6_16pe_384c/installer.conf b/device/arista/x86_64-arista_7060x6_16pe_384c/installer.conf new file mode 100644 index 00000000000..609eb2d05a2 --- /dev/null +++ b/device/arista/x86_64-arista_7060x6_16pe_384c/installer.conf @@ -0,0 +1,2 @@ +ARISTA_SID="Redstart*Moby" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=snd_hda_intel,hdaudio,amd_sfh" diff --git a/device/arista/x86_64-arista_7060x6_32pe/installer.conf b/device/arista/x86_64-arista_7060x6_32pe/installer.conf new file mode 100644 index 00000000000..0e8ad6c9afe --- /dev/null +++ b/device/arista/x86_64-arista_7060x6_32pe/installer.conf @@ -0,0 +1,2 @@ +ARISTA_SID="*MorandaP" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=snd_hda_intel,hdaudio,amd_sfh" diff --git a/device/arista/x86_64-arista_7060x6_64pe/installer.conf b/device/arista/x86_64-arista_7060x6_64pe/installer.conf new file mode 100644 index 00000000000..693cca6c1e5 --- /dev/null +++ b/device/arista/x86_64-arista_7060x6_64pe/installer.conf @@ -0,0 +1,2 @@ +ARISTA_SID="Shearwater*QuicksilverP" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=snd_hda_intel,hdaudio" diff --git a/device/arista/x86_64-arista_7060x6_64pe_b/installer.conf b/device/arista/x86_64-arista_7060x6_64pe_b/installer.conf new file mode 100644 index 00000000000..6cc2e45188a --- /dev/null +++ b/device/arista/x86_64-arista_7060x6_64pe_b/installer.conf @@ -0,0 +1,2 @@ +ARISTA_SID="Redstart*QuicksilverP512" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=snd_hda_intel,hdaudio,amd_sfh" diff --git a/device/arista/x86_64-arista_720dt_48s/installer.conf b/device/arista/x86_64-arista_720dt_48s/installer.conf new file mode 100644 index 00000000000..dc7ed80563f --- /dev/null +++ b/device/arista/x86_64-arista_720dt_48s/installer.conf @@ -0,0 +1,2 @@ +ARISTA_SID="PikeIslandZ PikeIslandZ-F PikeIslandZ-R PikeIslandZ-F PikeIslandZ-R" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="" diff --git a/device/arista/x86_64-arista_720dt_48s_mgx/installer.conf b/device/arista/x86_64-arista_720dt_48s_mgx/installer.conf new file mode 100644 index 00000000000..386aa5b49bc --- /dev/null +++ b/device/arista/x86_64-arista_720dt_48s_mgx/installer.conf @@ -0,0 +1,2 @@ +ARISTA_SID="PikeIslandZ-MGX" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="" diff --git a/device/arista/x86_64-arista_7280r4_32qf_32df/installer.conf b/device/arista/x86_64-arista_7280r4_32qf_32df/installer.conf new file mode 100644 index 00000000000..d5dd67178b7 --- /dev/null +++ b/device/arista/x86_64-arista_7280r4_32qf_32df/installer.conf @@ -0,0 +1,2 @@ +ARISTA_SID="*CitrineDd" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=snd_hda_intel,hdaudio,amd_sfh" diff --git a/device/arista/x86_64-arista_7280r4k_32qf_32df/installer.conf b/device/arista/x86_64-arista_7280r4k_32qf_32df/installer.conf new file mode 100644 index 00000000000..3dbfa81e3d7 --- /dev/null +++ b/device/arista/x86_64-arista_7280r4k_32qf_32df/installer.conf @@ -0,0 +1,2 @@ +ARISTA_SID="*CitrineDdBk" +ONIE_PLATFORM_EXTRA_CMDLINE_LINUX="modprobe.blacklist=snd_hda_intel,hdaudio,amd_sfh" diff --git a/dockers/docker-platform-monitor/Dockerfile.j2 b/dockers/docker-platform-monitor/Dockerfile.j2 index fda0d9b34cd..0a277f4373b 100755 --- a/dockers/docker-platform-monitor/Dockerfile.j2 +++ b/dockers/docker-platform-monitor/Dockerfile.j2 @@ -32,7 +32,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 %} diff --git a/files/initramfs-tools/modules b/files/initramfs-tools/modules index 546660daefe..dd8cb3c8edd 100644 --- a/files/initramfs-tools/modules +++ b/files/initramfs-tools/modules @@ -6,3 +6,4 @@ nls_cp437 nls_utf8 nvme zstd +efivarfs diff --git a/files/initramfs-tools/swi2bin b/files/initramfs-tools/swi2bin new file mode 100644 index 00000000000..83da26c20da --- /dev/null +++ b/files/initramfs-tools/swi2bin @@ -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" < /proc/sysrq-trigger diff --git a/files/initramfs-tools/varlog b/files/initramfs-tools/varlog index 980b2452345..1dc3644906a 100644 --- a/files/initramfs-tools/varlog +++ b/files/initramfs-tools/varlog @@ -1,6 +1,6 @@ #!/bin/sh -e -PREREQS="" +PREREQS="swi2bin" prereqs() { echo "$PREREQS"; } diff --git a/installer/default_platform.conf b/installer/default_platform.conf index 4a882fc1fc3..b9574c9de6b 100755 --- a/installer/default_platform.conf +++ b/installer/default_platform.conf @@ -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 \ diff --git a/platform/broadcom/one-image.mk b/platform/broadcom/one-image.mk index 756f476b18c..bc7a6e00b6f 100755 --- a/platform/broadcom/one-image.mk +++ b/platform/broadcom/one-image.mk @@ -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) \ diff --git a/platform/broadcom/platform-modules-arista.mk b/platform/broadcom/platform-modules-arista.mk index bf1ab1e1128..2a7562827f5 100644 --- a/platform/broadcom/platform-modules-arista.mk +++ b/platform/broadcom/platform-modules-arista.mk @@ -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))) @@ -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