[PATCH u-boot] scripts/dtc: Remove redundant YYLOC global declaration
From: Dirk Mueller gcc 10 will default to -fno-common, which causes this error at link time: (.text+0x0): multiple definition of `yylloc'; dtc-lexer.lex.o (symbol from plugin):(.text+0x0): first defined here This is because both dtc-lexer as well as dtc-parser define the same global symbol yyloc. Before with -fcommon those were merged into one defintion. The proper solution would be to to mark this as "extern", however that leads to: dtc-lexer.l:26:16: error: redundant redeclaration of 'yylloc' [-Werror=redundant-decls] 26 | extern YYLTYPE yylloc; |^~ In file included from dtc-lexer.l:24: dtc-parser.tab.h:127:16: note: previous declaration of 'yylloc' was here 127 | extern YYLTYPE yylloc; |^~ cc1: all warnings being treated as errors which means the declaration is completely redundant and can just be dropped. Signed-off-by: Dirk Mueller Signed-off-by: David Gibson [robh: cherry-pick from upstream] Cc: sta...@vger.kernel.org Signed-off-by: Rob Herring [Cherry-picked from linux e33a814e772cdc36436c8c188d8c42d019fda639] Signed-off-by: Eneas U de Queiroz --- I'm not sure I got the subject line right for this. This is supposed to go into git.openwrt.org/project/bcm63xx/u-boot.git I've stumbled upon the error while doing a test build for https://github.com/openwrt/openwrt/pull/9756 scripts/dtc/dtc-lexer.l | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l index fd825ebba6..24af549977 100644 --- a/scripts/dtc/dtc-lexer.l +++ b/scripts/dtc/dtc-lexer.l @@ -38,7 +38,6 @@ LINECOMMENT "//".*\n #include "srcpos.h" #include "dtc-parser.tab.h" -YYLTYPE yylloc; extern bool treesource_error; /* CAUTION: this will stop working if we ever use yyless() or yyunput() */ ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [PATCH V3] tplink-safeloader: Patch to handle partitions with alternate names
On 5.05.2022 17:41, Ole Kristian Lona via openwrt-devel wrote: The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software. Looks good to me, I'll let others review it during next days and apply it if noone objects. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH] bcm53xx: add support for Buffalo WZR-1166DHP,DHP2
From: SHIMAMOTO Takayoshi Hardware Specifications: Buffalo WZR-1166DHP/WZR-1166DHP2 wireless router with - SoC: BCM4708A0 - Flash: 128MiB NAND flash - Wi-Fi: 2T2R 11ac/a/b/g/n - Switch: 4x 10/100/1000M ethernet switch - USB: 1x USB 3.0 port - Serial console: 115200,8n1 WZR-1166DHP and WZR-1166DHP2 have different memory capacity. WZR-1166DHP - DRAM: 512 MiB DDR2 SDRAM WZR-1166DHP2 - DRAM: 256 MiB DDR2 SDRAM These hardware components are very similar to the WZR-1750DHP except for the number of antennas. Installation: Serial console connected to J14. Pin layout is 3.3 V, GND, TXD, RXD in order from the mark. Press CTRL + C at boot to enter the CFE prompt. Set the IP address of the TFTP server to 192.168.11.2/24 CFE> flash -noheader 192.168.11.2:openwrt-squashfs.trx nflash0.trx CFE> flash -noheader 192.168.11.2:openwrt-squashfs.trx nflash1.trx CFE> reboot Signed-off-by: SHIMAMOTO Takayoshi --- target/linux/bcm53xx/image/Makefile | 14 + ...-Add-DT-Buffalo-WZR-1166DHP-and-DHP2.patch | 279 ++ 2 files changed, 293 insertions(+) create mode 100644 target/linux/bcm53xx/patches-5.10/035-v5.18-0005-ARM-dts-BCM5301X-Add-DT-Buffalo-WZR-1166DHP-and-DHP2.patch diff --git a/target/linux/bcm53xx/image/Makefile b/target/linux/bcm53xx/image/Makefile index d70e394b94..be75491387 100644 --- a/target/linux/bcm53xx/image/Makefile +++ b/target/linux/bcm53xx/image/Makefile @@ -237,6 +237,20 @@ define Device/buffalo_wzr-1750dhp endef TARGET_DEVICES += buffalo_wzr-1750dhp +define Device/buffalo_wzr-1166dhp + $(call Device/buffalo/Default) + DEVICE_MODEL := WZR-1166DHP + DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES) +endef +TARGET_DEVICES += buffalo_wzr-1166dhp + +define Device/buffalo_wzr-1166dhp2 + $(call Device/buffalo/Default) + DEVICE_MODEL := WZR-1166DHP2 + DEVICE_PACKAGES := $(B43) $(USB3_PACKAGES) +endef +TARGET_DEVICES += buffalo_wzr-1166dhp2 + define Device/dlink DEVICE_VENDOR := D-Link IMAGES := bin diff --git a/target/linux/bcm53xx/patches-5.10/035-v5.18-0005-ARM-dts-BCM5301X-Add-DT-Buffalo-WZR-1166DHP-and-DHP2.patch b/target/linux/bcm53xx/patches-5.10/035-v5.18-0005-ARM-dts-BCM5301X-Add-DT-Buffalo-WZR-1166DHP-and-DHP2.patch new file mode 100644 index 00..538a57ce89 --- /dev/null +++ b/target/linux/bcm53xx/patches-5.10/035-v5.18-0005-ARM-dts-BCM5301X-Add-DT-Buffalo-WZR-1166DHP-and-DHP2.patch @@ -0,0 +1,279 @@ +--- a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile +@@ -98,6 +98,8 @@ dtb-$(CONFIG_ARCH_BCM2835) += \ + dtb-$(CONFIG_ARCH_BCM_5301X) += \ + bcm4708-asus-rt-ac56u.dtb \ + bcm4708-asus-rt-ac68u.dtb \ ++ bcm4708-buffalo-wzr-1166dhp.dtb \ ++ bcm4708-buffalo-wzr-1166dhp2.dtb \ + bcm4708-buffalo-wzr-1750dhp.dtb \ + bcm4708-linksys-ea6300-v1.dtb \ + bcm4708-linksys-ea6500-v2.dtb \ +--- /dev/null b/arch/arm/boot/dts/bcm4708-buffalo-wzr-1166dhp-common.dtsi +@@ -0,0 +1,207 @@ ++// SPDX-License-Identifier: GPL-2.0-or-later OR MIT ++/* ++ * Broadcom BCM470X / BCM5301X ARM platform code. ++ * DTS for Buffalo WZR-1166DHP and WZR-1166DHP2 ++ * ++ * Copyright (C) 2014 Rafał Miłecki ++ * Copyright (C) 2022 SHIMAMOTO Takayoshi ++ */ ++ ++/dts-v1/; ++ ++#include "bcm4708.dtsi" ++#include "bcm5301x-nand-cs0-bch8.dtsi" ++#include ++ ++/ { ++/* ++ compatible = "buffalo,wzr-1166dhp2", "brcm,bcm4708"; ++ model = "Buffalo WZR-1166DHP2"; ++ ++ chosen { ++ bootargs = "console=ttyS0,115200"; ++ }; ++ ++ memory@0 { ++ device_type = "memory"; ++ reg = <0x 0x0800>, ++<0x8800 0x0800>; ++ }; ++*/ ++ spi { ++ compatible = "spi-gpio"; ++ num-chipselects = <1>; ++ gpio-sck = < 7 0>; ++ gpio-mosi = < 4 0>; ++ cs-gpios = < 6 0>; ++ #address-cells = <1>; ++ #size-cells = <0>; ++ ++ hc595: gpio_spi@0 { ++ compatible = "fairchild,74hc595"; ++ reg = <0>; ++ registers-number = <1>; ++ spi-max-frequency = <10>; ++ ++ gpio-controller; ++ #gpio-cells = <2>; ++ ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ usb { ++ /* label = "bcm53xx:blue:usb"; */ ++ function = LED_FUNCTION_USB; ++ color = ; ++ gpios = < 0 GPIO_ACTIVE_HIGH>; ++ trigger-sources = <_port1>, <_port1>, ++<_port1>, <_port2>, ++<_port2>; ++ linux,default-trigger = "usbport"; ++ }; ++ ++ power0 { ++ /* label = "bcm53xx:red:power"; */ ++ function
Re: Optimizing kernel compilation / alignments for network performance
On 05.05.22 18:04, Andrew Lunn wrote: you'll see that most used functions are: v7_dma_inv_range __irqentry_text_end l2c210_inv_range v7_dma_clean_range bcma_host_soc_read32 __netif_receive_skb_core arch_cpu_idle l2c210_clean_range fib_table_lookup There is a lot of cache management functions here. Might sound odd, but have you tried disabling SMP? These cache functions need to operate across all CPUs, and the communication between CPUs can slow them down. If there is only one CPU, these cache functions get simpler and faster. It just depends on your workload. If you have 1 CPU loaded to 100% and the other 3 idle, you might see an improvement. If you actually need more than one CPU, it will probably be worse. I've also found that some Ethernet drivers invalidate or flush too much. If you are sending a 64 byte TCP ACK, all you need to flush is 64 bytes, not the full 1500 MTU. If you receive a TCP ACK, and then recycle the buffer, all you need to invalidate is the size of the ACK, so long as you can guarantee nothing has touched the memory above it. But you need to be careful when implementing tricks like this, or you can get subtle corruption bugs when you get it wrong. I just took a quick look at the driver. It allocates and maps rx buffers that can cover a packet size of BGMAC_RX_MAX_FRAME_SIZE = 9724. This seems rather excessive, especially since most people are going to use a MTU of 1500. My proposal would be to add support for making rx buffer size dependent on MTU, reallocating the ring on MTU changes. This should significantly reduce the time spent on flushing caches. - Felix ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: Optimizing kernel compilation / alignments for network performance
> you'll see that most used functions are: > v7_dma_inv_range > __irqentry_text_end > l2c210_inv_range > v7_dma_clean_range > bcma_host_soc_read32 > __netif_receive_skb_core > arch_cpu_idle > l2c210_clean_range > fib_table_lookup There is a lot of cache management functions here. Might sound odd, but have you tried disabling SMP? These cache functions need to operate across all CPUs, and the communication between CPUs can slow them down. If there is only one CPU, these cache functions get simpler and faster. It just depends on your workload. If you have 1 CPU loaded to 100% and the other 3 idle, you might see an improvement. If you actually need more than one CPU, it will probably be worse. I've also found that some Ethernet drivers invalidate or flush too much. If you are sending a 64 byte TCP ACK, all you need to flush is 64 bytes, not the full 1500 MTU. If you receive a TCP ACK, and then recycle the buffer, all you need to invalidate is the size of the ACK, so long as you can guarantee nothing has touched the memory above it. But you need to be careful when implementing tricks like this, or you can get subtle corruption bugs when you get it wrong. Andrew ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: Optimizing kernel compilation / alignments for network performance
On 29.04.2022 16:49, Arnd Bergmann wrote: On Wed, Apr 27, 2022 at 7:31 PM Rafał Miłecki wrote: On 27.04.2022 14:56, Alexander Lobakin wrote: Thank you Alexander, this appears to be helpful! I decided to ignore CONFIG_DEBUG_FORCE_FUNCTION_ALIGN_64B for now and just adjust CFLAGS manually. 1. Without ce5013ff3bec and with -falign-functions=32 387 Mb/s 2. Without ce5013ff3bec and with -falign-functions=64 377 Mb/s 3. With ce5013ff3bec and with -falign-functions=32 384 Mb/s 4. With ce5013ff3bec and with -falign-functions=64 377 Mb/s So it seems that: 1. -falign-functions=32 = pretty stable high speed 2. -falign-functions=64 = very stable slightly lower speed I'm going to perform tests on more commits but if it stays so reliable as above that will be a huge success for me. Note that the problem may not just be the alignment of a particular function, but also how different function map into your cache. The Cortex-A9 has a 4-way set-associative L1 cache of 16KB, 32KB or 64KB, with a line size of 32 bytes. If you are unlucky and you get five different functions that are frequently called and are a multiple functions are exactly the wrong spacing that they need more than four ways, calling them in sequence would always evict the other ones. The same could of course happen if the problem is the D-cache or the L2. Can you try to get a profile using 'perf record' to see where most time is spent, in both the slowest and the fastest versions? If the instruction cache is the issue, you should see how the hottest addresses line up. Your explanation sounds sane of course. If you take a look at my old e-mail ARM router NAT performance affected by random/unrelated commits https://lkml.org/lkml/2019/5/21/349 https://www.spinics.net/lists/linux-block/msg40624.html you'll see that most used functions are: v7_dma_inv_range __irqentry_text_end l2c210_inv_range v7_dma_clean_range bcma_host_soc_read32 __netif_receive_skb_core arch_cpu_idle l2c210_clean_range fib_table_lookup Is there a way to optimize kernel for optimal cache usage of selected (above) functions? Meanwhile I was testing -fno-reorder-blocks which some OpenWrt folks reported as worth trying. It's another randomness. It stabilizes NAT performance across some commits and breaks stability across others. ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH V3] tplink-safeloader: Patch to handle partitions with alternate names
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software.--- Begin Message --- Some devices, specifically Deco M4R-v3 / M5 have partition names that deviate from the scheme other devices use. They have an added "@0" and "@1" for some patition names. The devices have fallback partitions which will be used in case the device determines that the primary partition set is unbootable. This patch introduces an option to set these alternate partition names in the device definition of tplink-safeloader. Signed-off-by: Ole Kristian Lona --- src/tplink-safeloader.c | 58 - 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c index 1c08a33..2adcaf6 100644 --- a/src/tplink-safeloader.c +++ b/src/tplink-safeloader.c @@ -48,11 +48,20 @@ struct image_partition_entry { /** A flash partition table entry */ struct flash_partition_entry { - char *name; + const char *name; uint32_t base; uint32_t size; }; +/** Flash partition names table entry */ +struct factory_partition_names { + const char *partition_table; + const char *soft_ver; + const char *os_image; + const char *file_system; + const char *extra_para; +}; + /** Partition trailing padding definitions * Values 0x00 to 0xff are reserved to indicate the padding value * Values from 0x100 are reserved to indicate other behaviour */ @@ -89,6 +98,7 @@ struct device_info { struct flash_partition_entry partitions[MAX_PARTITIONS+1]; const char *first_sysupgrade_partition; const char *last_sysupgrade_partition; + struct factory_partition_names partition_names; }; #define SOFT_VER_TEXT(_t) {.type = SOFT_VER_TYPE_TEXT, .text = _t} @@ -2962,6 +2972,21 @@ static struct image_partition_entry alloc_image_partition(const char *name, size return entry; } +/** Sets up default partition names whenever custom names aren't specified */ +static void set_partition_names(struct device_info *info) +{ + if (!info->partition_names.partition_table) + info->partition_names.partition_table = "partition-table"; + if (!info->partition_names.soft_ver) + info->partition_names.soft_ver = "soft-version"; + if (!info->partition_names.os_image) + info->partition_names.os_image = "os-image"; + if (!info->partition_names.file_system) + info->partition_names.file_system = "file-system"; + if (!info->partition_names.extra_para) + info->partition_names.extra_para = "extra-para"; +} + /** Frees an image partition */ static void free_image_partition(struct image_partition_entry entry) { free(entry.data); @@ -2982,8 +3007,10 @@ static void set_source_date_epoch() { } /** Generates the partition-table partition */ -static struct image_partition_entry make_partition_table(const struct flash_partition_entry *p) { - struct image_partition_entry entry = alloc_image_partition("partition-table", 0x800); +static struct image_partition_entry make_partition_table(const char *name, + const struct flash_partition_entry *p) +{ + struct image_partition_entry entry = alloc_image_partition(name, 0x800); char *s = (char *)entry.data, *end = (char *)(s+entry.size); @@ -3018,14 +3045,14 @@ static inline uint8_t bcd(uint8_t v) { /** Generates the soft-version partition */ -static struct image_partition_entry make_soft_version( +static struct image_partition_entry make_soft_version(const char *name, const struct device_info *info, uint32_t rev) { /** If an info string is provided, use this instead of * the structured data, and include the null-termination */ if (info->soft_ver.type == SOFT_VER_TYPE_TEXT) { uint32_t len = strlen(info->soft_ver.text) + 1; - return init_meta_partition_entry("soft-version", + return init_meta_partition_entry(name, info->soft_ver.text, len, info->part_trail); } @@ -3055,11 +3082,11 @@ static struct image_partition_entry make_soft_version( }; if (info->soft_ver_compat_level == 0) - return init_meta_partition_entry("soft-version", , + return init_meta_partition_entry(name, , (uint8_t *)(_level) - (uint8_t *)(), info->part_trail); else - return init_meta_partition_entry("soft-version", , + return init_meta_partition_entry(name, , sizeof(s), info->part_trail); } @@ -3307,6 +3334,8 @@ static void build_image(const char *output, struct flash_partition_entry
RE: [PATCH V2] tplink-safeloader: Patch to handle partitions with alternate names.
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software.--- Begin Message --- Sorry, of course you are right. Thanks! I have also tried a few different solutions to the SPF/DMARC issue, but still haven't found a solution. I will send the new version soon. Regards, Ole Kristian -Original Message- From: Rafał Miłecki Sent: torsdag 5. mai 2022 17:13 To: Ole Kristian Lona ; o...@oklona.net; openwrt-devel@lists.openwrt.org Subject: Re: [PATCH V2] tplink-safeloader: Patch to handle partitions with alternate names. On 5.05.2022 16:33, Ole Kristian Lona wrote: > I removed those "const" qualifiers to get rid of the error message about > "assignments discards 'const' qualifiers"... If I in addition make > flash_partition_entry a const, the file won't compile any more, since we are > adjusting the value of flash_partition_entry "info->partitions" in line 3360. > > I tried a few different variants of using "const", but could not find a > combination that actually works, and yields no error message. Please doble verify that. Do you really get any warnings with change as below? I just tested it and it seems to work diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c index 93b2450..526f709 100644 --- a/src/tplink-safeloader.c +++ b/src/tplink-safeloader.c @@ -48,18 +48,18 @@ struct image_partition_entry { /** A flash partition table entry */ struct flash_partition_entry { - char *name; + const char *name; uint32_t base; uint32_t size; }; /** Flash partition names table entry */ struct factory_partition_names { - char *partition_table; - char *soft_ver; - char *os_image; - char *file_system; - char *extra_para; + const char *partition_table; + const char *soft_ver; + const char *os_image; + const char *file_system; + const char *extra_para; }; /** Partition trailing padding definitions --- End Message --- ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [PATCH V2] tplink-safeloader: Patch to handle partitions with alternate names.
On 5.05.2022 16:33, Ole Kristian Lona wrote: I removed those "const" qualifiers to get rid of the error message about "assignments discards 'const' qualifiers"... If I in addition make flash_partition_entry a const, the file won't compile any more, since we are adjusting the value of flash_partition_entry "info->partitions" in line 3360. I tried a few different variants of using "const", but could not find a combination that actually works, and yields no error message. Please doble verify that. Do you really get any warnings with change as below? I just tested it and it seems to work diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c index 93b2450..526f709 100644 --- a/src/tplink-safeloader.c +++ b/src/tplink-safeloader.c @@ -48,18 +48,18 @@ struct image_partition_entry { /** A flash partition table entry */ struct flash_partition_entry { - char *name; + const char *name; uint32_t base; uint32_t size; }; /** Flash partition names table entry */ struct factory_partition_names { - char *partition_table; - char *soft_ver; - char *os_image; - char *file_system; - char *extra_para; + const char *partition_table; + const char *soft_ver; + const char *os_image; + const char *file_system; + const char *extra_para; }; /** Partition trailing padding definitions ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
RE: [PATCH V2] tplink-safeloader: Patch to handle partitions with alternate names.
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software.--- Begin Message --- I removed those "const" qualifiers to get rid of the error message about "assignments discards 'const' qualifiers"... If I in addition make flash_partition_entry a const, the file won't compile any more, since we are adjusting the value of flash_partition_entry "info->partitions" in line 3360. I tried a few different variants of using "const", but could not find a combination that actually works, and yields no error message. Best regards, Ole Kristian -Original Message- From: Rafał Miłecki Sent: torsdag 5. mai 2022 16:12 To: o...@oklona.net; openwrt-devel@lists.openwrt.org Subject: Re: [PATCH V2] tplink-safeloader: Patch to handle partitions with alternate names. On 5.05.2022 10:31, Ole Kristian Lona via openwrt-devel wrote: > +/** Flash partition names table entry */ > +struct factory_partition_names > { > +char *partition_table; > +char *soft_ver; > +char *os_image; > +char *file_system; > +char *extra_para; > +}; Use "const char *" for each. You'll also need to adjust "struct flash_partition_entry" (add const there too). --- End Message --- ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [PATCH V2] tplink-safeloader: Patch to handle partitions with alternate names.
On 5.05.2022 10:31, Ole Kristian Lona via openwrt-devel wrote: > +/** Flash partition names table entry */ > +struct factory_partition_names { > + char *partition_table; > + char *soft_ver; > + char *os_image; > + char *file_system; > + char *extra_para; > +}; Use "const char *" for each. You'll also need to adjust "struct flash_partition_entry" (add const there too). ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: Unpatched DNS bug affects millions of routers and IoT devices
Dear Jo-Philipp Wich, Thank you for your reply and information. Regards, Mr. Turritopsis Dohrnii Teo En Ming Targeted Individual in Singapore 5 May 2022 Thursday On Thu, 5 May 2022 at 05:57, Jo-Philipp Wich wrote: > > Hi, > > > [QUOTE] > > > > The library uClibc and its fork from the OpenWRT team, uClibc-ng. Both > > variants are widely used by major vendors like Netgear, Axis, and > > Linksys, as well as Linux distributions suitable for embedded > > applications. > > > > [/QUOTE] > > > > Does it affect my TP-link AC1200 wireless router? > > Neither does current OpenWrt use uClibc, not did the OpenWrt team fork uClibc > into uClibc-ng, both projects are completely unaffiliated with OpenWrt. > > It likely does not affect your TP-link AC1200 wireless router if it runs one > of the currnetly supported OpenWrt version series 19.07, 21.02 or 22.03. > > OpenWrt switched the default libc implementation to musl in June 2015 and > dropped the last remaining ARC-only support for uClibc-ng in December 2020. > > Many vendors use proprietary forks based on a very old OpenWrt 15.05 ("Chaos > Calmer") version, which still used uClibc. This version is long EOL though and > not maintained by the OpenWrt project anymore. It is up to the vendors to > provide patches for their OpenWrt based firmware derivates. > > Regards, > Jo > > ___ > openwrt-devel mailing list > openwrt-devel@lists.openwrt.org > https://lists.openwrt.org/mailman/listinfo/openwrt-devel ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[openwrt] Patch notification: 1 patch updated
Hello, The following patch (submitted by you) has been updated in Patchwork: * openwrt: tplink-safeloader: Patch to handle partitions with alternate names. - http://patchwork.ozlabs.org/project/openwrt/patch/mailman.12731.1651734888.441203.openwrt-de...@lists.openwrt.org/ - for: OpenWrt development was: New now: Changes Requested This email is a notification only - you do not need to respond. Happy patchworking. -- This is an automated mail sent by the Patchwork system at patchwork.ozlabs.org. To stop receiving these notifications, edit your mail settings at: http://patchwork.ozlabs.org/mail/ ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [PATCH] tplink-safeloader: Patch to handle partitions with alternate names.
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software.--- Begin Message --- Sorry. Somehow I did indeed send the old patch! I try to be very thorough, but obviously not good enough! Regards, Ole Kristian On 05/05/2022, 10:28, "Rafał Miłecki" wrote: On 5.05.2022 09:14, Ole Kristian Lona via openwrt-devel wrote: > The sender domain has a DMARC Reject/Quarantine policy which disallows > sending mailing list messages using the original "From" header. > > To mitigate this problem, the original message has been wrapped > automatically by the mailing list software. It's the same patch as before (without any of suggested changes). --- End Message --- ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH V2] tplink-safeloader: Patch to handle partitions with alternate names.
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software.--- Begin Message --- From: Ole Kristian Lona Some devices, specifically Deco M4R-v3 / M5 have partition names that deviate from the scheme other devices use. They have an added "@0" and "@1" for some patition names. The devices have fallback partitions which will be used in case the device determines that the primary partition set is unbootable. This patch introduces an option to set these alternate partition names in the device definition of tplink-safeloader. Signed-off-by: Ole Kristian Lona --- src/tplink-safeloader.c | 56 - 1 file changed, 44 insertions(+), 12 deletions(-) diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c index 1c08a33..0c9d5d5 100644 --- a/src/tplink-safeloader.c +++ b/src/tplink-safeloader.c @@ -53,6 +53,15 @@ struct flash_partition_entry { uint32_t size; }; +/** Flash partition names table entry */ +struct factory_partition_names { + char *partition_table; + char *soft_ver; + char *os_image; + char *file_system; + char *extra_para; +}; + /** Partition trailing padding definitions * Values 0x00 to 0xff are reserved to indicate the padding value * Values from 0x100 are reserved to indicate other behaviour */ @@ -89,6 +98,7 @@ struct device_info { struct flash_partition_entry partitions[MAX_PARTITIONS+1]; const char *first_sysupgrade_partition; const char *last_sysupgrade_partition; + struct factory_partition_names partition_names; }; #define SOFT_VER_TEXT(_t) {.type = SOFT_VER_TYPE_TEXT, .text = _t} @@ -2962,6 +2972,21 @@ static struct image_partition_entry alloc_image_partition(const char *name, size return entry; } +/** Sets up default partition names whenever custom names aren't specified */ +static void set_partition_names(struct device_info *info) +{ + if (!info->partition_names.partition_table) + info->partition_names.partition_table = "partition-table"; + if (!info->partition_names.soft_ver) + info->partition_names.soft_ver = "soft-version"; + if (!info->partition_names.os_image) + info->partition_names.os_image = "os-image"; + if (!info->partition_names.file_system) + info->partition_names.file_system = "file-system"; + if (!info->partition_names.extra_para) + info->partition_names.extra_para = "extra-para"; +} + /** Frees an image partition */ static void free_image_partition(struct image_partition_entry entry) { free(entry.data); @@ -2982,8 +3007,10 @@ static void set_source_date_epoch() { } /** Generates the partition-table partition */ -static struct image_partition_entry make_partition_table(const struct flash_partition_entry *p) { - struct image_partition_entry entry = alloc_image_partition("partition-table", 0x800); +static struct image_partition_entry make_partition_table(const char *name, + const struct flash_partition_entry *p) +{ + struct image_partition_entry entry = alloc_image_partition(name, 0x800); char *s = (char *)entry.data, *end = (char *)(s+entry.size); @@ -3018,14 +3045,14 @@ static inline uint8_t bcd(uint8_t v) { /** Generates the soft-version partition */ -static struct image_partition_entry make_soft_version( +static struct image_partition_entry make_soft_version(const char *name, const struct device_info *info, uint32_t rev) { /** If an info string is provided, use this instead of * the structured data, and include the null-termination */ if (info->soft_ver.type == SOFT_VER_TYPE_TEXT) { uint32_t len = strlen(info->soft_ver.text) + 1; - return init_meta_partition_entry("soft-version", + return init_meta_partition_entry(name, info->soft_ver.text, len, info->part_trail); } @@ -3055,11 +3082,11 @@ static struct image_partition_entry make_soft_version( }; if (info->soft_ver_compat_level == 0) - return init_meta_partition_entry("soft-version", , + return init_meta_partition_entry(name, , (uint8_t *)(_level) - (uint8_t *)(), info->part_trail); else - return init_meta_partition_entry("soft-version", , + return init_meta_partition_entry(name, , sizeof(s), info->part_trail); } @@ -3307,6 +3334,8 @@ static void build_image(const char *output, struct flash_partition_entry *file_system_partition = NULL; size_t firmware_partition_index = 0; + set_partition_names(info); + for (i = 0; info->partitions[i].name; i++) {
Re: [PATCH] tplink-safeloader: Patch to handle partitions with alternate names.
On 5.05.2022 09:14, Ole Kristian Lona via openwrt-devel wrote: The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software. It's the same patch as before (without any of suggested changes). ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [PATCH] tplink-safeloader: Patch to handle partitions with alternate names.
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software.--- Begin Message --- Thank you! Very good suggestion, I added this to my newest version, and sent it in now. Have tried to fix SPF, so hope the mail looks better now. Best regards, Ole Kristian Lona On 03/05/2022, 09:09, "Rafał Miłecki" wrote: On 2.05.2022 18:24, Ole Kristian Lona via openwrt-devel wrote: > The sender domain has a DMARC Reject/Quarantine policy which disallows > sending mailing list messages using the original "From" header. > > To mitigate this problem, the original message has been wrapped > automatically by the mailing list software. Please kindly fix your domain setup. That ML workaround with forwarding makes it hard to read / review / apply your changes. > @@ -3306,6 +3318,8 @@ static void build_image(const char *output, > struct flash_partition_entry *os_image_partition = NULL; > struct flash_partition_entry *file_system_partition = NULL; > size_t firmware_partition_index = 0; > +char fs_name[32]; > +char os_name[32]; > > for (i = 0; info->partitions[i].name; i++) { > if (!strcmp(info->partitions[i].name, "firmware")) I don't think you need those fs_name / os_name. Just add "const" where it's needed. > @@ -3339,15 +3359,38 @@ static void build_image(const char *output, > > file_system_partition->size = firmware_partition->size - file_system_partition->base; > > -os_image_partition->name = "os-image"; > +if (info->partition_names.os_image == NULL) > +os_image_partition->name = "os-image"; > +else { > +strcpy(os_name, info->partition_names.os_image); > +os_image_partition->name = os_name; > +} > + > os_image_partition->size = kernel.st_size; > } > > -parts[0] = make_partition_table(info->partitions); > -parts[1] = make_soft_version(info, rev); > +if (info->partition_names.partition_table == NULL) > +parts[0] = make_partition_table("partition-table", info->partitions); > +else > +parts[0] = make_partition_table(info->partition_names.partition_table, info->partitions); > + > +if (info->partition_names.soft_ver == NULL) > +parts[1] = make_soft_version("soft-version", info, rev); > +else > +parts[1] = make_soft_version(info->partition_names.soft_ver, info, rev); > + > parts[2] = make_support_list(info); > -parts[3] = read_file("os-image", kernel_image, false, NULL); > -parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof, file_system_partition); > + > +if (info->partition_names.os_image == NULL) > +parts[3] = read_file("os-image", kernel_image, false, NULL); > +else > +parts[3] = read_file(info->partition_names.os_image, kernel_image, false, NULL); > + > +if (info->partition_names.file_system == NULL) > +parts[4] = read_file("file-system", rootfs_image, add_jffs2_eof, file_system_partition); > +else > +parts[4] = read_file(info->partition_names.file_system, rootfs_image, add_jffs2_eof, file_system_partition); > + > > /* Some devices need the extra-para partition to accept the firmware */ > if (strcasecmp(info->id, "ARCHER-A6-V3") == 0 || We now have all those (foo == NULL) checks everywhere. We also have default names inlined all around. What about adding new function that will setup default names if custom ones are not specified? That would gather all checking code in one place and would let you move all NULL checks to a single place. set_default_names() { if (!info->partition_names.partition_table) info->partition_names.partition_table = "partition-table"; if (!info->partition_names.soft_ver) info->partition_names.soft_ver = "soft-version"; (...) } --- End Message --- ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH] tplink-safeloader: Patch to handle partitions with alternate names.
The sender domain has a DMARC Reject/Quarantine policy which disallows sending mailing list messages using the original "From" header. To mitigate this problem, the original message has been wrapped automatically by the mailing list software.--- Begin Message --- From: Ole Kristian Lona Some devices, specifically Deco M4R-v3 / M5 have partition names that deviate from the scheme other devices use. They have an added "@0" and "@1" for some patition names. The devices have fallback partitions which will be used in case the device determines that the primary partition set is unbootable. This patch introduces an option to set these alternate partition names in the device definition of tplink-safeloader. Signed-off-by: Ole Kristian Lona --- src/tplink-safeloader.c | 67 + 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/src/tplink-safeloader.c b/src/tplink-safeloader.c index fc46124..0ddbc02 100644 --- a/src/tplink-safeloader.c +++ b/src/tplink-safeloader.c @@ -53,6 +53,15 @@ struct flash_partition_entry { uint32_t size; }; +/** Flash partition names table entry */ +struct factory_partition_names { + const char *partition_table; + const char *soft_ver; + const char *os_image; + const char *file_system; + const char *extra_para; +}; + /** Partition trailing padding definitions * Values 0x00 to 0xff are reserved to indicate the padding value * Values from 0x100 are reserved to indicate other behaviour */ @@ -89,6 +98,7 @@ struct device_info { struct flash_partition_entry partitions[MAX_PARTITIONS+1]; const char *first_sysupgrade_partition; const char *last_sysupgrade_partition; + struct factory_partition_names partition_names; }; #define SOFT_VER_TEXT(_t) {.type = SOFT_VER_TYPE_TEXT, .text = _t} @@ -2982,8 +2992,10 @@ static void set_source_date_epoch() { } /** Generates the partition-table partition */ -static struct image_partition_entry make_partition_table(const struct flash_partition_entry *p) { - struct image_partition_entry entry = alloc_image_partition("partition-table", 0x800); +static struct image_partition_entry make_partition_table(const char *name, + const struct flash_partition_entry *p) +{ + struct image_partition_entry entry = alloc_image_partition(name, 0x800); char *s = (char *)entry.data, *end = (char *)(s+entry.size); @@ -3018,14 +3030,14 @@ static inline uint8_t bcd(uint8_t v) { /** Generates the soft-version partition */ -static struct image_partition_entry make_soft_version( +static struct image_partition_entry make_soft_version(const char *name, const struct device_info *info, uint32_t rev) { /** If an info string is provided, use this instead of * the structured data, and include the null-termination */ if (info->soft_ver.type == SOFT_VER_TYPE_TEXT) { uint32_t len = strlen(info->soft_ver.text) + 1; - return init_meta_partition_entry("soft-version", + return init_meta_partition_entry(name, info->soft_ver.text, len, info->part_trail); } @@ -3055,11 +3067,11 @@ static struct image_partition_entry make_soft_version( }; if (info->soft_ver_compat_level == 0) - return init_meta_partition_entry("soft-version", , + return init_meta_partition_entry(name, , (uint8_t *)(_level) - (uint8_t *)(), info->part_trail); else - return init_meta_partition_entry("soft-version", , + return init_meta_partition_entry(name, , sizeof(s), info->part_trail); } @@ -3306,6 +3318,8 @@ static void build_image(const char *output, struct flash_partition_entry *os_image_partition = NULL; struct flash_partition_entry *file_system_partition = NULL; size_t firmware_partition_index = 0; + char fs_name[32]; + char os_name[32]; for (i = 0; info->partitions[i].name; i++) { if (!strcmp(info->partitions[i].name, "firmware")) @@ -3330,7 +3344,13 @@ static void build_image(const char *output, for (i = MAX_PARTITIONS-1; i >= firmware_partition_index + 1; i--) info->partitions[i+1] = info->partitions[i]; - file_system_partition->name = "file-system"; + if (info->partition_names.file_system == NULL) + file_system_partition->name = "file-system"; + else { + strcpy(fs_name, info->partition_names.file_system); + file_system_partition->name = fs_name; + } + file_system_partition->base = firmware_partition->base + kernel.st_size; /* Align partition start to erase blocks for factory images only */ @@ -3339,15 +3359,38 @@ static void