···3434 in <link xlink:href="https://www.kernel.org/doc/Documentation/kernel-parameters.txt">
3535 the kernel documentation</link> for more details).</para>
3636 </listitem>
3737+ <listitem>
3838+ <para>If you want to load the contents of the ISO to ram after bootin
3939+ (So you can remove the stick after bootup) you can append the parameter
4040+ <literal>copytoram</literal>to the <literal>options</literal> field.</para>
4141+ </listitem>
3742</itemizedlist>
3843</para>
3944
+19
nixos/modules/system/boot/stage-1-init.sh
···154154 fi
155155 ln -s "$root" /dev/root
156156 ;;
157157+ copytoram)
158158+ copytoram=1
159159+ ;;
157160 esac
158161done
159162···473476 # Wait once more for the udev queue to empty, just in case it's
474477 # doing something with $device right now.
475478 udevadm settle
479479+480480+ # If copytoram is enabled: skip mounting the ISO and copy its content to a tmpfs.
481481+ if [ -n "$copytoram" ] && [ "$device" = /dev/root ] && [ "$mountPoint" = /iso ]; then
482482+ fsType=$(blkid -o value -s TYPE "$device")
483483+ fsSize=$(blockdev --getsize64 "$device")
484484+485485+ mkdir -p /tmp-iso
486486+ mount -t "$fsType" /dev/root /tmp-iso
487487+ mountFS tmpfs /iso size="$fsSize" tmpfs
488488+489489+ cp -r /tmp-iso/* /mnt-root/iso/
490490+491491+ umount /tmp-iso
492492+ rmdir /tmp-iso
493493+ continue
494494+ fi
476495477496 mountFS "$device" "$mountPoint" "$options" "$fsType"
478497done