From 51ec2f45a64687b93faec76a6cd5a7499f4cf0ca Mon Sep 17 00:00:00 2001 From: lovehackintosh <92633080+lovehackintosh@users.noreply.github.com> Date: Wed, 25 Jan 2023 15:30:35 +0800 Subject: [PATCH] treewide: sync with upstream (#10750) * build: fix incomplete initramfs compression options Requires: tools/lz4, tools/lzop complete the wiring so that these options work: * `CONFIG_KERNEL_INITRAMFS_COMPRESSION_LZO` * `CONFIG_KERNEL_INITRAMFS_COMPRESSION_LZ4` Signed-off-by: Tony Butler [remove blocking dependencies for separate ramdisk, fix lzop options] Signed-off-by: Daniel Golle * include: sync with upstream * toolchain/binutils: add support for version 2.40 Release notes: https://sourceware.org/pipermail/binutils/2023-January/125671.html Signed-off-by: Linhui Liu * toolchain/gcc: switch to version 12 by default Also fix build error with gcc 12. * toolchain/nasm: update to 2.16.01 ChangeLog: Version 2.16.01 _This is a documentation update release only._ (*) Fix the creation of the table of contents in the HTML version of the documentation. Version 2.16 (*) Support for the `rdf' format has been discontinued and all the RDOFF utilities has been removed. (*) The `--reproducible' option now leaves the filename field in the COFF object format blank. This was always rather useless since it is only 18 characters long; as such debug formats have to carry their own filename information anyway. (*) Fix handling of MASM-syntax reserved memory (e.g. `dw ?') when used in structure definitions. (*) The preprocessor now supports functions, which can be less verbose and more convenient than the equivalent code implemented using directives. See section 4.4. (*) Fix the handling of `%00' in the preprocessor. (*) Fix incorrect handling of path names affecting error messages, dependency generation, and debug format output. (*) Support for the RDOFF output format and the RDOFF tools have been removed. The RDOFF tools had already been broken since at least NASM 2.14. For flat code the ELF output format recommended; for segmented code the `obj' (OMF) output format. (*) New facility: preprocessor functions. Preprocessor functions, which are expanded similarly to single-line macros, can greatly simplify code that in the past would have required a lengthy list of directives and intermediate macros. See section 4.4. (*) Single-line macros can now declare parameters (using a `&&' prefix) that creates a quoted string, but does _not_ requote an already quoted string. See section 4.2.1. (*) Instruction table updated per public information available as of November 2022. (*) All warnings in the preprocessor have now been assigned warning classes. See appendix A. (*) Fix the invalid use of `RELA'-type relocations instead of `REL'- type relocations when generating DWARF debug information for the `elf32' output format. (*) Fix the handling `at' in `istruc' when the structure contains local labels. See section 5.9.2. (*) When assembling with `--reproducible', don't encode the filename in the COFF header for the `coff', `win32' or `win64' output formats. The COFF header only has space for an 18-character filename, which makes this field rather useless in the first place. Debug output data, if enabled, is not affected. (*) Fix incorrect size calculation when using MASM syntax for non- byte reservations (e.g. `dw ?'.) (*) Allow forcing an instruction in 64-bit mode to have a (possibly redundant) REX prefix, using the syntax `{rex}' as a prefix. (*) Add a `{vex}' prefix to enforce VEX (AVX) encoding of an instruction, either using the 2- or 3-byte VEX prefixes. (*) The `CPU' directive has been augmented to allow control of generation of VEX (AVX) versus EVEX (AVX-512) instruction formats, see section 7.11. (*) Some recent instructions that previously have been only available using EVEX encodings are now also encodable using VEX (AVX) encodings. For backwards compatibility these encodings are not enabled by default, but can be generated either via an explicit `{vex}' prefix or by specifying either `CPU LATEVEX' or `CPU NOEVEX'; see section 7.11. (*) Document the already existing `%unimacro' directive. See section 4.5.12. (*) Fix a code range generation bug in the DWARF debug format (incorrect information in the `DW_AT_high_pc' field) for the ELF output formats. This bug happened to cancel out with a bug in older versions of the GNU binutils linker, but breaks with other linkers and updated or other linkers that expect the spec to be followed. (*) Fix segment symbols with addends, e.g. `jmp _TEXT+10h:0' in output formats that support segment relocations, e.g. the `obj' format. (*) Fix various crashes and hangs on invalid input. Signed-off-by: Linhui Liu * toolchain: musl: Fix symbol loading in gdb Fix DT_DEBUG handling on MIPS in musl libc. With this change gdb will load the symbol files for shared libraries on MIPS too. This patch was taken from this thread: https://www.openwall.com/lists/musl/2022/01/09/4 Signed-off-by: Hauke Mehrtens * tools: sync with upstream * build: fix issues with targets installed via feeds - fix including modules.mk when a target is being replaced - fix calling make targets from target/linux Signed-off-by: Felix Fietkau * package: sync with upstream Signed-off-by: Tony Butler Signed-off-by: Daniel Golle Signed-off-by: Linhui Liu Signed-off-by: Hauke Mehrtens Signed-off-by: Felix Fietkau Co-authored-by: Tony Butler Co-authored-by: Hauke Mehrtens Co-authored-by: Felix Fietkau --- Makefile | 2 +- config/Config-images.in | 2 - include/bpf.mk | 2 +- include/host-build.mk | 6 +- include/image-commands.mk | 11 + include/image.mk | 42 +- include/kernel-defaults.mk | 6 +- include/prereq-build.mk | 19 +- include/prereq.mk | 12 + include/scan.mk | 2 +- include/toplevel.mk | 16 +- include/trusted-firmware-a.mk | 2 +- include/unpack.mk | 4 +- package/boot/uboot-envtools/Makefile | 6 +- package/boot/uboot-envtools/files/apm821xx | 4 + package/boot/uboot-envtools/files/ath79 | 61 +- .../boot/uboot-envtools/files/imx_cortexa7 | 19 + package/boot/uboot-envtools/files/ipq40xx | 27 +- package/boot/uboot-envtools/files/ipq806x | 1 + package/boot/uboot-envtools/files/ipq807x | 21 +- package/boot/uboot-envtools/files/kirkwood | 1 + .../boot/uboot-envtools/files/mediatek_mt7622 | 5 +- .../boot/uboot-envtools/files/mediatek_mt7623 | 4 + package/boot/uboot-envtools/files/mpc85xx | 7 + package/boot/uboot-envtools/files/mvebu | 16 +- package/boot/uboot-envtools/files/oxnas | 2 +- package/boot/uboot-envtools/files/realtek | 28 +- package/boot/uboot-mediatek/Makefile | 17 +- ...20-add-support-for-RAVPower-RP-WD009.patch | 9 +- .../patches/431-add-xiaomi_redmi-ax6000.patch | 392 ++++++ package/devel/trace-cmd/Makefile | 4 +- package/kernel/linux/Makefile | 6 +- package/kernel/rtl8812au-ct/Makefile | 6 +- .../rtl8812au-ct/patches/100-api_update.patch | 56 + package/libs/elfutils/Makefile | 2 +- package/libs/libpcap/Makefile | 8 +- .../libs/libpcap/patches/100-no-openssl.patch | 2 +- .../libpcap/patches/102-skip-manpages.patch | 2 +- .../patches/201-space_optimization.patch | 26 - .../210-add-rpcapd-in-linux-support.patch | 2 +- ...dd-support-for-B.A.T.M.A.N.-Advanced.patch | 642 ++++++++++ package/libs/libtraceevent/Makefile | 4 +- package/libs/libtracefs/Makefile | 4 +- package/libs/mbedtls/Makefile | 7 - .../mbedtls/patches/101-remove-test.patch | 15 + package/libs/ncurses/Makefile | 6 +- .../100-ncurses-5.6-20080112-urxvt.patch | 2 +- .../101-ncurses-5.6-20080628-kbs.patch | 26 +- .../patches/102-ncurses-5.9-gcc-5.patch | 2 +- .../patches/103-ncurses-ar-determinism.patch | 4 +- .../libs/ncurses/patches/900-terminfo.patch | 2 +- .../libs/openssl/patches/010-padlock.patch | 52 + package/network/services/lldpd/Makefile | 9 +- .../network/services/lldpd/files/lldpd.init | 7 +- ...-configure-Remove-include-sys-stat.h.patch | 43 + package/network/utils/nftables/Makefile | 8 +- .../utils/nftables/patches/0001-fix-nft.patch | 23 - package/network/utils/uqmi/Makefile | 6 +- ...001-SSDK-config-add-kernel-5.10-5.15.patch | 2 +- .../patches/0005-add-kernel-5.4-support.patch | 8 +- ...010-QSDK-config-Avoid-Werror-heroics.patch | 30 + ...mpilation-error-for-parse_uci_option.patch | 5 - package/system/fstools/Makefile | 10 +- package/system/procd/Makefile | 8 +- package/system/urngd/Makefile | 2 +- package/utils/busybox/Config-defaults.in | 33 + package/utils/busybox/Makefile | 6 +- .../utils/busybox/config/coreutils/Config.in | 7 +- package/utils/busybox/config/libbb/Config.in | 62 +- .../utils/busybox/config/miscutils/Config.in | 12 + .../busybox/config/networking/udhcp/Config.in | 7 +- package/utils/busybox/config/shell/Config.in | 5 + ...VE-2022-30065-awk-fix-use-after-free.patch | 42 - package/utils/ucode-mod-bpf/Makefile | 40 + package/utils/ucode-mod-bpf/src/bpf.c | 814 +++++++++++++ package/utils/ucode/Makefile | 6 +- package/utils/util-linux/Makefile | 6 +- .../util-linux/patches/010-meson-typo.patch | 20 - ...eson-fix-compilation-without-systemd.patch | 22 - ...n-fix-when-HAVE_CLOCK_GETTIME-is-set.patch | 21 - .../files/95_apply_bootconfig | 4 +- rules.mk | 4 +- scripts/dl_github_archive.py | 2 +- scripts/ext-tools.sh | 26 +- scripts/json_add_image_info.py | 2 +- target/imagebuilder/files/Makefile | 33 +- target/linux/Makefile | 2 +- target/linux/ipq807x/Makefile | 2 +- toolchain/binutils/Config.in | 4 + toolchain/binutils/Config.version | 4 + toolchain/binutils/Makefile | 4 + .../2.40/300-001_ld_makefile_patch.patch | 22 + .../400-mips_no_dynamic_linking_sym.patch | 18 + ...e-default-emulation-for-mips64-linux.patch | 38 + toolchain/gcc/Config.in | 2 +- toolchain/gcc/Config.version | 8 +- toolchain/gcc/common.mk | 10 +- toolchain/gcc/final/Makefile | 2 +- toolchain/gdb/Makefile | 8 +- .../musl/patches/800-mips_pie_debug.patch | 61 + toolchain/nasm/Makefile | 5 +- tools/Makefile | 20 +- tools/autoconf/patches/000-relocatable.patch | 40 +- tools/automake/Makefile | 2 +- tools/automake/patches/000-relocatable.patch | 10 +- tools/b43-tools/Makefile | 11 +- tools/cmake/Makefile | 4 +- ...poch.patch => 100-source-date-epoch.patch} | 17 +- .../101-config-switch-to-AC_CHECK_LIB.patch | 28 + tools/libdeflate/Makefile | 23 +- tools/liblzo/Makefile | 42 + .../001-add-cmake-ENABLE-configurables.patch | 68 ++ tools/libtool/patches/000-relocatable.patch | 50 +- tools/llvm-bpf/Makefile | 4 +- tools/lz4/Makefile | 49 + ...01-add-make-ENABLE_DOCS-configurable.patch | 60 + ...makefile-install-links-from-same-dir.patch | 71 ++ tools/lzop/Makefile | 33 + ...1-add-cmake-ENABLE_DOCS-configurable.patch | 24 + tools/mpc/Makefile | 4 +- tools/mpfr/Makefile | 4 +- tools/mpfr/patches/001-only_src.patch | 4 +- ...2-Fix-mpfr_custom_get_kind-macro-bug.patch | 76 -- .../patches/100-make_jobserver_support.patch | 1073 +++++++++-------- tools/patchelf/Makefile | 4 +- tools/xz/Makefile | 4 +- 126 files changed, 3842 insertions(+), 1034 deletions(-) create mode 100644 package/boot/uboot-envtools/files/imx_cortexa7 create mode 100644 package/boot/uboot-mediatek/patches/431-add-xiaomi_redmi-ax6000.patch create mode 100644 package/kernel/rtl8812au-ct/patches/100-api_update.patch delete mode 100644 package/libs/libpcap/patches/201-space_optimization.patch create mode 100644 package/libs/libpcap/patches/300-Add-support-for-B.A.T.M.A.N.-Advanced.patch create mode 100644 package/libs/mbedtls/patches/101-remove-test.patch create mode 100644 package/libs/openssl/patches/010-padlock.patch create mode 100644 package/network/utils/iproute2/patches/320-configure-Remove-include-sys-stat.h.patch delete mode 100644 package/network/utils/nftables/patches/0001-fix-nft.patch create mode 100644 package/qca/qca-ssdk/patches/0010-QSDK-config-Avoid-Werror-heroics.patch delete mode 100644 package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch create mode 100644 package/utils/ucode-mod-bpf/Makefile create mode 100644 package/utils/ucode-mod-bpf/src/bpf.c delete mode 100644 package/utils/util-linux/patches/010-meson-typo.patch delete mode 100644 package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch delete mode 100644 package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch create mode 100644 toolchain/binutils/patches/2.40/300-001_ld_makefile_patch.patch create mode 100644 toolchain/binutils/patches/2.40/400-mips_no_dynamic_linking_sym.patch create mode 100644 toolchain/binutils/patches/2.40/500-Change-default-emulation-for-mips64-linux.patch create mode 100644 toolchain/musl/patches/800-mips_pie_debug.patch rename tools/dosfstools/patches/{source-date-epoch.patch => 100-source-date-epoch.patch} (93%) create mode 100644 tools/dosfstools/patches/101-config-switch-to-AC_CHECK_LIB.patch create mode 100644 tools/liblzo/Makefile create mode 100644 tools/liblzo/patches/001-add-cmake-ENABLE-configurables.patch create mode 100644 tools/lz4/Makefile create mode 100644 tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch create mode 100644 tools/lz4/patches/002-makefile-install-links-from-same-dir.patch create mode 100644 tools/lzop/Makefile create mode 100644 tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch delete mode 100644 tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch diff --git a/Makefile b/Makefile index cbf9fa2cd..cff0e1d8d 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt dir world: DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep '/usr' -m 1) -export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) +export PATH:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host/bin),$(TOPDIR)/staging_dir/host/bin):$(PATH) ifneq ($(OPENWRT_BUILD),1) _SINGLE=export MAKEFLAGS=$(space); diff --git a/config/Config-images.in b/config/Config-images.in index 92e517ca8..495e9b791 100644 --- a/config/Config-images.in +++ b/config/Config-images.in @@ -37,11 +37,9 @@ menu "Target Images" bool "lzma" config TARGET_INITRAMFS_COMPRESSION_LZO - depends on !TARGET_ROOTFS_INITRAMFS_SEPARATE bool "lzo" config TARGET_INITRAMFS_COMPRESSION_LZ4 - depends on !TARGET_ROOTFS_INITRAMFS_SEPARATE bool "lz4" config TARGET_INITRAMFS_COMPRESSION_XZ diff --git a/include/bpf.mk b/include/bpf.mk index e43fcad50..ec3f04e1e 100644 --- a/include/bpf.mk +++ b/include/bpf.mk @@ -64,7 +64,7 @@ BPF_CFLAGS := \ -O2 -emit-llvm -Xclang -disable-llvm-passes ifneq ($(CONFIG_HAS_BPF_TOOLCHAIN),) -ifeq ($(DUMP),) +ifeq ($(DUMP)$(filter download refresh,$(MAKECMDGOALS)),) CLANG_VER:=$(shell $(CLANG) -dM -E - < /dev/null | grep __clang_major__ | cut -d' ' -f3) CLANG_VER_VALID:=$(shell [ "$(CLANG_VER)" -ge "$(CLANG_MIN_VER)" ] && echo 1 ) ifeq ($(CLANG_VER_VALID),) diff --git a/include/host-build.mk b/include/host-build.mk index 22fcc31f1..2cc1ec584 100644 --- a/include/host-build.mk +++ b/include/host-build.mk @@ -206,5 +206,9 @@ endif define HostBuild $(HostBuild/Core) - $(if $(if $(PKG_HOST_ONLY),,$(if $(and $(filter host-%,$(MAKECMDGOALS)),$(PKG_SKIP_DOWNLOAD)),,$(STAMP_PREPARED))),,$(if $(strip $(PKG_SOURCE_URL)),$(call Download,default))) + $(if $(if $(PKG_HOST_ONLY),,$(if $(and $(filter host-%,$(MAKECMDGOALS)),$(PKG_SKIP_DOWNLOAD)),,$(STAMP_PREPARED))),, + $(if $(and $(CONFIG_AUTOREMOVE), $(wildcard $(HOST_STAMP_INSTALLED), $(wildcard $(HOST_STAMP_BUILT)))),, + $(if $(strip $(PKG_SOURCE_URL)),$(call Download,default)) + ) + ) endef diff --git a/include/image-commands.mk b/include/image-commands.mk index 407dffa0c..d65d2cd55 100644 --- a/include/image-commands.mk +++ b/include/image-commands.mk @@ -277,7 +277,9 @@ endef define Build/initrd_compression $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),.bzip2) \ $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),.gzip) \ + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),.lz4) \ $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),.lzma) \ + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),.lzo) \ $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),.xz) \ $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),.zstd) endef @@ -316,6 +318,15 @@ define Build/gzip @mv $@.new $@ endef +define Build/gzip-filename + @mkdir -p $@.tmp + @cp $@ $@.tmp/$(word 1,$(1)) + $(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $@.tmp/$(word 1,$(1)) $(word 2,$(1))) + $(STAGING_DIR_HOST)/bin/gzip -f -9 -N -c $@.tmp/$(word 1,$(1)) $(word 2,$(1)) > $@.new + @mv $@.new $@ + @rm -rf $@.tmp +endef + define Build/install-dtb $(call locked, \ $(foreach dts,$(DEVICE_DTS), \ diff --git a/include/image.mk b/include/image.mk index 5d9d4acb4..b801ef993 100644 --- a/include/image.mk +++ b/include/image.mk @@ -333,6 +333,8 @@ define Device/InitProfile DEVICE_ALT0_TITLE = $$(DEVICE_ALT0_VENDOR) $$(DEVICE_ALT0_MODEL)$$(if $$(DEVICE_ALT0_VARIANT), $$(DEVICE_ALT0_VARIANT)) DEVICE_ALT1_TITLE = $$(DEVICE_ALT1_VENDOR) $$(DEVICE_ALT1_MODEL)$$(if $$(DEVICE_ALT1_VARIANT), $$(DEVICE_ALT1_VARIANT)) DEVICE_ALT2_TITLE = $$(DEVICE_ALT2_VENDOR) $$(DEVICE_ALT2_MODEL)$$(if $$(DEVICE_ALT2_VARIANT), $$(DEVICE_ALT2_VARIANT)) + DEVICE_ALT3_TITLE = $$(DEVICE_ALT3_VENDOR) $$(DEVICE_ALT3_MODEL)$$(if $$(DEVICE_ALT3_VARIANT), $$(DEVICE_ALT3_VARIANT)) + DEVICE_ALT4_TITLE = $$(DEVICE_ALT4_VENDOR) $$(DEVICE_ALT4_MODEL)$$(if $$(DEVICE_ALT4_VARIANT), $$(DEVICE_ALT4_VARIANT)) DEVICE_VENDOR := DEVICE_MODEL := DEVICE_VARIANT := @@ -345,6 +347,12 @@ define Device/InitProfile DEVICE_ALT2_VENDOR := DEVICE_ALT2_MODEL := DEVICE_ALT2_VARIANT := + DEVICE_ALT3_VENDOR := + DEVICE_ALT3_MODEL := + DEVICE_ALT3_VARIANT := + DEVICE_ALT4_VENDOR := + DEVICE_ALT4_MODEL := + DEVICE_ALT4_VARIANT := DEVICE_PACKAGES := DEVICE_DESCRIPTION = Build firmware images for $$(DEVICE_TITLE) endef @@ -359,6 +367,7 @@ define Device/Init ARTIFACTS := DEVICE_IMG_PREFIX := $(IMG_PREFIX)-$(1) DEVICE_IMG_NAME = $$(DEVICE_IMG_PREFIX)-$$(1)-$$(2) + FACTORY_IMG_NAME := IMAGE_SIZE := KERNEL_PREFIX = $$(DEVICE_IMG_PREFIX) KERNEL_SUFFIX := -kernel.bin @@ -418,11 +427,14 @@ DEFAULT_DEVICE_VARS := \ DEVICE_FDT_NUM DEVICE_IMG_PREFIX SOC BOARD_NAME UIMAGE_MAGIC UIMAGE_NAME \ SUPPORTED_DEVICES IMAGE_METADATA KERNEL_ENTRY KERNEL_LOADADDR \ UBOOT_PATH IMAGE_SIZE \ + FACTORY_IMG_NAME FACTORY_SIZE \ DEVICE_PACKAGES DEVICE_COMPAT_VERSION DEVICE_COMPAT_MESSAGE \ DEVICE_VENDOR DEVICE_MODEL DEVICE_VARIANT \ DEVICE_ALT0_VENDOR DEVICE_ALT0_MODEL DEVICE_ALT0_VARIANT \ DEVICE_ALT1_VENDOR DEVICE_ALT1_MODEL DEVICE_ALT1_VARIANT \ - DEVICE_ALT2_VENDOR DEVICE_ALT2_MODEL DEVICE_ALT2_VARIANT + DEVICE_ALT2_VENDOR DEVICE_ALT2_MODEL DEVICE_ALT2_VARIANT \ + DEVICE_ALT3_VENDOR DEVICE_ALT3_MODEL DEVICE_ALT3_VARIANT \ + DEVICE_ALT4_VENDOR DEVICE_ALT4_MODEL DEVICE_ALT4_VARIANT define Device/ExportVar $(1) : $(2):=$$($(2)) @@ -505,6 +517,12 @@ define Device/Build/initramfs DEVICE_ALT2_VENDOR="$$(DEVICE_ALT2_VENDOR)" \ DEVICE_ALT2_MODEL="$$(DEVICE_ALT2_MODEL)" \ DEVICE_ALT2_VARIANT="$$(DEVICE_ALT2_VARIANT)" \ + DEVICE_ALT3_VENDOR="$$(DEVICE_ALT3_VENDOR)" \ + DEVICE_ALT3_MODEL="$$(DEVICE_ALT3_MODEL)" \ + DEVICE_ALT3_VARIANT="$$(DEVICE_ALT3_VARIANT)" \ + DEVICE_ALT4_VENDOR="$$(DEVICE_ALT4_VENDOR)" \ + DEVICE_ALT4_MODEL="$$(DEVICE_ALT4_MODEL)" \ + DEVICE_ALT4_VARIANT="$$(DEVICE_ALT4_VARIANT)" \ DEVICE_TITLE="$$(DEVICE_TITLE)" \ DEVICE_PACKAGES="$$(DEVICE_PACKAGES)" \ TARGET="$(BOARD)" \ @@ -613,6 +631,12 @@ define Device/Build/image DEVICE_ALT2_VENDOR="$(DEVICE_ALT2_VENDOR)" \ DEVICE_ALT2_MODEL="$(DEVICE_ALT2_MODEL)" \ DEVICE_ALT2_VARIANT="$(DEVICE_ALT2_VARIANT)" \ + DEVICE_ALT3_VENDOR="$(DEVICE_ALT3_VENDOR)" \ + DEVICE_ALT3_MODEL="$(DEVICE_ALT3_MODEL)" \ + DEVICE_ALT3_VARIANT="$(DEVICE_ALT3_VARIANT)" \ + DEVICE_ALT4_VENDOR="$(DEVICE_ALT4_VENDOR)" \ + DEVICE_ALT4_MODEL="$(DEVICE_ALT4_MODEL)" \ + DEVICE_ALT4_VARIANT="$(DEVICE_ALT4_VARIANT)" \ DEVICE_TITLE="$(DEVICE_TITLE)" \ DEVICE_PACKAGES="$(DEVICE_PACKAGES)" \ TARGET="$(BOARD)" \ @@ -658,6 +682,12 @@ define Device/Build/artifact DEVICE_ALT2_VENDOR="$(DEVICE_ALT2_VENDOR)" \ DEVICE_ALT2_MODEL="$(DEVICE_ALT2_MODEL)" \ DEVICE_ALT2_VARIANT="$(DEVICE_ALT2_VARIANT)" \ + DEVICE_ALT3_VENDOR="$(DEVICE_ALT3_VENDOR)" \ + DEVICE_ALT3_MODEL="$(DEVICE_ALT3_MODEL)" \ + DEVICE_ALT3_VARIANT="$(DEVICE_ALT3_VARIANT)" \ + DEVICE_ALT4_VENDOR="$(DEVICE_ALT4_VENDOR)" \ + DEVICE_ALT4_MODEL="$(DEVICE_ALT4_MODEL)" \ + DEVICE_ALT4_VARIANT="$(DEVICE_ALT4_VARIANT)" \ DEVICE_TITLE="$(DEVICE_TITLE)" \ DEVICE_PACKAGES="$(DEVICE_PACKAGES)" \ TARGET="$(BOARD)" \ @@ -699,6 +729,8 @@ $(if $(strip $(DEVICE_ALT0_TITLE)),Alternative device titles: - $(DEVICE_ALT0_TITLE)) $(if $(strip $(DEVICE_ALT1_TITLE)),- $(DEVICE_ALT1_TITLE)) $(if $(strip $(DEVICE_ALT2_TITLE)),- $(DEVICE_ALT2_TITLE)) +$(if $(strip $(DEVICE_ALT3_TITLE)),- $(DEVICE_ALT3_TITLE)) +$(if $(strip $(DEVICE_ALT4_TITLE)),- $(DEVICE_ALT4_TITLE)) @@ endef @@ -716,6 +748,14 @@ ifneq ($$(strip $$(DEVICE_ALT2_TITLE)),) DEVICE_DISPLAY = $$(DEVICE_ALT2_TITLE) ($$(DEVICE_TITLE)) $$(info $$(call Device/DumpInfo,$(1))) endif +ifneq ($$(strip $$(DEVICE_ALT3_TITLE)),) +DEVICE_DISPLAY = $$(DEVICE_ALT3_TITLE) ($$(DEVICE_TITLE)) +$$(info $$(call Device/DumpInfo,$(1))) +endif +ifneq ($$(strip $$(DEVICE_ALT4_TITLE)),) +DEVICE_DISPLAY = $$(DEVICE_ALT4_TITLE) ($$(DEVICE_TITLE)) +$$(info $$(call Device/DumpInfo,$(1))) +endif DEVICE_DISPLAY = $$(DEVICE_TITLE) $$(eval $$(if $$(DEVICE_TITLE),$$(info $$(call Device/DumpInfo,$(1))))) endef diff --git a/include/kernel-defaults.mk b/include/kernel-defaults.mk index 5b334fcdf..334d99e9c 100644 --- a/include/kernel-defaults.mk +++ b/include/kernel-defaults.mk @@ -21,7 +21,7 @@ Kernel/Patch:=$(Kernel/Patch/Default) ifneq (,$(findstring .xz,$(LINUX_SOURCE))) LINUX_CAT:=xzcat else - LINUX_CAT:=gzip -dc + LINUX_CAT:=$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc endif ifeq ($(strip $(CONFIG_EXTERNAL_KERNEL_TREE)),"") @@ -180,10 +180,10 @@ endif $(if $(SOURCE_DATE_EPOCH),touch -hcd "@$(SOURCE_DATE_EPOCH)" $(KERNEL_BUILD_DIR)/initrd.cpio) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_BZIP2),bzip2 -9 -c < $(KERNEL_BUILD_DIR)/initrd.cpio > $(KERNEL_BUILD_DIR)/initrd.cpio.bzip2) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_GZIP),gzip -n -f -S .gzip -9n $(KERNEL_BUILD_DIR)/initrd.cpio) + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),$(STAGING_DIR_HOST)/bin/lz4c -l -c1 -fz --favor-decSpeed $(KERNEL_BUILD_DIR)/initrd.cpio) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZMA),$(STAGING_DIR_HOST)/bin/lzma e -lc1 -lp2 -pb2 $(KERNEL_BUILD_DIR)/initrd.cpio $(KERNEL_BUILD_DIR)/initrd.cpio.lzma) -# ? $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),) + $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),$(STAGING_DIR_HOST)/bin/lzop -9 -f $(KERNEL_BUILD_DIR)/initrd.cpio) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_XZ),$(STAGING_DIR_HOST)/bin/xz -T$(if $(filter 1,$(NPROC)),2,0) -9 -fz --check=crc32 $(KERNEL_BUILD_DIR)/initrd.cpio) -# ? $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),) $(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),$(STAGING_DIR_HOST)/bin/zstd -T0 -f -o $(KERNEL_BUILD_DIR)/initrd.cpio.zstd $(KERNEL_BUILD_DIR)/initrd.cpio) endif +$(KERNEL_MAKE) $(KERNEL_MAKEOPTS_IMAGE) $(if $(KERNELNAME),$(KERNELNAME),all) modules diff --git a/include/prereq-build.mk b/include/prereq-build.mk index 9c4ef547a..8fae92ab9 100644 --- a/include/prereq-build.mk +++ b/include/prereq-build.mk @@ -49,10 +49,9 @@ $(eval $(call TestHostCommand,working-g++, \ g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \ $(TMP_DIR)/a.out)) -$(eval $(call TestHostCommand,ncurses, \ +$(eval $(call RequireCHeader,ncurses.h, \ Please install ncurses. (Missing libncurses.so or ncurses.h), \ - echo 'int main(int argc, char **argv) { initscr(); return 0; }' | \ - gcc -include ncurses.h -x c -o $(TMP_DIR)/a.out - -lncurses)) + initscr(), -lncurses)) $(eval $(call SetupHostCommand,git,Please install Git (git-core) >= 1.7.12.2, \ git --exec-path | xargs -I % -- grep -q -- --recursive %/git-submodule, \ @@ -205,6 +204,20 @@ $(eval $(call SetupHostCommand,which,Please install 'which', \ /bin/which which, \ which which)) +ifeq ($(HOST_OS),Linux) + $(eval $(call RequireCHeader,argp.h, \ + Missing argp.h Please install the argp-standalone package if musl libc)) + + $(eval $(call RequireCHeader,fts.h, \ + Missing fts.h Please install the musl-fts-dev package if musl libc)) + + $(eval $(call RequireCHeader,obstack.h, \ + Missing obstack.h Please install the musl-obstack-dev package if musl libc)) + + $(eval $(call RequireCHeader,libintl.h, \ + Missing libintl.h Please install the musl-libintl package if musl libc)) +endif + $(STAGING_DIR_HOST)/bin/mkhash: $(SCRIPT_DIR)/mkhash.c mkdir -p $(dir $@) $(CC) -O2 -I$(TOPDIR)/tools/include -o $@ $< diff --git a/include/prereq.mk b/include/prereq.mk index 0033535e7..d34539ec3 100644 --- a/include/prereq.mk +++ b/include/prereq.mk @@ -63,6 +63,18 @@ define RequireHeader $$(eval $$(call Require,$(1),$(2))) endef +# 1: header to test +# 2: failure message +# 3: optional compile time test +# 4: optional link library test (example -lncurses) +define RequireCHeader + define Require/$(1) + echo 'int main(int argc, char **argv) { $(3); return 0; }' | gcc -include $(1) -x c -o $(TMP_DIR)/a.out - $(4) + endef + + $$(eval $$(call Require,$(1),$(2))) +endef + define CleanupPython2 define Require/python2-cleanup if [ -f "$(STAGING_DIR_HOST)/bin/python" ] && \ diff --git a/include/scan.mk b/include/scan.mk index 5032afa81..12ef5d1dc 100644 --- a/include/scan.mk +++ b/include/scan.mk @@ -11,7 +11,7 @@ TARGET_STAMP:=$(TMP_DIR)/info/.files-$(SCAN_TARGET).stamp FILELIST:=$(TMP_DIR)/info/.files-$(SCAN_TARGET)-$(SCAN_COOKIE) OVERRIDELIST:=$(TMP_DIR)/info/.overrides-$(SCAN_TARGET)-$(SCAN_COOKIE) -export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) +export PATH:=$(STAGING_DIR_HOST)/bin:$(PATH) define feedname $(if $(patsubst feeds/%,,$(1)),,$(word 2,$(subst /, ,$(1)))) diff --git a/include/toplevel.mk b/include/toplevel.mk index 455fc9c4d..2fda7ed22 100644 --- a/include/toplevel.mk +++ b/include/toplevel.mk @@ -51,22 +51,22 @@ path:=$(subst :,$(space),$(PATH)) path:=$(filter-out .%,$(path)) path:=$(subst $(space),:,$(path)) export PATH:=$(path) +export STAGING_DIR_HOST:=$(if $(STAGING_DIR),$(abspath $(STAGING_DIR)/../host),$(TOPDIR)/staging_dir/host) unexport TAR_OPTIONS ifeq ($(FORCE),) - .config scripts/config/conf scripts/config/mconf: staging_dir/host/.prereq-build + .config scripts/config/conf scripts/config/mconf: $(STAGING_DIR_HOST)/.prereq-build endif SCAN_COOKIE?=$(shell echo $$$$) export SCAN_COOKIE -export STAGING_DIR_HOST=$(TOPDIR)/staging_dir/host SUBMAKE:=umask 022; $(SUBMAKE) ULIMIT_FIX=_limit=`ulimit -n`; [ "$$_limit" = "unlimited" -o "$$_limit" -ge 1024 ] || ulimit -n 1024; -prepare-mk: staging_dir/host/.prereq-build FORCE ; +prepare-mk: $(STAGING_DIR_HOST)/.prereq-build FORCE ; ifdef SDK IGNORE_PACKAGES = linux @@ -75,7 +75,7 @@ endif _ignore = $(foreach p,$(IGNORE_PACKAGES),--ignore $(p)) prepare-tmpinfo: FORCE - @+$(MAKE) -r -s staging_dir/host/.prereq-build $(PREP_MK) + @+$(MAKE) -r -s $(STAGING_DIR_HOST)/.prereq-build $(PREP_MK) mkdir -p tmp/info $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="packageinfo" SCAN_DIR="package" SCAN_NAME="package" SCAN_DEPTH=5 SCAN_EXTRA="" $(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f include/scan.mk SCAN_TARGET="targetinfo" SCAN_DIR="target/linux" SCAN_NAME="target" SCAN_DEPTH=3 SCAN_EXTRA="" SCAN_MAKEOPTS="TARGET_BUILD=1" @@ -152,7 +152,7 @@ xconfig: scripts/config/qconf prepare-tmpinfo FORCE prepare_kernel_conf: .config toolchain/install FORCE -ifeq ($(wildcard staging_dir/host/bin/quilt),) +ifeq ($(wildcard $(STAGING_DIR_HOST)/bin/quilt),) prepare_kernel_conf: @+$(SUBMAKE) -r tools/quilt/compile else @@ -176,7 +176,7 @@ kernel_nconfig: prepare_kernel_conf kernel_xconfig: prepare_kernel_conf $(_SINGLE)$(NO_TRACE_MAKE) -C target/linux xconfig -staging_dir/host/.prereq-build: include/prereq-build.mk +$(STAGING_DIR_HOST)/.prereq-build: include/prereq-build.mk mkdir -p tmp @$(_SINGLE)$(NO_TRACE_MAKE) -j1 -r -s -f $(TOPDIR)/include/prereq-build.mk prereq 2>/dev/null || { \ echo "Prerequisite check failed. Use FORCE=1 to override."; \ @@ -199,7 +199,7 @@ else DOWNLOAD_DIRS = package/download endif -download: .config FORCE $(if $(wildcard $(TOPDIR)/staging_dir/host/bin/flock),,tools/flock/compile) +download: .config FORCE $(if $(wildcard $(STAGING_DIR_HOST)/bin/flock),,tools/flock/compile) @+$(foreach dir,$(DOWNLOAD_DIRS),$(SUBMAKE) $(dir);) clean dirclean: .config @@ -263,7 +263,7 @@ distclean: @$(_SINGLE)$(SUBMAKE) -C scripts/config clean ifeq ($(findstring v,$(DEBUG)),) - .SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig staging_dir/host/.prereq-build tmp/.prereq-package prepare-tmpinfo + .SILENT: symlinkclean clean dirclean distclean config-clean download help tmpinfo-clean .config scripts/config/mconf scripts/config/conf menuconfig $(STAGING_DIR_HOST)/.prereq-build tmp/.prereq-package prepare-tmpinfo endif .PHONY: help FORCE .NOTPARALLEL: diff --git a/include/trusted-firmware-a.mk b/include/trusted-firmware-a.mk index 082ada269..0c0118e09 100644 --- a/include/trusted-firmware-a.mk +++ b/include/trusted-firmware-a.mk @@ -81,7 +81,7 @@ define Build/Compile/Trusted-Firmware-A $(if $(DTC),DTC="$(DTC)") \ PLAT=$(PLAT) \ BUILD_STRING="OpenWrt v$(PKG_VERSION)-$(PKG_RELEASE) ($(VARIANT))" \ - $(if $(CONFIG_BINUTILS_VERSION_2_39),LDFLAGS="-no-warn-rwx-segments") \ + $(if $(CONFIG_BINUTILS_VERSION_2_37)$(CONFIG_BINUTILS_VERSION_2_38),,LDFLAGS="-no-warn-rwx-segments") \ $(TFA_MAKE_FLAGS) endef diff --git a/include/unpack.mk b/include/unpack.mk index ebece6997..5959d55f4 100644 --- a/include/unpack.mk +++ b/include/unpack.mk @@ -18,7 +18,7 @@ ifeq ($(strip $(UNPACK_CMD)),) ifeq ($(filter gz tgz,$(EXT)),$(EXT)) EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=)) - DECOMPRESS_CMD:=gzip -dc $(DL_DIR)/$(PKG_SOURCE) | + DECOMPRESS_CMD:=$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc $(DL_DIR)/$(PKG_SOURCE) | endif ifeq ($(filter bzip2 bz2 bz tbz2 tbz,$(EXT)),$(EXT)) EXT:=$(call ext,$(PKG_SOURCE:.$(EXT)=)) @@ -56,7 +56,7 @@ ifeq ($(strip $(UNPACK_CMD)),) endif # replace zcat with $(ZCAT), because some system don't support it properly ifeq ($(PKG_CAT),zcat) - UNPACK_CMD=gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR_CMD) + UNPACK_CMD=$(STAGING_DIR_HOST)/bin/libdeflate-gzip -dc $(DL_DIR)/$(PKG_SOURCE) | $(TAR_CMD) endif endif endif diff --git a/package/boot/uboot-envtools/Makefile b/package/boot/uboot-envtools/Makefile index 1ace390c4..9ed39cbf5 100644 --- a/package/boot/uboot-envtools/Makefile +++ b/package/boot/uboot-envtools/Makefile @@ -9,15 +9,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=uboot-envtools PKG_DISTNAME:=u-boot -PKG_VERSION:=2021.01 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=2023.01 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_DISTNAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ https://ftp.denx.de/pub/u-boot \ https://mirror.cyberbits.eu/u-boot \ ftp://ftp.denx.de/pub/u-boot -PKG_HASH:=b407e1510a74e863b8b5cb42a24625344f0e0c2fc7582d8c866bd899367d0454 +PKG_HASH:=69423bad380f89a0916636e89e6dcbd2e4512d584308d922d1039d1e4331950f PKG_SOURCE_SUBDIR:=$(PKG_DISTNAME)-$(PKG_VERSION) PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_DISTNAME)-$(PKG_VERSION) diff --git a/package/boot/uboot-envtools/files/apm821xx b/package/boot/uboot-envtools/files/apm821xx index 690fbba33..e73aaab7a 100644 --- a/package/boot/uboot-envtools/files/apm821xx +++ b/package/boot/uboot-envtools/files/apm821xx @@ -19,6 +19,10 @@ netgear,wndap620|\ netgear,wndap660) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000" "4" ;; +wd,mybooklive) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x1000" "1" + ubootenv_add_uci_config "/dev/mtd1" "0x1000" "0x1000" "0x1000" "1" + ;; esac config_load ubootenv diff --git a/package/boot/uboot-envtools/files/ath79 b/package/boot/uboot-envtools/files/ath79 index b2ef0d29e..cd94be66d 100644 --- a/package/boot/uboot-envtools/files/ath79 +++ b/package/boot/uboot-envtools/files/ath79 @@ -18,10 +18,16 @@ alfa-network,n2q|\ alfa-network,n5q|\ alfa-network,pi-wifi4|\ alfa-network,r36a|\ +alfa-network,tube-2hq|\ allnet,all-wap02860ac|\ +araknis,an-300-ap-i-n|\ +araknis,an-500-ap-i-ac|\ +araknis,an-700-ap-i-ac|\ arduino,yun|\ buffalo,bhr-4grv2|\ devolo,magic-2-wifi|\ +engenius,eap1200h|\ +engenius,eap1750h|\ engenius,eap300-v2|\ engenius,eap350-v1|\ engenius,eap600|\ @@ -38,6 +44,7 @@ glinet,gl-ar750s-nor-nand|\ librerouter,librerouter-v1|\ netgear,ex6400|\ netgear,ex7300|\ +netgear,ex7300-v2|\ netgear,wndr4300-v2|\ netgear,wndr4500-v3|\ netgear,wnr1000-v2|\ @@ -49,11 +56,33 @@ ocedo,koala|\ ocedo,raccoon|\ openmesh,a40|\ openmesh,a60|\ +openmesh,mr600-v1|\ +openmesh,mr600-v2|\ +openmesh,mr900-v1|\ +openmesh,mr900-v2|\ +openmesh,mr1750-v1|\ +openmesh,mr1750-v2|\ openmesh,om5p|\ +openmesh,om5p-an|\ +openmesh,om5p-ac-v1|\ openmesh,om5p-ac-v2|\ +samsung,wam250|\ +ubnt,airrouter|\ +ubnt,bullet-m-ar7240|\ +ubnt,bullet-m-ar7241|\ +ubnt,nanobridge-m|\ +ubnt,nanostation-loco-m|\ ubnt,nanostation-m|\ +ubnt,picostation-m|\ +ubnt,powerbridge-m|\ +ubnt,rocket-m|\ +watchguard,ap100|\ +watchguard,ap200|\ +watchguard,ap300|\ yuncore,a770|\ yuncore,a782|\ +yuncore,a930|\ +yuncore,xd3200|\ yuncore,xd4200|\ ziking,cpe46b|\ zyxel,nbg6616) @@ -63,15 +92,15 @@ buffalo,wzr-hp-ag300h) ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x10000" ;; buffalo,wzr-hp-g300nh-rb|\ -buffalo,wzr-hp-g300nh-s) +buffalo,wzr-hp-g300nh-s|\ +linksys,ea4500-v3) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; domywifi,dw33d) ubootenv_add_uci_config "/dev/mtd4" "0x0" "0x10000" "0x10000" ;; -glinet,gl-ar150) - ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x10000" - ;; +dongwon,dw02-412h-64m|\ +dongwon,dw02-412h-128m|\ glinet,gl-ar300m-lite|\ glinet,gl-ar300m-nand|\ glinet,gl-ar300m-nor|\ @@ -80,17 +109,22 @@ glinet,gl-ar300m16) [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" ;; +glinet,gl-ar150) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x8000" "0x10000" + ;; netgear,wndr3700|\ netgear,wndr3700-v2|\ netgear,wndrmac-v1) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x10000" ;; +netgear,pgzng1|\ netgear,wndr3700-v4|\ netgear,wndr4300|\ netgear,wndr4300tn|\ netgear,wndr4300sw) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x40000" "0x20000" ;; +openmesh,om2p-v1|\ openmesh,om2p-v2|\ openmesh,om2p-v4|\ openmesh,om2p-hs-v1|\ @@ -105,9 +139,28 @@ plasmacloud,pa300e) qihoo,c301) ubootenv_add_uci_config "/dev/mtd9" "0x0" "0x10000" "0x10000" ;; +ruckus,zf7025) + ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x40000" "0x40000" + ;; +ruckus,zf7321|\ +ruckus,zf7372) + ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x40000" "0x10000" + ;; +sophos,ap15|\ +sophos,ap55|\ +sophos,ap55c|\ +sophos,ap100|\ +sophos,ap100c) + ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x1000" "0x10000" + ;; wallys,dr531) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0xf800" "0x10000" ;; +zte,mf286|\ +zte,mf286a|\ +zte,mf286r) + ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x20000" "0x10000" + ;; esac config_load ubootenv diff --git a/package/boot/uboot-envtools/files/imx_cortexa7 b/package/boot/uboot-envtools/files/imx_cortexa7 new file mode 100644 index 000000000..df6a43626 --- /dev/null +++ b/package/boot/uboot-envtools/files/imx_cortexa7 @@ -0,0 +1,19 @@ +[ -e /etc/config/ubootenv ] && exit 0 + +touch /etc/config/ubootenv + +. /lib/uboot-envtools.sh +. /lib/functions.sh + +board=$(board_name) + +case "$board" in +technexion,imx7d-pico-pi) + ubootenv_add_uci_config "/dev/mmcblk2" "0xc0000" "0x2000" "0x2000" + ;; +esac + +config_load ubootenv +config_foreach ubootenv_add_app_config ubootenv + +exit 0 diff --git a/package/boot/uboot-envtools/files/ipq40xx b/package/boot/uboot-envtools/files/ipq40xx index 2e81ea1bd..8d993fae3 100644 --- a/package/boot/uboot-envtools/files/ipq40xx +++ b/package/boot/uboot-envtools/files/ipq40xx @@ -26,26 +26,49 @@ ubootenv_mtdinfo () { fi sectors=$(( $ubootenv_size / $mtd_erase )) + sectors=$(printf "0x%x" $sectors ) echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors } case "$board" in alfa-network,ap120c-ac|\ +devolo,magic-2-wifi-next|\ +edgecore,ecw5211|\ glinet,gl-a1300 |\ +glinet,gl-ap1300|\ glinet,gl-b1300|\ +glinet,gl-b2200|\ +luma,wrtq-329acn|\ +netgear,wac510|\ openmesh,a42|\ -openmesh,a62) +openmesh,a62|\ +pakedge,wr-1|\ +plasmacloud,pa1200|\ +plasmacloud,pa2200) ubootenv_add_uci_config "/dev/mtd5" "0x0" "0x10000" "0x10000" ;; +aruba,ap-303) + ubootenv_add_uci_config "/dev/mtd13" "0x0" "0x10000" "0x10000" + ;; +aruba,ap-365) + ubootenv_add_uci_config "/dev/mtd8" "0x0" "0x10000" "0x10000" + ;; buffalo,wtr-m2133hp) ubootenv_add_uci_config "/dev/mtd8" "0x0" "0x40000" "0x20000" ;; linksys,ea6350v3) ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x20000" "0x20000" ;; -linksys,ea8300) +linksys,ea8300|\ +linksys,mr8300) ubootenv_add_uci_config "/dev/mtd7" "0x0" "0x40000" "0x20000" ;; +linksys,whw01) + ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x40000" "0x10000" + ;; +linksys,whw03v2) + ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x80000" "0x20000" + ;; zyxel,nbg6617) ubootenv_add_uci_config "/dev/mtd6" "0x0" "0x10000" "0x10000" ;; diff --git a/package/boot/uboot-envtools/files/ipq806x b/package/boot/uboot-envtools/files/ipq806x index 804a16a13..928a666e1 100644 --- a/package/boot/uboot-envtools/files/ipq806x +++ b/package/boot/uboot-envtools/files/ipq806x @@ -26,6 +26,7 @@ ubootenv_mtdinfo () { fi sectors=$(( $ubootenv_size / $mtd_erase )) + sectors=$(printf "0x%x" $sectors ) echo /dev/$mtd_dev 0x0 $ubootenv_size $mtd_erase $sectors } diff --git a/package/boot/uboot-envtools/files/ipq807x b/package/boot/uboot-envtools/files/ipq807x index 9bd6b2b96..6e4fadbdf 100644 --- a/package/boot/uboot-envtools/files/ipq807x +++ b/package/boot/uboot-envtools/files/ipq807x @@ -8,12 +8,31 @@ touch /etc/config/ubootenv board=$(board_name) case "$board" in +dynalink,dl-wrx36) + idx="$(find_mtd_index 0:appsblenv)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x40000" "0x20000" "2" + ;; +edgecore,eap102|\ +zyxel,nbg7815) + idx="$(find_mtd_index 0:appsblenv)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1" + ;; +edimax,cax1800) + idx="$(find_mtd_index 0:appsblenv)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000" + ;; redmi,ax6|\ xiaomi,ax3600|\ xiaomi,ax9000) idx="$(find_mtd_index 0:appsblenv)" [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x20000" + idx2="$(find_mtd_index bdata)" + [ -n "$idx2" ] && \ + ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x10000" "0x20000" ;; qnap,301w) idx="$(find_mtd_index 0:appsblenv)" @@ -23,6 +42,6 @@ qnap,301w) esac config_load ubootenv -config_foreach ubootenv_add_app_config ubootenv +config_foreach ubootenv_add_app_config exit 0 diff --git a/package/boot/uboot-envtools/files/kirkwood b/package/boot/uboot-envtools/files/kirkwood index 6a3dfcaba..240371f48 100644 --- a/package/boot/uboot-envtools/files/kirkwood +++ b/package/boot/uboot-envtools/files/kirkwood @@ -19,6 +19,7 @@ globalscale,sheevaplug|\ iom,ix2-200|\ linksys,e4200-v2|\ linksys,ea4500|\ +netgear,readynas-duo-v2|\ raidsonic,ib-nas62x0|\ seagate,dockstar|\ zyxel,nsa310b|\ diff --git a/package/boot/uboot-envtools/files/mediatek_mt7622 b/package/boot/uboot-envtools/files/mediatek_mt7622 index 879b7e27c..9ad4c7c1a 100644 --- a/package/boot/uboot-envtools/files/mediatek_mt7622 +++ b/package/boot/uboot-envtools/files/mediatek_mt7622 @@ -32,8 +32,11 @@ bananapi,bpi-r64) buffalo,wsr-2533dhp2) ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x1000" "0x20000" ;; +ruijie,rg-ew3200gx-pro) + ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x20000" "0x20000" + ;; ubnt,unifi-6-lr-ubootmod) - ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x4000" "0x10000" + ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x4000" "0x1000" ;; xiaomi,redmi-router-ax6s) ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" "0x40000" diff --git a/package/boot/uboot-envtools/files/mediatek_mt7623 b/package/boot/uboot-envtools/files/mediatek_mt7623 index 863c8bc21..fd2a01006 100644 --- a/package/boot/uboot-envtools/files/mediatek_mt7623 +++ b/package/boot/uboot-envtools/files/mediatek_mt7623 @@ -17,6 +17,10 @@ bananapi,bpi-r2) export_bootdevice export_partdevice ubootpart 1 ubootenv_add_uci_config "/dev/$ubootpart" "0xb0000" "0x10000" "0x10000" "1" + ;; +unielec,u7623-02) + ubootenv_add_uci_config "/dev/mmcblk0p1" "0xc0000" "0x10000" "0x10000" "1" + ;; esac config_load ubootenv diff --git a/package/boot/uboot-envtools/files/mpc85xx b/package/boot/uboot-envtools/files/mpc85xx index 004ec2413..36d9f753a 100644 --- a/package/boot/uboot-envtools/files/mpc85xx +++ b/package/boot/uboot-envtools/files/mpc85xx @@ -8,10 +8,17 @@ touch /etc/config/ubootenv board=$(board_name) case "$board" in +extreme-networks,ws-ap3825i) + ubootenv_add_uci_config "$(find_mtd_part 'cfg1')" "0x0" "0x10000" "0x20000" + ubootenv_add_uci_config "$(find_mtd_part 'cfg2')" "0x0" "0x10000" "0x20000" + ;; ocedo,panda) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000" ;; +aerohive,hiveap-330) + ubootenv_add_uci_config "$(find_mtd_part 'u-boot-env')" "0x0" "0x20000" "0x10000" + ;; esac config_load ubootenv diff --git a/package/boot/uboot-envtools/files/mvebu b/package/boot/uboot-envtools/files/mvebu index 25f29599a..cc1c648f2 100644 --- a/package/boot/uboot-envtools/files/mvebu +++ b/package/boot/uboot-envtools/files/mvebu @@ -17,7 +17,10 @@ buffalo,ls421de) ubootenv_add_uci_config "/dev/mtd3" "0x0" "0x10000" ;; cznic,turris-omnia) - if grep -q 'U-Boot 2015.10-rc2' /dev/mtd0; then + idx="$(find_mtd_index u-boot-env)" + if [ -n "$idx" ]; then + ubootenv_add_uci_config "/dev/mtd${idx}" "0x0" "0x10000" "0x10000" + elif grep -q 'U-Boot 2015.10-rc2' /dev/mtd0; then ubootenv_add_uci_config "/dev/mtd0" "0xc0000" "0x10000" "0x40000" else ubootenv_add_uci_config "/dev/mtd0" "0xf0000" "0x10000" "0x10000" @@ -30,7 +33,8 @@ globalscale,espressobin|\ globalscale,espressobin-emmc|\ globalscale,espressobin-ultra|\ globalscale,espressobin-v7|\ -globalscale,espressobin-v7-emmc) +globalscale,espressobin-v7-emmc|\ +globalscale,mochabin) idx="$(find_mtd_index u-boot-env)" if [ -n "$idx" ]; then ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1" @@ -54,8 +58,14 @@ linksys,wrt3200acm|\ linksys,wrt32x) ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ;; -methode,udpu) +methode,udpu|\ +methode,edpu) + idx="$(find_mtd_index u-boot-env)" + if [ -n "$idx" ]; then + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" "1" + else ubootenv_add_uci_config "/dev/mtd0" "0x180000" "0x10000" "0x10000" + fi ;; esac diff --git a/package/boot/uboot-envtools/files/oxnas b/package/boot/uboot-envtools/files/oxnas index bf872b697..bd407c67d 100644 --- a/package/boot/uboot-envtools/files/oxnas +++ b/package/boot/uboot-envtools/files/oxnas @@ -14,7 +14,7 @@ board=$(board_name) case "$board" in "cloudengines,pogoplug"*|\ "shuttle,kd20") - ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x2000" "0x2000" "1" + ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x2000" "0x20000" "1" ;; "mitrastar,stg-212") ubootenv_add_uci_config "/dev/mtd2" "0x0" "0x20000" "0x20000" "1" diff --git a/package/boot/uboot-envtools/files/realtek b/package/boot/uboot-envtools/files/realtek index 75a399208..f19150387 100644 --- a/package/boot/uboot-envtools/files/realtek +++ b/package/boot/uboot-envtools/files/realtek @@ -8,13 +8,20 @@ touch /etc/config/ubootenv board=$(board_name) case "$board" in -d-link,dgs-1210-16|\ -d-link,dgs-1210-28|\ +d-link,dgs-1210-10mp|\ d-link,dgs-1210-10p|\ +d-link,dgs-1210-16|\ +d-link,dgs-1210-20|\ +d-link,dgs-1210-28|\ zyxel,gs1900-8|\ zyxel,gs1900-8hp-v1|\ zyxel,gs1900-8hp-v2|\ -zyxel,gs1900-10hp) +zyxel,gs1900-10hp|\ +zyxel,gs1900-16|\ +zyxel,gs1900-24-v1|\ +zyxel,gs1900-24e|\ +zyxel,gs1900-24hp-v1|\ +zyxel,gs1900-24hp-v2) idx="$(find_mtd_index u-boot-env)" [ -n "$idx" ] && \ ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x400" "0x10000" @@ -22,6 +29,21 @@ zyxel,gs1900-10hp) [ -n "$idx2" ] && \ ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x1000" "0x10000" ;; +tplink,sg2008p-v1|\ +tplink,sg2210p-v3|\ +tplink,sg2452p-v4) + idx="$(find_mtd_index u-boot-env)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x20000" "0x10000" + ;; +iodata,bsh-g24mb) + idx="$(find_mtd_index u-boot-env)" + [ -n "$idx" ] && \ + ubootenv_add_uci_config "/dev/mtd$idx" "0x0" "0x10000" "0x10000" + idx2="$(find_mtd_index u-boot-env2)" + [ -n "$idx2" ] && \ + ubootenv_add_uci_sys_config "/dev/mtd$idx2" "0x0" "0x3800" "0x10000" + ;; *) idx="$(find_mtd_index u-boot-env)" [ -n "$idx" ] && \ diff --git a/package/boot/uboot-mediatek/Makefile b/package/boot/uboot-mediatek/Makefile index c7df2d566..7fbca24d0 100644 --- a/package/boot/uboot-mediatek/Makefile +++ b/package/boot/uboot-mediatek/Makefile @@ -3,7 +3,7 @@ include $(INCLUDE_DIR)/kernel.mk PKG_VERSION:=2023.01 PKG_HASH:=69423bad380f89a0916636e89e6dcbd2e4512d584308d922d1039d1e4331950f -PKG_BUILD_DEPENDS:=!TARGET_mediatek_mt7623:arm-trusted-firmware-tools/host +PKG_BUILD_DEPENDS:=!(TARGET_ramips||TARGET_mediatek_mt7623):arm-trusted-firmware-tools/host include $(INCLUDE_DIR)/u-boot.mk include $(INCLUDE_DIR)/package.mk @@ -236,6 +236,18 @@ define U-Boot/mt7986_bananapi_bpi-r3-nor FIP_COMPRESS:=1 endef +define U-Boot/mt7986_xiaomi_redmi-router-ax6000 + NAME:=Xiaomi Redmi AX6000 + BUILD_SUBTARGET:=filogic + BUILD_DEVICES:=xiaomi_redmi-router-ax6000-ubootmod + UBOOT_CONFIG:=mt7986_xiaomi_redmi-ax6000 + UBOOT_IMAGE:=u-boot.fip + BL2_BOOTDEV:=spim-nand + BL2_SOC:=mt7986 + BL2_DDRTYPE:=ddr4 + DEPENDS:=+trusted-firmware-a-mt7986-spim-nand-ddr4 +endef + UBOOT_TARGETS := \ mt7620_mt7530_rfb \ mt7620_rfb \ @@ -256,6 +268,7 @@ UBOOT_TARGETS := \ mt7986_bananapi_bpi-r3-sdmmc \ mt7986_bananapi_bpi-r3-snand \ mt7986_bananapi_bpi-r3-nor \ + mt7986_xiaomi_redmi-router-ax6000 \ mt7986_rfb ifdef CONFIG_TARGET_mediatek @@ -291,7 +304,7 @@ endef define Build/Compile $(call Build/Compile/U-Boot) -ifeq ($(UBOOT_IMAGE),u-boot.fip)) +ifeq ($(UBOOT_IMAGE),u-boot.fip) $(call Build/fip-image) endif endef diff --git a/package/boot/uboot-mediatek/patches/420-add-support-for-RAVPower-RP-WD009.patch b/package/boot/uboot-mediatek/patches/420-add-support-for-RAVPower-RP-WD009.patch index 80af85a95..a89b6c68b 100644 --- a/package/boot/uboot-mediatek/patches/420-add-support-for-RAVPower-RP-WD009.patch +++ b/package/boot/uboot-mediatek/patches/420-add-support-for-RAVPower-RP-WD009.patch @@ -125,7 +125,7 @@ Subject: [PATCH] add support for RAVPower RP-WD009 +} --- /dev/null +++ b/configs/ravpower-rp-wd009-ram_defconfig -@@ -0,0 +1,61 @@ +@@ -0,0 +1,64 @@ +CONFIG_MIPS=y +CONFIG_SYS_LOAD_ADDR=0x80010000 +CONFIG_NR_DRAM_BANKS=1 @@ -140,6 +140,7 @@ Subject: [PATCH] add support for RAVPower RP-WD009 +CONFIG_SYS_CONSOLE_INFO_QUIET=y +CONFIG_VERSION_VARIABLE=y +CONFIG_BOARD_RAVPOWER_RP_WD009=y ++CONFIG_SYS_MIPS_TIMER_FREQ=290000000 +CONFIG_HUSH_PARSER=y +CONFIG_CMD_LICENSE=y +# CONFIG_CMD_ELF is not set @@ -187,9 +188,11 @@ Subject: [PATCH] add support for RAVPower RP-WD009 +CONFIG_WDT_MT7621=y +CONFIG_LZMA=y +CONFIG_BAUDRATE=57600 ++CONFIG_SYS_MAXARGS=64 ++CONFIG_SYS_CBSIZE=512 --- /dev/null +++ b/include/configs/ravpower-rp-wd009.h -@@ -0,0 +1,42 @@ +@@ -0,0 +1,40 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright (C) 2018 Stefan Roese @@ -219,9 +222,7 @@ Subject: [PATCH] add support for RAVPower RP-WD009 +#define CONFIG_SYS_MEMTEST_END 0x80400000 + +/* Memory usage */ -+#define CONFIG_SYS_MAXARGS 64 +#define CONFIG_SYS_BOOTPARAMS_LEN (128 * 1024) -+#define CONFIG_SYS_CBSIZE 512 + +/* Environment settings */ + diff --git a/package/boot/uboot-mediatek/patches/431-add-xiaomi_redmi-ax6000.patch b/package/boot/uboot-mediatek/patches/431-add-xiaomi_redmi-ax6000.patch new file mode 100644 index 000000000..26c4e1466 --- /dev/null +++ b/package/boot/uboot-mediatek/patches/431-add-xiaomi_redmi-ax6000.patch @@ -0,0 +1,392 @@ +--- /dev/null ++++ b/configs/mt7986_xiaomi_redmi-ax6000_defconfig +@@ -0,0 +1,176 @@ ++CONFIG_ARM=y ++CONFIG_POSITION_INDEPENDENT=y ++CONFIG_ARCH_MEDIATEK=y ++CONFIG_TARGET_MT7986=y ++CONFIG_SYS_TEXT_BASE=0x41e00000 ++CONFIG_SYS_MALLOC_F_LEN=0x4000 ++CONFIG_SYS_HAS_NONCACHED_MEMORY=y ++CONFIG_NR_DRAM_BANKS=1 ++CONFIG_DEFAULT_DEVICE_TREE="mt7986a-xiaomi_redmi-ax6000" ++CONFIG_DEFAULT_ENV_FILE="xiaomi_redmi-ax6000_env" ++CONFIG_DEFAULT_FDT_FILE="mediatek/mt7986a-xiaomi_redmi-ax6000.dtb" ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_DEBUG_UART_BASE=0x11002000 ++CONFIG_DEBUG_UART_CLOCK=40000000 ++CONFIG_DEBUG_UART=y ++CONFIG_SYS_LOAD_ADDR=0x46000000 ++CONFIG_SMBIOS_PRODUCT_NAME="" ++CONFIG_AUTOBOOT_KEYED=y ++CONFIG_BOOTDELAY=30 ++CONFIG_AUTOBOOT_MENU_SHOW=y ++CONFIG_CFB_CONSOLE_ANSI=y ++CONFIG_BOARD_LATE_INIT=y ++CONFIG_BUTTON=y ++CONFIG_BUTTON_GPIO=y ++CONFIG_GPIO_HOG=y ++CONFIG_CMD_ENV_FLAGS=y ++CONFIG_FIT=y ++CONFIG_FIT_ENABLE_SHA256_SUPPORT=y ++# CONFIG_LED is not set ++# CONFIG_LED_BLINK is not set ++# CONFIG_LED_GPIO is not set ++CONFIG_LOGLEVEL=7 ++CONFIG_LOG=y ++CONFIG_SYS_PROMPT="MT7986> " ++CONFIG_CMD_BOOTMENU=y ++CONFIG_CMD_BOOTP=y ++CONFIG_CMD_BUTTON=y ++CONFIG_CMD_CACHE=y ++CONFIG_CMD_CDP=y ++CONFIG_CMD_CPU=y ++CONFIG_CMD_DHCP=y ++CONFIG_CMD_DM=y ++CONFIG_CMD_DNS=y ++CONFIG_CMD_ECHO=y ++CONFIG_CMD_ENV_READMEM=y ++CONFIG_CMD_ERASEENV=y ++# CONFIG_CMD_EXT4 is not set ++# CONFIG_CMD_FAT is not set ++CONFIG_CMD_FDT=y ++# CONFIG_CMD_FS_GENERIC is not set ++# CONFIG_CMD_FS_UUID is not set ++CONFIG_CMD_GPIO=y ++# CONFIG_CMD_GPT is not set ++CONFIG_CMD_HASH=y ++CONFIG_CMD_ITEST=y ++# CONFIG_CMD_LED is not set ++CONFIG_CMD_LICENSE=y ++CONFIG_CMD_LINK_LOCAL=y ++# CONFIG_CMD_MBR is not set ++CONFIG_CMD_MTD=y ++# CONFIG_CMD_PCI is not set ++CONFIG_CMD_PSTORE=y ++CONFIG_CMD_PSTORE_MEM_ADDR=0x42ff0000 ++CONFIG_CMD_SF_TEST=y ++CONFIG_CMD_PING=y ++CONFIG_CMD_PXE=y ++# CONFIG_CMD_PWM is not set ++CONFIG_CMD_SMC=y ++CONFIG_CMD_TFTPBOOT=y ++CONFIG_CMD_TFTPSRV=y ++CONFIG_CMD_UBI=y ++CONFIG_CMD_UBI_RENAME=y ++CONFIG_CMD_UBIFS=y ++CONFIG_CMD_ASKENV=y ++CONFIG_CMD_PART=y ++CONFIG_CMD_RARP=y ++CONFIG_CMD_SETEXPR=y ++CONFIG_CMD_SLEEP=y ++CONFIG_CMD_SNTP=y ++CONFIG_CMD_SOURCE=y ++CONFIG_CMD_STRINGS=y ++# CONFIG_CMD_USB is not set ++# CONFIG_CMD_FLASH is not set ++CONFIG_CMD_UUID=y ++CONFIG_DISPLAY_CPUINFO=y ++CONFIG_DM_MTD=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_REGULATOR_GPIO=y ++# CONFIG_DM_USB is not set ++# CONFIG_DM_PWM is not set ++# CONFIG_PWM_MTK is not set ++CONFIG_HUSH_PARSER=y ++CONFIG_SYS_REDUNDAND_ENVIRONMENT=y ++CONFIG_SYS_RELOC_GD_ENV_ADDR=y ++CONFIG_VERSION_VARIABLE=y ++CONFIG_PARTITION_UUIDS=y ++CONFIG_NETCONSOLE=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_DM_GPIO=y ++# CONFIG_DM_SCSI is not set ++# CONFIG_AHCI is not set ++CONFIG_PHY=y ++# CONFIG_PHY_MTK_TPHY is not set ++CONFIG_PHY_FIXED=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++# CONFIG_PCI is not set ++# CONFIG_MMC is not set ++# CONFIG_DM_MMC is not set ++CONFIG_MTD=y ++CONFIG_MTD_UBI_FASTMAP=y ++# CONFIG_DM_PCI is not set ++# CONFIG_PCIE_MEDIATEK is not set ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++# CONFIG_PINCTRL_MT7622 is not set ++CONFIG_POWER_DOMAIN=y ++CONFIG_PRE_CONSOLE_BUFFER=y ++CONFIG_PRE_CON_BUF_ADDR=0x4007EF00 ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_RAM=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_SPI=y ++# CONFIG_I2C is not set ++CONFIG_DM_SPI=y ++CONFIG_MTK_SPI_NAND=y ++CONFIG_MTK_SPI_NAND_MTD=y ++CONFIG_SYSRESET_WATCHDOG=y ++CONFIG_WDT_MTK=y ++CONFIG_LZO=y ++CONFIG_ZSTD=y ++CONFIG_HEXDUMP=y ++CONFIG_RANDOM_UUID=y ++CONFIG_REGEX=y ++# CONFIG_USB is not set ++# CONFIG_USB_HOST is not set ++# CONFIG_USB_XHCI_HCD is not set ++# CONFIG_USB_XHCI_MTK is not set ++# CONFIG_USB_STORAGE is not set ++CONFIG_OF_EMBED=y ++CONFIG_ENV_OVERWRITE=y ++CONFIG_ENV_IS_IN_UBI=y ++CONFIG_ENV_UBI_PART="ubi" ++CONFIG_ENV_SIZE=0x1f000 ++CONFIG_ENV_SIZE_REDUND=0x1f000 ++CONFIG_ENV_UBI_VOLUME="ubootenv" ++CONFIG_ENV_UBI_VOLUME_REDUND="ubootenv2" ++CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG=y ++CONFIG_NET_RANDOM_ETHADDR=y ++CONFIG_REGMAP=y ++CONFIG_SYSCON=y ++CONFIG_CLK=y ++CONFIG_PHY_FIXED=y ++CONFIG_DM_ETH=y ++CONFIG_MEDIATEK_ETH=y ++CONFIG_PINCTRL=y ++CONFIG_PINCONF=y ++CONFIG_PINCTRL_MT7986=y ++CONFIG_POWER_DOMAIN=y ++CONFIG_MTK_POWER_DOMAIN=y ++CONFIG_DM_REGULATOR=y ++CONFIG_DM_REGULATOR_FIXED=y ++CONFIG_DM_SERIAL=y ++CONFIG_MTK_SERIAL=y ++CONFIG_HEXDUMP=y ++CONFIG_USE_DEFAULT_ENV_FILE=y ++CONFIG_MTD_SPI_NAND=y ++CONFIG_MTK_SPIM=y ++CONFIG_CMD_MTD=y ++CONFIG_CMD_NAND=y ++CONFIG_CMD_NAND_TRIMFFS=y ++CONFIG_LMB_MAX_REGIONS=64 +--- /dev/null ++++ b/arch/arm/dts/mt7986a-xiaomi_redmi-ax6000.dts +@@ -0,0 +1,152 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/* ++ * Copyright (c) 2021 MediaTek Inc. ++ * Author: Sam Shih ++ */ ++ ++/dts-v1/; ++#include "mt7986.dtsi" ++#include ++ ++/ { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ model = "Xiaomi Redmi AX6000"; ++ compatible = "mediatek,mt7986", "mediatek,mt7986-sd-rfb"; ++ ++ chosen { ++ stdout-path = &uart0; ++ tick-timer = &timer0; ++ }; ++ ++ keys { ++ compatible = "gpio-keys"; ++ factory { ++ label = "reset"; ++ gpios = <&gpio 9 GPIO_ACTIVE_LOW>; ++ }; ++ mesh { ++ label = "mesh"; ++ gpios = <&gpio 10 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++}; ++ ++&uart0 { ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "disabled"; ++}; ++ ++ð { ++ status = "okay"; ++ mediatek,gmac-id = <0>; ++ phy-mode = "sgmii"; ++ mediatek,switch = "mt7531"; ++ reset-gpios = <&gpio 5 GPIO_ACTIVE_HIGH>; ++ ++ fixed-link { ++ speed = <1000>; ++ full-duplex; ++ }; ++}; ++ ++&pinctrl { ++ spic_pins: spi1-pins-func-1 { ++ mux { ++ function = "spi"; ++ groups = "spi1_2"; ++ }; ++ }; ++ ++ uart1_pins: spi1-pins-func-3 { ++ mux { ++ function = "uart"; ++ groups = "uart1_2"; ++ }; ++ }; ++ ++ spi_flash_pins: spi0-pins-func-1 { ++ mux { ++ function = "flash"; ++ groups = "spi0", "spi0_wp_hold"; ++ }; ++ ++ conf-pu { ++ pins = "SPI2_CS", "SPI2_HOLD", "SPI2_WP"; ++ drive-strength = ; ++ bias-pull-up = ; ++ }; ++ ++ conf-pd { ++ pins = "SPI2_CLK", "SPI2_MOSI", "SPI2_MISO"; ++ drive-strength = ; ++ bias-pull-down = ; ++ }; ++ }; ++}; ++ ++&spi0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi_flash_pins>; ++ status = "okay"; ++ must_tx; ++ enhance_timing; ++ dma_ext; ++ ipm_design; ++ support_quad; ++ tick_dly = <1>; ++ sample_sel = <0>; ++ ++ spi_nand@0 { ++ compatible = "spi-nand"; ++ reg = <0>; ++ spi-max-frequency = <52000000>; ++ ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ ++ partition@0 { ++ label = "bl2"; ++ reg = <0x0 0x80000>; ++ }; ++ ++ partition@100000 { ++ label = "nvram"; ++ reg = <0x100000 0x40000>; ++ }; ++ ++ partition@140000 { ++ label = "bdata"; ++ reg = <0x140000 0x40000>; ++ }; ++ ++ partition@180000 { ++ label = "factory"; ++ reg = <0x180000 0x200000>; ++ }; ++ ++ partition@380000 { ++ label = "fip"; ++ reg = <0x380000 0x200000>; ++ }; ++ ++ partition@600000 { ++ label = "ubi"; ++ reg = <0x580000 0x7a80000>; ++ }; ++ }; ++ }; ++}; ++ ++&watchdog { ++ status = "disabled"; ++}; +--- /dev/null ++++ b/xiaomi_redmi-ax6000_env +@@ -0,0 +1,55 @@ ++ethaddr_factory=mtd read factory 0x40080000 0x0 0x20000 && env readmem -b ethaddr 0x40080004 0x6 ; setenv ethaddr_factory ++ipaddr=192.168.1.1 ++serverip=192.168.1.254 ++loadaddr=0x46000000 ++console=earlycon=uart8250,mmio32,0x11002000 console=ttyS0 ++bootargs=console=ttyS0,115200n8 console_msg_format=syslog ++bootcmd=if pstore check ; then run boot_recovery ; else run boot_ubi ; fi ++bootconf=config-1 ++bootdelay=0 ++bootfile=openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-ubootmod-initramfs-recovery.itb ++bootfile_bl2=openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-ubootmod-preloader.bin ++bootfile_fip=openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-ubootmod-bl31-uboot.fip ++bootfile_upg=openwrt-mediatek-filogic-xiaomi_redmi-router-ax6000-ubootmod-squashfs-sysupgrade.itb ++bootmenu_confirm_return=askenv - Press ENTER to return to menu ; bootmenu 60 ++bootmenu_default=0 ++bootmenu_delay=0 ++bootmenu_title= ( ( ( OpenWrt ) ) ) ++bootmenu_0=Initialize environment.=run _firstboot ++bootmenu_0d=Run default boot command.=run boot_default ++bootmenu_1=Boot system via TFTP.=run boot_tftp ; run bootmenu_confirm_return ++bootmenu_2=Boot production system from NAND.=run boot_production ; run bootmenu_confirm_return ++bootmenu_3=Boot recovery system from NAND.=run boot_recovery ; run bootmenu_confirm_return ++bootmenu_4=Load production system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_production ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_5=Load recovery system via TFTP then write to NAND.=setenv noboot 1 ; setenv replacevol 1 ; run boot_tftp_recovery ; setenv noboot ; setenv replacevol ; run bootmenu_confirm_return ++bootmenu_6=Load BL31+U-Boot FIP via TFTP then write to NAND.=run boot_tftp_write_fip ; run bootmenu_confirm_return ++bootmenu_7=Load BL2 preloader via TFTP then write to NAND.=run boot_tftp_write_bl2 ; run bootmenu_confirm_return ++bootmenu_8=Reboot.=reset ++bootmenu_9=Reset all settings to factory defaults.=run reset_factory ; reset ++boot_first=if button reset ; then run boot_tftp_recovery ; setenv flag_recover 1 ; run boot_default ; fi ; bootmenu ++boot_default=if env exists flag_recover ; then else run bootcmd ; fi ; run boot_recovery ; setenv replacevol 1 ; run boot_tftp_forever ++boot_production=run ubi_read_production && bootm $loadaddr#$bootconf ++boot_recovery=run ubi_read_recovery && bootm $loadaddr#$bootconf ++boot_ubi=run boot_production ; run boot_recovery ; run boot_tftp_forever ++boot_tftp_forever=while true ; do run boot_tftp_recovery ; sleep 1 ; done ++boot_tftp_recovery=tftpboot $loadaddr $bootfile && env exists replacevol && iminfo $loadaddr && run ubi_write_recovery ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp_production=tftpboot $loadaddr $bootfile_upg && env exists replacevol && iminfo $loadaddr && run ubi_write_production ; if env exists noboot ; then else bootm $loadaddr#$bootconf ; fi ++boot_tftp=tftpboot $loadaddr $bootfile && bootm $loadaddr#$bootconf ++boot_tftp_write_fip=tftpboot $loadaddr $bootfile_fip && run mtd_write_fip && run reset_factory ++boot_tftp_write_bl2=tftpboot $loadaddr $bootfile_bl2 && run mtd_write_bl2 ++part_fit=fit ++reset_factory=ubi part ubi ; mw $loadaddr 0x0 0x800 ; ubi write $loadaddr ubootenv 0x800 ; ubi write $loadaddr ubootenv2 0x800 ++mtd_write_fip=mtd erase fip && mtd write fip $loadaddr ++mtd_write_bl2=mtd erase bl2 && mtd write bl2 $loadaddr ++ubi_create_env=ubi check ubootenv || ubi create ubootenv 0x100000 dynamic 0 ; ubi check ubootenv2 || ubi create ubootenv2 0x100000 dynamic 1 ++ubi_format=ubi detach ; mtd erase ubi && ubi part ubi ; reset ++ubi_prepare_rootfs=if ubi check rootfs_data ; then else if env exists rootfs_data_max ; then ubi create rootfs_data $rootfs_data_max dynamic || ubi create rootfs_data - dynamic ; else ubi create rootfs_data - dynamic ; fi ; fi ++ubi_read_production=ubi read $loadaddr $part_fit && iminfo $loadaddr && run ubi_prepare_rootfs ++ubi_read_recovery=ubi check recovery && ubi read $loadaddr recovery ++ubi_remove_rootfs=ubi check rootfs_data && ubi remove rootfs_data ++ubi_write_production=ubi check fit && ubi remove fit ; run ubi_remove_rootfs ; ubi create fit $filesize dynamic && ubi write $loadaddr fit $filesize ++ubi_write_recovery=ubi check recovery && ubi remove recovery ; run ubi_remove_rootfs ; ubi create recovery $filesize dynamic && ubi write $loadaddr recovery $filesize ++_init_env=setenv _init_env ; run ubi_create_env ; saveenv ; saveenv ++_firstboot=setenv _firstboot ; run ethaddr_factory ; run _switch_to_menu ; run _init_env ; run boot_first ++_switch_to_menu=setenv _switch_to_menu ; setenv bootdelay 3 ; setenv bootmenu_delay 3 ; setenv bootmenu_0 $bootmenu_0d ; setenv bootmenu_0d ; run _bootmenu_update_title ++_bootmenu_update_title=setenv _bootmenu_update_title ; setenv bootmenu_title "$bootmenu_title $ver" diff --git a/package/devel/trace-cmd/Makefile b/package/devel/trace-cmd/Makefile index 47929491e..eac281820 100644 --- a/package/devel/trace-cmd/Makefile +++ b/package/devel/trace-cmd/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=trace-cmd -PKG_VERSION:=v3.1.5 +PKG_VERSION:=v3.1.6 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/snapshot/ -PKG_HASH:=9af1ea00e312d03639470e126fa9c786789f03c16df93a57c0bc90eeffbc7d50 +PKG_HASH:=f9198ea306deee9cda3b262342b03b6029e82c1b9c671ba521739a9703e115b9 PKG_LICENSE:=GPL-2.0-only PKG_LICENSE_FILES:=COPYING diff --git a/package/kernel/linux/Makefile b/package/kernel/linux/Makefile index 9fa68d78f..ff9176027 100644 --- a/package/kernel/linux/Makefile +++ b/package/kernel/linux/Makefile @@ -12,7 +12,9 @@ PKG_NAME:=kernel PKG_FLAGS:=hold PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/packages -SCAN_DEPS=modules/*.mk $(TOPDIR)/target/linux/*/modules.mk $(TOPDIR)/include/netfilter.mk +SUBTARGETS = $(sort $(filter-out feeds,$(notdir $(wildcard $(TOPDIR)/target/linux/* $(TOPDIR)/target/linux/feeds/*)))) +SUBTARGET_MODULES = $(foreach t,$(SUBTARGETS),$(firstword $(wildcard $(TOPDIR)/target/linux/feeds/$(t)/modules.mk $(TOPDIR)/target/linux/$(t)/modules.mk))) +SCAN_DEPS=modules/*.mk $(SUBTARGET_MODULES) $(TOPDIR)/include/netfilter.mk PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:= @@ -63,4 +65,4 @@ endef $(eval $(if $(DUMP),,$(call BuildPackage,kernel))) include $(sort $(wildcard ./modules/*.mk)) --include $(TOPDIR)/target/linux/*/modules.mk +-include $(SUBTARGET_MODULES) diff --git a/package/kernel/rtl8812au-ct/Makefile b/package/kernel/rtl8812au-ct/Makefile index e987aceb8..be1acabf2 100644 --- a/package/kernel/rtl8812au-ct/Makefile +++ b/package/kernel/rtl8812au-ct/Makefile @@ -24,7 +24,7 @@ include $(INCLUDE_DIR)/package.mk define KernelPackage/rtl8812au-ct SUBMENU:=Wireless Drivers TITLE:=Driver for Realtek 8812 AU devices comfast 912-ac, etc - DEPENDS:=+kmod-cfg80211 +kmod-usb-core +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT + DEPENDS:=+kmod-cfg80211 +kmod-usb-core +@DRIVER_11AC_SUPPORT FILES:=\ $(PKG_BUILD_DIR)/rtl8812au.ko AUTOLOAD:=$(call AutoProbe,rtl8812au) @@ -39,7 +39,9 @@ NOSTDINC_FLAGS := \ -I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \ -I$(STAGING_DIR)/usr/include/mac80211 \ -I$(STAGING_DIR)/usr/include/mac80211/uapi \ - -include backport/backport.h + -include backport/backport.h \ + -Wno-error=address \ + -Wno-error=stringop-overread NOSTDINC_FLAGS+=-DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT -DBUILD_OPENWRT diff --git a/package/kernel/rtl8812au-ct/patches/100-api_update.patch b/package/kernel/rtl8812au-ct/patches/100-api_update.patch new file mode 100644 index 000000000..2c081256e --- /dev/null +++ b/package/kernel/rtl8812au-ct/patches/100-api_update.patch @@ -0,0 +1,56 @@ +--- a/os_dep/linux/ioctl_cfg80211.c ++++ b/os_dep/linux/ioctl_cfg80211.c +@@ -798,8 +798,8 @@ check_bss: + + DBG_871X(FUNC_ADPT_FMT" call cfg80211_roamed\n", FUNC_ADPT_ARG(padapter)); + #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0) +- roam_info.channel = notify_channel; +- roam_info.bssid = cur_network->network.MacAddress; ++ roam_info.links[0].channel = notify_channel; ++ roam_info.links[0].bssid = cur_network->network.MacAddress; + roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2; + roam_info.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2; + roam_info.resp_ie = pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6; +@@ -1389,6 +1389,7 @@ exit: + + static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev, + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++ int link_id, + u8 key_index, bool pairwise, const u8 *mac_addr, + #else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr, +@@ -1529,6 +1530,7 @@ addkey_end: + + static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev, + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++ int link_id, + u8 key_index, bool pairwise, const u8 *mac_addr, + #else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr, +@@ -1562,6 +1564,7 @@ static int cfg80211_rtw_get_key(struct w + + static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev, + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) || defined(COMPAT_KERNEL_RELEASE) ++ int link_id, + u8 key_index, bool pairwise, const u8 *mac_addr) + #else // (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) + u8 key_index, const u8 *mac_addr) +@@ -1581,7 +1584,7 @@ static int cfg80211_rtw_del_key(struct w + } + + static int cfg80211_rtw_set_default_key(struct wiphy *wiphy, +- struct net_device *ndev, u8 key_index ++ struct net_device *ndev, int link_id, u8 key_index + #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)) || defined(COMPAT_KERNEL_RELEASE) + , bool unicast, bool multicast + #endif +@@ -4019,7 +4022,8 @@ static int cfg80211_rtw_change_beacon(st + return ret; + } + +-static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev) ++static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, ++ unsigned int link_id) + { + DBG_871X(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); + return 0; diff --git a/package/libs/elfutils/Makefile b/package/libs/elfutils/Makefile index d4e5d994e..1e41e296b 100644 --- a/package/libs/elfutils/Makefile +++ b/package/libs/elfutils/Makefile @@ -81,7 +81,7 @@ HOST_CONFIGURE_VARS += \ CONFIGURE_VARS += \ ac_cv_search__obstack_free=yes -TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral +TARGET_CFLAGS += -D_GNU_SOURCE -Wno-unused-result -Wno-format-nonliteral -Wno-error=use-after-free define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include diff --git a/package/libs/libpcap/Makefile b/package/libs/libpcap/Makefile index 5ee5727a9..984b20507 100644 --- a/package/libs/libpcap/Makefile +++ b/package/libs/libpcap/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2006-2022 OpenWrt.org +# Copyright (C) 2006-2013 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libpcap -PKG_VERSION:=1.10.1 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=1.10.3 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://www.tcpdump.org/release/ -PKG_HASH:=ed285f4accaf05344f90975757b3dbfe772ba41d1c401c2648b7fa45b711bdd4 +PKG_HASH:=2a8885c403516cf7b0933ed4b14d6caa30e02052489ebd414dc75ac52e7559e6 PKG_MAINTAINER:=Felix Fietkau PKG_LICENSE:=BSD-3-Clause diff --git a/package/libs/libpcap/patches/100-no-openssl.patch b/package/libs/libpcap/patches/100-no-openssl.patch index 56896ad8b..434f1ce00 100644 --- a/package/libs/libpcap/patches/100-no-openssl.patch +++ b/package/libs/libpcap/patches/100-no-openssl.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -1042,7 +1042,6 @@ endif() +@@ -1325,7 +1325,6 @@ endif() # # OpenSSL/libressl. # diff --git a/package/libs/libpcap/patches/102-skip-manpages.patch b/package/libs/libpcap/patches/102-skip-manpages.patch index 79a365643..43d393ac5 100644 --- a/package/libs/libpcap/patches/102-skip-manpages.patch +++ b/package/libs/libpcap/patches/102-skip-manpages.patch @@ -9,7 +9,7 @@ Subject: [PATCH] skip manpages --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -2732,57 +2732,6 @@ if(NOT MSVC) +@@ -3325,57 +3325,6 @@ if(NOT MSVC) if(MINGW) find_program(LINK_EXECUTABLE ln) endif(MINGW) diff --git a/package/libs/libpcap/patches/201-space_optimization.patch b/package/libs/libpcap/patches/201-space_optimization.patch deleted file mode 100644 index bf9374dd5..000000000 --- a/package/libs/libpcap/patches/201-space_optimization.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/pcap-common.c -+++ b/pcap-common.c -@@ -1662,14 +1662,23 @@ swap_pseudo_headers(int linktype, struct - break; - - case DLT_USB_LINUX: -+#ifndef PCAP_SUPPORT_USB -+ return; -+#endif - swap_linux_usb_header(hdr, data, 0); - break; - - case DLT_USB_LINUX_MMAPPED: -+#ifndef PCAP_SUPPORT_USB -+ return; -+#endif - swap_linux_usb_header(hdr, data, 1); - break; - - case DLT_NFLOG: -+#ifndef PCAP_SUPPORT_NETFILTER -+ return; -+#endif - swap_nflog_header(hdr, data); - break; - } diff --git a/package/libs/libpcap/patches/210-add-rpcapd-in-linux-support.patch b/package/libs/libpcap/patches/210-add-rpcapd-in-linux-support.patch index 91b77aaf3..1402bd1eb 100644 --- a/package/libs/libpcap/patches/210-add-rpcapd-in-linux-support.patch +++ b/package/libs/libpcap/patches/210-add-rpcapd-in-linux-support.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -200,15 +200,7 @@ option(NO_PROTOCHAIN "Disable protochain +@@ -477,15 +477,7 @@ option(NO_PROTOCHAIN "Disable protochain # set(PCAP_TYPE "" CACHE STRING "Packet capture type") diff --git a/package/libs/libpcap/patches/300-Add-support-for-B.A.T.M.A.N.-Advanced.patch b/package/libs/libpcap/patches/300-Add-support-for-B.A.T.M.A.N.-Advanced.patch new file mode 100644 index 000000000..b3ff25286 --- /dev/null +++ b/package/libs/libpcap/patches/300-Add-support-for-B.A.T.M.A.N.-Advanced.patch @@ -0,0 +1,642 @@ +From 3d8d268320d2381021a409ff8d03533698dd6242 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Linus=20L=C3=BCssing?= +Date: Mon, 23 Nov 2020 00:38:22 +0100 +Subject: [PATCH] Add support for B.A.T.M.A.N. Advanced +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This adds support for the layer 2 mesh routing protocol +B.A.T.M.A.N. Advanced. "batadv" can be used to filter on batman-adv +packets. It also allows later filters to look at frames inside the +tunnel when both "version" and "type" are specified. + +Documentation for the batman-adv protocol can be found at the following +locations: + +https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/networking/batman-adv.rst +https://www.open-mesh.org/ + +Signed-off-by: Linus Lüssing +--- + Makefile.in | 2 + + batadv_legacy_packet.h | 77 +++++++++++++++++++ + batadv_packet.h | 78 ++++++++++++++++++++ + ethertype.h | 3 + + gencode.c | 164 +++++++++++++++++++++++++++++++++++++++++ + gencode.h | 3 + + grammar.y.in | 32 +++++++- + nametoaddr.c | 59 +++++++++++++++ + pcap-filter.manmisc.in | 35 ++++++++- + pcap/namedb.h | 2 + + scanner.l | 1 + + 11 files changed, 453 insertions(+), 3 deletions(-) + create mode 100644 batadv_legacy_packet.h + create mode 100644 batadv_packet.h + +--- a/Makefile.in ++++ b/Makefile.in +@@ -133,6 +133,8 @@ PUBHDR = \ + HDR = $(PUBHDR) \ + arcnet.h \ + atmuni31.h \ ++ batadv_legacy_packet.h \ ++ batadv_packet.h \ + diag-control.h \ + ethertype.h \ + extract.h \ +--- /dev/null ++++ b/batadv_legacy_packet.h +@@ -0,0 +1,77 @@ ++/* SPDX-License-Identifier: BSD-3 */ ++/* Copyright (C) 2020 Linus Lüssing */ ++ ++#ifndef _BATADV_LEGACY_PACKET_H_ ++#define _BATADV_LEGACY_PACKET_H_ ++ ++enum batadv_legacy_packettype { ++ BATADV_LEGACY_IV_OGM = 0x01, ++ BATADV_LEGACY_ICMP = 0x02, ++ BATADV_LEGACY_UNICAST = 0x03, ++ BATADV_LEGACY_BCAST = 0x04, ++ BATADV_LEGACY_VIS = 0x05, ++ BATADV_LEGACY_UNICAST_FRAG = 0x06, ++ BATADV_LEGACY_TT_QUERY = 0x07, ++ BATADV_LEGACY_ROAM_ADV = 0x08, ++ BATADV_LEGACY_UNICAST_4ADDR = 0x09, ++ BATADV_LEGACY_CODED = 0x0a, ++}; ++ ++#define ETH_ALEN 6 ++ ++struct batadv_legacy_unicast_packet { ++ uint8_t packet_type; ++ uint8_t version; ++ uint8_t ttl; ++ uint8_t ttvn; ++ uint8_t dest[ETH_ALEN]; ++}; ++ ++struct batadv_legacy_unicast_4addr_packet { ++ uint8_t packet_type; ++ uint8_t version; ++ uint8_t ttl; ++ uint8_t src[ETH_ALEN]; ++ uint8_t subtype; ++ uint8_t reserved; ++}; ++ ++struct batadv_legacy_unicast_frag_packet { ++ uint8_t packet_type; ++ uint8_t version; ++ uint8_t ttl; ++ uint8_t ttvn; ++ uint8_t dest[ETH_ALEN]; ++ uint8_t flags; ++ uint8_t align; ++ uint8_t orig[ETH_ALEN]; ++ uint8_t seqno[2]; /* 2-byte integral value */ ++}; ++ ++struct batadv_legacy_bcast_packet { ++ uint8_t packet_type; ++ uint8_t version; ++ uint8_t ttl; ++ uint8_t reserved; ++ uint8_t seqno[4]; /* 4-byte integral value */ ++ uint8_t orig[ETH_ALEN]; ++}; ++ ++struct batadv_legacy_coded_packet { ++ uint8_t packet_type; ++ uint8_t version; ++ uint8_t ttl; ++ uint8_t first_ttvn; ++ uint8_t first_source[ETH_ALEN]; ++ uint8_t first_orig_dest[ETH_ALEN]; ++ uint8_t first_crc[4]; /* 4-byte integral value */ ++ uint8_t second_ttl; ++ uint8_t second_ttvn; ++ uint8_t second_dest[ETH_ALEN]; ++ uint8_t second_source[ETH_ALEN]; ++ uint8_t second_orig_dest[ETH_ALEN]; ++ uint8_t second_crc[4]; /* 4-byte integral value */ ++ uint8_t coded_len[2]; /* 2-byte integral value */ ++}; ++ ++#endif /* _BATADV_LEGACY_PACKET_H_ */ +--- /dev/null ++++ b/batadv_packet.h +@@ -0,0 +1,78 @@ ++/* SPDX-License-Identifier: BSD-3 */ ++/* Copyright (C) 2020 Linus Lüssing */ ++ ++#ifndef _BATADV_PACKET_H_ ++#define _BATADV_PACKET_H_ ++ ++/* For the definitive and most recent packet format definition, ++ * see the batadv_packet.h in the Linux kernel. ++ */ ++ ++enum batadv_packettype { ++ BATADV_IV_OGM = 0x00, ++ BATADV_BCAST = 0x01, ++ BATADV_CODED = 0x02, ++ BATADV_ELP = 0x03, ++ BATADV_OGM2 = 0x04, ++ BATADV_UNICAST = 0x40, ++ BATADV_UNICAST_FRAG = 0x41, ++ BATADV_UNICAST_4ADDR = 0x42, ++ BATADV_ICMP = 0x43, ++ BATADV_UNICAST_TVLV = 0x44, ++}; ++ ++#define ETH_ALEN 6 ++ ++struct batadv_unicast_packet { ++ uint8_t packet_type; ++ uint8_t version; ++ uint8_t ttl; ++ uint8_t ttvn; ++ uint8_t dest[ETH_ALEN]; ++}; ++ ++struct batadv_unicast_4addr_packet { ++ struct batadv_unicast_packet u; ++ uint8_t src[ETH_ALEN]; ++ uint8_t subtype; ++ uint8_t reserved; ++}; ++ ++struct batadv_frag_packet { ++ uint8_t packet_type; ++ uint8_t version; ++ uint8_t ttl; ++ uint8_t num_pri; /* number and priority */ ++ uint8_t dest[ETH_ALEN]; ++ uint8_t orig[ETH_ALEN]; ++ uint8_t seqno[2]; /* 2-byte integral value */ ++ uint8_t total_size[2]; /* 2-byte integral value */ ++}; ++ ++struct batadv_bcast_packet { ++ uint8_t packet_type; ++ uint8_t version; ++ uint8_t ttl; ++ uint8_t reserved; ++ uint8_t seqno[4]; /* 4-byte integral value */ ++ uint8_t orig[ETH_ALEN]; ++}; ++ ++struct batadv_coded_packet { ++ uint8_t packet_type; ++ uint8_t version; ++ uint8_t ttl; ++ uint8_t first_ttvn; ++ uint8_t first_source[ETH_ALEN]; ++ uint8_t first_orig_dest[ETH_ALEN]; ++ uint8_t first_crc[4]; /* 4-byte integral value */ ++ uint8_t second_ttl; ++ uint8_t second_ttvn; ++ uint8_t second_dest[ETH_ALEN]; ++ uint8_t second_source[ETH_ALEN]; ++ uint8_t second_orig_dest[ETH_ALEN]; ++ uint8_t second_crc[4]; /* 4-byte integral value */ ++ uint8_t coded_len[2]; /* 2-byte integral value */ ++}; ++ ++#endif /* _BATADV_PACKET_H_ */ +--- a/ethertype.h ++++ b/ethertype.h +@@ -49,6 +49,9 @@ + #ifndef ETHERTYPE_TRAIL + #define ETHERTYPE_TRAIL 0x1000 + #endif ++#ifndef ETHERTYPE_BATMAN ++#define ETHERTYPE_BATMAN 0x4305 /* B.A.T.M.A.N. Advanced */ ++#endif + #ifndef ETHERTYPE_MOPDL + #define ETHERTYPE_MOPDL 0x6001 + #endif +--- a/gencode.c ++++ b/gencode.c +@@ -60,6 +60,8 @@ + #include "sunatmpos.h" + #include "pflog.h" + #include "ppp.h" ++#include "batadv_packet.h" ++#include "batadv_legacy_packet.h" + #include "pcap/sll.h" + #include "pcap/ipnet.h" + #include "arcnet.h" +@@ -9436,6 +9438,168 @@ gen_geneve(compiler_state_t *cstate, bpf + return b1; + } + ++static struct block * ++gen_batadv_check_version(compiler_state_t *cstate, struct block *b0, bpf_u_int32 version) ++{ ++ struct block *b1; ++ ++ if (version > UINT8_MAX) ++ bpf_error(cstate, ++ "batman-adv compatibility version number %u unsupported", ++ version); ++ ++ b1 = gen_cmp(cstate, OR_LINKPL, 1, BPF_B, version); ++ gen_and(b0, b1); ++ ++ return b1; ++} ++ ++static struct block * ++gen_batadv_check_type(compiler_state_t *cstate, struct block *b0, ++ bpf_u_int32 version, bpf_u_int32 type) ++{ ++ struct block *b1; ++ ++ switch (version) { ++ case 14: ++ case 15: ++ if (type > UINT8_MAX) ++ bpf_error(cstate, ++ "batman-adv packet type %u unsupported for compatibility version %u", ++ type, version); ++ ++ b1 = gen_cmp(cstate, OR_LINKPL, 0, BPF_B, type); ++ gen_and(b0, b1); ++ b0 = b1; ++ ++ break; ++ default: ++ bpf_error(cstate, ++ "batman-adv compatibility version number %u unsupported", ++ version); ++ } ++ ++ return b0; ++} ++ ++ ++static void gen_batadv_push_offset(compiler_state_t *cstate, u_int offset) ++{ ++ PUSH_LINKHDR(cstate, DLT_EN10MB, cstate->off_linkpl.is_variable, ++ cstate->off_linkpl.constant_part + cstate->off_nl + offset, ++ cstate->off_linkpl.reg); ++ ++ cstate->off_linktype.constant_part += cstate->off_linkhdr.constant_part; ++ cstate->off_linkpl.constant_part += cstate->off_linkhdr.constant_part; ++ ++ cstate->off_nl = 0; ++ cstate->off_nl_nosnap = 0; /* no 802.2 LLC */ ++} ++ ++static void ++gen_batadv_offsets_v14(compiler_state_t *cstate, bpf_u_int32 type) ++{ ++ size_t offset; ++ ++ switch (type) { ++ case BATADV_LEGACY_UNICAST: /* 0x03 */ ++ offset = sizeof(struct batadv_legacy_unicast_packet); ++ break; ++ case BATADV_LEGACY_BCAST: /* 0x04 */ ++ offset = sizeof(struct batadv_legacy_bcast_packet); ++ break; ++ case BATADV_LEGACY_UNICAST_FRAG: /* 0x06 */ ++ offset = sizeof(struct batadv_legacy_unicast_frag_packet); ++ break; ++ case BATADV_LEGACY_UNICAST_4ADDR: /* 0x09 */ ++ offset = sizeof(struct batadv_legacy_unicast_4addr_packet); ++ break; ++ case BATADV_LEGACY_CODED: /* 0x0a */ ++ offset = sizeof(struct batadv_legacy_coded_packet); ++ break; ++ default: ++ offset = 0; ++ } ++ ++ if (offset) ++ gen_batadv_push_offset(cstate, (u_int)offset); ++} ++ ++static void ++gen_batadv_offsets_v15(compiler_state_t *cstate, bpf_u_int32 type) ++{ ++ size_t offset; ++ ++ switch (type) { ++ case BATADV_BCAST: /* 0x01 */ ++ offset = sizeof(struct batadv_bcast_packet); ++ break; ++ case BATADV_CODED: /* 0x02 */ ++ offset = sizeof(struct batadv_coded_packet); ++ break; ++ case BATADV_UNICAST: /* 0x40 */ ++ offset = sizeof(struct batadv_unicast_packet); ++ break; ++ case BATADV_UNICAST_FRAG: /* 0x41 */ ++ offset = sizeof(struct batadv_frag_packet); ++ break; ++ case BATADV_UNICAST_4ADDR: /* 0x42 */ ++ offset = sizeof(struct batadv_unicast_4addr_packet); ++ break; ++ case BATADV_UNICAST_TVLV: ++ /* unsupported for now, needs variable offset to ++ * take tvlv_len into account ++ */ ++ /* fall through */ ++ default: ++ offset = 0; ++ } ++ ++ if (offset) ++ gen_batadv_push_offset(cstate, (u_int)offset); ++} ++ ++static void ++gen_batadv_offsets(compiler_state_t *cstate, bpf_u_int32 version, bpf_u_int32 type) ++{ ++ switch (version) { ++ case 14: ++ gen_batadv_offsets_v14(cstate, type); ++ break; ++ case 15: ++ gen_batadv_offsets_v15(cstate, type); ++ break; ++ default: ++ break; ++ } ++} ++ ++struct block * ++gen_batadv(compiler_state_t *cstate, bpf_u_int32 version, int has_version, ++ bpf_u_int32 type, int has_type) ++{ ++ struct block *b0; ++ ++ /* ++ * Catch errors reported by us and routines below us, and return NULL ++ * on an error. ++ */ ++ if (setjmp(cstate->top_ctx)) ++ return (NULL); ++ ++ b0 = gen_linktype(cstate, ETHERTYPE_BATMAN); ++ ++ if (has_version) ++ b0 = gen_batadv_check_version(cstate, b0, version); ++ ++ if (has_type) { ++ b0 = gen_batadv_check_type(cstate, b0, version, type); ++ gen_batadv_offsets(cstate, version, type); ++ } ++ ++ return b0; ++} ++ + /* Check that the encapsulated frame has a link layer header + * for Ethernet filters. */ + static struct block * +--- a/gencode.h ++++ b/gencode.h +@@ -358,6 +358,9 @@ struct block *gen_pppoes(compiler_state_ + + struct block *gen_geneve(compiler_state_t *, bpf_u_int32, int); + ++struct block *gen_batadv(compiler_state_t *, bpf_u_int32, int, ++ bpf_u_int32, int); ++ + struct block *gen_atmfield_code(compiler_state_t *, int, bpf_u_int32, + int, int); + struct block *gen_atmtype_abbrev(compiler_state_t *, int); +--- a/grammar.y.in ++++ b/grammar.y.in +@@ -375,6 +375,7 @@ DIAG_OFF_BISON_BYACC + %type mtp2type + %type mtp3field + %type mtp3fieldvalue mtp3value mtp3listvalue ++%type pbatadv + + + %token DST SRC HOST GATEWAY +@@ -393,7 +394,7 @@ DIAG_OFF_BISON_BYACC + %token LEN + %token IPV6 ICMPV6 AH ESP + %token VLAN MPLS +-%token PPPOED PPPOES GENEVE ++%token PPPOED PPPOES GENEVE BATADV + %token ISO ESIS CLNP ISIS L1 L2 IIH LSP SNP CSNP PSNP + %token STP + %token IPX +@@ -620,11 +621,40 @@ other: pqual TK_BROADCAST { CHECK_PTR_ + | PPPOES { CHECK_PTR_VAL(($$ = gen_pppoes(cstate, 0, 0))); } + | GENEVE pnum { CHECK_PTR_VAL(($$ = gen_geneve(cstate, $2, 1))); } + | GENEVE { CHECK_PTR_VAL(($$ = gen_geneve(cstate, 0, 0))); } ++ | BATADV pbatadv { $$ = $2; } + | pfvar { $$ = $1; } + | pqual p80211 { $$ = $2; } + | pllc { $$ = $1; } + ; + ++pbatadv: { CHECK_PTR_VAL(($$ = gen_batadv(cstate, 0, 0, 0, 0))); } ++ | pnum { CHECK_PTR_VAL(($$ = gen_batadv(cstate, $1, 1, 0, 0))); } ++ | pnum pnum { CHECK_PTR_VAL(($$ = gen_batadv(cstate, $1, 1, $2, 1))); } ++ | pnum ID ++ { ++ int type; ++ ++ switch ($1) { ++ case 14: ++ type = pcap_nametobatadvtype_v14($2); ++ break; ++ case 15: ++ type = pcap_nametobatadvtype_v15($2); ++ break; ++ default: ++ bpf_set_error(cstate, "batman-adv compatibility version number %u unsupported", $1); ++ YYABORT; ++ } ++ ++ if (type == PROTO_UNDEF) { ++ bpf_set_error(cstate, "invalid batman-adv packet type value \"%s\"", $2); ++ YYABORT; ++ } ++ ++ CHECK_PTR_VAL(($$ = gen_batadv(cstate, $1, 1, type, 1))); ++ } ++ ; ++ + pfvar: PF_IFNAME ID { CHECK_PTR_VAL($2); CHECK_PTR_VAL(($$ = gen_pf_ifname(cstate, $2))); } + | PF_RSET ID { CHECK_PTR_VAL($2); CHECK_PTR_VAL(($$ = gen_pf_ruleset(cstate, $2))); } + | PF_RNR NUM { CHECK_PTR_VAL(($$ = gen_pf_rnr(cstate, $2))); } +--- a/nametoaddr.c ++++ b/nametoaddr.c +@@ -136,8 +136,12 @@ + + #include "diag-control.h" + ++#include "batadv_packet.h" ++#include "batadv_legacy_packet.h" ++ + #include "gencode.h" + #include ++ + #include "nametoaddr.h" + + #ifdef HAVE_OS_PROTO_H +@@ -604,6 +608,7 @@ PCAP_API_DEF struct eproto eproto_db[] = + { "moprc", ETHERTYPE_MOPRC }, + { "rarp", ETHERTYPE_REVARP }, + { "sca", ETHERTYPE_SCA }, ++ { "batadv", ETHERTYPE_BATMAN }, + { (char *)0, 0 } + }; + +@@ -638,6 +643,60 @@ pcap_nametollc(const char *s) + + while (p->s != 0) { + if (strcmp(p->s, s) == 0) ++ return p->p; ++ p += 1; ++ } ++ return PROTO_UNDEF; ++} ++ ++/* Static data base of batman-adv v14 packet type values. */ ++static struct eproto batadv_type_db_v14[] = { ++ { "iv_ogm", BATADV_LEGACY_IV_OGM }, ++ { "icmp", BATADV_LEGACY_ICMP }, ++ { "unicast", BATADV_LEGACY_UNICAST }, ++ { "bcast", BATADV_LEGACY_BCAST }, ++ { "vis", BATADV_LEGACY_VIS }, ++ { "unicast_frag", BATADV_LEGACY_UNICAST_FRAG }, ++ { "tt_query", BATADV_LEGACY_TT_QUERY }, ++ { "roam_adv", BATADV_LEGACY_ROAM_ADV }, ++ { "unicast_4addr", BATADV_LEGACY_UNICAST_4ADDR }, ++ { "coded", BATADV_LEGACY_CODED }, ++ { (char *)0, 0 } ++}; ++ ++int pcap_nametobatadvtype_v14(const char *s) ++{ ++ struct eproto *p = batadv_type_db_v14; ++ ++ while (p->s != 0) { ++ if (strcmp(p->s, s) == 0) ++ return p->p; ++ p += 1; ++ } ++ return PROTO_UNDEF; ++} ++ ++/* Static data base of batman-adv v15 packet type values. */ ++static struct eproto batadv_type_db_v15[] = { ++ { "iv_ogm", BATADV_IV_OGM }, ++ { "bcast", BATADV_BCAST }, ++ { "coded", BATADV_CODED }, ++ { "elp", BATADV_ELP }, ++ { "ogm2", BATADV_OGM2 }, ++ { "unicast", BATADV_UNICAST }, ++ { "unicast_frag", BATADV_UNICAST_FRAG }, ++ { "unicast_4addr", BATADV_UNICAST_4ADDR }, ++ { "icmp", BATADV_ICMP }, ++ { "unicast_tvlv", BATADV_UNICAST_TVLV }, ++ { (char *)0, 0 } ++}; ++ ++int pcap_nametobatadvtype_v15(const char *s) ++{ ++ struct eproto *p = batadv_type_db_v15; ++ ++ while (p->s != 0) { ++ if (strcmp(p->s, s) == 0) + return p->p; + p += 1; + } +--- a/pcap-filter.manmisc.in ++++ b/pcap-filter.manmisc.in +@@ -98,6 +98,7 @@ protocols are: + .BR arp , + .BR rarp , + .BR decnet , ++.BR batadv , + .BR sctp , + .B tcp + and +@@ -400,7 +401,7 @@ True if the packet is an IPv6 multicast + .IP "\fBether proto \fIprotocol\fR" + True if the packet is of ether type \fIprotocol\fR. + \fIProtocol\fP can be a number or one of the names +-\fBaarp\fP, \fBarp\fP, \fBatalk\fP, \fBdecnet\fP, \fBip\fP, \fBip6\fP, ++\fBaarp\fP, \fBarp\fP, \fBatalk\fP, \fBbatadv\fP, \fBdecnet\fP, \fBip\fP, \fBip6\fP, + \fBipx\fP, \fBiso\fP, \fBlat\fP, \fBloopback\fP, \fBmopdl\fP, \fBmoprc\fP, \fBnetbeui\fP, + \fBrarp\fP, \fBsca\fP or \fBstp\fP. + Note these identifiers (except \fBloopback\fP) are also keywords +@@ -454,7 +455,7 @@ the filter checks for the IPX etype in a + DSAP in the LLC header, the 802.3-with-no-LLC-header encapsulation of + IPX, and the IPX etype in a SNAP frame. + .RE +-.IP "\fBip\fR, \fBip6\fR, \fBarp\fR, \fBrarp\fR, \fBatalk\fR, \fBaarp\fR, \fBdecnet\fR, \fBiso\fR, \fBstp\fR, \fBipx\fR, \fBnetbeui\fP" ++.IP "\fBip\fR, \fBip6\fR, \fBarp\fR, \fBrarp\fR, \fBatalk\fR, \fBaarp\fR, \fBdecnet\fR, \fBiso\fR, \fBstp\fR, \fBipx\fR, \fBnetbeui\fP, \fBbatadv\fP" + Abbreviations for: + .in +.5i + .nf +@@ -792,6 +793,36 @@ For example: + filters IPv4 protocol encapsulated in Geneve with VNI 0xb. This will + match both IPv4 directly encapsulated in Geneve as well as IPv4 contained + inside an Ethernet frame. ++.IP "\fBbatadv \fI[version] \fI[type]\fR" ++True if the packet is a B.A.T.M.A.N. Advanced packet (Ethernet type 0x4305). ++If the optional \fIversion\fR is specified, only true if the packet has the ++specified batman-adv compatibility \fIversion\fR. If the optional \fIversion\fR ++and \fItype\fR are specified, only true if the packet has both the specified ++batman-adv compatibility \fIversion\fR and batman-adv packet \fItype\fR. ++.IP ++\fIversion\fR may be a number from 0 to 255, though only compatibility version ++14 and 15 were actually deployed in the wild. Version 15 is the current version, ++14 is considered deprecated. ++.IP ++\fItype\fR is currently only defined for compatibility \fIversion\fR 14 and 15. ++\fItype\fR may be a number from 0 to 255 for compatibility \fIversion\fR 14 and 15. ++.IP ++The following packet \fItype\fR aliases are available for compat \fIversion\fR 14: ++\fBiv_ogm\fP, \fBicmp\fP, \fBunicast\fP, \fBbcast\fP, \fBvis\fP, \fBunicast-frag\fP, ++\fBtt_query\fP, \fBroam_adv\fP, \fBunicast_4addr\fP, \fPcoded\fP. ++.IP ++The following packet \fItype\fR aliases are available for compat \fIversion\fR 15: ++\fBiv_ogm\fP, \fBbcast\fP, \fBcoded\fP, \fBelp\fP, \fBogm2\fP, \fBunicast\fP, ++\fBunicast_frag\fP, \fBunicast_4addr\fP, \fBicmp\fP, \fPunicast_tvlv\fP. ++.IP ++Note that when the \fBbatadv\fR keyword is encountered in an expression and ++a batman-adv packet \fItype\fR is provided which specifies an encapsulating ++packet type then it changes the decoding offsets for the remainder of the ++expression on the assumption that the packet is a batman-adv packet. For compat ++\fIversion\fR 14 these are packet \fItype\fRs \fBunicast\fP, \fBbcast\fP, ++\fBunicast_frag\fP, \fBunicast_4addr\fP and \fBcoded\fP. For compat \fIversion\fR ++15 these are currently packet \fItype\fRs \fBbcast\fP, \fBcoded\fP, \fBunicast\fP, ++\fBunicast_frag\fP and \fBunicast_4addr\fP. + .IP "\fBiso proto \fIprotocol\fR" + True if the packet is an OSI packet of protocol type \fIprotocol\fP. + \fIProtocol\fP can be a number or one of the names +--- a/pcap/namedb.h ++++ b/pcap/namedb.h +@@ -70,6 +70,8 @@ PCAP_API int pcap_nametoportrange(const + PCAP_API int pcap_nametoproto(const char *); + PCAP_API int pcap_nametoeproto(const char *); + PCAP_API int pcap_nametollc(const char *); ++PCAP_API int pcap_nametobatadvtype_v14(const char *); ++PCAP_API int pcap_nametobatadvtype_v15(const char *); + /* + * If a protocol is unknown, PROTO_UNDEF is returned. + * Also, pcap_nametoport() returns the protocol along with the port number. +--- a/scanner.l ++++ b/scanner.l +@@ -347,6 +347,7 @@ mpls return MPLS; + pppoed return PPPOED; + pppoes return PPPOES; + geneve return GENEVE; ++batadv return BATADV; + + lane return LANE; + llc return LLC; diff --git a/package/libs/libtraceevent/Makefile b/package/libs/libtraceevent/Makefile index 63f954ba0..cfa5e465b 100644 --- a/package/libs/libtraceevent/Makefile +++ b/package/libs/libtraceevent/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libtraceevent -PKG_VERSION:=1.7.0 +PKG_VERSION:=1.7.1 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/snapshot/ -PKG_HASH:=3e902184f743c955b183b45f25ea163a3d41c9f287fdcfc95cd9cca748c563c8 +PKG_HASH:=17b7131c106793c3b45477445bd32d295170c4245ed8348e03c17296e53009e1 PKG_MAINTAINER:=Nick Hainke diff --git a/package/libs/libtracefs/Makefile b/package/libs/libtracefs/Makefile index a3d08d298..b97922f46 100644 --- a/package/libs/libtracefs/Makefile +++ b/package/libs/libtracefs/Makefile @@ -1,12 +1,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libtracefs -PKG_VERSION:=1.6.3 +PKG_VERSION:=1.6.4 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/snapshot/ -PKG_HASH:=de307faaa54ac52cf0ce3ff19b32b51af24897e3440e643068ac82d31e197e92 +PKG_HASH:=52ce793dbb35a3e59bddce31de09a5d92cedd4d0702e64d0916f1ccdb00526c9 PKG_MAINTAINER:=Nick Hainke diff --git a/package/libs/mbedtls/Makefile b/package/libs/mbedtls/Makefile index b07f0477e..2ae3fdbe2 100644 --- a/package/libs/mbedtls/Makefile +++ b/package/libs/mbedtls/Makefile @@ -130,13 +130,6 @@ CMAKE_OPTIONS += \ -DENABLE_TESTING:Bool=OFF \ -DENABLE_PROGRAMS:Bool=ON -define Build/Configure - $(call Build/Configure/Default) - - sed -i '/fuzz/d' $(PKG_BUILD_DIR)/programs/CMakeLists.txt - sed -i '/test/d' $(PKG_BUILD_DIR)/programs/CMakeLists.txt -endef - define Build/Prepare $(call Build/Prepare/Default) diff --git a/package/libs/mbedtls/patches/101-remove-test.patch b/package/libs/mbedtls/patches/101-remove-test.patch new file mode 100644 index 000000000..e43f8757d --- /dev/null +++ b/package/libs/mbedtls/patches/101-remove-test.patch @@ -0,0 +1,15 @@ +--- a/programs/CMakeLists.txt ++++ b/programs/CMakeLists.txt +@@ -1,12 +1,8 @@ + add_subdirectory(aes) +-if (NOT WIN32) +- add_subdirectory(fuzz) +-endif() + add_subdirectory(hash) + add_subdirectory(pkey) + add_subdirectory(psa) + add_subdirectory(random) + add_subdirectory(ssl) +-add_subdirectory(test) + add_subdirectory(util) + add_subdirectory(x509) diff --git a/package/libs/ncurses/Makefile b/package/libs/ncurses/Makefile index 14f74082a..29261a4cd 100644 --- a/package/libs/ncurses/Makefile +++ b/package/libs/ncurses/Makefile @@ -9,12 +9,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ncurses PKG_CPE_ID:=cpe:/a:gnu:ncurses -PKG_VERSION:=6.3 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=6.4 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=@GNU/$(PKG_NAME) -PKG_HASH:=97fc51ac2b085d4cde31ef4d2c3122c21abc217e9090a43a30fc5ec21684e059 +PKG_HASH:=6931283d9ac87c5073f30b6290c4c75f21632bb4fc3603ac8100812bed248159 PKG_LICENSE:=MIT PKG_LICENSE_FILES:=README diff --git a/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch b/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch index 2fdbb7b0b..70d64bd8e 100644 --- a/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch +++ b/package/libs/ncurses/patches/100-ncurses-5.6-20080112-urxvt.patch @@ -1,6 +1,6 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -6616,6 +6616,172 @@ rxvt-cygwin-native|rxvt terminal emulato +@@ -6886,6 +6886,172 @@ rxvt-cygwin-native|rxvt terminal emulato rxvt-16color|rxvt with 16 colors like aixterm, ncv#32, use=ibm+16color, use=rxvt, diff --git a/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch b/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch index 2d299197b..9f00350a4 100644 --- a/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch +++ b/package/libs/ncurses/patches/101-ncurses-5.6-20080628-kbs.patch @@ -1,14 +1,14 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -4815,6 +4815,7 @@ xterm+nofkeys|building block for xterm f - # This version reflects the current xterm features. - xterm-new|modern xterm terminal emulator, +@@ -4984,6 +4984,7 @@ xterm-xfree86|xterm terminal emulator (X + + xterm+nofkeys|building block for xterm fkey-variants, npc, + kbs=\177, kcbt=\E[Z, kent=\EOM, nel=\EE, use=ecma+index, - use=ansi+rep, use=ecma+strikeout, use=xterm+pcfkeys, - use=xterm+nofkeys, -@@ -6416,6 +6417,7 @@ mlterm-256color|mlterm 3.0 with xterm 25 + use=ansi+rep, use=ecma+strikeout, use=vt420+lrmm, + use=xterm+sm+1006, use=xterm+tmux, use=ecma+italics, +@@ -6689,6 +6690,7 @@ mlterm-256color|mlterm 3.0 with xterm 25 rxvt-basic|rxvt terminal base (X Window System), OTbs, am, bce, eo, mir, msgr, xenl, xon, XT, cols#80, it#8, lines#24, @@ -16,24 +16,24 @@ acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, clear=\E[H\E[2J, cr=\r, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, -@@ -6425,7 +6427,7 @@ rxvt-basic|rxvt terminal base (X Window +@@ -6698,7 +6700,7 @@ rxvt-basic|rxvt terminal base (X Window enacs=\E(B\E)0, flash=\E[?5h$<100/>\E[?5l, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\n, is1=\E[?47l\E=\E[?1l, - is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kbs=^H, + is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kcbt=\E[Z, kmous=\E[M, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, - rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E>, rmso=\E[27m, - rmul=\E[24m, -@@ -8060,6 +8062,7 @@ dumb-emacs-ansi|Emacs dumb terminal with - screen|VT 100/ANSI X3.64 virtual terminal, + rmir=\E[4l, rmkx=\E>, rmso=\E[27m, rmul=\E[24m, + rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, +@@ -8347,6 +8349,7 @@ dumb-emacs-ansi|Emacs dumb terminal with + screen-base|VT 100/ANSI X3.64 virtual terminal (base), OTbs, OTpt, am, km, mir, msgr, xenl, G0, colors#8, cols#80, it#8, lines#24, ncv@, pairs#64, U8#1, + kbs=\177, acsc=++\,\,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxy yzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, -@@ -8071,7 +8074,7 @@ screen|VT 100/ANSI X3.64 virtual termina +@@ -8358,7 +8361,7 @@ screen-base|VT 100/ANSI X3.64 virtual te dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, flash=\Eg, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, @@ -42,7 +42,7 @@ kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, -@@ -8199,6 +8202,7 @@ screen.xterm-r6|screen customized for X1 +@@ -8500,6 +8503,7 @@ screen.xterm-r6|screen customized for X1 # on Solaris because Sun's curses implementation gets confused. screen.teraterm|disable ncv in teraterm, ncv#127, diff --git a/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch b/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch index a6398acf8..5f1461b7b 100644 --- a/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch +++ b/package/libs/ncurses/patches/102-ncurses-5.9-gcc-5.patch @@ -15,7 +15,7 @@ Subject: [PATCH] ncurses 5.9 - patch 20141206 --- a/ncurses/base/MKlib_gen.sh +++ b/ncurses/base/MKlib_gen.sh -@@ -511,11 +511,22 @@ sed -n -f $ED1 \ +@@ -512,11 +512,22 @@ sed -n -f $ED1 \ -e 's/gen_$//' \ -e 's/ / /g' >>$TMP diff --git a/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch b/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch index 5ef8ab7ab..a4599130c 100644 --- a/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch +++ b/package/libs/ncurses/patches/103-ncurses-ar-determinism.patch @@ -1,6 +1,6 @@ --- a/aclocal.m4 +++ b/aclocal.m4 -@@ -505,7 +505,7 @@ AC_CACHE_CHECK(for options to update arc +@@ -523,7 +523,7 @@ AC_CACHE_CHECK(for options to update arc ;; (*) cf_cv_ar_flags=unknown @@ -11,7 +11,7 @@ # check if $ARFLAGS already contains this choice --- a/configure +++ b/configure -@@ -5072,7 +5072,7 @@ else +@@ -5110,7 +5110,7 @@ else ;; (*) cf_cv_ar_flags=unknown diff --git a/package/libs/ncurses/patches/900-terminfo.patch b/package/libs/ncurses/patches/900-terminfo.patch index 96d78cde3..86e3bc16b 100644 --- a/package/libs/ncurses/patches/900-terminfo.patch +++ b/package/libs/ncurses/patches/900-terminfo.patch @@ -1,6 +1,6 @@ --- a/misc/terminfo.src +++ b/misc/terminfo.src -@@ -6240,12 +6240,11 @@ konsole-xf3x|KDE console window with key +@@ -6514,12 +6514,11 @@ konsole-xf3x|KDE console window with key # The value for kbs (see konsole-vt100) reflects local customization rather # than the settings used for XFree86 xterm. konsole-xf4x|KDE console window with keyboard for XFree86 4.x xterm, diff --git a/package/libs/openssl/patches/010-padlock.patch b/package/libs/openssl/patches/010-padlock.patch new file mode 100644 index 000000000..e859295cd --- /dev/null +++ b/package/libs/openssl/patches/010-padlock.patch @@ -0,0 +1,52 @@ +From 2bcf8e69bd92e33d84c48e7d108d3d46b22f8a6d Mon Sep 17 00:00:00 2001 +From: ValdikSS +Date: Wed, 18 Jan 2023 20:14:48 +0300 +Subject: [PATCH] Padlock: fix byte swapping assembly for AES-192 and 256 + +Byte swapping code incorrectly uses the number of AES rounds to swap expanded +AES key, while swapping only a single dword in a loop, resulting in swapped +key and partially swapped expanded keys, breaking AES encryption and +decryption on VIA Padlock hardware. + +This commit correctly sets the number of swapping loops to be done. + +Fixes #20073 + +CLA: trivial + +Reviewed-by: Hugo Landau +Reviewed-by: Tomas Mraz +(Merged from https://github.com/openssl/openssl/pull/20077) + +(cherry picked from commit 7331e7ef79fe4499d81cc92249e9c97e9ff9291a) +--- + engines/asm/e_padlock-x86.pl | 2 ++ + engines/asm/e_padlock-x86_64.pl | 2 ++ + 2 files changed, 4 insertions(+) + +diff --git a/engines/asm/e_padlock-x86.pl b/engines/asm/e_padlock-x86.pl +index 5b097ce3ef9b..07f7000fd38a 100644 +--- a/engines/asm/e_padlock-x86.pl ++++ b/engines/asm/e_padlock-x86.pl +@@ -116,6 +116,8 @@ + &function_begin_B("padlock_key_bswap"); + &mov ("edx",&wparam(0)); + &mov ("ecx",&DWP(240,"edx")); ++ &inc ("ecx"); ++ &shl ("ecx",2); + &set_label("bswap_loop"); + &mov ("eax",&DWP(0,"edx")); + &bswap ("eax"); +diff --git a/engines/asm/e_padlock-x86_64.pl b/engines/asm/e_padlock-x86_64.pl +index 09b0aaa48dfe..dfd2ae656375 100644 +--- a/engines/asm/e_padlock-x86_64.pl ++++ b/engines/asm/e_padlock-x86_64.pl +@@ -92,6 +92,8 @@ + .align 16 + padlock_key_bswap: + mov 240($arg1),%edx ++ inc %edx ++ shl \$2,%edx + .Lbswap_loop: + mov ($arg1),%eax + bswap %eax diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index 920e113e6..a08626366 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -8,15 +8,16 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lldpd -PKG_VERSION:=1.0.9 -PKG_RELEASE:=3 +PKG_VERSION:=1.0.16 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz -PKG_SOURCE_URL:=https://media.luffy.cx/files/lldpd -PKG_HASH:=6b64eb3125952b1e33472198b054e8aa0dee45f45d3d4be22789090a474949f5 +PKG_SOURCE_URL:=https://github.com/lldpd/lldpd/releases/download/$(PKG_VERSION)/ +PKG_HASH:=7753c6e31e938923185f4e10c4ab328929729e22ee4a9687d08881fb82c092ee PKG_MAINTAINER:=Stijn Tintel PKG_LICENSE:=ISC +PKG_CPE_ID:=cpe:/a:lldpd_project:lldpd PKG_FIXUP:=autoreconf PKG_BUILD_PARALLEL:=1 diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 7a5b25e01..5b3914492 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -56,6 +56,10 @@ write_lldpd_conf() [ -e $LLDPD_CONFS_DIR ] || ln -s /etc/lldpd.d $LLDPD_CONFS_DIR } +service_triggers() { + procd_add_reload_trigger "lldpd" +} + start_service() { local enable_cdp @@ -84,8 +88,7 @@ start_service() { write_lldpd_conf procd_open_instance - procd_set_param command /usr/sbin/lldpd - procd_append_param command -d # don't daemonize, procd will handle that for us + procd_set_param command /usr/sbin/lldpd -d [ $enable_cdp -gt 0 ] && procd_append_param command '-c' [ $enable_fdp -gt 0 ] && procd_append_param command '-f' diff --git a/package/network/utils/iproute2/patches/320-configure-Remove-include-sys-stat.h.patch b/package/network/utils/iproute2/patches/320-configure-Remove-include-sys-stat.h.patch new file mode 100644 index 000000000..02bb20297 --- /dev/null +++ b/package/network/utils/iproute2/patches/320-configure-Remove-include-sys-stat.h.patch @@ -0,0 +1,43 @@ +From 3a3a2f6be704c970938eb8dac4eb0118f1c2fb06 Mon Sep 17 00:00:00 2001 +From: Hauke Mehrtens +Date: Wed, 21 Dec 2022 23:26:28 +0100 +Subject: [PATCH iproute2 v2] configure: Remove include + +The check_name_to_handle_at() function in the configure script is +including sys/stat.h. This include fails with glibc 2.36 like this: +```` +In file included from /linux-5.15.84/include/uapi/linux/stat.h:5, + from /toolchain-x86_64_gcc-12.2.0_glibc/include/bits/statx.h:31, + from /toolchain-x86_64_gcc-12.2.0_glibc/include/sys/stat.h:465, + from config.YExfMc/name_to_handle_at_test.c:3: +/linux-5.15.84/include/uapi/linux/types.h:10:2: warning: #warning "Attempt to use kernel headers from user space, see https://kernelnewbies.org/KernelHeaders" [-Wcpp] + 10 | #warning "Attempt to use kernel headers from user space, see https://kernelnewbies.org/KernelHeaders" + | ^~~~~~~ +In file included from /linux-5.15.84/include/uapi/linux/posix_types.h:5, + from /linux-5.15.84/include/uapi/linux/types.h:14: +/linux-5.15.84/include/uapi/linux/stddef.h:5:10: fatal error: linux/compiler_types.h: No such file or directory + 5 | #include + | ^~~~~~~~~~~~~~~~~~~~~~~~ +compilation terminated. +```` + +Just removing the include works, the manpage of name_to_handle_at() says +only fcntl.h is needed. + +Fixes: c5b72cc56bf8 ("lib/fs: fix issue when {name,open}_to_handle_at() is not implemented") +Tested-by: Heiko Thiery +Signed-off-by: Hauke Mehrtens +--- + configure | 1 - + 1 file changed, 1 deletion(-) + +--- a/configure ++++ b/configure +@@ -215,7 +215,6 @@ check_name_to_handle_at() + cat >$TMPDIR/name_to_handle_at_test.c < +-#include + #include + int main(int argc, char **argv) + { diff --git a/package/network/utils/nftables/Makefile b/package/network/utils/nftables/Makefile index 9691151c7..2010aaf65 100644 --- a/package/network/utils/nftables/Makefile +++ b/package/network/utils/nftables/Makefile @@ -6,12 +6,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nftables -PKG_VERSION:=1.0.5 -PKG_RELEASE:=2 +PKG_VERSION:=1.0.6 +PKG_RELEASE:=1 -PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=https://netfilter.org/projects/$(PKG_NAME)/files -PKG_HASH:=8d1b4b18393af43698d10baa25d2b9b6397969beecac7816c35dd0714e4de50a +PKG_HASH:=2407430ddd82987670e48dc2fda9e280baa8307abec04ab18d609df3db005e4c PKG_MAINTAINER:= PKG_LICENSE:=GPL-2.0 diff --git a/package/network/utils/nftables/patches/0001-fix-nft.patch b/package/network/utils/nftables/patches/0001-fix-nft.patch deleted file mode 100644 index 2138e254e..000000000 --- a/package/network/utils/nftables/patches/0001-fix-nft.patch +++ /dev/null @@ -1,23 +0,0 @@ -'rule inet dscpclassify dscp_match meta l4proto { udp } th dport { 3478 } th sport { 3478-3497, 16384-16387 } goto ct_set_ef' -works with 'nft add', but not 'nft insert', the latter yields: "BUG: unhandled op 4". - -Fixes: 81e36530fcac ("src: replace interval segment tree overlap and automerge") -Signed-off-by: Florian Westphal ---- - src/evaluate.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/evaluate.c b/src/evaluate.c -index d9c9ca28a53a..edebd7bcd8ab 100644 ---- a/src/evaluate.c -+++ b/src/evaluate.c -@@ -1520,6 +1520,7 @@ static int interval_set_eval(struct eval_ctx *ctx, struct set *set, - switch (ctx->cmd->op) { - case CMD_CREATE: - case CMD_ADD: -+ case CMD_INSERT: - if (set->automerge) { - ret = set_automerge(ctx->msgs, ctx->cmd, set, init, - ctx->nft->debug_mask); --- -2.35.1 diff --git a/package/network/utils/uqmi/Makefile b/package/network/utils/uqmi/Makefile index 53ca67230..0a295628c 100644 --- a/package/network/utils/uqmi/Makefile +++ b/package/network/utils/uqmi/Makefile @@ -32,7 +32,11 @@ define Package/uqmi/description endef TARGET_CFLAGS += \ - -I$(STAGING_DIR)/usr/include -ffunction-sections -fdata-sections + -I$(STAGING_DIR)/usr/include \ + -ffunction-sections \ + -fdata-sections \ + -Wno-error=dangling-pointer \ + -Wno-error=maybe-uninitialized TARGET_LDFLAGS += -Wl,--gc-sections diff --git a/package/qca/qca-ssdk/patches/0001-SSDK-config-add-kernel-5.10-5.15.patch b/package/qca/qca-ssdk/patches/0001-SSDK-config-add-kernel-5.10-5.15.patch index 057652e45..14fc12222 100644 --- a/package/qca/qca-ssdk/patches/0001-SSDK-config-add-kernel-5.10-5.15.patch +++ b/package/qca/qca-ssdk/patches/0001-SSDK-config-add-kernel-5.10-5.15.patch @@ -29,7 +29,7 @@ Signed-off-by: Robert Marko ifeq ($(KVER), 3.4.0) OS_VER=3_4 endif -@@ -123,7 +127,7 @@ endif +@@ -123,7 +131,7 @@ endif endif ifeq ($(ARCH), arm64) diff --git a/package/qca/qca-ssdk/patches/0005-add-kernel-5.4-support.patch b/package/qca/qca-ssdk/patches/0005-add-kernel-5.4-support.patch index 6b08b05ae..a18dacc33 100644 --- a/package/qca/qca-ssdk/patches/0005-add-kernel-5.4-support.patch +++ b/package/qca/qca-ssdk/patches/0005-add-kernel-5.4-support.patch @@ -1,6 +1,6 @@ --- a/app/nathelper/linux/lib/nat_helper_dt.c +++ b/app/nathelper/linux/lib/nat_helper_dt.c -@@ -721,7 +721,7 @@ napt_ct_counter_sync(a_uint32_t hw_index) +@@ -721,7 +721,7 @@ napt_ct_counter_sync(a_uint32_t hw_index } if (!test_bit(IPS_FIXED_TIMEOUT_BIT, &ct->status)) { @@ -9,7 +9,7 @@ } if((cct != NULL) && (napt_hw_get_by_index(&napt, hw_index) == 0)) -@@ -770,7 +770,7 @@ napt_ct_timer_update(a_uint32_t hw_index) +@@ -770,7 +770,7 @@ napt_ct_timer_update(a_uint32_t hw_index } if (!test_bit(IPS_FIXED_TIMEOUT_BIT, &ct->status)) { @@ -32,7 +32,7 @@ } int -@@ -85,7 +80,7 @@ napt_ct_aging_is_enable(uint32_t ct_addr) +@@ -85,7 +80,7 @@ napt_ct_aging_is_enable(uint32_t ct_addr ct = (struct nf_conn *)ct_addr; @@ -70,7 +70,7 @@ struct nf_conntrack_tuple_hash *h = NULL; struct nf_conn *ct = NULL; struct hlist_nulls_node *pos = (struct hlist_nulls_node *) (*iterate); -@@ -349,7 +342,7 @@ napt_ct_list_iterate(uint32_t *hash, uint32_t *iterate) +@@ -349,7 +342,7 @@ napt_ct_list_iterate(uint32_t *hash, uin if(pos == 0) { /*get head for list*/ diff --git a/package/qca/qca-ssdk/patches/0010-QSDK-config-Avoid-Werror-heroics.patch b/package/qca/qca-ssdk/patches/0010-QSDK-config-Avoid-Werror-heroics.patch new file mode 100644 index 000000000..1f926eee2 --- /dev/null +++ b/package/qca/qca-ssdk/patches/0010-QSDK-config-Avoid-Werror-heroics.patch @@ -0,0 +1,30 @@ +From ecd1e0c57fdf7f8916fa20f085e08bb4b6ba0396 Mon Sep 17 00:00:00 2001 +From: Alexandru Gagniuc +Date: Fri, 23 Sep 2022 08:21:13 -0500 +Subject: [PATCH 10/11] QSDK: config: Avoid -Werror heroics + +Trying to compile the QSDK with warnings as errors is a very brave +endeavor. It's also stupid as it doesn't work on ipq60xx: + + isisc_acl_prv.h:99: error: "FIELD_GET" redefined [-Werror] + 99 | #define FIELD_GET(reg, field, val) \ + | + +Instead of dealing with the braindead code, just disable Werror. + +Signed-off-by: Alexandru Gagniuc +--- + config | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/config ++++ b/config +@@ -132,7 +132,7 @@ endif + + ifeq ($(ARCH), arm64) + ifeq ($(KVER),$(filter 4.1% 4.4% 4.9% 5.4% 5.10% 5.15%,$(KVER))) +- CPU_CFLAG= -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -Werror -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -mcmodel=large ++ CPU_CFLAG= -DMODULE -Os -pipe -march=armv8-a -mcpu=cortex-a53+crypto -fno-caller-saves -fno-strict-aliasing -fno-common -Wno-format-security -Wno-pointer-sign -Wno-unused-but-set-variable -Wno-error=unused-result -Wno-error=maybe-uninitialized -Wno-error=array-bounds -mcmodel=large + endif + endif + diff --git a/package/qca/qca-ssdk/patches/0012-include-fix-compilation-error-for-parse_uci_option.patch b/package/qca/qca-ssdk/patches/0012-include-fix-compilation-error-for-parse_uci_option.patch index 01b8deda9..79b04f403 100644 --- a/package/qca/qca-ssdk/patches/0012-include-fix-compilation-error-for-parse_uci_option.patch +++ b/package/qca/qca-ssdk/patches/0012-include-fix-compilation-error-for-parse_uci_option.patch @@ -10,8 +10,6 @@ Signed-off-by: Ansuel Smith include/ref/ref_uci.h | 1 + 1 file changed, 1 insertion(+) -diff --git a/include/ref/ref_uci.h b/include/ref/ref_uci.h -index a42ea153..0906c5ba 100755 --- a/include/ref/ref_uci.h +++ b/include/ref/ref_uci.h @@ -19,6 +19,7 @@ @@ -22,6 +20,3 @@ index a42ea153..0906c5ba 100755 #if defined(IN_SWCONFIG) int --- -2.34.1 - diff --git a/package/system/fstools/Makefile b/package/system/fstools/Makefile index 3a82ecd11..a61d4bb5a 100644 --- a/package/system/fstools/Makefile +++ b/package/system/fstools/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2014-2022 OpenWrt.org +# Copyright (C) 2014-2015 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=fstools -PKG_RELEASE:=$(AUTORELEASE) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/fstools.git -PKG_MIRROR_HASH:=28be14a1e28fc62e80681e1b5e7f2435692ee326b66afcc1f3d158764df686d5 -PKG_SOURCE_DATE:=2022-11-10 -PKG_SOURCE_VERSION:=3affe9ea5098c8bb90111ce97d50ad976ef0c034 +PKG_MIRROR_HASH:=edda9151c73c1adfe369f5e315347344727a540ad57d3e2b41b9f57f9d4313fe +PKG_SOURCE_DATE:=2023-01-22 +PKG_SOURCE_VERSION:=1ea5855e980cd88766dd9f615e78e7dd6edfbb74 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 diff --git a/package/system/procd/Makefile b/package/system/procd/Makefile index 2eebe50a4..56aa9e0b3 100644 --- a/package/system/procd/Makefile +++ b/package/system/procd/Makefile @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=procd -PKG_RELEASE:=$(AUTORELEASE) +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/procd.git -PKG_MIRROR_HASH:=d60b4aa9d47d75e906dfd812528a1bc28e91f5af72a9d9275056b71b19d99f04 -PKG_SOURCE_DATE:=2022-11-10 -PKG_SOURCE_VERSION:=039b88f75367203e540009cc97603b1bce3fafa6 +PKG_MIRROR_HASH:=75a92c01ef85f41dc7e0b77ac35f464fbe45942af02ca6847516c4ebf574c4a4 +PKG_SOURCE_DATE:=2023-01-16 +PKG_SOURCE_VERSION:=190f13a75e67e0bdb662188da79b8be31e0aae01 CMAKE_INSTALL:=1 PKG_LICENSE:=GPL-2.0 diff --git a/package/system/urngd/Makefile b/package/system/urngd/Makefile index bfee18470..8350f7ceb 100644 --- a/package/system/urngd/Makefile +++ b/package/system/urngd/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=urngd -PKG_RELEASE:=2 +PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/urngd.git diff --git a/package/utils/busybox/Config-defaults.in b/package/utils/busybox/Config-defaults.in index abe6d5431..7b6cf9003 100644 --- a/package/utils/busybox/Config-defaults.in +++ b/package/utils/busybox/Config-defaults.in @@ -208,6 +208,15 @@ config BUSYBOX_DEFAULT_PASSWORD_MINLEN config BUSYBOX_DEFAULT_MD5_SMALL int default 1 +config BUSYBOX_DEFAULT_SHA1_SMALL + int + default 3 +config BUSYBOX_DEFAULT_SHA1_HWACCEL + bool + default y +config BUSYBOX_DEFAULT_SHA256_HWACCEL + bool + default y config BUSYBOX_DEFAULT_SHA3_SMALL int default 1 @@ -298,6 +307,15 @@ config BUSYBOX_DEFAULT_UNICODE_NEUTRAL_TABLE config BUSYBOX_DEFAULT_UNICODE_PRESERVE_BROKEN bool default n +config BUSYBOX_DEFAULT_LOOP_CONFIGURE + bool + default n +config BUSYBOX_DEFAULT_NO_LOOP_CONFIGURE + bool + default n +config BUSYBOX_DEFAULT_TRY_LOOP_CONFIGURE + bool + default y config BUSYBOX_DEFAULT_FEATURE_SEAMLESS_XZ bool default n @@ -860,6 +878,9 @@ config BUSYBOX_DEFAULT_TRUNCATE bool default y if TARGET_bcm53xx default n +config BUSYBOX_DEFAULT_TSORT + bool + default n config BUSYBOX_DEFAULT_TTY bool default n @@ -2162,6 +2183,9 @@ config BUSYBOX_DEFAULT_RUNLEVEL config BUSYBOX_DEFAULT_RX bool default n +config BUSYBOX_DEFAULT_SEEDRNG + bool + default n config BUSYBOX_DEFAULT_SETFATTR bool default n @@ -2174,6 +2198,9 @@ config BUSYBOX_DEFAULT_STRINGS config BUSYBOX_DEFAULT_TIME bool default y +config BUSYBOX_DEFAULT_TREE + bool + default n config BUSYBOX_DEFAULT_TS bool default n @@ -2682,6 +2709,9 @@ config BUSYBOX_DEFAULT_FEATURE_UDHCPC_SANITIZEOPT config BUSYBOX_DEFAULT_UDHCPC_DEFAULT_SCRIPT string default "/usr/share/udhcpc/default.script" +config BUSYBOX_DEFAULT_UDHCPC6_DEFAULT_SCRIPT + string + default "" config BUSYBOX_DEFAULT_UDHCPC6 bool default n @@ -3012,6 +3042,9 @@ config BUSYBOX_DEFAULT_ASH_PRINTF config BUSYBOX_DEFAULT_ASH_TEST bool default y +config BUSYBOX_DEFAULT_ASH_SLEEP + bool + default n config BUSYBOX_DEFAULT_ASH_HELP bool default n diff --git a/package/utils/busybox/Makefile b/package/utils/busybox/Makefile index 2861e7d2e..957327894 100644 --- a/package/utils/busybox/Makefile +++ b/package/utils/busybox/Makefile @@ -5,14 +5,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=busybox -PKG_VERSION:=1.35.0 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=1.36.0 +PKG_RELEASE:=1 PKG_FLAGS:=essential PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://www.busybox.net/downloads \ http://sources.buildroot.net -PKG_HASH:=faeeb244c35a348a334f4a59e44626ee870fb07b6884d68c10ae8bc19f83a694 +PKG_HASH:=542750c8af7cb2630e201780b4f99f3dcceeb06f505b479ec68241c1e6af61a5 PKG_BUILD_DEPENDS:=BUSYBOX_CONFIG_PAM:libpam PKG_BUILD_PARALLEL:=1 diff --git a/package/utils/busybox/config/coreutils/Config.in b/package/utils/busybox/config/coreutils/Config.in index 835ce7950..983740be6 100644 --- a/package/utils/busybox/config/coreutils/Config.in +++ b/package/utils/busybox/config/coreutils/Config.in @@ -653,7 +653,7 @@ config BUSYBOX_CONFIG_SORT sort is used to sort lines of text in specified files. config BUSYBOX_CONFIG_FEATURE_SORT_BIG - bool "Full SuSv3 compliant sort (support -ktcbdfiogM)" + bool "Full SuSv3 compliant sort (support -ktcbdfioghM)" default BUSYBOX_DEFAULT_FEATURE_SORT_BIG depends on BUSYBOX_CONFIG_SORT help @@ -851,6 +851,11 @@ config BUSYBOX_CONFIG_TRUNCATE help truncate truncates files to a given size. If a file does not exist, it is created unless told otherwise. +config BUSYBOX_CONFIG_TSORT + bool "tsort (0.7 kb)" + default BUSYBOX_DEFAULT_TSORT + help + tsort performs a topological sort. config BUSYBOX_CONFIG_TTY bool "tty (3.6 kb)" default BUSYBOX_DEFAULT_TTY diff --git a/package/utils/busybox/config/libbb/Config.in b/package/utils/busybox/config/libbb/Config.in index e050c4a91..b3a83b9b0 100644 --- a/package/utils/busybox/config/libbb/Config.in +++ b/package/utils/busybox/config/libbb/Config.in @@ -98,21 +98,47 @@ config BUSYBOX_CONFIG_MD5_SMALL default BUSYBOX_DEFAULT_MD5_SMALL # all "fast or small" options default to small range 0 3 help - Trade binary size versus speed for the md5sum algorithm. + Trade binary size versus speed for the md5 algorithm. Approximate values running uClibc and hashing linux-2.4.4.tar.bz2 were: - value user times (sec) text size (386) - 0 (fastest) 1.1 6144 - 1 1.4 5392 - 2 3.0 5088 - 3 (smallest) 5.1 4912 + value user times (sec) text size (386) + 0 (fastest) 1.1 6144 + 1 1.4 5392 + 2 3.0 5088 + 3 (smallest) 5.1 4912 + +config BUSYBOX_CONFIG_SHA1_SMALL + int "SHA1: Trade bytes for speed (0:fast, 3:slow)" + default BUSYBOX_DEFAULT_SHA1_SMALL # all "fast or small" options default to small + range 0 3 + help + Trade binary size versus speed for the sha1 algorithm. + With FEATURE_COPYBUF_KB=64: + throughput MB/s size of sha1_process_block64 + value 486 x86-64 486 x86-64 + 0 440 485 3481 3502 + 1 265 265 641 696 + 2,3 220 210 342 364 + +config BUSYBOX_CONFIG_SHA1_HWACCEL + bool "SHA1: Use hardware accelerated instructions if possible" + default BUSYBOX_DEFAULT_SHA1_HWACCEL + help + On x86, this adds ~590 bytes of code. Throughput + is about twice as fast as fully-unrolled generic code. + +config BUSYBOX_CONFIG_SHA256_HWACCEL + bool "SHA256: Use hardware accelerated instructions if possible" + default BUSYBOX_DEFAULT_SHA256_HWACCEL + help + On x86, this adds ~1k bytes of code. config BUSYBOX_CONFIG_SHA3_SMALL int "SHA3: Trade bytes for speed (0:fast, 1:slow)" default BUSYBOX_DEFAULT_SHA3_SMALL # all "fast or small" options default to small range 0 1 help - Trade binary size versus speed for the sha3sum algorithm. + Trade binary size versus speed for the sha3 algorithm. SHA3_SMALL=0 compared to SHA3_SMALL=1 (approximate): 64-bit x86: +270 bytes of code, 45% faster 32-bit x86: +450 bytes of code, 75% faster @@ -399,3 +425,25 @@ config BUSYBOX_CONFIG_UNICODE_PRESERVE_BROKEN For example, this means that entering 'l', 's', ' ', 0xff, [Enter] at shell prompt will list file named 0xff (single char name with char value 255), not file named '?'. + +choice + prompt "Use LOOP_CONFIGURE for losetup and loop mounts" + default BUSYBOX_CONFIG_TRY_LOOP_CONFIGURE + help + LOOP_CONFIGURE is added to Linux 5.8 + https://lwn.net/Articles/820408/ + This allows userspace to completely setup a loop device with a single + ioctl, removing the in-between state where the device can be partially + configured - eg the loop device has a backing file associated with it, + but is reading from the wrong offset. + +config BUSYBOX_CONFIG_LOOP_CONFIGURE + bool "use LOOP_CONFIGURE, needs kernel >= 5.8" + +config BUSYBOX_CONFIG_NO_LOOP_CONFIGURE + bool "use LOOP_SET_FD + LOOP_SET_STATUS" + +config BUSYBOX_CONFIG_TRY_LOOP_CONFIGURE + bool "try LOOP_CONFIGURE, fall back to LOOP_SET_FD + LOOP_SET_STATUS" + +endchoice diff --git a/package/utils/busybox/config/miscutils/Config.in b/package/utils/busybox/config/miscutils/Config.in index ecb83d964..e15e318fe 100644 --- a/package/utils/busybox/config/miscutils/Config.in +++ b/package/utils/busybox/config/miscutils/Config.in @@ -704,6 +704,13 @@ config BUSYBOX_CONFIG_RX default BUSYBOX_DEFAULT_RX help Receive files using the Xmodem protocol. +config BUSYBOX_CONFIG_SEEDRNG + bool "seedrng (1.3 kb)" + default BUSYBOX_DEFAULT_SEEDRNG + help + Seed the kernel RNG from seed files, meant to be called + once during startup, once during shutdown, and optionally + at some periodic interval in between. config BUSYBOX_CONFIG_SETFATTR bool "setfattr (3.7 kb)" default BUSYBOX_DEFAULT_SETFATTR @@ -727,6 +734,11 @@ config BUSYBOX_CONFIG_TIME The time command runs the specified program with the given arguments. When the command finishes, time writes a message to standard output giving timing statistics about this program run. +config BUSYBOX_CONFIG_TREE + bool "tree (0.6 kb)" + default BUSYBOX_DEFAULT_TREE + help + List files and directories in a tree structure. config BUSYBOX_CONFIG_TS bool "ts (450 bytes)" default BUSYBOX_DEFAULT_TS diff --git a/package/utils/busybox/config/networking/udhcp/Config.in b/package/utils/busybox/config/networking/udhcp/Config.in index ecfa283e2..6757f1efc 100644 --- a/package/utils/busybox/config/networking/udhcp/Config.in +++ b/package/utils/busybox/config/networking/udhcp/Config.in @@ -93,12 +93,17 @@ config BUSYBOX_CONFIG_FEATURE_UDHCPC_SANITIZEOPT config BUSYBOX_CONFIG_UDHCPC_DEFAULT_SCRIPT string "Absolute path to config script" default BUSYBOX_DEFAULT_UDHCPC_DEFAULT_SCRIPT - depends on BUSYBOX_CONFIG_UDHCPC || BUSYBOX_CONFIG_UDHCPC6 + depends on BUSYBOX_CONFIG_UDHCPC help This script is called after udhcpc receives an answer. See examples/udhcp for a working example. Normally it is safe to leave this untouched. +config BUSYBOX_CONFIG_UDHCPC6_DEFAULT_SCRIPT + string "Absolute path to config script for IPv6" + default BUSYBOX_DEFAULT_UDHCPC6_DEFAULT_SCRIPT + depends on BUSYBOX_CONFIG_UDHCPC6 + # udhcpc6 config is inserted here: config BUSYBOX_CONFIG_UDHCPC6 bool "udhcpc6 (21 kb)" diff --git a/package/utils/busybox/config/shell/Config.in b/package/utils/busybox/config/shell/Config.in index 2b0781210..a68e9114e 100644 --- a/package/utils/busybox/config/shell/Config.in +++ b/package/utils/busybox/config/shell/Config.in @@ -201,6 +201,11 @@ config BUSYBOX_CONFIG_ASH_TEST default BUSYBOX_DEFAULT_ASH_TEST depends on BUSYBOX_CONFIG_SHELL_ASH +config BUSYBOX_CONFIG_ASH_SLEEP + bool "sleep builtin" + default BUSYBOX_DEFAULT_ASH_SLEEP + depends on BUSYBOX_CONFIG_SHELL_ASH + config BUSYBOX_CONFIG_ASH_HELP bool "help builtin" default BUSYBOX_DEFAULT_ASH_HELP diff --git a/package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch b/package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch deleted file mode 100644 index 7dcb9dff3..000000000 --- a/package/utils/busybox/patches/001-CVE-2022-30065-awk-fix-use-after-free.patch +++ /dev/null @@ -1,42 +0,0 @@ -From e63d7cdfdac78c6fd27e9e63150335767592b85e Mon Sep 17 00:00:00 2001 -From: Natanael Copa -Date: Fri, 17 Jun 2022 17:45:34 +0200 -Subject: awk: fix use after free (CVE-2022-30065) - -fixes https://bugs.busybox.net/show_bug.cgi?id=14781 - -function old new delta -evaluate 3343 3357 +14 - -Signed-off-by: Natanael Copa -Signed-off-by: Denys Vlasenko ---- - editors/awk.c | 3 +++ - testsuite/awk.tests | 6 ++++++ - 2 files changed, 9 insertions(+) - ---- a/editors/awk.c -+++ b/editors/awk.c -@@ -3114,6 +3114,9 @@ static var *evaluate(node *op, var *res) - - case XC( OC_MOVE ): - debug_printf_eval("MOVE\n"); -+ /* make sure that we never return a temp var */ -+ if (L.v == TMPVAR0) -+ L.v = res; - /* if source is a temporary string, jusk relink it to dest */ - if (R.v == TMPVAR1 - && !(R.v->type & VF_NUMBER) ---- a/testsuite/awk.tests -+++ b/testsuite/awk.tests -@@ -469,4 +469,10 @@ testing 'awk printf %% prints one %' \ - "%\n" \ - '' '' - -+testing 'awk assign while test' \ -+ "awk '\$1==\$1=\"foo\" {print \$1}'" \ -+ "foo\n" \ -+ "" \ -+ "foo" -+ - exit $FAILCOUNT diff --git a/package/utils/ucode-mod-bpf/Makefile b/package/utils/ucode-mod-bpf/Makefile new file mode 100644 index 000000000..a748b9dbb --- /dev/null +++ b/package/utils/ucode-mod-bpf/Makefile @@ -0,0 +1,40 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=ucode-mod-bpf +PKG_RELEASE:=1 +PKG_LICENSE:=ISC +PKG_MAINTAINER:=Felix Fietkau + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/ucode-mod-bpf + SECTION:=utils + CATEGORY:=Utilities + TITLE:=ucode eBPF module + DEPENDS:=+libucode +libbpf +endef + +define Package/ucode-mod-bpf/description +The bpf plugin provides functionality for loading and interacting with +eBPF modules. + +It allows loading full modules and pinned maps/programs and supports +interacting with maps and attaching programs as tc classifiers. +endef + +define Package/ucode-mod-bpf/install + $(INSTALL_DIR) $(1)/usr/lib/ucode + $(CP) $(PKG_BUILD_DIR)/bpf.so $(1)/usr/lib/ucode/ +endef + +define Build/Configure +endef + +define Build/Compile + $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(FPIC) \ + -Wall -ffunction-sections -Wl,--gc-sections -shared -Wl,--no-as-needed -lbpf \ + -o $(PKG_BUILD_DIR)/bpf.so $(PKG_BUILD_DIR)/bpf.c +endef + +$(eval $(call BuildPackage,ucode-mod-bpf)) diff --git a/package/utils/ucode-mod-bpf/src/bpf.c b/package/utils/ucode-mod-bpf/src/bpf.c new file mode 100644 index 000000000..415215e54 --- /dev/null +++ b/package/utils/ucode-mod-bpf/src/bpf.c @@ -0,0 +1,814 @@ +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "ucode/module.h" + +#define err_return_int(err, ...) do { set_error(err, __VA_ARGS__); return -1; } while(0) +#define err_return(err, ...) do { set_error(err, __VA_ARGS__); return NULL; } while(0) +#define TRUE ucv_boolean_new(true) + +static uc_resource_type_t *module_type, *map_type, *map_iter_type, *program_type; +static uc_value_t *registry; +static uc_vm_t *debug_vm; + +static struct { + int code; + char *msg; +} last_error; + +struct uc_bpf_fd { + int fd; + bool close; +}; + +struct uc_bpf_map { + struct uc_bpf_fd fd; /* must be first */ + unsigned int key_size, val_size; +}; + +struct uc_bpf_map_iter { + int fd; + unsigned int key_size; + bool has_next; + uint8_t key[]; +}; + +__attribute__((format(printf, 2, 3))) static void +set_error(int errcode, const char *fmt, ...) +{ + va_list ap; + + free(last_error.msg); + + last_error.code = errcode; + last_error.msg = NULL; + + if (fmt) { + va_start(ap, fmt); + xvasprintf(&last_error.msg, fmt, ap); + va_end(ap); + } +} + +static void init_env(void) +{ + static bool init_done = false; + struct rlimit limit = { + .rlim_cur = RLIM_INFINITY, + .rlim_max = RLIM_INFINITY, + }; + + if (init_done) + return; + + setrlimit(RLIMIT_MEMLOCK, &limit); + init_done = true; +} + +static uc_value_t * +uc_bpf_error(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *numeric = uc_fn_arg(0); + const char *msg = last_error.msg; + int code = last_error.code; + uc_stringbuf_t *buf; + const char *s; + + if (last_error.code == 0) + return NULL; + + set_error(0, NULL); + + if (ucv_is_truish(numeric)) + return ucv_int64_new(code); + + buf = ucv_stringbuf_new(); + if (code < 0 && msg) { + ucv_stringbuf_addstr(buf, msg, strlen(msg)); + } else { + s = strerror(code); + ucv_stringbuf_addstr(buf, s, strlen(s)); + if (msg) + ucv_stringbuf_printf(buf, ": %s", msg); + } + + return ucv_stringbuf_finish(buf); +} + +static int +uc_bpf_module_set_opts(struct bpf_object *obj, uc_value_t *opts) +{ + uc_value_t *val; + + if (!opts) + return 0; + + if (ucv_type(opts) != UC_OBJECT) + err_return_int(EINVAL, "options argument"); + + if ((val = ucv_object_get(opts, "rodata", NULL)) != NULL) { + struct bpf_map *map = NULL; + + if (ucv_type(val) != UC_STRING) + err_return_int(EINVAL, "rodata type"); + + while ((map = bpf_object__next_map(obj, map)) != NULL) { + if (!strstr(bpf_map__name(map), ".rodata")) + continue; + + break; + } + + if (!map) + err_return_int(errno, "rodata map"); + + if (bpf_map__set_initial_value(map, ucv_string_get(val), + ucv_string_length(val))) + err_return_int(errno, "rodata"); + } + + if ((val = ucv_object_get(opts, "program-type", NULL)) != NULL) { + if (ucv_type(val) != UC_OBJECT) + err_return_int(EINVAL, "prog_types argument"); + + ucv_object_foreach(val, name, type) { + struct bpf_program *prog; + + if (ucv_type(type) != UC_INTEGER) + err_return_int(EINVAL, "program %s type", name); + + prog = bpf_object__find_program_by_name(obj, name); + if (!prog) + err_return_int(-1, "program %s not found", name); + + bpf_program__set_type(prog, ucv_int64_get(type)); + } + } + + return 0; +} + +static uc_value_t * +uc_bpf_open_module(uc_vm_t *vm, size_t nargs) +{ + DECLARE_LIBBPF_OPTS(bpf_object_open_opts, bpf_opts); + uc_value_t *path = uc_fn_arg(0); + uc_value_t *opts = uc_fn_arg(1); + struct bpf_object *obj; + + if (ucv_type(path) != UC_STRING) + err_return(EINVAL, "module path"); + + init_env(); + obj = bpf_object__open_file(ucv_string_get(path), &bpf_opts); + if (libbpf_get_error(obj)) + err_return(errno, NULL); + + if (uc_bpf_module_set_opts(obj, opts)) { + bpf_object__close(obj); + return NULL; + } + + if (bpf_object__load(obj)) { + bpf_object__close(obj); + err_return(errno, NULL); + } + + return uc_resource_new(module_type, obj); +} + +static uc_value_t * +uc_bpf_map_create(int fd, unsigned int key_size, unsigned int val_size, bool close) +{ + struct uc_bpf_map *uc_map; + + uc_map = xalloc(sizeof(*uc_map)); + uc_map->fd.fd = fd; + uc_map->key_size = key_size; + uc_map->val_size = val_size; + uc_map->fd.close = close; + + return uc_resource_new(map_type, uc_map); +} + +static uc_value_t * +uc_bpf_open_map(uc_vm_t *vm, size_t nargs) +{ + struct bpf_map_info info; + uc_value_t *path = uc_fn_arg(0); + __u32 len = sizeof(info); + int err; + int fd; + + if (ucv_type(path) != UC_STRING) + err_return(EINVAL, "module path"); + + fd = bpf_obj_get(ucv_string_get(path)); + if (fd < 0) + err_return(errno, NULL); + + err = bpf_obj_get_info_by_fd(fd, &info, &len); + if (err) { + close(fd); + err_return(errno, NULL); + } + + return uc_bpf_map_create(fd, info.key_size, info.value_size, true); +} + +static uc_value_t * +uc_bpf_open_program(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *path = uc_fn_arg(0); + struct uc_bpf_fd *f; + int fd; + + if (ucv_type(path) != UC_STRING) + err_return(EINVAL, "module path"); + + fd = bpf_obj_get(ucv_string_get(path)); + if (fd < 0) + err_return(errno, NULL); + + f = xalloc(sizeof(*f)); + f->fd = fd; + f->close = true; + + return uc_resource_new(program_type, f); +} + +static uc_value_t * +uc_bpf_module_get_maps(uc_vm_t *vm, size_t nargs) +{ + struct bpf_object *obj = uc_fn_thisval("bpf.module"); + struct bpf_map *map = NULL; + uc_value_t *rv; + int i = 0; + + if (!obj) + err_return(EINVAL, NULL); + + rv = ucv_array_new(vm); + bpf_object__for_each_map(map, obj) + ucv_array_set(rv, i++, ucv_string_new(bpf_map__name(map))); + + return rv; +} + +static uc_value_t * +uc_bpf_module_get_map(uc_vm_t *vm, size_t nargs) +{ + struct bpf_object *obj = uc_fn_thisval("bpf.module"); + struct bpf_map *map; + uc_value_t *name = uc_fn_arg(0); + int fd; + + if (!obj || ucv_type(name) != UC_STRING) + err_return(EINVAL, NULL); + + map = bpf_object__find_map_by_name(obj, ucv_string_get(name)); + if (!map) + err_return(errno, NULL); + + fd = bpf_map__fd(map); + if (fd < 0) + err_return(EINVAL, NULL); + + return uc_bpf_map_create(fd, bpf_map__key_size(map), bpf_map__value_size(map), false); +} + +static uc_value_t * +uc_bpf_module_get_programs(uc_vm_t *vm, size_t nargs) +{ + struct bpf_object *obj = uc_fn_thisval("bpf.module"); + struct bpf_program *prog = NULL; + uc_value_t *rv; + int i = 0; + + if (!obj) + err_return(EINVAL, NULL); + + rv = ucv_array_new(vm); + bpf_object__for_each_program(prog, obj) + ucv_array_set(rv, i++, ucv_string_new(bpf_program__name(prog))); + + return rv; +} + +static uc_value_t * +uc_bpf_module_get_program(uc_vm_t *vm, size_t nargs) +{ + struct bpf_object *obj = uc_fn_thisval("bpf.module"); + struct bpf_program *prog; + uc_value_t *name = uc_fn_arg(0); + struct uc_bpf_fd *f; + int fd; + + if (!obj || !name || ucv_type(name) != UC_STRING) + err_return(EINVAL, NULL); + + prog = bpf_object__find_program_by_name(obj, ucv_string_get(name)); + if (!prog) + err_return(errno, NULL); + + fd = bpf_program__fd(prog); + if (fd < 0) + err_return(EINVAL, NULL); + + f = xalloc(sizeof(*f)); + f->fd = fd; + + return uc_resource_new(program_type, f); +} + +static void * +uc_bpf_map_arg(uc_value_t *val, const char *kind, unsigned int size) +{ + static union { + uint32_t u32; + uint64_t u64; + } val_int; + + switch (ucv_type(val)) { + case UC_INTEGER: + if (size == 4) + val_int.u32 = ucv_int64_get(val); + else if (size == 8) + val_int.u64 = ucv_int64_get(val); + else + break; + + return &val_int; + case UC_STRING: + if (size != ucv_string_length(val)) + break; + + return ucv_string_get(val); + default: + err_return(EINVAL, "%s type", kind); + } + + err_return(EINVAL, "%s size mismatch (expected: %d)", kind, size); +} + +static uc_value_t * +uc_bpf_map_get(uc_vm_t *vm, size_t nargs) +{ + struct uc_bpf_map *map = uc_fn_thisval("bpf.map"); + uc_value_t *a_key = uc_fn_arg(0); + void *key, *val; + + if (!map) + err_return(EINVAL, NULL); + + key = uc_bpf_map_arg(a_key, "key", map->key_size); + if (!key) + return NULL; + + val = alloca(map->val_size); + if (bpf_map_lookup_elem(map->fd.fd, key, val)) + return NULL; + + return ucv_string_new_length(val, map->val_size); +} + +static uc_value_t * +uc_bpf_map_set(uc_vm_t *vm, size_t nargs) +{ + struct uc_bpf_map *map = uc_fn_thisval("bpf.map"); + uc_value_t *a_key = uc_fn_arg(0); + uc_value_t *a_val = uc_fn_arg(1); + uc_value_t *a_flags = uc_fn_arg(2); + uint64_t flags; + void *key, *val; + + if (!map) + err_return(EINVAL, NULL); + + key = uc_bpf_map_arg(a_key, "key", map->key_size); + if (!key) + return NULL; + + val = uc_bpf_map_arg(a_val, "value", map->val_size); + if (!val) + return NULL; + + if (!a_flags) + flags = BPF_ANY; + else if (ucv_type(a_flags) != UC_INTEGER) + err_return(EINVAL, "flags"); + else + flags = ucv_int64_get(a_flags); + + if (bpf_map_update_elem(map->fd.fd, key, val, flags)) + return NULL; + + return ucv_string_new_length(val, map->val_size); +} + +static uc_value_t * +uc_bpf_map_delete(uc_vm_t *vm, size_t nargs) +{ + struct uc_bpf_map *map = uc_fn_thisval("bpf.map"); + uc_value_t *a_key = uc_fn_arg(0); + uc_value_t *a_return = uc_fn_arg(1); + void *key, *val = NULL; + int ret; + + if (!map) + err_return(EINVAL, NULL); + + key = uc_bpf_map_arg(a_key, "key", map->key_size); + if (!key) + return NULL; + + if (!ucv_is_truish(a_return)) { + ret = bpf_map_delete_elem(map->fd.fd, key); + + return ucv_boolean_new(ret == 0); + } + + val = alloca(map->val_size); + if (bpf_map_lookup_and_delete_elem(map->fd.fd, key, val)) + return NULL; + + return ucv_string_new_length(val, map->val_size); +} + +static uc_value_t * +uc_bpf_map_delete_all(uc_vm_t *vm, size_t nargs) +{ + struct uc_bpf_map *map = uc_fn_thisval("bpf.map"); + uc_value_t *filter = uc_fn_arg(0); + bool has_next; + void *key, *next; + + if (!map) + err_return(EINVAL, NULL); + + key = alloca(map->key_size); + next = alloca(map->key_size); + has_next = !bpf_map_get_next_key(map->fd.fd, NULL, next); + while (has_next) { + bool skip = false; + + memcpy(key, next, map->key_size); + has_next = !bpf_map_get_next_key(map->fd.fd, next, next); + + if (ucv_is_callable(filter)) { + uc_value_t *rv; + + uc_value_push(ucv_get(filter)); + uc_value_push(ucv_string_new_length((const char *)key, map->key_size)); + if (uc_call(1) != EXCEPTION_NONE) + break; + + rv = uc_vm_stack_pop(vm); + if (!rv) + break; + + skip = !ucv_is_truish(rv); + ucv_put(rv); + } + + if (!skip) + bpf_map_delete_elem(map->fd.fd, key); + } + + return TRUE; +} + +static uc_value_t * +uc_bpf_map_iterator(uc_vm_t *vm, size_t nargs) +{ + struct uc_bpf_map *map = uc_fn_thisval("bpf.map"); + struct uc_bpf_map_iter *iter; + + if (!map) + err_return(EINVAL, NULL); + + iter = xalloc(sizeof(*iter) + map->key_size); + iter->fd = map->fd.fd; + iter->key_size = map->key_size; + iter->has_next = !bpf_map_get_next_key(iter->fd, NULL, &iter->key); + + return uc_resource_new(map_iter_type, iter); +} + +static uc_value_t * +uc_bpf_map_iter_next(uc_vm_t *vm, size_t nargs) +{ + struct uc_bpf_map_iter *iter = uc_fn_thisval("bpf.map_iter"); + uc_value_t *rv; + + if (!iter->has_next) + return NULL; + + rv = ucv_string_new_length((const char *)iter->key, iter->key_size); + iter->has_next = !bpf_map_get_next_key(iter->fd, &iter->key, &iter->key); + + return rv; +} + +static uc_value_t * +uc_bpf_map_iter_next_int(uc_vm_t *vm, size_t nargs) +{ + struct uc_bpf_map_iter *iter = uc_fn_thisval("bpf.map_iter"); + uint64_t intval; + uc_value_t *rv; + + if (!iter->has_next) + return NULL; + + if (iter->key_size == 4) + intval = *(uint32_t *)iter->key; + else if (iter->key_size == 8) + intval = *(uint64_t *)iter->key; + else + return NULL; + + rv = ucv_int64_new(intval); + iter->has_next = !bpf_map_get_next_key(iter->fd, &iter->key, &iter->key); + + return rv; +} + +static uc_value_t * +uc_bpf_map_foreach(uc_vm_t *vm, size_t nargs) +{ + struct uc_bpf_map *map = uc_fn_thisval("bpf.map"); + uc_value_t *func = uc_fn_arg(0); + bool has_next; + void *key, *next; + bool ret = false; + + key = alloca(map->key_size); + next = alloca(map->key_size); + has_next = !bpf_map_get_next_key(map->fd.fd, NULL, next); + + while (has_next) { + uc_value_t *rv; + bool stop; + + memcpy(key, next, map->key_size); + has_next = !bpf_map_get_next_key(map->fd.fd, next, next); + + uc_value_push(ucv_get(func)); + uc_value_push(ucv_string_new_length((const char *)key, map->key_size)); + + if (uc_call(1) != EXCEPTION_NONE) + break; + + rv = uc_vm_stack_pop(vm); + stop = (ucv_type(rv) == UC_BOOLEAN && !ucv_boolean_get(rv)); + ucv_put(rv); + + if (stop) + break; + + ret = true; + } + + return ucv_boolean_new(ret); +} + +static uc_value_t * +uc_bpf_obj_pin(uc_vm_t *vm, size_t nargs, const char *type) +{ + struct uc_bpf_fd *f = uc_fn_thisval(type); + uc_value_t *path = uc_fn_arg(0); + + if (ucv_type(path) != UC_STRING) + err_return(EINVAL, NULL); + + if (bpf_obj_pin(f->fd, ucv_string_get(path))) + err_return(errno, NULL); + + return TRUE; +} + +static uc_value_t * +uc_bpf_program_pin(uc_vm_t *vm, size_t nargs) +{ + return uc_bpf_obj_pin(vm, nargs, "bpf.program"); +} + +static uc_value_t * +uc_bpf_map_pin(uc_vm_t *vm, size_t nargs) +{ + return uc_bpf_obj_pin(vm, nargs, "bpf.map"); +} + +static uc_value_t * +uc_bpf_set_tc_hook(uc_value_t *ifname, uc_value_t *type, uc_value_t *prio, + int fd) +{ + DECLARE_LIBBPF_OPTS(bpf_tc_hook, hook); + DECLARE_LIBBPF_OPTS(bpf_tc_opts, attach_tc, + .handle = 1); + const char *type_str; + uint64_t prio_val; + + if (ucv_type(ifname) != UC_STRING || ucv_type(type) != UC_STRING || + ucv_type(prio) != UC_INTEGER) + err_return(EINVAL, NULL); + + prio_val = ucv_int64_get(prio); + if (prio_val > 0xffff) + err_return(EINVAL, NULL); + + type_str = ucv_string_get(type); + if (!strcmp(type_str, "ingress")) + hook.attach_point = BPF_TC_INGRESS; + else if (!strcmp(type_str, "egress")) + hook.attach_point = BPF_TC_EGRESS; + else + err_return(EINVAL, NULL); + + hook.ifindex = if_nametoindex(ucv_string_get(ifname)); + if (!hook.ifindex) + goto error; + + bpf_tc_hook_create(&hook); + attach_tc.priority = prio_val; + if (bpf_tc_detach(&hook, &attach_tc) < 0 && fd < 0) + goto error; + + if (fd < 0) + goto out; + + attach_tc.prog_fd = fd; + if (bpf_tc_attach(&hook, &attach_tc) < 0) + goto error; + +out: + return TRUE; + +error: + if (fd >= 0) + err_return(ENOENT, NULL); + return NULL; +} + +static uc_value_t * +uc_bpf_program_tc_attach(uc_vm_t *vm, size_t nargs) +{ + struct uc_bpf_fd *f = uc_fn_thisval("bpf.program"); + uc_value_t *ifname = uc_fn_arg(0); + uc_value_t *type = uc_fn_arg(1); + uc_value_t *prio = uc_fn_arg(2); + + if (!f) + err_return(EINVAL, NULL); + + return uc_bpf_set_tc_hook(ifname, type, prio, f->fd); +} + +static uc_value_t * +uc_bpf_tc_detach(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *ifname = uc_fn_arg(0); + uc_value_t *type = uc_fn_arg(1); + uc_value_t *prio = uc_fn_arg(2); + + return uc_bpf_set_tc_hook(ifname, type, prio, -1); +} + +static int +uc_bpf_debug_print(enum libbpf_print_level level, const char *format, + va_list args) +{ + char buf[256], *str = NULL; + uc_value_t *val; + va_list ap; + int size; + + va_copy(ap, args); + size = vsnprintf(buf, sizeof(buf), format, ap); + va_end(ap); + + if (size > 0 && (unsigned long)size < ARRAY_SIZE(buf) - 1) { + val = ucv_string_new(buf); + goto out; + } + + if (vasprintf(&str, format, args) < 0) + return 0; + + val = ucv_string_new(str); + free(str); + +out: + uc_vm_stack_push(debug_vm, ucv_get(ucv_array_get(registry, 0))); + uc_vm_stack_push(debug_vm, ucv_int64_new(level)); + uc_vm_stack_push(debug_vm, val); + if (uc_vm_call(debug_vm, false, 2) == EXCEPTION_NONE) + ucv_put(uc_vm_stack_pop(debug_vm)); + + return 0; +} + +static uc_value_t * +uc_bpf_set_debug_handler(uc_vm_t *vm, size_t nargs) +{ + uc_value_t *handler = uc_fn_arg(0); + + if (handler && !ucv_is_callable(handler)) + err_return(EINVAL, NULL); + + debug_vm = vm; + libbpf_set_print(handler ? uc_bpf_debug_print : NULL); + + ucv_array_set(registry, 0, ucv_get(handler)); + + return NULL; +} + +static void +register_constants(uc_vm_t *vm, uc_value_t *scope) +{ +#define ADD_CONST(x) ucv_object_add(scope, #x, ucv_int64_new(x)) + ADD_CONST(BPF_PROG_TYPE_SCHED_CLS); + ADD_CONST(BPF_PROG_TYPE_SCHED_ACT); + + ADD_CONST(BPF_ANY); + ADD_CONST(BPF_NOEXIST); + ADD_CONST(BPF_EXIST); + ADD_CONST(BPF_F_LOCK); +} + +static const uc_function_list_t module_fns[] = { + { "get_map", uc_bpf_module_get_map }, + { "get_maps", uc_bpf_module_get_maps }, + { "get_programs", uc_bpf_module_get_programs }, + { "get_program", uc_bpf_module_get_program }, +}; + +static void module_free(void *ptr) +{ + struct bpf_object *obj = ptr; + + bpf_object__close(obj); +} + +static const uc_function_list_t map_fns[] = { + { "pin", uc_bpf_map_pin }, + { "get", uc_bpf_map_get }, + { "set", uc_bpf_map_set }, + { "delete", uc_bpf_map_delete }, + { "delete_all", uc_bpf_map_delete_all }, + { "foreach", uc_bpf_map_foreach }, + { "iterator", uc_bpf_map_iterator }, +}; + +static void uc_bpf_fd_free(void *ptr) +{ + struct uc_bpf_fd *f = ptr; + + if (f->close) + close(f->fd); + free(f); +} + +static const uc_function_list_t map_iter_fns[] = { + { "next", uc_bpf_map_iter_next }, + { "next_int", uc_bpf_map_iter_next_int }, +}; + +static const uc_function_list_t prog_fns[] = { + { "pin", uc_bpf_program_pin }, + { "tc_attach", uc_bpf_program_tc_attach }, +}; + +static const uc_function_list_t global_fns[] = { + { "error", uc_bpf_error }, + { "set_debug_handler", uc_bpf_set_debug_handler }, + { "open_module", uc_bpf_open_module }, + { "open_map", uc_bpf_open_map }, + { "open_program", uc_bpf_open_program }, + { "tc_detach", uc_bpf_tc_detach }, +}; + +void uc_module_init(uc_vm_t *vm, uc_value_t *scope) +{ + uc_function_list_register(scope, global_fns); + register_constants(vm, scope); + + registry = ucv_array_new(vm); + uc_vm_registry_set(vm, "bpf.registry", registry); + + module_type = uc_type_declare(vm, "bpf.module", module_fns, module_free); + map_type = uc_type_declare(vm, "bpf.map", map_fns, uc_bpf_fd_free); + map_iter_type = uc_type_declare(vm, "bpf.map_iter", map_iter_fns, free); + program_type = uc_type_declare(vm, "bpf.program", prog_fns, uc_bpf_fd_free); +} diff --git a/package/utils/ucode/Makefile b/package/utils/ucode/Makefile index fafc44909..3913fd2aa 100644 --- a/package/utils/ucode/Makefile +++ b/package/utils/ucode/Makefile @@ -12,9 +12,9 @@ PKG_RELEASE:=1 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=https://github.com/jow-/ucode.git -PKG_SOURCE_DATE:=2022-12-02 -PKG_SOURCE_VERSION:=46d93c9cc5da6fce581df86159bd0fc4357de41c -PKG_MIRROR_HASH:=970a47f1bef719f056d40d17398db492bd4de92b98ef9aba4582cb18b4c9b270 +PKG_SOURCE_DATE:=2023-01-09 +PKG_SOURCE_VERSION:=8dad974baa4696fcba85837fa70cde8b68dd7c12 +PKG_MIRROR_HASH:=91494352ac298ac2735d62355837a1f18e366999c9e940613e6fa3265edc0364 PKG_MAINTAINER:=Jo-Philipp Wich PKG_LICENSE:=ISC diff --git a/package/utils/util-linux/Makefile b/package/utils/util-linux/Makefile index 706c3194b..21764a2d2 100644 --- a/package/utils/util-linux/Makefile +++ b/package/utils/util-linux/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=util-linux -PKG_VERSION:=2.38 -PKG_RELEASE:=$(AUTORELEASE) +PKG_VERSION:=2.38.1 +PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/utils/$(PKG_NAME)/v2.38 -PKG_HASH:=6d111cbe4d55b336db2f1fbeffbc65b89908704c01136371d32aa9bec373eb64 +PKG_HASH:=60492a19b44e6cf9a3ddff68325b333b8b52b6c59ce3ebd6a0ecaa4c5117e84f PKG_CPE_ID:=cpe:/a:kernel:util-linux PKG_LICENSE:=GPL-2.0-only diff --git a/package/utils/util-linux/patches/010-meson-typo.patch b/package/utils/util-linux/patches/010-meson-typo.patch deleted file mode 100644 index 466d942d5..000000000 --- a/package/utils/util-linux/patches/010-meson-typo.patch +++ /dev/null @@ -1,20 +0,0 @@ -From c387d4fe7a1435a762a5b7d8b75feb13ad613315 Mon Sep 17 00:00:00 2001 -From: Anatoly Pugachev -Date: Fri, 8 Apr 2022 15:34:16 +0300 -Subject: [PATCH] libfdisk: meson.build fix typo - ---- - libfdisk/meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/libfdisk/meson.build -+++ b/libfdisk/meson.build -@@ -11,7 +11,7 @@ libfdisk_h = configure_file( - output : 'libfdisk.h', - configuration : defs, - install : build_libfdisk, -- install_dir : join_paths(get_option('includedir'), 'libfisk'), -+ install_dir : join_paths(get_option('includedir'), 'libfdisk'), - ) - - lib_fdisk_sources = ''' diff --git a/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch b/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch deleted file mode 100644 index aa209994e..000000000 --- a/package/utils/util-linux/patches/020-meson-fix-compilation-without-systemd.patch +++ /dev/null @@ -1,22 +0,0 @@ -From 38b15ca2dc4ca32bbe4a2449e1c7b645e4577840 Mon Sep 17 00:00:00 2001 -From: Rosen Penev -Date: Fri, 29 Apr 2022 16:53:43 -0700 -Subject: [PATCH 1/7] meson: fix compilation without systemd - -systemdsystemunitdir is used elsewhere. - -Signed-off-by: Rosen Penev ---- - meson.build | 1 + - 1 file changed, 1 insertion(+) - ---- a/meson.build -+++ b/meson.build -@@ -720,6 +720,7 @@ if fs_search_path_extra != '' - endif - conf.set_quoted('FS_SEARCH_PATH', fs_search_path) - -+systemdsystemunitdir = '' - if systemd.found() - systemdsystemunitdir = systemd.get_pkgconfig_variable('systemdsystemunitdir') - endif diff --git a/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch b/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch deleted file mode 100644 index bba8baf5a..000000000 --- a/package/utils/util-linux/patches/110-meson-fix-when-HAVE_CLOCK_GETTIME-is-set.patch +++ /dev/null @@ -1,21 +0,0 @@ -From e51565b653cf09985df57cb7254b16d5af5df223 Mon Sep 17 00:00:00 2001 -From: Nicolas Caramelli -Date: Fri, 29 Apr 2022 18:16:36 +0200 -Subject: [PATCH] meson: fix when HAVE_CLOCK_GETTIME is set - -Signed-off-by: Nicolas Caramelli ---- - meson.build | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/meson.build -+++ b/meson.build -@@ -602,7 +602,7 @@ if not have - have = cc.has_function('clock_gettime', - dependencies : realtime_libs) - endif --conf.set('HAVE_CLOCK_GETTIME', have_dirfd ? 1 : false) -+conf.set('HAVE_CLOCK_GETTIME', have ? 1 : false) - - thread_libs = dependency('threads') - diff --git a/package/utils/zyxel-bootconfig/files/95_apply_bootconfig b/package/utils/zyxel-bootconfig/files/95_apply_bootconfig index c47857b08..500b81234 100644 --- a/package/utils/zyxel-bootconfig/files/95_apply_bootconfig +++ b/package/utils/zyxel-bootconfig/files/95_apply_bootconfig @@ -1,12 +1,10 @@ apply_bootconfig() { . /lib/functions.sh - local part - case $(board_name) in zyxel,nwa50ax|\ zyxel,nwa55axe) - mtd_idx=$(find_mtd_index "bootconfig") + mtd_idx=$(find_mtd_index "bootconfig") zyxel-bootconfig "/dev/mtd$mtd_idx" set-image-status 0 valid zyxel-bootconfig "/dev/mtd$mtd_idx" set-active-image 0 ;; diff --git a/rules.mk b/rules.mk index d53f673d4..3d151338a 100644 --- a/rules.mk +++ b/rules.mk @@ -156,8 +156,8 @@ BUILD_LOG_DIR:=$(if $(call qstrip,$(CONFIG_BUILD_LOG_DIR)),$(call qstrip,$(CONFI PKG_INFO_DIR := $(STAGING_DIR)/pkginfo BUILD_DIR_HOST:=$(if $(IS_PACKAGE_BUILD),$(BUILD_DIR_BASE)/hostpkg,$(BUILD_DIR_BASE)/host) -STAGING_DIR_HOST:=$(TOPDIR)/staging_dir/host -STAGING_DIR_HOSTPKG:=$(TOPDIR)/staging_dir/hostpkg +STAGING_DIR_HOST:=$(abspath $(STAGING_DIR)/../host) +STAGING_DIR_HOSTPKG:=$(abspath $(STAGING_DIR)/../hostpkg) TARGET_PATH:=$(subst $(space),:,$(filter-out .,$(filter-out ./,$(subst :,$(space),$(PATH))))) TARGET_INIT_PATH:=$(call qstrip,$(CONFIG_TARGET_INIT_PATH)) diff --git a/scripts/dl_github_archive.py b/scripts/dl_github_archive.py index b992227dc..328d588e7 100755 --- a/scripts/dl_github_archive.py +++ b/scripts/dl_github_archive.py @@ -133,7 +133,7 @@ class Path(object): def tar(path, subdir, into=None, ts=None): """Pack ``path`` into tarball ``into``.""" # --sort=name requires a recent build of GNU tar - args = ['tar', '--numeric-owner', '--owner=0', '--group=0', '--sort=name'] + args = ['tar', '--numeric-owner', '--owner=0', '--group=0', '--sort=name', '--mode=a-s'] args += ['-C', path, '-cf', into, subdir] envs = os.environ.copy() if ts is not None: diff --git a/scripts/ext-tools.sh b/scripts/ext-tools.sh index bf56f4d9e..b58296be1 100755 --- a/scripts/ext-tools.sh +++ b/scripts/ext-tools.sh @@ -5,16 +5,14 @@ HOST_BUILD_DIR=$(pwd)/"build_dir/host" HOST_STAGING_DIR_STAMP=$(pwd)/"staging_dir/host/stamp" refresh_timestamps() { - find "$1" -not -type l -print0 | xargs -0 touch + find -H "$1" -not -type l -print0 | xargs -0 touch } extract_prebuilt_tar() { tar -xf "$1" } -install_prebuilt_tools() { - extract_prebuilt_tar "$TOOLS_TAR" - +refresh_prebuilt_tools() { if [ ! -d "$HOST_BUILD_DIR" ]; then echo "Can't find Host Build Dir "$HOST_BUILD_DIR"" >&2 exit 1 @@ -33,6 +31,14 @@ install_prebuilt_tools() { return 0 } +install_prebuilt_tools() { + extract_prebuilt_tar "$TOOLS_TAR" + + refresh_prebuilt_tools + + return 0 +} + while [ -n "$1" ]; do arg="$1"; shift case "$arg" in @@ -63,6 +69,12 @@ while [ -n "$1" ]; do exit $? ;; + --refresh) + refresh_prebuilt_tools + + exit $? + ;; + -h|--help) me="$(basename "$0")" echo -e "\nUsage:\n" >&2 @@ -81,8 +93,12 @@ while [ -n "$1" ]; do echo -e " $me --tools {tar}" >&2 echo -e " Install the prebuilt tools present in the passed" >&2 echo -e " tar and prepare them." >&2 - echo -e " To correctly use them it's needed to update the." >&2 + echo -e " To correctly use them it's needed to update the" >&2 echo -e " timestamp of each tools to skip recompilation.\n" >&2 + echo -e " $me --refresh" >&2 + echo -e " Refresh timestamps of already extracted prebuilt" >&2 + echo -e " tools to correctly use them and skip" >&2 + echo -e " recompilation.\n" >&2 echo -e " $me --help" >&2 echo -e " Display this help text and exit.\n\n" >&2 exit 1 diff --git a/scripts/json_add_image_info.py b/scripts/json_add_image_info.py index 9aa2a19e4..0c441b933 100755 --- a/scripts/json_add_image_info.py +++ b/scripts/json_add_image_info.py @@ -21,7 +21,7 @@ if not file_path.is_file(): def get_titles(): titles = [] - for prefix in ["", "ALT0_", "ALT1_", "ALT2_"]: + for prefix in ["", "ALT0_", "ALT1_", "ALT2_", "ALT3_", "ALT4_"]: title = {} for var in ["vendor", "model", "variant"]: if getenv("DEVICE_{}{}".format(prefix, var.upper())): diff --git a/target/imagebuilder/files/Makefile b/target/imagebuilder/files/Makefile index 3329fe70a..275932577 100644 --- a/target/imagebuilder/files/Makefile +++ b/target/imagebuilder/files/Makefile @@ -35,8 +35,11 @@ Available Commands: info: Show a list of available target profiles clean: Remove images and temporary build files image: Build an image (see below for more information). + manifest: Show all package that will be installed into the image + package_whatdepends: Show which packages have a dependency on this + package_depends: Show installation dependency of the package -Building images: +image: By default 'make image' will create an image with the default target profile and package set. You can use the following parameters to change that: @@ -49,7 +52,7 @@ Building images: make image DISABLED_SERVICES=" [ [ ..]]" # Which services in /etc/init.d/ should be disabled make image ADD_LOCAL_KEY=1 # store locally generated signing key in built images -Print manifest: +manifest: List "all" packages which get installed into the image. You can use the following parameters: @@ -57,6 +60,19 @@ Print manifest: make manifest PACKAGES=" [ [ ...]]" # include extra packages make manifest STRIP_ABI=1 # remove ABI version from printed package names + +package_whatdepends: + List "all" packages that have a dependency on this package + You can use the following parameters: + + make package_whatdepends PACKAGE="" + +package_depends: + List "all" packages dependency of the package + You can use the following parameters: + + make package_depends PACKAGE="" + endef $(eval $(call shexport,Helptext)) @@ -255,7 +271,7 @@ manifest: FORCE $(if $(PROFILE),USER_PROFILE="$(PROFILE_FILTER)") \ $(if $(PACKAGES),USER_PACKAGES="$(PACKAGES)")) -whatdepends: FORCE +package_whatdepends: FORCE ifeq ($(PACKAGE),) @echo 'Variable `PACKAGE` is not set but required by `whatdepends`' @exit 1 @@ -263,4 +279,13 @@ endif @$(MAKE) -s package_reload @$(OPKG) whatdepends -A $(PACKAGE) -.SILENT: help info image manifest whatdepends +package_depends: FORCE +ifeq ($(PACKAGE),) + @echo 'Variable `PACKAGE` is not set but required by `package_depends`' + @exit 1 +endif + @$(MAKE) -s package_reload + @$(OPKG) depends -A $(PACKAGE) + + +.SILENT: help info image manifest package_whatdepends package_depends diff --git a/target/linux/Makefile b/target/linux/Makefile index a939d42bc..8eea40ee1 100644 --- a/target/linux/Makefile +++ b/target/linux/Makefile @@ -8,4 +8,4 @@ include $(INCLUDE_DIR)/target.mk export TARGET_BUILD=1 prereq clean download prepare compile install oldconfig menuconfig nconfig xconfig update refresh: FORCE - @+$(NO_TRACE_MAKE) -C $(BOARD) $@ + @+$(NO_TRACE_MAKE) -C $(firstword $(wildcard feeds/$(BOARD) $(BOARD))) $@ diff --git a/target/linux/ipq807x/Makefile b/target/linux/ipq807x/Makefile index 697ad9217..4fad49310 100644 --- a/target/linux/ipq807x/Makefile +++ b/target/linux/ipq807x/Makefile @@ -3,7 +3,7 @@ include $(TOPDIR)/rules.mk ARCH:=aarch64 BOARD:=ipq807x BOARDNAME:=Qualcomm Atheros IPQ807x -FEATURES:=squashfs ramdisk fpu nand source-only +FEATURES:=squashfs ramdisk fpu nand rtc emmc KERNELNAME:=Image dtbs CPU_TYPE:=cortex-a53 SUBTARGETS:=generic diff --git a/toolchain/binutils/Config.in b/toolchain/binutils/Config.in index 7fe797a5a..dbcaf4afc 100644 --- a/toolchain/binutils/Config.in +++ b/toolchain/binutils/Config.in @@ -17,6 +17,10 @@ choice config BINUTILS_USE_VERSION_2_39 bool "Binutils 2.39" select BINUTILS_VERSION_2_39 + + config BINUTILS_USE_VERSION_2_40 + bool "Binutils 2.40" + select BINUTILS_VERSION_2_40 endchoice config EXTRA_BINUTILS_CONFIG_OPTIONS diff --git a/toolchain/binutils/Config.version b/toolchain/binutils/Config.version index eac97877f..479a8459f 100644 --- a/toolchain/binutils/Config.version +++ b/toolchain/binutils/Config.version @@ -9,8 +9,12 @@ config BINUTILS_VERSION_2_39 default y if !TOOLCHAINOPTS bool +config BINUTILS_VERSION_2_40 + bool + config BINUTILS_VERSION string default "2.37" if BINUTILS_VERSION_2_37 default "2.38" if BINUTILS_VERSION_2_38 default "2.39" if BINUTILS_VERSION_2_39 + default "2.40" if BINUTILS_VERSION_2_40 diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index 554388296..cf65e83e6 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -27,6 +27,10 @@ ifeq ($(PKG_VERSION),2.39) PKG_HASH:=645c25f563b8adc0a81dbd6a41cffbf4d37083a382e02d5d3df4f65c09516d00 endif +ifeq ($(PKG_VERSION),2.40) + PKG_HASH:=0f8a4c272d7f17f369ded10a4aca28b8e304828e95526da482b0ccc4dfc9d8e1 +endif + HOST_BUILD_PARALLEL:=1 PATCH_DIR:=./patches/$(PKG_VERSION) diff --git a/toolchain/binutils/patches/2.40/300-001_ld_makefile_patch.patch b/toolchain/binutils/patches/2.40/300-001_ld_makefile_patch.patch new file mode 100644 index 000000000..2dafd92a0 --- /dev/null +++ b/toolchain/binutils/patches/2.40/300-001_ld_makefile_patch.patch @@ -0,0 +1,22 @@ +--- a/ld/Makefile.am ++++ b/ld/Makefile.am +@@ -50,7 +50,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + + EMUL = @EMUL@ + EMULATION_OFILES = @EMULATION_OFILES@ +--- a/ld/Makefile.in ++++ b/ld/Makefile.in +@@ -573,7 +573,7 @@ AM_CFLAGS = $(WARN_CFLAGS) $(ELF_CLFAGS) + # We put the scripts in the directory $(scriptdir)/ldscripts. + # We can't put the scripts in $(datadir) because the SEARCH_DIR + # directives need to be different for native and cross linkers. +-scriptdir = $(tooldir)/lib ++scriptdir = $(libdir) + BASEDIR = $(srcdir)/.. + BFDDIR = $(BASEDIR)/bfd + INCDIR = $(BASEDIR)/include diff --git a/toolchain/binutils/patches/2.40/400-mips_no_dynamic_linking_sym.patch b/toolchain/binutils/patches/2.40/400-mips_no_dynamic_linking_sym.patch new file mode 100644 index 000000000..aeb5a993a --- /dev/null +++ b/toolchain/binutils/patches/2.40/400-mips_no_dynamic_linking_sym.patch @@ -0,0 +1,18 @@ +--- a/bfd/elfxx-mips.c ++++ b/bfd/elfxx-mips.c +@@ -8119,6 +8119,7 @@ _bfd_mips_elf_create_dynamic_sections (b + + name = SGI_COMPAT (abfd) ? "_DYNAMIC_LINK" : "_DYNAMIC_LINKING"; + bh = NULL; ++ if (0) { + if (!(_bfd_generic_link_add_one_symbol + (info, abfd, name, BSF_GLOBAL, bfd_abs_section_ptr, 0, + NULL, false, get_elf_backend_data (abfd)->collect, &bh))) +@@ -8131,6 +8132,7 @@ _bfd_mips_elf_create_dynamic_sections (b + + if (! bfd_elf_link_record_dynamic_symbol (info, h)) + return false; ++ } + + if (! mips_elf_hash_table (info)->use_rld_obj_head) + { diff --git a/toolchain/binutils/patches/2.40/500-Change-default-emulation-for-mips64-linux.patch b/toolchain/binutils/patches/2.40/500-Change-default-emulation-for-mips64-linux.patch new file mode 100644 index 000000000..14a18a1d8 --- /dev/null +++ b/toolchain/binutils/patches/2.40/500-Change-default-emulation-for-mips64-linux.patch @@ -0,0 +1,38 @@ +--- a/bfd/config.bfd ++++ b/bfd/config.bfd +@@ -944,12 +944,12 @@ case "${targ}" in + targ_selvecs="mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_be_vec mips_ecoff_le_vec" + ;; + mips64*el-*-linux*) +- targ_defvec=mips_elf32_ntrad_le_vec +- targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_le_vec mips_elf64_trad_be_vec" ++ targ_defvec=mips_elf64_trad_le_vec ++ targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_ntrad_be_vec mips_elf32_trad_le_vec mips_elf32_trad_be_vec mips_elf64_trad_be_vec" + ;; + mips64*-*-linux*) +- targ_defvec=mips_elf32_ntrad_be_vec +- targ_selvecs="mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec" ++ targ_defvec=mips_elf64_trad_be_vec ++ targ_selvecs="mips_elf32_ntrad_be_vec mips_elf32_ntrad_le_vec mips_elf32_trad_be_vec mips_elf32_trad_le_vec mips_elf64_trad_le_vec" + ;; + mips*el-*-linux*) + targ_defvec=mips_elf32_trad_le_vec +--- a/ld/configure.tgt ++++ b/ld/configure.tgt +@@ -585,12 +585,12 @@ mips*-*-vxworks*) targ_emul=elf32ebmipvx + ;; + mips*-*-windiss) targ_emul=elf32mipswindiss + ;; +-mips64*el-*-linux-*) targ_emul=elf32ltsmipn32 +- targ_extra_emuls="elf32btsmipn32 elf32ltsmip elf32btsmip elf64ltsmip elf64btsmip" ++mips64*el-*-linux-*) targ_emul=elf64ltsmip ++ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32ltsmip elf32btsmip elf64btsmip" + targ_extra_libpath=$targ_extra_emuls + ;; +-mips64*-*-linux-*) targ_emul=elf32btsmipn32 +- targ_extra_emuls="elf32ltsmipn32 elf32btsmip elf32ltsmip elf64btsmip elf64ltsmip" ++mips64*-*-linux-*) targ_emul=elf64btsmip ++ targ_extra_emuls="elf32btsmipn32 elf32ltsmipn32 elf32btsmip elf32ltsmip elf64ltsmip" + targ_extra_libpath=$targ_extra_emuls + ;; + mips*el-*-linux-*) targ_emul=elf32ltsmip diff --git a/toolchain/gcc/Config.in b/toolchain/gcc/Config.in index 8a31bf0d2..921e84067 100644 --- a/toolchain/gcc/Config.in +++ b/toolchain/gcc/Config.in @@ -3,7 +3,7 @@ choice prompt "GCC compiler Version" if TOOLCHAINOPTS default GCC_USE_VERSION_8 if mips || mipsel || mips64 || mips64el - default GCC_USE_VERSION_11 + default GCC_USE_VERSION_12 help Select the version of gcc you wish to use. diff --git a/toolchain/gcc/Config.version b/toolchain/gcc/Config.version index da915851a..50af279d8 100644 --- a/toolchain/gcc/Config.version +++ b/toolchain/gcc/Config.version @@ -3,12 +3,12 @@ config GCC_VERSION_8 default y if mips || mipsel || mips64 || mips64el bool -config GCC_VERSION_12 - default y if GCC_USE_VERSION_12 +config GCC_VERSION_11 + default y if GCC_USE_VERSION_11 bool config GCC_VERSION string default "8.4.0" if GCC_VERSION_8 - default "12.2.0" if GCC_VERSION_12 - default "11.3.0" + default "11.3.0" if GCC_VERSION_11 + default "12.2.0" diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk index 1a4a849e4..8cb21b50d 100644 --- a/toolchain/gcc/common.mk +++ b/toolchain/gcc/common.mk @@ -76,7 +76,7 @@ ifdef CONFIG_INSTALL_GCCGO endif ifdef CONFIG_GCC_USE_GRAPHITE - GRAPHITE_CONFIGURE:= --with-isl=$(TOPDIR)/staging_dir/host + GRAPHITE_CONFIGURE:= --with-isl=$(STAGING_DIR_HOST) else GRAPHITE_CONFIGURE:= --without-isl --without-cloog endif @@ -110,9 +110,9 @@ GCC_CONFIGURE:= \ --with-abi=$(call qstrip,$(CONFIG_MIPS64_ABI))) \ $(if $(CONFIG_arc),--with-cpu=$(CONFIG_CPU_TYPE)) \ $(if $(CONFIG_powerpc64), $(if $(CONFIG_USE_MUSL),--with-abi=elfv2)) \ - --with-gmp=$(TOPDIR)/staging_dir/host \ - --with-mpfr=$(TOPDIR)/staging_dir/host \ - --with-mpc=$(TOPDIR)/staging_dir/host \ + --with-gmp=$(STAGING_DIR_HOST) \ + --with-mpfr=$(STAGING_DIR_HOST) \ + --with-mpc=$(STAGING_DIR_HOST) \ --disable-decimal-float \ --with-diagnostics-color=auto-if-env \ --enable-__cxa_atexit \ @@ -181,7 +181,7 @@ define Host/SetToolchainInfo $(SED) 's,GCC_VERSION=.*,GCC_VERSION=$(GCC_VERSION),' $(TOOLCHAIN_DIR)/info.mk endef -ifdef CONFIG_GCC_USE_VERSION_12 +ifeq ($(GCC_MAJOR_VERSION),12) GCC_VERSION_FILE:=gcc/genversion.cc else GCC_VERSION_FILE:=gcc/version.c diff --git a/toolchain/gcc/final/Makefile b/toolchain/gcc/final/Makefile index 0315b9d1f..049ddf61f 100644 --- a/toolchain/gcc/final/Makefile +++ b/toolchain/gcc/final/Makefile @@ -9,7 +9,7 @@ GCC_CONFIGURE += \ --enable-threads \ --with-slibdir=$(TOOLCHAIN_DIR)/lib \ --enable-lto \ - --with-libelf=$(TOPDIR)/staging_dir/host + --with-libelf=$(STAGING_DIR_HOST) ifndef CONFIG_USE_GLIBC GCC_CONFIGURE += --disable-libsanitizer diff --git a/toolchain/gdb/Makefile b/toolchain/gdb/Makefile index 4587c591f..70a4fa590 100644 --- a/toolchain/gdb/Makefile +++ b/toolchain/gdb/Makefile @@ -30,10 +30,10 @@ HOST_CONFIGURE_ARGS = \ --build=$(GNU_HOST_NAME) \ --host=$(GNU_HOST_NAME) \ --target=$(REAL_GNU_TARGET_NAME) \ - --with-gmp=$(TOPDIR)/staging_dir/host \ - --with-mpfr=$(TOPDIR)/staging_dir/host \ - --with-mpc=$(TOPDIR)/staging_dir/host \ - --with-expat=$(TOPDIR)/staging_dir/host \ + --with-gmp=$(STAGING_DIR_HOST) \ + --with-mpfr=$(STAGING_DIR_HOST) \ + --with-mpc=$(STAGING_DIR_HOST) \ + --with-expat=$(STAGING_DIR_HOST) \ --disable-werror \ --without-uiout \ --enable-tui --disable-gdbtk --without-x \ diff --git a/toolchain/musl/patches/800-mips_pie_debug.patch b/toolchain/musl/patches/800-mips_pie_debug.patch new file mode 100644 index 000000000..80fe15e84 --- /dev/null +++ b/toolchain/musl/patches/800-mips_pie_debug.patch @@ -0,0 +1,61 @@ +Fix DT_DEBUG handling on MIPS in musl libc. +With this change gdb will load the symbol files for shared libraries on MIPS too. + +This patch was taken from this thread: https://www.openwall.com/lists/musl/2022/01/09/4 + +--- a/arch/mips/reloc.h ++++ b/arch/mips/reloc.h +@@ -29,6 +29,7 @@ + + #define NEED_MIPS_GOT_RELOCS 1 + #define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP ++#define DT_DEBUG_INDIRECT_REL DT_MIPS_RLD_MAP_REL + #define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT)) + + #define CRTJMP(pc,sp) __asm__ __volatile__( \ +--- a/arch/mips64/reloc.h ++++ b/arch/mips64/reloc.h +@@ -38,6 +38,7 @@ + + #define NEED_MIPS_GOT_RELOCS 1 + #define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP ++#define DT_DEBUG_INDIRECT_REL DT_MIPS_RLD_MAP_REL + #define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT)) + + #define CRTJMP(pc,sp) __asm__ __volatile__( \ +--- a/arch/mipsn32/reloc.h ++++ b/arch/mipsn32/reloc.h +@@ -29,6 +29,7 @@ + + #define NEED_MIPS_GOT_RELOCS 1 + #define DT_DEBUG_INDIRECT DT_MIPS_RLD_MAP ++#define DT_DEBUG_INDIRECT_REL DT_MIPS_RLD_MAP_REL + #define ARCH_SYM_REJECT_UND(s) (!((s)->st_other & STO_MIPS_PLT)) + + #define CRTJMP(pc,sp) __asm__ __volatile__( \ +--- a/ldso/dynlink.c ++++ b/ldso/dynlink.c +@@ -1923,6 +1923,10 @@ void __dls3(size_t *sp, size_t *auxv) + size_t *ptr = (size_t *) app.dynv[i+1]; + *ptr = (size_t)&debug; + } ++ if (app.dynv[i]==DT_DEBUG_INDIRECT_REL) { ++ size_t *ptr = (size_t *)((size_t)&app.dynv[i] + app.dynv[i+1]); ++ *ptr = (size_t)&debug; ++ } + } + + /* This must be done before final relocations, since it calls +--- a/src/internal/dynlink.h ++++ b/src/internal/dynlink.h +@@ -92,6 +92,10 @@ struct fdpic_dummy_loadmap { + #define DT_DEBUG_INDIRECT 0 + #endif + ++#ifndef DT_DEBUG_INDIRECT_REL ++#define DT_DEBUG_INDIRECT_REL 0 ++#endif ++ + #define AUX_CNT 32 + #define DYN_CNT 32 + diff --git a/toolchain/nasm/Makefile b/toolchain/nasm/Makefile index f733c5291..64bb5e775 100644 --- a/toolchain/nasm/Makefile +++ b/toolchain/nasm/Makefile @@ -5,12 +5,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=nasm -PKG_VERSION:=2.15.05 +PKG_VERSION:=2.16.01 PKG_SOURCE_URL:=https://www.nasm.us/pub/nasm/releasebuilds/$(PKG_VERSION)/ PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz - -PKG_HASH:=3caf6729c1073bf96629b57cee31eeb54f4f8129b01902c73428836550b30a3f +PKG_HASH:=c77745f4802375efeee2ec5c0ad6b7f037ea9c87c92b149a9637ff099f162558 HOST_BUILD_PARALLEL:=1 diff --git a/tools/Makefile b/tools/Makefile index c7c7d0075..7b3a8eb14 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -20,6 +20,12 @@ endif ifneq ($(CONFIG_SDK)$(CONFIG_PACKAGE_kmod-b43)$(CONFIG_BRCMSMAC_USE_FW_FROM_WL),) BUILD_B43_TOOLS = y endif +ifneq ($(CONFIG_SDK)$(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZ4),) + BUILD_LZ4_TOOLS = y +endif +ifneq ($(CONFIG_SDK)$(CONFIG_TARGET_INITRAMFS_COMPRESSION_LZO),) + BUILD_LZO_TOOLS = y +endif tools-y += autoconf tools-y += autoconf-archive @@ -36,7 +42,6 @@ tools-y += findutils tools-y += firmware-utils tools-y += flex tools-y += gengetopt -tools-y += libdeflate tools-y += libressl tools-y += libtool tools-y += lzma @@ -59,8 +64,11 @@ tools-y += sstrip tools-y += zip tools-y += zlib tools-y += zstd +tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS),y) += liblzo tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_B43_TOOLS),y) += b43-tools tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_ISL),y) += isl +tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_LZ4_TOOLS),y) += lz4 +tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_LZO_TOOLS),y) += lzop tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(BUILD_TOOLCHAIN),y) += gmp mpc mpfr tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_apm821xx)$(CONFIG_TARGET_gemini),y) += genext2fs tools-$(if $(CONFIG_BUILD_ALL_HOST_TOOLS)$(CONFIG_TARGET_ath79),y) += lzma-old squashfs @@ -89,10 +97,11 @@ $(curdir)/genext2fs/compile := $(curdir)/libtool/compile $(curdir)/gengetopt/compile := $(curdir)/libtool/compile $(curdir)/gmp/compile := $(curdir)/libtool/compile $(curdir)/isl/compile := $(curdir)/gmp/compile -$(curdir)/libdeflate/compile := $(curdir)/cmake/compile +$(curdir)/liblzo/compile := $(curdir)/cmake/compile $(curdir)/libressl/compile := $(curdir)/pkgconf/compile $(curdir)/libtool/compile := $(curdir)/automake/compile $(curdir)/missing-macros/compile $(curdir)/lzma-old/compile := $(curdir)/zlib/compile +$(curdir)/lzop/compile := $(curdir)/cmake/compile $(curdir)/liblzo/compile $(curdir)/llvm-bpf/compile := $(curdir)/cmake/compile $(curdir)/make-ext4fs/compile := $(curdir)/zlib/compile $(curdir)/meson/compile := $(curdir)/ninja/compile @@ -136,8 +145,11 @@ $(foreach tool, $(tools-y), $(if $(wildcard $(curdir)/$(tool)/patches),$(eval $( $(foreach tool, $(filter-out xz,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/xz/compile)) -# make any tool depend on tar, xz and patch to ensure that archives can be unpacked and patched properly -tools-core := tar xz patch +# make any tool depend on the following to ensure that archives can be unpacked and patched properly +tools-core += libdeflate +tools-core += patch +tools-core += tar +tools-core += xz $(foreach tool, $(tools-y), $(eval $(curdir)/$(tool)/compile += $(patsubst %,$(curdir)/%/compile,$(tools-core)))) tools-y += $(tools-core) diff --git a/tools/autoconf/patches/000-relocatable.patch b/tools/autoconf/patches/000-relocatable.patch index 12e94ae9a..a935671ce 100644 --- a/tools/autoconf/patches/000-relocatable.patch +++ b/tools/autoconf/patches/000-relocatable.patch @@ -6,7 +6,7 @@ { - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; + my $pkgdatadir = $ENV{'autom4te_perllibdir'} || -+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@'); ++ ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@'); unshift @INC, "$pkgdatadir"; # Override SHELL. On DJGPP SHELL may not be set to a shell @@ -15,7 +15,7 @@ # Lib files. -my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; -+my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autom4te-name@' : '@bindir@/@autom4te-name@'); ++my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/@autom4te-name@' : '@bindir@/@autom4te-name@'); local $config_h; my $config_h_in; my @prepend_include; @@ -41,7 +41,7 @@ { - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; + my $pkgdatadir = $ENV{'autom4te_perllibdir'} || -+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@'); ++ ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@'); unshift @INC, $pkgdatadir; # Override SHELL. On DJGPP SHELL may not be set to a shell @@ -51,7 +51,7 @@ # Data directory. -my $pkgdatadir = $ENV{'AC_MACRODIR'} || '@pkgdatadir@'; +my $pkgdatadir = $ENV{'AC_MACRODIR'} || -+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@'); ++ ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@'); # $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE. my %language; @@ -60,7 +60,7 @@ # $M4. -my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/m4' : '@M4@'); ++my $m4 = $ENV{"M4"} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/m4' : '@M4@'); # Some non-GNU m4's don't reject the --help option, so give them /dev/null. fatal "need GNU m4 1.4 or later: $m4" if system "$m4 --help &1 | grep reload-state >/dev/null"; @@ -69,9 +69,9 @@ my @words = shellwords ($_); my $type = shift @words; + -+ if ($ENV{'STAGING_DIR'}) ++ if ($ENV{'STAGING_DIR_HOST'}) + { -+ @words = map { s!^@pkgdatadir@!$ENV{'STAGING_DIR'}/../host/share/autoconf!; $_ } @words; ++ @words = map { s!^@pkgdatadir@!$ENV{'STAGING_DIR_HOST'}/share/autoconf!; $_ } @words; + } + if ($type eq 'begin-language:') @@ -99,7 +99,7 @@ { - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; + my $pkgdatadir = $ENV{'autom4te_perllibdir'} || -+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@'); ++ ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@'); unshift @INC, $pkgdatadir; # Override SHELL. On DJGPP SHELL may not be set to a shell @@ -110,9 +110,9 @@ -my $autoconf = $ENV{'AUTOCONF'} || '@bindir@/@autoconf-name@'; -my $autoheader = $ENV{'AUTOHEADER'} || '@bindir@/@autoheader-name@'; -my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; -+my $autoconf = $ENV{'AUTOCONF'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autoconf-name@' : '@bindir@/@autoconf-name@'); -+my $autoheader = $ENV{'AUTOHEADER'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autoheader-name@' : '@bindir@/@autoheader-name@'); -+my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autom4te-name@' : '@bindir@/@autom4te-name@'); ++my $autoconf = $ENV{'AUTOCONF'} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/@autoconf-name@' : '@bindir@/@autoconf-name@'); ++my $autoheader = $ENV{'AUTOHEADER'} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/@autoheader-name@' : '@bindir@/@autoheader-name@'); ++my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/@autom4te-name@' : '@bindir@/@autom4te-name@'); my $automake = $ENV{'AUTOMAKE'} || 'automake'; my $aclocal = $ENV{'ACLOCAL'} || 'aclocal'; my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize'; @@ -134,7 +134,7 @@ { - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; + my $pkgdatadir = $ENV{'autom4te_perllibdir'} || -+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@'); ++ ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@'); unshift @INC, $pkgdatadir; # Override SHELL. On DJGPP SHELL may not be set to a shell @@ -143,11 +143,11 @@ # Autoconf and lib files. -my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; -+my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/@autom4te-name@' : '@bindir@/@autom4te-name@'); ++my $autom4te = $ENV{'AUTOM4TE'} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/@autom4te-name@' : '@bindir@/@autom4te-name@'); my $autoconf = "$autom4te --language=autoconf"; my @prepend_include; -my @include = ('@pkgdatadir@'); -+my @include = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@'); ++my @include = ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@'); # $help # ----- @@ -169,7 +169,7 @@ { - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; + my $pkgdatadir = $ENV{'autom4te_perllibdir'} || -+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@'); ++ ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@'); unshift @INC, $pkgdatadir; # Override SHELL. On DJGPP SHELL may not be set to a shell @@ -178,11 +178,11 @@ # We need to find m4sugar. my @prepend_include; -my @include = ('@pkgdatadir@'); -+my @include = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@'); ++my @include = ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@'); my $force = 0; # m4. -my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/bin/m4' : '@M4@'); ++my $m4 = $ENV{"M4"} || ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/bin/m4' : '@M4@'); # $HELP @@ -208,7 +208,7 @@ { - my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; + my $pkgdatadir = $ENV{'autom4te_perllibdir'} || -+ ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/autoconf' : '@pkgdatadir@'); ++ ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/autoconf' : '@pkgdatadir@'); unshift @INC, $pkgdatadir; # Override SHELL. On DJGPP SHELL may not be set to a shell @@ -219,8 +219,8 @@ # Variables. -: ${AUTOM4TE='@bindir@/@autom4te-name@'} -+if test -n "$STAGING_DIR"; then -+ : ${AUTOM4TE="$STAGING_DIR/../host/bin/@autom4te-name@"} ++if test -n "$STAGING_DIR_HOST"; then ++ : ${AUTOM4TE="$STAGING_DIR_HOST/bin/@autom4te-name@"} +else + : ${AUTOM4TE='@bindir@/@autom4te-name@'} +fi diff --git a/tools/automake/Makefile b/tools/automake/Makefile index a1121f137..85ccc0ded 100644 --- a/tools/automake/Makefile +++ b/tools/automake/Makefile @@ -25,7 +25,7 @@ HOST_CONFIGURE_VARS += \ am_cv_prog_PERL_ithreads=no define Host/Configure - (cd $(HOST_BUILD_DIR); $(AM_TOOL_PATHS) STAGING_DIR="" ./bootstrap) + (cd $(HOST_BUILD_DIR); $(AM_TOOL_PATHS) STAGING_DIR_HOST="" ./bootstrap) $(call Host/Configure/Default) endef diff --git a/tools/automake/patches/000-relocatable.patch b/tools/automake/patches/000-relocatable.patch index d05b25e61..02382ba8c 100644 --- a/tools/automake/patches/000-relocatable.patch +++ b/tools/automake/patches/000-relocatable.patch @@ -5,7 +5,7 @@ our $VERSION = '@VERSION@'; our $RELEASE_YEAR = '@RELEASE_YEAR@'; -our $libdir = '@datadir@/@PACKAGE@-@APIVERSION@'; -+our $libdir = $ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@'; ++our $libdir = $ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@'; our $perl_threads = 0; # We need at least this version for CLONE support. @@ -30,7 +30,7 @@ BEGIN { - @Aclocal::perl_libdirs = ('@datadir@/@PACKAGE@-@APIVERSION@') -+ @Aclocal::perl_libdirs = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@') ++ @Aclocal::perl_libdirs = ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@') unless @Aclocal::perl_libdirs; unshift @INC, @Aclocal::perl_libdirs; } @@ -40,8 +40,8 @@ my @user_includes = (); -my @automake_includes = ("@datadir@/aclocal-$APIVERSION"); -my @system_includes = ('@datadir@/aclocal'); -+my @automake_includes = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . "/../host/share/aclocal-$APIVERSION" : "@datadir@/aclocal-$APIVERSION"); -+my @system_includes = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/aclocal' : '@datadir@/aclocal'); ++my @automake_includes = ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . "/share/aclocal-$APIVERSION" : "@datadir@/aclocal-$APIVERSION"); ++my @system_includes = ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/aclocal' : '@datadir@/aclocal'); # Whether we should copy M4 file in $user_includes[0]. my $install = 0; @@ -66,7 +66,7 @@ BEGIN { - @Automake::perl_libdirs = ('@datadir@/@PACKAGE@-@APIVERSION@') -+ @Automake::perl_libdirs = ($ENV{'STAGING_DIR'} ? $ENV{'STAGING_DIR'} . '/../host/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@') ++ @Automake::perl_libdirs = ($ENV{'STAGING_DIR_HOST'} ? $ENV{'STAGING_DIR_HOST'} . '/share/@PACKAGE@-@APIVERSION@' : '@datadir@/@PACKAGE@-@APIVERSION@') unless @Automake::perl_libdirs; unshift @INC, @Automake::perl_libdirs; diff --git a/tools/b43-tools/Makefile b/tools/b43-tools/Makefile index a99b0c9e5..bae498c78 100644 --- a/tools/b43-tools/Makefile +++ b/tools/b43-tools/Makefile @@ -8,18 +8,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=b43-tools -PKG_DATE:=2017-09-13 +PKG_DATE:=2022-07-05 -PKG_SOURCE_URL:=https://github.com/mbuesch/b43-tools.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_SUBDIR:=$(PKG_NAME) -PKG_SOURCE_VERSION:=27892ef741e7f1d08cb939744f8b8f5dac7b04ae -PKG_MIRROR_HASH:=f914c36ac566e9e3b5a3a04de16ddb014fcad6a1cf25cdd8e4825c708d28d3f4 -HOST_BUILD_DIR=$(BUILD_DIR_HOST)/$(PKG_NAME) +PKG_SOURCE_URL:=https://github.com/mbuesch/b43-tools.git +PKG_SOURCE_VERSION:=2fe10ea6690df9a068cb21cde537236bae784a14 +PKG_MIRROR_HASH:=4f1cde5da35a1e768f6a01d67888549d04512073990769342381af1b2c9e7fd2 include $(INCLUDE_DIR)/host-build.mk - define Host/Compile +$(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/fwcutter \ CFLAGS="$(HOST_CFLAGS) -include endian.h" \ diff --git a/tools/cmake/Makefile b/tools/cmake/Makefile index b7dadee73..ed2580fe4 100644 --- a/tools/cmake/Makefile +++ b/tools/cmake/Makefile @@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=cmake -PKG_VERSION:=3.25.1 +PKG_VERSION:=3.25.2 PKG_VERSION_MAJOR:=$(word 1,$(subst ., ,$(PKG_VERSION))).$(word 2,$(subst ., ,$(PKG_VERSION))) PKG_RELEASE:=1 PKG_CPE_ID:=cpe:/a:kitware:cmake @@ -15,7 +15,7 @@ PKG_CPE_ID:=cpe:/a:kitware:cmake PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://github.com/Kitware/CMake/releases/download/v$(PKG_VERSION)/ \ https://cmake.org/files/v$(PKG_VERSION_MAJOR)/ -PKG_HASH:=1c511d09516af493694ed9baf13c55947a36389674d657a2d5e0ccedc6b291d8 +PKG_HASH:=c026f22cb931dd532f648f087d587f07a1843c6e66a3dfca4fb0ea21944ed33c HOST_BUILD_PARALLEL:=1 HOST_CONFIGURE_PARALLEL:=1 diff --git a/tools/dosfstools/patches/source-date-epoch.patch b/tools/dosfstools/patches/100-source-date-epoch.patch similarity index 93% rename from tools/dosfstools/patches/source-date-epoch.patch rename to tools/dosfstools/patches/100-source-date-epoch.patch index fb46753f2..c758caa4c 100644 --- a/tools/dosfstools/patches/source-date-epoch.patch +++ b/tools/dosfstools/patches/100-source-date-epoch.patch @@ -19,8 +19,6 @@ Signed-off-by: Bjørn Forsman src/mkfs.fat.c | 19 ++++++++++++++++--- 3 files changed, 53 insertions(+), 7 deletions(-) -diff --git a/src/boot.c b/src/boot.c -index 4de450d..8f78e1c 100644 --- a/src/boot.c +++ b/src/boot.c @@ -33,6 +33,8 @@ @@ -32,7 +30,7 @@ index 4de450d..8f78e1c 100644 #include "common.h" #include "fsck.fat.h" -@@ -672,6 +674,7 @@ void write_volume_label(DOS_FS * fs, char *label) +@@ -672,6 +674,7 @@ void write_volume_label(DOS_FS * fs, cha { time_t now; struct tm *mtime; @@ -40,7 +38,7 @@ index 4de450d..8f78e1c 100644 off_t offset; int created; DIR_ENT de; -@@ -687,8 +690,24 @@ void write_volume_label(DOS_FS * fs, char *label) +@@ -687,8 +690,24 @@ void write_volume_label(DOS_FS * fs, cha if (de.name[0] == 0xe5) de.name[0] = 0x05; @@ -67,8 +65,6 @@ index 4de450d..8f78e1c 100644 if (mtime && mtime->tm_year >= 80 && mtime->tm_year <= 207) { de.time = htole16((unsigned short)((mtime->tm_sec >> 1) + (mtime->tm_min << 5) + -diff --git a/src/common.c b/src/common.c -index 6a2e396..4f1afcb 100644 --- a/src/common.c +++ b/src/common.c @@ -30,6 +30,7 @@ @@ -83,10 +79,9 @@ index 6a2e396..4f1afcb 100644 uint32_t generate_volume_id(void) { struct timeval now; -- -- if (gettimeofday(&now, NULL) != 0 || now.tv_sec == (time_t)-1 || now.tv_sec < 0) { + char *source_date_epoch = NULL; -+ + +- if (gettimeofday(&now, NULL) != 0 || now.tv_sec == (time_t)-1 || now.tv_sec < 0) { + source_date_epoch = getenv("SOURCE_DATE_EPOCH"); + if (source_date_epoch) { + char *tmp = NULL; @@ -103,8 +98,6 @@ index 6a2e396..4f1afcb 100644 srand(getpid()); /* rand() returns int from [0,RAND_MAX], therefore only 31 bits */ return (((uint32_t)(rand() & 0xFFFF)) << 16) | ((uint32_t)(rand() & 0xFFFF)); -diff --git a/src/mkfs.fat.c b/src/mkfs.fat.c -index 37fc8ff..1948635 100644 --- a/src/mkfs.fat.c +++ b/src/mkfs.fat.c @@ -1074,7 +1074,7 @@ static void setup_tables(void) @@ -154,4 +147,4 @@ index 37fc8ff..1948635 100644 + volume_id = generate_volume_id(); check_atari(); - \ No newline at end of file + diff --git a/tools/dosfstools/patches/101-config-switch-to-AC_CHECK_LIB.patch b/tools/dosfstools/patches/101-config-switch-to-AC_CHECK_LIB.patch new file mode 100644 index 000000000..ba2d00bf8 --- /dev/null +++ b/tools/dosfstools/patches/101-config-switch-to-AC_CHECK_LIB.patch @@ -0,0 +1,28 @@ +From e7671c2a3be03d790cbc225cd3e784b5434fb5da Mon Sep 17 00:00:00 2001 +From: David Bauer +Date: Mon, 16 Jan 2023 01:29:22 +0100 +Subject: [PATCH] config: switch to AC_CHECK_LIB + +This fixes spurious build-errors on OpenWrt, where the AM_ICONV macro +is undefined while invoking autoconfig. Later in the build, the ICONV +LDOPTIONS are set to @LIBICONV@, failing the build. + +Signed-off-by: David Bauer +--- + configure.ac | 5 +---- + 1 file changed, 1 insertion(+), 4 deletions(-) + +--- a/configure.ac ++++ b/configure.ac +@@ -70,10 +70,7 @@ AC_CHECK_DECLS([getmntent], [], [], [[#i + AC_CHECK_DECLS([getmntinfo], [], [], [[#include ]]) + + # optional iconv support +-AC_ARG_WITH([iconv], AS_HELP_STRING([--without-iconv], [build without iconv support])) +-if test "x$with_iconv" != "xno"; then +- AM_ICONV +-fi ++AC_CHECK_LIB(iconv, iconv_open) + + # xxd (distributed with vim) is used in the testsuite + AC_CHECK_PROG([XXD_FOUND], [xxd], [yes]) diff --git a/tools/libdeflate/Makefile b/tools/libdeflate/Makefile index d30a8ca67..53a674440 100644 --- a/tools/libdeflate/Makefile +++ b/tools/libdeflate/Makefile @@ -7,25 +7,32 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libdeflate -PKG_VERSION:=1.15 -PKG_RELEASE:=1 +PKG_VERSION:=1.17 +PKG_RELEASE:=2 PKG_SOURCE_URL:=https://github.com/ebiggers/libdeflate.git PKG_SOURCE_PROTO:=git PKG_SOURCE_VERSION:=v$(PKG_VERSION) -PKG_MIRROR_HASH:=122feff4543541b547dc89e832adf262c81911ae1acbccdc591f0353a85b600a +PKG_MIRROR_HASH:=ee5790cf3140aa6a2e0f0c400d4b32539f13cb270e9357135c51927ba3784dc7 include $(INCLUDE_DIR)/host-build.mk -include $(INCLUDE_DIR)/cmake.mk + +define Host/Compile + $(HOSTCC_NOCACHE) $(HOST_CFLAGS) $(HOST_LDFLAGS) \ + $(HOST_BUILD_DIR)/lib/*{,/*}.c \ + $(HOST_BUILD_DIR)/programs/{gzip,prog_util,tgetopt}.c \ + -o $(HOST_BUILD_DIR)/libdeflate-gzip +endef define Host/Install - $(INSTALL_BIN) $(HOST_BUILD_DIR)/programs/libdeflate-gzip $(STAGING_DIR_HOST)/bin/ + $(INSTALL_BIN) $(HOST_BUILD_DIR)/libdeflate-gzip $(STAGING_DIR_HOST)/bin/ $(LN) libdeflate-gzip $(STAGING_DIR_HOST)/bin/libdeflate-gunzip endef -define Host/Clean - rm -f $(STAGING_DIR_HOST)/bin/libdeflate-gzip - rm -f $(STAGING_DIR_HOST)/bin/libdeflate-gunzip +define Host/Uninstall + $(RM) $(STAGING_DIR_HOST)/bin/libdeflate-gzip + $(RM) $(STAGING_DIR_HOST)/bin/libdeflate-gunzip + $(call Host/Uninstall/Default) endef $(eval $(call HostBuild)) diff --git a/tools/liblzo/Makefile b/tools/liblzo/Makefile new file mode 100644 index 000000000..4ebda0c33 --- /dev/null +++ b/tools/liblzo/Makefile @@ -0,0 +1,42 @@ +# +# Copyright (C) 2022 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lzo +PKG_VERSION:=2.10 +PKG_RELEASE:=4 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.oberhumer.com/opensource/lzo/download/ +PKG_HASH:=c0f892943208266f9b6543b3ae308fab6284c5c90e627931446fb49b4221a072 + +PKG_LICENSE:=GPL-2.0-or-later +PKG_LICENSE_FILES:=COPYING + +CMAKE_BINARY_SUBDIR:=openwrt-build + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/cmake.mk + +CMAKE_HOST_OPTIONS += \ + -DENABLE_SHARED=ON \ + -DENABLE_TESTS=OFF \ + -DENABLE_EXAMPLES=OFF \ + -DENABLE_DOCS=ON \ + -DBUILD_TESTING=OFF + +define Host/Uninstall + rm -rf $(HOST_BUILD_PREFIX)/include/lzo + rm -f $(HOST_BUILD_PREFIX)/lib/liblzo2.a + rm -f $(HOST_BUILD_PREFIX)/lib/liblzo2.so.2.0.0 + rm -f $(HOST_BUILD_PREFIX)/lib/liblzo2.so.2 + rm -f $(HOST_BUILD_PREFIX)/lib/liblzo2.so + rm -f $(HOST_BUILD_PREFIX)/lib/pkgconfig/lzo2.pc +endef + +$(eval $(call HostBuild)) diff --git a/tools/liblzo/patches/001-add-cmake-ENABLE-configurables.patch b/tools/liblzo/patches/001-add-cmake-ENABLE-configurables.patch new file mode 100644 index 000000000..9ab27fc92 --- /dev/null +++ b/tools/liblzo/patches/001-add-cmake-ENABLE-configurables.patch @@ -0,0 +1,68 @@ +--- a/CMakeLists.txt 2022-11-28 06:34:39.171209779 -0800 ++++ b/CMakeLists.txt 2022-11-28 06:33:13.368239757 -0800 +@@ -51,8 +51,11 @@ + project(lzo VERSION 2.10 LANGUAGES C) + + # configuration options +-option(ENABLE_STATIC "Build static LZO library." ON) +-option(ENABLE_SHARED "Build shared LZO library." OFF) ++option(ENABLE_STATIC "Build static LZO library." ON) ++option(ENABLE_SHARED "Build shared LZO library." OFF) ++option(ENABLE_TESTS "Build tests." ON) ++option(ENABLE_EXAMPLES "Build examples." ON) ++option(ENABLE_DOCS "Install documentation." ON) + if(NOT ENABLE_STATIC AND NOT ENABLE_SHARED) + set(ENABLE_STATIC ON) + endif() +@@ -127,14 +130,20 @@ + endif() + endmacro() + # main test driver ++if(ENABLE_TESTS OR ENABLE_EXAMPLES) + lzo_add_executable(lzotest lzotest/lzotest.c) ++endif() + # examples ++if(ENABLE_EXAMPLES) + lzo_add_executable(dict examples/dict.c) + lzo_add_executable(lzopack examples/lzopack.c) + lzo_add_executable(overlap examples/overlap.c) + lzo_add_executable(precomp examples/precomp.c) + lzo_add_executable(precomp2 examples/precomp2.c) ++endif() ++if(ENABLE_TESTS OR ENABLE_EXAMPLES) + lzo_add_executable(simple examples/simple.c) ++endif() + # some boring internal test programs + if(0) + lzo_add_executable(align tests/align.c) +@@ -144,7 +153,7 @@ + endif() + + # miniLZO +-if(1) ++if(ENABLE_TESTS) + add_executable(testmini minilzo/testmini.c minilzo/minilzo.c) + target_include_directories(testmini PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include/lzo") # needed for "lzoconf.h" + endif() +@@ -263,8 +272,10 @@ + + if(DEFINED CMAKE_INSTALL_FULL_LIBDIR) + +-set(f AUTHORS COPYING NEWS THANKS doc/LZO.FAQ doc/LZO.TXT doc/LZOAPI.TXT) +-install(FILES ${f} DESTINATION "${CMAKE_INSTALL_FULL_DOCDIR}") ++if(ENABLE_DOCS) ++ set(f AUTHORS COPYING NEWS THANKS doc/LZO.FAQ doc/LZO.TXT doc/LZOAPI.TXT) ++ install(FILES ${f} DESTINATION "${CMAKE_INSTALL_FULL_DOCDIR}") ++endif() + + set(f include/lzo/lzo1.h include/lzo/lzo1a.h include/lzo/lzo1b.h + include/lzo/lzo1c.h include/lzo/lzo1f.h include/lzo/lzo1x.h +@@ -285,7 +296,7 @@ + ) + endif() + +-if(1) ++if(ENABLE_EXAMPLES) + set(f lzopack lzotest simple testmini) # examples + install(TARGETS ${f} DESTINATION "${CMAKE_INSTALL_FULL_LIBEXECDIR}/lzo/examples") + endif() diff --git a/tools/libtool/patches/000-relocatable.patch b/tools/libtool/patches/000-relocatable.patch index 6d1651be3..996e6445b 100644 --- a/tools/libtool/patches/000-relocatable.patch +++ b/tools/libtool/patches/000-relocatable.patch @@ -13,11 +13,11 @@ : ${MV="mv -f"} : ${RM="rm -f"} -: ${SED="@SED@"} -+if test -n "$STAGING_DIR"; then -+ : ${EGREP="$STAGING_DIR/../host/bin/grep -E"} -+ : ${FGREP="$STAGING_DIR/../host/bin/grep -F"} -+ : ${GREP="$STAGING_DIR/../host/bin/grep"} -+ : ${SED="$STAGING_DIR/../host/bin/sed"} ++if test -n "$STAGING_DIR_HOST"; then ++ : ${EGREP="$STAGING_DIR_HOST/bin/grep -E"} ++ : ${FGREP="$STAGING_DIR_HOST/bin/grep -F"} ++ : ${GREP="$STAGING_DIR_HOST/bin/grep"} ++ : ${SED="$STAGING_DIR_HOST/bin/sed"} +else + : ${EGREP="@EGREP@"} + : ${FGREP="@FGREP@"} @@ -42,11 +42,11 @@ : ${MV="mv -f"} : ${RM="rm -f"} -: ${SED="@SED@"} -+if test -n "$STAGING_DIR"; then -+ : ${EGREP="$STAGING_DIR/../host/bin/grep -E"} -+ : ${FGREP="$STAGING_DIR/../host/bin/grep -F"} -+ : ${GREP="$STAGING_DIR/../host/bin/grep"} -+ : ${SED="$STAGING_DIR/../host/bin/sed"} ++if test -n "$STAGING_DIR_HOST"; then ++ : ${EGREP="$STAGING_DIR_HOST/bin/grep -E"} ++ : ${FGREP="$STAGING_DIR_HOST/bin/grep -F"} ++ : ${GREP="$STAGING_DIR_HOST/bin/grep"} ++ : ${SED="$STAGING_DIR_HOST/bin/sed"} +else + : ${EGREP="@EGREP@"} + : ${FGREP="@FGREP@"} @@ -64,11 +64,11 @@ - pkgdatadir=@pkgdatadir@ - pkgltdldir=@pkgdatadir@ - aclocaldir=@aclocaldir@ -+ if test -n "$STAGING_DIR"; then -+ datadir="$STAGING_DIR/../host/share" -+ pkgdatadir="$STAGING_DIR/../host/share/libtool" -+ pkgltdldir="$STAGING_DIR/../host/share/libtool" -+ aclocaldir="$STAGING_DIR/../host/share/aclocal" ++ if test -n "$STAGING_DIR_HOST"; then ++ datadir="$STAGING_DIR_HOST/share" ++ pkgdatadir="$STAGING_DIR_HOST/share/libtool" ++ pkgltdldir="$STAGING_DIR_HOST/share/libtool" ++ aclocaldir="$STAGING_DIR_HOST/share/aclocal" + else + datadir=@datadir@ + pkgdatadir=@pkgdatadir@ @@ -88,11 +88,11 @@ - pkgdatadir=@pkgdatadir@ - pkgltdldir=@pkgdatadir@ - aclocaldir=@aclocaldir@ -+ if test -n "$STAGING_DIR"; then -+ datadir="$STAGING_DIR/../host/share" -+ pkgdatadir="$STAGING_DIR/../host/share/libtool" -+ pkgltdldir="$STAGING_DIR/../host/share/libtool" -+ aclocaldir="$STAGING_DIR/../host/share/aclocal" ++ if test -n "$STAGING_DIR_HOST"; then ++ datadir="$STAGING_DIR_HOST/share" ++ pkgdatadir="$STAGING_DIR_HOST/share/libtool" ++ pkgltdldir="$STAGING_DIR_HOST/share/libtool" ++ aclocaldir="$STAGING_DIR_HOST/share/aclocal" + else + datadir=@datadir@ + pkgdatadir=@pkgdatadir@ @@ -111,7 +111,7 @@ - _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl -+_LT_DECL([LTCFLAGS], [CFLAGS], ["-O2 -I\${STAGING_DIR:-$STAGING_DIR}/../host/include"], [LTCC compiler flags])dnl ++_LT_DECL([LTCFLAGS], [CFLAGS], ["-O2 -I\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/include"], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl @@ -122,9 +122,9 @@ -_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) -_LT_DECL([], [EGREP], [1], [An ERE matcher]) -_LT_DECL([], [FGREP], [1], [A literal string matcher]) -+_LT_DECL([], [GREP], ["\${STAGING_DIR:-$STAGING_DIR}/../host/bin/grep"], [A grep program that handles long lines]) -+_LT_DECL([], [EGREP], ["\${STAGING_DIR:-$STAGING_DIR}/../host/bin/grep -E"], [An ERE matcher]) -+_LT_DECL([], [FGREP], ["\${STAGING_DIR:-$STAGING_DIR}/../host/bin/grep -F"], [A literal string matcher]) ++_LT_DECL([], [GREP], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/grep"], [A grep program that handles long lines]) ++_LT_DECL([], [EGREP], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/grep -E"], [An ERE matcher]) ++_LT_DECL([], [FGREP], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/grep -F"], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) @@ -135,7 +135,7 @@ -test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" -_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) -+_LT_DECL([], [SED], ["\${STAGING_DIR:-$STAGING_DIR}/../host/bin/sed"], [A sed program that does not truncate output]) ++_LT_DECL([], [SED], ["\${STAGING_DIR_HOST:-$STAGING_DIR_HOST}/bin/sed"], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED diff --git a/tools/llvm-bpf/Makefile b/tools/llvm-bpf/Makefile index 2a0cc0ab3..71509511e 100644 --- a/tools/llvm-bpf/Makefile +++ b/tools/llvm-bpf/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=llvm-project -PKG_VERSION:=15.0.6 +PKG_VERSION:=15.0.7 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).src.tar.xz PKG_SOURCE_URL:=https://github.com/llvm/llvm-project/releases/download/llvmorg-$(PKG_VERSION) -PKG_HASH:=9d53ad04dc60cb7b30e810faf64c5ab8157dadef46c8766f67f286238256ff92 +PKG_HASH:=8b5fcb24b4128cf04df1b0b9410ce8b1a729cb3c544e6da885d234280dedeac6 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)-$(PKG_VERSION).src diff --git a/tools/lz4/Makefile b/tools/lz4/Makefile new file mode 100644 index 000000000..c5d4f6f16 --- /dev/null +++ b/tools/lz4/Makefile @@ -0,0 +1,49 @@ +# +# Copyright (C) 2022 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lz4 +PKG_VERSION:=1.9.4 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/lz4/lz4/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b + +PKG_LICENSE:=BSD-2-Clause +PKG_LICENSE_FILES:=LICENSE lib/LICENSE + +HOST_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/host-build.mk + +# Always optimize for speed +HOST_CFLAGS := $(filter-out -O%,$(HOST_CFLAGS)) -O3 + +HOST_MAKE_FLAGS+=PREFIX=$(HOST_BUILD_PREFIX) \ + ENABLE_DOCS=1 + +define Host/Configure +endef + +define Host/Compile + $(call Host/Compile/Default,default) +endef + +define Host/Install + $(call Host/Compile/Default,install) +endef + +define Host/Uninstall + $(call Host/Compile/Default,uninstall) + $(call Host/Compile/Default,clean) +endef + +define Host/Clean +endef + +$(eval $(call HostBuild)) diff --git a/tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch b/tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch new file mode 100644 index 000000000..5d6dca33f --- /dev/null +++ b/tools/lz4/patches/001-add-make-ENABLE_DOCS-configurable.patch @@ -0,0 +1,60 @@ ++++ a/programs/Makefile 2022-08-15 15:45:31.000000000 -0700 +--- b/programs/Makefile 2022-11-28 16:34:21.315593784 -0800 +@@ -66,6 +66,7 @@ + MD2ROFF = ronn + MD2ROFF_FLAGS = --roff --warnings --manual="User Commands" --organization="lz4 $(LZ4_VERSION)" + ++ENABLE_DOCS ?= 1 + + default: lz4-release + +@@ -120,6 +121,7 @@ + lz4c32 : $(SRCFILES) + $(CC) $(FLAGS) $^ -o $@$(EXT) + ++ifeq ($(ENABLE_DOCS),1) + lz4.1: lz4.1.md $(LIBVER_SRC) + cat $< | $(MD2ROFF) $(MD2ROFF_FLAGS) | $(SED) -n '/^\.\\\".*/!p' > $@ + +@@ -130,6 +132,7 @@ + + preview-man: clean-man man + man ./lz4.1 ++endif + + clean: + ifeq ($(WINBASED),yes) +@@ -172,16 +175,19 @@ + + install: lz4 + @echo Installing binaries in $(DESTDIR)$(bindir) +- $(INSTALL_DIR) $(DESTDIR)$(bindir)/ $(DESTDIR)$(man1dir)/ ++ $(INSTALL_DIR) $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) lz4$(EXT) $(DESTDIR)$(bindir)/lz4$(EXT) + $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4c$(EXT) + $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4cat$(EXT) + $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/unlz4$(EXT) ++ifeq ($(ENABLE_DOCS),1) + @echo Installing man pages in $(DESTDIR)$(man1dir) ++ $(INSTALL_DIR) $(DESTDIR)$(man1dir)/ + $(INSTALL_DATA) lz4.1 $(DESTDIR)$(man1dir)/lz4.1 + $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4c.1 + $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4cat.1 + $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/unlz4.1 ++endif + @echo lz4 installation completed + + uninstall: +@@ -189,10 +195,12 @@ + $(RM) $(DESTDIR)$(bindir)/unlz4$(EXT) + $(RM) $(DESTDIR)$(bindir)/lz4$(EXT) + $(RM) $(DESTDIR)$(bindir)/lz4c$(EXT) ++ifeq ($(ENABLE_DOCS),1) + $(RM) $(DESTDIR)$(man1dir)/lz4.1 + $(RM) $(DESTDIR)$(man1dir)/lz4c.1 + $(RM) $(DESTDIR)$(man1dir)/lz4cat.1 + $(RM) $(DESTDIR)$(man1dir)/unlz4.1 ++endif + @echo lz4 programs successfully uninstalled + + endif diff --git a/tools/lz4/patches/002-makefile-install-links-from-same-dir.patch b/tools/lz4/patches/002-makefile-install-links-from-same-dir.patch new file mode 100644 index 000000000..159dc67f1 --- /dev/null +++ b/tools/lz4/patches/002-makefile-install-links-from-same-dir.patch @@ -0,0 +1,71 @@ +diff -ur a/lib/Makefile b/lib/Makefile +--- a/lib/Makefile 2022-12-04 23:49:06.336839263 -0800 ++++ b/lib/Makefile 2022-12-05 00:00:59.172307488 -0800 +@@ -195,8 +195,8 @@ + $(INSTALL_PROGRAM) dll/$(LIBLZ4_EXP) $(DESTDIR)$(libdir) + else + $(INSTALL_PROGRAM) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir) +- $(LN_SF) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT_MAJOR) +- $(LN_SF) liblz4.$(SHARED_EXT_VER) $(DESTDIR)$(libdir)/liblz4.$(SHARED_EXT) ++ (cd $(DESTDIR)$(libdir) && $(LN_SF) liblz4.$(SHARED_EXT_VER) liblz4.$(SHARED_EXT_MAJOR)) ++ (cd $(DESTDIR)$(libdir) && $(LN_SF) liblz4.$(SHARED_EXT_MAJOR) liblz4.$(SHARED_EXT)) + endif + endif + @echo Installing headers in $(DESTDIR)$(includedir) +diff -ur a/Makefile b/Makefile +--- a/Makefile 2022-12-04 23:49:06.336839263 -0800 ++++ b/Makefile 2022-12-04 23:42:09.693836654 -0800 +@@ -77,12 +77,12 @@ + + .PHONY: clean + clean: +- $(MAKE) -C $(LZ4DIR) $@ > $(VOID) +- $(MAKE) -C $(PRGDIR) $@ > $(VOID) +- $(MAKE) -C $(TESTDIR) $@ > $(VOID) +- $(MAKE) -C $(EXDIR) $@ > $(VOID) +- $(MAKE) -C $(FUZZDIR) $@ > $(VOID) +- $(MAKE) -C contrib/gen_manual $@ > $(VOID) ++ $(MAKE) -C $(LZ4DIR) $@ ++ $(MAKE) -C $(PRGDIR) $@ ++ $(MAKE) -C $(TESTDIR) $@ ++ $(MAKE) -C $(EXDIR) $@ ++ $(MAKE) -C $(FUZZDIR) $@ ++ $(MAKE) -C contrib/gen_manual $@ + $(RM) lz4$(EXT) + $(RM) -r $(CMAKE_BUILD_DIR) + @echo Cleaning completed +diff -ur a/programs/Makefile b/programs/Makefile +--- a/programs/Makefile 2022-12-04 23:49:06.336839263 -0800 ++++ b/programs/Makefile 2022-12-04 23:42:30.849582910 -0800 +@@ -138,7 +138,7 @@ + ifeq ($(WINBASED),yes) + $(RM) *.rc + endif +- $(MAKE) -C $(LZ4DIR) $@ > $(VOID) ++ $(MAKE) -C $(LZ4DIR) $@ + $(RM) core *.o *.test tmp* \ + lz4$(EXT) lz4c$(EXT) lz4c32$(EXT) lz4-wlib$(EXT) \ + unlz4$(EXT) lz4cat$(EXT) +@@ -177,16 +177,16 @@ + @echo Installing binaries in $(DESTDIR)$(bindir) + $(INSTALL_DIR) $(DESTDIR)$(bindir)/ + $(INSTALL_PROGRAM) lz4$(EXT) $(DESTDIR)$(bindir)/lz4$(EXT) +- $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4c$(EXT) +- $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/lz4cat$(EXT) +- $(LN_SF) lz4$(EXT) $(DESTDIR)$(bindir)/unlz4$(EXT) ++ (cd $(DESTDIR)$(bindir) && $(LN_SF) lz4$(EXT) lz4c$(EXT)) ++ (cd $(DESTDIR)$(bindir) && $(LN_SF) lz4$(EXT) lz4cat$(EXT)) ++ (cd $(DESTDIR)$(bindir) && $(LN_SF) lz4$(EXT) unlz4$(EXT)) + ifeq ($(ENABLE_DOCS),1) + @echo Installing man pages in $(DESTDIR)$(man1dir) + $(INSTALL_DIR) $(DESTDIR)$(man1dir)/ + $(INSTALL_DATA) lz4.1 $(DESTDIR)$(man1dir)/lz4.1 +- $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4c.1 +- $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/lz4cat.1 +- $(LN_SF) lz4.1 $(DESTDIR)$(man1dir)/unlz4.1 ++ (cd $(DESTDIR)$(man1dir) && $(LN_SF) lz4.1 lz4c.1) ++ (cd $(DESTDIR)$(man1dir) && $(LN_SF) lz4.1 lz4cat.1) ++ (cd $(DESTDIR)$(man1dir) && $(LN_SF) lz4.1 unlz4.1) + endif + @echo lz4 installation completed + diff --git a/tools/lzop/Makefile b/tools/lzop/Makefile new file mode 100644 index 000000000..65bd7fe67 --- /dev/null +++ b/tools/lzop/Makefile @@ -0,0 +1,33 @@ +# +# Copyright (C) 2022 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lzop +PKG_VERSION:=1.04 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=http://www.lzop.org/download/ +PKG_HASH:=7e72b62a8a60aff5200a047eea0773a8fb205caf7acbe1774d95147f305a2f41 + +PKG_LICENSE:=GPL-2.0-or-later +PKG_LICENSE_FILES:=COPYING + +CMAKE_BINARY_SUBDIR:=openwrt-build + +include $(INCLUDE_DIR)/host-build.mk +include $(INCLUDE_DIR)/cmake.mk + +CMAKE_HOST_OPTIONS += \ + -DENABLE_DOCS=ON \ + -DBUILD_TESTING=OFF + +define Host/Uninstall + rm -f $(STAGING_DIR_HOST)/bin/lzop +endef + +$(eval $(call HostBuild)) diff --git a/tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch b/tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch new file mode 100644 index 000000000..01ebd33a3 --- /dev/null +++ b/tools/lzop/patches/001-add-cmake-ENABLE_DOCS-configurable.patch @@ -0,0 +1,24 @@ +--- a/CMakeLists.txt 2017-08-10 04:19:45.000000000 -0700 ++++ b/CMakeLists.txt 2022-11-28 17:21:03.453548350 -0800 +@@ -50,6 +50,9 @@ + + project(lzop VERSION 1.04 LANGUAGES C) + ++# configuration options ++option(ENABLE_DOCS "Install documentation." ON) ++ + # install directories + if(NOT CMAKE_INSTALL_PREFIX) + message(FATAL_ERROR "ERROR: CMAKE_INSTALL_PREFIX is not defined.") +@@ -186,9 +189,11 @@ + + install(TARGETS lzop DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}") + ++if(ENABLE_DOCS) + set(f AUTHORS COPYING NEWS README THANKS doc/lzop.html doc/lzop.man doc/lzop.pod doc/lzop.ps doc/lzop.tex doc/lzop.txt) + install(FILES ${f} DESTINATION "${CMAKE_INSTALL_FULL_DOCDIR}") + install(FILES doc/lzop.1 DESTINATION "${CMAKE_INSTALL_FULL_MANDIR}/man1") ++endif() # ENABLE_DOCS + + endif() # CMAKE_INSTALL_FULL_LIBDIR + diff --git a/tools/mpc/Makefile b/tools/mpc/Makefile index 5c196a27e..97e94291c 100644 --- a/tools/mpc/Makefile +++ b/tools/mpc/Makefile @@ -22,8 +22,8 @@ unexport CFLAGS HOST_CONFIGURE_ARGS += \ --enable-static \ --disable-shared \ - --with-mpfr=$(TOPDIR)/staging_dir/host \ - --with-gmp=$(TOPDIR)/staging_dir/host + --with-mpfr=$(STAGING_DIR_HOST) \ + --with-gmp=$(STAGING_DIR_HOST) define Host/Uninstall -$(call Host/Compile/Default,uninstall) diff --git a/tools/mpfr/Makefile b/tools/mpfr/Makefile index 6a13be739..cdcca5f11 100644 --- a/tools/mpfr/Makefile +++ b/tools/mpfr/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=mpfr -PKG_VERSION:=4.1.1 +PKG_VERSION:=4.2.0 PKG_CPE_ID:=cpe:/a:mpfr:gnu_mpfr PKG_SOURCE_URL:=@GNU/mpfr http://www.mpfr.org/mpfr-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_HASH:=ffd195bd567dbaffc3b98b23fd00aad0537680c9896171e44fe3ff79e28ac33d +PKG_HASH:=06a378df13501248c1b2db5aa977a2c8126ae849a9d9b7be2546fb4a9c26d993 HOST_BUILD_PARALLEL:=1 HOST_FIXUP:=autoreconf diff --git a/tools/mpfr/patches/001-only_src.patch b/tools/mpfr/patches/001-only_src.patch index 68312276c..bd9e38aef 100644 --- a/tools/mpfr/patches/001-only_src.patch +++ b/tools/mpfr/patches/001-only_src.patch @@ -1,6 +1,6 @@ --- a/Makefile.am +++ b/Makefile.am -@@ -34,7 +34,7 @@ AUTOMAKE_OPTIONS = gnu +@@ -38,7 +38,7 @@ AUTOMAKE_OPTIONS = gnu # old Automake version. ACLOCAL_AMFLAGS = -I m4 @@ -11,7 +11,7 @@ pkgconfig_DATA = mpfr.pc --- a/Makefile.in +++ b/Makefile.in -@@ -397,7 +397,7 @@ AUTOMAKE_OPTIONS = gnu +@@ -401,7 +401,7 @@ AUTOMAKE_OPTIONS = gnu # libtoolize and in case some developer needs to switch back to an # old Automake version. ACLOCAL_AMFLAGS = -I m4 diff --git a/tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch b/tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch deleted file mode 100644 index bb66a9067..000000000 --- a/tools/mpfr/patches/002-Fix-mpfr_custom_get_kind-macro-bug.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 0ce17bae34a6c54de31b126f969d3ddd72c6bc37 Mon Sep 17 00:00:00 2001 -From: Vincent Lefevre -Date: Tue, 22 Nov 2022 16:33:00 +0100 -Subject: [PATCH] Fix mpfr_custom_get_kind() macro bug. - -* src/mpfr.h: in the mpfr_custom_get_kind() macro, changed mpfr_ptr to - mpfr_srcptr for _x to agree with the function prototype, in order to - avoid a compilation failure of user code in some cases. This bug was - introduced by commit 9f94e0311ed53d0c64d4fbca249d19cc4888027e, which - introduced the temporary variable _x to avoid an incorrect number of - evaluations of the x argument. -* tests/tstckintc.c: improved the tests to detect this bug. - -This should fix mpfr bug #1. - -Bug initially reported by FX Coudert: - https://github.com/CGAL/cgal/issues/7064 - -It affects Fedora Linux: - https://bugzilla.redhat.com/show_bug.cgi?id=2144197 ---- - src/mpfr.h | 2 +- - tests/tstckintc.c | 10 +++++++--- - 2 files changed, 8 insertions(+), 4 deletions(-) - ---- a/src/mpfr.h -+++ b/src/mpfr.h -@@ -1027,7 +1027,7 @@ __MPFR_DECLSPEC int mpfr_total_order_p ( - #if __GNUC__ > 2 || __GNUC_MINOR__ >= 95 - #define mpfr_custom_get_kind(x) \ - __extension__ ({ \ -- mpfr_ptr _x = (x); \ -+ mpfr_srcptr _x = (x); \ - _x->_mpfr_exp > __MPFR_EXP_INF ? \ - (mpfr_int) MPFR_REGULAR_KIND * MPFR_SIGN (_x) \ - : _x->_mpfr_exp == __MPFR_EXP_INF ? \ ---- a/tests/tstckintc.c -+++ b/tests/tstckintc.c -@@ -295,14 +295,16 @@ static void - test_nan_inf_zero (void) - { - mpfr_ptr val; -+ mpfr_srcptr sval; /* for compilation error checking */ - int sign; - int kind; - - reset_stack (); - - val = new_mpfr (MPFR_PREC_MIN); -+ sval = val; - mpfr_set_nan (val); -- kind = (mpfr_custom_get_kind) (val); -+ kind = (mpfr_custom_get_kind) (sval); - if (kind != MPFR_NAN_KIND) - { - printf ("mpfr_custom_get_kind error: "); -@@ -380,7 +382,8 @@ static long * - dummy_set_si (long si) - { - mpfr_t x; -- long * r = dummy_new (); -+ mpfr_srcptr px; /* for compilation error checking */ -+ long *r = dummy_new (); - int i1, i2, i3, i4, i5; - - /* Check that the type "void *" can be used, like with the function. -@@ -405,7 +408,8 @@ dummy_set_si (long si) - MPFR_ASSERTN (i5 == 1); - - mpfr_set_si (x, si, MPFR_RNDN); -- r[0] = mpfr_custom_get_kind (x); -+ px = x; -+ r[0] = mpfr_custom_get_kind (px); - - /* Check that the type "void *" can be used in C, like with the function - (forbidden in C++). Also check side effects. */ diff --git a/tools/ninja/patches/100-make_jobserver_support.patch b/tools/ninja/patches/100-make_jobserver_support.patch index b62717943..34d2b6c43 100644 --- a/tools/ninja/patches/100-make_jobserver_support.patch +++ b/tools/ninja/patches/100-make_jobserver_support.patch @@ -1,64 +1,36 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -112,6 +112,7 @@ add_library(libninja OBJECT - src/state.cc - src/status.cc - src/string_piece_util.cc -+ src/tokenpool-gnu-make.cc - src/util.cc - src/version.cc - ) -@@ -123,9 +124,13 @@ if(WIN32) - src/msvc_helper_main-win32.cc - src/getopt.c - src/minidump-win32.cc -+ src/tokenpool-gnu-make-win32.cc - ) - else() -- target_sources(libninja PRIVATE src/subprocess-posix.cc) -+ target_sources(libninja PRIVATE -+ src/subprocess-posix.cc -+ src/tokenpool-gnu-make-posix.cc -+ ) - if(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR CMAKE_SYSTEM_NAME STREQUAL "AIX") - target_sources(libninja PRIVATE src/getopt.c) - endif() -@@ -204,6 +209,7 @@ if(BUILD_TESTING) - src/string_piece_util_test.cc - src/subprocess_test.cc - src/test.cc -+ src/tokenpool_test.cc - src/util_test.cc - ) - if(WIN32) ---- a/README.md -+++ b/README.md -@@ -1,3 +1,25 @@ -+Kitware maintains this branch of Ninja in order to provide features -+that have not yet been integrated upstream: -+ -+* make-style jobserver support -+ -+This branch may be *rebased* without notice for maintenance on top of -+the upstream `master` branch. It will be removed once upstream has -+integrated the features. -+ -+Parts of this branch are under upstream consideration: -+ -+* https://github.com/ninja-build/ninja/pull/1140 -+ -+As each PR is accepted additional parts of this branch will be submitted -+incrementally. -+ -+Binaries built from versions of this branch are available here: -+ -+* https://github.com/Kitware/ninja/releases -+ -+----------------------------------------------------------------------------- -+ - # Ninja - - Ninja is a small build system with a focus on speed. +From afec30f5caf4b051827ffdd822ebd27c58219fee Mon Sep 17 00:00:00 2001 +From: Stefan Becker +Date: Tue, 22 Mar 2016 13:48:07 +0200 +Subject: [PATCH 01/11] Add GNU make jobserver client support + +- add new TokenPool interface +- GNU make implementation for TokenPool parses and verifies the magic + information from the MAKEFLAGS environment variable +- RealCommandRunner tries to acquire TokenPool + * if no token pool is available then there is no change in behaviour +- When a token pool is available then RealCommandRunner behaviour + changes as follows + * CanRunMore() only returns true if TokenPool::Acquire() returns true + * StartCommand() calls TokenPool::Reserve() + * WaitForCommand() calls TokenPool::Release() + +Documentation for GNU make jobserver + + http://make.mad-scientist.net/papers/jobserver-implementation/ + +Fixes https://github.com/ninja-build/ninja/issues/1139 +--- + configure.py | 2 + + src/build.cc | 63 ++++++++---- + src/build.h | 3 + + src/tokenpool-gnu-make.cc | 211 ++++++++++++++++++++++++++++++++++++++ + src/tokenpool-none.cc | 27 +++++ + src/tokenpool.h | 26 +++++ + 6 files changed, 310 insertions(+), 22 deletions(-) + create mode 100644 src/tokenpool-gnu-make.cc + create mode 100644 src/tokenpool-none.cc + create mode 100644 src/tokenpool.h + --- a/configure.py +++ b/configure.py @@ -517,11 +517,13 @@ for name in ['build', @@ -251,7 +223,7 @@ result->status = subproc->Finish(); result->output = subproc->GetOutput(); -@@ -620,38 +669,42 @@ bool Builder::Build(string* err) { +@@ -620,38 +669,43 @@ bool Builder::Build(string* err) { // command runner. // Second, we attempt to wait for / reap the next finished command. while (plan_.more_to_do()) { @@ -259,8 +231,6 @@ - if (failures_allowed && command_runner_->CanRunMore()) { - if (Edge* edge = plan_.FindWork()) { - if (edge->GetBindingBool("generator")) { -- scan_.build_log()->Close(); -- } + // See if we can start any more commands... + bool can_run_more = + failures_allowed && @@ -271,15 +241,16 @@ + if (can_run_more && command_runner_->AcquireToken()) { + Edge* edge = plan_.FindWork(); + if (edge->GetBindingBool("generator")) { -+ scan_.build_log()->Close(); -+ } + scan_.build_log()->Close(); + } + +- if (!StartEdge(edge, err)) { + if (!StartEdge(edge, err)) { + Cleanup(); + status_->BuildFinished(); + return false; + } - -- if (!StartEdge(edge, err)) { ++ + if (edge->is_phony()) { + if (!plan_.EdgeFinished(edge, Plan::kEdgeSucceeded, err)) { Cleanup(); @@ -315,7 +286,7 @@ result.status == ExitInterrupted) { Cleanup(); status_->BuildFinished(); -@@ -659,6 +712,10 @@ bool Builder::Build(string* err) { +@@ -659,6 +713,10 @@ bool Builder::Build(string* err) { return false; } @@ -375,6 +346,162 @@ int failures_allowed; /// The maximum load average we must not exceed. A negative value /// means that we do not have any limit. +--- /dev/null ++++ b/src/tokenpool-gnu-make.cc +@@ -0,0 +1,108 @@ ++// Copyright 2016-2018 Google Inc. All Rights Reserved. ++// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++ ++#include "tokenpool-gnu-make.h" ++ ++#include ++#include ++#include ++ ++#include "line_printer.h" ++ ++// TokenPool implementation for GNU make jobserver - common bits ++// every instance owns an implicit token -> available_ == 1 ++GNUmakeTokenPool::GNUmakeTokenPool() : available_(1), used_(0) { ++} ++ ++GNUmakeTokenPool::~GNUmakeTokenPool() { ++} ++ ++bool GNUmakeTokenPool::Setup(bool ignore, ++ bool verbose, ++ double& max_load_average) { ++ const char* value = GetEnv("MAKEFLAGS"); ++ if (!value) ++ return false; ++ ++ // GNU make <= 4.1 ++ const char* jobserver = strstr(value, "--jobserver-fds="); ++ if (!jobserver) ++ // GNU make => 4.2 ++ jobserver = strstr(value, "--jobserver-auth="); ++ if (jobserver) { ++ LinePrinter printer; ++ ++ if (ignore) { ++ printer.PrintOnNewLine("ninja: warning: -jN forced on command line; ignoring GNU make jobserver.\n"); ++ } else { ++ if (ParseAuth(jobserver)) { ++ const char* l_arg = strstr(value, " -l"); ++ int load_limit = -1; ++ ++ if (verbose) { ++ printer.PrintOnNewLine("ninja: using GNU make jobserver.\n"); ++ } ++ ++ // translate GNU make -lN to ninja -lN ++ if (l_arg && ++ (sscanf(l_arg + 3, "%d ", &load_limit) == 1) && ++ (load_limit > 0)) { ++ max_load_average = load_limit; ++ } ++ ++ return true; ++ } ++ } ++ } ++ ++ return false; ++} ++ ++bool GNUmakeTokenPool::Acquire() { ++ if (available_ > 0) ++ return true; ++ ++ if (AcquireToken()) { ++ // token acquired ++ available_++; ++ return true; ++ } ++ ++ // no token available ++ return false; ++} ++ ++void GNUmakeTokenPool::Reserve() { ++ available_--; ++ used_++; ++} ++ ++void GNUmakeTokenPool::Return() { ++ if (ReturnToken()) ++ available_--; ++} ++ ++void GNUmakeTokenPool::Release() { ++ available_++; ++ used_--; ++ if (available_ > 1) ++ Return(); ++} ++ ++void GNUmakeTokenPool::Clear() { ++ while (used_ > 0) ++ Release(); ++ while (available_ > 1) ++ Return(); ++} +--- /dev/null ++++ b/src/tokenpool.h +@@ -0,0 +1,42 @@ ++// Copyright 2016-2018 Google Inc. All Rights Reserved. ++// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++ ++#ifdef _WIN32 ++#include ++#endif ++ ++// interface to token pool ++struct TokenPool { ++ virtual ~TokenPool() {} ++ ++ virtual bool Acquire() = 0; ++ virtual void Reserve() = 0; ++ virtual void Release() = 0; ++ virtual void Clear() = 0; ++ ++ // returns false if token pool setup failed ++ virtual bool Setup(bool ignore, bool verbose, double& max_load_average) = 0; ++ ++#ifdef _WIN32 ++ virtual void WaitForTokenAvailability(HANDLE ioport) = 0; ++ // returns true if a token has become available ++ // key is result from GetQueuedCompletionStatus() ++ virtual bool TokenIsAvailable(ULONG_PTR key) = 0; ++#else ++ virtual int GetMonitorFd() = 0; ++#endif ++ ++ // returns NULL if token pool is not available ++ static TokenPool* Get(); ++}; --- a/src/build_test.cc +++ b/src/build_test.cc @@ -15,6 +15,7 @@ @@ -527,7 +654,7 @@ + void ExpectWaitForCommand(int count, ...); + +private: -+ void EnqueueBooleans(vector& booleans, int count, va_list ao); ++ void EnqueueBooleans(vector& booleans, int count, va_list ap); +}; + +void BuildTokenTest::SetUp() { @@ -785,16 +912,6 @@ }; #endif // NINJA_EXIT_STATUS_H_ ---- a/src/ninja.cc -+++ b/src/ninja.cc -@@ -1447,6 +1447,7 @@ int ReadFlags(int* argc, char*** argv, - // We want to run N jobs in parallel. For N = 0, INT_MAX - // is close enough to infinite for most sane builds. - config->parallelism = value > 0 ? value : INT_MAX; -+ config->parallelism_from_cmdline = true; - deferGuessParallelism.needGuess = false; - break; - } --- a/src/subprocess-posix.cc +++ b/src/subprocess-posix.cc @@ -13,6 +13,7 @@ @@ -1166,7 +1283,7 @@ + subprocs_.DoWork(&tokens_); +#ifdef _WIN32 + tokens_._token_available = false; -+ // we need to loop here as we have no conrol where the token ++ // we need to loop here as we have no control where the token + // I/O completion post ends up in the queue + while (!subproc->Done() && !subprocs_.IsTokenAvailable()) { + subprocs_.DoWork(&tokens_); @@ -1226,9 +1343,301 @@ + + EXPECT_EQ(1u, subprocs_.finished_.size()); +} +--- a/src/ninja.cc ++++ b/src/ninja.cc +@@ -1447,6 +1447,7 @@ int ReadFlags(int* argc, char*** argv, + // We want to run N jobs in parallel. For N = 0, INT_MAX + // is close enough to infinite for most sane builds. + config->parallelism = value > 0 ? value : INT_MAX; ++ config->parallelism_from_cmdline = true; + deferGuessParallelism.needGuess = false; + break; + } +--- /dev/null ++++ b/src/tokenpool_test.cc +@@ -0,0 +1,279 @@ ++// Copyright 2018 Google Inc. All Rights Reserved. ++// ++// Licensed under the Apache License, Version 2.0 (the "License"); ++// you may not use this file except in compliance with the License. ++// You may obtain a copy of the License at ++// ++// http://www.apache.org/licenses/LICENSE-2.0 ++// ++// Unless required by applicable law or agreed to in writing, software ++// distributed under the License is distributed on an "AS IS" BASIS, ++// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++// See the License for the specific language governing permissions and ++// limitations under the License. ++ ++#include "tokenpool.h" ++ ++#include "test.h" ++ ++#ifdef _WIN32 ++#include ++#else ++#include ++#endif ++ ++#include ++#include ++ ++#ifdef _WIN32 ++// should contain all valid characters ++#define SEMAPHORE_NAME "abcdefghijklmnopqrstwxyz01234567890_" ++#define AUTH_FORMAT(tmpl) "foo " tmpl "=%s bar" ++#define ENVIRONMENT_CLEAR() SetEnvironmentVariable("MAKEFLAGS", NULL) ++#define ENVIRONMENT_INIT(v) SetEnvironmentVariable("MAKEFLAGS", v) ++#else ++#define AUTH_FORMAT(tmpl) "foo " tmpl "=%d,%d bar" ++#define ENVIRONMENT_CLEAR() unsetenv("MAKEFLAGS") ++#define ENVIRONMENT_INIT(v) setenv("MAKEFLAGS", v, true) ++#endif ++ ++namespace { ++ ++const double kLoadAverageDefault = -1.23456789; ++ ++struct TokenPoolTest : public testing::Test { ++ double load_avg_; ++ TokenPool* tokens_; ++ char buf_[1024]; ++#ifdef _WIN32 ++ const char* semaphore_name_; ++ HANDLE semaphore_; ++#else ++ int fds_[2]; ++ ++ char random() { ++ return int((rand() / double(RAND_MAX)) * 256); ++ } ++#endif ++ ++ virtual void SetUp() { ++ load_avg_ = kLoadAverageDefault; ++ tokens_ = NULL; ++ ENVIRONMENT_CLEAR(); ++#ifdef _WIN32 ++ semaphore_name_ = SEMAPHORE_NAME; ++ if ((semaphore_ = CreateSemaphore(0, 0, 2, SEMAPHORE_NAME)) == NULL) ++#else ++ if (pipe(fds_) < 0) ++#endif ++ ASSERT_TRUE(false); ++ } ++ ++ void CreatePool(const char* format, bool ignore_jobserver = false) { ++ if (format) { ++ sprintf(buf_, format, ++#ifdef _WIN32 ++ semaphore_name_ ++#else ++ fds_[0], fds_[1] ++#endif ++ ); ++ ENVIRONMENT_INIT(buf_); ++ } ++ if ((tokens_ = TokenPool::Get()) != NULL) { ++ if (!tokens_->Setup(ignore_jobserver, false, load_avg_)) { ++ delete tokens_; ++ tokens_ = NULL; ++ } ++ } ++ } ++ ++ void CreateDefaultPool() { ++ CreatePool(AUTH_FORMAT("--jobserver-auth")); ++ } ++ ++ virtual void TearDown() { ++ if (tokens_) ++ delete tokens_; ++#ifdef _WIN32 ++ CloseHandle(semaphore_); ++#else ++ close(fds_[0]); ++ close(fds_[1]); ++#endif ++ ENVIRONMENT_CLEAR(); ++ } ++}; ++ ++} // anonymous namespace ++ ++// verifies none implementation ++TEST_F(TokenPoolTest, NoTokenPool) { ++ CreatePool(NULL, false); ++ ++ EXPECT_EQ(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++} ++ ++TEST_F(TokenPoolTest, SuccessfulOldSetup) { ++ // GNUmake <= 4.1 ++ CreatePool(AUTH_FORMAT("--jobserver-fds")); ++ ++ EXPECT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++} ++ ++TEST_F(TokenPoolTest, SuccessfulNewSetup) { ++ // GNUmake => 4.2 ++ CreateDefaultPool(); ++ ++ EXPECT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++} ++ ++TEST_F(TokenPoolTest, IgnoreWithJN) { ++ CreatePool(AUTH_FORMAT("--jobserver-auth"), true); ++ ++ EXPECT_EQ(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++} ++ ++TEST_F(TokenPoolTest, HonorLN) { ++ CreatePool(AUTH_FORMAT("-l9 --jobserver-auth")); ++ ++ EXPECT_NE(NULL, tokens_); ++ EXPECT_EQ(9.0, load_avg_); ++} ++ ++#ifdef _WIN32 ++TEST_F(TokenPoolTest, SemaphoreNotFound) { ++ semaphore_name_ = SEMAPHORE_NAME "_foobar"; ++ CreateDefaultPool(); ++ ++ EXPECT_EQ(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++} ++ ++TEST_F(TokenPoolTest, TokenIsAvailable) { ++ CreateDefaultPool(); ++ ++ ASSERT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++ ++ EXPECT_TRUE(tokens_->TokenIsAvailable((ULONG_PTR)tokens_)); ++} ++#else ++TEST_F(TokenPoolTest, MonitorFD) { ++ CreateDefaultPool(); ++ ++ ASSERT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++ ++ EXPECT_EQ(fds_[0], tokens_->GetMonitorFd()); ++} ++#endif ++ ++TEST_F(TokenPoolTest, ImplicitToken) { ++ CreateDefaultPool(); ++ ++ ASSERT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++ ++ EXPECT_TRUE(tokens_->Acquire()); ++ tokens_->Reserve(); ++ EXPECT_FALSE(tokens_->Acquire()); ++ tokens_->Release(); ++ EXPECT_TRUE(tokens_->Acquire()); ++} ++ ++TEST_F(TokenPoolTest, TwoTokens) { ++ CreateDefaultPool(); ++ ++ ASSERT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++ ++ // implicit token ++ EXPECT_TRUE(tokens_->Acquire()); ++ tokens_->Reserve(); ++ EXPECT_FALSE(tokens_->Acquire()); ++ ++ // jobserver offers 2nd token ++#ifdef _WIN32 ++ LONG previous; ++ ASSERT_TRUE(ReleaseSemaphore(semaphore_, 1, &previous)); ++ ASSERT_EQ(0, previous); ++#else ++ char test_tokens[1] = { random() }; ++ ASSERT_EQ(1u, write(fds_[1], test_tokens, sizeof(test_tokens))); ++#endif ++ EXPECT_TRUE(tokens_->Acquire()); ++ tokens_->Reserve(); ++ EXPECT_FALSE(tokens_->Acquire()); ++ ++ // release 2nd token ++ tokens_->Release(); ++ EXPECT_TRUE(tokens_->Acquire()); ++ ++ // release implicit token - must return 2nd token back to jobserver ++ tokens_->Release(); ++ EXPECT_TRUE(tokens_->Acquire()); ++ ++ // there must be one token available ++#ifdef _WIN32 ++ EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(semaphore_, 0)); ++ EXPECT_TRUE(ReleaseSemaphore(semaphore_, 1, &previous)); ++ EXPECT_EQ(0, previous); ++#else ++ EXPECT_EQ(1u, read(fds_[0], buf_, sizeof(buf_))); ++ EXPECT_EQ(test_tokens[0], buf_[0]); ++#endif ++ ++ // implicit token ++ EXPECT_TRUE(tokens_->Acquire()); ++} ++ ++TEST_F(TokenPoolTest, Clear) { ++ CreateDefaultPool(); ++ ++ ASSERT_NE(NULL, tokens_); ++ EXPECT_EQ(kLoadAverageDefault, load_avg_); ++ ++ // implicit token ++ EXPECT_TRUE(tokens_->Acquire()); ++ tokens_->Reserve(); ++ EXPECT_FALSE(tokens_->Acquire()); ++ ++ // jobserver offers 2nd & 3rd token ++#ifdef _WIN32 ++ LONG previous; ++ ASSERT_TRUE(ReleaseSemaphore(semaphore_, 2, &previous)); ++ ASSERT_EQ(0, previous); ++#else ++ char test_tokens[2] = { random(), random() }; ++ ASSERT_EQ(2u, write(fds_[1], test_tokens, sizeof(test_tokens))); ++#endif ++ EXPECT_TRUE(tokens_->Acquire()); ++ tokens_->Reserve(); ++ EXPECT_TRUE(tokens_->Acquire()); ++ tokens_->Reserve(); ++ EXPECT_FALSE(tokens_->Acquire()); ++ ++ tokens_->Clear(); ++ EXPECT_TRUE(tokens_->Acquire()); ++ ++ // there must be two tokens available ++#ifdef _WIN32 ++ EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(semaphore_, 0)); ++ EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(semaphore_, 0)); ++ EXPECT_TRUE(ReleaseSemaphore(semaphore_, 2, &previous)); ++ EXPECT_EQ(0, previous); ++#else ++ EXPECT_EQ(2u, read(fds_[0], buf_, sizeof(buf_))); ++ // tokens are pushed onto a stack, hence returned in reverse order ++ EXPECT_EQ(test_tokens[0], buf_[1]); ++ EXPECT_EQ(test_tokens[1], buf_[0]); ++#endif ++ ++ // implicit token ++ EXPECT_TRUE(tokens_->Acquire()); ++} --- /dev/null +++ b/src/tokenpool-gnu-make-posix.cc -@@ -0,0 +1,202 @@ +@@ -0,0 +1,214 @@ +// Copyright 2016-2018 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); @@ -1254,6 +1663,7 @@ +#include +#include +#include ++#include + +// TokenPool implementation for GNU make jobserver - POSIX implementation +// (http://make.mad-scientist.net/papers/jobserver-implementation/) @@ -1275,6 +1685,16 @@ + struct sigaction old_act_; + bool restore_; + ++ // See https://www.gnu.org/software/make/manual/html_node/POSIX-Jobserver.html ++ // ++ // It’s important that when you release the job slot, you write back ++ // the same character you read. Don’t assume that all tokens are the ++ // same character different characters may have different meanings to ++ // GNU make. The order is not important, since make has no idea in ++ // what order jobs will complete anyway. ++ // ++ std::stack tokens_; ++ + static int dup_rfd_; + static void CloseDupRfd(int signum); + @@ -1295,9 +1715,7 @@ + if (fd < 0) + return false; + int ret = fcntl(fd, F_GETFD); -+ if (ret < 0) -+ return false; -+ return true; ++ return ret >= 0; +} + +int GNUmakeTokenPoolPosix::dup_rfd_ = -1; @@ -1366,6 +1784,7 @@ + if (dup_rfd_ != -1) { + struct sigaction act, old_act; + int ret = 0; ++ char buf; + + // Temporarily replace SIGCHLD handler with our own + memset(&act, 0, sizeof(act)); @@ -1377,8 +1796,6 @@ + memset(&timeout, 0, sizeof(timeout)); + timeout.it_value.tv_usec = 100 * 1000; // [ms] -> [usec] + if (setitimer(ITIMER_REAL, &timeout, NULL) == 0) { -+ char buf; -+ + // Now try to read() from dup_rfd_. Return values from read(): + // + // 1. token read -> 1 @@ -1401,8 +1818,10 @@ + CloseDupRfd(0); + + // Case 1 from above list -+ if (ret > 0) ++ if (ret > 0) { ++ tokens_.push(buf); + return true; ++ } + } + } + @@ -1413,11 +1832,13 @@ +} + +bool GNUmakeTokenPoolPosix::ReturnToken() { -+ const char buf = '+'; ++ const char buf = tokens_.top(); + while (1) { + int ret = write(wfd_, &buf, 1); -+ if (ret > 0) ++ if (ret > 0) { ++ tokens_.pop(); + return true; ++ } + if ((ret != -1) || (errno != EINTR)) + return false; + // write got interrupted - retry @@ -1674,117 +2095,6 @@ + return new GNUmakeTokenPoolWin32; +} --- /dev/null -+++ b/src/tokenpool-gnu-make.cc -@@ -0,0 +1,108 @@ -+// Copyright 2016-2018 Google Inc. All Rights Reserved. -+// -+// Licensed under the Apache License, Version 2.0 (the "License"); -+// you may not use this file except in compliance with the License. -+// You may obtain a copy of the License at -+// -+// http://www.apache.org/licenses/LICENSE-2.0 -+// -+// Unless required by applicable law or agreed to in writing, software -+// distributed under the License is distributed on an "AS IS" BASIS, -+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+// See the License for the specific language governing permissions and -+// limitations under the License. -+ -+#include "tokenpool-gnu-make.h" -+ -+#include -+#include -+#include -+ -+#include "line_printer.h" -+ -+// TokenPool implementation for GNU make jobserver - common bits -+// every instance owns an implicit token -> available_ == 1 -+GNUmakeTokenPool::GNUmakeTokenPool() : available_(1), used_(0) { -+} -+ -+GNUmakeTokenPool::~GNUmakeTokenPool() { -+} -+ -+bool GNUmakeTokenPool::Setup(bool ignore, -+ bool verbose, -+ double& max_load_average) { -+ const char* value = GetEnv("MAKEFLAGS"); -+ if (!value) -+ return false; -+ -+ // GNU make <= 4.1 -+ const char* jobserver = strstr(value, "--jobserver-fds="); -+ if (!jobserver) -+ // GNU make => 4.2 -+ jobserver = strstr(value, "--jobserver-auth="); -+ if (jobserver) { -+ LinePrinter printer; -+ -+ if (ignore) { -+ printer.PrintOnNewLine("ninja: warning: -jN forced on command line; ignoring GNU make jobserver.\n"); -+ } else { -+ if (ParseAuth(jobserver)) { -+ const char* l_arg = strstr(value, " -l"); -+ int load_limit = -1; -+ -+ if (verbose) { -+ printer.PrintOnNewLine("ninja: using GNU make jobserver.\n"); -+ } -+ -+ // translate GNU make -lN to ninja -lN -+ if (l_arg && -+ (sscanf(l_arg + 3, "%d ", &load_limit) == 1) && -+ (load_limit > 0)) { -+ max_load_average = load_limit; -+ } -+ -+ return true; -+ } -+ } -+ } -+ -+ return false; -+} -+ -+bool GNUmakeTokenPool::Acquire() { -+ if (available_ > 0) -+ return true; -+ -+ if (AcquireToken()) { -+ // token acquired -+ available_++; -+ return true; -+ } -+ -+ // no token available -+ return false; -+} -+ -+void GNUmakeTokenPool::Reserve() { -+ available_--; -+ used_++; -+} -+ -+void GNUmakeTokenPool::Return() { -+ if (ReturnToken()) -+ available_--; -+} -+ -+void GNUmakeTokenPool::Release() { -+ available_++; -+ used_--; -+ if (available_ > 1) -+ Return(); -+} -+ -+void GNUmakeTokenPool::Clear() { -+ while (used_ > 0) -+ Release(); -+ while (available_ > 1) -+ Return(); -+} ---- /dev/null +++ b/src/tokenpool-gnu-make.h @@ -0,0 +1,40 @@ +// Copyright 2016-2018 Google Inc. All Rights Reserved. @@ -1827,331 +2137,36 @@ + + void Return(); +}; ---- /dev/null -+++ b/src/tokenpool.h -@@ -0,0 +1,42 @@ -+// Copyright 2016-2018 Google Inc. All Rights Reserved. -+// -+// Licensed under the Apache License, Version 2.0 (the "License"); -+// you may not use this file except in compliance with the License. -+// You may obtain a copy of the License at -+// -+// http://www.apache.org/licenses/LICENSE-2.0 -+// -+// Unless required by applicable law or agreed to in writing, software -+// distributed under the License is distributed on an "AS IS" BASIS, -+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+// See the License for the specific language governing permissions and -+// limitations under the License. -+ -+#ifdef _WIN32 -+#include -+#endif -+ -+// interface to token pool -+struct TokenPool { -+ virtual ~TokenPool() {} -+ -+ virtual bool Acquire() = 0; -+ virtual void Reserve() = 0; -+ virtual void Release() = 0; -+ virtual void Clear() = 0; -+ -+ // returns false if token pool setup failed -+ virtual bool Setup(bool ignore, bool verbose, double& max_load_average) = 0; -+ -+#ifdef _WIN32 -+ virtual void WaitForTokenAvailability(HANDLE ioport) = 0; -+ // returns true if a token has become available -+ // key is result from GetQueuedCompletionStatus() -+ virtual bool TokenIsAvailable(ULONG_PTR key) = 0; -+#else -+ virtual int GetMonitorFd() = 0; -+#endif -+ -+ // returns NULL if token pool is not available -+ static TokenPool* Get(); -+}; ---- /dev/null -+++ b/src/tokenpool_test.cc -@@ -0,0 +1,269 @@ -+// Copyright 2018 Google Inc. All Rights Reserved. -+// -+// Licensed under the Apache License, Version 2.0 (the "License"); -+// you may not use this file except in compliance with the License. -+// You may obtain a copy of the License at -+// -+// http://www.apache.org/licenses/LICENSE-2.0 -+// -+// Unless required by applicable law or agreed to in writing, software -+// distributed under the License is distributed on an "AS IS" BASIS, -+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+// See the License for the specific language governing permissions and -+// limitations under the License. -+ -+#include "tokenpool.h" -+ -+#include "test.h" -+ -+#ifdef _WIN32 -+#include -+#else -+#include -+#endif -+ -+#include -+#include -+ -+#ifdef _WIN32 -+// should contain all valid characters -+#define SEMAPHORE_NAME "abcdefghijklmnopqrstwxyz01234567890_" -+#define AUTH_FORMAT(tmpl) "foo " tmpl "=%s bar" -+#define ENVIRONMENT_CLEAR() SetEnvironmentVariable("MAKEFLAGS", NULL) -+#define ENVIRONMENT_INIT(v) SetEnvironmentVariable("MAKEFLAGS", v) -+#else -+#define AUTH_FORMAT(tmpl) "foo " tmpl "=%d,%d bar" -+#define ENVIRONMENT_CLEAR() unsetenv("MAKEFLAGS") -+#define ENVIRONMENT_INIT(v) setenv("MAKEFLAGS", v, true) -+#endif -+ -+namespace { -+ -+const double kLoadAverageDefault = -1.23456789; -+ -+struct TokenPoolTest : public testing::Test { -+ double load_avg_; -+ TokenPool* tokens_; -+ char buf_[1024]; -+#ifdef _WIN32 -+ const char* semaphore_name_; -+ HANDLE semaphore_; -+#else -+ int fds_[2]; -+#endif -+ -+ virtual void SetUp() { -+ load_avg_ = kLoadAverageDefault; -+ tokens_ = NULL; -+ ENVIRONMENT_CLEAR(); -+#ifdef _WIN32 -+ semaphore_name_ = SEMAPHORE_NAME; -+ if ((semaphore_ = CreateSemaphore(0, 0, 2, SEMAPHORE_NAME)) == NULL) -+#else -+ if (pipe(fds_) < 0) -+#endif -+ ASSERT_TRUE(false); -+ } -+ -+ void CreatePool(const char* format, bool ignore_jobserver = false) { -+ if (format) { -+ sprintf(buf_, format, -+#ifdef _WIN32 -+ semaphore_name_ -+#else -+ fds_[0], fds_[1] -+#endif -+ ); -+ ENVIRONMENT_INIT(buf_); -+ } -+ if ((tokens_ = TokenPool::Get()) != NULL) { -+ if (!tokens_->Setup(ignore_jobserver, false, load_avg_)) { -+ delete tokens_; -+ tokens_ = NULL; -+ } -+ } -+ } -+ -+ void CreateDefaultPool() { -+ CreatePool(AUTH_FORMAT("--jobserver-auth")); -+ } -+ -+ virtual void TearDown() { -+ if (tokens_) -+ delete tokens_; -+#ifdef _WIN32 -+ CloseHandle(semaphore_); -+#else -+ close(fds_[0]); -+ close(fds_[1]); -+#endif -+ ENVIRONMENT_CLEAR(); -+ } -+}; -+ -+} // anonymous namespace -+ -+// verifies none implementation -+TEST_F(TokenPoolTest, NoTokenPool) { -+ CreatePool(NULL, false); -+ -+ EXPECT_EQ(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+} -+ -+TEST_F(TokenPoolTest, SuccessfulOldSetup) { -+ // GNUmake <= 4.1 -+ CreatePool(AUTH_FORMAT("--jobserver-fds")); -+ -+ EXPECT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+} -+ -+TEST_F(TokenPoolTest, SuccessfulNewSetup) { -+ // GNUmake => 4.2 -+ CreateDefaultPool(); -+ -+ EXPECT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+} -+ -+TEST_F(TokenPoolTest, IgnoreWithJN) { -+ CreatePool(AUTH_FORMAT("--jobserver-auth"), true); -+ -+ EXPECT_EQ(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+} -+ -+TEST_F(TokenPoolTest, HonorLN) { -+ CreatePool(AUTH_FORMAT("-l9 --jobserver-auth")); -+ -+ EXPECT_NE(NULL, tokens_); -+ EXPECT_EQ(9.0, load_avg_); -+} -+ -+#ifdef _WIN32 -+TEST_F(TokenPoolTest, SemaphoreNotFound) { -+ semaphore_name_ = SEMAPHORE_NAME "_foobar"; -+ CreateDefaultPool(); -+ -+ EXPECT_EQ(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+} -+ -+TEST_F(TokenPoolTest, TokenIsAvailable) { -+ CreateDefaultPool(); -+ -+ ASSERT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+ -+ EXPECT_TRUE(tokens_->TokenIsAvailable((ULONG_PTR)tokens_)); -+} -+#else -+TEST_F(TokenPoolTest, MonitorFD) { -+ CreateDefaultPool(); -+ -+ ASSERT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+ -+ EXPECT_EQ(fds_[0], tokens_->GetMonitorFd()); -+} -+#endif -+ -+TEST_F(TokenPoolTest, ImplicitToken) { -+ CreateDefaultPool(); -+ -+ ASSERT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+ -+ EXPECT_TRUE(tokens_->Acquire()); -+ tokens_->Reserve(); -+ EXPECT_FALSE(tokens_->Acquire()); -+ tokens_->Release(); -+ EXPECT_TRUE(tokens_->Acquire()); -+} -+ -+TEST_F(TokenPoolTest, TwoTokens) { -+ CreateDefaultPool(); -+ -+ ASSERT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+ -+ // implicit token -+ EXPECT_TRUE(tokens_->Acquire()); -+ tokens_->Reserve(); -+ EXPECT_FALSE(tokens_->Acquire()); -+ -+ // jobserver offers 2nd token -+#ifdef _WIN32 -+ LONG previous; -+ ASSERT_TRUE(ReleaseSemaphore(semaphore_, 1, &previous)); -+ ASSERT_EQ(0, previous); -+#else -+ ASSERT_EQ(1u, write(fds_[1], "T", 1)); -+#endif -+ EXPECT_TRUE(tokens_->Acquire()); -+ tokens_->Reserve(); -+ EXPECT_FALSE(tokens_->Acquire()); -+ -+ // release 2nd token -+ tokens_->Release(); -+ EXPECT_TRUE(tokens_->Acquire()); -+ -+ // release implict token - must return 2nd token back to jobserver -+ tokens_->Release(); -+ EXPECT_TRUE(tokens_->Acquire()); -+ -+ // there must be one token available -+#ifdef _WIN32 -+ EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(semaphore_, 0)); -+ EXPECT_TRUE(ReleaseSemaphore(semaphore_, 1, &previous)); -+ EXPECT_EQ(0, previous); -+#else -+ EXPECT_EQ(1u, read(fds_[0], buf_, sizeof(buf_))); -+#endif -+ -+ // implicit token -+ EXPECT_TRUE(tokens_->Acquire()); -+} -+ -+TEST_F(TokenPoolTest, Clear) { -+ CreateDefaultPool(); -+ -+ ASSERT_NE(NULL, tokens_); -+ EXPECT_EQ(kLoadAverageDefault, load_avg_); -+ -+ // implicit token -+ EXPECT_TRUE(tokens_->Acquire()); -+ tokens_->Reserve(); -+ EXPECT_FALSE(tokens_->Acquire()); -+ -+ // jobserver offers 2nd & 3rd token -+#ifdef _WIN32 -+ LONG previous; -+ ASSERT_TRUE(ReleaseSemaphore(semaphore_, 2, &previous)); -+ ASSERT_EQ(0, previous); -+#else -+ ASSERT_EQ(2u, write(fds_[1], "TT", 2)); -+#endif -+ EXPECT_TRUE(tokens_->Acquire()); -+ tokens_->Reserve(); -+ EXPECT_TRUE(tokens_->Acquire()); -+ tokens_->Reserve(); -+ EXPECT_FALSE(tokens_->Acquire()); -+ -+ tokens_->Clear(); -+ EXPECT_TRUE(tokens_->Acquire()); -+ -+ // there must be two tokens available -+#ifdef _WIN32 -+ EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(semaphore_, 0)); -+ EXPECT_EQ(WAIT_OBJECT_0, WaitForSingleObject(semaphore_, 0)); -+ EXPECT_TRUE(ReleaseSemaphore(semaphore_, 2, &previous)); -+ EXPECT_EQ(0, previous); -+#else -+ EXPECT_EQ(2u, read(fds_[0], buf_, sizeof(buf_))); -+#endif -+ -+ // implicit token -+ EXPECT_TRUE(tokens_->Acquire()); -+} ---- a/src/version.cc -+++ b/src/version.cc -@@ -20,7 +20,7 @@ - - using namespace std; - --const char* kNinjaVersion = "1.11.1"; -+const char* kNinjaVersion = "1.11.1.git.kitware.jobserver-1"; - - void ParseVersion(const string& version, int* major, int* minor) { - size_t end = version.find('.'); +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -112,6 +112,7 @@ add_library(libninja OBJECT + src/state.cc + src/status.cc + src/string_piece_util.cc ++ src/tokenpool-gnu-make.cc + src/util.cc + src/version.cc + ) +@@ -123,9 +124,14 @@ if(WIN32) + src/msvc_helper_main-win32.cc + src/getopt.c + src/minidump-win32.cc ++ src/tokenpool-gnu-make-win32.cc + ) + else() + target_sources(libninja PRIVATE src/subprocess-posix.cc) ++ target_sources(libninja PRIVATE ++ src/subprocess-posix.cc ++ src/tokenpool-gnu-make-posix.cc ++ ) + if(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR CMAKE_SYSTEM_NAME STREQUAL "AIX") + target_sources(libninja PRIVATE src/getopt.c) + endif() +@@ -204,6 +210,7 @@ if(BUILD_TESTING) + src/string_piece_util_test.cc + src/subprocess_test.cc + src/test.cc ++ src/tokenpool_test.cc + src/util_test.cc + ) + if(WIN32) diff --git a/tools/patchelf/Makefile b/tools/patchelf/Makefile index 1271a393c..3ddd611cd 100644 --- a/tools/patchelf/Makefile +++ b/tools/patchelf/Makefile @@ -7,11 +7,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=patchelf -PKG_VERSION:=0.17.0 +PKG_VERSION:=0.17.2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=https://github.com/NixOS/patchelf/releases/download/$(PKG_VERSION) -PKG_HASH:=45d76f4a31688a523718ec512f31650b1f35d1affec3eafeb3feeb5448d341e1 +PKG_HASH:=bae2ea376072e422c196218dd9bdef0548ccc08da4de9f36b4672df84ea2d8e2 HOST_BUILD_PARALLEL:=1 HOST_FIXUP:=autoreconf diff --git a/tools/xz/Makefile b/tools/xz/Makefile index 6e287a61b..9084cb08f 100644 --- a/tools/xz/Makefile +++ b/tools/xz/Makefile @@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=xz -PKG_VERSION:=5.2.10 +PKG_VERSION:=5.4.1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:=@SF/lzmautils \ http://tukaani.org/xz -PKG_HASH:=01b71df61521d9da698ce3c33148bff06a131628ff037398c09482f3a26e5408 +PKG_HASH:=dd172acb53867a68012f94c17389401b2f274a1aa5ae8f84cbfb8b7e383ea8d3 PKG_CPE_ID:=cpe:/a:tukaani:xz HOST_BUILD_PARALLEL:=1