mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-14 21:49:34 +03:00
* Substitute the path of the system derivation directly in the stage 2
init script. This removes the need for the `systemConfig' boot parameter; `init=<stage-2-init>' is enough. However, the GRUB menu builder still needs to add `systemConfig' to the kernel command line for compatibility with old configurations. svn path=/nixos/trunk/; revision=23775
This commit is contained in:
parent
4046056cdc
commit
c4f910f550
5 changed files with 17 additions and 37 deletions
|
@ -174,11 +174,9 @@ in
|
||||||
# Closures to be copied to the Nix store on the CD, namely the init
|
# Closures to be copied to the Nix store on the CD, namely the init
|
||||||
# script and the top-level system configuration directory.
|
# script and the top-level system configuration directory.
|
||||||
isoImage.storeContents =
|
isoImage.storeContents =
|
||||||
[ config.system.build.bootStage2
|
[ config.system.build.toplevel ] ++
|
||||||
config.system.build.toplevel
|
optional config.isoImage.includeSystemBuildDependencies
|
||||||
] ++
|
config.system.build.toplevel.drvPath;
|
||||||
(optional config.isoImage.includeSystemBuildDependencies
|
|
||||||
config.system.build.toplevel.drvPath);
|
|
||||||
|
|
||||||
# Create the squashfs image that contains the Nix store.
|
# Create the squashfs image that contains the Nix store.
|
||||||
system.build.squashfsStore = import ../../../lib/make-squashfs.nix {
|
system.build.squashfsStore = import ../../../lib/make-squashfs.nix {
|
||||||
|
@ -220,7 +218,7 @@ in
|
||||||
boot.loader.grub.extraEntries =
|
boot.loader.grub.extraEntries =
|
||||||
''
|
''
|
||||||
menuentry "NixOS Installer / Rescue" {
|
menuentry "NixOS Installer / Rescue" {
|
||||||
linux /boot/bzImage init=${config.system.build.bootStage2} systemConfig=${config.system.build.toplevel} ${toString config.boot.kernelParams}
|
linux /boot/bzImage init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}
|
||||||
initrd /boot/initrd
|
initrd /boot/initrd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,8 +34,7 @@ let
|
||||||
# A clue for the uboot loading
|
# A clue for the uboot loading
|
||||||
ubootKernelParams = pkgs.writeText "uboot-kernel-params.txt" ''
|
ubootKernelParams = pkgs.writeText "uboot-kernel-params.txt" ''
|
||||||
Kernel Parameters:
|
Kernel Parameters:
|
||||||
init=${config.system.build.bootStage2}
|
init=${config.system.build.toplevel}/init
|
||||||
systemConfig=${config.system.build.toplevel}
|
|
||||||
${toString config.boot.kernelParams}
|
${toString config.boot.kernelParams}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
@ -70,12 +69,7 @@ in
|
||||||
# Closures to be copied to the Nix store on the CD, namely the init
|
# Closures to be copied to the Nix store on the CD, namely the init
|
||||||
# script and the top-level system configuration directory.
|
# script and the top-level system configuration directory.
|
||||||
tarball.storeContents =
|
tarball.storeContents =
|
||||||
[ {
|
[ { object = config.system.build.toplevel;
|
||||||
object = config.system.build.bootStage2;
|
|
||||||
symlink = "none";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
object = config.system.build.toplevel;
|
|
||||||
symlink = "/var/run/current-system";
|
symlink = "/var/run/current-system";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
|
|
@ -103,13 +103,15 @@ let
|
||||||
ln -s $grub $out/grub
|
ln -s $grub $out/grub
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ln -s ${config.system.build.bootStage2} $out/init
|
|
||||||
ln -s ${config.system.build.initialRamdisk}/initrd $out/initrd
|
ln -s ${config.system.build.initialRamdisk}/initrd $out/initrd
|
||||||
|
|
||||||
echo "$activationScript" > $out/activate
|
echo "$activationScript" > $out/activate
|
||||||
substituteInPlace $out/activate --subst-var out
|
substituteInPlace $out/activate --subst-var out
|
||||||
chmod u+x $out/activate
|
chmod u+x $out/activate
|
||||||
unset activationScript
|
unset activationScript
|
||||||
|
|
||||||
|
cp ${config.system.build.bootStage2} $out/init
|
||||||
|
substituteInPlace $out/init --subst-var-by systemConfig $out
|
||||||
|
|
||||||
ln -s ${config.system.build.etc}/etc $out/etc
|
ln -s ${config.system.build.etc}/etc $out/etc
|
||||||
ln -s ${config.system.path} $out/sw
|
ln -s ${config.system.path} $out/sw
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#! @shell@
|
#! @shell@
|
||||||
|
|
||||||
# !!! copied from stage 1; remove duplication
|
systemConfig=@systemConfig@
|
||||||
|
|
||||||
|
|
||||||
# Print a greeting.
|
# Print a greeting.
|
||||||
|
@ -56,11 +56,6 @@ rm -f /etc/mtab* # not that we care about stale locks
|
||||||
cat /proc/mounts > /etc/mtab
|
cat /proc/mounts > /etc/mtab
|
||||||
|
|
||||||
|
|
||||||
# If no `systemConfig' parameter is specified on the kernel command
|
|
||||||
# line, use a fallback.
|
|
||||||
systemConfig=/nix/var/nix/profiles/system
|
|
||||||
|
|
||||||
|
|
||||||
# Process the kernel command line.
|
# Process the kernel command line.
|
||||||
for o in $(cat /proc/cmdline); do
|
for o in $(cat /proc/cmdline); do
|
||||||
case $o in
|
case $o in
|
||||||
|
@ -79,10 +74,6 @@ for o in $(cat /proc/cmdline); do
|
||||||
safemode)
|
safemode)
|
||||||
safeMode=1
|
safeMode=1
|
||||||
;;
|
;;
|
||||||
systemConfig=*)
|
|
||||||
set -- $(IFS==; echo $o)
|
|
||||||
systemConfig=$2
|
|
||||||
;;
|
|
||||||
resume=*)
|
resume=*)
|
||||||
set -- $(IFS==; echo $o)
|
set -- $(IFS==; echo $o)
|
||||||
resumeDevice=$2
|
resumeDevice=$2
|
||||||
|
@ -90,8 +81,6 @@ for o in $(cat /proc/cmdline); do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
systemConfig="$(readlink -f "$systemConfig")"
|
|
||||||
|
|
||||||
|
|
||||||
# More special file systems, initialise required directories.
|
# More special file systems, initialise required directories.
|
||||||
mkdir -m 0777 /dev/shm
|
mkdir -m 0777 /dev/shm
|
||||||
|
@ -153,19 +142,16 @@ fi
|
||||||
# Run the script that performs all configuration activation that does
|
# Run the script that performs all configuration activation that does
|
||||||
# not have to be done at boot time.
|
# not have to be done at boot time.
|
||||||
echo "running activation script..."
|
echo "running activation script..."
|
||||||
"$systemConfig"/activate
|
$systemConfig/activate
|
||||||
|
|
||||||
|
|
||||||
# Record the boot configuration.
|
# Record the boot configuration.
|
||||||
if test -n "$systemConfig"; then
|
ln -sfn "$systemConfig" /var/run/booted-system
|
||||||
ln -sfn "$systemConfig" /var/run/booted-system
|
|
||||||
|
|
||||||
# Prevent the booted system form being garbage-collected
|
# Prevent the booted system form being garbage-collected If it weren't
|
||||||
# If it weren't a gcroot, if we were running a different kernel,
|
# a gcroot, if we were running a different kernel, switched system,
|
||||||
# switched system, and garbage collected all, we could not load
|
# and garbage collected all, we could not load kernel modules anymore.
|
||||||
# kernel modules anymore.
|
ln -sfn /var/run/booted-system /nix/var/nix/gcroots/booted-system
|
||||||
ln -sfn /var/run/booted-system /nix/var/nix/gcroots/booted-system
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Ensure that the module tools can find the kernel modules.
|
# Ensure that the module tools can find the kernel modules.
|
||||||
|
|
|
@ -167,7 +167,7 @@ let
|
||||||
-drive file=$NIX_DISK_IMAGE,if=virtio,boot=on,cache=writeback,werror=report \
|
-drive file=$NIX_DISK_IMAGE,if=virtio,boot=on,cache=writeback,werror=report \
|
||||||
-kernel ${config.system.build.toplevel}/kernel \
|
-kernel ${config.system.build.toplevel}/kernel \
|
||||||
-initrd ${config.system.build.toplevel}/initrd \
|
-initrd ${config.system.build.toplevel}/initrd \
|
||||||
-append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.bootStage2} systemConfig=${config.system.build.toplevel} regInfo=${regInfo} ${kernelConsole} $QEMU_KERNEL_PARAMS" \
|
-append "$(cat ${config.system.build.toplevel}/kernel-params) init=${config.system.build.toplevel}/init regInfo=${regInfo} ${kernelConsole} $QEMU_KERNEL_PARAMS" \
|
||||||
''} \
|
''} \
|
||||||
${qemuGraphics} \
|
${qemuGraphics} \
|
||||||
$QEMU_OPTS \
|
$QEMU_OPTS \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue