0

I'm trying to run a RISCV Linux system in QEMU, following the official steps for it, here: https://risc-v-getting-started-guide.readthedocs.io/en/latest/linux-qemu.html

My problem starts where most people's problem starts, in the

cd linux
git checkout v5.4.0
make ARCH=riscv CROSS_COMPILE=riscv64-unknown-linux-gnu- defconfig

With that, I found the official toolchain for compiling, https://github.com/riscv-collab/riscv-gnu-toolchain. I've setup my path to include /opt/riscv as suggested, I have all the dependencies listed, and ran ./configure --prefix=/opt/riscv successfully. When running sudo make -j linux (running without sudo only throws permission errors), it seems to work normally, but after a few seconds it starts closing all my windows and then my session. I have to log back in and there's nothing. I can't tell whether it's crashing my user session or simply logging me out. I believe it's the first since there's no point in a make action closing windows just because.

The problem is I don't know where to start debugging, or what I could be doing wrong, so I don't have enough information to know if it's worth opening an issue in the repo.

The only part where my flow deviates from the steps in the guide is when it says to checkout the 5.0.0 branch in the linux folder, because there's only the 5.0 branch, but I doubt that's it since I still haven't gotten to the kernel compilation part.

My system: HP 15 laptop, Ryzen 5 5500U, 8gb ram. Running Debian 11 Bullseye, kernel 5.10.0-23-amd64

I've been reading other posts in here and Github, but haven't had any luck. I've tried re-doing the process from scratch. I haven't gotten my Linux Mint desktop back but I still have to try the workflow there.

Ian Abbott
  • 15,083
  • 19
  • 33
  • "Attempting to build riscv64-unknown-linux-gnu crashes my session" - `riscv64-unknown-linux-gnu` is a **toolchain**. You are not *building* that toolchain, you download it from somewhere. What you are doing is **using** this toolchain for **build the Linux kernel**. And exactly that building which causes the crash. – Tsyvarev Jun 07 '23 at 18:41
  • 1
    A good start would be to fix your permissions problems so you're not trying to run the build as root... – Peter Maydell Jun 08 '23 at 15:13
  • Thanks for the clarification. I thought since I was in a repo named toolchain that that was the case, especially since the next step in the first tutorial after being done with that build was to THEN compile a kernel. @PeterMaydell what do you mean? I did try running the build as non-root, but it gives permission errors. Is there a way to install things to /opt without being root? – Francisco Ayrolo Jun 10 '23 at 01:30
  • You need root to *install* to /opt, but the command line you're running is not doing an install -- it is just doing a build. And the instructions you're trying to follow for building a kernel: (1) don't say anything about using /opt (2) suggest you do *not* try to build your own toolchain (3) don't tell you to install the kernel you build anywhere (which makes sense, it is for your target, not for your host). – Peter Maydell Jun 10 '23 at 18:28
  • I don't understand. The line `./configure --prefix=/opt/riscv` is using /opt. I tried changing it to a folder on my home but it still gives me permission errors. I know it's not making me build/install the kernel, I assume "make linux" within the toolchain's folder is just to build the linux target of the toolchain. I understand it's better to download the toolchain from somewhere else, but I don't see what's wrong with building it myself on my system. – Francisco Ayrolo Jul 05 '23 at 18:35

0 Answers0