sysprog21 / semu

A minimalist RISC-V system emulator capable of running Linux kernel
MIT License
251 stars 47 forks source link

Implement the loading of initrd image #25

Closed shengwen-tw closed 1 year ago

shengwen-tw commented 1 year ago

This pull request is for solving #24, where the modifications mainly include:

  1. Reserve 8 MiB of memory at the end of the guest OS before the dtb region, and map initrd image to the new reserved area.
  2. Adjust device tree source by specifying initrd-start and initrd-end properties.
  3. Support passing initrd image with -i option.
  4. Configure the Linux kernel to not let it be integrated with initramfs by default.
  5. Adjust build-image.sh to copy the rootfs.cpio file from buildroot/ to project's root directory.
shengwen-tw commented 1 year ago

Reservation of 32MiB introduces about 20~30 seconds of extra booting time on my AMD Ryzen 7 PRO 4750U (8 cores) machine.

The user may find the OS stop at the following line for a while:

[    0.152986] Unpacking initramfs...

One dirty fix for short term might be shrinking the size of the linux,initrd-end property for now.

jserv commented 1 year ago

Reservation of 32MiB introduces about 20~30 seconds of extra booting time on my AMD Ryzen 7 PRO 4750U (8 cores) machine.

Let's set 8 MB by default and introduce build-time option to specify the memory layout.