* Show a splash screen during booting. The splash screen is displayed
by the program /sbin/splash_helper in the initrd and is called even before /init. * make-initrd.nix: allow a list of FSOs to be placed in the initrd, with a symlink to each top-level FSO (e.g., /init, /sbin/splash_helper, /etc/splash). * make-initrd.nix: pre-create /proc, /dev and /sys, because splash_helper needs them. svn path=/nixu/trunk/; revision=7144
This commit is contained in:
parent
0905c1525a
commit
3a70748bb5
|
@ -28,6 +28,12 @@ rec {
|
|||
nix = pkgs.nixUnstable; # we need the exportReferencesGraph feature
|
||||
|
||||
|
||||
# Splash configuration.
|
||||
splashThemes = import ./splash-themes.nix {
|
||||
inherit (pkgs) fetchurl;
|
||||
};
|
||||
|
||||
|
||||
# Determine the set of modules that we need to mount the root FS.
|
||||
modulesClosure = import ./modules-closure.nix {
|
||||
inherit (pkgs) stdenv kernel module_init_tools;
|
||||
|
@ -45,10 +51,12 @@ rec {
|
|||
ensureDir $out/bin
|
||||
cp $utillinux/bin/mount $utillinux/bin/umount $utillinux/sbin/pivot_root $out/bin
|
||||
cp -p $e2fsprogs/sbin/fsck* $e2fsprogs/sbin/e2fsck $out/bin
|
||||
cp $splashutils/bin/splash_helper $out/bin
|
||||
nuke-refs $out/bin/*
|
||||
";
|
||||
buildInputs = [pkgs.nukeReferences];
|
||||
inherit (pkgsStatic) utillinux;
|
||||
inherit (pkgs) splashutils;
|
||||
e2fsprogs = pkgs.e2fsprogsDiet;
|
||||
};
|
||||
|
||||
|
@ -71,7 +79,21 @@ rec {
|
|||
# the initial RAM disk.
|
||||
initialRamdisk = import ./make-initrd.nix {
|
||||
inherit (pkgs) stdenv cpio;
|
||||
init = bootStage1;
|
||||
contents = [
|
||||
{ object = bootStage1;
|
||||
symlink = "/init";
|
||||
}
|
||||
{ object = extraUtils;
|
||||
suffix = "/bin/splash_helper";
|
||||
symlink = "/sbin/splash_helper";
|
||||
}
|
||||
{ object = import ./helpers/unpack-theme.nix {
|
||||
inherit (pkgs) stdenv;
|
||||
theme = splashThemes.splashScreen;
|
||||
};
|
||||
symlink = "/etc/splash";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
|
||||
|
@ -116,9 +138,7 @@ rec {
|
|||
# Transparent TTY backgrounds.
|
||||
(import ./upstart-jobs/tty-backgrounds.nix {
|
||||
inherit (pkgs) stdenv splashutils;
|
||||
backgrounds = (import ./splash-themes.nix {
|
||||
inherit (pkgs) fetchurl;
|
||||
}).ttyBackgrounds;
|
||||
backgrounds = splashThemes.ttyBackgrounds;
|
||||
})
|
||||
|
||||
# Handles the maintenance/stalled event (single-user shell).
|
||||
|
|
|
@ -24,11 +24,11 @@ done
|
|||
|
||||
|
||||
# Mount special file systems.
|
||||
mkdir /etc # to shut up mount
|
||||
mkdir -p /etc # to shut up mount
|
||||
touch /etc/fstab # idem
|
||||
mkdir /proc
|
||||
mkdir -p /proc
|
||||
mount -t proc none /proc
|
||||
mkdir /sys
|
||||
mkdir -p /sys
|
||||
mount -t sysfs none /sys
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Create an initial ramdisk containing the closure of the specified
|
||||
# `init' package. An initial ramdisk is used during the initial
|
||||
# file system objects. An initial ramdisk is used during the initial
|
||||
# stages of booting a Linux system. It is loaded by the boot loader
|
||||
# along with the kernel image. It's supposed to contain everything
|
||||
# (such as kernel modules) necessary to allow us to mount the root
|
||||
|
@ -8,18 +8,24 @@
|
|||
#
|
||||
# An initrd is really just a gzipped cpio archive.
|
||||
#
|
||||
# A symlink `/init' is made to the store path passed in the `init'
|
||||
# Symlinks are created for each top-level file system object. E.g.,
|
||||
# `contents = {object = ...; symlink = /init;}' is a typical
|
||||
# argument.
|
||||
|
||||
{stdenv, cpio, init}:
|
||||
{stdenv, cpio, contents}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "initrd";
|
||||
builder = ./make-initrd.sh;
|
||||
buildInputs = [cpio];
|
||||
inherit init;
|
||||
|
||||
# !!! should use XML.
|
||||
objects = map (x: x.object) contents;
|
||||
symlinks = map (x: x.symlink) contents;
|
||||
suffices = map (x: if x ? suffix then x.suffix else "none") contents;
|
||||
|
||||
# For obtaining the closure of `init'.
|
||||
exportReferencesGraph = ["init-closure" init];
|
||||
# For obtaining the closure of `contents'.
|
||||
exportReferencesGraph =
|
||||
map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents;
|
||||
pathsFromGraph = ./paths-from-graph.sh;
|
||||
}
|
||||
|
|
|
@ -2,20 +2,41 @@ source $stdenv/setup
|
|||
|
||||
set -o pipefail
|
||||
|
||||
# Get the paths in the closure of `init'.
|
||||
if ! test -e ./init-closure; then
|
||||
echo 'Your Nix installation is too old! Upgrade to nix-0.11pre7038 or newer.'
|
||||
exit 1
|
||||
fi
|
||||
storePaths=$($SHELL $pathsFromGraph ./init-closure)
|
||||
objects=($objects)
|
||||
symlinks=($symlinks)
|
||||
suffices=($suffices)
|
||||
|
||||
# Paths in cpio archives *must* be relative, otherwise the kernel
|
||||
# won't unpack 'em.
|
||||
mkdir root
|
||||
cd root
|
||||
cp -prd --parents $storePaths .
|
||||
|
||||
# Needed for splash_helper, which gets run before init.
|
||||
mkdir root/dev
|
||||
mkdir root/sys
|
||||
mkdir root/proc
|
||||
|
||||
|
||||
for ((n = 0; n < ${#objects[*]}; n++)); do
|
||||
object=${objects[$n]}
|
||||
symlink=${symlinks[$n]}
|
||||
suffix=${suffices[$n]}
|
||||
if test "$suffix" = none; then suffix=; fi
|
||||
|
||||
# Get the paths in the closure of `object'.
|
||||
closure=closure-$(basename $symlink)
|
||||
if ! test -e $closure; then
|
||||
echo 'Your Nix installation is too old! Upgrade to nix-0.11pre7038 or newer.'
|
||||
exit 1
|
||||
fi
|
||||
storePaths=$($SHELL $pathsFromGraph $closure)
|
||||
|
||||
# Paths in cpio archives *must* be relative, otherwise the kernel
|
||||
# won't unpack 'em.
|
||||
(cd root && cp -prd --parents $storePaths .)
|
||||
|
||||
mkdir -p $(dirname root/$symlink)
|
||||
ln -s $object$suffix root/$symlink
|
||||
done
|
||||
|
||||
|
||||
# Put the closure in a gzipped cpio archive.
|
||||
ensureDir $out
|
||||
ln -s $init init
|
||||
find * -print0 | cpio -ov -H newc --null | gzip -9 > $out/initrd
|
||||
(cd root && find * -print0 | cpio -ov -H newc --null | gzip -9 > $out/initrd)
|
||||
|
|
|
@ -25,6 +25,11 @@ rec {
|
|||
};
|
||||
|
||||
|
||||
# The splash screen.
|
||||
|
||||
splashScreen = themeBabyTux;
|
||||
|
||||
|
||||
# The themes to use for each tty. For each tty except the first
|
||||
# entry in the list, you can omit `theme' to get the same theme as
|
||||
# the first one. If a tty does not appear, it doesn't get a
|
||||
|
|
Loading…
Reference in a new issue