Skip to content

Conversation

@nathanchance
Copy link
Member

This series adds support for quickly boot testing User Mode Linux images via boot-uml.sh, which works in a similar manner to boot-qemu.sh:

$ boot-uml.sh -k ...
...
Run /sbin/init as init process
EXT4-fs (ubda): re-mounted. Quota mode: none.
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Saving random seed: OK
Starting network: OK
Linux version 5.17.0-next-20220322-dirty (nathan@dev-arch.thelio-3990X) (ClangBuiltLinux clang version 15.0.0 (https://github.com/llvm/llvm-project 9f90254286dc6ec9be39648200712dfe2e4b1fda), LLD 15.0.0) #1 Tue Mar 22 12:21:48 MST 2022
Stopping network: OK
Saving random seed: OK
Stopping klogd: OK
Stopping syslogd: OK
EXT4-fs (ubda): re-mounted. Quota mode: none.
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system poweroff
reboot: System halted

As I needed an ext4 rootfs image for UML (as opposed to the existing cpio archives), I opted to update Buildroot to the latest release and rebuild all the images to include #42. I can drop the image update if so desired, as it will slightly increase the size of the repo.

This is the latest buildroot LTS release.

The RISC-V configuration needed a small update due to the commit linked
below.

Link: https://buildroot.org/news.html
Link: https://git.busybox.net/buildroot/commit/?id=b3c66481e1f1503fcbf193d0c780271e880ad500
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
I have not found a clean way to boot User Mode Linux with our existing
cpio rootfs images but it does work with a standard ext4 image. Tell
buildroot to build an ext4 image as part of the build process for
x86_64, which can be used for UML. This extra image only adds 1.61MB to
the repo when compressed.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
This script allows us to quickly boot a User Mode Linux image with the
existing boot-utils infrastructure, namely the root filesystem images.

$ ./boot-uml.sh -k <path_to_kernel_folder>
...
Run /sbin/init as init process
EXT4-fs (ubda): re-mounted. Quota mode: none.
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Saving random seed: OK
Starting network: OK
Linux version 5.17.0-next-20220322-dirty ...
Stopping network: OK
Saving random seed: OK
Stopping klogd: OK
Stopping syslogd: OK
EXT4-fs (ubda): re-mounted. Quota mode: none.
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system poweroff
reboot: System halted

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
@nathanchance
Copy link
Member Author

Using boot-uml.sh within another script results in the same experience that I noted on IRC:

https://gist.github.com/nathanchance/4ef597d4cad53e98e4199e87516ecd4e

I am going to see if using Python's subprocess.run() is any better...

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
@nathanchance
Copy link
Member Author

Comment has been updated and I pushed an additional fix for a small problem I noticed.

My mainline kernel source is just "linux", which causes problems with
boot-uml.sh when passing in that folder via '-k':

$ ./boot-uml.sh -k $CBL_SRC/linux
/home/nathan/cbl/src/linux does not exist!

Don't check that the path ends in the kernel image, just check that it
is a file. QEMU will handle a wrong kernel image path just fine.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
@nathanchance nathanchance merged commit 0492152 into ClangBuiltLinux:main Mar 24, 2022
@nathanchance nathanchance deleted the uml branch March 24, 2022 15:20
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