VM builds: Use BusyBox

http://hydra.nixos.org/build/3510928
This commit is contained in:
Eelco Dolstra 2012-12-18 16:57:11 +01:00
parent 7503291ff9
commit b643316a42

View File

@ -38,35 +38,19 @@ rec {
# Copy what we need from Glibc. # Copy what we need from Glibc.
cp -p ${pkgs.stdenv.glibc}/lib/ld-linux*.so.? $out/lib cp -p ${pkgs.stdenv.glibc}/lib/ld-linux*.so.? $out/lib
cp -p ${pkgs.stdenv.glibc}/lib/libc.so.* $out/lib cp -p ${pkgs.stdenv.glibc}/lib/libc.so.* $out/lib
cp -p ${pkgs.stdenv.glibc}/lib/librt.so.* $out/lib cp -p ${pkgs.stdenv.glibc}/lib/libm.so.* $out/lib
cp -p ${pkgs.stdenv.glibc}/lib/libdl.so.* $out/lib
# Copy some utillinux stuff. # Copy BusyBox.
cp ${utillinux}/bin/mount ${utillinux}/bin/umount $out/bin cp -pd ${pkgs.busybox}/bin/* ${pkgs.busybox}/sbin/* $out/bin
cp -pd ${utillinux}/lib/libblkid*.so.* $out/lib
cp -pd ${utillinux}/lib/libuuid*.so.* $out/lib
# Copy some coreutils.
cp ${coreutils}/bin/basename $out/bin
cp ${coreutils}/bin/mkdir $out/bin
cp ${coreutils}/bin/mknod $out/bin
cp ${coreutils}/bin/cat $out/bin
cp ${coreutils}/bin/chroot $out/bin
cp ${coreutils}/bin/sleep $out/bin
cp ${coreutils}/bin/ln $out/bin
# Copy some other tools.
cp ${bash}/bin/bash $out/bin
cp ${module_init_tools}/sbin/insmod $out/bin/insmod
cp ${nettools}/sbin/ifconfig $out/bin
cp ${sysvinit}/sbin/halt $out/bin
# Run patchelf to make the programs refer to the copied libraries. # Run patchelf to make the programs refer to the copied libraries.
for i in $out/bin/* $out/lib/*; do if ! test -L $i; then nuke-refs $i; fi; done for i in $out/bin/* $out/lib/*; do if ! test -L $i; then nuke-refs $i; fi; done
for i in $out/bin/*; do for i in $out/bin/*; do
echo "patching $i..." if [ -f "$i" -a ! -L "$i" ]; then
patchelf --set-interpreter $out/lib/ld-linux*.so.? --set-rpath $out/lib $i || true echo "patching $i..."
patchelf --set-interpreter $out/lib/ld-linux*.so.? --set-rpath $out/lib $i || true
fi
done done
''; # */ ''; # */
@ -84,8 +68,7 @@ rec {
stage1Init = writeScript "vm-run-stage1" '' stage1Init = writeScript "vm-run-stage1" ''
#! ${initrdUtils}/bin/bash -e #! ${initrdUtils}/bin/ash -e
echo START
export PATH=${initrdUtils}/bin export PATH=${initrdUtils}/bin
@ -167,8 +150,7 @@ rec {
mount -o remount,ro dummy /fs mount -o remount,ro dummy /fs
echo DONE poweroff -f
halt -d -p -f
''; '';