diff options
author | Jörg Thalheim <Mic92@users.noreply.github.com> | 2017-04-30 11:22:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-30 11:22:45 +0200 |
commit | fa5196e47e3a72553155f684c8e66a97d91e6dff (patch) | |
tree | 81e173f38f60a5391500e812263bf3eee3b87965 /nixos/modules/system | |
parent | dce7ebbd9b130feb877b36e570d07db29908c00c (diff) | |
parent | 87a4615e27bf14ab5d3949fce47aa05a81ece47c (diff) |
Merge pull request #25005 from Lassulus/copytoram
nixos/stage1: add copytoram support
Diffstat (limited to 'nixos/modules/system')
-rw-r--r-- | nixos/modules/system/boot/stage-1-init.sh | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh index c75e637124a96..9a125dcb0aeb6 100644 --- a/nixos/modules/system/boot/stage-1-init.sh +++ b/nixos/modules/system/boot/stage-1-init.sh @@ -154,6 +154,9 @@ for o in $(cat /proc/cmdline); do fi ln -s "$root" /dev/root ;; + copytoram) + copytoram=1 + ;; esac done @@ -474,6 +477,22 @@ while read -u 3 mountPoint; do # doing something with $device right now. udevadm settle + # If copytoram is enabled: skip mounting the ISO and copy its content to a tmpfs. + if [ -n "$copytoram" ] && [ "$device" = /dev/root ] && [ "$mountPoint" = /iso ]; then + fsType=$(blkid -o value -s TYPE "$device") + fsSize=$(blockdev --getsize64 "$device") + + mkdir -p /tmp-iso + mount -t "$fsType" /dev/root /tmp-iso + mountFS tmpfs /iso size="$fsSize" tmpfs + + cp -r /tmp-iso/* /mnt-root/iso/ + + umount /tmp-iso + rmdir /tmp-iso + continue + fi + mountFS "$device" "$mountPoint" "$options" "$fsType" done |