I have recently acquired a device driver for an integrated watchdog timer on a x86 board on which I am running a minimal Linux system. The kernel is 3.6.11 and it has been built using buildroot.

My installation does not run udev so I am required to manually perform an insmod and mknod for any drivers that I require. I have managed to do this for a CAN driver, but for this watchdog driver, I am able to cross-compile the source code for the target and I am successfully able to insmod the resulting .ko file. After this there are no errors generated and a call to lsmod reports that the module is loaded.

The problem I am having is that I need to created a device node in /dev for this driver and I am not sure how to proceed. I do not know how to obtain device major and minor numbers like I can for char devices.

The source of this driver suggests it is a platform device driver but I am not sure what that even means. I have only heard of character and block devices and so – is the notion of major and minor numbers relevant to platform devices? If so, how can I obtain this information? There is no entry within /proc for this device driver name and I am unsure how to proceed.

  • This file describes the currently allocated major and minor device number for the 2.6+ kernel. I'm quite surprised it's so old, by the way. lanana.org/docs/device-list/devices-2.6+.txt. This file is also available in /usr/src/linux/documentation/devices.txt (assuming /usr/src/linux is the directory where your kernel sources are installed). – lgeorget May 29 '13 at 14:59
up vote 4 down vote accepted

If it uses the normal kernel watchdog interface, that's at /dev/watchdog, which is 10, 130 here.

It may also export another one (/dev/watchdog0, etc.). You can find that by querying sysfs:

$ cat /sys/class/watchdog/watchdog0/dev
$ cat /sys/class/watchdog/watchdog0/uevent 

And indeed:

$ ls -l /dev/watchdog0 
crw------- 1 root root 253, 0 May 17 18:26 /dev/watchdog0

That number may be dynamically allocated (I'm not sure), so it could be different on your machine.

(Platform devices probably also have something in /sys/devices/platform, which may let you set various parameters)

edit: You can create a character device with mknod like this (as root):

mknod -m 0600 /dev/watchdog c 10 130

-m sets the mode (file permissions, you have to use octal here); /dev/watchdog is the name; c means its a character device (as opposed to block); 10 is the major number; 130 is the minor.

  • Thanks for this - yes the insmod has created an entry in /sys/class/misc/watchdog . The misc seems to refer to the device major of 10 and so now I have all I need to know to create a node with mknod. Thanks for your help. – mathematician1975 May 29 '13 at 15:59
  • @mathematician1975 I've added in an example mknod to my answer. You actually get the major and minor numbers from /sys/class/misc/watchdog/dev (or …/uevent). But I think 10:130 is statically allocated, so you can just hard-code that. – derobert May 29 '13 at 16:54

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.