riscvarchive / riscv-linux

RISC-V Linux Port
607 stars 205 forks source link

What instruction sets do I need to run Linux on my own risc-v CPU? #150

Closed hyf6661669 closed 5 years ago

hyf6661669 commented 5 years ago

I'm planning to design my own 32-bit risc-v cpu, put it into a FPGA and run Linux on it. What instruction sets does my cpu must support? Is RV32IMAC enough to boot Linux? Thank you!

aramoki commented 5 years ago

I wonder that too, I'm planning to design RISC64IMAC CPU I'm aware if it is capable to run Linux or not or what kind of other implementations need to make it possible?

davidlt commented 5 years ago

IIRC the Linux kernel only requires I and A (check makefiles), but Linux distributions are targeting RV64GC as described in https://github.com/riscv/riscv-platform-specs/blob/master/riscv-unix.md

davidlt commented 5 years ago

Note, that 32-bit Linux ABI is not yet frozen. Most likely that will happen with glibc release 2.30 (half a year).

aramoki commented 5 years ago

so for a very basic implementation, RISC32IA or RISC64IA is enough to run Linux

aswaterman commented 5 years ago

I’m not certain, but you might run into some minor issues if you omit the M extension (missing emulation routines for mul/div). Should be pretty straightforward to fix, if so.

On Sun, Feb 10, 2019 at 11:33 PM Sencer notifications@github.com wrote:

so for a very basic implementation, RISC32IA or RISC64IA is enough to run Linux

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/riscv/riscv-linux/issues/150#issuecomment-462238635, or mute the thread https://github.com/notifications/unsubscribe-auth/AA-7wh0o3ppwvKxtP-HP3-aA1-xztEGLks5vMRzEgaJpZM4aOIzM .

palmer-dabbelt commented 5 years ago

If you want to run the standard pre-compiled userspaces (ie, Debia/Fedora) then you'll need rv64gc. The upstream Linux and glibc ports should work fine with rv64imac and rv64gc -- at least, that's what we test. The 32-bit ports are coming along, but they won't be all the way there for another 6 months or so.

If you're willing to rebuild userspace but expect it to work, then your minimum is probably rv64ima. There is no fundamental reason that rv64i won't boot Linux (on a single hart system), but that will require writing some code.

aramoki commented 5 years ago

thanx for replies