debugfs.sh 509 B

1234567891011121314151617181920212223
  1. #!/bin/sh
  2. set -ex
  3. d=/debugfs
  4. mkdir -p "$d"
  5. # We also added a fstab entry that mounts this under /sys/kernel/debug autmoatically.
  6. # That is the most common place to mount it.
  7. # The /sys/kernel/debug directory gets created automatically when debugfs is
  8. # compiled into the kernel, but it does not get mounted automatically.
  9. mount -t debugfs none /debugfs
  10. insmod /debugfs.ko
  11. cd "${d}/lkmc_debugfs"
  12. cat myfile
  13. # => 42
  14. echo 13 > myfile
  15. cat myfile
  16. # => 13
  17. echo 666 > "${d}/lkmc_debugfs_file"
  18. cat myfile
  19. # => 666