From 46362c48c8c6e4df9d117a4a42083760bec454d8 Mon Sep 17 00:00:00 2001 From: Philip Prindeville Date: Fri, 19 Mar 2021 17:09:26 -0600 Subject: [PATCH 1/6] libnfnetlink: quote $(FPIC) on command line When $(FPIC) gets expanded on the command line (for instance when setting environment variables for libtool, configure, or make) we can't count on it not needing quoting (i.e. it could contain multiple flags separated with spaces). Fixes: dc31191ec3e5 ("build: make sure asm gets built with -DPIC") Signed-off-by: Philip Prindeville (cherry picked from commit 7fae64cc065738b73a1dddc2fc28adde36c1ae3d) --- package/libs/libnfnetlink/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/libs/libnfnetlink/Makefile b/package/libs/libnfnetlink/Makefile index 7d65d63857..bc64ff111d 100644 --- a/package/libs/libnfnetlink/Makefile +++ b/package/libs/libnfnetlink/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libnfnetlink PKG_VERSION:=1.0.1 -PKG_RELEASE:=3 +PKG_RELEASE:=4 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_URL:= \ @@ -45,7 +45,7 @@ CONFIGURE_ARGS += \ --enable-shared CONFIGURE_VARS += \ - lt_prog_compiler_pic=$(FPIC) + lt_prog_compiler_pic="$(FPIC)" define Build/InstallDev $(INSTALL_DIR) $(1)/usr/include/libnfnetlink From 6fd65c657351908302b37447675ee352ec927d93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20=C5=A0tetiar?= Date: Fri, 9 Apr 2021 14:52:05 +0200 Subject: [PATCH 2/6] tplink-safeloader: fix C7v5 factory flashing from vendor fw > v1.1.x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently it's not possible to flash factory images on devices shipped with vendor firmware versions 1.1.0 Build 20201120 rel. 50406 (published 2020-12-22): (curFw_ver, newFw_ver) == (1.1, 1.0) [NM_Error](nm_checkSoftVer) 00848: Firmwave not supports, check failed. [NM_Error](nm_checkUpdateContent) 01084: software version dismatched [NM_Error](nm_buildUpgradeStruct) 01188: checkUpdateContent failed. They've even following note in release notes: Note: You will be unable to downgrade to the previous firmware version after updating this firmware. This version check in vendor firmware is implemented in /usr/bin/nvrammanager binary likely as following C code[1]: sscanf(buf, "%d.%d.%*s",&upd_fw_major, &upd_fw_minor); ... if (((int)upd_fw_major < (int)cur_fw_major) || ((ret = 1, cur_fw_major == upd_fw_major && (upd_fw_minor < (int)cur_fw_minor)))) { ret = 0; printf("[NM_Error](%s) %05d: Firmwave not supports, check failed.\r\n\r\n","nm_checkSoftVer" ,0x350); } ... return ret; So in order to fix this and make it future proof it should be enough to ship our factory firmware images with major version 7 (lucky number). Tested on latest firmware version 1.1.2 Build 20210125 rel.37999: Firmwave supports, check OK. (curFw_ver, newFw_ver) == (1.1, 7.0) check firmware ok! Flashing back to vendor firmware c7v5_us-up-ver1-1-2-P1[20210125-rel37999]_2021-01-25_10.33.55.bin works as well: U-Boot 1.1.4-gbec22107-dirty (Nov 18 2020 - 18:19:12) ... Firmware downloaded... filesize = 0xeeae77 fileaddr = 0x80060000. Firmware Recovery file length : 15642231 Firmware process id 2. handle_fw_cloud 146 Image verify OK! Firmware file Verify ok! product-info:product_name:Archer C7 product_ver:5.0.0 special_id:55530000 [Error]sysmgr_cfg_checkSupportList(): 1023 @ specialId 45550000 NOT Match. Firmware supports, check OK. Firmware Recovery check ok! 1. https://gist.github.com/ynezz/2e0583647d863386a66c3d231541b6d1 Signed-off-by: Petr Štetiar (cherry picked from commit e6d66375cbbb54e0e82a67030e385a5486273766) --- tools/firmware-utils/src/tplink-safeloader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/firmware-utils/src/tplink-safeloader.c b/tools/firmware-utils/src/tplink-safeloader.c index da73e1bf30..ac71b3305e 100644 --- a/tools/firmware-utils/src/tplink-safeloader.c +++ b/tools/firmware-utils/src/tplink-safeloader.c @@ -1262,7 +1262,7 @@ static struct device_info boards[] = { "{product_name:Archer C7,product_ver:5.0.0,special_id:4B520000}\n", .part_trail = 0x00, - .soft_ver = "soft_ver:1.0.0\n", + .soft_ver = "soft_ver:7.0.0\n", /* We're using a dynamic kernel/rootfs split here */ .partitions = { From 48262735d9b7b824e947d8ea0b6b8571f678f265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 13 Apr 2021 17:18:27 +0200 Subject: [PATCH 3/6] kernel: crypto: format "crypto-hw-ccp" dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use multiples lines for better readability and sort lines. Suggested-by: Stijn Tintel Signed-off-by: Rafał Miłecki (cherry picked from commit 107111adbba16328f9853a4d89db4a103b20118c) --- package/kernel/linux/modules/crypto.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index 19b0d4696b..b8b9e5f9fd 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -313,7 +313,14 @@ $(eval $(call KernelPackage,crypto-hmac)) define KernelPackage/crypto-hw-ccp TITLE:=AMD Cryptographic Coprocessor - DEPENDS:=+kmod-crypto-authenc +kmod-crypto-hash +kmod-crypto-manager +kmod-random-core +kmod-crypto-sha1 +kmod-crypto-sha256 +kmod-crypto-rsa + DEPENDS:= \ + +kmod-crypto-authenc \ + +kmod-crypto-hash \ + +kmod-crypto-manager \ + +kmod-crypto-rsa \ + +kmod-crypto-sha1 \ + +kmod-crypto-sha256 \ + +kmod-random-core KCONFIG:= \ CONFIG_CRYPTO_HW=y \ CONFIG_CRYPTO_DEV_CCP=y \ From 50f2f25d588bef24856cf220a7bbdd58d96ce6fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Tue, 13 Apr 2021 10:15:39 +0200 Subject: [PATCH 4/6] kernel: limit crypto-hw-ccp to the x86 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CRYPTO_DEV_CCP depends on X86 or ARM64 CRYPTO_DEV_CCP_DD depends on CPU_SUP_AMD or ARM64 Compiling this driver makes sense for x86 mainly. If one day support for ARM64 board with AMD Secure Processor gets added this package may be updated. Trying to build this package on bcm4908 was causing: ERROR: module 'build_dir/target-aarch64_cortex-a53_musl/linux-bcm4908_generic/linux-5.4.110/drivers/crypto/ccp/ccp-crypto.ko' is missing. Signed-off-by: Rafał Miłecki (cherry picked from commit cb3fb45ed1262355e8c31d8e522f411169ee6df8) --- package/kernel/linux/modules/crypto.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/package/kernel/linux/modules/crypto.mk b/package/kernel/linux/modules/crypto.mk index b8b9e5f9fd..b50ed06824 100644 --- a/package/kernel/linux/modules/crypto.mk +++ b/package/kernel/linux/modules/crypto.mk @@ -314,6 +314,7 @@ $(eval $(call KernelPackage,crypto-hmac)) define KernelPackage/crypto-hw-ccp TITLE:=AMD Cryptographic Coprocessor DEPENDS:= \ + @TARGET_x86 \ +kmod-crypto-authenc \ +kmod-crypto-hash \ +kmod-crypto-manager \ From 2748b36eff2882074dfb26310482f29298c92c8e Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Sat, 10 Apr 2021 22:18:10 -0700 Subject: [PATCH 5/6] gemini,layerscape,oxnas: don't disable option CONFIG_BPF_SYSCALL Respect the generic kernel config setting, which is "enabled" tree-wide, as previously done for sunxi. Ref: 247ef4d98bab ("sunxi: enable CONFIG_BPF_SYSCALL and CONFIG_EMBEDDED") Signed-off-by: Tony Ambardar (cherry picked from commit 41948c9c1b80e39f2fd2771f42e62e209347b0bf) Signed-off-by: Kevin Darbyshire-Bryant --- target/linux/gemini/config-5.4 | 1 - target/linux/layerscape/armv7/config-5.4 | 1 - target/linux/layerscape/armv8_64b/config-5.4 | 1 - target/linux/oxnas/config-5.4 | 1 - 4 files changed, 4 deletions(-) diff --git a/target/linux/gemini/config-5.4 b/target/linux/gemini/config-5.4 index 7cfdb3ccdb..087da4ffee 100644 --- a/target/linux/gemini/config-5.4 +++ b/target/linux/gemini/config-5.4 @@ -47,7 +47,6 @@ CONFIG_BLK_DEV_SD=y CONFIG_BLK_MQ_PCI=y CONFIG_BLK_SCSI_REQUEST=y CONFIG_BOUNCE=y -# CONFIG_BPF_SYSCALL is not set CONFIG_CLKDEV_LOOKUP=y CONFIG_CLKSRC_MMIO=y CONFIG_CLONE_BACKWARDS=y diff --git a/target/linux/layerscape/armv7/config-5.4 b/target/linux/layerscape/armv7/config-5.4 index 1cdbba426d..35c8eed8da 100644 --- a/target/linux/layerscape/armv7/config-5.4 +++ b/target/linux/layerscape/armv7/config-5.4 @@ -107,7 +107,6 @@ CONFIG_BLK_SCSI_REQUEST=y # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 CONFIG_BOUNCE=y -# CONFIG_BPF_SYSCALL is not set CONFIG_BRCMSTB_GISB_ARB=y CONFIG_BROADCOM_PHY=y CONFIG_CACHE_L2X0=y diff --git a/target/linux/layerscape/armv8_64b/config-5.4 b/target/linux/layerscape/armv8_64b/config-5.4 index 172a9d43b1..ce619ac6c1 100644 --- a/target/linux/layerscape/armv8_64b/config-5.4 +++ b/target/linux/layerscape/armv8_64b/config-5.4 @@ -132,7 +132,6 @@ CONFIG_BLK_PM=y CONFIG_BLK_SCSI_REQUEST=y # CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0 -# CONFIG_BPF_SYSCALL is not set CONFIG_BSD_PROCESS_ACCT=y CONFIG_BSD_PROCESS_ACCT_V3=y CONFIG_BTRFS_FS=y diff --git a/target/linux/oxnas/config-5.4 b/target/linux/oxnas/config-5.4 index ed6f03d388..1c97c39170 100644 --- a/target/linux/oxnas/config-5.4 +++ b/target/linux/oxnas/config-5.4 @@ -65,7 +65,6 @@ CONFIG_BLK_DEV_RAM_COUNT=16 CONFIG_BLK_DEV_RAM_SIZE=65536 CONFIG_BLK_PM=y CONFIG_BLK_SCSI_REQUEST=y -# CONFIG_BPF_SYSCALL is not set CONFIG_CC_HAS_KASAN_GENERIC=y CONFIG_CLKDEV_LOOKUP=y CONFIG_CLKSRC_MMIO=y From beab1bf16317d83e59c669ce83ce16268d197f91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= Date: Wed, 14 Apr 2021 08:26:25 +0200 Subject: [PATCH 6/6] bcm53xx: add pending TRX patch for "firmware" partition MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This fixes partitioning on Linksys EA9500. With this change only the currently used firmware MTD partition gets parsed. Signed-off-by: Rafał Miłecki (cherry picked from commit a3c7633ddcd4fac9ec8935e5be9249c011bfec14) --- ...x-parse-firmware-MTD-partitions-only.patch | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 target/linux/bcm53xx/patches-5.4/140-mtd-parsers-trx-parse-firmware-MTD-partitions-only.patch diff --git a/target/linux/bcm53xx/patches-5.4/140-mtd-parsers-trx-parse-firmware-MTD-partitions-only.patch b/target/linux/bcm53xx/patches-5.4/140-mtd-parsers-trx-parse-firmware-MTD-partitions-only.patch new file mode 100644 index 0000000000..fa86303637 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.4/140-mtd-parsers-trx-parse-firmware-MTD-partitions-only.patch @@ -0,0 +1,43 @@ +From: =?UTF-8?q?Rafa=C5=82=20Mi=C5=82ecki?= +Date: Tue, 13 Apr 2021 18:25:20 +0200 +Subject: [PATCH] mtd: parsers: trx: parse "firmware" MTD partitions only +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Parsing every partition with "compatible" set to "brcm,trx" results in +parsing both: firmware partition and failsafe partition on devices that +implement failsafe booting. This affects e.g. Linksys EA9500 which has: + +partition@200000 { + reg = <0x0200000 0x01d00000>; + compatible = "linksys,ns-firmware", "brcm,trx"; +}; + +partition@1f00000 { + reg = <0x01f00000 0x01d00000>; + compatible = "linksys,ns-firmware", "brcm,trx"; +}; + +Check for MTD partition name "firmware" before parsing. Recently added +ofpart_linksys_ns.c creates "firmware" and "failsafe" depending on +bootloader setup. + +Signed-off-by: Rafał Miłecki +--- + drivers/mtd/parsers/parser_trx.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/drivers/mtd/parsers/parser_trx.c ++++ b/drivers/mtd/parsers/parser_trx.c +@@ -85,6 +85,10 @@ static int parser_trx_parse(struct mtd_i + uint8_t curr_part = 0, i = 0; + int err; + ++ /* Don't parse any failsafe / backup partitions */ ++ if (strcmp(mtd->name, "firmware")) ++ return -EINVAL; ++ + parts = kcalloc(TRX_PARSER_MAX_PARTS, sizeof(struct mtd_partition), + GFP_KERNEL); + if (!parts)