User: Password:
|
|
Subscribe / Log in / New account

KS2008: Bootstrap code

KS2008: Bootstrap code

Posted Sep 16, 2008 9:23 UTC (Tue) by nix (subscriber, #2304)
Parent article: KS2008: Bootstrap code

I'd be really annoyed if it became difficult to roll your own initramfs. I've got systems which run entirely from initramfs and systems which do very peculiar things from it (such as kicking up NBD connections to remote hosts and bringing up RAID arrays from them, and even, in one case, getting a root filesystem from an LVM-atop-two-RAIDs-atop-multiple-NBDs). Having to ditch all that or work around attempts to jam another initramfs system down our throats would be extremely irritating. (Of course I could just not use that initramfs and forward-port the existing assemble-your-own-initramfs-from-usr/ code, but that's extra work for, from my perspective, no gain at all.)


(Log in to post comments)

KS2008: Bootstrap code

Posted Sep 16, 2008 10:47 UTC (Tue) by drag (subscriber, #31333) [Link]

I have found that working with Debian's Initramfs stuff isn't too difficult.

For example, if you have busybox installed when Debian generates the initrd then it includes that. Then throwing a extra 'sh' in a script or whatnot is very easy thing to do and makes it easy to troubleshoot.

Adding your own functionality is pretty decent.

There are two places in the file system were you would have to concern yourself with when editing the initramfs. One is the /etc/initramfs/ directory and the second is the /usr/share/initramfs

The directory layout of both are the same, with the exception of the /usr/share/initramfs having the init and hook-functions scripts. Users are suppose to edit the stuff in the /etc directory and packages install their hooks and whatnot into the /usr/share/ stuff.

You add your own hook scripts to for adding binaries and such. Then you have directories like scripts/init-premount/ or scripts/local-bottom were you stick your scripts for adding functionality.

And not only that, it's decently documented. 'man initramfs-tools' has useful documentation on the boiler plate code your scripts need and what the different helper functions are available and whatnot.

It's nice that it's fairly modular and adding or removing scripts for waking up from hibernation (for example) won't break the scripts for doing nfs-root and whatnot.

It's not perfect, of course.

Now compared to that... I tried working with Fedora's initramfs stuff figuring they have something similar that would be editable.

Needless to say I didn't get very far at all. It was very unpleasant.

--------------------------

Now it's all fine and dandy to have some humongous distro-specific init script you just shove into the root of your initramfs and have all sorts of uncommented magic for setting everything up...

But from third party's perspectives this is unusable. If they want to standardize on a initrd that can support multiple distros it needs to be treated as a mini-Linux distribution in it's own right. Something that has a clean directory structure, good documentation, and is familiar.

If you add busybox support you should be able to shell out into it. It should have a init script structure that is similar to what is used in a regular Linux distribution.

A user will need to be able to see the directory structure and the files and whatnot that will be included in the final initramfs image. Something that they can chroot into and fart around with would be very handy. So you should be able to have a option in the initramfs build scripts that instead of cpio and compressing the directory it should stop there and leave the directories in a /tmp directory some were.

That sort of thing.

-------------------

As a general rule:
If you don't document stuff well and you don't make it simple for people to understand and work with then it's going to be much easier for end users to write their own stuff then try to bang their heads on their tables after trying to understand yours.

THAT is why each distro writes their own right now.


Copyright © 2017, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds