Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions gen-tc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ Supported platforms:
kobov5
nickel
remarkable
remarkable-aarch64
cervantes
pocketbook
bookeen
Expand Down Expand Up @@ -166,6 +167,12 @@ case $1 in
62fb5946719c24dd38c1f41a35a7f8bdf35462d6 \
"arm-${1}-linux-gnueabihf"
;;
remarkable-aarch64)
Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
9d4156d109d22e9b0e8958e56bbbd947cd7ce065 \
"aarch64-remarkable-linux-gnu"
;;
cervantes)
Build_CT-NG \
https://github.com/NiLuJe/crosstool-ng.git \
Expand Down
67 changes: 67 additions & 0 deletions refs/x-compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ case ${1} in
remarkable | reMarkable | Remarkable )
KINDLE_TC="REMARKABLE"
;;
remarkable-aarch64 )
KINDLE_TC="REMARKABLE_AARCH64"
;;
pocketbook | pb | PB )
KINDLE_TC="PB"
;;
Expand Down Expand Up @@ -625,6 +628,70 @@ case ${KINDLE_TC} in

DEVICE_USERSTORE="/home/root"
;;
REMARKABLE_AARCH64 )
ARCH_FLAGS="-march=armv8-a+crc+crypto -mtune=cortex-a53"
CROSS_TC="aarch64-remarkable-linux-gnu"
TC_BUILD_DIR="${HOME}/Kindle/CrossTool/Build_${KINDLE_TC}"

# Export it for our CMakeCross TC file
export CROSS_TC
export TC_BUILD_DIR

export CROSS_PREFIX="${CROSS_TC}-"
export PATH="${HOME}/x-tools/${CROSS_TC}/bin:${PATH}"

## NOTE: Upstream is (currently) using GCC 7.3, so we have no potential C++ ABI issue to take care of :)

BASE_CFLAGS="-O3 -ffast-math ${ARCH_FLAGS} -pipe -fomit-frame-pointer -frename-registers -fweb -flto=${AUTO_JOBS} -fuse-linker-plugin"
NOLTO_CFLAGS="-O3 -ffast-math ${ARCH_FLAGS} -pipe -fomit-frame-pointer -frename-registers -fweb"
## Here be dragons!
RICE_CFLAGS="-O3 -ffast-math -ftree-vectorize -funroll-loops ${ARCH_FLAGS} -pipe -fomit-frame-pointer -frename-registers -fweb -flto=${AUTO_JOBS} -fuse-linker-plugin"

## NOTE: Check if LTO still horribly breaks some stuff...
## NOTE: See https://gcc.gnu.org/gcc-4.9/changes.html for the notes about building LTO-enabled static libraries... (gcc-ar/gcc-ranlib)
## NOTE: And see https://gcc.gnu.org/gcc-5/changes.html to rejoice because we don't have to care about broken build-systems with mismatched compile/link time flags anymore :).
export AR="${CROSS_TC}-gcc-ar"
export RANLIB="${CROSS_TC}-gcc-ranlib"
export NM="${CROSS_TC}-gcc-nm"
## NOTE: Also, BOLO for packages thant link with $(CC) $(LDFLAGS) (ie. without CFLAGS). This is BAD. One (dirty) workaround if you can't fix the package is to append CFLAGS to the end of LDFLAGS... :/
## NOTE: ... although GCC 5 should handle this in a transparent & sane manner, so, yay :).
#BASE_CFLAGS="${NOLTO_CFLAGS}"
export CFLAGS="${BASE_CFLAGS}"
export CXXFLAGS="${BASE_CFLAGS}"
# NOTE: Use -isystem instead of -I to make sure GMP doesn't do crazy stuff... (FIXME: -idirafter sounds more correct for our use-case, though...)
BASE_CPPFLAGS="-isystem${TC_BUILD_DIR}/include"
export CPPFLAGS="${BASE_CPPFLAGS}"
BASE_LDFLAGS="-L${TC_BUILD_DIR}/lib -Wl,-O1 -Wl,--as-needed"
# NOTE: Dirty LTO workaround (cf. earlier). All hell might break loose if we tweak CFLAGS for some packages...
#BASE_LDFLAGS="${BASE_CFLAGS} ${BASE_LDFLAGS}"
export LDFLAGS="${BASE_LDFLAGS}"

# NOTE: We're no longer using the gold linker by default...
# FIXME: Because for some mysterious reason, gold + LTO leads to an unconditional dynamic link against libgcc_s (uless -static-libgcc is passed, of course).
export CTNG_LD_IS="bfd"

## NOTE: We jump through terrible hoops to counteract libtool's stripping of 'unknown' or 'harmful' FLAGS... (cf. https://www.gnu.org/software/libtool/manual/html_node/Stripped-link-flags.html)
## That's a questionable behavior that is bound to screw up LTO in fun and interesting ways, at the very least on the performance aspect of things...
## Store those in the right format here, and apply patches or tricks to anything using libtool, because of course it's a syntax that gcc doesn't know about, so we can't simply put it in the global LDFLAGS.... -_-".
## And since autotools being autotools, it's used in various completely idiosyncratic ways, we can't always rely on simply overriding AM_LDFLAGS...
## NOTE: Hopefully, GCC 5's smarter LTO handling means we don't have to care about that anymore... :).
export XC_LINKTOOL_CFLAGS="-Wc,-ffast-math -Wc,-fomit-frame-pointer -Wc,-frename-registers -Wc,-fweb"

BASE_HACKDIR="${SVN_ROOT}/Configs/trunk/Kindle/rM_aarch64_Hacks"

# We always rely on the native pkg-config, with custom search paths
BASE_PKG_CONFIG="pkg-config"
export PKG_CONFIG="${BASE_PKG_CONFIG}"
BASE_PKG_CONFIG_LIBDIR="${TC_BUILD_DIR}/lib/pkgconfig"
export PKG_CONFIG_PATH=""
export PKG_CONFIG_LIBDIR="${BASE_PKG_CONFIG_LIBDIR}"

## CMake is hell.
export CMAKE="cmake -DCMAKE_TOOLCHAIN_FILE=${SCRIPTS_BASE_DIR}/CMakeCross.txt -DCMAKE_INSTALL_PREFIX=${TC_BUILD_DIR}"

DEVICE_USERSTORE="/home/root"
;;

PB )
# NOTE: The TC itself is built in ARM mode, otherwise glibc 2.9 doesn't build (fails with a "r15 not allowed here" assembler error on csu/libc-start.o during the early multilib start-files step).
# AFAICT, the official SDK doesn't make a specific choice on that front (i.e., it passes neither -marm not -mthumb. That usually means ARM)...
Expand Down