[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: riscv64 and qemu trunk





On 24/10/2018, at 9:55 AM, Karsten Merker <merker@debian.org> wrote:

On Tue, Oct 23, 2018 at 02:20:34PM -0400, Dennis Clarke wrote:
On 10/23/2018 01:55 PM, Luke Kenneth Casson Leighton wrote:
On Tue, Oct 23, 2018 at 6:23 PM Dennis Clarke <dclarke@blastwave.org> wrote:

Just saw this from Luke Kenneth Casson Leighton :

  if i get really stuck i'll embed the riscv64 chroot within a
  qemu-amd64 chroot, running a 4.18 kernel, and document how
  it's done.

Getting qemu built from fresh git is certainly doable and I have booted
the ppc64 debian installer with it just fine.  Is there some page, or
scratch notes or even just essential command line stuff to get basic
cli or *anything* runnable inside a RISC-V qemu instance?

 i found these two resources:
    https://wiki.debian.org/RISC-V#Qemu
    https://wiki.debian.org/RISC-V#Creating_a_riscv64_chroot

Yep. I have looked there over and over.

Anything particular missing in there?

For setting up a complete networked virtual riscv64 machine with
qemu-system instead of "just" a chroot with qemu-user there is
also a step-by-step description at

 https://wiki.debian.org/RISC-V#Setting_up_a_riscv64_virtual_machine

It currently describes using a downstream 4.15 kernel with a
number of patches; I intend to update the kernel section within the
next days as upstream 4.19 has now been released and contains all
the necessary bits to run a riscv64 VM.

Just as FYI to Luke and others.

As far as I know, the requirement on the host kernel being 4.15 or higher is due to the modern RISC-V/Glibc kernel ABI and the way that qemu-riscv64 (linux-user emulation) proxies syscalls from the RV64 binaries to the host kernel (probably amd64). If your host kernel is too old, it may not contain the syscalls that are used by the modern RV64 Glibc. The choice of 4.15.0 is somewhat arbitrary and the constraint on host kernel version could possibly be relaxed.

There was a patch that raised the minimum from 3.8.0 to 4.15.0

https://lists.gnu.org/archive/html/qemu-devel/2018-04/msg04325.html

I’m not sure if this is related, but you can grep -r the qemu source tree to find the error message.

The kernel version used in the patch may or may not be the minimum host kernel version. That requires a little analysis. I vaguely remember there may be some new syscall like renameat or renameat2 that needs to be present on the host kernel. The correct minimum host kernel version is in fact the kernel that contains the most recent ABI change that Glibc RISC-V depends on and that isn’t strictly the first version of Linux kernel that included RISC-V. They could indeed be the same version but, that needs analysis...

I suspect qemu-riscv64 will run on older kernels if you patch the kernel version check, but be prepared for unpredictable results.

Reply to: