nixos/stage1: add copytoram support
This commit is contained in:
parent
91ad6b3597
commit
87a4615e27
|
@ -34,6 +34,11 @@ ISO, copy its contents verbatim to your drive, then either:
|
||||||
in <link xlink:href="https://www.kernel.org/doc/Documentation/kernel-parameters.txt">
|
in <link xlink:href="https://www.kernel.org/doc/Documentation/kernel-parameters.txt">
|
||||||
the kernel documentation</link> for more details).</para>
|
the kernel documentation</link> for more details).</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
|
<listitem>
|
||||||
|
<para>If you want to load the contents of the ISO to ram after bootin
|
||||||
|
(So you can remove the stick after bootup) you can append the parameter
|
||||||
|
<literal>copytoram</literal>to the <literal>options</literal> field.</para>
|
||||||
|
</listitem>
|
||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
|
|
@ -154,6 +154,9 @@ for o in $(cat /proc/cmdline); do
|
||||||
fi
|
fi
|
||||||
ln -s "$root" /dev/root
|
ln -s "$root" /dev/root
|
||||||
;;
|
;;
|
||||||
|
copytoram)
|
||||||
|
copytoram=1
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -474,6 +477,22 @@ while read -u 3 mountPoint; do
|
||||||
# doing something with $device right now.
|
# doing something with $device right now.
|
||||||
udevadm settle
|
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"
|
mountFS "$device" "$mountPoint" "$options" "$fsType"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue