Make module loading work in VMs
Also, execute stage 2 as PID 1.
This commit is contained in:
parent
b97362989f
commit
fef86de618
|
@ -140,15 +140,7 @@ rec {
|
||||||
echo "127.0.0.1 localhost" > /fs/etc/hosts
|
echo "127.0.0.1 localhost" > /fs/etc/hosts
|
||||||
|
|
||||||
echo "starting stage 2 ($command)"
|
echo "starting stage 2 ($command)"
|
||||||
test -n "$command"
|
exec switch_root /fs $command $out
|
||||||
|
|
||||||
set +e
|
|
||||||
chroot /fs $command $out
|
|
||||||
echo $? > /fs/tmp/xchg/in-vm-exit
|
|
||||||
|
|
||||||
mount -o remount,ro dummy /fs
|
|
||||||
|
|
||||||
poweroff -f
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
||||||
|
@ -181,12 +173,27 @@ rec {
|
||||||
${coreutils}/bin/ln -s ${bash}/bin/sh /bin/sh
|
${coreutils}/bin/ln -s ${bash}/bin/sh /bin/sh
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Set up automatic kernel module loading.
|
||||||
|
export MODULE_DIR=${linux}/lib/modules/
|
||||||
|
${coreutils}/bin/cat <<EOF > /run/modprobe
|
||||||
|
#! /bin/sh
|
||||||
|
export MODULE_DIR=$MODULE_DIR
|
||||||
|
exec ${kmod}/bin/modprobe "\$@"
|
||||||
|
EOF
|
||||||
|
${coreutils}/bin/chmod 755 /run/modprobe
|
||||||
|
echo /run/modprobe > /proc/sys/kernel/modprobe
|
||||||
|
|
||||||
# For debugging: if this is the second time this image is run,
|
# For debugging: if this is the second time this image is run,
|
||||||
# then don't start the build again, but instead drop the user into
|
# then don't start the build again, but instead drop the user into
|
||||||
# an interactive shell.
|
# an interactive shell.
|
||||||
if test -n "$origBuilder" -a ! -e /.debug; then
|
if test -n "$origBuilder" -a ! -e /.debug; then
|
||||||
${coreutils}/bin/touch /.debug
|
${coreutils}/bin/touch /.debug
|
||||||
exec $origBuilder $origArgs
|
$origBuilder $origArgs
|
||||||
|
echo $? > /tmp/xchg/in-vm-exit
|
||||||
|
|
||||||
|
${busybox}/bin/mount -o remount,ro dummy /
|
||||||
|
|
||||||
|
${busybox}/bin/poweroff -f
|
||||||
else
|
else
|
||||||
export PATH=/bin:/usr/bin:${coreutils}/bin
|
export PATH=/bin:/usr/bin:${coreutils}/bin
|
||||||
echo "Starting interactive shell..."
|
echo "Starting interactive shell..."
|
||||||
|
|
Loading…
Reference in a new issue