From 82179bd6a604bbbaf545a6997ac843f25cbc8688 Mon Sep 17 00:00:00 2001 From: Vladimir Sokolovsky Date: Fri, 11 Aug 2023 06:42:07 +0300 Subject: [PATCH] Ubuntu 20.04 DOCA_2.2.0_BSP_4.2.0 Signed-off-by: Vladimir Sokolovsky --- ubuntu/20.04/Dockerfile | 20 ++++++++++---------- ubuntu/20.04/bfb-build | 30 ++++++++++++++++++++++++++---- ubuntu/20.04/create_bfb | 4 +++- ubuntu/20.04/install.sh | 41 +++++++++++++++++++++++++++++++---------- 4 files changed, 70 insertions(+), 25 deletions(-) diff --git a/ubuntu/20.04/Dockerfile b/ubuntu/20.04/Dockerfile index 38f2163..fbe1f87 100644 --- a/ubuntu/20.04/Dockerfile +++ b/ubuntu/20.04/Dockerfile @@ -56,16 +56,16 @@ RUN dpkg -i /var/doca-dpu-repo-ubuntu2004-local/*mstflint*.deb || true RUN apt-mark hold mstflint RUN apt install -y -f \ - linux-bluefield=5.4.0.1060.55 \ - linux-bluefield-headers-5.4.0-1060=5.4.0-1060.66 \ - linux-bluefield-tools-5.4.0-1060=5.4.0-1060.66 \ - linux-headers-5.4.0-1060-bluefield=5.4.0-1060.66 \ - linux-headers-bluefield=5.4.0.1060.55 \ - linux-image-5.4.0-1060-bluefield=5.4.0-1060.66 \ - linux-image-bluefield=5.4.0.1060.55 \ - linux-modules-5.4.0-1060-bluefield=5.4.0-1060.66 \ - linux-tools-5.4.0-1060-bluefield=5.4.0-1060.66 \ - linux-tools-bluefield=5.4.0.1060.55 \ + linux-bluefield=5.4.0.1068.63 \ + linux-bluefield-headers-5.4.0-1068=5.4.0-1068.74 \ + linux-bluefield-tools-5.4.0-1068=5.4.0-1068.74 \ + linux-headers-5.4.0-1068-bluefield=5.4.0-1068.74 \ + linux-headers-bluefield=5.4.0.1068.63 \ + linux-image-5.4.0-1068-bluefield=5.4.0-1068.74 \ + linux-image-bluefield=5.4.0.1068.63 \ + linux-modules-5.4.0-1068-bluefield=5.4.0-1068.74 \ + linux-tools-5.4.0-1068-bluefield=5.4.0-1068.74 \ + linux-tools-bluefield=5.4.0.1068.63 \ linux-libc-dev:arm64 \ linux-tools-common diff --git a/ubuntu/20.04/bfb-build b/ubuntu/20.04/bfb-build index 044c7b8..ba0a870 100755 --- a/ubuntu/20.04/bfb-build +++ b/ubuntu/20.04/bfb-build @@ -1,4 +1,26 @@ #!/bin/bash -e +############################################################################### +# +# Copyright 2022 NVIDIA Corporation +# +# Permission is hereby granted, free of charge, to any person obtaining a copy of +# this software and associated documentation files (the "Software"), to deal in +# the Software without restriction, including without limitation the rights to +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +# the Software, and to permit persons to whom the Software is furnished to do so, +# subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +############################################################################### cd ${0%*/*} @@ -20,9 +42,9 @@ fi DISTRO="ubuntu" DISTRO_VERSION="20.04" DISTRO_BASE_URL="http://cloud-images.ubuntu.com/releases/focal/release/${DISTRO}-${DISTRO_VERSION}-server-cloudimg-arm64-root.tar.xz" -BF_RELEASE="4.0.2" -DOCA_VERSION="2.0.2" -MLNX_OFED_VERSION=23.04-0.5.3.0 +BF_RELEASE="4.2.0-12855" +DOCA_VERSION="2.2.0" +MLNX_OFED_VERSION=23.07-0.5.0.0 IMAGE_TYPE=${IMAGE_TYPE:-"prod"} CUSTOM_VERSION=${CUSTOM_VERSION:-""} NV_BASE_URL=${NV_BASE_URL:-"https://linux.mellanox.com/public/repo"} @@ -30,7 +52,7 @@ NV_BASE_URL=${NV_BASE_URL:-"https://linux.mellanox.com/public/repo"} WDIR=/tmp/${DISTRO}${DISTRO_VERSION}.$$ mkdir -p $WDIR -wget -q -P $WDIR -r --no-verbose --no-directories -l1 --no-parent -A 'doca-dpu-repo*arm64.deb' ${NV_BASE_URL}/doca/${DOCA_VERSION}/ubuntu${DISTRO_VERSION}/aarch64/ +wget -q -P $WDIR -r --no-verbose --no-directories -l1 --no-parent -A 'doca-dpu-repo*arm64.deb' ${NV_BASE_URL}/doca/${DOCA_VERSION}/${DISTRO}${DISTRO_VERSION}/aarch64/ mv $WDIR/doca-dpu-repo*arm64.deb $WDIR/doca-repo.deb wget -q -P $WDIR -r --no-verbose --no-directories -l1 --no-parent -A 'mlxbf-bootimages*arm64.deb' ${NV_BASE_URL}/bluefield/${BF_RELEASE}/bootimages/${IMAGE_TYPE}/ mv $WDIR/mlxbf-bootimages*arm64.deb $WDIR/mlxbf-bootimages.deb diff --git a/ubuntu/20.04/create_bfb b/ubuntu/20.04/create_bfb index 1ea63e3..7658a93 100755 --- a/ubuntu/20.04/create_bfb +++ b/ubuntu/20.04/create_bfb @@ -262,7 +262,7 @@ do done done -for mod in mlxbf_tmfifo dw_mmc-bluefield dw_mmc dw_mmc-pltfm mmc_block sdhci sdhci-of-dwcmshc nvme-rdma nvme-tcp nvme mlx5_ib ib_ipoib ib_iser $ADDON_KERNEL_MODULES +for mod in mlxbf_tmfifo dw_mmc-bluefield dw_mmc dw_mmc-pltfm mmc_block sdhci sdhci-of-dwcmshc nvme-rdma nvme-tcp nvme mlx5_ib mlxfw ib_umad ib_ipoib ib_iser $ADDON_KERNEL_MODULES do copy_module $mod done @@ -313,6 +313,8 @@ printf_msg() modprobe -a sdhci-of-dwcmshc dw_mmc-bluefield > /dev/null 2>&1 modprobe mlxbf_tmfifo > /dev/null 2>&1 +modprobe -a mlx5_ib mlxfw ib_umad +modprobe nvme > /dev/null 2>&1 insmod /mlx-bootctl.ko > /dev/null 2>&1 insmod /sbsa_gwdt.ko > /dev/null 2>&1 /usr/sbin/watchdog > /dev/null 2>&1 diff --git a/ubuntu/20.04/install.sh b/ubuntu/20.04/install.sh index fec65a0..4cf12cf 100755 --- a/ubuntu/20.04/install.sh +++ b/ubuntu/20.04/install.sh @@ -30,6 +30,8 @@ rshimlog=`which bfrshlog 2> /dev/null` distro="Ubuntu" NIC_FW_UPDATE_DONE=0 NIC_FW_RESET_REQUIRED=0 +RC=0 +err_msg="" fspath=$(readlink -f `dirname $0`) @@ -166,9 +168,9 @@ fi log "INFO: $distro installation started" default_device=/dev/mmcblk0 -# if [ -b /dev/nvme0n1 ]; then -# default_device=/dev/nvme0n1 -# fi +if [ -b /dev/nvme0n1 ]; then + default_device="/dev/$(cd /sys/block; /bin/ls -1d nvme* | sort -n | tail -1)" +fi device=${device:-"$default_device"} echo 0 > /proc/sys/kernel/hung_task_timeout_secs @@ -418,6 +420,7 @@ sdhci-of-dwcmshc sdhci_pltfm sdhci mlxbf-tmfifo +nvme EOF chroot /mnt update-initramfs -k ${kver} -u @@ -488,6 +491,7 @@ EOF elif (lspci -n -d 15b3: | grep -wq 'a2d6'); then # BlueField-2 ln -snf snap_rpc_init_bf2.conf /mnt/etc/mlnx_snap/snap_rpc_init.conf + #chroot /mnt env PATH=$CHROOT_PATH apt remove -y --purge dpa-compiler dpacc dpaeumgmt flexio || true elif (lspci -n -d 15b3: | grep -wq 'a2dc'); then # BlueField-3 chroot /mnt env PATH=$CHROOT_PATH apt remove -y --purge mlnx-snap || true @@ -587,6 +591,11 @@ EOF sed -i -e "s/0x01000000/0x13010000/g" /mnt/etc/default/grub fi + if (lspci -vv | grep -wq SimX); then + # Remove earlycon from grub parameters on SimX + sed -i -r -e 's/earlycon=[^ ]* //g' /mnt/etc/default/grub + fi + chroot /mnt env PATH=$CHROOT_PATH /usr/sbin/grub-install ${device} > /dev/null 2>&1 chroot /mnt env PATH=$CHROOT_PATH /usr/sbin/grub-mkconfig -o /boot/grub/grub.cfg > /dev/null 2>&1 chroot /mnt env PATH=$CHROOT_PATH /usr/sbin/grub-set-default 0 @@ -601,11 +610,9 @@ EOF unmount_partitions } -mounted_efivarfs=0 if [ ! -d /sys/firmware/efi/efivars ]; then mount -t efivarfs none /sys/firmware/efi/efivars fi -mounted_efivarfs=1 bfbootmgr --cleanall > /dev/null 2>&1 /bin/rm -f /sys/firmware/efi/efivars/Boot* > /dev/null 2>&1 @@ -641,9 +648,9 @@ blockdev --rereadpt ${device} > /dev/null 2>&1 sync -bfrec --bootctl --policy dual 2> /dev/null || true +bfrec --bootctl 2> /dev/null || true if [ -e /lib/firmware/mellanox/boot/capsule/boot_update2.cap ]; then - bfrec --capsule /lib/firmware/mellanox/boot/capsule/boot_update2.cap --policy dual + bfrec --capsule /lib/firmware/mellanox/boot/capsule/boot_update2.cap fi if [ -e /lib/firmware/mellanox/boot/capsule/efi_sbkeysync.cap ]; then @@ -675,6 +682,14 @@ PXE_DHCP_CLASS_ID=$DHCP_CLASS_ID EOF $BFCFG + rc=$? + if [ $rc -ne 0 ]; then + if (grep -q "boot: failed to get MAC" /tmp/bfcfg.log > /dev/null 2>&1); then + err_msg="Failed to add PXE boot entries" + fi + fi + + RC=$((RC+rc)) # Restore the original bf.cfg /bin/rm -f /etc/bf.cfg @@ -695,12 +710,18 @@ if ! (efibootmgr | grep ${UBUNTU_CODENAME}); then fi fi -if [ $mounted_efivarfs -eq 1 ]; then - umount /sys/firmware/efi/efivars > /dev/null 2>&1 -fi +umount /sys/firmware/efi/efivars if [ -n "$BFCFG" ]; then $BFCFG + rc=$? + if [ $rc -ne 0 ]; then + if (grep -q "boot: failed to get MAC" /tmp/bfcfg.log > /dev/null 2>&1); then + err_msg="Failed to add PXE boot entries" + fi + fi + + RC=$((RC+rc)) fi if function_exists bfb_post_install; then