You are not logged in.

#1 2006-10-03 20:02:05

damjan
Member
Registered: 2006-05-30
Posts: 454

What's the purpose of udev in the initramfs image

I was wondering why is udev needed in the initramfs image created by mkinitcpio.

I want to understand the boot process better with the initramfs created by mkinitcpio.

BTW is there some more featurefull shell and "ls" that I could put in the initramfs, just for playing around/debuging?

Offline

#2 2006-10-03 20:49:39

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: What's the purpose of udev in the initramfs image

udev is there because udev identifies your hardware and determines the proper modules needed, and because it creates device nodes.  In order to do anything complex (decryption, lvm, raid, etc) with your root filesystem, you need device nodes there to work off of.

Offline

#3 2006-10-04 00:33:24

damjan
Member
Registered: 2006-05-30
Posts: 454

Re: What's the purpose of udev in the initramfs image

Well the modules are already detected when I run mkinitcpio, so it only has to load all modules present (unless it's a fallback image I guess).

But it seems it's still needed for the creation of the /dev/ nodes.

Offline

#4 2006-10-04 16:30:16

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: What's the purpose of udev in the initramfs image

damjan wrote:

Well the modules are already detected when I run mkinitcpio, so it only has to load all modules present (unless it's a fallback image I guess).

Yes and no.  There's a few things here.  Let's say, for instance, you build you mkinitcpio image with 5 different USB devices plugged in.  mkinitcpio is going to think you have numerous scsi-type drives and add those modules too.

If you're concerned about the time it takes to run early-userspace udev, you can use the modload hook (which, I haven't tested in a long time, so it may not work... I consider it generally deprecated as the MODULES config entry works fine).

Offline

#5 2006-10-04 18:42:06

toxic
Member
Registered: 2006-06-05
Posts: 117

Re: What's the purpose of udev in the initramfs image

Isn't the ramdisk de-allocated before the modules in MODULES array are initiated ?

From my understanding, the ramdisk is created as a means of preparing your system (devices, nodes etc) for your kernel image to load. If the HOOKS array in mkinitcpio.conf contains ie "filesystems sata  base" for a system which uses those three, then what's the need for udev? Does it not load with the kernel, and try to load the modules in MODULES array when the kernel loads, or have I gotten myself the wrong picture of how a system boot works?.

Offline

#6 2006-10-04 19:17:28

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: What's the purpose of udev in the initramfs image

I am talking about the MODULES setting in mkinitcpio.conf - it is similar to the MODULES array in rc.conf in that it loads modules before udev does - in fact the mkinitcpio MODULES setting loads the modules before any hooks are executed.

As for the hooks, using "base sata filesystem" does nothing.  All of these hooks simply install modules to the image.  You either need udev or modload to actually load the modules.  The problem is that modload doesn't create device nodes (this is not a problem unless you actually need to act on these device nodes - ala raid, etc)

In my eyes, the most optimal setup is:

MODULES="piix reiserfs some other modules"
HOOKS="base"

as this loads all the modules then passes control to kinit.

Offline

#7 2006-10-06 02:28:32

damjan
Member
Registered: 2006-05-30
Posts: 454

Re: What's the purpose of udev in the initramfs image

phrakture thanks, now I understand better how it works.

one more thing, I was thinking of using that /dev/disk/by-XXX/ feature of udev. So I should be able to put root=/dev/disk/by-label/ROOT on the kernel line right?

I think I'd need to add /lib/udev/vol_id and to edit the rules file in the initramfs...

Thats one reason why I was looking for a better shell and at least 'ls' for the initramfs, it makes it easier to experiment with break=y

Offline

#8 2006-10-06 05:28:48

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: What's the purpose of udev in the initramfs image

you can do "echo /dev/*" in place of ls... it's not the best, but it gets you by.

Adding a new shell in there is doable, but a heavyweight shell might be overkill.... either way, you may be able to add BINARIES="/bin/sh" to mkinitcpio.conf, but that's entirely untested.

Offline

Board footer

Powered by FluxBB