LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   What do the configuration options in initramfs.conf mean? (https://www.linuxquestions.org/questions/linux-newbie-8/what-do-the-configuration-options-in-initramfs-conf-mean-743027/)

Kesem 07-27-2009 04:21 AM

What do the configuration options in initramfs.conf mean?
 
The following wall of text exists in the initramfs-tools/initramfs.conf

Code:

#
# MODULES: [ most | netboot | dep | list ]
#
# most - Add all framebuffer, acpi, filesystem, and harddrive drivers.
#
# netboot - Add the base modules, network modules, but skip block devices.
#
# dep - Try and guess which modules to load.
#
# list - Only include modules from the 'additional modules' list
#

MODULES=most

Most seems to be the intuitive option of course, but what do each of these options actually do?

How does "try and guess which modules to load" work?
Does netboot include "most" (add the base modules...) and more, or is it
a different set of modules?
Does most actually mean 'all'?
Only include modules from the 'additional modules' list.. where is this list?

These options are very unclear, if anyone could please elaborate, go into detail about them, or link me to a FAQ (or man page? Neither of which I could find..) I'd appreciate it.

Thanks.

neonsignal 07-27-2009 09:41 AM

Quote:

These options are very unclear, if anyone could please elaborate, go into detail about them, or link me to a FAQ (or man page? Neither of which I could find..) I'd appreciate it.
Well, the man page for initramfs.conf is no more helpful!

The 'most' flag will not be all modules (since there are plenty of modules for peripheral devices that have no relevance to the boot). It is just all the modules that might be required for the boot (eg acpi driver modules in case the boot is a resume, block devices since they might contain the boot filesystem, etc).

The purpose of the 'netboot' flag is to leave out any of the storage devices (eg ide, scsi etc), since the intention here is to boot the system via the network, so none of these block devices will be required. Instead of block devices, it will include the network drivers.

The 'list' flag text is referring to the module list inside /etc/initramfs-tools/modules (see the man page for mkinitramfs). The idea of this is that you can build a minimal initramfs that is customized for a particular system (with only the modules that are really needed).

I don't know how the dep flag works.

Kesem 07-28-2009 02:35 AM

Thanks for your answer.

I looked at the scripts for mkinitramfs with my minimal scripting knowledge and I came across these lines:

Code:

for d in bin conf/conf.d etc lib modules sbin scripts ${MODULESDIR}; do
mkdir -p "${DESTDIR}/${d}"
done

### here are the lines i'm talking about ###
# MODULES=list case. Always honour.
for x in "${CONFDIR}/modules" /usr/share/initramfs-tools/modules.d/*; do
if [ -f "${x}" ]; then
add_modules_from_file "${x}"
fi
done

if [ "${MODULES}" = "dep" ]; then
dep_add_modules
fi

if [ "${MODULES}" = "most" ]; then
auto_add_modules
fi

if [ "${MODULES}" = "netboot" ]; then
auto_add_modules base
auto_add_modules net
fi

### end of the lines i'm talking about ###
# Have to do each file, because cpio --dereference doesn't recurse down
# symlinks.

First of all I notice that it doesn't even check if $MODULES = "list" before adding the modules from the modules file, it -always- does it.

And then, for the three other cases, it uses dep_add_modules, auto_add_modules, and auto_add_modules PARAMETER.
While I do have only a minimal knowledge of bash scripting, I can usually figure things out from their context, whereas here I'm stumped - there are no such functions defined in the same script file, these are not programs.. I don't know where they're referenced, I don't know anything about them. What is this? I try to find the implementations for these but I don't know where to start.

Kesem 07-28-2009 02:40 AM

I may have been a little hasty in asking my question. A quick search
on Google brought me to /initramfs-tools/hook-functions where I found
the definitions of all these functions.

neonsignal 07-28-2009 02:52 AM

Quote:

First of all I notice that it doesn't even check if $MODULES = "list" before adding the modules from the modules file, it -always- does it.
Yes, this makes sense - normally the modules list file is for additional modules that are required on a particular setup, but are not in the typical groups loaded. For example, you might add in modules for an experimental boot device. So normally it would be empty.

This is different to the case where the 'list' flag is specified, because then you are trying to build a minimal initramfs, and will probably specify a number of modules in the file. Arguably the file is being used for two different purposes, depending on the flag.

For the hook functions, have a look in /usr/share/initramfs-tools/hook-functions.


All times are GMT -5. The time now is 11:15 PM.