-
Notifications
You must be signed in to change notification settings - Fork 2
/
collect-sample.sh
executable file
·56 lines (44 loc) · 1.1 KB
/
collect-sample.sh
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
#!/bin/bash
if [ $# -ne 1 ] ; then
echo >&2 "Usage: $0 <destination-dir>"
exit 1
fi
testdir=$1
if [ "$EUID" -ne 0 ] ; then
echo >&2 "This script needs root permission to read device info"
exit 1
fi
# /dev/cpu/*/cpuid
if [ -e /dev/cpu/0/cpuid ] ; then
for d in /dev/cpu/* ; do
mkdir -p "$1/$d"
dd if="$d/cpuid" of="$1/$d/cpuid" bs=16 count=1
done
fi
# /proc/cpuinfo
mkdir -p "$1/proc"
cp /proc/cpuinfo "$1/proc/cpuinfo"
# /proc/net/dev
mkdir -p "$1/proc/net"
cp /proc/net/dev "$1/proc/net/dev"
# /proc/sys/kernel, /proc/sys/abi
mkdir -p "$1/proc/sys"
cp -dR /proc/sys/kernel /proc/sys/abi "$1/proc/sys/"
# /proc/device-tree
if [ -e /proc/device-tree ] ; then
mkdir -p "$1/proc"
cp -dR /proc/device-tree "$1/proc/device-tree"
fi
# /proc/bus
cp -dR /proc/bus "$1/proc/"
# /sys
mkdir -p "$1/sys"
cp -dR /sys/{devices,class,bus,block,firmware,power} "$1/sys/"
# /sys/kernel/debug/usb/devices
mkdir -p "$1/sys/kernel/debug/usb"
cp /sys/kernel/debug/usb/devices "$1/sys/kernel/debug/usb/devices"
# sysconf
mkdir -p "$1/sysconf"
./dump_sysconf.py "$1"
# arch
uname -m >"$1/arch"