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!
@Manveru curious how you did it: I’ve got a remarkble 2 with this week update to 2.26 . Install of nix fails because of invalid option -- 'c'
reMarkable: ~/nix-2.3.7pre0_0000000-armv7l-linux/ ./install-multi-user
...
We will:
- make sure your computer doesn't already have Nix files
(if it does, I will tell you how to clean them up.)
- create local users (see the list above for the users we'll make)
- create a local group (nixbld)
- install Nix in to /nix
- create a configuration file in /etc/nix
- set up the "default profile" by creating some Nix-related files in
/home/root
- load and start a service (at /etc/systemd/system/nix-daemon.service
and /etc/systemd/system/nix-daemon.socket) for nix-daemon
Ready to continue?
[y/n] y
head: invalid option -- 'c'
BusyBox v1.31.1 (2020-12-17 19:42:00 UTC) multi-call binary.
Usage: head [OPTIONS] [FILE]...
head: invalid option -- 'c'
BusyBox v1.31.1 (2020-12-17 19:42:00 UTC) multi-call binary.
Usage: head [OPTIONS] [FILE]...