Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the loading of initrd image #25

Merged
merged 5 commits into from
Jul 29, 2023
Merged

Conversation

shengwen-tw
Copy link
Collaborator

@shengwen-tw shengwen-tw commented Jul 27, 2023

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.

main.c Outdated Show resolved Hide resolved
@shengwen-tw
Copy link
Collaborator Author

shengwen-tw commented Jul 28, 2023

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
Copy link
Collaborator

jserv commented Jul 28, 2023

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.

main.c Outdated Show resolved Hide resolved
In this commit, the `rootfs.cpio` provided by the buildroot can be passed to semu
with -i option. In order to achieve such function, the following modifcations
are conducted:

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`.
3. Support passing initrd image with -i option.
This commit forces the Linux kernel to load initrd image from external environment.
@jserv jserv merged commit 61cea98 into sysprog21:master Jul 29, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants