linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* UDEV from scratch for beginners - mtd device not shown in device
@ 2005-07-11 13:19 Clemens Koller
  2005-07-11 13:28 ` Clemens Koller
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Clemens Koller @ 2005-07-11 13:19 UTC (permalink / raw
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 3869 bytes --]

Hello!

Well... I am pretty new to udev - forced to use the good new udev
system as I need to migrate to 2.6.13. ;-)
I try to work my way through all the things google gave me to understand
udev but I got stuck now somewhere in the middle:

After installing "udev from scratch" on an embedded system
(not being able to follow Decibels UDEV Primer directly as I don't use
any package management tools.) I still cannot get my mtd
(memory technology device) node created dynamically by udev when I
insert my module to the kernel.

Basically, my installation was like this:

- compiled Linux-2.6.13-rc2 w/ CONFIG_UNIX98_PTYS and CONFIG_DEVPTS_FS
and CONFIG_HOTPLUG and friends.

- manually created /dev nodes on local filesystem to be able to boot
and login via ssh at least:
cd /dev
mknod -m 660 console c 5 1
mknod -m 666 null c 1 3
mknod -m 666 hda b 3 0
mknod -m 666 hda1 b 3 1
mknod -m 666 hda2 b 3 2
(I guess I will have to move those manually created devices to
/etc/udev/devices, right? Where is documentation for that and who
is copying that to /dev and when?)

- to be able to login via ssh:
mknod /dev/ptmx c 5 2
chmod 666 /dev/ptmx
mkdir /dev/pts            

- Add to /etc/fstab:
  none            /dev/pts        devpts        gid=5,mode=620    0 0
	(Note:  gid=5 is applicable for RedHat systems for which group "tty" has
	gid 5.  Adjust according to your distribution.  Use mode=600 if you want
	"mesg n" to be default.)

- mount /dev/pts

- installed hotplug-2004_09_23

- installed udev-062 with udevdir=/dev

- added mtd sections to /etc/udev/rules.d/50-udev.rules:
#KERNEL="mtd[0-9]*", NAME="mtd/%k", MODE="0666"
KERNEL="mtd*"            NAME="%k", OWNER="root", GROUP="disk", MODE="0640"
(I tested both lines)

(BTW: in which order are the files in /etc/udev/rules.d processed if
there are more than one? Are there any naming conventions which apply?
Where is the documentation for that?)

- I've checked /udev/uevent_listen which works pretty fine while
loading my mtd modules:

$ ./uevent_listen
[1121084998] received 'remove' from '/module/mminfo'
ACTION=remove
DEVPATH=/module/mminfo
SUBSYSTEM=module
SEQNUM=181

[1121085000] received 'add' from '/module/mminfo'
ACTION=add
DEVPATH=/module/mminfo
SUBSYSTEM=module
SEQNUM=182

while doing
$ rmmod mminfo
$ insmod mminfo.ko

Now I ran into the following problem while loading my module
which appeared as /dev/mtd/0 and/or /dev/mtd/0ro in devfs:

Jul 11 13:33:29 ecam udevd[14647]: udevd.c: seq 177 forked, pid 14653, 2 seconds old
Jul 11 13:33:29 ecam udev[14653]: udev_rules.c: reset run list
Jul 11 13:33:29 ecam udev[14654]: udev_utils.c: exec of program '/sbin/udev_run_devd' failed
Jul 11 13:33:29 ecam udevd[14647]: udevd.c: seq 177 exit, 2 seconds old
Jul 11 13:42:32 ecam udevd[14647]: udevd.c: seq 178 queued, devpath '/module/mminfo'
Jul 11 13:42:32 ecam udevd[14647]: udevd.c: seq 178 forked, pid 14662, 0 seconds old

I patched udev_utils.c (appended, whitespaces fixed, too) to get the clue
that the call to /sbin/udev_run_devd failed.

Well, there is no valuable documentation about udev_run_devd neither in
writing_udev_rules nor in Decibels UDEV primer. So I decided to remove
that line from the 50-udev.rules:
# emulate dev.d/
#RUN="/sbin/udev_run_devd"
without really knowing what that is...
(What is a directory multiplexer doing? Do I need that? For what?)

The error messge about failed exec of udev_run_devd doesn't appear anymore.
But I still cannot get my /dev/mtd/0 created...

What did I miss? udev seems to work as udevstart gives me all the ttys and
friends... but I cannot get my /dev/mtd.
Is there a step by step installation for the not-mainstream distros?

Best greets,

Clemens Koller
_______________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Str. 45/1
81379 Muenchen
Germany

http://www.anagramm.de
Phone: +49-89-741518-50
Fax: +49-89-741518-19

[-- Attachment #2: udev-062-exec-arg-added.patch --]
[-- Type: text/plain, Size: 1028 bytes --]

--- udev_utils.c	2005-07-11 13:30:48.000000000 +0200
+++ udev_utils.c.bak	2005-07-08 00:00:50.000000000 +0200
@@ -6,12 +6,12 @@
  *	This program is free software; you can redistribute it and/or modify it
  *	under the terms of the GNU General Public License as published by the
  *	Free Software Foundation version 2 of the License.
- *
+ * 
  *	This program is distributed in the hope that it will be useful, but
  *	WITHOUT ANY WARRANTY; without even the implied warranty of
  *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  *	General Public License for more details.
- *
+ * 
  *	You should have received a copy of the GNU General Public License along
  *	with this program; if not, write to the Free Software Foundation, Inc.,
  *	675 Mass Ave, Cambridge, MA 02139, USA.
@@ -462,7 +462,7 @@
 		if (result)
 			dup2(pipefds[1], STDOUT_FILENO);
 		execv(arg, argv);
-		err("exec of program '%s' failed", arg);
+		err("exec of program failed");
 		_exit(1);
 	case -1:
 		err("fork of '%s' failed", arg);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: UDEV from scratch for beginners - mtd device not shown in device
  2005-07-11 13:19 UDEV from scratch for beginners - mtd device not shown in device Clemens Koller
@ 2005-07-11 13:28 ` Clemens Koller
  2005-07-11 13:58 ` UDEV from scratch for beginners - mtd device not shown in device tree Kay Sievers
  2005-07-11 16:04 ` UDEV from scratch for beginners - mtd device not shown in device Clemens Koller
  2 siblings, 0 replies; 4+ messages in thread
