Age | Commit message (Collapse) | Author | Files | Lines |
|
Fallback on no compression at all, since we don't want to make
potentially poor assumptions about what the kernel might support.
Fixes FS#39659.
|
|
This isn't documented, but it's needed since the kernel lz4 support is
based on the original streaming format and not the newer default. Use
-l to force the legacy codec.
Fixup lsinitcpio to support the older format, and, add a warning when
the newer format is detected. Who knows when this will be "resolved" ...
Upstream discussion: https://code.google.com/p/lz4/issues/detail?id=102
|
|
This is surely a configuration error as it's an infinite loop.
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
The '-k none' switch prevents mkinitcpio from adding modules to the
image and keeps it from bailing out when it cannot find any.
|
|
|
|
The -d (--generatedir) option writes the root of the generated image
directly to the specified directory.
Useful for generating a shutdown-ramfs with mkinitcpio -d /run/initramfs/.
|
|
It doesn't make any sense that this was added during the final image
creation. This fixes a subtle bug that would manifest itself if the
user archived the build root manually.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Running as non-root is usually for my own dev purposes, but someone
might do this and be surprised when a directory/file that needs
permissions other than root isn't preserved.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Using --tab-file for findmnt calls is redundant if we can rely on the
defaults. Sanitize the environment from any LIBMOUNT_* variables so
that we can be sure of what file we're reading.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Shaves a trivial, but measurable, amount of time off of early userspace
at the cost of a small cache file.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Without this flag set, errors in install_modules are ignored, and
mkinitcpio potentially exits without complaining about build problems
when foolish people run out of disk (presumably after using /tmp as a
build directory).
Fixes FS#35037.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Add this as an abstraction for the various places firmware might exist.
Additionally, don't complain about missing firmware unless *none* of it
can be found -- and even then, only throw a warning.
NB: this means that users building images without the autodetect hook
and a rudimentary hook like "block" will see warnings which are going
to cause panic, chaos, and upheaval. I fully expect that this will
result in extra non-work for me in the form of closing invalid bug
reports.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This also removes a check which would have otherwise hidden a missing
firmware error from the user. FS#34255.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
As a logical extension, allow the -p option to be specified multiple
times in order to process several presets at once.
Original-patch-by: Sébastien Luttringer <seblu@seblu.net>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
823e24 wasn't really correct, since running 'tput setaf 0' effectively
sanity checks the terminfo as well as checking existance. However, it
does nothing to affirm that the terminal is capable of supporting
colors.
Moreover, *never* fall back on the hardcoded escapes as doing so implies
that we've found a broken terminfo and we have no idea what the terminal
is capable of doing.
This reverts commit 823e2454176d4381cd3acc30481e9d84cdc298b1.
|
|
This leaves bash completion with a duplication, but this is intentional
to avoid pulling in the entire functions file and worrying about
pollution.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
The kernel defines an offset at a fixed location within the bzImage
which we can use to find the kernel version string. Since this is fairly
important, reimplement the algorithm (which file almost surely uses)
using low level tools to avoid the possibility that file may break or
change its output, critically wounding mkinitcpio.
Note that this change leaves 'file' in use for lsinitcpio compression
detection.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Denote deprecation with unicode superscript footnote markers. Yes, this
inherently limits us to 9 deprecation notices in its current form, but
there really shouldn't ever be so many deprecated items at once.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Separate out the printing from these flags to separate functions and
examine each hook more closely, pointing out where it might be
deprecated, and what should be used in place of it.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Declaring our lookup paths like normal colon delimited PATHs lets us
reuse them for builtins like source and type to do the same work that
this function previously did.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Don't make any assumptions about the compression on modules and scan the
passed in module list for telltale extensions. This has the benefit of
doing nothing when modules are uncompressed, and adds support for
decompression of XZ modules.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Declaring _modpaths as an associative array allows us to forego the
printf|sort -u|xargs cp pipeline as we can guarantee that the array is
already prepared.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This removes any meaning from the definitions of MODULES, BINARIES,
FILES, and SCRIPT within install hooks. It also removed the deprecated
checked_modules() function, which is replaced by add_checked_modules().
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Eric Bélanger <snowmaniscool@gmail.com>
|
|
map() runs the first argument (a function) with each of the remaining
arguments as $1. The return value of map() is only 0 if all the calls
succeeded.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
If mkinitcpio -s is run, we still flush this cache to disk before
exiting.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Using anything but /lib/modules isn't really sane, and it shouldn't be
supported. If you want to use /usr/lib/modules, then /lib must be a
symlink to usr/lib.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Mostly in favor of scoping out some variables further.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Instead of using a bash test, just source the preset file. If it fails,
exit. This patch is a bit ugly because it remove a level of indentation.
|
|
This is an ugly patch, and probably does more than I'd like it to. The
idea is that mkinitcpio adopts some sort of consistent style which I'm
actually happy with. I define 3 kinds of variables:
1) local variables: all lower case, and scoped within functions. Use
freely, as they're well contained.
2) global variables: these are known to mkinitcpio internally, but are
global in scope. They mainly carry runtime configuration and collected
data during the image generation process. These are always lower case,
but carry a leading underscore to denote that they're global.
3) "API" variables: also global in scope, but exist "outside" of
mkinitcpio -- either drawn in from the configuration file, or "exported"
to the install hooks. These are always all upper case. When introducing
new variables, extreme care must be taken to pick names that will not
conflict with the environment inherited by mkinitcpio.
A HACKING file is introduced with a similar description of the above,
and more.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
The initramfs installs all modules to kernel/ which devalues the
modules.order file. To avoid any edge cases with the wrong module being
loaded (because all matching modules for a given alias will be added),
make sure that the modules.order file is actually valid.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Overlooked in b8d9c5cd2753e9. This change also assigns a value of "2" to
builtin modules which are added to the the ADDED_MODULES array, to
distinguish them from actual modules on disk. Using this, we can avoid
adding builtins to the image's runtime config.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This was always wrong and should have been braced by MODPATHS rather
than ADDED_MODULES. However, since ADDED_MODULES now possibly contains
modules that weren't actually added (builtins), creating an initramfs
without modules causes cp to be passed a null string to be copied.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
In case mkinitcpio is in run via chroot(1), this possibly silences a
harmless warning about bsdcpio failing to set the default locale. This
comes up fairly often with the recent install media and users think that
it's something to be concerned about.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Assuming modules.builtin exists, add the module names it contains to the
ADDED_MODULES hash so that we silently skip over them.
Suggested-by: Matthew Monaco <dgbaley27@0x01b.net>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Lookups in the hash table are far faster than traversing the entire
array, as this grows O(n) and introduces a particularly noticeable
slowdown on larger images.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Rename this option so that it mirrors the longopt name for -S,
--skiphooks. The original --add option remains behind in the option
parser for backwards compatability, but no other references remain.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This might be useful for creating an initramfs image as part of a kernel
package.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
mkinitcpio needs to be able to more tightly control the layout of the
image. By moving this outside the control of the base hook, it's more
reasonable to believe that a drop-in replacement for the base hook could
be written, as it now only contains the utilities required for the /init
that it provides.
Being that initialize_buildroot is outside of a hook, we can make "raw"
calls to coreutils that create the directories and symlinks, saving some
overhead and forking.
This also symlinks /usr/local/{lib,bin} into the common /usr/lib and
/usr/bin, respectively, so that there's always a way to override libs
and bins, and they're automatically pulled into our strict early init
path of /usr/bin.
Finally, we lump all this generally a little "later" in the early setup.
This addresses an unseen "bug" wherein an extra temp directory that
never gets used is created when leveraging a preset.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
I've adopted the convention of specifying the shebang for the
interpreter any given install or runtime hook that a script runs under.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|