Issues with local builds using qemu
Hello, I spent a long time struggling with some OBS issues, so I decided to document my fix/workaround here: https://en.opensuse.org/openSUSE:RISC-V#Build_Service I was having trouble getting packages to build locally as described on the wiki: osc checkout openSUSE:Factory:RISCV/u-boot cd openSUSE:Factory:RISCV/u-boot osc build --local-package --vm-type=qemu standard riscv64 What actually happens is qemu-system-x86_64 gets started which is totally wrong. I waded into the obs-build code and realized it was detecting the QEMU machine type to use based on the .build.hostarch.kvm file installed by kernel-obs- build. Then I checked my buildinfo and found this suspicious line: <bdep name="kernel-obs-build" vminstall="1" notmeta="1" version="6.6.2" release="1.1" arch="x86_64" hdrmd5="1495a9ca1e882f15589477d9de8a6005" project="openSUSE:Factory:RISCV" repository="standard"/> I tried to figure out why OBS is selecting the x86_64, but got lost in the Perl. Eventually I just decided to try the native repo and it worked... I didn't hit this problem with ARM, so I'm wondering: is this a bug or a feature? Thanks! Kind regards, Matt
Hi Matthew, On 25/11/2023 06:40, Matthew Trescott wrote:
Hello,
I spent a long time struggling with some OBS issues, so I decided to document my fix/workaround here: https://en.opensuse.org/openSUSE:RISC-V#Build_Service
Thanks a lot for that! Would you mind to put that in a seperate wiki page and link it in our Risc-V portal page: https://en.opensuse.org/Portal:RISC-V I think that will make it easier to find for others. Best regards, Matthias
I was having trouble getting packages to build locally as described on the wiki:
osc checkout openSUSE:Factory:RISCV/u-boot cd openSUSE:Factory:RISCV/u-boot osc build --local-package --vm-type=qemu standard riscv64
What actually happens is qemu-system-x86_64 gets started which is totally wrong.
I waded into the obs-build code and realized it was detecting the QEMU machine type to use based on the .build.hostarch.kvm file installed by kernel-obs- build. Then I checked my buildinfo and found this suspicious line:
<bdep name="kernel-obs-build" vminstall="1" notmeta="1" version="6.6.2" release="1.1" arch="x86_64" hdrmd5="1495a9ca1e882f15589477d9de8a6005" project="openSUSE:Factory:RISCV" repository="standard"/>
I tried to figure out why OBS is selecting the x86_64, but got lost in the Perl. Eventually I just decided to try the native repo and it worked...
I didn't hit this problem with ARM, so I'm wondering: is this a bug or a feature?
Thanks!
Kind regards, Matt
Hi Matthias,
Thanks a lot for that! Would you mind to put that in a seperate wiki page and link it in our Risc-V portal page: https://en.opensuse.org/Portal:RISC-V
Moving it isn't a problem, but I'm wondering if it's the correct information. I did a little more testing just now, and found that if I left the old build- root (without --clean), the package would build normally even without the native repository enabled. (At least, it would build once—I'm not sure if it would work a second time after the wrong kernel-obs-build is installed.) I also checked whether using --vm-type=kvm makes a difference. It didn't, because qemu-kvm is just a symlink to qemu-system-x86_64. So the (wrong) x86_64 linux image from kernel-obs-build executes, but of course the init process can't execute because it is riscv64 while the kernel and qemu are x86_64... I admit I don't know how the "kvm" build works on b.o.o, since there are no risc-v build workers... is that documented somewhere? I suspect the "Hostarch" setting in the openSUSE:Factory:ARM config is the problem, but I can't say for sure. It seems there is no way to override this inherited setting in my home project.
%if "%qemu_user_space_build" == "1"
Target: riscv64-suse-linux Hostarch: x86_64 Preinstall: qemu-linux-user
Macros: %qemu_user_space_build 1 :Macros
ExportFilter: ^(kernel-obs-build|qemu-linux-user).*\.riscv64\.rpm$ ExportFilter: ^qemu-linux-user-riscv.*\.riscv64\.rpm$ .
%endif # %qemu_user_space_build
Any context on this would be really helpful! Kind regards, Matt
Hi Matthias,
I admit I don't know how the "kvm" build works on b.o.o, since there are no risc-v build workers... is that documented somewhere?
Seems to have something to do with build-initvm; once I installed it, --vm- type=qemu worked like a charm. I'll update the wiki, but I still wish I understood better how it works... Kind regards, Matt
If you want to build with the qemu linux-user emulation on x86_64, use the standard repository. If you want to build natively on riscv64, use the native repoitory. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
On Monday, December 4, 2023 4:56:27 AM EST Andreas Schwab wrote:
If you want to build with the qemu linux-user emulation on x86_64, use the standard repository. If you want to build natively on riscv64, use the native repoitory.
Thanks, I already documented this here: https://en.opensuse.org/openSUSE:RISC-V#Build_Service
On Dez 04 2023, Matthew Trescott wrote:
Thanks, I already documented this here: https://en.opensuse.org/openSUSE:RISC-V#Build_Service
It contains a lot of factual errors. You can build with chroot just fine, and like the KWM build, it uses linux-user emulation. None of the builds in o:F:RISCV use qemu system emulation. -- Andreas Schwab, SUSE Labs, schwab@suse.de GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7 "And now for something completely different."
participants (3)
-
Andreas Schwab
-
Matthew Trescott
-
Matthias Brugger