[Mageia-dev] [soft-commits] [2494] Port stage2 to use udev.

Thierry Vignaud thierry.vignaud at gmail.com
Tue Dec 20 12:42:38 CET 2011


On 20 December 2011 12:19, Colin Guthrie <colin at guthr.ie> wrote:
>>>  get_needed_files: xs
>>>      REP4PMS=$(REP4PMS) ../../tools/install-xml-file-list share/list.xml
>>> $(DEST)
>>> +    mkdir -p $(DEST)/run
>>
>> That won't work. stage2 is mounted by stage1 in /tmp/stage2
>> so you want to create & include it in stage1
>
> Right... strangely enough some stuff still worked fine... e.g.
> /lib/udev/udevd exists inside the installer shell.... so that's why I
> thought all was well. I double check a few things.
>
> Technically it's not super important that /run exists anyway as I mkdir
> it later, so this bit can probably be dropped.

Either you create it in stage1 or in the sub starting udev, but anyway
the Makefile should be reverted

>>> --- drakx/trunk/perl-install/install/install2.pm     2011-12-19 21:36:04 UTC
>>> (rev 2493)
>>> +++ drakx/trunk/perl-install/install/install2.pm     2011-12-19 22:47:15 UTC
>>> (rev 2494)
>>> @@ -395,6 +395,24 @@
>>>      eval { fs::mount::mount('none', '/sys', 'sysfs', 1) };
>>>      eval { touch('/root/non-chrooted-marker.DrakX') }; #- helps
>>> distinguishing /root and /mnt/root when we don't know if we are chrooted
>>>
>>> +    # Ensure /run is mounted
>>> +    mkdir "/run", 0755;
>>> +    run_program::run("mount -t tmpfs -o mode=0755,nosuid,nodev tmpfs
>>> /run");

having perms from both chown & mount is maybe a little too much

>>> +    mkdir "/run/udev", 0755;
>>> +    mkdir "/run/udev/rules.d", 0755;

can be simplified mkdir_p("/run/udev/rules.d").
The perms should be OK through umask

>>> +    $ENV{UDEVRULESD} = "/run/udev/rules.d";
>>> +
>>> +    # Start up udev and trigger cold plugs
>>> +    run_program::run("mount", "-t", "devtmpfs", "-o", "mode=0755,nosuid",
>>> "devtmpfs", "/dev");
>>> +    mkdir "/dev/pts", 0755;
>>> +    run_program::run("mount", "-t", "devpts", "-o",
>>> "gid=5,mode=620,noexec,nosuid", "devpts", "/dev/pts");
>>> +    mkdir "/dev/shm", 0755;

This one should be better included in stage1 with other /dev stuff IMHO
See images/make_boot_img

>>> +    run_program::run("mount", "-t", "tmpfs", "-o",
>>> "mode=1777,nosuid,nodev", "tmpfs", "/dev/shm");
>>> +
>>> +    run_program::run("/lib/udev/udevd", "--daemon",
>>> "--resolve-names=never");

I guess it auto detach with --daemon?
If not we could use "raw({ detach => 1}," instead of "run("
I think you wan

>>> +    run_program::run("udevadm", "trigger", "--type=subsystems",
>>> "--action=add");
>>> +    run_program::run("udevadm", "trigger", "--type=devices",
>>> "--action=add");

Since this will forces us to wait, you should either display a "please
wait dialog"
or better not run this as we'll only look at block devices quite a lot later
after accepting license & loading disks modules

>> 3) which bring me to the last item: you should run perl_checker
>>     See /usr/share/doc/perl_checker/perl_checker.html &
>>     /usr/share/doc/perl-MDK-Common/tutorial.html
>> It can be simply called from within emacs (or vim)
>
> Cool, thanks. I'm not a perl-master so feel free to tidy this commit up
> a bit if you have time, otherwise I'll try and tidy up my mess this
> evening :)

There's no urgency so it's better if done by you so that
you eventually became a co maintainer of drakx :-)

BTW you may eventually include udev in rescue too
(but only once it's done in stage2)
See rescue/ && rescue/devices.pl


More information about the Mageia-dev mailing list