-
Notifications
You must be signed in to change notification settings - Fork 25
/
build_bclinux_bfb
executable file
·103 lines (82 loc) · 4.46 KB
/
build_bclinux_bfb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash -x
###############################################################################
#
# 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.
#
###############################################################################
DOCA_VERSION=1.5.1
BF_VERSION=3.9.3
MLNX_OFED_VERSION=5.8-1.1.2.1
WDIR=${WDIR:-/tmp}
# Execute command w/ echo and exit if it fail
ex()
{
echo "$@"
if ! "$@"; then
printf "\nFailed executing $@\n\n"
exit 1
fi
}
rpm -e dw_mmc
# Upgrade kernel
ex yum-config-manager --nogpgcheck --add-repo http://mirrors.bclinux.org/bclinux/el7.7/updates/aarch64/
yum update --nogpgcheck -y kernel-bek-core kernel-bek kernel-bek-modules kernel-bek-devel kernel-bek-headers
kernel=`/bin/ls -1tr /lib/modules | tail -1`
yum install -y \
NetworkManager \
grub2-tools grub2 grubby grub2-tools-minimal grub2-efi-aa64 grub2-efi-aa64-modules grub2-common grub2-tools-extra \
efibootmgr tcpdump nvme-cli rsync binutils sg3_utils libnl3 bison flex meson libmnl libnuma perl lsof \
python-netifaces libreswan python36 python36-devel python36-idle python36-libs python36-test python36-tkinter python36-Cython \
device-mapper-persistent-data lvm2 acpid perf popt-devel bc edac-utils lm_sensors lm_sensors-sensord re2c ninja-build \
cryptsetup rasdaemon pciutils-devel watchdog python3-sphinx python36-six kexec-tools jq python3-pip libnghttp2 wget sudo uriparser || true
# Set python2.7 as a default
update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10
mkdir -p $WDIR
cd $WDIR
# Build and install MLNX_OFED drivers
ex wget --quiet https://linux.mellanox.com/public/repo/doca/${DOCA_VERSION}/extras/mlnx_ofed/${MLNX_OFED_VERSION}/MLNX_OFED_SRC-${MLNX_OFED_VERSION}.tgz
ex tar xzf MLNX_OFED_SRC-${MLNX_OFED_VERSION}.tgz
ex MLNX_OFED_SRC-${MLNX_OFED_VERSION}/install.pl -k $kernel --kernel-extra-args '--with-sf-cfg-drv --without-xdp --without-odp' --kernel-only --disable-kmp
# find MLNX_OFED_SRC-${MLNX_OFED_VERSION}/RPMS -name '*rpm' -a ! -name '*debuginfo*rpm' -exec rpm -ihv '{}' \;
# Build and install BlueField SoC drivers
ex wget --quiet -r -np -nH --cut-dirs=3 -R "index.html*" https://linux.mellanox.com/public/repo/doca/${DOCA_VERSION}/extras/SRPMS/
mkdir -p ${WDIR}/${DOCA_VERSION}/extras/{SPECS,RPMS,SOURCES,BUILD}
for p in ${WDIR}/${DOCA_VERSION}/extras/SRPMS/*.src.rpm
do
case $p in
*rshim* | *libpka* | *mlx-OpenIPMI* | *mlxbf-bootctl*)
continue
;;
esac
ex rpmbuild --rebuild -D "debug_package %{nil}" -D "KVERSION $kernel" --define "KMP 0" --define "_topdir ${WDIR}/${DOCA_VERSION}/extras" $p
done
ex rpm -ivh --force ${WDIR}/${DOCA_VERSION}/extras/RPMS/aarch64/*.rpm
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y --enablerepo=extras --nogpgcheck docker-ce docker-ce-cli container-selinux containerd.io
systemctl enable docker
# ex yum-config-manager --nogpgcheck --add-repo https://linux.mellanox.com/public/repo/doca/${DOCA_VERSION}/bclinux7.6/aarch64/
ex yum-config-manager --nogpgcheck --add-repo https://linux.mellanox.com/public/repo/doca/${DOCA_VERSION}/centos7.6/aarch64/
ex yum install --nogpgcheck -y doca-runtime-user doca-sdk-user doca-tools
ex rpm -ihv --force /root/workspace/mlxbf-bootimages-*.aarch64.rpm
/usr/sbin/update-pciids || true
sed -i -e "s/CentOS_7.6/BCLinux_7.6/" /etc/mlnx-release
sed -i -e "s/signed/@IMAGE_TYPE@@CUSTOM_VERSION@/" /etc/mlnx-release
ex /root/workspace/create_bfb -k $kernel