From 94929f76ac46d252685d990bd9b59e03c14bc59d Mon Sep 17 00:00:00 2001 From: BoBppy <46050967+BoBppy@users.noreply.github.com> Date: Fri, 19 Jun 2020 17:07:37 +0800 Subject: [PATCH 1/9] build: add GCC 10 version detection Lets add GCC 10 detection to the build system as distributions like Fedora 32 have started shipping with it. Some tools like mtd-utils need work to compile under GCC10, but that will be next step. Signed-off-by: Robert Marko --- include/prereq-build.mk | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/include/prereq-build.mk b/include/prereq-build.mk index a711ae33f..156b3f372 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -28,8 +28,8 @@ $(eval $(call TestHostCommand,proper-umask, \ $(eval $(call SetupHostCommand,gcc, \ Please install the GNU C Compiler (gcc) 4.8 or later, \ - $(CC) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \ - gcc -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \ + $(CC) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \ + gcc -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \ gcc48 --version | grep gcc, \ gcc49 --version | grep gcc, \ gcc5 --version | grep gcc, \ @@ -37,6 +37,7 @@ $(eval $(call SetupHostCommand,gcc, \ gcc7 --version | grep gcc, \ gcc8 --version | grep gcc, \ gcc9 --version | grep gcc, \ + gcc10 --version | grep gcc, \ gcc --version | grep -E 'Apple.(LLVM|clang)' )) $(eval $(call TestHostCommand,working-gcc, \ @@ -47,8 +48,8 @@ $(eval $(call TestHostCommand,working-gcc, \ $(eval $(call SetupHostCommand,g++, \ Please install the GNU C++ Compiler (g++) 4.8 or later, \ - $(CXX) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \ - g++ -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?)', \ + $(CXX) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \ + g++ -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \ g++48 --version | grep g++, \ g++49 --version | grep g++, \ g++5 --version | grep g++, \ @@ -56,6 +57,7 @@ $(eval $(call SetupHostCommand,g++, \ g++7 --version | grep g++, \ g++8 --version | grep g++, \ g++9 --version | grep g++, \ + g++10 --version | grep g++, \ g++ --version | grep -E 'Apple.(LLVM|clang)' )) $(eval $(call TestHostCommand,working-g++, \ @@ -93,6 +95,11 @@ $(eval $(call SetupHostCommand,find,Please install GNU 'find', \ $(eval $(call SetupHostCommand,bash,Please install GNU 'bash', \ bash --version 2>&1 | grep GNU)) +$(eval $(call SetupHostCommand,xargs, \ + Please install 'xargs' that supports '-r/--no-run-if-empty', \ + gxargs -r --version, \ + xargs -r --version)) + $(eval $(call SetupHostCommand,patch,Please install GNU 'patch', \ gpatch --version 2>&1 | grep 'Free Software Foundation', \ patch --version 2>&1 | grep 'Free Software Foundation')) @@ -120,7 +127,6 @@ $(eval $(call SetupHostCommand,grep,Please install GNU 'grep', \ $(eval $(call SetupHostCommand,getopt, \ Please install an extended getopt version that supports --long, \ gnugetopt -o t --long test -- --test | grep '^ *--test *--', \ - /usr/local/bin/getopt -o t --long test -- --test | grep '^ *--test *--', \ getopt -o t --long test -- --test | grep '^ *--test *--')) $(eval $(call SetupHostCommand,stat,Cannot find a file stat utility, \ From d665cad5f2ae932cd8dc3ecd0337ba4b5dbcefd3 Mon Sep 17 00:00:00 2001 From: BoBppy <46050967+BoBppy@users.noreply.github.com> Date: Fri, 19 Jun 2020 17:09:24 +0800 Subject: [PATCH 2/9] squashfs: Fix compile with GCC 10 Fixes the following build error with GCC 10: /usr/bin/ld: read_fs.o:(.bss+0x0): multiple definition of `swap'; mksquashfs.o:(.bss+0x1b2a88): first defined here And a compile warning. Fixes: FS#3104, FS#3119 Signed-off-by: Hauke Mehrtens (cherry picked from commit 1bbc1aa) --- tools/squashfs/patches/140-gcc-10-fix.patch | 25 +++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tools/squashfs/patches/140-gcc-10-fix.patch diff --git a/tools/squashfs/patches/140-gcc-10-fix.patch b/tools/squashfs/patches/140-gcc-10-fix.patch new file mode 100644 index 000000000..a02641f30 --- /dev/null +++ b/tools/squashfs/patches/140-gcc-10-fix.patch @@ -0,0 +1,25 @@ +Fixes the following build error with GCC 10: + /usr/bin/ld: read_fs.o:(.bss+0x0): multiple definition of `swap'; mksquashfs.o:(.bss+0x1b2a88): first defined here +And a compile warning. + +--- a/squashfs-tools/read_fs.c ++++ b/squashfs-tools/read_fs.c +@@ -61,7 +61,7 @@ extern int add_file(long long, long long + fprintf(stderr, s, ## args); \ + } while(0) + +-int swap; ++static int swap; + + int read_block(int fd, long long start, long long *next, unsigned char *block, squashfs_super_block *sBlk) + { +--- a/squashfs-tools/mksquashfs.c ++++ b/squashfs-tools/mksquashfs.c +@@ -258,6 +258,7 @@ int read_sort_file(char *filename, int s + void sort_files_and_write(struct dir_info *dir); + struct file_info *duplicate(char *(get_next_file_block)(struct duplicate_buffer_handle *, unsigned int), struct duplicate_buffer_handle *file_start, long long bytes, unsigned int **block_list, long long *start, int blocks, struct fragment **fragment, char *frag_data, int frag_bytes); + struct dir_info *dir_scan1(char *, int (_readdir)(char *, char *, struct dir_info *)); ++int dir_scan2(squashfs_inode *inode, struct dir_info *dir_info); + + #define MKINODE(A) ((squashfs_inode)(((squashfs_inode) inode_bytes << 16) + (((char *)A) - data_cache))) + From 7915610933edf541b52a609c5aeb5ce43a65f677 Mon Sep 17 00:00:00 2001 From: BoBppy <46050967+BoBppy@users.noreply.github.com> Date: Fri, 19 Jun 2020 17:12:34 +0800 Subject: [PATCH 3/9] tools: squashfskit4: fix build with GCC10 In order to build squashfskit with GCC10, this backport from upstream is needed. Signed-off-by: Robert Marko [increase PKG_RELEASE] Signed-off-by: Alexander Couzens --- ...002-fix-build-failure-against-gcc-10.patch | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tools/squashfskit4/patches/0002-fix-build-failure-against-gcc-10.patch diff --git a/tools/squashfskit4/patches/0002-fix-build-failure-against-gcc-10.patch b/tools/squashfskit4/patches/0002-fix-build-failure-against-gcc-10.patch new file mode 100644 index 000000000..46c6a5ea0 --- /dev/null +++ b/tools/squashfskit4/patches/0002-fix-build-failure-against-gcc-10.patch @@ -0,0 +1,43 @@ +From fe2f5da4b0f8994169c53e84b7cb8a0feefc97b5 Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sun, 26 Jan 2020 18:35:13 +0000 +Subject: [PATCH] squashfs-tools: fix build failure against gcc-10 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On gcc-10 (and gcc-9 -fno-common) build fails as: + +``` +cc ... -o mksquashfs +ld: read_fs.o:(.bss+0x0): + multiple definition of `fwriter_buffer'; mksquashfs.o:(.bss+0x400c90): first defined here +ld: read_fs.o:(.bss+0x8): + multiple definition of `bwriter_buffer'; mksquashfs.o:(.bss+0x400c98): first defined here +``` + +gcc-10 will change the default from -fcommon to fno-common: +https://gcc.gnu.org/PR85678. + +The error also happens if CFLAGS=-fno-common passed explicitly. + +Reported-by: Toralf Förster +Bug: https://bugs.gentoo.org/706456 +Signed-off-by: Sergei Trofimovich +--- + squashfs-tools/mksquashfs.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/squashfs-tools/mksquashfs.h b/squashfs-tools/mksquashfs.h +index 1beefef7..b6503063 100644 +--- a/squashfs-tools/mksquashfs.h ++++ b/squashfs-tools/mksquashfs.h +@@ -143,7 +143,7 @@ struct append_file { + #endif + + extern struct cache *reader_buffer, *fragment_buffer, *reserve_cache; +-struct cache *bwriter_buffer, *fwriter_buffer; ++extern struct cache *bwriter_buffer, *fwriter_buffer; + extern struct queue *to_reader, *to_deflate, *to_writer, *from_writer, + *to_frag, *locked_fragment, *to_process_frag; + extern struct append_file **file_mapping; From bd2aaaea2c08a475af121c3f84b6d30fbe27c13d Mon Sep 17 00:00:00 2001 From: BoBppy <46050967+BoBppy@users.noreply.github.com> Date: Fri, 19 Jun 2020 17:16:24 +0800 Subject: [PATCH 4/9] libubox:fix array out of bounds GCC 10 warning --- package/libs/libubox/Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile index 1c318b3e4..2c5c218b2 100644 --- a/package/libs/libubox/Makefile +++ b/package/libs/libubox/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git -PKG_SOURCE_DATE:=2019-06-16 -PKG_SOURCE_VERSION:=ecf56174da9614a0b3107d33def463eefb4d7785 -PKG_MIRROR_HASH:=e3dd137d69848b8cf2dbc58d70452586dd4178b55977896ea3a9dedaf62c768c +PKG_MIRROR_HASH:=f3b5c23280016bbe4b825de81cd455507ca817f599c5cd9f888370d9a33f6c9e +PKG_SOURCE_DATE:=2020-02-27 +PKG_SOURCE_VERSION:=7da66430de3fc235bfc6ebb0b85fb90ea246138d CMAKE_INSTALL:=1 PKG_LICENSE:=ISC @@ -27,7 +27,7 @@ define Package/libubox SECTION:=libs CATEGORY:=Libraries TITLE:=Basic utility library - ABI_VERSION:=20170601 + ABI_VERSION:=20191228 DEPENDS:= endef From 98ac6365ae10367712b2cc69f7d27b8c8510e40e Mon Sep 17 00:00:00 2001 From: BoBppy <46050967+BoBppy@users.noreply.github.com> Date: Fri, 19 Jun 2020 17:17:11 +0800 Subject: [PATCH 5/9] Add files via upload --- package/system/ubus/Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/package/system/ubus/Makefile b/package/system/ubus/Makefile index 3b0a95598..8308d3016 100644 --- a/package/system/ubus/Makefile +++ b/package/system/ubus/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git -PKG_SOURCE_DATE:=2018-10-06 -PKG_SOURCE_VERSION:=221ce7e7ff1bd1a0c9995fa9d32f58e865f7207f -PKG_MIRROR_HASH:=e6ab3f009688740eb6d7a1857df59a6ba10ae8ae0fac78ae0fd6672f71c02dce +PKG_SOURCE_DATE:=2020-01-05 +PKG_SOURCE_VERSION:=d35df8adda873dc75d876f72b78e84db8cfa72ee +PKG_MIRROR_HASH:=bbe69a7b7df98310f6a6dba344b6190f4ba3ebcc6333b9c4b884feda0a7470e6 CMAKE_INSTALL:=1 PKG_LICENSE:=LGPL-2.1 @@ -15,6 +15,8 @@ PKG_LICENSE_FILES:= PKG_MAINTAINER:=Felix Fietkau +PKG_ASLR_PIE_REGULAR:=1 + include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/cmake.mk From e03d060d1c419d267c8014ce4587cbdf1d6e7a03 Mon Sep 17 00:00:00 2001 From: BoBppy <46050967+BoBppy@users.noreply.github.com> Date: Fri, 19 Jun 2020 17:17:39 +0800 Subject: [PATCH 6/9] Add files via upload From c1cd85e1b44834fd5ac1f1e49c57bbe1d46fbbb2 Mon Sep 17 00:00:00 2001 From: BoBppy <46050967+BoBppy@users.noreply.github.com> Date: Fri, 19 Jun 2020 17:18:42 +0800 Subject: [PATCH 7/9] Add files via upload --- package/system/ucert/Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/package/system/ucert/Makefile b/package/system/ucert/Makefile index 5b4c6b12c..57566e609 100644 --- a/package/system/ucert/Makefile +++ b/package/system/ucert/Makefile @@ -5,9 +5,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/ucert.git -PKG_SOURCE_DATE:=2018-09-18 -PKG_SOURCE_VERSION:=e1c722b1b6cbf2527b3178342464e56b97825874 -PKG_MIRROR_HASH:=36dcca7c2d649a6c34a8daaaef4698fbeb808fd6580c6bfb1ca35f4f06825d17 +PKG_SOURCE_DATE:=2019-12-19 +PKG_SOURCE_VERSION:=14a279411cff06f9b1363711df4ec3b5db73f042 +PKG_MIRROR_HASH:=797f35138c6e1099a839e768d9e01db022223884d9e0a6d09965e625caf0ae79 CMAKE_INSTALL:=1 PKG_CHECK_FORMAT_SECURITY:=1 @@ -17,8 +17,6 @@ PKG_LICENSE_FILES:=COPYING PKG_MAINTAINER:=Daniel Golle -PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) - include $(INCLUDE_DIR)/package.mk include $(INCLUDE_DIR)/host-build.mk include $(INCLUDE_DIR)/cmake.mk @@ -39,6 +37,7 @@ define Package/ucert-full DEPENDS:=+usign +libubox +libjson-c +libblobmsg-json TITLE:=OpenWrt certificate generation and verification utility PROVIDES:=ucert + PROVIDES:=ucert VARIANT:=full endef From 3ace77ac4f55f59addc1ac6e652a9ecd40e3d5b2 Mon Sep 17 00:00:00 2001 From: BoBppy <46050967+BoBppy@users.noreply.github.com> Date: Fri, 19 Jun 2020 17:19:16 +0800 Subject: [PATCH 8/9] Add files via upload --- package/system/uci/Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/package/system/uci/Makefile b/package/system/uci/Makefile index 0f7ef68f1..5c2b68f00 100644 --- a/package/system/uci/Makefile +++ b/package/system/uci/Makefile @@ -9,13 +9,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uci -PKG_RELEASE:=1 +PKG_RELEASE:=3 PKG_SOURCE_URL=$(PROJECT_GIT)/project/uci.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE=2018-08-11 -PKG_SOURCE_VERSION:=4c8b4d6efc8302b508d261573351fffb75bd98c2 -PKG_MIRROR_HASH:=c1f0f565921c71ff9231508c7c249baacad4c3ae1a3fade25c37bcb2bf7a7b5f +PKG_SOURCE_DATE=2020-01-27 +PKG_SOURCE_VERSION:=e8d83732f9eb571dce71aa915ff38a072579610b +PKG_MIRROR_HASH:=f39f82b71bc1072e4bcadaeb392d51055b2be72c41744bb97897a3ac63ce0805 PKG_LICENSE:=LGPL-2.1 PKG_LICENSE_FILES:= @@ -35,6 +35,7 @@ define Package/libuci CATEGORY:=Libraries TITLE:=C library for the Unified Configuration Interface (UCI) DEPENDS:=+libubox + ABI_VERSION:=20130104 endef define Package/uci From f317ed5b5dd70619b1290de92d6e6433198017d3 Mon Sep 17 00:00:00 2001 From: BoBppy <46050967+BoBppy@users.noreply.github.com> Date: Fri, 19 Jun 2020 17:19:49 +0800 Subject: [PATCH 9/9] Add files via upload --- package/system/uci/files/lib/config/uci.sh | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/package/system/uci/files/lib/config/uci.sh b/package/system/uci/files/lib/config/uci.sh index 78ec27766..1e85ced83 100644 --- a/package/system/uci/files/lib/config/uci.sh +++ b/package/system/uci/files/lib/config/uci.sh @@ -85,6 +85,15 @@ uci_set() { /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set "$PACKAGE.$CONFIG.$OPTION=$VALUE" } +uci_add_list() { + local PACKAGE="$1" + local CONFIG="$2" + local OPTION="$3" + local VALUE="$4" + + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} add_list "$PACKAGE.$CONFIG.$OPTION=$VALUE" +} + uci_get_state() { uci_get "$1" "$2" "$3" "$4" "/var/state" } @@ -108,7 +117,7 @@ uci_add() { local CONFIG="$3" if [ -z "$CONFIG" ]; then - export ${NO_EXPORT:+-n} CONFIG_SECTION="$(/sbin/uci add "$PACKAGE" "$TYPE")" + export ${NO_EXPORT:+-n} CONFIG_SECTION="$(/sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} add "$PACKAGE" "$TYPE")" else /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} set "$PACKAGE.$CONFIG=$TYPE" export ${NO_EXPORT:+-n} CONFIG_SECTION="$CONFIG" @@ -132,6 +141,15 @@ uci_remove() { /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} del "$PACKAGE.$CONFIG${OPTION:+.$OPTION}" } +uci_remove_list() { + local PACKAGE="$1" + local CONFIG="$2" + local OPTION="$3" + local VALUE="$4" + + /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} del_list "$PACKAGE.$CONFIG.$OPTION=$VALUE" +} + uci_commit() { local PACKAGE="$1" /sbin/uci ${UCI_CONFIG_DIR:+-c $UCI_CONFIG_DIR} commit $PACKAGE