mirror of
https://github.com/cirosantilli/linux-kernel-module-cheat.git
synced 2026-01-24 18:51:36 +01:00
Move debugfs, rootfs and procfs documentation to README
This commit is contained in:
@@ -1,22 +1,13 @@
|
||||
#!/bin/sh
|
||||
set -ex
|
||||
set -e
|
||||
d=/debugfs
|
||||
mkdir -p "$d"
|
||||
# We also added a fstab entry that mounts this under /sys/kernel/debug autmoatically.
|
||||
# That is the most common place to mount it.
|
||||
# The /sys/kernel/debug directory gets created automatically when debugfs is
|
||||
# compiled into the kernel, but it does not get mounted automatically.
|
||||
mount -t debugfs none /debugfs
|
||||
mount -t debugfs none "$d"
|
||||
insmod /debugfs.ko
|
||||
cd "${d}/lkmc_debugfs"
|
||||
|
||||
cat myfile
|
||||
# => 42
|
||||
|
||||
echo 13 > myfile
|
||||
cat myfile
|
||||
# => 13
|
||||
|
||||
[ "$(cat "${d}/lkmc_debugfs/myfile")" = 42 ]
|
||||
echo 13 > "${d}/lkmc_debugfs/myfile"
|
||||
[ "$(cat "${d}/lkmc_debugfs/myfile")" = 13 ]
|
||||
echo 666 > "${d}/lkmc_debugfs_file"
|
||||
cat myfile
|
||||
# => 666
|
||||
[ "$(cat "${d}/lkmc_debugfs/myfile")" = 666 ]
|
||||
rmmod debugfs
|
||||
umount "$d"
|
||||
|
||||
Reference in New Issue
Block a user