2005-02-17 20:09:31

by Erik van Konijnenburg

[permalink] [raw]
Subject: [ANNOUNCE] yaird, a mkinitrd based on hotplug concepts


OK, time to stop polishing and start publishing.

This is to announce yaird, Yet Another mkInitRD, a rewrite of mkinitrd
based on hotplug algorithms.

MOTIVATION
==========
Why a rewrite? The versions of mkinitrd that I studied, Debian sid
and Fedora FC3, have some problems: they capture a lot of knowledge
about the boot process, but don't always understand when a new kernel
uses a different module name than the old kernel, may rely on modules
compiled into the kernel, and don't always catch errors at the earliest
opportunity.

Assumption: there are three issues that cause most of these problems.
- Backward compatibility: sysfs provides a wealth of information
about hardware, but if you have to support 2.4 kernels, you have
to limit yourself in the use you can make of that information.
- Originality: hotplug does a pretty good job of finding the appropriate
modules for a device, basically because it closely follows the
algorithms the kernel uses for matching hardware with modules.
Deviating from those algorithms is unlikely to produce a more
robust result.
- Shell scripting: beyond a certain level of complexity, the shell
syntax makes it difficult to focus on the data structures you're
trying to process and makes it difficult to do rigorous error checking.

Yaird is intended to find out whether that assumption is correct: if so,
a program to build initrd images will be more reliable if it's written
in perl, if it uses sysfs to determine what hardware needs to be supported,
and if it closely follows the methods hotplug uses find the modules
needed to support some hardware.

STATUS
======
There is working code: yaird booted the machine this note is written on.
Code is available online, there also is a paper that discusses the workings
of the application in detail.

http://www.xs4all.nl/~ekonijn/yaird/

So far, the program works correctly on every machine it's been tested on,
but with only two test boxes that does not mean much.

Basic creature comforts are in place: "configure; make" but no RPM or
deb files, a README and help option but no manual page.

Features:
- understands SATA and IDE. USB sticks and SCSI should work, but are
untested.
- understands MDADM and LVM2, activates only necessary devices,
understands stacks like LVM on top of stripe on top of mirror.
- handles both initrd and initramfs.
- understands USB keyboards.
- understands hotplug blacklist.
- knows that a module compiled into the kernel does not need insmod.
- understands /etc/fstab, including niceties such as labels, uuids and
octal escapes.
- image generation understands symbolic links and shared libraries.
(should support 32bit emulation on 64bit kernels; untested).
- templating system to simplify tuning the initrd image to the distribution.
- avoids hard-coded device numbers; does not require devfs.
- testing mode gives detailed overview of the systems hardware
and the modules needed to support that.

There are rough edges in practically every feature: this is suitable
for testing, but not for production use.

TODO
====
(1) Testing so far is 100% successful, but with just two boxes to play
with, that's not saying much. If you can find space to test the code
on your system, your results are highly appreciated. At this point,
hardware testing is most valuable: I already know that dm-crypt is
unsupported for now, but whether this stuff can boot a powerbook, sparc,
or just about anything else is an open question.

(2) Feedback. This may be an interesting idea, but how does it relate
to other new stuff floating about? In particular, what about the work
that's going on putting udev on initramfs: are these approaches complementary
or alternatives? Different perspectives on where this stuff fits in would
help.

(3) Support more configurations. dm-crypt is unsupported for now, and so
are multipath, swsusp, EVMS, NFS and loopback mounts. Implementing this
stuff becomes interesting once there are some tests results that the
basic ideas work in practice.

Regards,
Erik



2005-02-17 21:50:26

by Jeff Garzik

[permalink] [raw]
Subject: Re: [ANNOUNCE] yaird, a mkinitrd based on hotplug concepts

Erik van Konijnenburg wrote:
> Features:
> - handles both initrd and initramfs.


Comments:

* Having a mkinitrd that's not a shell script is a godsend. I would
endorse yaird on that fact alone :)

* I've long wanted a "mkinitfoo" that would create .cpio.gz for
initramfs by default. So, good job there, too.

* Eventually your script will need pull in, into the initramfs, klibc
and programs linked against klibc.

Jeff


2005-02-19 17:26:10

by Andreas Jellinghaus

[permalink] [raw]
Subject: Re: [ANNOUNCE] yaird, a mkinitrd based on hotplug concepts

it looks like yaird does use pivot_root.
however pivot_root and initramfs cause a kernel crash
(once you unmount /initrd in the real system).
use run-init from klibc instead and you are fine.

Andreas

2005-02-21 19:37:43

by Erik van Konijnenburg

[permalink] [raw]
Subject: Re: [ANNOUNCE] yaird, a mkinitrd based on hotplug concepts

Andreas Jellinghaus <aj <at> dungeon.inka.de> writes:
> it looks like yaird does use pivot_root.
> however pivot_root and initramfs cause a kernel crash
> (once you unmount /initrd in the real system).
> use run-init from klibc instead and you are fine.

You're right: pivot_root and initramfs don't mix, so yaird uses
pivot_root only in the Debian template, which still has initrd.
The initramfs template manages to boot without run-init using a
hack that's too embarrasing to quote without rot13; klibc is needed
indeed.

Thanks,
Erik






2005-03-17 08:28:04

by Werner Almesberger

[permalink] [raw]
Subject: Re: [ANNOUNCE] yaird, a mkinitrd based on hotplug concepts

Erik van Konijnenburg wrote:
> Yaird is intended to find out whether that assumption is correct: if so,
> a program to build initrd images will be more reliable if it's written
> in perl, if it uses sysfs to determine what hardware needs to be supported,
> and if it closely follows the methods hotplug uses find the modules
> needed to support some hardware.

This is great, and was long overdue. Thanks for fixing my sins of
omission dating back from 1996 :-)

- Werner

--
_________________________________________________________________________
/ Werner Almesberger, Buenos Aires, Argentina [email protected] /
/_http://www.almesberger.net/____________________________________________/