Skip to content
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

Allow jor1k use other linux distros #137

Open
sr229 opened this issue Aug 7, 2018 · 5 comments
Open

Allow jor1k use other linux distros #137

sr229 opened this issue Aug 7, 2018 · 5 comments

Comments

@sr229
Copy link

sr229 commented Aug 7, 2018

Main Rationale behind this is the copy/v86 project.

A number of Linux distros and some OSes can run OpenRISC, and it would make sense if:

  • Have options to use different OSes that supports RISC

  • Allow images provided by the user using XHR (Rationale: copy/v86)

Considering how this project stacks up with other emulators, its fair we also give such feature since it'll promote a sense of customizability on the end user

@elixx
Copy link

elixx commented May 27, 2019

I have been trying to bootstrap a basic system using buildroot and openADK (and just plain 'raw'), but haven't had much success. Seconding this; perhaps just an easy way to build a 9p filesystem and kernel to boot.

@s-macke
Copy link
Owner

s-macke commented May 29, 2019

Unfortunately it is not easy to build for OpenRISC. I don't know of any distros supporting OpenRISC. Please let me know if this changed.

I am using my own scripts (www.jor1k.com/or1k-toolchain.tar.bz2) to build for the emulator. The kernel is patched to work flawless. Also I use my own code to generate my 9p specific file system. I don't see an easy method to support other distros out of the box. However when you have a sysroot filesystem it is pretty easy to build the 9p filesystem for jor1k. Just look at the fs2xml.c file in the tools directory.

@sr229
Copy link
Author

sr229 commented May 30, 2019

hey @s-macke, GCC supports OpenRISC compiling now on GCC9, which should allow you to compile any distro for OpenRISC.

@elixx
Copy link

elixx commented May 31, 2019

I've managed to do the binfmt + QEMU bit, and unbzip2 the existing jor1k filesystem and chroot into it, and attempting to build software that way, with a bit more horsepower, but I generally either run into missing header files for some of the installed (or sometimes missing) libraries, or otherwise odd segfaults (probably QEMU issues there).

I think I may have created a system with https://openadk.org/ which claims to support OR1k, but am not certain the usage with fs2xml to bring in a new sysroot and kernel. I also run into some compilation issues with fs2xml on my main dev VM for this, probably something simple on my part:

$ gcc -lbz2 -o fs2xml fs2xml.c

/usr/bin/ld: /tmp/ccbsQtfm.o: in function `decompress':
fs2xml.c:(.text+0x4e7): undefined reference to `BZ2_bzopen'
/usr/bin/ld: fs2xml.c:(.text+0x540): undefined reference to `BZ2_bzread'
/usr/bin/ld: fs2xml.c:(.text+0x555): undefined reference to `BZ2_bzclose'
collect2: error: ld returned 1 exit status

I've also built the gcc toolchain separately for cross compilation, fwiw, but am not sure where to go with that without a rootfs with headers to chroot into:

┌─[elixx@ubufoo] - [/opt/toolchains/or1k-elf/bin] - [2019-05-31 05:52:34]
└─[1] <> ./or1k-elf-c++ -v
Using built-in specs.
COLLECT_GCC=./or1k-elf-c++
COLLECT_LTO_WRAPPER=/opt/toolchains/or1k-elf/libexec/gcc/or1k-elf/9.0.0/lto-wrapper
Target: or1k-elf
Configured with: ../gcc/configure --target=or1k-elf --prefix=/opt/toolchains/or1k-elf/ --enable-languages=c,c++ --disable-shared --disable-libssp --with-newlib
Thread model: single
gcc version 9.0.0 20181109 (experimental) (GCC)

I'm no stranger to chasing down dependencies to get manual compilations off the ground -- I used to run Slackware in the 90's ;) -- but seem to keep running into missing headers when trying to get (for example) w3m or NetHack compiled -- even natively within the emulator.

@andrakis
Copy link

Hello,
I've been using a version of GCC that matches the version that jor1k uses - it's statically compiled for x86_64 and runs on a current (13.10+) ubuntu. https://github.com/andrakis/openrisc-toolchain

I mirrored this tool chain because it is difficult to track down, but I've not run into issues compiling large C++ projects with it. (My own project using the POCO library cross compiles fine.)

You may have some more luck using this version of the GCC suite, I did. I myself ran into problems getting the cross compiler setup and working on jor1k, particularly in that any difference in version meant I had to compile statically or the C runtime would be incorrect and my program would not run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants