[toc]
单板原型
编译内核
$ cd /home/rlk/rlk/runninglinuxkernel_5.0
$ ./run_rlk_arm64.sh build_kernel
生成 /home/rlk/rlk/runninglinuxkernel_5.0/arch/arm64/boot/Image.
编译文件系统
$ cd /home/rlk/rlk/runninglinuxkernel_5.0
$ ./run_rlk_arm64.sh build_rootfs
生成 /home/rlk/rlk/runninglinuxkernel_5.0/rootfs_debian_arm64.ext4.
编译内核模块
在vmware的虚拟机中编译ko(即交叉编译)
$ cd
/home/rlk/rlk/runninglinuxkernel_5.0/kmodules/rlk_lab/rlk_basic/chapter_5_module/lab1_simple_module
$sudo su //注意交叉编译ko需要root用户
# export ARCH=arm64
# export CROSS_COMPILE=aarch64-linux-gnu-
# export BASEINCLUDE=/home/rlk/rlk/runninglinuxkernel_5.0
# make
# cp test.ko runninglinuxkernel_5.0/kmodules
在qemu的开发板的mnt目录可以看到 test.ko,加载该内核模块:
$ insmod test.ko
在qemu的单板中自己编译ko
启动 QEMU+runninglinuxkernel。
$ ./run_rlk_arm64.sh run
进入本实验的参考代码。
# cd /mnt/rlk_lab/rlk_basic/chapter_5_module/lab1_simple_module
直接输入 make 命令来编译内核模块。
benshushu:lab1_simple_module# make
使用 insmod 命令来加载模块。
benshushu:lab1_simple_module# insmod mytest.ko
单板的启动
登录用户名root,密码123,在/home/rlk/rlk/runninglinuxkernel_5.0 下执行:
$ ./run_rlk_arm64.sh run
qemu单板和vmware之间传递文件
vmware的 /home/rlk/rlk/runninglinuxkernel_5.0/kmodules 和qemu单板的/mnt 是同步的。
常用命令
benshushu:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux buster/sid"
NAME="Debian GNU/Linux"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
benshushu:/# cat /proc/sys/kernel/printk
8 4 1 7
benshushu:~# lsmod
Module Size Used by
benshushu:proc# uname -a
Linux benshushu 5.0.0+ #1 SMP Sun Mar 5 23:53:17 CST 2023 aarch64 GNU/Linux
benshushu:proc# dumpsys meminfo
-bash: dumpsys: command not found
benshushu:proc# busybox i2cdetect -l
i2cdetect: can't open '/sys/class/i2c-dev': No such file or directory
benshushu:proc# apt update
Get:1 http://mirrors.ustc.edu.cn/debian unstable InRelease [195 kB]
Err:1 http://mirrors.ustc.edu.cn/debian unstable InRelease
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY 6ED0E7B82643E131
Reading package lists... Done
W: GPG error: http://mirrors.ustc.edu.cn/debian unstable InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0E98404D386FA1D9 NO_PUBKEY 6ED0E7B82643E131
E: The repository 'http://mirrors.ustc.edu.cn/debian unstable InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
benshushu:proc#
benshushu:proc# busybox --help
BusyBox v1.30.1 (Debian 1:1.30.1-4) multi-call binary.
BusyBox is copyrighted by many authors between 1998-2015.
Licensed under GPLv2. See source distribution for detailed
copyright notices.
Usage: busybox [function [arguments]...]
or: busybox --list[-full]
or: busybox --show SCRIPT
or: busybox --install [-s] [DIR]
or: function [arguments]...
BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable. Most people will create a
link to busybox for each function they wish to use and BusyBox
will act like whatever it was invoked as.
Currently defined functions:
[, [[, acpid, adjtimex, ar, arch, arp, arping, ash, awk, basename, bc,
blkdiscard, blockdev, brctl, bunzip2, bzcat, bzip2, cal, cat, chgrp,
chmod, chown, chroot, chvt, clear, cmp, cp, cpio, cttyhack, cut, date,
dc, dd, deallocvt, depmod, devmem, df, diff, dirname, dmesg,
dnsdomainname, dos2unix, du, dumpkmap, dumpleases, echo, egrep, env,
expand, expr, factor, fallocate, false, fatattr, fgrep, find, fold,
free, freeramdisk, fsfreeze, fstrim, ftpget, ftpput, getopt, getty,
grep, groups, gunzip, gzip, halt, head, hexdump, hostid, hostname,
httpd, hwclock, i2cdetect, i2cdump, i2cget, i2cset, id, ifconfig,
ifdown, ifup, init, insmod, ionice, ip, ipcalc, ipneigh, kill, killall,
klogd, last, less, link, linux32, linux64, linuxrc, ln, loadfont,
loadkmap, logger, login, logname, logread, losetup, ls, lsmod, lsscsi,
lzcat, lzma, lzop, md5sum, mdev, microcom, mkdir, mkdosfs, mke2fs,
mkfifo, mknod, mkpasswd, mkswap, mktemp, modinfo, modprobe, more,
mount, mt, mv, nameif, nc, netstat, nl, nologin, nproc, nsenter,
nslookup, nuke, od, openvt, partprobe, paste, patch, pidof, ping,
ping6, pivot_root, poweroff, printf, ps, pwd, rdate, readlink,
realpath, reboot, renice, reset, resume, rev, rm, rmdir, rmmod, route,
rpm, rpm2cpio, run-init, run-parts, sed, seq, setkeycodes, setpriv,
setsid, sh, sha1sum, sha256sum, sha512sum, shred, shuf, sleep, sort,
ssl_client, start-stop-daemon, stat, strings, stty, svc, svok, swapoff,
swapon, switch_root, sync, sysctl, syslogd, tac, tail, tar, taskset,
tee, telnet, test, tftp, time, timeout, top, touch, tr, traceroute,
traceroute6, true, truncate, tty, ubirename, udhcpc, udhcpd, uevent,
umount, uname, uncompress, unexpand, uniq, unix2dos, unlink, unlzma,
unshare, unxz, unzip, uptime, usleep, uudecode, uuencode, vconfig, vi,
w, watch, watchdog, wc, wget, which, who, whoami, xargs, xxd, xz,
xzcat, yes, zcat
benshushu:sys# ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 4 13:02 ? 00:00:16 /sbin/init noinitrd nokaslr
root 2 0 0 13:02 ? 00:00:00 [kthreadd]
root 3 2 0 13:02 ? 00:00:00 [rcu_gp]
root 4 2 0 13:02 ? 00:00:00 [rcu_par_gp]
root 6 2 0 13:02 ? 00:00:00 [kworker/0:0H-kblockd]
root 8 2 0 13:02 ? 00:00:00 [mm_percpu_wq]
root 9 2 0 13:02 ? 00:00:00 [ksoftirqd/0]
root 10 2 0 13:02 ? 00:00:02 [rcu_sched]
root 11 2 0 13:02 ? 00:00:00 [migration/0]
root 12 2 0 13:02 ? 00:00:00 [kworker/0:1-mm_percpu_wq]
root 13 2 0 13:02 ? 00:00:00 [cpuhp/0]
root 14 2 0 13:02 ? 00:00:00 [cpuhp/1]
root 15 2 0 13:02 ? 00:00:00 [migration/1]
root 16 2 0 13:02 ? 00:00:00 [ksoftirqd/1]
root 18 2 0 13:02 ? 00:00:00 [kworker/1:0H-kblockd]
root 19 2 0 13:02 ? 00:00:00 [cpuhp/2]
root 20 2 0 13:02 ? 00:00:00 [migration/2]
root 21 2 0 13:02 ? 00:00:00 [ksoftirqd/2]
root 23 2 0 13:02 ? 00:00:00 [kworker/2:0H-kblockd]
root 24 2 0 13:02 ? 00:00:00 [cpuhp/3]
root 25 2 0 13:02 ? 00:00:00 [migration/3]
root 26 2 0 13:02 ? 00:00:00 [ksoftirqd/3]
root 27 2 0 13:02 ? 00:00:00 [kworker/3:0-cgroup_destroy]
root 28 2 0 13:02 ? 00:00:00 [kworker/3:0H-kblockd]
root 29 2 0 13:02 ? 00:00:00 [kdevtmpfs]
root 30 2 0 13:02 ? 00:00:00 [netns]
root 31 2 0 13:02 ? 00:00:00 [kworker/3:1-mm_percpu_wq]
root 32 2 0 13:02 ? 00:00:00 [kworker/1:1-events_power_efficiroot 33 2 0 13:02 ? 00:00:00 [kworker/2:1-mm_percpu_wq]
root 34 2 0 13:02 ? 00:00:00 [khungtaskd]
root 35 2 0 13:02 ? 00:00:00 [oom_reaper]
root 36 2 0 13:02 ? 00:00:00 [writeback]
root 37 2 0 13:02 ? 00:00:00 [kcompactd0]
root 38 2 0 13:02 ? 00:00:00 [ksmd]
root 39 2 0 13:02 ? 00:00:00 [khugepaged]
root 40 2 0 13:02 ? 00:00:00 [crypto]
root 41 2 0 13:02 ? 00:00:00 [kintegrityd]
root 42 2 0 13:02 ? 00:00:00 [kblockd]
root 43 2 0 13:02 ? 00:00:00 [devfreq_wq]
root 44 2 0 13:02 ? 00:00:00 [watchdogd]
root 45 2 0 13:02 ? 00:00:00 [kswapd0]
root 47 2 0 13:02 ? 00:00:00 [kworker/u8:1-events_unbound]
root 110 2 0 13:02 ? 00:00:00 [kthrotld]
root 112 2 0 13:02 ? 00:00:00 [irq/38-arm-smmu]
root 113 2 0 13:02 ? 00:00:00 [kworker/1:1H-kblockd]
root 114 2 0 13:02 ? 00:00:00 [vfio-irqfd-clea]
root 115 2 0 13:02 ? 00:00:00 [ion_system_heap]
root 116 2 0 13:02 ? 00:00:00 [ipv6_addrconf]
root 122 2 0 13:02 ? 00:00:00 [kworker/2:2-cgroup_destroy]
root 123 2 0 13:02 ? 00:00:00 [kworker/3:1H-kblockd]
root 124 2 0 13:02 ? 00:00:00 [kworker/0:1H-kblockd]
root 125 2 0 13:02 ? 00:00:00 [kworker/2:1H-kblockd]
root 126 2 0 13:02 ? 00:00:00 [jbd2/vda-8]
root 127 2 0 13:02 ? 00:00:00 [ext4-rsv-conver]
root 149 1 1 13:02 ? 00:00:04 /lib/systemd/systemd-journald
root 151 2 0 13:02 ? 00:00:00 [kworker/1:2-cgroup_destroy]
root 153 2 0 13:02 ? 00:00:00 [kworker/0:2-cgroup_destroy]
root 157 2 0 13:02 ? 00:00:00 [kworker/3:2-events]
root 161 1 0 13:02 ? 00:00:02 /lib/systemd/systemd-udevd
root 217 1 0 13:02 ? 00:00:01 /usr/sbin/rsyslogd -n -iNONE
avahi 219 1 0 13:02 ? 00:00:01 avahi-daemon: running [benshushumessage+ 228 1 0 13:02 ? 00:00:02 /usr/bin/dbus-daemon --system --avahi 231 219 0 13:02 ? 00:00:00 avahi-daemon: chroot helperroot 232 1 0 13:02 ? 00:00:00 /sbin/wpa_supplicant -u -s -O /rroot 238 1 0 13:02 ? 00:00:01 /lib/systemd/systemd-logindroot 239 1 0 13:02 ? 00:00:00 /usr/sbin/cron -froot 267 2 0 13:02 ? 00:00:00 [kworker/u8:3-events_unbound]
root 350 1 0 13:03 tty1 00:00:00 /sbin/agetty -o -p -- \u --nocle
root 352 1 0 13:03 ttyAMA0 00:00:00 /bin/login -p --
root 370 1 0 13:03 ? 00:00:00 /usr/sbin/dhcpcd
root 412 1 0 13:03 ? 00:00:00 /sbin/dhclient -4 -v -i -pf /run
systemd+ 604 1 0 13:03 ? 00:00:01 /lib/systemd/systemd-timesyncd
root 666 1 0 13:04 ? 00:00:00 /lib/systemd/systemd --user
root 669 666 0 13:04 ? 00:00:00 (sd-pam)
root 681 352 0 13:04 ttyAMA0 00:00:00 -bash
root 697 2 0 13:07 ? 00:00:00 [kworker/3:3]
root 698 1 0 13:07 ? 00:00:00 /usr/sbin/sshd -t
root 699 681 0 13:08 ttyAMA0 00:00:00 ps -ef
benshushu:sys# ps -ef |grep service
root 710 681 0 13:11 ttyAMA0 00:00:00 grep service
benshushu:sys# ps -ef |grep thermal
root 712 681 0 13:11 ttyAMA0 00:00:00 grep thermal
benshushu:sys#
top
- 13:01:50 up 5 min, 1 user, load average: 0.05, 0.43, 0.28
Tasks: 78 total, 1 running, 77 sleeping, 0 stopped, 0 zombie
%Cpu(s): 5.8 us, 5.8 sy, 0.0 ni, 88.5 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 719.3 total, 548.0 free, 53.3 used, 118.0 buff/cache
MiB Swap: 0.0 total, 0.0 free, 0.0 used. 588.2 avail Mem
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
747 root 20 0 7584 3040 2640 R 18.2 0.4 0:00.20 top
10 root 20 0 0 0 0 I 4.5 0.0 0:03.34 rcu_sched
1 root 20 0 165160 9392 6996 S 0.0 1.3 0:19.70 systemd
2 root 20 0 0 0 0 S 0.0 0.0 0:00.13 kthreadd
3 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_gp
4 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 rcu_par_gp
5 root 20 0 0 0 0 I 0.0 0.0 0:00.01 kworker/0+
6 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 kworker/0+
7 root 20 0 0 0 0 I 0.0 0.0 0:00.48 kworker/u+
8 root 0 -20 0 0 0 I 0.0 0.0 0:00.00 mm_percpu+
9 root 20 0 0 0 0 S 0.0 0.0 0:00.30 ksoftirqd+
11 root rt 0 0 0 0 S 0.0 0.0 0:00.12 migration+
12 root 20 0 0 0 0 I 0.0 0.0 0:00.34 kworker/0+
13 root 20 0 0 0 0 S 0.0 0.0 0:00.01 cpuhp/0
14 root 20 0 0 0 0 S 0.0 0.0 0:00.01 cpuhp/1
15 root rt 0 0 0 0 S 0.0 0.0 0:00.11 migration+
16 root 20 0 0 0 0 S 0.0 0.0 0:00.15 ksoftirqd+
benshushu:proc# fdisk -l
Disk /dev/vda: 2 GiB, 2147483648 bytes, 4194304 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
benshushu:proc# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 254:0 0 2G 0 disk /
benshushu:proc# cat iomem
09000000-09000fff : pl011@9000000
09000000-09000fff : pl011@9000000
09010000-09010fff : pl031@9010000
09010000-09010fff : rtc-pl031
09030000-09030fff : pl061@9030000
09030000-09030fff : pl061@9030000
09050000-0906ffff : smmuv3@9050000
0a003e00-0a003fff : a003e00.virtio_mmio
10000000-3efeffff : pcie@10000000
10000000-1003ffff : 0000:00:01.0
40000000-7fffffff : System RAM
40080000-41bfffff : Kernel code
41c00000-4208ffff : reserved
42090000-42240fff : Kernel data
48000000-480fffff : reserved
6ac00000-6fbfffff : reserved
6fd77000-6fdeefff : reserved
6fdf1000-6fdf2fff : reserved
6fdf3000-6fdf7fff : reserved
6fdf8000-6fdfffff : reserved
6fe00000-7fdfffff : Crash kernel
7fe00000-7fe00fff : reserved
7fe01000-7fe03fff : reserved
7fe04000-7fffffff : reserved
4010000000-401fffffff : PCI ECAM
8000000000-ffffffffff : pcie@10000000
8000000000-8000003fff : 0000:00:01.0
8000000000-8000003fff : virtio-pci-modern
8000004000-8000007fff : 0000:00:02.0
8000004000-8000007fff : virtio-pci-modern
benshushu:proc# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 2.0G 1.1G 788M 58% /
devtmpfs 326M 0 326M 0% /dev
tmpfs 360M 0 360M 0% /dev/shm
tmpfs 360M 9.3M 351M 3% /run
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 360M 0 360M 0% /sys/fs/cgroup
kmod_mount 982G 20G 913G 3% /mnt
tmpfs 72M 0 72M 0% /run/user/0
benshushu:sys# zcat /proc/config.gz
gzip: /proc/config.gz: No such file or directory
proc文件系统
benshushu:~# cat /proc/cpuinfo
processor : 0
BogoMIPS : 125.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm flagm sb paca pacg
CPU implementer : 0x00
CPU architecture: 8
CPU variant : 0x0
CPU part : 0x051
CPU revision : 0
processor : 1
BogoMIPS : 125.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm flagm sb paca pacg
CPU implementer : 0x00
CPU architecture: 8
CPU variant : 0x0
CPU part : 0x051
CPU revision : 0
processor : 2
BogoMIPS : 125.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm flagm sb paca pacg
CPU implementer : 0x00
CPU architecture: 8
CPU variant : 0x0
CPU part : 0x051
CPU revision : 0
processor : 3
BogoMIPS : 125.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm jscvt fcma dcpop sha3 sm3 sm4 asimddp sha512 sve asimdfhm flagm sb paca pacg
CPU implementer : 0x00
CPU architecture: 8
CPU variant : 0x0
CPU part : 0x051
CPU revision : 0
benshushu:~# cat /proc/meminfo
MemTotal: 736564 kB
MemFree: 562572 kB
MemAvailable: 602580 kB
Buffers: 6068 kB
Cached: 97292 kB
SwapCached: 0 kB
Active: 46724 kB
Inactive: 72496 kB
Active(anon): 16016 kB
Inactive(anon): 9300 kB
Active(file): 30708 kB
Inactive(file): 63196 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 24 kB
Writeback: 0 kB
AnonPages: 15804 kB
Mapped: 19676 kB
Shmem: 9460 kB
KReclaimable: 16108 kB
Slab: 36496 kB
SReclaimable: 16108 kB
SUnreclaim: 20388 kB
KernelStack: 2912 kB
PageTables: 764 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 368280 kB
Committed_AS: 102636 kB
VmallocTotal: 135290159040 kB
VmallocUsed: 0 kB
VmallocChunk: 0 kB
Percpu: 912 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
ShmemHugePages: 0 kB
ShmemPmdMapped: 0 kB
CmaTotal: 65536 kB
CmaFree: 65244 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
Hugetlb: 0 kB
benshushu:proc# cat /proc/mounts
/dev/root / ext4 rw,relatime 0 0
sysfs /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0
proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0
devtmpfs /dev devtmpfs rw,nosuid,size=333176k,nr_inodes=83294,mode=755 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /run tmpfs rw,nosuid,nodev,mode=755 0 0
tmpfs /run/lock tmpfs rw,nosuid,nodev,noexec,relatime,size=5120k 0 0
tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,mode=755 0 0
cgroup2 /sys/fs/cgroup/unified cgroup2 rw,nosuid,nodev,noexec,relatime,nsdelegate 0 0
cgroup /sys/fs/cgroup/systemd cgroup rw,nosuid,nodev,noexec,relatime,xattr,name=systemd 0 0
pstore /sys/fs/pstore pstore rw,nosuid,nodev,noexec,relatime 0 0
bpf /sys/fs/bpf bpf rw,nosuid,nodev,noexec,relatime,mode=700 0 0
cgroup /sys/fs/cgroup/devices cgroup rw,nosuid,nodev,noexec,relatime,devices 0 0
cgroup /sys/fs/cgroup/blkio cgroup rw,nosuid,nodev,noexec,relatime,blkio 0 0
cgroup /sys/fs/cgroup/cpu,cpuacct cgroup rw,nosuid,nodev,noexec,relatime,cpu,cpuacct 0 0
cgroup /sys/fs/cgroup/freezer cgroup rw,nosuid,nodev,noexec,relatime,freezer 0 0
cgroup /sys/fs/cgroup/cpuset cgroup rw,nosuid,nodev,noexec,relatime,cpuset 0 0
cgroup /sys/fs/cgroup/memory cgroup rw,nosuid,nodev,noexec,relatime,memory 0 0
cgroup /sys/fs/cgroup/perf_event cgroup rw,nosuid,nodev,noexec,relatime,perf_event 0 0
cgroup /sys/fs/cgroup/pids cgroup rw,nosuid,nodev,noexec,relatime,pids 0 0
systemd-1 /proc/sys/fs/binfmt_misc autofs rw,relatime,fd=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=1384 0 0
hugetlbfs /dev/hugepages hugetlbfs rw,relatime,pagesize=2M 0 0
debugfs /sys/kernel/debug debugfs rw,relatime 0 0
kmod_mount /mnt 9p rw,sync,dirsync,relatime,access=client,trans=virtio 0 0
tmpfs /run/user/0 tmpfs rw,nosuid,nodev,relatime,size=73656k,mode=700 0 0
benshushu:proc# cat /proc/cmdline
noinitrd nokaslr loglevel=8 sched_debug root=/dev/vda rootfstype=ext4 rw crashkernel=256M vfio.dyndbg=+pflmt irq_gic_v3_its.dyndbg=+pflmt iommu.dyndbg=+pflmt irqdomain.dyndbg=+pflmt
benshushu:proc# cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
3: 10149 11698 10371 10162 GICv3 27 Level arch_timer
36: 2193 0 0 0 GICv3 79 Edge virtio0
38: 0 0 0 0 GICv3 106 Edge arm-smmu-v3-evtq
41: 0 0 0 0 GICv3 109 Edge arm-smmu-v3-gerror
42: 0 0 0 0 GICv3 34 Level rtc-pl031
43: 172 0 0 0 GICv3 33 Level uart-pl011
44: 0 0 0 0 GICv3 23 Level arm-pmu
45: 16 0 0 0 GICv3 36 Level virtio1
46: 6 0 0 0 GICv3 37 Level virtio2
IPI0: 2134 1865 2002 1576 Rescheduling interrupts
IPI1: 303 264 132 251 Function call interrupts
IPI2: 0 0 0 0 CPU stop interrupts
IPI3: 0 0 0 0 CPU stop (for crash dump) interrupts
IPI4: 0 0 0 0 Timer broadcast interrupts
IPI5: 0 0 0 0 IRQ work interrupts
IPI6: 0 0 0 0 CPU wake-up interrupts
Err: 0
benshushu:proc# cat /proc/devices
Character devices:
1 mem
4 /dev/vc/0
4 tty
4 ttyS
5 /dev/tty
5 /dev/console
5 /dev/ptmx
5 ttyprintk
7 vcs
10 misc
13 input
29 fb
128 ptm
136 pts
204 ttyAMA
248 binder
249 vfio
250 bsg
251 watchdog
252 rtc
253 dax
254 gpiochip
Block devices:
7 loop
254 virtblk
259 blkext
benshushu:sys# cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
3: 9296 11463 9519 8916 GICv3 27 Level arch_timer
36: 2704 0 0 0 GICv3 79 Edge virtio0
38: 0 0 0 0 GICv3 106 Edge arm-smmu-v3-evtq
41: 0 0 0 0 GICv3 109 Edge arm-smmu-v3-gerror
42: 0 0 0 0 GICv3 34 Level rtc-pl031
43: 89 0 0 0 GICv3 33 Level uart-pl011
44: 0 0 0 0 GICv3 23 Level arm-pmu
45: 25 0 0 0 GICv3 36 Level virtio1
46: 8 0 0 0 GICv3 37 Level virtio2
IPI0: 1805 2159 1686 1513 Rescheduling interrupts
IPI1: 232 298 236 196 Function call interrupts
IPI2: 0 0 0 0 CPU stop interrupts
IPI3: 0 0 0 0 CPU stop (for crash dump) interrupts
IPI4: 0 0 0 0 Timer broadcast interrupts
IPI5: 0 0 0 0 IRQ work interrupts
IPI6: 0 0 0 0 CPU wake-up interrupts
Err: 0
sys文件系统
动态输出打印(page 345) benshushu:debug# cat /sys/kernel/debug/dynamic_debug/control
# filename:lineno [module]function flags format
init/main.c:770 [main]initcall_blacklist =p "blacklisting initcall %s\012"
init/main.c:803 [main]initcall_blacklisted =p "initcall %s blacklisted\012"
.....
针对 pr_debug()/dev_dbg()函数.打印级别有8级:
#define KERN_EMERG KERN_SOH "0" /* system is unusable */
#define KERN_ALERT KERN_SOH "1" /* action must be taken immediately */
#define KERN_CRIT KERN_SOH "2" /* critical conditions */
#define KERN_ERR KERN_SOH "3" /* error conditions */
#define KERN_WARNING KERN_SOH "4" /* warning conditions */
#define KERN_NOTICE KERN_SOH "5" /* normal but significant condition */
#define KERN_INFO KERN_SOH "6" /* informational */
#define KERN_DEBUG KERN_SOH "7" /* debug-level messages */
除了pr_debug()是可以动态的,其他7级(pr_info/pr_notice/pr_warn/pr_err/pr_crit/pr_alert/pr_emerg)都是固定级别的.
benshushu:sys# ls -al /sys/devices/platform/
total 0
drwxr-xr-x 49 root root 0 Jun 23 13:11 .
drwxr-xr-x 11 root root 0 Jun 23 13:04 ..
drwxr-xr-x 3 root root 0 Jun 23 13:03 0.flash
drwxr-xr-x 4 root root 0 Jun 23 13:03 4010000000.pcie
drwxr-xr-x 4 root root 0 Jun 23 13:03 9000000.pl011
drwxr-xr-x 4 root root 0 Jun 23 13:03 9010000.pl031
drwxr-xr-x 3 root root 0 Jun 23 13:03 9020000.fw-cfg
drwxr-xr-x 5 root root 0 Jun 23 13:03 9030000.pl061
drwxr-xr-x 4 root root 0 Jun 23 13:03 9050000.smmuv3
drwxr-xr-x 3 root root 0 Jun 23 13:03 a000000.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a000200.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a000400.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a000600.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a000800.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a000a00.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a000c00.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a000e00.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a001000.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a001200.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a001400.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a001600.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a001800.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a001a00.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a001c00.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a001e00.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a002000.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a002200.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a002400.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a002600.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a002800.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a002a00.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a002c00.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a002e00.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a003000.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a003200.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a003400.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a003600.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a003800.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a003a00.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 a003c00.virtio_mmio
drwxr-xr-x 4 root root 0 Jun 23 13:03 a003e00.virtio_mmio
drwxr-xr-x 3 root root 0 Jun 23 13:03 alarmtimer
drwxr-xr-x 3 root root 0 Jun 23 13:03 gpio-keys
drwxr-xr-x 3 root root 0 Jun 23 13:03 platform@c000000
drwxr-xr-x 3 root root 0 Jun 23 13:03 pmu
drwxr-xr-x 2 root root 0 Jun 23 13:11 power
drwxr-xr-x 3 root root 0 Jun 23 13:03 psci
drwxr-xr-x 4 root root 0 Jun 23 13:03 serial8250
drwxr-xr-x 3 root root 0 Jun 23 13:03 timer
-rw-r--r-- 1 root root 4096 Jun 23 13:03 uevent
其他文件系统
benshushu:sys# ls -al /dev
total 4
drwxr-xr-x 10 root root 2940 Jun 23 13:03 .
drwxr-xr-x 21 root root 4096 Feb 15 14:58 ..
crw-r--r-- 1 root root 10, 235 Jun 23 13:03 autofs
crw------- 1 root root 10, 60 Jun 23 13:03 binder
drwxr-xr-x 2 root root 220 Jun 23 13:03 block
drwxr-xr-x 2 root root 2440 Jun 23 13:03 char
crw------- 1 root root 5, 1 Jun 23 13:03 console
lrwxrwxrwx 1 root root 11 Jun 23 13:03 core -> /proc/kcore
crw------- 1 root root 10, 57 Jun 23 13:03 cpu_dma_latency
crw------- 1 root root 10, 203 Jun 23 13:03 cuse
drwxr-xr-x 4 root root 80 Jun 23 13:03 disk
lrwxrwxrwx 1 root root 13 Jun 23 13:03 fd -> /proc/self/fd
crw-rw-rw- 1 root root 1, 7 Jun 23 13:03 full
crw-rw-rw- 1 root root 10, 229 Jun 23 13:03 fuse
crw------- 1 root root 254, 0 Jun 23 13:03 gpiochip0
drwxr-xr-x 2 root root 0 Jun 23 13:03 hugepages
crw------- 1 root root 10, 59 Jun 23 13:03 hwbinder
lrwxrwxrwx 1 root root 12 Jun 23 13:03 initctl -> /run/initctl
drwxr-xr-x 2 root root 60 Jan 1 1970 input
crw------- 1 root root 10, 62 Jun 23 13:03 ion
crw-r--r-- 1 root root 1, 11 Jun 23 13:03 kmsg
lrwxrwxrwx 1 root root 28 Jun 23 13:03 log -> /run/systemd/journal/dev-log
crw-rw---- 1 root disk 10, 237 Jun 23 13:03 loop-control
brw-rw---- 1 root disk 7, 0 Jun 23 13:03 loop0
brw-rw---- 1 root disk 7, 1 Jun 23 13:03 loop1
brw-rw---- 1 root disk 7, 2 Jun 23 13:03 loop2
brw-rw---- 1 root disk 7, 3 Jun 23 13:03 loop3
brw-rw---- 1 root disk 7, 4 Jun 23 13:03 loop4
brw-rw---- 1 root disk 7, 5 Jun 23 13:03 loop5
brw-rw---- 1 root disk 7, 6 Jun 23 13:03 loop6
brw-rw---- 1 root disk 7, 7 Jun 23 13:03 loop7
crw-r----- 1 root kmem 1, 1 Jun 23 13:03 mem
crw------- 1 root root 10, 54 Jun 23 13:03 memory_bandwidth
crw------- 1 root root 10, 56 Jun 23 13:03 network_latency
crw------- 1 root root 10, 55 Jun 23 13:03 network_throughput
crw-rw-rw- 1 root root 1, 3 Jun 23 13:03 null
crw-r----- 1 root kmem 1, 4 Jun 23 13:03 port
crw------- 1 root root 10, 1 Jun 23 13:03 psaux
crw-rw-rw- 1 root tty 5, 2 Jun 23 13:03 ptmx
drwxr-xr-x 2 root root 0 Jun 23 13:03 pts
crw-rw-rw- 1 root root 1, 8 Jun 23 13:03 random
lrwxrwxrwx 1 root root 4 Jun 23 13:03 rtc -> rtc0
crw------- 1 root root 252, 0 Jun 23 13:03 rtc0
drwxrwxrwt 2 root root 40 Jun 23 13:03 shm
crw------- 1 root root 10, 231 Jun 23 13:03 snapshot
lrwxrwxrwx 1 root root 15 Jun 23 13:03 stderr -> /proc/self/fd/2
lrwxrwxrwx 1 root root 15 Jun 23 13:03 stdin -> /proc/self/fd/0
lrwxrwxrwx 1 root root 15 Jun 23 13:03 stdout -> /proc/self/fd/1
crw-rw-rw- 1 root tty 5, 0 Jun 23 13:03 tty
crw--w---- 1 root tty 4, 0 Jun 23 13:03 tty0
crw--w---- 1 root tty 4, 1 Jun 23 13:03 tty1
crw--w---- 1 root tty 4, 10 Jun 23 13:03 tty10
crw--w---- 1 root tty 4, 11 Jun 23 13:03 tty11
crw--w---- 1 root tty 4, 12 Jun 23 13:03 tty12
crw--w---- 1 root tty 4, 13 Jun 23 13:03 tty13
crw--w---- 1 root tty 4, 14 Jun 23 13:03 tty14
crw--w---- 1 root tty 4, 15 Jun 23 13:03 tty15
crw--w---- 1 root tty 4, 16 Jun 23 13:03 tty16
crw--w---- 1 root tty 4, 17 Jun 23 13:03 tty17
crw--w---- 1 root tty 4, 18 Jun 23 13:03 tty18
crw--w---- 1 root tty 4, 19 Jun 23 13:03 tty19
crw--w---- 1 root tty 4, 2 Jun 23 13:03 tty2
crw--w---- 1 root tty 4, 20 Jun 23 13:03 tty20
crw--w---- 1 root tty 4, 21 Jun 23 13:03 tty21
crw--w---- 1 root tty 4, 22 Jun 23 13:03 tty22
crw--w---- 1 root tty 4, 23 Jun 23 13:03 tty23
crw--w---- 1 root tty 4, 24 Jun 23 13:03 tty24
crw--w---- 1 root tty 4, 25 Jun 23 13:03 tty25
crw--w---- 1 root tty 4, 26 Jun 23 13:03 tty26
crw--w---- 1 root tty 4, 27 Jun 23 13:03 tty27
crw--w---- 1 root tty 4, 28 Jun 23 13:03 tty28
crw--w---- 1 root tty 4, 29 Jun 23 13:03 tty29
crw--w---- 1 root tty 4, 3 Jun 23 13:03 tty3
crw--w---- 1 root tty 4, 30 Jun 23 13:03 tty30
crw--w---- 1 root tty 4, 31 Jun 23 13:03 tty31
crw--w---- 1 root tty 4, 32 Jun 23 13:03 tty32
crw--w---- 1 root tty 4, 33 Jun 23 13:03 tty33
crw--w---- 1 root tty 4, 34 Jun 23 13:03 tty34
crw--w---- 1 root tty 4, 35 Jun 23 13:03 tty35
crw--w---- 1 root tty 4, 36 Jun 23 13:03 tty36
crw--w---- 1 root tty 4, 37 Jun 23 13:03 tty37
crw--w---- 1 root tty 4, 38 Jun 23 13:03 tty38
crw--w---- 1 root tty 4, 39 Jun 23 13:03 tty39
crw--w---- 1 root tty 4, 4 Jun 23 13:03 tty4
crw--w---- 1 root tty 4, 40 Jun 23 13:03 tty40
crw--w---- 1 root tty 4, 41 Jun 23 13:03 tty41
crw--w---- 1 root tty 4, 42 Jun 23 13:03 tty42
crw--w---- 1 root tty 4, 43 Jun 23 13:03 tty43
crw--w---- 1 root tty 4, 44 Jun 23 13:03 tty44
crw--w---- 1 root tty 4, 45 Jun 23 13:03 tty45
crw--w---- 1 root tty 4, 46 Jun 23 13:03 tty46
crw--w---- 1 root tty 4, 47 Jun 23 13:03 tty47
crw--w---- 1 root tty 4, 48 Jun 23 13:03 tty48
crw--w---- 1 root tty 4, 49 Jun 23 13:03 tty49
crw--w---- 1 root tty 4, 5 Jun 23 13:03 tty5
crw--w---- 1 root tty 4, 50 Jun 23 13:03 tty50
crw--w---- 1 root tty 4, 51 Jun 23 13:03 tty51
crw--w---- 1 root tty 4, 52 Jun 23 13:03 tty52
crw--w---- 1 root tty 4, 53 Jun 23 13:03 tty53
crw--w---- 1 root tty 4, 54 Jun 23 13:03 tty54
crw--w---- 1 root tty 4, 55 Jun 23 13:03 tty55
crw--w---- 1 root tty 4, 56 Jun 23 13:03 tty56
crw--w---- 1 root tty 4, 57 Jun 23 13:03 tty57
crw--w---- 1 root tty 4, 58 Jun 23 13:03 tty58
crw--w---- 1 root tty 4, 59 Jun 23 13:03 tty59
crw--w---- 1 root tty 4, 6 Jun 23 13:03 tty6
crw--w---- 1 root tty 4, 60 Jun 23 13:03 tty60
crw--w---- 1 root tty 4, 61 Jun 23 13:03 tty61
crw--w---- 1 root tty 4, 62 Jun 23 13:03 tty62
crw--w---- 1 root tty 4, 63 Jun 23 13:03 tty63
crw--w---- 1 root tty 4, 7 Jun 23 13:03 tty7
crw--w---- 1 root tty 4, 8 Jun 23 13:03 tty8
crw--w---- 1 root tty 4, 9 Jun 23 13:03 tty9
crw------- 1 root tty 204, 64 Jun 23 2024 ttyAMA0
crw-rw---- 1 root dialout 4, 64 Jun 23 13:03 ttyS0
crw-rw---- 1 root dialout 4, 65 Jun 23 13:03 ttyS1
crw-rw---- 1 root dialout 4, 66 Jun 23 13:03 ttyS2
crw-rw---- 1 root dialout 4, 67 Jun 23 13:03 ttyS3
crw------- 1 root root 5, 3 Jun 23 13:03 ttyprintk
crw------- 1 root root 10, 61 Jun 23 13:03 udmabuf
crw-rw-rw- 1 root root 1, 9 Jun 23 13:03 urandom
crw-rw---- 1 root tty 7, 0 Jun 23 13:03 vcs
crw-rw---- 1 root tty 7, 1 Jun 23 13:03 vcs1
crw-rw---- 1 root tty 7, 2 Jun 23 13:03 vcs2
crw-rw---- 1 root tty 7, 3 Jun 23 13:03 vcs3
crw-rw---- 1 root tty 7, 4 Jun 23 13:03 vcs4
crw-rw---- 1 root tty 7, 5 Jun 23 13:03 vcs5
crw-rw---- 1 root tty 7, 6 Jun 23 13:03 vcs6
crw-rw---- 1 root tty 7, 128 Jun 23 13:03 vcsa
crw-rw---- 1 root tty 7, 129 Jun 23 13:03 vcsa1
crw-rw---- 1 root tty 7, 130 Jun 23 13:03 vcsa2
crw-rw---- 1 root tty 7, 131 Jun 23 13:03 vcsa3
crw-rw---- 1 root tty 7, 132 Jun 23 13:03 vcsa4
crw-rw---- 1 root tty 7, 133 Jun 23 13:03 vcsa5
crw-rw---- 1 root tty 7, 134 Jun 23 13:03 vcsa6
crw-rw---- 1 root tty 7, 64 Jun 23 13:03 vcsu
crw-rw---- 1 root tty 7, 65 Jun 23 13:03 vcsu1
crw-rw---- 1 root tty 7, 66 Jun 23 13:03 vcsu2
crw-rw---- 1 root tty 7, 67 Jun 23 13:03 vcsu3
crw-rw---- 1 root tty 7, 68 Jun 23 13:03 vcsu4
crw-rw---- 1 root tty 7, 69 Jun 23 13:03 vcsu5
crw-rw---- 1 root tty 7, 70 Jun 23 13:03 vcsu6
brw-rw---- 1 root disk 254, 0 Jun 23 13:03 vda
drwxr-xr-x 2 root root 60 Jan 1 1970 vfio
crw------- 1 root root 10, 63 Jun 23 13:03 vga_arbiter
crw------- 1 root root 10, 58 Jun 23 13:03 vndbinder
crw-rw-rw- 1 root root 1, 5 Jun 23 13:03 zero
benshushu:/# find /etc/init.d/
/etc/init.d/
/etc/init.d/hwclock.sh
/etc/init.d/dhcpcd
/etc/init.d/kmod
/etc/init.d/rsyslog
/etc/init.d/networking
/etc/init.d/procps
/etc/init.d/avahi-daemon
/etc/init.d/kexec
/etc/init.d/dbus
/etc/init.d/ssh
/etc/init.d/kdump-tools
/etc/init.d/kexec-load
/etc/init.d/udev
/etc/init.d/cron
/etc/init.d/sudo