Skip to content

Commit 43cd0aa

Browse files
saumyag-xilinxsaumya garg
andauthored
Adding support for RHEL9.* (#7258)
Co-authored-by: saumya garg <[email protected]>
1 parent 0261541 commit 43cd0aa

File tree

26 files changed

+91
-63
lines changed

26 files changed

+91
-63
lines changed

build/covbuild.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ set -e
2020
# Update to scan.coverity.com using the version and description per covbuild.sh output
2121
# Make sure to upload from a host with direct access to xrt.tgz (342M)
2222

23-
OSDIST=`lsb_release -i |awk -F: '{print tolower($2)}' | tr -d ' \t'`
23+
OSDIST=`awk -F= '$1=="ID" {print $2}' /etc/os-release | tr -d '"' | awk '{print tolower($1)}'`
2424
BUILDDIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
2525
CORE=`grep -c ^processor /proc/cpuinfo`
2626
CMAKE=cmake

build/cross_compile.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ else
150150
OS_TARGET=${OS_TARGET^}
151151
VERSION=$VERSION_ID
152152
else
153-
OS_TARGET=`cat ${SYSROOT}/etc/redhat-release | awk '{print $1}' | tr -d '"'`
154-
VERSION=`cat ${SYSROOT}/etc/redhat-release | awk '{print $4}' | tr -d '"'`
153+
OS_TARGET=`awk -F= '$1=="ID" {print $2}' ${SYSROOT}/etc/os-release | tr -d '"' | awk '{print tolower($1)}'`
154+
VERSION=`awk -F= '$1=="VERSION_ID" {print $2}' ${SYSROOT}/etc/os-release | tr -d '"'`
155155
fi
156156
echo "INFO: Cross Compiling XRT for $AARCH and Target System $OS_TARGET, Version:$VERSION"
157157
fi

build/dbg.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -e
44

5-
OSDIST=`lsb_release -i |awk -F: '{print tolower($2)}' | tr -d ' \t'`
5+
OSDIST=`awk -F= '$1=="ID" {print $2}' /etc/os-release | tr -d '"' | awk '{print tolower($1)}'`
66
BUILDDIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
77
CORE=`grep -c ^processor /proc/cpuinfo`
88
CMAKE=cmake

build/debian/xrt-xocl-dkms.prerm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ version_line=$(grep ^PACKAGE_VERSION= "$dkms_file")
3333
eval "$version_line"
3434
echo "Removing version $PACKAGE_VERSION"
3535

36-
lsb_release -si | grep -Eq "^RedHat|^CentOS"
36+
awk -F= '$1=="ID" {print $2}' /etc/os-release | tr -d '"' | awk '{print tolower($1)}' | grep -Eq "^rhel|^centos"
3737
if [ $? -eq 0 ] && [ $1 -ge 1 ]; then
3838
echo "Cleanup is skipped for package upgrade/downgrade/re-install on RHEL/CentOS"
3939
exit 0
4040
fi
4141

42-
lsb_release -si | grep -Eq "^Ubuntu|^Debian"
42+
awk -F= '$1=="ID" {print $2}' /etc/os-release | tr -d '"' | awk '{print tolower($1)}' | grep -Eq "^ubuntu|^debian"
4343
if [ $? -eq 0 ] && [ "$1" = "upgrade" ]; then
4444
echo "Unregistering old XRT Linux kernel module sources $PACKAGE_VERSION from dkms on Ubuntu/Debian"
4545
dkms remove -m xrt -v "$PACKAGE_VERSION" --all

src/CMake/config/prerm-aws.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ if [ $? -eq 1 ]; then
4545
fi
4646

4747
#In case prerm is called after postinst on centos, make sure not to stop mpd
48-
lsb_release -si | grep -Eq "^RedHat|^CentOS"
48+
awk -F= '$1=="ID" {print $2}' /etc/os-release | tr -d '"' | awk '{print tolower($1)}' | grep -Eq "^rhel|^centos"
4949
if [ $? -eq 0 ] && [ $1 -ge 1 ]; then
5050
echo "Cleanup is skipped for package upgrade/downgrade/re-install on RHEL/CentOS"
5151
exit 0

src/CMake/config/prerm-azure.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
DIR=/opt/xilinx/xrt
3434

3535
#In case prerm is called after postinst on centos, make sure not to stop mpd
36-
lsb_release -si | grep -Eq "^RedHat|^CentOS"
36+
awk -F= '$1=="ID" {print $2}' /etc/os-release | tr -d '"' | awk '{print tolower($1)}' | grep -Eq "^rhel|^centos"
3737
if [ $? -eq 0 ] && [ $1 -ge 1 ]; then
3838
echo "Cleanup is skipped for package upgrade/downgrade/re-install on RHEL/CentOS"
3939
exit 0

src/CMake/config/prerm-container.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
# in postinst script.
3232

3333
#In case prerm is called after postinst on centos, make sure not to stop mpd
34-
lsb_release -si | grep -Eq "^RedHat|^CentOS"
34+
awk -F= '$1=="ID" {print $2}' /etc/os-release | tr -d '"' | awk '{print tolower($1)}' | grep -Eq "^rhel|^centos"
3535
if [ $? -eq 0 ] && [ $1 -ge 1 ]; then
3636
echo "Cleanup is skipped for package upgrade/downgrade/re-install on RHEL/CentOS"
3737
exit 0

src/CMake/config/prerm.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@
3030
# configuration of the components and hence we want to handle the configuration
3131
# in postinst script.
3232

33-
lsb_release -si | grep -Eq "^RedHat|^CentOS"
33+
awk -F= '$1=="ID" {print $2}' /etc/os-release | tr -d '"' | awk '{print tolower($1)}' | grep -Eq "^rhel|^centos"
3434
if [ $? -eq 0 ] && [ $1 -ge 1 ]; then
3535
echo "Cleanup is skipped for package upgrade/downgrade/re-install on RHEL/CentOS"
3636
exit 0
3737
fi
3838

39-
lsb_release -si | grep -Eq "^Ubuntu|^Debian"
39+
awk -F= '$1=="ID" {print $2}' /etc/os-release | tr -d '"' | awk '{print tolower($1)}' | grep -Eq "^ubuntu|^debian"
4040
if [ $? -eq 0 ] && [ "$1" = "upgrade" ]; then
4141
echo "Unregistering old XRT Linux kernel module sources @XRT_VERSION_STRING@ from dkms on Ubuntu/Debian"
4242
dkms remove -m xrt -v @XRT_VERSION_STRING@ --all

src/CMake/cpackLin.cmake

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@ if (DEFINED CROSS_COMPILE)
3333
set(CPACK_REL_VER ${LINUX_VERSION})
3434
else()
3535
execute_process(
36-
COMMAND lsb_release -r -s
36+
COMMAND awk -F= "$1==\"VERSION_ID\" {print $2}" /etc/os-release
37+
COMMAND tr -d "\""
3738
OUTPUT_VARIABLE CPACK_REL_VER
3839
OUTPUT_STRIP_TRAILING_WHITESPACE
3940
)
4041
endif()
4142

4243
SET(PACKAGE_KIND "TGZ")
43-
if (${LINUX_FLAVOR} MATCHES "^(Ubuntu|Debian)")
44+
if (${LINUX_FLAVOR} MATCHES "^(ubuntu|debian)")
4445
execute_process(
4546
COMMAND dpkg --print-architecture
4647
OUTPUT_VARIABLE CPACK_ARCH
@@ -66,7 +67,7 @@ if (${LINUX_FLAVOR} MATCHES "^(Ubuntu|Debian)")
6667
endif()
6768

6869
SET(CPACK_DEBIAN_AWS_PACKAGE_DEPENDS "xrt (>= ${XRT_VERSION_MAJOR}.${XRT_VERSION_MINOR}.${XRT_VERSION_PATCH})")
69-
SET(CPACK_DEBIAN_XRT_PACKAGE_DEPENDS "ocl-icd-libopencl1 (>= 2.2.0), lsb-release, dkms (>= 2.2.0), udev, python3")
70+
SET(CPACK_DEBIAN_XRT_PACKAGE_DEPENDS "ocl-icd-libopencl1 (>= 2.2.0), dkms (>= 2.2.0), udev, python3")
7071

7172
if (${XRT_DEV_COMPONENT} STREQUAL "xrt")
7273
# applications link with -luuid
@@ -95,7 +96,7 @@ if (${LINUX_FLAVOR} MATCHES "^(Ubuntu|Debian)")
9596
SET(CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_XRT_PACKAGE_DEPENDS})
9697
endif()
9798

98-
elseif (${LINUX_FLAVOR} MATCHES "^(RedHat|CentOS|Amazon|Fedora|SUSE)")
99+
elseif (${LINUX_FLAVOR} MATCHES "^(rhel|centos|amzn|fedora|sles)")
99100
execute_process(
100101
COMMAND uname -m
101102
OUTPUT_VARIABLE CPACK_ARCH
@@ -123,10 +124,10 @@ elseif (${LINUX_FLAVOR} MATCHES "^(RedHat|CentOS|Amazon|Fedora|SUSE)")
123124
SET(CPACK_RPM_CONTAINER_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_BINARY_DIR}/container/prerm")
124125
SET(CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION "/usr/local" "/usr/src" "/opt" "/etc/OpenCL" "/etc/OpenCL/vendors" "/usr/lib" "/usr/lib/pkgconfig" "/usr/lib64/pkgconfig" "/lib" "/lib/firmware")
125126
SET(CPACK_RPM_AWS_PACKAGE_REQUIRES "xrt >= ${XRT_VERSION_MAJOR}.${XRT_VERSION_MINOR}.${XRT_VERSION_PATCH}")
126-
if (${LINUX_FLAVOR} MATCHES "^(SUSE)")
127-
SET(CPACK_RPM_XRT_PACKAGE_REQUIRES "ocl-icd-devel >= 2.2, lsb-release, dkms >= 2.2.0, python3 >= 3.6")
127+
if (${LINUX_FLAVOR} MATCHES "^(sles)")
128+
SET(CPACK_RPM_XRT_PACKAGE_REQUIRES "ocl-icd-devel >= 2.2, dkms >= 2.2.0, python3 >= 3.6")
128129
else()
129-
SET(CPACK_RPM_XRT_PACKAGE_REQUIRES "ocl-icd >= 2.2, redhat-lsb-core, dkms >= 2.5.0, python3 >= 3.6")
130+
SET(CPACK_RPM_XRT_PACKAGE_REQUIRES "ocl-icd >= 2.2, dkms >= 2.5.0, python3 >= 3.6")
130131
endif()
131132

132133
if (${XRT_DEV_COMPONENT} STREQUAL "xrt")
@@ -158,7 +159,7 @@ endif()
158159
# On Amazon Linux CPACK_REL_VER is just '2' and it is hard to
159160
# distinguish it as AL package, so adding CPACK_FLOVOR (eg: amzn)
160161
# to package name
161-
if (${LINUX_FLAVOR} MATCHES "^Amazon")
162+
if (${LINUX_FLAVOR} MATCHES "^amzn")
162163
execute_process(
163164
COMMAND awk -F= "$1==\"ID\" {print $2}" /etc/os-release
164165
COMMAND tr -d "\""

src/CMake/nativeLnx.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,19 @@ ELSE(GIT_FOUND)
4141
endif(GIT_FOUND)
4242

4343
# --- LSB Release ---
44-
find_program(LSB_RELEASE lsb_release)
4544
find_program(UNAME uname)
4645

47-
execute_process(COMMAND ${LSB_RELEASE} -is
46+
execute_process(
47+
COMMAND awk -F= "$1==\"ID\" {print $2}" /etc/os-release
48+
COMMAND tr -d "\""
49+
COMMAND awk "{print tolower($1)}"
4850
OUTPUT_VARIABLE LINUX_FLAVOR
4951
OUTPUT_STRIP_TRAILING_WHITESPACE
5052
)
5153

52-
execute_process(COMMAND ${LSB_RELEASE} -rs
54+
execute_process(
55+
COMMAND awk -F= "$1==\"VERSION_ID\" {print $2}" /etc/os-release
56+
COMMAND tr -d "\""
5357
OUTPUT_VARIABLE LINUX_VERSION
5458
OUTPUT_STRIP_TRAILING_WHITESPACE
5559
)

0 commit comments

Comments
 (0)