s-macke / jor1k

Online OR1K Emulator running Linux
http://jor1k.com
BSD 2-Clause "Simplified" License
1.73k stars 193 forks source link

Pulling latest linux kernel and rebuilding jor1k #156

Open unicomp21 opened 4 years ago

unicomp21 commented 4 years ago

I'd like to rebuild jor1k w/ the latest linux kernel. My intention is to experiment w/ the wireguard protocol just added to the linux kernel, and run it over jor1k websockets.

pflegende commented 4 years ago

great!

A tiny please by me: It is so a big wish of some years to the santa: ;) running in jor1k: "gcc -g mytool.c -o mytoolexe ; gdb mytoolexe" but gdb wan't do it at the moment.

May be, it is not soooo much more to invest ... having a look to the at the moment in jor1k not solved problem with gdb? It is not running now. Something difficult with build says @s-macke sometimes ago ..., long long ago ... ;)

May be the prerequisites are now better after some time. ... only there as long as casually without trouble would result. ;)

Awesome project! Good luck!

s-macke commented 4 years ago

I will try to compile the latest kernel. You are right, that gdb did not work years ago. But it is worth trying again.

pflegende commented 4 years ago

Good luck! and much more than this: KEEP HEALTHY! :)

unicomp21 commented 4 years ago

thanks @s-macke !

unicomp21 commented 4 years ago

By the way, this is an amazing project. It could change the world on a number of fronts. I still can't believe how fast it runs in a web browser.

unicomp21 commented 4 years ago

If I want to create communication between javascript in a web page and jor1k, w/ both running on the same/main web browser thread, what's the best way to do this?

To provide more background on what I plan to do, I'm wanting to compile and run boringtun within jor1k and then communicate from javascript/browser to jor1k using protobuf messages, probably something similar to an event/message bus.

https://github.com/cloudflare/boringtun https://github.com/protobufjs/protobuf.js

ie create a virtual nic (vpn connection) within jor1k by tunneling wireguard/udp packets over javascript/browser/websocket.

unicomp21 commented 4 years ago

How hard would it be to make Ubuntu 18.10 run in jor1k? If it isn't easy, please disregard this query.

unicomp21 commented 4 years ago

Is there any way I can help? Would love to learn how to do this myself.

s-macke commented 4 years ago

The kernel is now on version 5.8 with enabled wireguard. In order to cross compile some code you might want to use a pre build toolchain. https://github.com/openrisc/or1k-gcc/releases/tag/or1k-7.2.0-20180317 I haven't tested these, because I use my own toolchain which you can find here. https://jor1k.com/or1k-toolchain.tar.bz2

Ubuntu will not work on this machine. To port Ubuntu on OpenRisc would probably mean a full time job for one year.

s-macke commented 4 years ago

jor1k network connection runs on the lowest level you can imagine. On Ethernet Frames. The frames are sent to a websocket host which then use a Linux TAP device. The ethernet frames are handled in the following script: https://github.com/s-macke/jor1k/blob/master/js/master/dev/ethernet.js Dependent on what you want to do exactly this can be very difficult. E. g. build you own TCP/IP Stack implementation.

unicomp21 commented 4 years ago

Thanks @s-macke ! Much appreciated.

In case I need it, is there an example somewhere for creating a pre-build? Or maybe a howto page?

No worries w/ the ethernet frames, I've worked w/ them in the past, building kernel-bypass systems.

unicomp21 commented 4 years ago

Feel like a kid again! git clone's are slow, is there a way to run websocket ethernet proxy locally? Or do I need to make my own? @s-macke

andrakis commented 4 years ago

@unicomp21 Yes, you can run the websocket proxy locally in docker, see the websocket proxy project page for a docker command that will set it up locally. You can then change the URL used by the jor1k webpage to point to the correct address (&relayURL=wss://localhost:8080/ or thereabouts.) Note that there is a form of rate limiting applied, but this rate limiting can be disabled with a bit of tweaking in limiter.py. It won't go a heck of a lot faster, but you should be able to break 10kbyte/s.

unicomp21 commented 4 years ago

@andrakis thinking I could speed up this interface dramatically (possibly MB/s if lucky) using RTCDataChannel(s), w/ the guaranteed delivery disabled, instead of websockets, just need to find some time.

s-macke commented 4 years ago

So far no luck with gdb. It has still not been ported to run natively.

What do you mean with pre build? The root filesystem or the emulator itself? For the emulator just look at compile.sh. You just need browserify. You can ignore all the webassembly stuff.

unicomp21 commented 3 years ago

@s-macke Sorry, should have been more clear, I meant the root filesystem (ie building a new kernel)

On the emulator side, would it make sense to "jit" emulated instructions into webassembly? If so, how hard would it be?

remisharrock commented 3 years ago

So far no luck with gdb. It has still not been ported to run natively.

What do you mean with pre build? The root filesystem or the emulator itself? For the emulator just look at compile.sh. You just need browserify. You can ignore all the webassembly stuff.

Ho I was hoping to have gdb support, should we contact the openrisc community and/or the gdb community for help ?