build: Add toolchain

This commit is contained in:
robshape 2023-04-14 17:51:40 +02:00
parent 3c6310d4e3
commit 6373955e86
17 changed files with 3292 additions and 0 deletions

42
toolchain/Dockerfile Normal file
View file

@ -0,0 +1,42 @@
FROM debian:buster-slim
ENV DEBIAN_FRONTEND noninteractive
ENV TZ=America/New_York
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get -y update && apt-get -y install \
bc \
build-essential \
bzip2 \
bzr \
cmake \
cmake-curses-gui \
cpio \
device-tree-compiler \
git \
imagemagick \
libncurses5-dev \
locales \
make \
p7zip-full \
rsync \
sharutils \
scons \
tree \
unzip \
vim \
wget \
zip \
&& rm -rf /var/lib/apt/lists/*
RUN mkdir -p /root/workspace
WORKDIR /root
COPY support .
RUN ./build-toolchain.sh
RUN cat ./setup-env.sh >> .bashrc
VOLUME /root/workspace
WORKDIR /root/workspace
CMD ["/bin/bash"]

20
toolchain/README.md Normal file
View file

@ -0,0 +1,20 @@
# Toolchain Docker image
Based on the [Trimui toolchain Docker image](https://git.crowdedwood.com/trimui-toolchain/) by neonloop.
## Installation
With Docker installed and running, `make shell` builds the toolchain and drops into a shell inside the container. The container's `~/workspace` is bound to `./workspace` by default. The toolchain is located at `/opt/` inside the container.
After building the first time, unless a dependency of the image has changed, `make shell` will skip building and drop into the shell. Running `make shell` from another window while already in a running shell will attach to the already running image.
## Workflow
- On your host machine, clone repositories into `./workspace` and make changes as usual.
- In the container shell, find the repository in `~/workspace` and build as usual.
See [setup-env.sh](./support/setup-env.sh) for some useful vars for compiling that are exported automatically.
## Docker for Mac
Docker for Mac has a memory limit that can make the toolchain build fail. Follow [these instructions](https://docs.docker.com/docker-for-mac/) to increase the memory limit. Also, docker on the M1 currently has a bug that stops reporting build progress after 5 minutes or so. The initial build takes about 15 minutes on my M1 so just be patient once you see `[output clipped, log limit 1MiB reached]`, it should get there.

30
toolchain/makefile Normal file
View file

@ -0,0 +1,30 @@
.PHONY: shell
.PHONY: clean
TOOLCHAIN_NAME=rg35xx-toolchain-new
WORKSPACE_DIR := $(shell pwd)/workspace
CONTAINER_NAME=$(shell docker ps -f "ancestor=$(TOOLCHAIN_NAME)" --format "{{.Names}}")
BOLD=$(shell tput bold)
NORM=$(shell tput sgr0)
.build: Dockerfile
$(info $(BOLD)Building $(TOOLCHAIN_NAME)...$(NORM))
mkdir -p ./workspace
docker build -t $(TOOLCHAIN_NAME) .
touch .build
ifeq ($(CONTAINER_NAME),)
shell: .build
$(info $(BOLD)Starting $(TOOLCHAIN_NAME)...$(NORM))
docker run -it --rm -v "$(WORKSPACE_DIR)":/root/workspace $(TOOLCHAIN_NAME) /bin/bash
else
shell:
$(info $(BOLD)Connecting to running $(TOOLCHAIN_NAME)...$(NORM))
docker exec -it $(CONTAINER_NAME) /bin/bash
endif
clean:
$(info $(BOLD)Removing $(TOOLCHAIN_NAME)...$(NORM))
docker rmi $(TOOLCHAIN_NAME)
rm -f .build

View file

@ -0,0 +1,41 @@
#!/bin/sh
BUILDROOT_VERSION=2017.11
set -xe
if [ -d ~/buildroot ]; then
rm -rf ~/buildroot
else
sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen
locale-gen
fi
cd ~
BUILDROOT_NAME=buildroot-$BUILDROOT_VERSION
wget https://buildroot.org/downloads/$BUILDROOT_NAME.tar.gz
tar -xf ./$BUILDROOT_NAME.tar.gz
rm -f ./$BUILDROOT_NAME.tar.gz
mv ./$BUILDROOT_NAME ./buildroot
# patches for buildroot packages
cd ~/patches
for FILE in $(find . -type f -name "*.patch" 2>/dev/null); do
cp $FILE ~/buildroot/$FILE
done
cd ~/buildroot
# patches for buildroot itself
patch -p1 < ~/toolchain-expose-BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS-for-all-toolchain-types-2017.11.1.diff
cp ~/rg35xx-buildroot-$BUILDROOT_VERSION.config ./.config
if [ -f ~/rg35xx-toolchain.tar.xz ]; then
tar -xf ~/rg35xx-toolchain.tar.xz -C /opt
else
export FORCE_UNSAFE_CONFIGURE=1
make oldconfig
make world
~/install-toolchain.sh
fi

View file

@ -0,0 +1,11 @@
#!/bin/sh
mkdir -p /opt/rg35xx-toolchain
if [ -d /opt/rg35xx-toolchain/usr ]; then
rm -fr /opt/rg35xx-toolchain/usr
fi
cp -rf ~/buildroot/output/host/usr/ /opt/rg35xx-toolchain/
# this version of buildroot doesn't have relocate-sdk.sh yet so we bring our own
cp ~/relocate-sdk.sh /opt/rg35xx-toolchain/
cp ~/sdk-location /opt/rg35xx-toolchain/
/opt/rg35xx-toolchain/relocate-sdk.sh

View file

@ -0,0 +1,3 @@
#!/bin/sh
cp ~/buildroot/output/images/rootfs.ext2 ~/workspace/rootfs.img

View file

@ -0,0 +1,7 @@
#!/bin/sh
cd /opt/
tar --xz -cvf rg35xx-toolchain.tar.xz rg35xx-toolchain/
mv rg35xx-toolchain.tar.xz ~/workspace/
printf "rg35xx-toolchain.tar.xz can be shared as a blob\nby placing in support before calling 'make shell'\n"

View file

@ -0,0 +1,33 @@
Subject: Workaround change in glibc
Temporary workaround to compile with glibc 2.28, which
deprecated some constants
Based on the workaround made for the tools/m4 package
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -18,6 +18,12 @@
the same implementation of stdio extension API, except that some fields
have different naming conventions, or their access requires some casts. */
+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
+ problem by defining it ourselves. FIXME: Do not rely on glibc
+ internals. */
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
+# define _IO_IN_BACKUP 0x100
+#endif
/* BSD stdio derived implementations. */
--- a/lib/fseterr.c
+++ b/lib/fseterr.c
@@ -29,7 +29,7 @@
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_flags |= _IO_ERR_SEEN;
#elif defined __sferror || defined __DragonFly__ /* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin */
fp_->_flags |= __SERR;

