Skip to content
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 support for >=3.6 firmwares, toolchain v4.x #27

Open
wants to merge 1 commit into
base: v4.x
Choose a base branch
from

Conversation

ilyaluk
Copy link

@ilyaluk ilyaluk commented Sep 6, 2023

This updates all libraries in toolchain/base images according to 3.6.0.1865 firmware.

Includes patches for glibc 2.35 (to be upstreamed) and for breakpad.

Updated crosstool-ng to latest master and regerated crosstool.config using it.

Does not include QT updates yet, waiting on reMarkable toolchain with up-to-date libqsgepaper

base/Dockerfile Show resolved Hide resolved
base/Dockerfile Show resolved Hide resolved
base/Dockerfile Show resolved Hide resolved
@@ -103,16 +95,18 @@ RUN export DEBIAN_FRONTEND=noninteractive \
&& cd .. \
# Clean up
&& rm -rf systemd \
# TODO: remove pip packages as well
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it's required, they are pretty small (jinja2+yaml, I think)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed replying to this the first time. Yes, removing the packages is required as it's not part of what we intend to deliver by default, especially if we aren't delivering pip.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking that we can use multi-stage builds: one that cross-compiles all the stuff, then copy the headers/libs to the final one with pre-installed compilers without any extra deps. This should require less friction and layers.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be appreciated, especially if there is caching we can do to avoid rebuilding if we already have a built version later.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, docker allows to cache multi-stage builds with buildx, that should be supported by GHA, will look into that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had issues with it not properly caching before, and there is also a limit to how much can be cached, which this would fill it up really quick, so you'd probably still want to clean up as much as possible to keep the cache size needed small.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A better way to do this would be to move the build of these artifacts to a different process that stores them elsewhere with a version number, and then the docker image pulls the versioned artifact.

toolchain/Dockerfile Show resolved Hide resolved
@@ -90,9 +92,8 @@ RUN export DEBIAN_FRONTEND=noninteractive \
libssl-dev \
libtool-bin \
&& cd /root \
&& git clone https://git.yoctoproject.org/git/opkg \
&& git clone --depth 1 --branch v0.4.5 https://git.yoctoproject.org/git/opkg \
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated opkg a bit as well, 0.4.4->0.4.5.

We can bump it all the way to 0.6.2, if this won't break anything.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reply to this was missing for some reason. The version of opkg in entware is from 2022-02-24, so we should try to match its version here.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entware uses opkg-lede, which is a (lesser maintained?) fork of opkg. For compatibility we can it as well, not sure what issues that might bring now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's what we use on device, so it would be best to use the same thing. It's probably a miss that we are using version.

@@ -326,16 +335,20 @@ CT_LINUX_V_5_4=y
# CT_LINUX_V_3_10 is not set
# CT_LINUX_V_3_4 is not set
# CT_LINUX_V_3_2 is not set
CT_LINUX_VERSION="5.4.70"
CT_LINUX_VERSION="5.4.248"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is change made by ./ct-ng arm-remarkable-linux-gnueabihf. I guess it doesn't matter, as we only need kernel headers, which should not change in minor releases (not sure about that though)

Copy link
Author

@ilyaluk ilyaluk Sep 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even previous version of ct-ng bumped version when copying from crosstool.config to .config, to something around 5.4.140

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would prefer to target the exact kernel version in use on the device.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I tried that for the same reasons, but even if exact older version is specified here, after calling ./ct-ng arm-remarkable-linux-gnueabihf the latest kernel patch version supported by current ct-ng (5.4.248 as of now) is written to .config, and ./ct-ng build uses newer one.

I think the same happens in 3.x toolchain, but the version is 5.4.179: https://github.com/crosstool-ng/crosstool-ng/tree/a21748bd5342b72ddf5bfef782e058c3245161f7/packages/linux/5.4.179

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd need to modify .config after calling ./ct-ng arm-remarkable-linux-gnueabihf if we want exact version, which is discouraged by crosstool-ng.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you found in the documentation why this is the case? Or opened an issue about it?

I'm not exactly happy that it's ignoring our configuration.

