summaryrefslogtreecommitdiffstats
path: root/init_functions
AgeCommit message (Collapse)AuthorFilesLines
2017-03-10init: move early mounting to function, add efivarsDave Reisner1-0/+12
ref: https://bugs.archlinux.org/task/52768
2016-07-07refactor parse_cmdline into something more readableDave Reisner1-58/+117
This refactors parse_cmdline into a few chunks of code, mainly to separate the work of parsing from the handling of the actual parsed parameters. By default, parse_cmdline_item is used as the callback for handling the parameters, but this could be overriden by other code sourcing init_functions if desirable. Our test harness passes more tests, but we leave behind some expected failures to describe the cases where it still fails. Fortunately I've not yet been able to find any cases which warrant --expect-parse-fail.
2016-07-02init: handle rootfstype as a synonym for fstypeDave Reisner1-1/+2
rootfstype is handled by the kernel, so we should handle it, too. ref: https://bugs.archlinux.org/task/45117
2013-11-27init_functions: escape slashes in tag valuesDave Reisner1-2/+11
This allows booting from devices which have labels like LABEL=/. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-07-18init: rely on ConditionPathIsReadWrite for root fsck flag0.15.0Dave Reisner1-3/+13
Add an annoying warning in case the root device is fsck'd and about to be mounted RO. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-07-01rdlogger: log messages which would have been hidden by quietDave Reisner1-1/+6
This allows 'quiet rd.log=kmsg' to produce a silent boot while still logging the full output that would have been written to the console. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-06-25init: remove unneeded intermediate variableDave Reisner1-3/+2
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-06-25init: merge duped code, use bitfield_has_bit in fsck_rootDave Reisner1-14/+8
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-06-25init: allow for logging of early userspaceDave Reisner1-2/+145
This introduces support for the rd.log and rd.debug kernel command line options, which log early userspace activity to /run/initramfs/init.log. Code is largely inspired by Dracut's implementation of early userspace logging, but without needless complexity and redundancies. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-06-19init: throw error on unknown fsck.modeDave Reisner1-2/+9
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-05-07init: redirect /proc/cmdline to parse_cmdlineDave Reisner1-1/+1
This makes it easier to test parse_cmdline. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2013-01-12init_functions: namespace parsed vars from cmdlineDave Reisner1-23/+23
It's possible, though unlikely, that someone expecting a variable of the name, e.g. "rhs" or "lhs" to be propagated from the kernel cmdline could be sadly let down because of the local scoping. Give our localized vars names less likely to clash. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-11-24init: remove unneeded variable expansionDave Reisner1-3/+3
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-11-24init: remove needless workaround for empty rootdelayDave Reisner1-1/+1
Adjust the test in poll_device to look for either an unset OR an empty 2nd parameter. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-11-24init: use exponential backoff in poll_deviceDave Reisner1-3/+13
Start at .1 second and double the interval, capping at 1s. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-08-30init: add support for root=PARTLABEL=fooDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-07-24init_functions: use a consistent default rootdelayDave Reisner1-1/+1
init defaults to a rootdelay of 10, but poll_device falls back on a default of 5 if rootdelay is somehow manage during the hook run. Keep this consistent and use 10 seconds in both places. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18init_functions: move running hooks to separate funcDave Reisner1-0/+16
Abstract this out to the init_functions file, and allow this function take 2+ parameters -- the hook name to be run, a user friendly short description, and then the list of hook files to source from. While we're at it, take advantage of the fact that hooks are now installed with executable perms. If a hook isn't marked excutable, we skip it, thereby removing our eval hack. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-28init_functions: remove non-devtmpfs caseDave Reisner1-6/+2
devtmpfs is no longer supported elsewhere, so this is essentially dead code. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-28init_functions: add support for PARTUUID tagsDave Reisner1-13/+6
libblkid (and thus blkid) gain support for this in util-linux 2.22. This block gets refactored slightly to cut out the monotony. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-02init_functions: fix missing * in fsck messageDave Reisner1-1/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-28fsck: leverage blank /etc/fstab included by baseDave Reisner1-1/+1
Since 3b18c9cd we have a blank /etc/fstab in the image. This is also forward thinking for the next release of util-linux (2.22), where fsck complains loudly about my filthy hack of using /dev/null as /etc/fstab. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-24init_functions: fix tag resolution w/o udev rulesDave Reisner1-10/+9
The combination of the udev+mdadm hooks plus a tag based root= would cause resolve_device to fail because it immediately looked for a udev symlink which would never be created. The proper fix is to get rid of the mdadm hook and to always use mdadm_udev (which should be merged into mdadm), but this might come back and bite us again. The new solution doesn't assume that udev rules exist and tries blkid first. If the device doesn't (yet) exist fall back on a udev symlink if udevd is running. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-24init_functions: support fsck.mode= cmdline parameterDave Reisner1-0/+6
Possible options are 'skip' and 'force' which are synonyms for fastboot and forcefsck, respectively. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-24init_functions: avoid special treatment for forcefsckDave Reisner1-2/+1
I don't want to make a habit of treating cmdline opts as special if they don't need to be, and this is a case where some simple PE magic can be substituted. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-04init: add informational output about mountingDave Reisner1-0/+1
Applies to both the real root and any device that's mounted on /usr Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-04init_functions: lazily resolve UUID/LABEL tagsDave Reisner1-5/+22
Relying on blkid to do tag resolution will fail when the root device doesn't yet exist. This is, of course, bad for USB root devices. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-29init: use fastboot, not skip to avoid fsckDave Reisner1-0/+5
Move this logic inside fsck_device as well, so that fastboot skips a possible fsck on the /usr partition as well. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-29init_functions: avoid using fsck_ret to check 0Dave Reisner1-7/+7
our fsck_ret function would always return true when passed 0, which clearly isn't what we want. Use a simple string compare instead. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-13Update PS1 ramfs -> rootfsGerardo Exequiel Pozzi1-1/+1
This is cosmetic change, but using rootfs is more correct than ramfs. [Rootfs is a special instance of ramfs or tmpfs, if that is enabled] Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2011-12-01init_functions: redirect poll_device output to stderrDave Reisner1-1/+1
Fixes FS#27385 Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-29init_functions: rephrase bailout messageDave Reisner1-1/+1
I think this error is more confusing to most people than it needs to be, and it's not really accurate any longer. Generalize the message and inform the user that we simply couldn't find the root device. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init_functions: simplify parse_cmdlineDave Reisner1-21/+19
Do variable name validation via the case labels rather than via PEs. This frees up the fallthrough case to simply ignore things we don't understand (and not exist). Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15fsck: implement basic fsck supportDave Reisner1-4/+65
This adds support for fsck'ing root at bootstrap if the fsck binary and necessary helpers are included. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init_functions: resolve M:m to device fileDave Reisner1-3/+19
Rather than immediately defaulting to /dev/root, attempt to resolve the major/minor pair back to a block device. If we can't do this properly, then fallback to /dev/root. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init_functions: generalize resolve_deviceDave Reisner1-41/+49
This allows a caller to pass in a device by name and get a /dev node returned. Note that this is heavily limited in that only the root device can be identified by major:minor. This might break init's API, if such a thing exists. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init_functions: move root resolution to separate functionDave Reisner1-1/+5
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init: use util-linux's /bin/mountDave Reisner1-13/+2
Providing this means we no longer need blkid for FS detection, as mount will do this for us. Adds a slight bloat to the image, in exchange for a huge convenience. Messaging is changed to assume that /bin/mount will provide useful feedback for us on failure. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init_functions: refactor poll_deviceDave Reisner1-11/+12
Beyond stylistic cleanup, add a conditional to ensure that we don't show the 'waiting for device' message if it already exists. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-22init_functions: avoid setting var without LHS0.7.5Dave Reisner1-0/+1
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-22init_functions: replace grep/sed with PEsDave Reisner1-12/+13
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-22init_functions: tighten up mount option gatheringDave Reisner1-26/+16
* Directly assign ro or rw to the rwopt rather than using readwrite as an intermediary * Use a default expansion to cut out an if block in determining the root fstype. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-01init_functions: use constants on LHS of testsDave Reisner1-3/+3
If we encounter a BOOT_IMAGE var taken from grub2, the first character could be a '(' which will throw off busybox's parser and error out. Reverse the comparison so that the LHS is always a constant, which can be compared to anything (including nothing at all). Fixes FS#26119. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-06-30init_functions/default_mount_handler: use -l option for blkid to avoid ↵Thomas Bächler1-1/+1
syntax errors in a later mount command Fixes FS#24969.
2011-06-25init: declare PATH, remove absolute pathsDave Reisner1-3/+3
We were never very consistent about this anyways. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-16use consistent vim modelinesDave Reisner1-0/+2
This also adds a /bin/bash shebang to functions. While not technically necessary, this ensures that vim gives us the correct syntax highlight file. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-07default_mount_handler: Only try to manually create the root device if ↵Thomas Bächler1-1/+1
devtmpfs is not used.
2011-06-07init_functions: simplify mount case of root=/dev/*Dave Reisner1-9/+5
/sys/class/block contains all of our block devices, including the partitions of each parent block device, so directly check for the existance of the dev file rather than looping. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-07init_functions: support {LABEL,UUID}= syntaxDave Reisner1-0/+9
use blkid to resolve a tag name to a block device. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-04-14Rewrite parse_cmdline (again)Thomas Bächler1-21/+38
This should properly handle all ugly characters in values, omit settings any forbidden variable names and take care of double-quoted values with spaces in them. This should finally fix FS#23467, FS#22080 and FS#13900.