-
-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
Initial implementation of remarkable1 cross-compile #102503
Conversation
What exactly is the reMarkable architecture? It is Linux and Arm, does it have a custom libc or something? I would rather GCC from source for this than bundle their pre-built stuff. I know we do just that for Android, but I wish we didn't there, too (#38411). |
See https://github.com/toltec-dev/toolchain , which builds the toolchain from source instead of using the pre-built toolchain. |
This is how the toolchain is built on Debian; https://github.com/toltec-dev/toolchain/blob/master/base/Dockerfile |
@GrahamcOfBorg build pkgs.pkgsCross.remarkable1.hello |
@GrahamcOfBorg build pkgsCross.remarkable1.hello |
ea8c258
to
a830f2f
Compare
Author of the overlay these were derived from here! I did look into using an upstream GCC, and I remember running into some issues, but I don't recall precisely what they were, unfortunately. I needed ABI compatible with the software on the device, and using the upstream toolchain was the simplest way to get that. I think their libc is glibc-based---the device is pretty much a GNU userland running on an i.MX6 SoloLite, as far as I'm aware---but I didn't have success trying to build it from scratch. I'm also happy to maintain this as an overlay (I'll also try to figure out how to add Flakes support) if you'd rather not see the upstream binary toolchain and related hackery added to nixpkgs directly---dealing with the ugliness of that is the main reason that I didn't try to upstream the configuration in the first place. Ben, if using a built-from-source nixpkgs version of the standard gcc and glibc is working for you, I don't think you need the rmToolchain packages at all---the various wrappers around oecore that I'm setting up there are only really useful for satisfying the constraints that Nixpkgs expects out of a compiler/libc. If you want to remove them here, I'm happy to continue to maintain the upstream-binaries packages out of tree (hopefully with flakes to make using them easy, once I figure out flakes). |
Hi @pl-semiotics! The toltec-dev toolchain seems to be able to replace the reMarkable toolchain with one using Crosstool-NG. And importantly the closed-source libqsgepaper Qt library as well. Do you think we could follow their example? |
@siraben, unfortunately, I have not used their toolchain, so I can't say for sure---I wasn't aware of it (or, possibly, it didn't exist---I'm not sure) when I first set up the nix-remarkable overlay. I could try to take a look at it ~this weekend to audit it and see if it works for my current use cases (unfortunately, I don't believe I still have copies of the experiments that necessitated the switch to the binary toolchain in the first place). It does look promising, though! If the open source toolchain here works well enough (hopefully!), we should remove the rmToolchain packages in their entirety, since they're just the equivalent of cc-wrapper for the binary toolchain. |
a830f2f
to
19c7e8b
Compare
I've been recently testing the from-source toolchain and it produces dynamic executables that don't run on the tablet. the toolchain from the company also produces dynamic executables but links and runs properly. @Ericson2314 What do you suggest? |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/remarkable1-cross-compile-toolchain-for-nix/9961/1 |
@siraben OK so first a few things:
I would like to get to the bottom of this, as having from-source builds is much more maintainable. Perhaps you can paste some errors you get? Or, if there error is very vague, try comparing the |
Ok, when would the PR be considered ready? It currently cross-compiles many packages.
I have some executables I cross-compiled from various setups;
|
That would be your first problem. You must override the dynamic linker used by the CC wrapper to match the one present on the device. For comparison, this is how I do it with the proprietary toolchain: https://github.com/pl-semiotics/nix-remarkable/blob/master/rM/toolchain-pkgs.nix#L38 . I think since this is intended for inclusion in Nixpkgs the most reasonable thing to do would likely be to extend this if tree: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/bintools-wrapper/default.nix#L52 . |
Sorry! I mistakenly thought you had begun pushing the source version. |
@pl-semiotics Thanks! I think that will work just fine. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/help-wanted-remarkable1-cross-compile-toolchain-for-nix/9961/7 |
717b058
to
d970db9
Compare
Per discussion on Discourse, there seems to be an issue with setting the appropriate dynamic linker. @Ericson2314 is there some way we could do the following two commands to set the dynamic linker?
|
d970db9
to
e00ea29
Compare
8e35478
to
e00ea29
Compare
@siraben I'm pretty sure all you need is the |
e00ea29
to
53eb9b7
Compare
@Ericson2314 Ok. I've followed your suggestions regarding the custom toolchain/depending on on-device dynamic linker.
Could you clarify how |
|
Using |
53eb9b7
to
f17faa6
Compare
f17faa6
to
77e0015
Compare
I got Nix installed on my tablet and did various cross-builds and used |
43f062d
to
77e0015
Compare
Ofborg error was unrelated, guess something bad got merged at some point. |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/help-wanted-remarkable1-cross-compile-toolchain-for-nix/9961/16 |
Motivation for this change
Initial implementation of reMarkable 1 cross-compile. Doesn't rely on the company-provided toolchain, so if the user wants to run Nix-build binaries on the device they have two options:
nix-copy-closure
Try out a build with
$ nix-build --argstr system 'x86_64-linux' -A pkgs.pkgsCross.remarkable1.hello $ sha256sum ./result/bin/hello ab10b198df6f61efaa98ef1ced6ec94c651489871c556b365138b5a42891820d ./result/bin/hello
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)Pinging some people who I've talked to on IRC/seen add infra in the commits. @cleverca22 @matthewbauer . Thanks!