2

I have a device which I added to /etc/modules, previously it was added by insmod then mknod..

I want to add mknod command at kernel boot..

  # load driver
/sbin/insmod -f ./${module}.${suf} $* o_dbg=1 || exit 1

# Get driver major number
major=`awk "\\$2==\"$module\" {print \\$1}" /proc/devices`

mknod /dev/${device}0 c $major 0

1- I added the module to /lib/modules/uname -r/

2- debmod -a

but I don't know how to make mknod automatically

Khaled
  • 151
  • 2
  • 6
  • 1
    may could help : http://stackoverflow.com/questions/7221757/run-automatically-program-on-startup-under-linux-ubuntu – Amir Naghizadeh Dec 02 '12 at 12:47
  • Thanks,but is there a way like automatically use mknode without script, like adding module name to /etc/modules – Khaled Dec 02 '12 at 12:59
  • I used script for now, I add mknod commands in `/ect/rc.local` but as described before are there a way to "mknod" automatically without script. Thanks. – Khaled Dec 05 '12 at 13:33

1 Answers1

1

If your system is having udev or mdev then you can write rules to create device nodes automatically. Otherwise, you can manually call sys_mknod from your module code. Make sure that sys_mknod is exported.

See also: Create a device node in code

Community
  • 1
  • 1
manav m-n
  • 11,136
  • 23
  • 74
  • 97