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

qemu: riscv related fixes #214534

Merged
merged 2 commits into from
Feb 13, 2023
Merged

Conversation

dramforever
Copy link
Contributor

@dramforever dramforever commented Feb 4, 2023

Two fixes found when trying to use qemu on riscv.

Description of changes
Things done
  • Built on platform(s)
    • x86_64-linux (native on x64, and cross x64 to riscv64 with sdlSupport = false)
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

@dramforever
Copy link
Contributor Author

After some discussion with qemu devs, it seems that the correct thing to do is indeed just not to pass --cpu, and let the configure script detect it based on $CC.

https://lore.kernel.org/qemu-devel/[email protected]/T/

It seems that there is still a bit of problem with regards to cross qemu. I'll come back to it once I get that settled.

The python dependencies were fixed for cross in NixOS#147692, but the changes
are reversed NixOS#190560 due to concerns of accidentally mixing python
versions. Compromise by using python3Packages.python.
@dramforever dramforever changed the title qemu: Remove --cpu= flag qemu: riscv related fixes Feb 9, 2023
@dramforever dramforever marked this pull request as ready for review February 9, 2023 15:57
@dramforever
Copy link
Contributor Author

cc @figsoda @SuperSandro2000 from #190560 and @NickCao from #147692

'./configure --cpu=$(uname -m)' (essentially) breaks the case of riscv,
where the configure script expects '--cpu=riscv', but 'uname -m' gives
'riscv{32,64}'. This eventually leads to user-mode emulation being
disabled.

Since the configure script can auto-detect the parameter based on
compilers, remove this flag.

Originally added in NixOS#147692, but apparently it's not needed and @NickCao
couldn't remember why it was added. See also mailing list discussion at
https://lore.kernel.org/qemu-devel/[email protected]/T/
@figsoda
Copy link
Member

figsoda commented Feb 9, 2023

the python change lgtm, don't know enough to review the change to configureFlags

@NickCao
Copy link
Member

NickCao commented Feb 10, 2023

Had to disable sdl support to test due to dependency failure.

Builds fine crossing from x86_64-linux to riscv64-linux, build/host platform is correctly recognized by build system, qemu-user support is discovered and built.

@SuperSandro2000
Copy link
Member

@ofborg build qemu
@ofborg test qemu

@SuperSandro2000 SuperSandro2000 merged commit cc44376 into NixOS:master Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants