-
Notifications
You must be signed in to change notification settings - Fork 7
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
loongarch support #108
Comments
On Fri, Jun 23, 2023 at 09:49:57AM -0700, Nick Desaulniers wrote:
cc @xen0n
@xen0n [sent patches for loongarch ***@***.***/) and [mentioned qemu ***@***.***/).
@xen0n can you please share the qemu command line invocation you use for boot testing? That will help us wire up support for boot testing the kernel image.
Examples:
qemu-system-loongarch64 -M virt -cpu la464 \
-kernel arch/loongarch/boot/vmlinuz.efi -smp 2 -no-reboot -m 4G \
-initrd rootfs.cpio \
-bios firmware/QEMU_EFI-loongarch64.fd \
--append "rdinit=/sbin/init console=ttyS0,115200" \
-nographic -serial stdio -monitor none
qemu-system-loongarch64 -M virt -cpu la464 \
-kernel arch/loongarch/boot/vmlinuz.efi -smp 2 -no-reboot -m 4G \
-bios firmware/QEMU_EFI-loongarch64.fd \
-snapshot \
-device nvme,serial=foo,drive=d0 \
-drive file=rootfs.ext2,if=none,format=raw,id=d0 \
--append "root=/dev/nvme0n1 rootwait console=ttyS0,115200" \
-nographic -serial stdio -monitor none
You'll need a working EFI bios.
Do you happen to know if buildroot supports loongarch?
I added support for it in my buildroot repository.
Guenter
|
Thanks for the prompt followup after the patch series! My QEMU invocation FYI: qemu-system-loongarch64 \
-m 4G \
-smp 4 \
-bios ./QEMU_EFI_7.2.fd \
-nographic \
-net nic -net user \
-hda ./rw.qcow2 \
-kernel ./vmlinuz.efi -initrd ./initramfs-linux.img \
-append 'root=UUID=fbaa5a22-85ff-4127-82fb-efb7eba03595 rw rootfstype=ext4 loglevel=7 console=ttyS0,115200' This is a simplistic setup with @yetist's Arch Linux port. It could be useful but given we build our own sysroots I guess we only have to take the firmware from there. The QEMU firmware can be built from 100% open-source code, and I've previously confirmed it to be working, so we could do that as well if anyone's doubting whether we can legally just grab that prebuilt firmware blob. Last time I asked they're working on integrating the firmware into the upstream QEMU build process too; it seems they've been busy doing other things but eventually this part should become as painless as other arches. Now it's a bit late here in UTC+8, so I'd have to go AFK soon, but I guess the info should be enough to get something together. Thanks again for the heads-up! |
Update: apparently the firmware is officially hosted at https://github.com/loongson/Firmware/tree/main/LoongArchVirtMachine -- maintained directly by the Loongson firmware team (who are very helpful and responsive). This could be more accessible (I'm not sure about connectivity to the Loong Arch Linux mirrors outside of China -- it's not globally mirrored yet) and having an issue tracker is definitely better. |
On 6/23/23 10:46, WÁNG Xuěruì wrote:
Thanks for the prompt followup after the patch series!
My QEMU invocation FYI:
qemu-system-loongarch64 \
-m 4G \
-smp 4 \
-bios ./QEMU_EFI_7.2.fd \
-nographic \
-net nic -net user \
-hda ./rw.qcow2 \
-kernel ./vmlinuz.efi -initrd ./initramfs-linux.img \
-append'root=UUID=fbaa5a22-85ff-4127-82fb-efb7eba03595 rw rootfstype=ext4 loglevel=7 console=ttyS0,115200'
This is a simplistic setup <https://mirrors.wsyu.edu.cn/loongarch/archlinux/images/README.html> with @yetist <https://github.com/yetist>'s Arch Linux port. It could be useful but given we build our own sysroots I guess we only have to take the firmware from there.
The QEMU firmware can be built from 100% open-source code <https://github.com/tianocore/edk2-platforms/tree/master/Platform/Loongson/LoongArchQemuPkg>, and I've previously confirmed it to be working, so we could do that as well if anyone's doubting whether we can legally just grab that prebuilt firmware blob. Last time I asked they're working on integrating ***@***.***/T/#u> the firmware into the upstream QEMU build process too; it seems they've been busy doing other things but eventually this part should become as painless as other arches.
I built mine from edk2 ***@***.***:tianocore/edk2.git), but it took me a while to find a working version.
I ended up with edk2-stable202211. edk2-stable202302 does _not_ work, and the master branch did not
work either when I tried. I did not try edk2-stable202305.
Guenter
|
I have this tentatively wired up: http://github.com/nathanchance/boot-utils/commits/loongarch However, I see a crash when running
A kernel built using GCC 13.1.0 from kernel.org has no issues.
Is this expected? I don't think I am missing a patch to LLVM, but I might be. |
Thanks for the quick follow-up. @nathanchance : Would you please share the config used to build the kernel? @chenhuacai told me yesterday privately that he backed out the KASan patches as they apparently need some more polish, but that happened after |
Oh I saw in the ClangBuiltLinux/linux#1787 issue it should be the defconfig. I'll try with a setup similar to yours shortly (previously I did all Clang builds natively). |
@xen0n If you have any issues reproducing, please let me know! |
I've reproduced and debugged the issue: it's llvm/llvm-project#63549 and will get fixed by https://reviews.llvm.org/D153865. |
LoongArch requires EFI firmware to boot, which is available as a precompiled blob from Loongson's GitHub, so it is downloaded when running 'boot-qemu.py -a loongarch' for the first time. There is no update mechanism like for the rootfs images for a simple implementation. If there comes a time where the firmware has to be updated for the machine to boot properly, such a mechanism can be implemented then. Other than that, the rest of the support is pretty straightforward. The defaults for cores and memory are a little higher than other machines, as that is what other folks are testing. Closes: ClangBuiltLinux#108 Signed-off-by: Nathan Chancellor <nathan@kernel.org>
@nathanchance: FYI, Regarding the QEMU options, it could be fine to continue running with And thanks for your testing efforts! |
Ah there's already #109. I re-posted the feedback there for better visibility. |
cc @xen0n
@xen0n sent patches for loongarch enablement and mentioned qemu support.
@xen0n can you please share the qemu command line invocation you use for boot testing? That will help us wire up support for boot testing the kernel image.
Do you happen to know if buildroot supports loongarch?
The text was updated successfully, but these errors were encountered: