userspace: overhaul

master
Adam Joseph 2 years ago
parent 4711bd6676
commit e43f31656d

@ -56,9 +56,8 @@ in {
'';
});
userspace = prev.userspace.override {
inherit modules_insmod;
inherit modules_noinsmod;
userspace = prev.userspace.override {
};
initramfs = prev.initramfs.override {

@ -3,9 +3,18 @@
{ lib
, nixpkgsOnBuildForHost
, kernel
, modules_noinsmod ? [ ]
, modules_insmod ? [ ]
, kernelname
, bootScript ? ../boot.sh # symlinked to /init if non-null
, withBusybox ? true
, withSignify ? true
# Inclusion of these is temporarily disabled. I had a bunch of
# ugly space-saving hacks that were removed during the pre-release
# cleanup, and it turns out that without those hacks there isn't enough
# space for the large userspace tools. Once I clean up and
# reinstate those hacks I will reenable this.
, withLvm ? false
, withCryptsetup ? false
, withKexec ? false
}:
let
@ -13,43 +22,33 @@ let
in stdenv.mkDerivation {
name = "ownerboot-initramfs-userspace";
modules_all = (lib.concatMapStringsSep "\n" (m: "${kernel.version}/kernel/" + m) (modules_insmod ++ modules_noinsmod))+"\n";
modules_insmod = (lib.concatMapStringsSep "\n" (m: "${kernel.version}/kernel/" + m) modules_insmod) + "\n";
bootScript = builtins.readFile ../boot.sh;
passAsFile = [ "bootScript" "modules_insmod" ];
dontUnpack = true;
dontFixup = true;
# FIXME: get this working again using `__impure` derivations
#bannerText = "$$(git describe --abbrev=4 --dirty --always --tags) built $$(date +'%Y-%h-%d at %H:%M')";
bannerText = "ownerboot";
installPhase = ''
runHook preInstall
mkdir -p $out/usr
cp -r ${busybox}/bin $out/bin
chmod -R u+w $out
cp ${signify}/bin/signify $out/bin/
ln -s bin $out/sbin
ln -s ../bin $out/usr/bin
ln -s ../sbin $out/usr/sbin
cp $bootScriptPath $out/boot.sh
'' + lib.optionalString (bootScript != null) ''
cp ${bootScript} $out/boot.sh
chmod +x $out/boot.sh
ln -s boot.sh $out/init
chmod +x $out/sbin/init
mkdir -p $out/lib/modules
echo "ownerboot ${platform_name} $bannerText" > $out/banner.txt
cp $modules_insmodPath $out/modules-insmod.txt
# Inclusion of these is temporarily disabled. I had a bunch of
# ugly space-saving hacks that were removed during the pre-release
# cleanup, and it turns out that without those hacks there isn't enough
# space for the large userspace tools. Once I clean up and
# reinstate those hacks I will reenable this.
#cp ${lib.getBin lvm2}/bin/lvm $out/bin/
#cp ${lib.getBin lvm2}/bin/dmsetup $out/bin/
#cp ${cryptsetup}/bin/cryptsetup $out/bin/
#cp ${kexec-tools}/bin/kexec $out/bin/
'' + lib.optionalString withBusybox ''
cp -r ${busybox}/bin $out/bin
chmod -R u+w $out/bin
'' + lib.optionalString withSignify ''
cp ${signify}/bin/signify $out/bin/
'' + lib.optionalString withLvm ''
cp ${lib.getBin lvm2}/bin/lvm $out/bin/
cp ${lib.getBin lvm2}/bin/dmsetup $out/bin/
'' + lib.optionalString withCryptsetup ''
cp ${cryptsetup}/bin/cryptsetup $out/bin/
'' + lib.optionalString withKexec ''
cp ${kexec-tools}/bin/kexec $out/bin/
'' + ''
runHook postInstall
'';
}

Loading…
Cancel
Save