Skip to content

Add support for ARCH=um#337

Merged
nathanchance merged 8 commits into
ClangBuiltLinux:mainfrom
nathanchance:support-um
Mar 24, 2022
Merged

Add support for ARCH=um#337
nathanchance merged 8 commits into
ClangBuiltLinux:mainfrom
nathanchance:support-um

Conversation

@nathanchance

Copy link
Copy Markdown
Member

Now that ARCH=um builds with clang, let's make sure it stays working!

NOTE: This PR depends on this PR for mainline; once it is merged, this one can be too.

@nickdesaulniers nickdesaulniers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you remove the closes tag, then in a follow up, we can work on boot testing this?

@nickdesaulniers

Copy link
Copy Markdown
Member

Probably want to update some docs. Homepage and kernel docs?

@nathanchance

Copy link
Copy Markdown
Member Author

if you remove the closes tag, then in a follow up, we can work on boot testing this?

Sure, I can remove the closes tag. I don't think that we can boot test this with our current flow, as UML is a virtual machine within itself, so we would not use QEMU for testing. I'll look into that tomorrow.

@nickdesaulniers

Copy link
Copy Markdown
Member

we can work on boot testing this?

I don't think that we can boot test this with our current flow, as UML is a virtual machine within itself, so we would not use QEMU for testing. I'll look into that tomorrow.

Right, I'm pretty sure it's just an ELF executable. You just run the image and pass it command line parameters.

@nathanchance

nathanchance commented Mar 22, 2022

Copy link
Copy Markdown
Member Author

Yup, I have this working locally:

$ tuxmake -a um -C $CBL_SRC/linux-next -k defconfig -r podman -t clang-nightly LLVM=1 kernel
...
I: config: PASS in 0:00:02.285515
I: default: PASS in 0:00:15.879420
I: kernel: PASS in 0:00:04.387773
I: build output in /home/nathan/.cache/tuxmake/builds/56

# sudo is critical here, the root_fs needs to be owned by root to work properly
$ sudo sh -c "mkdir root_fs && zstd -c -d $CBL_GIT/boot-utils/images/x86_64/rootfs.cpio.zst | cpio -D root_fs -di"
...

$ $HOME/.cache/tuxmake/builds/56/linux rootfstype=hostfs rootflags=$PWD/root_fs
Core dump limits :
        soft - NONE
        hard - NONE
Checking that ptrace can change system call numbers...OK
Checking syscall emulation patch for ptrace...OK
Checking advanced syscall emulation patch for ptrace...OK
Checking environment variables for a tempdir...none found
Checking if /dev/shm is on tmpfs...OK
Checking PROT_EXEC mmap in /dev/shm...OK
Adding 25071616 bytes to physical memory to account for exec-shield gap
Linux version 5.17.0-rc6-00019-g7c23c8af7393-dirty (tuxmake@tuxmake) (Debian clang version 15.0.0-++20220321071824+df4814d45d6b-1~exp1~20220321071914.194, Debian LLD 15.0.0) #1 @1647970143
Zone ranges:
  Normal   [mem 0x0000000000000000-0x00000000637e8fff]
Movable zone start for each node
Early memory node ranges
  node   0: [mem 0x0000000000000000-0x00000000037e8fff]
Initmem setup node 0 [mem 0x0000000000000000-0x00000000037e8fff]
Built 1 zonelists, mobility grouping on.  Total pages: 14117
Kernel command line: rootfstype=hostfs rootflags=/home/nathan/tmp/root_fs root=98:0 console=tty
...
Run /sbin/init as init process
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Saving random seed: SKIP (read-only file system detected)
Starting network: OK
Linux version 5.17.0-rc6-00019-g7c23c8af7393-dirty (tuxmake@tuxmake) (Debian clang version 15.0.0-++20220321071824+df4814d45d6b-1~exp1~20220321071914.194, Debian LLD 15.0.0) #1 @1647970143
Linux version 5.17.0-rc6-00019-g7c23c8af7393-dirty (tuxmake@tuxmake) (Debian clang version 15.0.0-++20220321071824+df4814d45d6b-1~exp1~20220321071914.194, Debian LLD 15.0.0) #1 @1647970143
Stopping network: OK
Saving random seed: SKIP (read-only file system detected)
Stopping klogd: OK
Stopping syslogd: OK
The system is going down NOW!
Sent SIGTERM to all processes
Sent SIGKILL to all processes
Requesting system poweroff
reboot: System halted

I will wire this up into boot-utils shortly as boot-uml.sh, then I will update this PR.

@nathanchance

Copy link
Copy Markdown
Member Author

Alright, this now depends on ClangBuiltLinux/boot-utils#59. Once that is good to go, I'll bump boot-utils here, then this pull request should be mergeable!

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Closes: ClangBuiltLinux#332
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
@nathanchance

Copy link
Copy Markdown
Member Author

Alright, boot-utils has been updated and I have added a patch for a next regression. This should be mergeable, please let me know what you think.

@nickdesaulniers nickdesaulniers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work! consider dropping all the intermediary regen patches that just churn the dotfiles. 🛡️ 🚢

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
This will allow us to fetch the UML image for boot testing.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
ARCH=um does not use QEMU for booting, as it is designed to run as a
regular binary in user space. Use the newly created boot-uml.sh to allow
us to test booting ARCH=um kernels in CI.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
@nathanchance nathanchance merged commit 45d633f into ClangBuiltLinux:main Mar 24, 2022
@nathanchance nathanchance deleted the support-um branch March 24, 2022 19:36
@nathanchance

Copy link
Copy Markdown
Member Author

Thanks for the review as always!

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