I have followed this link to set up a kernel development environment. In summary, I am running a Linux kernel 5.11.5 with a custom root file system. I am using buildroot to creating a root file system. Now, the filesystem image size is fixed so I'm not able to even create a directory at runtime from within a guest. So, I am not able to create a swap space.
Please provide a way to create a swap space for a guest.
Please provide a way to create a swap space for a guest.the filesystem image size is fixed-> unfix the image size. Create a partition in image. Format it for swap. Add the swap to that linux. The link there just uses-hda ../buildroot/output/images/rootfs.ext4. Create your own qmeu disc, format it withfdisk, create the partitions there with swap partition, copy theext4filesystem there and edit/etc/fstabin that partition to use swap./tmpso I created a swap file in/tmpdirectory usingfallocate. But when I tried to activate that swap file usingswapon /tmp/1GiB.swapI got an errorswapon: /tmp/1GiB.swap: Invalid argument. Can you please tell me what is going wrong over here?I found free space under /tmpAssumingtmpis mounted astmpfs, you basically created a swapfile in RAM and called it swap. Just use ram as ram instead. Swap should be on disc.qemu. So is it the reason (/tmpnot being actual physical file) I am getting that error?