@@ -399,12 +414,14 @@ CT_BINUTILS_V_2_36=y
# CT_BINUTILS_V_2_28 is not set
# CT_BINUTILS_V_2_27 is not set
# CT_BINUTILS_V_2_26 is not set
CT_BINUTILS_VERSION="2.36.1"
CT_BINUTILS_VERSION="2.35.1"
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downgraded binutils just to be safe when debugged the issues with compilation and forgot to upgrade back. But I guess it's better to have binutils matching glibc?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should match what is in the official toolchain ideally. Which would match what is on device if it ends up on device. I don't really think we want to downgrade them unless they actually need to be downgraded.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still haven't received official toolchain for 3.6, sadly

Nothing from binutils end up on device, as far as I can tell. Also, 3.1.15 toolchain included 2.34.0 binutils, not 2.36.1:

# /opt/codex/rm11x/3.1.15/sysroots/x86_64-codexsdk-linux/usr/libexec/arm-remarkable-linux-gnueabi/gcc/arm-remarkable-linux-gnueabi/9.3.0/ld --version
GNU ld (GNU Binutils) 2.34.0.20200220

I don't think that binutils versions are that important for linking binaries, and probably we can use either one until we get official toolchain, your call.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you have the latest toolchain now. Could you also open a PR against https://github.com/Eeems-Org/remarkable.guide/ to add the toolchain to https://github.com/Eeems-Org/remarkable.guide/blob/main/src/devel/toolchains.rst with ipfs links?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Official toolchain includes 2.38, apparently

$ /opt/codex/rm2/4.0.117-1/sysroots/x86_64-codexsdk-linux/usr/libexec/arm-remarkable-linux-gnueabi/gcc/arm-remarkable-linux-gnueabi/11.3.0/ld --version
GNU ld (GNU Binutils) 2.38.20220708

Probably also should bump gcc to 11.3.0

toolchain/crosstool-ng/crosstool.config Outdated Show resolved Hide resolved
toolchain/crosstool-ng/crosstool.config Show resolved Hide resolved
base/Dockerfile Show resolved Hide resolved
@@ -326,16 +335,20 @@ CT_LINUX_V_5_4=y
# CT_LINUX_V_3_10 is not set
# CT_LINUX_V_3_4 is not set
# CT_LINUX_V_3_2 is not set
CT_LINUX_VERSION="5.4.70"
CT_LINUX_VERSION="5.4.248"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We would prefer to target the exact kernel version in use on the device.

@@ -399,12 +414,14 @@ CT_BINUTILS_V_2_36=y
# CT_BINUTILS_V_2_28 is not set
# CT_BINUTILS_V_2_27 is not set
# CT_BINUTILS_V_2_26 is not set
CT_BINUTILS_VERSION="2.36.1"
CT_BINUTILS_VERSION="2.35.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should match what is in the official toolchain ideally. Which would match what is on device if it ends up on device. I don't really think we want to downgrade them unless they actually need to be downgraded.

toolchain/crosstool-ng/crosstool.config Outdated Show resolved Hide resolved
@Eeems Eeems changed the base branch from v3.x to v4.x September 8, 2023 20:27
This updates all libraries in toolchain/base images according to
3.6.0.1865 firmware.

Includes patches for glibc 2.35 (to be upstreamed) and for
breakpad.

Updated crosstool-ng to latest master and regerated crosstool.config
using it.
@ilyaluk
Copy link
Author

ilyaluk commented Sep 11, 2023

Btw, @Eeems, ct-ng offers way smaller configs by exporting them:

root@64aab2c30c79:~/crosstool-ng# ./ct-ng saveconfig
Reporter name [Mattéo Delabre]:
Reporter URL [https://matteo.delab.re]:
Old comment:
  > Toolchain for the reMarkable - Adapted from arm-cortexa9_neon-linux-gnueabihf
Reporter comment (Ctrl-D to finish, '.' to use previous):
.
root@64aab2c30c79:~/crosstool-ng# cat samples/arm-remarkable-linux-gnueabihf/crosstool.config
CT_CONFIG_VERSION="4"
CT_EXPERIMENTAL=y
CT_ALLOW_BUILD_AS_ROOT=y
CT_ALLOW_BUILD_AS_ROOT_SURE=y
CT_ARCH_ARM=y
CT_ARCH_CPU="cortex-a9"
CT_ARCH_FPU="neon"
CT_ARCH_FLOAT_HW=y
CT_TARGET_VENDOR="remarkable"
CT_TARGET_ALIAS="arm-linux-gnueabihf"
CT_TOOLCHAIN_ENABLE_NLS=y
CT_KERNEL_LINUX=y
CT_LINUX_V_5_4=y
CT_BINUTILS_V_2_35=y
CT_BINUTILS_LINKER_LD_GOLD=y
CT_BINUTILS_GOLD_THREADS=y
CT_BINUTILS_LD_WRAPPER=y
CT_BINUTILS_PLUGINS=y
CT_GLIBC_V_2_35=y
CT_GLIBC_USE_LIBIDN_ADDON=y
# CT_GLIBC_ENABLE_DEBUG is not set
CT_GLIBC_LOCALES=y
CT_GLIBC_KERNEL_VERSION_NONE=y
CT_GCC_V_10=y
# CT_CC_GCC_ENABLE_TARGET_OPTSPACE is not set
CT_CC_LANG_CXX=y
CT_DEBUG_GDB=y
CT_GDB_V_11=y
# CT_GDB_CROSS_PYTHON is not set
CT_GDB_NATIVE=y
CT_GDB_NATIVE_STATIC=y
CT_GETTEXT_V_0_20_1=y
CT_ISL_V_0_22=y
CT_NCURSES_V_6_2=y
# CT_NCURSES_NEW_ABI is not set

Which yields the same .config after ./ct-ng arm-remarkable-linux-gnueabihf.

I can update the PR to include this config format.

@Eeems
Copy link
Member

Eeems commented Sep 17, 2023

Btw, @Eeems, ct-ng offers way smaller configs by exporting them:

...

Which yields the same .config after ./ct-ng arm-remarkable-linux-gnueabihf.

I can update the PR to include this config format.

Sure, a simpler config will be easier to maintain.

@@ -103,16 +95,18 @@ RUN export DEBIAN_FRONTEND=noninteractive \
&& cd .. \
# Clean up
&& rm -rf systemd \
# TODO: remove pip packages as well
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I missed replying to this the first time. Yes, removing the packages is required as it's not part of what we intend to deliver by default, especially if we aren't delivering pip.

@@ -90,9 +92,8 @@ RUN export DEBIAN_FRONTEND=noninteractive \
libssl-dev \
libtool-bin \
&& cd /root \
&& git clone https://git.yoctoproject.org/git/opkg \
&& git clone --depth 1 --branch v0.4.5 https://git.yoctoproject.org/git/opkg \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My reply to this was missing for some reason. The version of opkg in entware is from 2022-02-24, so we should try to match its version here.

@@ -326,16 +335,20 @@ CT_LINUX_V_5_4=y
# CT_LINUX_V_3_10 is not set
# CT_LINUX_V_3_4 is not set
# CT_LINUX_V_3_2 is not set
CT_LINUX_VERSION="5.4.70"
CT_LINUX_VERSION="5.4.248"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you found in the documentation why this is the case? Or opened an issue about it?

I'm not exactly happy that it's ignoring our configuration.

@@ -399,12 +414,14 @@ CT_BINUTILS_V_2_36=y
# CT_BINUTILS_V_2_28 is not set
# CT_BINUTILS_V_2_27 is not set
# CT_BINUTILS_V_2_26 is not set
CT_BINUTILS_VERSION="2.36.1"
CT_BINUTILS_VERSION="2.35.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like you have the latest toolchain now. Could you also open a PR against https://github.com/Eeems-Org/remarkable.guide/ to add the toolchain to https://github.com/Eeems-Org/remarkable.guide/blob/main/src/devel/toolchains.rst with ipfs links?

@Eeems
Copy link
Member

Eeems commented Dec 17, 2023

@jilyaluk poke, any chance you've had time to continue working on this?

@Eeems
Copy link
Member

Eeems commented Feb 8, 2024

@jilyaluk poke again?

@ilyaluk
Copy link
Author

ilyaluk commented Sep 15, 2024

@Eeems sorry, I did not have access to my reMarkable for quite some time, so could not test anything. Now I got it back, will look at this soon.

@ilyaluk
Copy link
Author

ilyaluk commented Sep 27, 2024

Hey @Eeems, could you bump the v4.x branch in the repo to match v3.x? I'll rebase my branch

@Eeems
Copy link
Member

Eeems commented Sep 27, 2024

Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants