* Provide an option to add more files to the ISO image.
svn path=/nixos/branches/modular-nixos/; revision=15903
This commit is contained in:
parent
ca061eb628
commit
37edcf4fae
|
@ -6,13 +6,24 @@ targets_=($targets)
|
||||||
objects=($objects)
|
objects=($objects)
|
||||||
symlinks=($symlinks)
|
symlinks=($symlinks)
|
||||||
|
|
||||||
|
|
||||||
|
# Remove the initial slash from a path, since genisofs likes it that way.
|
||||||
|
stripSlash() {
|
||||||
|
res="$1"
|
||||||
|
if test "${res:0:1}" = /; then res=${res:1}; fi
|
||||||
|
}
|
||||||
|
|
||||||
|
stripSlash "$bootImage"; bootImage="$res"
|
||||||
|
|
||||||
|
|
||||||
if test -n "$bootable"; then
|
if test -n "$bootable"; then
|
||||||
|
|
||||||
# The -boot-info-table option modifies the $bootImage file, so
|
# The -boot-info-table option modifies the $bootImage file, so
|
||||||
# find it in `contents' and make a copy of it (since the original
|
# find it in `contents' and make a copy of it (since the original
|
||||||
# is read-only in the Nix store...).
|
# is read-only in the Nix store...).
|
||||||
for ((i = 0; i < ${#targets_[@]}; i++)); do
|
for ((i = 0; i < ${#targets_[@]}; i++)); do
|
||||||
if test "${targets_[$i]}" = "$bootImage"; then
|
stripSlash "${targets_[$i]}"
|
||||||
|
if test "$res" = "$bootImage"; then
|
||||||
echo "copying the boot image ${sources_[$i]}"
|
echo "copying the boot image ${sources_[$i]}"
|
||||||
cp "${sources_[$i]}" boot.img
|
cp "${sources_[$i]}" boot.img
|
||||||
chmod u+w boot.img
|
chmod u+w boot.img
|
||||||
|
@ -23,11 +34,14 @@ if test -n "$bootable"; then
|
||||||
bootFlags="-b $bootImage -c .boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table"
|
bootFlags="-b $bootImage -c .boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
touch pathlist
|
touch pathlist
|
||||||
|
|
||||||
|
|
||||||
# Add the individual files.
|
# Add the individual files.
|
||||||
for ((i = 0; i < ${#targets_[@]}; i++)); do
|
for ((i = 0; i < ${#targets_[@]}; i++)); do
|
||||||
echo "${targets_[$i]}=$(readlink -f ${sources_[$i]})" >> pathlist
|
stripSlash "${targets_[$i]}"
|
||||||
|
echo "$res=$(readlink -f ${sources_[$i]})" >> pathlist
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
@ -54,6 +68,7 @@ for ((n = 0; n < ${#objects[*]}; n++)); do
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# !!! what does this do?
|
||||||
cat pathlist | sed -e 's/=\(.*\)=\(.*\)=/\\=\1=\2\\=/' | tee pathlist.safer
|
cat pathlist | sed -e 's/=\(.*\)=\(.*\)=/\\=\1=\2\\=/' | tee pathlist.safer
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,23 @@
|
||||||
{config, pkgs, ...}:
|
{config, pkgs, ...}:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
||||||
|
options = {
|
||||||
|
|
||||||
|
isoImage.contents = pkgs.lib.mkOption {
|
||||||
|
example =
|
||||||
|
[ { source = pkgs.memtest86 + "/memtest.bin";
|
||||||
|
target = "boot/memtest.bin";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
description = ''
|
||||||
|
This option lists files that have to be copied to fixed
|
||||||
|
locations in the generated ISO image.
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
cdLabel = "NIXOS_INSTALLATION_CD";
|
cdLabel = "NIXOS_INSTALLATION_CD";
|
||||||
|
|
||||||
|
@ -15,18 +32,14 @@ let
|
||||||
timeout 10
|
timeout 10
|
||||||
splashimage /boot/background.xpm.gz
|
splashimage /boot/background.xpm.gz
|
||||||
|
|
||||||
title Boot from hard disk
|
${config.boot.extraGrubEntries}
|
||||||
root (hd0)
|
|
||||||
chainloader +1
|
|
||||||
|
|
||||||
title NixOS Installer / Rescue
|
|
||||||
kernel /boot/vmlinuz init=/init ${toString config.boot.kernelParams}
|
|
||||||
initrd /boot/initrd
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
require = options;
|
||||||
|
|
||||||
# In stage 1 of the boot, mount the CD/DVD as the root FS by label
|
# In stage 1 of the boot, mount the CD/DVD as the root FS by label
|
||||||
# so that we don't need to know its device.
|
# so that we don't need to know its device.
|
||||||
fileSystems =
|
fileSystems =
|
||||||
|
@ -44,36 +57,52 @@ in
|
||||||
# and move that bit of code here.
|
# and move that bit of code here.
|
||||||
boot.isLiveCD = true;
|
boot.isLiveCD = true;
|
||||||
|
|
||||||
|
# Individual files to be included on the CD, outside of the Nix
|
||||||
|
# store on the CD.
|
||||||
|
isoImage.contents =
|
||||||
|
[ { source = "${pkgs.grub}/lib/grub/${if pkgs.stdenv.system == "i686-linux" then "i386-pc" else "x86_64-unknown"}/stage2_eltorito";
|
||||||
|
target = "/boot/grub/stage2_eltorito";
|
||||||
|
}
|
||||||
|
{ source = pkgs.writeText "menu.lst" grubCfg;
|
||||||
|
target = "/boot/grub/menu.lst";
|
||||||
|
}
|
||||||
|
{ source = config.boot.kernelPackages.kernel + "/vmlinuz";
|
||||||
|
target = "/boot/vmlinuz";
|
||||||
|
}
|
||||||
|
{ source = config.system.build.initialRamdisk + "/initrd";
|
||||||
|
target = "/boot/initrd";
|
||||||
|
}
|
||||||
|
{ source = config.boot.grubSplashImage;
|
||||||
|
target = "/boot/background.xpm.gz";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
# The Grub menu.
|
||||||
|
boot.extraGrubEntries =
|
||||||
|
''
|
||||||
|
title Boot from hard disk
|
||||||
|
root (hd0)
|
||||||
|
chainloader +1
|
||||||
|
|
||||||
|
title NixOS Installer / Rescue
|
||||||
|
kernel /boot/vmlinuz init=/init ${toString config.boot.kernelParams}
|
||||||
|
initrd /boot/initrd
|
||||||
|
'';
|
||||||
|
|
||||||
# Create the ISO image.
|
# Create the ISO image.
|
||||||
system.build.isoImage = import ../../../lib/make-iso9660-image.nix {
|
system.build.isoImage = import ../../../lib/make-iso9660-image.nix {
|
||||||
inherit (pkgs) stdenv perl cdrkit pathsFromGraph;
|
inherit (pkgs) stdenv perl cdrkit pathsFromGraph;
|
||||||
#isoName = "${relName}-${platform}.iso";
|
#isoName = "${relName}-${platform}.iso";
|
||||||
|
|
||||||
bootable = true;
|
bootable = true;
|
||||||
bootImage = "boot/grub/stage2_eltorito";
|
bootImage = "/boot/grub/stage2_eltorito";
|
||||||
|
|
||||||
#compressImage = ...;
|
#compressImage = ...;
|
||||||
|
|
||||||
volumeID = cdLabel;
|
volumeID = cdLabel;
|
||||||
|
|
||||||
# Single files to be copied to fixed locations on the CD.
|
# Single files to be copied to fixed locations on the CD.
|
||||||
contents =
|
contents = config.isoImage.contents;
|
||||||
[ { source = "${pkgs.grub}/lib/grub/${if pkgs.stdenv.system == "i686-linux" then "i386-pc" else "x86_64-unknown"}/stage2_eltorito";
|
|
||||||
target = "boot/grub/stage2_eltorito";
|
|
||||||
}
|
|
||||||
{ source = pkgs.writeText "menu.lst" grubCfg;
|
|
||||||
target = "boot/grub/menu.lst";
|
|
||||||
}
|
|
||||||
{ source = config.boot.kernelPackages.kernel + "/vmlinuz";
|
|
||||||
target = "boot/vmlinuz";
|
|
||||||
}
|
|
||||||
{ source = config.system.build.initialRamdisk + "/initrd";
|
|
||||||
target = "boot/initrd";
|
|
||||||
}
|
|
||||||
{ source = config.boot.grubSplashImage;
|
|
||||||
target = "boot/background.xpm.gz";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
# Closures to be copied to the Nix store on the CD.
|
# Closures to be copied to the Nix store on the CD.
|
||||||
storeContents =
|
storeContents =
|
||||||
|
|
Loading…
Reference in a new issue