@@ -89,6 +89,35 @@ static int str2index(const char *arg, unsigned& index)
89
89
return 0 ;
90
90
}
91
91
92
+ static bool
93
+ check_os_release (const std::vector<std::string> kernel_versions, std::ostream &ostr)
94
+ {
95
+ const std::string release = sensor_tree::get<std::string>(" system.release" );
96
+ for (const auto & ver : kernel_versions) {
97
+ if (release.find (ver) != std::string::npos)
98
+ return true ;
99
+ }
100
+ ostr << " WARNING: Kernel verison " << release << " is not officially supported. "
101
+ << kernel_versions.back () << " is the latest supported version" << std::endl;
102
+ return false ;
103
+ }
104
+
105
+ static bool
106
+ is_supported_kernel_version (std::ostream &ostr)
107
+ {
108
+ std::vector<std::string> ubuntu_kernel_versions =
109
+ { " 4.4.0" , " 4.13.0" , " 4.15.0" , " 4.18.0" , " 5.0.0" };
110
+ std::vector<std::string> centos_rh_kernel_versions =
111
+ { " 3.10.0-693" , " 3.10.0-862" , " 3.10.0-957" , " 3.10.0-1062" };
112
+ const std::string os = sensor_tree::get<std::string>(" system.linux" , " N/A" );
113
+
114
+ if (os.find (" Ubuntu" ) != std::string::npos)
115
+ return check_os_release (ubuntu_kernel_versions, ostr);
116
+ else if (os.find (" Red Hat" ) != std::string::npos || os.find (" CentOS" ) != std::string::npos)
117
+ return check_os_release (centos_rh_kernel_versions, ostr);
118
+
119
+ return true ;
120
+ }
92
121
93
122
static void print_pci_info (std::ostream &ostr)
94
123
{
@@ -117,6 +146,8 @@ static void print_pci_info(std::ostream &ostr)
117
146
ostr << " please also run 'xbmgmt flash --scan --verbose' to further check card details."
118
147
<< std::endl;
119
148
}
149
+
150
+ is_supported_kernel_version (ostr);
120
151
}
121
152
122
153
static int xrt_xbutil_version_cmp ()
@@ -1463,6 +1494,19 @@ int xcldev::device::getXclbinuuid(uuid_t &uuid) {
1463
1494
1464
1495
return 0 ;
1465
1496
}
1497
+
1498
+ int xcldev::device::kernelVersionTest (void )
1499
+ {
1500
+ if (getenv_or_null (" INTERNAL_BUILD" )) {
1501
+ std::cout << " Developer's build. Skipping validation" << std::endl;
1502
+ return -EOPNOTSUPP;
1503
+ }
1504
+ if (!is_supported_kernel_version (std::cout)) {
1505
+ return 1 ;
1506
+ }
1507
+ return 0 ;
1508
+ }
1509
+
1466
1510
/*
1467
1511
* validate
1468
1512
*/
@@ -1471,6 +1515,12 @@ int xcldev::device::validate(bool quick)
1471
1515
bool withWarning = false ;
1472
1516
int retVal = 0 ;
1473
1517
1518
+ retVal = runOneTest (" Kernel version check" ,
1519
+ std::bind (&xcldev::device::kernelVersionTest, this ));
1520
+ withWarning = withWarning || (retVal == 1 );
1521
+ if (retVal < 0 )
1522
+ return retVal;
1523
+
1474
1524
retVal = runOneTest (" AUX power connector check" ,
1475
1525
std::bind (&xcldev::device::auxConnectionTest, this ));
1476
1526
withWarning = withWarning || (retVal == 1 );
0 commit comments