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

Thierry Vignaud thierry.vignaud at gmail.com
Tue Dec 20 12:07:33 CET 2011


On 19 December 2011 23:47,  <root at mageia.org> wrote:
> Log Message
>
> Port stage2 to use udev.
>
> In order to run dracut in the installer, it is necessary to have a working
> udev setup (specifically /dev/block/* nodes, but there may be other
> requirements).
>
> As dracut is needed by systemd when /usr is on a separate partition, we need
> udev in the installer in order to support systemd generally.
>
> Modified Paths
>
> drakx/trunk/perl-install/install/Makefile
> drakx/trunk/perl-install/install/install2.pm
> drakx/trunk/perl-install/install/share/list.xml
>
> Modified: drakx/trunk/perl-install/install/Makefile
> ===================================================================
> --- drakx/trunk/perl-install/install/Makefile	2011-12-19 21:36:04 UTC (rev
> 2493)
> +++ drakx/trunk/perl-install/install/Makefile	2011-12-19 22:47:15 UTC (rev
> 2494)
> @@ -47,6 +47,7 @@
>
>  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

> Modified: drakx/trunk/perl-install/install/install2.pm
> ===================================================================
> --- 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");
> +    mkdir "/run/udev", 0755;
> +    mkdir "/run/udev/rules.d", 0755;
> +    $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;
> +    run_program::run("mount", "-t", "tmpfs", "-o",
> "mode=1777,nosuid,nodev", "tmpfs", "/dev/shm");
> +
> +    run_program::run("/lib/udev/udevd", "--daemon",
> "--resolve-names=never");
> +    run_program::run("udevadm", "trigger", "--type=subsystems",
> "--action=add");
> +    run_program::run("udevadm", "trigger", "--type=devices",
> "--action=add");

A few remarks:
1) this is a little big, so better split it this into a new
start_udev() function
2) we prefer the fct(args) style over "fct args"
    (which is enforced by perl_checker)
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)


More information about the Mageia-dev mailing list