Skip to content

Commit 77b838f

Browse files
Collecting Linux device driver data in SR image
Signed-off-by: Manjunath Divakar <manjunatha.d@arm.com>
1 parent 0f8f625 commit 77b838f

File tree

6 files changed

+111
-215
lines changed

6 files changed

+111
-215
lines changed

SystemReady-band/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ This image comprise of single FAT file system partition recognized by UEFI: <br
166166
- /lib/modules/sbsa_acs.ko - SBSA Linux test kernel module
167167
- /bin/sbsa - SBSA Linux app
168168
- /usr/bin/edk2-test-parser - SCT results parser
169-
- /usr/bin/device_driver.sh - device driver script
169+
- /usr/bin/device_driver_sr.sh - device driver script
170170
- /usr/bin/log_parser - directory containing results post processing script
171171
- ramdisk-buildroot.img - ram disk file
172172

@@ -285,5 +285,4 @@ SystemReady ACS is distributed under Apache v2.0 License.
285285

286286
--------------
287287

288-
*Copyright (c) 2022-2024, Arm Limited and Contributors. All rights reserved.*
289-
288+
*Copyright (c) 2022-2025, Arm Limited and Contributors. All rights reserved.*

SystemReady-band/build-scripts/build-buildroot.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ do_build ()
6767

6868
cp $TOP_DIR/ramdisk/secure_init.sh root_fs_overlay/usr/bin/
6969
chmod +x root_fs_overlay/usr/bin/secure_init.sh
70-
cp $TOP_DIR/ramdisk/device_driver.sh root_fs_overlay/usr/bin/
71-
chmod +x root_fs_overlay/usr/bin/device_driver.sh
70+
cp $TOP_DIR/ramdisk/device_driver_sr.sh root_fs_overlay/usr/bin/
71+
chmod +x root_fs_overlay/usr/bin/device_driver_sr.sh
7272
cp $TOP_DIR/ramdisk/bsa.sh root_fs_overlay/bin/
7373
chmod +x root_fs_overlay/bin/bsa.sh
7474
cp $TOP_DIR/ramdisk/sbsa.sh root_fs_overlay/bin/

common/linux_scripts/device_driver.sh

Lines changed: 0 additions & 194 deletions
This file was deleted.
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
#!/bin/bash
2+
3+
# @file
4+
# Copyright (c) 2025, Arm Limited or its affiliates. All rights reserved.
5+
# SPDX-License-Identifier : Apache-2.0
6+
7+
# Licensed under the Apache License, Version 2.0 (the "License");
8+
# you may not use this file except in compliance with the License.
9+
# You may obtain a copy of the License at
10+
#
11+
# http://www.apache.org/licenses/LICENSE-2.0
12+
#
13+
# Unless required by applicable law or agreed to in writing, software
14+
# distributed under the License is distributed on an "AS IS" BASIS,
15+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
# See the License for the specific language governing permissions and
17+
# limitations under the License.
18+
19+
#This script reports the drivers in use for block devices, graphics cards, network interfaces, and PCIe devices on a Linux system
20+
21+
echo
22+
echo "Block Device Drivers Details"
23+
echo "----------------------------"
24+
echo ""
25+
printf "%10s %10s \n" "Device" "Driver"
26+
27+
for f in /sys/class/block/*; do
28+
dev=$(basename "$f")
29+
if driver_link=$(readlink "$f/device/driver" 2>/dev/null); then
30+
driver=$(basename "$driver_link")
31+
printf "%10s %10s \n" "$dev" "$driver"
32+
fi
33+
done
34+
echo
35+
echo
36+
37+
38+
echo "Graphics Device Driver Details"
39+
echo "------------------------------"
40+
echo ""
41+
lspci -k 2>/dev/null | grep -EA3 'VGA|3D|Display'
42+
echo
43+
echo
44+
45+
46+
echo "Network Device Drivers Details"
47+
echo "------------------------------"
48+
echo ""
49+
printf "%10s %30s (%s)\n" "Device" "Driver" "Status"
50+
51+
for f in /sys/class/net/*; do
52+
dev=$(basename "$f")
53+
addr=$(cat "$f/address" 2>/dev/null)
54+
operstate=$(cat "$f/operstate" 2>/dev/null)
55+
56+
if driver_link=$(readlink "$f/device/driver/module" 2>/dev/null); then
57+
driver=$(basename "$driver_link")
58+
else
59+
driver="N/A"
60+
fi
61+
62+
printf "%10s [%s] %10s (%s)\n" "$dev" "$addr" "$driver" "$operstate"
63+
done
64+
echo
65+
echo
66+
67+
68+
echo "PCIe Device Driver Details"
69+
echo "--------------------------"
70+
echo ""
71+
72+
lspci -vvv 2>/dev/null | awk '
73+
BEGIN {
74+
flag = 0;
75+
FS = ":"
76+
}
77+
/^[0-9A-Fa-f]*[:]*[0-9A-Fa-f][0-9A-Fa-f]:[0-9A-Fa-f][0-9A-Fa-f]\.[0-7]/ {
78+
if (flag == 1) {
79+
print " No driver found\n"
80+
}
81+
flag = 1
82+
print $0
83+
}
84+
{
85+
if (flag == 1 && index($0, "Kernel driver in use") > 0) {
86+
print $0
87+
flag = 0
88+
print ""
89+
}
90+
}
91+
END {
92+
if (flag == 1) {
93+
print " No driver found\n"
94+
}
95+
}'
96+
97+
echo
98+
echo

common/linux_scripts/init.sh

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,14 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then
152152
sleep 5
153153
echo "Linux Debug Dump - Completed"
154154

155+
# Linux Device Driver script run
156+
echo "Running Device Driver Matching Script"
157+
cd /usr/bin/
158+
./device_driver_sr.sh > /mnt/acs_results/linux_dump/device_driver.log
159+
cd -
160+
echo "Device Driver script run completed"
161+
sync /mnt
162+
sleep 5
155163

156164
# FWTS (SBBR) Execution
157165
echo "Executing FWTS for SBBR"
@@ -232,21 +240,6 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then
232240
echo "SCT result does not exist, cannot run edk2-test-parser tool cannot run"
233241
fi
234242

235-
236-
# Device Driver script run
237-
if [ -f "/mnt/acs_results/uefi_dump/devices.log" ] && [ -f "/mnt/acs_results/uefi_dump/drivers.log" ] && [ -f "/mnt/acs_results/uefi_dump/dh.log" ]; then
238-
echo "Running Device Driver Matching Script"
239-
cd /usr/bin/
240-
./device_driver.sh > /mnt/acs_results/linux_dump/device_driver.log
241-
cd -
242-
echo "Device Driver script run completed"
243-
sync /mnt
244-
sleep 5
245-
else
246-
echo "Devices/Driver/dh log does not exist, cannot run the script"
247-
fi
248-
249-
250243
# ACS log parser run
251244
echo "Running acs log parser tool "
252245
if [ -d "/mnt/acs_results" ]; then

common/tools/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ To display usage information, run:
2525
---
2626
This script streamlines the process of updating ACS configuration files in prebuilt images, incorporating error handling and automation. Additionally, it can be used to copy the ACS image results directory.
2727

28-
## Notes
28+
### Notes
2929

3030
- The script requires `sudo` privileges for mounting and copying files.
3131

0 commit comments

Comments
 (0)