runInLinuxVM: Set the clock properly

This commit is contained in:
Eelco Dolstra 2014-03-18 15:02:09 +01:00
parent b6d3526c53
commit f73ff0529e
1 changed files with 6 additions and 1 deletions

View File

@ -2,7 +2,7 @@
, kernel ? pkgs.linux_3_10 , kernel ? pkgs.linux_3_10
, img ? "bzImage" , img ? "bzImage"
, rootModules ? , rootModules ?
[ "virtio_pci" "virtio_blk" "virtio_balloon" "ext4" "unix" "9p" "9pnet_virtio" ] [ "virtio_pci" "virtio_blk" "virtio_balloon" "ext4" "unix" "9p" "9pnet_virtio" "rtc_cmos" ]
}: }:
with pkgs; with pkgs;
@ -57,6 +57,7 @@ rec {
mknod ${dev}/random c 1 8 mknod ${dev}/random c 1 8
mknod ${dev}/urandom c 1 9 mknod ${dev}/urandom c 1 9
mknod ${dev}/tty c 5 0 mknod ${dev}/tty c 5 0
mknod ${dev}/rtc c 254 0
. /sys/class/block/${hd}/uevent . /sys/class/block/${hd}/uevent
mknod ${dev}/${hd} b $MAJOR $MINOR mknod ${dev}/${hd} b $MAJOR $MINOR
''; '';
@ -159,6 +160,10 @@ rec {
#! ${bash}/bin/sh #! ${bash}/bin/sh
source /tmp/xchg/saved-env source /tmp/xchg/saved-env
# Set the system time from the hardware clock. Works around an
# apparent KVM > 1.5.2 bug.
${pkgs.utillinux}/sbin/hwclock -s
export NIX_STORE=/nix/store export NIX_STORE=/nix/store
export NIX_BUILD_TOP=/tmp export NIX_BUILD_TOP=/tmp
export TMPDIR=/tmp export TMPDIR=/tmp