Building various community projects, especially the Qt ones which might require a closed-source Qt library to be packaged as well
(if you have a tablet), test the compiled binaries
The company provides a toolchain from which a cross toolchain can be made, see it packaged into an overlay. When I adjusted the PR to not depend on the company provided toolchain and instead build everything from source, it seems that the linking behavior is changed and binaries wouldn’t run on the tablet, so I would have to either statically link everything or install Nix on the target.
Would it be possible to get dynamic linking to work again, perhaps linking against the libraries that are in the official toolchain?
I’m very interested in making open toolchain work, however I only have rM2 so that is what I am targeting.
Looking at your open PR it seemed easy enough to modify dynamicLinker so it points to proper path on device. However that is not the case as resulting binaries have set linker to: /usr/lib/ld.so.1 for some reason.
Right now I cannot figure out why that is the case.
It was also easy to modify dynamicLinker on my PR to /lib/ld-linux-armhf.so.3, however the resulting binaries cannot be run on the reMarkable tablet. Here’s the result of running file on hello. It seems to look for a nonexistent linker in the Nix store.
root@reMarkable:~# file ./hello-2020-11-16
./hello-2020-11-16: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /nix/store/3s2x09bbl1xss1lcx7a6dbw69zmip3gx-glibc-2.32-armv7l-unknown-linux-gnueabihf/lib/ld-linux-armhf.so.3, for GNU/Linux 2.6.32, not stripped
Have you tried compiling it statically yet? That is what I was planning for my reM1 but haven’t tried that yet. You mentioned it being an option in the OP.
It seems that is using standard nix linker. If you look at the dynamicLinkerif-then-else tree be sure to put remarkable condition before generic arm one. I did that with special isRemarkable flag.
However even with that my programs compile with linker pointed to nonsensical:
file /nix/store/xrm21bz3p2na8yxckg4g89b5kcf754jy-hello-2.10-armv7l-unknown-linux-gnueabihf/bin/hello
/nix/store/xrm21bz3p2na8yxckg4g89b5kcf754jy-hello-2.10-armv7l-unknown-linux-gnueabihf/bin/hello: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /usr/lib/ld.so.1, for GNU/Linux 2.6.32, not stripped
I have no clue where it comes from.
Inspecting binutils-wrapper it seems that there is correct nix-support/dynamic-linker file with proper contents.
Yeah, I made the right change to the dynamic linker, see this commit. Do we need to override something else? For instance, using the proprietary toolchain, this can be done.
It seems that you forgot to set the flag in remarkable1 example system. Take a look at my example
I saw, that proprietary toolchain fix, but it does set the proper contents for nix-support/dynamic-linker file. Theoretically the same happens when we override dynamicLinker. For some reason tho its getting ignored?
Here are the only places in nixpkgs that contains lib.so.1. I also checked if the if-else tree was properly taking that branch by raising an error, and it was correct.
$ ag "ld.so.1"
pkgs/development/compilers/fpc/mark-paths.patch
35:- const defdynlinker='/lib/ld.so.1';
36:+ const defdynlinker='@dynlinker-prefix@/lib/ld.so.1';
55:- const defdynlinker='/lib/ld.so.1';
56:+ const defdynlinker='@dynlinker-prefix@/lib/ld.so.1';
88:- const defdynlinker='/lib/ld.so.1';
89:+ const defdynlinker='@dynlinker-prefix@/lib/ld.so.1';
pkgs/build-support/bintools-wrapper/default.nix
63: else if targetPlatform.system == "powerpc-linux" then "${libc_lib}/lib/ld.so.1"
64: else if targetPlatform.isMips then "${libc_lib}/lib/ld.so.1"
66: else if stdenv.lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1"
if you inspect $out/nix-support/dynamic-linker correct value will be filled there already, since that is determined by this big if ... elsedynamicLinker part
Create a non-root user on the tablet, e.g. useradd siraben && passwd siraben. Ensure that you have passwordless SSH set up by using ssh-copy-id.
The root partition on the tablet has very limited space (22 MB), so, as root, mkdir -p /nix /opt/nix && mount --bind /opt/nix /nix. The bind can be made persistent by adding the following line to /etc/fstab
Using nix-build and nix-copy-closure, one can cross-build from their machine and transfer it to the tablet, like so. The NIX_SSHOPTS is needed because nix isn’t available unless .profile is sourced.
So glad to find someone doing this. I’ve had my eye on the Remarkable for a while, but they never answer my questions on whether the system is open to outside development and what tools will be available. I think I’ll buy one now!
Also see https://github.com/reHackable/awesome-reMarkable. Worth noting reMarkable company provides toolchain and is responsive on their linux repo, but cannot provide support for third party mods.