I am writing a module for the linux kernel and I want to create some device nodes in the init function
int init_module(void)
{
Major = register_chrdev(0,
To have more control over the device numbers and the device creation you could do the following steps (instead of register_chrdev()):
alloc_chrdev_region() to get a major number and a range of minor numbers to work with.class_create().cdev_init() and cdev_add() to add the character device to the system.device_create(). As a result, among other things, Udev will create device nodes for your devices. No need for mknod or the like. device_create() also allows you to control the names of the devices.There are probably many examples of this on the Net, one of them is here.