Initial implementation of cross-compilation to Knuth's MMIX#102766
Initial implementation of cross-compilation to Knuth's MMIX#102766Ericson2314 merged 1 commit intoNixOS:masterfrom
Conversation
a3fe794 to
368d56c
Compare
f40586a to
0927413
Compare
|
Result of 1 package built:
|
|
There are these two |
|
|
d40042a to
0bb2aa8
Compare
bc501b7 to
94aeca5
Compare
|
Please clarify: can this architecture run the Linux kernel or is it just bare-metal for now? |
|
Currently bare metal. I'll adjust the top comment with variations tried. |
|
It appears possible to boot a patched Linux kernel, see http://mmix.cs.hm.edu/examples/Linux/index.html |
vikanezrimaya
left a comment
There was a problem hiding this comment.
I am unable to reproduce the nix-shell example above. Maybe I'm doing something wrong?
|
@kisik21 Please try again. |
|
@siraben yay, it's compiling! |
|
@Ericson2314 I added this target locally, and it works. mmix-embedded = {
config = "mmix";
libc = "newlib";
};However GNU hello's diff seems to be very small. Are they really different targets? diff --git a/hello_mmixware.txt b/hello_mmixware-embedded.txt
index 99e4e08..0ca8e94 100644
--- a/hello_mmixware.txt
+++ b/hello_mmixware-embedded.txt
@@ -1,4 +1,4 @@
-00000000: 9809 0101 5fa2 a96c 9801 0002 0000 0000 ...._..l........
+00000000: 9809 0101 5fa3 ea56 9801 0002 0000 0000 ...._..V........
00000010: 0000 0100 6000 0000 0000 0000 0000 0000 ....`...........
00000020: 0002 9758 0000 0000 0002 983c 2000 0000 ...X.......< ...
00000030: 0000 0000 2000 0000 0000 1480 e3ff 0020 .... .......... |
vikanezrimaya
left a comment
There was a problem hiding this comment.
Built and run the provided example successfully!
|
It looks like ./lib/tests/release.nix needs updating to not see the new architecture as an error. |
|
Looks like
What do you mean by this? |
Passing that through |
|
Result of 1 package built:
|
|
@kisik21 I'm not sure what files I have to change to resolve that error. |
|
You need to add the new arch to |
The simulator supports some basic system calls. So it's like having a basic OS that just read writes out to serial ports or something. |
Motivation for this change
Let's make Nix one of the first Linux package managers to have cross-compile support for MMIX!
The following command cross-builds GNU Hello and runs it in Knuth's
mmixwaresimulator for MMIX showing that indeed it works.Some variations I'm trying (failed ones are strikethroughed)
mmix-unknown-mmixwarelibc = newlibmmix-unknown-linux-uclibmmix-unknown-elfmmix-none-elfmmix-elfmmixLooks like we will only be able to use
newlib, as it hasmmixwaresupport.Things done
sandboxinnix.confon non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"./result/bin/)nix path-info -Sbefore and after)