From: Clemens Koller @ 2005-07-11 13:28 UTC (permalink / raw
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 112 bytes --]

Sorry, the applied in my last mail was "reversed"...

Attached a hopefully better one...

Best greets,

Clemens

[-- Attachment #2: udev-062-exec-arg-added-fw.patch --]
[-- Type: text/plain, Size: 1069 bytes --]

--- udev_utils.c.bak	2005-07-08 00:00:50.000000000 +0200
+++ udev_utils.c	2005-07-11 13:30:48.000000000 +0200
@@ -6,12 +6,12 @@
  *	This program is free software; you can redistribute it and/or modify it
  *	under the terms of the GNU General Public License as published by the
  *	Free Software Foundation version 2 of the License.
- * 
+ *
  *	This program is distributed in the hope that it will be useful, but
  *	WITHOUT ANY WARRANTY; without even the implied warranty of
  *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  *	General Public License for more details.
- * 
+ *
  *	You should have received a copy of the GNU General Public License along
  *	with this program; if not, write to the Free Software Foundation, Inc.,
  *	675 Mass Ave, Cambridge, MA 02139, USA.
@@ -462,7 +462,7 @@ int execute_program(const char *command,
 		if (result)
 			dup2(pipefds[1], STDOUT_FILENO);
 		execv(arg, argv);
-		err("exec of program failed");
+		err("exec of program '%s' failed", arg);
 		_exit(1);
 	case -1:
 		err("fork of '%s' failed", arg);

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: UDEV from scratch for beginners - mtd device not shown in device tree.
  2005-07-11 13:19 UDEV from scratch for beginners - mtd device not shown in device Clemens Koller
  2005-07-11 13:28 ` Clemens Koller
@ 2005-07-11 13:58 ` Kay Sievers
  2005-07-11 16:04 ` UDEV from scratch for beginners - mtd device not shown in device Clemens Koller
  2 siblings, 0 replies; 4+ messages in thread
From: Kay Sievers @ 2005-07-11 13:58 UTC (permalink / raw
  To: linux-hotplug

On Mon, Jul 11, 2005 at 03:19:32PM +0200, Clemens Koller wrote:
> After installing "udev from scratch" on an embedded system
> (not being able to follow Decibels UDEV Primer directly as I don't use
> any package management tools.) I still cannot get my mtd
> (memory technology device) node created dynamically by udev when I
> insert my module to the kernel.
> 
> Basically, my installation was like this:
> 
> - compiled Linux-2.6.13-rc2 w/ CONFIG_UNIX98_PTYS and CONFIG_DEVPTS_FS
> and CONFIG_HOTPLUG and friends.
> 
> - manually created /dev nodes on local filesystem to be able to boot
> and login via ssh at least:
> cd /dev
> mknod -m 660 console c 5 1
> mknod -m 666 null c 1 3
> mknod -m 666 hda b 3 0
> mknod -m 666 hda1 b 3 1
> mknod -m 666 hda2 b 3 2
> (I guess I will have to move those manually created devices to
> /etc/udev/devices, right? Where is documentation for that and who
> is copying that to /dev and when?)

This is Fedora specific, udev does not do it by default.

> (BTW: in which order are the files in /etc/udev/rules.d processed if
> there are more than one?

Lexical order.
> Are there any naming conventions which apply?
> Where is the documentation for that?)

The man page.

> - I've checked /udev/uevent_listen which works pretty fine while
> loading my mtd modules:
> 
> $ ./uevent_listen
> [1121084998] received 'remove' from '/module/mminfo'
> ACTION=remove
> DEVPATH=/module/mminfo
> SUBSYSTEM=module
> SEQNUM\x181
> 
> [1121085000] received 'add' from '/module/mminfo'
> ACTION­d
> DEVPATH=/module/mminfo
> SUBSYSTEM=module
> SEQNUM\x182
> 
> while doing
> $ rmmod mminfo
> $ insmod mminfo.ko

These are module events and not events for class or block devices. udev
will not create any node for such events.

> Now I ran into the following problem while loading my module
> which appeared as /dev/mtd/0 and/or /dev/mtd/0ro in devfs:
> 
> Jul 11 13:33:29 ecam udevd[14647]: udevd.c: seq 177 forked, pid 14653, 2 
> seconds old
> Jul 11 13:33:29 ecam udev[14653]: udev_rules.c: reset run list
> Jul 11 13:33:29 ecam udev[14654]: udev_utils.c: exec of program 
> '/sbin/udev_run_devd' failed
> Jul 11 13:33:29 ecam udevd[14647]: udevd.c: seq 177 exit, 2 seconds old
> Jul 11 13:42:32 ecam udevd[14647]: udevd.c: seq 178 queued, devpath 
> '/module/mminfo'
> Jul 11 13:42:32 ecam udevd[14647]: udevd.c: seq 178 forked, pid 14662, 0 
> seconds old
> 
> I patched udev_utils.c (appended, whitespaces fixed, too) to get the clue
> that the call to /sbin/udev_run_devd failed.
> 
> Well, there is no valuable documentation about udev_run_devd neither in
> writing_udev_rules nor in Decibels UDEV primer. So I decided to remove
> that line from the 50-udev.rules:
> # emulate dev.d/
> #RUN="/sbin/udev_run_devd"
> without really knowing what that is...
> (What is a directory multiplexer doing? Do I need that? For what?)

Look at the archives, and RELEASE-NOTES. dev.d/ is a hotplug.d/ style
directory, where you can place programs in, that run at device node
creation/removal.

> The error messge about failed exec of udev_run_devd doesn't appear anymore.
> But I still cannot get my /dev/mtd/0 created...

Mtd seems to lack proper driver-core integration, and therefore no udev
support:
  http://lists.infradead.org/pipermail/linux-mtd/2005-June/012821.html

Kay


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: UDEV from scratch for beginners - mtd device not shown in device
  2005-07-11 13:19 UDEV from scratch for beginners - mtd device not shown in device Clemens Koller
  2005-07-11 13:28 ` Clemens Koller
  2005-07-11 13:58 ` UDEV from scratch for beginners - mtd device not shown in device tree Kay Sievers
@ 2005-07-11 16:04 ` Clemens Koller
  2 siblings, 0 replies; 4+ messages in thread
From: Clemens Koller @ 2005-07-11 16:04 UTC (permalink / raw
  To: linux-hotplug

Hello, Kai!

Thank you for filling the gaps. The problem was:

>>The error messge about failed exec of udev_run_devd doesn't appear anymore.
>>But I still cannot get my /dev/mtd/0 created...
> 
> 
> Mtd seems to lack proper driver-core integration, and therefore no udev
> support:
>   http://lists.infradead.org/pipermail/linux-mtd/2005-June/012821.html
> 

The latest 2.6.13-rc2 tree didn't use class_simple_device_xxx() to register
new devices. I've patched my tree with the patch in above link and I've also
applied no-sources-keep-class-symbol.diff for simple_class.c

Now everything seems to work fine, I get my mtd device added and removed
properly.

Thanks for your support!

Greets,

Clemens Koller
_______________________________
R&D Imaging Devices
Anagramm GmbH
Rupert-Mayer-Str. 45/1
81379 Muenchen
Germany

http://www.anagramm.de
Phone: +49-89-741518-50
Fax: +49-89-741518-19

Kay Sievers wrote:
> On Mon, Jul 11, 2005 at 03:19:32PM +0200, Clemens Koller wrote:
> 
>>After installing "udev from scratch" on an embedded system
>>(not being able to follow Decibels UDEV Primer directly as I don't use
>>any package management tools.) I still cannot get my mtd
>>(memory technology device) node created dynamically by udev when I
>>insert my module to the kernel.
>>
>>Basically, my installation was like this:
>>
>>- compiled Linux-2.6.13-rc2 w/ CONFIG_UNIX98_PTYS and CONFIG_DEVPTS_FS
>>and CONFIG_HOTPLUG and friends.
>>
>>- manually created /dev nodes on local filesystem to be able to boot
>>and login via ssh at least:
>>cd /dev
>>mknod -m 660 console c 5 1
>>mknod -m 666 null c 1 3
>>mknod -m 666 hda b 3 0
>>mknod -m 666 hda1 b 3 1
>>mknod -m 666 hda2 b 3 2
>>(I guess I will have to move those manually created devices to
>>/etc/udev/devices, right? Where is documentation for that and who
>>is copying that to /dev and when?)
> 
> 
> This is Fedora specific, udev does not do it by default.
> 
> 
>>(BTW: in which order are the files in /etc/udev/rules.d processed if
>>there are more than one?
> 
> 
> Lexical order.
> 
>>Are there any naming conventions which apply?
>>Where is the documentation for that?)
> 
> 
> The man page.
> 
> 
>>- I've checked /udev/uevent_listen which works pretty fine while
>>loading my mtd modules:
>>
>>$ ./uevent_listen
>>[1121084998] received 'remove' from '/module/mminfo'
>>ACTION=remove
>>DEVPATH=/module/mminfo
>>SUBSYSTEM=module
>>SEQNUM\x181
>>
>>[1121085000] received 'add' from '/module/mminfo'
>>ACTION­d
>>DEVPATH=/module/mminfo
>>SUBSYSTEM=module
>>SEQNUM\x182
>>
>>while doing
>>$ rmmod mminfo
>>$ insmod mminfo.ko
> 
> 
> These are module events and not events for class or block devices. udev
> will not create any node for such events.
> 
> 
>>Now I ran into the following problem while loading my module
>>which appeared as /dev/mtd/0 and/or /dev/mtd/0ro in devfs:
>>
>>Jul 11 13:33:29 ecam udevd[14647]: udevd.c: seq 177 forked, pid 14653, 2 
>>seconds old
>>Jul 11 13:33:29 ecam udev[14653]: udev_rules.c: reset run list
>>Jul 11 13:33:29 ecam udev[14654]: udev_utils.c: exec of program 
>>'/sbin/udev_run_devd' failed
>>Jul 11 13:33:29 ecam udevd[14647]: udevd.c: seq 177 exit, 2 seconds old
>>Jul 11 13:42:32 ecam udevd[14647]: udevd.c: seq 178 queued, devpath 
>>'/module/mminfo'
>>Jul 11 13:42:32 ecam udevd[14647]: udevd.c: seq 178 forked, pid 14662, 0 
>>seconds old
>>
>>I patched udev_utils.c (appended, whitespaces fixed, too) to get the clue
>>that the call to /sbin/udev_run_devd failed.
>>
>>Well, there is no valuable documentation about udev_run_devd neither in
>>writing_udev_rules nor in Decibels UDEV primer. So I decided to remove
>>that line from the 50-udev.rules:
>># emulate dev.d/
>>#RUN="/sbin/udev_run_devd"
>>without really knowing what that is...
>>(What is a directory multiplexer doing? Do I need that? For what?)
> 
> 
> Look at the archives, and RELEASE-NOTES. dev.d/ is a hotplug.d/ style
> directory, where you can place programs in, that run at device node
> creation/removal.
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
> July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
> core and dual graphics technology at this free one hour event hosted by HP,
> AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
> _______________________________________________
> Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
> Linux-hotplug-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
> 


-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP,
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-07-11 16:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-11 13:19 UDEV from scratch for beginners - mtd device not shown in device Clemens Koller
2005-07-11 13:28 ` Clemens Koller
2005-07-11 13:58 ` UDEV from scratch for beginners - mtd device not shown in device tree Kay Sievers
2005-07-11 16:04 ` UDEV from scratch for beginners - mtd device not shown in device Clemens Koller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).