* 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
|
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.
|
# Determine the set of modules that we need to mount the root FS.
|
||||||
modulesClosure = import ./modules-closure.nix {
|
modulesClosure = import ./modules-closure.nix {
|
||||||
inherit (pkgs) stdenv kernel module_init_tools;
|
inherit (pkgs) stdenv kernel module_init_tools;
|
||||||
@ -45,10 +51,12 @@ rec {
|
|||||||
ensureDir $out/bin
|
ensureDir $out/bin
|
||||||
cp $utillinux/bin/mount $utillinux/bin/umount $utillinux/sbin/pivot_root $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 -p $e2fsprogs/sbin/fsck* $e2fsprogs/sbin/e2fsck $out/bin
|
||||||
|
cp $splashutils/bin/splash_helper $out/bin
|
||||||
nuke-refs $out/bin/*
|
nuke-refs $out/bin/*
|
||||||
";
|
";
|
||||||
buildInputs = [pkgs.nukeReferences];
|
buildInputs = [pkgs.nukeReferences];
|
||||||
inherit (pkgsStatic) utillinux;
|
inherit (pkgsStatic) utillinux;
|
||||||
|
inherit (pkgs) splashutils;
|
||||||
e2fsprogs = pkgs.e2fsprogsDiet;
|
e2fsprogs = pkgs.e2fsprogsDiet;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -71,7 +79,21 @@ rec {
|
|||||||
# the initial RAM disk.
|
# the initial RAM disk.
|
||||||
initialRamdisk = import ./make-initrd.nix {
|
initialRamdisk = import ./make-initrd.nix {
|
||||||
inherit (pkgs) stdenv cpio;
|
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.
|
# Transparent TTY backgrounds.
|
||||||
(import ./upstart-jobs/tty-backgrounds.nix {
|
(import ./upstart-jobs/tty-backgrounds.nix {
|
||||||
inherit (pkgs) stdenv splashutils;
|
inherit (pkgs) stdenv splashutils;
|
||||||
backgrounds = (import ./splash-themes.nix {
|
backgrounds = splashThemes.ttyBackgrounds;
|
||||||
inherit (pkgs) fetchurl;
|
|
||||||
}).ttyBackgrounds;
|
|
||||||
})
|
})
|
||||||
|
|
||||||
# Handles the maintenance/stalled event (single-user shell).
|
# Handles the maintenance/stalled event (single-user shell).
|
||||||
|
@ -24,11 +24,11 @@ done
|
|||||||
|
|
||||||
|
|
||||||
# Mount special file systems.
|
# Mount special file systems.
|
||||||
mkdir /etc # to shut up mount
|
mkdir -p /etc # to shut up mount
|
||||||
touch /etc/fstab # idem
|
touch /etc/fstab # idem
|
||||||
mkdir /proc
|
mkdir -p /proc
|
||||||
mount -t proc none /proc
|
mount -t proc none /proc
|
||||||
mkdir /sys
|
mkdir -p /sys
|
||||||
mount -t sysfs none /sys
|
mount -t sysfs none /sys
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# Create an initial ramdisk containing the closure of the specified
|
# 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
|
# stages of booting a Linux system. It is loaded by the boot loader
|
||||||
# along with the kernel image. It's supposed to contain everything
|
# along with the kernel image. It's supposed to contain everything
|
||||||
# (such as kernel modules) necessary to allow us to mount the root
|
# (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.
|
# 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.
|
# argument.
|
||||||
|
|
||||||
{stdenv, cpio, init}:
|
{stdenv, cpio, contents}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
name = "initrd";
|
name = "initrd";
|
||||||
builder = ./make-initrd.sh;
|
builder = ./make-initrd.sh;
|
||||||
buildInputs = [cpio];
|
buildInputs = [cpio];
|
||||||
inherit init;
|
|
||||||
|
|
||||||
# For obtaining the closure of `init'.
|
# !!! should use XML.
|
||||||
exportReferencesGraph = ["init-closure" init];
|
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 `contents'.
|
||||||
|
exportReferencesGraph =
|
||||||
|
map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents;
|
||||||
pathsFromGraph = ./paths-from-graph.sh;
|
pathsFromGraph = ./paths-from-graph.sh;
|
||||||
}
|
}
|
||||||
|
@ -2,20 +2,41 @@ source $stdenv/setup
|
|||||||
|
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
# Get the paths in the closure of `init'.
|
objects=($objects)
|
||||||
if ! test -e ./init-closure; then
|
symlinks=($symlinks)
|
||||||
echo 'Your Nix installation is too old! Upgrade to nix-0.11pre7038 or newer.'
|
suffices=($suffices)
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
storePaths=$($SHELL $pathsFromGraph ./init-closure)
|
|
||||||
|
|
||||||
# Paths in cpio archives *must* be relative, otherwise the kernel
|
|
||||||
# won't unpack 'em.
|
|
||||||
mkdir root
|
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.
|
# Put the closure in a gzipped cpio archive.
|
||||||
ensureDir $out
|
ensureDir $out
|
||||||
ln -s $init init
|
(cd root && find * -print0 | cpio -ov -H newc --null | gzip -9 > $out/initrd)
|
||||||
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
|
# 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
|
# 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
|
# the first one. If a tty does not appear, it doesn't get a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user