Files
Linux-kernel-driver-tutorial/General.txt
2025-02-18 15:41:03 +02:00

35 lines
1.1 KiB
Plaintext

-> /proc/devices:
It contains the character and block devices
with their major number.
-> Why character devices are called character devices?
Because the read/write operation done is in size of
byte.
-> Why block devices are called block devices?
Because the read/write operation done is in size of
block.
-> To read bytes of a devices
use:
hexdump /dev/<device_name>
to see only few bytes
Use:
hexdump /dev/<device_name> | head
-> To create a new device file
Use:
mknod <device-name> <type of device 'c' or 'b'> <major-num> <minor-num>
-> /dev/*:
this file basically contains virtual files which act as a
interface between the device driver in kernel space and
the user space, which allow the control of the device from
user space.
-> The link between the driver and the device file is made over
the major and minor number of the device file rather than
name of the device file. So, if I associate a custom made
device file with driver using same major and minor number.
I can access the same device using that file.