rooturl support for "nested" mounts.
This adds support for "nested" mounts to rooturl.
A nested mount is in simplist for something like:
root=LABEL=my-images:file=my-squashfs.img
Which instructs the initramfs to mount a filesystem with the
label 'my-images' and then loop mount a 'my-squashfs.img' inside it.
A live cd basically contains an image on a cdrom.
The goal of this code is to mimic that sort of behavior but more
generically.
# Example:
qemu-img create -f raw 10G disk.img
mkfs.ext2 -L images disk.img
mount -o loop disk.img /mnt
wget -O /mnt/bionic.img \
http://images.maas.io/ephemeral-v3/daily/bionic/amd64/20200507/squashfs
umount /mnt
Then boot that with a kernel command line like:
root=img:LABEL=images:bionic.img
This actually does work right now, booting with something like:
cmdline="console=ttyS0 root=img:LABEL=images:file=squashfs overlayroot=tmpfs"
qemu-system-x86_64 -enable-kvm \
-device virtio-scsi-pci,id=virtio-scsi-xkvm \
-object rng-random,filename=/dev/urandom,id=objrng0 \
-device virtio-rng-pci,rng=objrng0,id=rng0 \
-device virtio-net-pci,netdev=net00 \
-netdev type=user,id=net00 \
-drive file=disk.img,id=disk00,if=none,format=raw,index=0 \
-device virtio-blk,drive=disk00,serial=disk.img \
-m 768 -serial mon:stdio \
-kernel boot-kernel \
-initrd boot-initrd.new \
-append "$cmdline"
# TODO
## handle ROOT_FLAGS in the final mount
## copy to tmpfs and unmount
I'd like to have some syntax which says copy the file to a tmpfs, and
unmount under it.
So that something like:
LABEL=images:tmpfile=my-squash.img
would do:
mount images by label
copy my-squash to /initramfs/tmp-images/my-squash.img
mount /initramfs/tmp-images/my-squash.img
umount /dev/disk/by-label/images
Then we'd be all in memory and a cdrom could be ejected.
## add support for 'fsimage-layered' support in curtin
I'd like to be able to use the un-modified squashfs images from
lxd (or maas) and overlay some changes on top, such as to
/etc/passwd or maybe /etc/cloud/ or something.
That would greatly ease the creation of derivative live-cds.
So that I could script something that would
- pull kernel and initramfs
- pull disk image / squashfs
- use mkisofs (and grub) It would ease creation of live-cds
'fsimage-layered' as described at
https://curtin.readthedocs.io/en/latest/topics/config.html
is a mechanism that curtin uses.