-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Initial implementation of cross-compilation to Knuth's MMIX #102766
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
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 .... .......... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
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
mmixware
simulator for MMIX showing that indeed it works.Some variations I'm trying (failed ones are strikethroughed)
mmix-unknown-mmixware
libc = newlib
mmix-unknown-linux-uclib
mmix-unknown-elf
mmix-none-elf
mmix-elf
mmix
Looks like we will only be able to use
newlib
, as it hasmmixware
support.Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)