View file

@ -0,0 +1,40 @@
This patch prevents a conflict with glibc
--- a/misc/create_inode.c
+++ b/misc/create_inode.c
@@ -392,7 +392,7 @@ static ssize_t my_pread(int fd, void *buf, size_t count, off_t offset)
}
#endif /* !defined HAVE_PREAD64 && !defined HAVE_PREAD */
-static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
+static errcode_t copy_file_chunk(ext2_filsys fs, int fd, ext2_file_t e2_file,
off_t start, off_t end, char *buf,
char *zerobuf)
{
@@ -466,7 +466,7 @@ static errcode_t try_lseek_copy(ext2_filsys fs, int fd, struct stat *statbuf,
data_blk = data & ~(fs->blocksize - 1);
hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1);
- err = copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf,
+ err = copy_file_chunk(fs, fd, e2_file, data_blk, hole_blk, buf,
zerobuf);
if (err)
return err;
@@ -516,7 +516,7 @@ static errcode_t try_fiemap_copy(ext2_filsys fs, int fd, ext2_file_t e2_file,
}
for (i = 0, ext = ext_buf; i < fiemap_buf->fm_mapped_extents;
i++, ext++) {
- err = copy_file_range(fs, fd, e2_file, ext->fe_logical,
+ err = copy_file_chunk(fs, fd, e2_file, ext->fe_logical,
ext->fe_logical + ext->fe_length,
buf, zerobuf);
if (err)
@@ -569,7 +569,7 @@ static errcode_t copy_file(ext2_filsys fs, int fd, struct stat *statbuf,
goto out;
#endif
- err = copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf,
+ err = copy_file_chunk(fs, fd, e2_file, 0, statbuf->st_size, buf,
zerobuf);
out:
ext2fs_free_mem(&zerobuf);

View file

@ -0,0 +1,131 @@
From c79aedf13fe693da0fc5c4ff727aed5bd43526dc Mon Sep 17 00:00:00 2001
From: Hutson Betts <hutson@hyper-expanse.net>
Date: Thu, 10 Dec 2020 21:13:54 -0600
Subject: [PATCH] glibc 2.28
diff --git a/lib/fflush.c b/lib/fflush.c
index ef2a7f1..787790d 100644
--- a/lib/fflush.c
+++ b/lib/fflush.c
@@ -33,7 +33,7 @@
#undef fflush
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
/* Clear the stream's ungetc buffer, preserving the value of ftello (fp). */
static void
@@ -72,7 +72,7 @@ clear_ungetc_buffer (FILE *fp)
#endif
-#if ! (defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
+#if ! (defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */)
# if (defined __sferror || defined __DragonFly__ || defined __ANDROID__) && defined __SNPT
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
@@ -148,7 +148,7 @@ rpl_fflush (FILE *stream)
if (stream == NULL || ! freading (stream))
return fflush (stream);
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
clear_ungetc_buffer_preserving_position (stream);
diff --git a/lib/fpending.c b/lib/fpending.c
index ce93604..9fe7ffb 100644
--- a/lib/fpending.c
+++ b/lib/fpending.c
@@ -32,7 +32,7 @@ __fpending (FILE *fp)
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
return fp->_IO_write_ptr - fp->_IO_write_base;
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
/* FreeBSD, NetBSD, OpenBSD, DragonFly, Mac OS X, Cygwin, Android */
diff --git a/lib/fpurge.c b/lib/fpurge.c
index 53ee68c..7cba3a3 100644
--- a/lib/fpurge.c
+++ b/lib/fpurge.c
@@ -62,7 +62,7 @@ fpurge (FILE *fp)
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_IO_read_end = fp->_IO_read_ptr;
fp->_IO_write_ptr = fp->_IO_write_base;
/* Avoid memory leak when there is an active ungetc buffer. */
diff --git a/lib/freadahead.c b/lib/freadahead.c
index cfc969b..5e43e13 100644
--- a/lib/freadahead.c
+++ b/lib/freadahead.c
@@ -25,7 +25,7 @@
size_t
freadahead (FILE *fp)
{
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
if (fp->_IO_write_ptr > fp->_IO_write_base)
return 0;
return (fp->_IO_read_end - fp->_IO_read_ptr)
diff --git a/lib/freading.c b/lib/freading.c
index 05cb0b8..f1da5b9 100644
--- a/lib/freading.c
+++ b/lib/freading.c
@@ -31,7 +31,7 @@ freading (FILE *fp)
/* Most systems provide FILE as a struct and the necessary bitmask in
<stdio.h>, because they need it for implementing getc() and putc() as
fast macros. */
-# if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+# if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
return ((fp->_flags & _IO_NO_WRITES) != 0
|| ((fp->_flags & (_IO_NO_READS | _IO_CURRENTLY_PUTTING)) == 0
&& fp->_IO_read_base != NULL));
diff --git a/lib/fseeko.c b/lib/fseeko.c
index 0c01c4f..0601619 100644
--- a/lib/fseeko.c
+++ b/lib/fseeko.c
@@ -47,7 +47,7 @@ fseeko (FILE *fp, off_t offset, int whence)
#endif
/* These tests are based on fpurge.c. */
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
if (fp->_IO_read_end == fp->_IO_read_ptr
&& fp->_IO_write_ptr == fp->_IO_write_base
&& fp->_IO_save_base == NULL)
@@ -123,7 +123,7 @@ fseeko (FILE *fp, off_t offset, int whence)
return -1;
}
-#if defined _IO_ftrylockfile || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
+#if defined _IO_EOF_SEEN || __GNU_LIBRARY__ == 1 /* GNU libc, BeOS, Haiku, Linux libc5 */
fp->_flags &= ~_IO_EOF_SEEN;
fp->_offset = pos;
#elif defined __sferror || defined __DragonFly__ || defined __ANDROID__
diff --git a/lib/stdio-impl.h b/lib/stdio-impl.h
index 766d693..75fe3ad 100644
--- a/lib/stdio-impl.h
+++ b/lib/stdio-impl.h
@@ -18,6 +18,12 @@
the same implementation of stdio extension API, except that some fields
have different naming conventions, or their access requires some casts. */
+/* Glibc 2.28 made _IO_IN_BACKUP private. For now, work around this
+ problem by defining it ourselves. FIXME: Do not rely on glibc
+ internals. */
+#if !defined _IO_IN_BACKUP && defined _IO_EOF_SEEN
+# define _IO_IN_BACKUP 0x100
+#endif
/* BSD stdio derived implementations. */
--
2.25.1

View file

@ -0,0 +1,80 @@
--- a/include/SDL_keysym.h
+++ b/include/SDL_keysym.h
@@ -296,6 +296,19 @@
SDLK_UNDO = 322, /**< Atari keyboard has Undo */
/*@}*/
+ /** @name RG35XX keys */
+ /*@{*/
+ SDLK_KATAKANA = 323,
+ SDLK_HIRAGANA = 324,
+ SDLK_HENKAN = 325,
+ SDLK_KATAKANAHIRAGANA = 326,
+ SDLK_MUHENKAN = 327,
+ SDLK_KP_JPCOMMA = 328,
+ SDLK_KP_SLASH = 329,
+ SDLK_CURSORBLOCKUP = 330,
+ SDLK_CURSORBLOCKDOWN = 331,
+ /*@}*/
+
/* Add any other keys here */
SDLK_LAST
--- a/src/video/fbcon/SDL_fbevents.c
+++ b/src/video/fbcon/SDL_fbevents.c
@@ -1133,6 +1133,38 @@
case 127:
keymap[i] = SDLK_MENU;
break;
+
+ /* RG35XX */
+ case SCANCODE_KATAKANA:
+ keymap[i] = SDLK_KATAKANA;
+ break;
+ case SCANCODE_HIRAGANA:
+ keymap[i] = SDLK_HIRAGANA;
+ break;
+ case SCANCODE_HENKAN:
+ keymap[i] = SDLK_HENKAN;
+ break;
+ case SCANCODE_KATAKANAHIRAGANA:
+ keymap[i] = SDLK_KATAKANAHIRAGANA;
+ break;
+ case SCANCODE_MUHENKAN:
+ keymap[i] = SDLK_MUHENKAN;
+ break;
+ case SCANCODE_KPJPCOMMA:
+ keymap[i] = SDLK_KP_JPCOMMA;
+ break;
+ case SCANCODE_KEYPADENTER:
+ keymap[i] = SDLK_KP_ENTER;
+ break;
+ case SCANCODE_CURSORBLOCKUP:
+ keymap[i] = SDLK_CURSORBLOCKUP;
+ break;
+ case SCANCODE_CURSORBLOCKDOWN:
+ keymap[i] = SDLK_CURSORBLOCKDOWN;
+ break;
+
+
+
/* this should take care of all standard ascii keys */
default:
keymap[i] = KVAL(vga_keymap[0][i]);
--- a/src/video/fbcon/SDL_fbkeys.h
+++ b/src/video/fbcon/SDL_fbkeys.h
@@ -114,6 +114,14 @@
#define SCANCODE_F11 87
#define SCANCODE_F12 88
+/* RG35XX */
+#define SCANCODE_KATAKANA 90
+#define SCANCODE_HIRAGANA 91
+#define SCANCODE_HENKAN 92
+#define SCANCODE_KATAKANAHIRAGANA 93
+#define SCANCODE_MUHENKAN 94
+#define SCANCODE_KPJPCOMMA 95
+
#define SCANCODE_KEYPADENTER 96
#define SCANCODE_RIGHTCONTROL 97
#define SCANCODE_CONTROL 97

View file

@ -0,0 +1,35 @@
--- a/src/video/fbcon/SDL_fbvideo.c
+++ b/src/video/fbcon/SDL_fbvideo.c
@@ -1907,15 +1907,12 @@
static void FB_VideoQuit(_THIS)
{
int i, j;
+ const char *dontClearPixels = SDL_getenv("SDL_FBCON_DONT_CLEAR");
if ( this->screen ) {
- /* Clear screen and tell SDL not to free the pixels */
-
- const char *dontClearPixels = SDL_getenv("SDL_FBCON_DONT_CLEAR");
-
/* If the framebuffer is not to be cleared, make sure that we won't
* display the previous frame when disabling double buffering. */
- if ( dontClearPixels && flip_page == 0 ) {
+ if ( dontClearPixels && (this->screen->flags & SDL_DOUBLEBUF) && flip_page == 0 ) {
SDL_memcpy(flip_address[0], flip_address[1], this->screen->pitch * this->screen->h);
}
@@ -1969,7 +1966,13 @@
/* Restore the original video mode and palette */
if ( FB_InGraphicsMode(this) ) {
- FB_RestorePalette(this);
+ if (dontClearPixels) {
+ /* Restore only panning, keep current mode */
+ ioctl(console_fd, FBIOGET_VSCREENINFO, &saved_vinfo);
+ saved_vinfo.yoffset = saved_vinfo.xoffset = 0;
+ } else {
+ FB_RestorePalette(this);
+ }
ioctl(console_fd, FBIOPUT_VSCREENINFO, &saved_vinfo);
}

View file

@ -0,0 +1,47 @@
#!/bin/sh
#
if [ "$#" -ne 0 ]; then
echo "Run this script to relocate the buildroot SDK at that location"
exit 1
fi
FILEPATH="$(readlink -f "$0")"
NEWPATH="$(dirname "${FILEPATH}")"
cd "${NEWPATH}"
LOCFILE="sdk-location"
if [ ! -r "${LOCFILE}" ]; then
echo "Previous location of the buildroot SDK not found!"
exit 1
fi
OLDPATH="$(cat "${LOCFILE}")"
if [ "${NEWPATH}" = "${OLDPATH}" ]; then
echo "This buildroot SDK has already been relocated!"
exit 0
fi
# Check if the path substitution does work properly, e.g. a tree
# "/a/b/c" copied into "/a/b/c/a/b/c/" would not be allowed.
newpath="$(sed -e "s|${OLDPATH}|${NEWPATH}|g" "${LOCFILE}")"
if [ "${NEWPATH}" != "${newpath}" ]; then
echo "Something went wrong with substituting the path!"
echo "Please choose another location for your SDK!"
exit 1
fi
echo "Relocating the buildroot SDK from ${OLDPATH} to ${NEWPATH} ..."
# Make sure file uses the right language
export LC_ALL=C
# Replace the old path with the new one in all text files
grep -lr "${OLDPATH}" . | while read -r FILE ; do
if file -b --mime-type "${FILE}" | grep -q '^text/' && [ "${FILE}" != "${LOCFILE}" ]
then
sed -i "s|${OLDPATH}|${NEWPATH}|g" "${FILE}"
fi
done
# At the very end, we update the location file to not break the
# SDK if this script gets interruted.
sed -i "s|${OLDPATH}|${NEWPATH}|g" ${LOCFILE}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1 @@
/root/buildroot/output/host

View file

@ -0,0 +1,4 @@
export PATH="/opt/rg35xx-toolchain/usr/bin:${PATH}:/opt/rg35xx-toolchain/usr/arm-buildroot-linux-gnueabihf/sysroot/bin"
export CROSS_COMPILE=/opt/rg35xx-toolchain/usr/bin/arm-buildroot-linux-gnueabihf-
export PREFIX=/opt/rg35xx-toolchain/usr/arm-buildroot-linux-gnueabihf/sysroot/usr
export UNION_PLATFORM=rg35xx

View file

@ -0,0 +1,89 @@
diff --git a/Config.in.legacy b/Config.in.legacy
index d4f3d04062..b3086300e6 100644
--- a/Config.in.legacy
+++ b/Config.in.legacy
@@ -147,6 +147,17 @@ endif
comment "Legacy options removed in 2017.11"
+config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS
+ string "toolchain-external extra libs option has been renamed"
+ help
+ The option BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS has
+ been renamed to BR2_TOOLCHAIN_EXTRA_LIBS.
+
+config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS_WRAP
+ bool
+ default y if BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS != ""
+ select BR2_LEGACY
+
config BR2_PACKAGE_RFKILL
bool "rfkill package removed"
select BR2_LEGACY
diff --git a/package/gcc/gcc-final/gcc-final.mk b/package/gcc/gcc-final/gcc-final.mk
index 30fb87856c..24d034b720 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -187,6 +187,8 @@ ifeq ($(BR2_GCC_ENABLE_OPENMP),y)
HOST_GCC_FINAL_USR_LIBS += libgomp
endif
+HOST_GCC_FINAL_USR_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_LIBS))
+
ifneq ($(HOST_GCC_FINAL_USR_LIBS),)
define HOST_GCC_FINAL_INSTALL_STATIC_LIBS
for i in $(HOST_GCC_FINAL_USR_LIBS) ; do \
diff --git a/toolchain/Config.in b/toolchain/Config.in
index c9aa95985f..8f990cacb9 100644
--- a/toolchain/toolchain-common.in
+++ b/toolchain/toolchain-common.in
@@ -82,6 +82,19 @@ config BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_LIST
Note: the full set of gconv libs are ~8MiB (on ARM).
+config BR2_TOOLCHAIN_EXTRA_LIBS
+ string "Extra toolchain libraries to be copied to target"
+ default ""
+ help
+ If your toolchain provides extra libraries that need to be
+ copied to the target filesystem, enter them here, separated
+ by spaces.
+
+ NOTE: The library name should not include a suffix or wildcard.
+
+ Examples where this can be useful is for adding debug libraries
+ to the target like the GCC libsanitizer (libasan/liblsan/...).
+
# This boolean is true if the toolchain provides a built-in full
# featured gettext implementation (glibc), and false if only a stub
# gettext implementation is provided (uclibc, musl)
diff --git a/toolchain/toolchain-external/pkg-toolchain-external.mk b/toolchain/toolchain-external/pkg-toolchain-external.mk
index 5147da0104..e339773a96 100644
--- a/toolchain/toolchain-external/pkg-toolchain-external.mk
+++ b/toolchain/toolchain-external/pkg-toolchain-external.mk
@@ -156,7 +156,7 @@ ifeq ($(BR2_TOOLCHAIN_HAS_DLANG),y)
TOOLCHAIN_EXTERNAL_LIBS += libgdruntime.so* libgphobos.so*
endif
-TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
+TOOLCHAIN_EXTERNAL_LIBS += $(call qstrip,$(BR2_TOOLCHAIN_EXTRA_LIBS))
#
diff --git a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
index a36747f490..fd95f8201b 100644
--- a/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
+++ b/toolchain/toolchain-external/toolchain-external-custom/Config.in.options
@@ -438,12 +438,4 @@ config BR2_TOOLCHAIN_EXTERNAL_OPENMP
support. If you don't know, leave the default value,
Buildroot will tell you if it's correct or not.
-config BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS
- string "Extra toolchain libraries to be copied to target"
- help
- If your external toolchain provides extra libraries that
- need to be copied to the target filesystem, enter them
- here, separated by spaces. They will be copied to the
- target's /lib directory.
-
endif