Age | Commit message (Collapse) | Author | Files | Lines |
|
This increases compression efficiency, which might be useful on an image
containing a lot of modules.
For the usecase I had in mind, this reduced the size by about a quarter.
Signed-off-by: Tom Gundersen <teg@jklm.no>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
depmod doesn't care where modules are, within reason, and separating
modules into the respective hierarchies only serves to irritate users
who go looking for modules in the rootfs (aka me). Forget all this and
dump everything into the kernel/ dir.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Move the unsetting of the errtrace and ERR trap flags to after the
image has been built. This lets us capture errors during module
installation to the build root and the call to depmod. Either of these
steps failing could be hazardous and should prompt a failure.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
All official hooks have been using build() for quite some time now.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Otherwise we need to modprobe module manually.
(Particulary I need this for archiso for using /dev/loop-control)
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
|
|
When present, modules.order will allow depmod to order the binary module
indicies for faster lookups and more deterministic behavior in resolving
aliases. We can discard this file from the buildroot after depmod is
called.
modules.builtin.bin is added as well (generated from modules.builtin),
to allow modprobe to not fail when a symbol is provided as a builtin.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Follow suit with lsinitcpio (change 0495018d) and make output colorless
on redirecting/piping stdout.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This forces bash tests as well as utilities like find to dereference
MODULEDIR in the odd case that it's a symlink.
Addresses FS#27494
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This is mostly a debugging aid. lsinitcpio will be taught to read this.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This lets the config file be an override for any files or binaries added
by hooks.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Maybe something went wrong with depmod after a kernel install, or the
user grabbed a kernel directory for an old kernel. Either way, if you're
using an initramfs, there's a very high probability that you'll have at
least 1 module on it.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
- Always call this function. At worst, just return the current kver.
- Do all our error reporting from within the function.
- Add an additional check for existance prior to allow for a more
appropriate error message when we encounter a situation such as /boot
not being mounted.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
cc36db45 was a bit too strict about localizing variables and blew out
TMPDIR, which might be a legit variable sourced from the calling
environment. Restore this behavior with a bit of refactoring, and
additionally add in a check to make sure the temporary directory is
writeable before proceeding.
Fixes FS#26373.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
As it turns out, the mountpoint toy from util-linux isn't really at
feature parity with sysvinit's. In particular, and with respect to
v2.20:
- It throws false negatives when /proc isn't mounted. Rather, it should
fall back on using stat(2), as is the basis for sysvinit's tool.
- when /proc is mounted with as source of 'none', it segfaults on a null
dereference.
Patches have been sent upstream to resolve these issues, but in the
meantime, we're mounting /dev and /proc for very specific reasons.
Instead of relying on a fork/exec to figure out if these API FS's are
mounted, use a simple bash test to see if these specific needs are
available within the FS.
One of many possible fixes for FS#26344.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
If PRESET is set, we're in the main loop, not a worker process. No image
will ever be created here, so there's never a need for saving any build
dir.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This avoids errors with process substitutions in chroots, among other
things. It's important that /proc be checked first as /etc/mtab might be
a link to /proc/self/mounts.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Instead of bailing entirely, throw an error, and ensure that we exit
with a non-zero status. The user might do something as simple as
misspell a hook name which may or may not prevent a useful image from
being created.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Avoids explosions if a user has no HOOKS in their config, as seen:
https://bbs.archlinux.org/viewtopic.php?pid=966344
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Also make sure that simple variables are declared as null strings.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Broken in 491a99.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This also removes a superfluous check on MODULEDIR, which is already
covered by get_kernver.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
This should be performed first, to avoid false positives on any checks
that would have been previously done before we knew our BASEDIR was
valid. Remove usage of readlink here as well, and use pushd/pwd to
resolve. The final trimming of any trailing slash (which might be the
entire BASEDIR value) resolves an edge case bug where specifying a
BASEDIR that resolved to '/' would cause explosions in add_symlink.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
|
|
build an array of paths to modules, and install them all at once with
mkdir -p and cp --parents. Cuts back on our major source of calls to
install(1).
This is a tad ugly in that it creates some amount of data duplication,
keeping an array of paths in addition to module names. However, turns
out to be a worthwhile tradeoff as merging the two datasets into one
results in the need for massive string trimming.
|
|
There's no use case for us calling cleanup without exiting afterwards,
so we can simplify all of our cleanup;exit; calls into just cleanup.
This means our sighandler is no longer needed (it wasn't really, to
begin with), but we split it up to make sure we exit with a posix-ish
128+signum exit value.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Much to my chagrin, we're going back to using ldd directly, as it's
otherwise too difficult to account for odd setups, such as idiots
wanting to create multilib initramfs images, or more commonly -- a 64
bit kernel on a 32 bit userland. Fortunately, we don't suffer too large
a regression in speed compared to the previous implementation.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
The _add_dir call is all wrong. The necessary paths are created by
reversing the order of the _add_symlink and _add_file calls, as
_add_file will take care of creating parent directories.
Thanks-to: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
We can't let add_file get its hands on the config file, because we need
to be sure that an absolute path is honored. As a side effect, ensure
that $BASEDIR is appended to the config file during preset processing.
Thanks-to: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
|
|
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
|
|
Thanks to Dave Reisner for having suggested!
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
|
|
before:
mkinitcpio -H sex
/sbin/mkinitcpio: line 105: /lib/initcpio/install/sex: No such file or directory
Help for hook 'sex':
GNU bash, version 4.2.10(2)-release (x86_64-unknown-linux-gnu)
These shell commands are defined internally. Type `help' to see this list.
after:
mkinitcpio -H sex
==> ERROR: No hook sex
Signed-off-by: Sebastien Luttringer <seblu@seblu.net>
|
|
This add proper support for a $BASEDIR, wherein as much as possible is
taken from the user specified root, instead of mixing and matching
binaries and modules. This avoids conflicts, particularly with binaries
like udev or module-init-tools which may have newer functionality that
the root in the $BASEDIR requires.
This is somewhat of a large patch, which involves a few key changes:
1) Add a new class of "private" functions: _add_*, which act as a "back
end" for the equivalent non-underscore-prefixed functions.
2) Refactor the add_* family of functions to use these new back end
functions. This generally simplifies the logic as we have a clear
division of labor.
3) Instead of using ldd, which is a glorified wrapper around the RTLD,
create a wrapper around the RTLD and invoke it ourselves. This is
basically just a small performance improvement -- the bulk of the
parsing done by this function's output is done in pure bash.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
It would be better to catch errors in build as well, but this isn't
entirely feasible due to the expectation of some builtins to return
non-zero during normal operations (e.g., read returns 1 on EOF).
Addresses FS#20661
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Display an actual error message for the user when they enter an
incorrect option, or neglect to provide $OPTARG when needed.
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
alphabetize the usage while we're at it
|