[no subject]
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 --- Hi everyone, Earlier today, I have tried to (re-)submit a patch to the mailing list (messages listed below). The mails show up fine on the list archives at infradead.org. Since my DMARC policy is (was) "p=quarantine", the forwarded messages were wrapped as a mitigation. The wrapped messages however, still showed up in my mailbox with an empty subject. The patch is also not being picked up by Patchwork. I will probably have to mail the patch again to get it processed, but I'm starting to feel annoyed by causing all this noise on the list with my resubmissions. Patch messages 2020-06-23: https://lists.infradead.org/pipermail/openwrt-devel/2020-June/029795.html https://lists.infradead.org/pipermail/openwrt-devel/2020-June/029796.html Patch messages 2020-06-27: https://lists.infradead.org/pipermail/openwrt-devel/2020-June/029843.html https://lists.infradead.org/pipermail/openwrt-devel/2020-June/029844.html Ideally, I should be able to keep my DMARC policy set to 'quarantine', if mailman would rewrite the From header and re-sign the message with the mail server's DKIM key (stripping my signature in the process). However, I don't know if Patchworks would be able to correctly process mails like this. Commit messages would still contain Signed-of-by and the Reply-to mail-header would also correspond to the author/submitter. Regards, Sander --- End Message --- ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org http://lists.infradead.org/mailman/listinfo/openwrt-devel
[no subject]
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 --- okli images always have the following structure: * ELF kernel loader * kernel uImage * rootfs Because the kernel loader is limited in size, the uImage can start within the same erase block. The current version of the the uImage splitter doesn't handle uImages not starting at an erase block boundary, requiring fixed partition splits. A fixed rootfs/kernel split may require future tuning if the kernel size changes. A fixed loader/firmware split enabled the current uImage splitter, but would require sysupgrade files without a loader, complicating build directives. This patch implements a basic partition scan, assuming the order listed above. If the ELF loader is present at the start of the firmware partition, it is included in the kernel partition. If not, then the dynamic kernel partition only comprises the uImage. This is done for backwards compatibility with other devices that use an openwrt,okli compatible firmware partition with a separate loader partition. Signed-off-by: Sander Vanheule --- .../drivers/mtd/mtdsplit/mtdsplit_uimage.c| 124 +- 1 file changed, 118 insertions(+), 6 deletions(-) diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c index 525ad8218b..5476ed3508 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c @@ -411,12 +411,13 @@ static struct mtd_part_parser uimage_fonfxc_parser = { * OKLI (OpenWrt Kernel Loader Image) **/ -#define IH_MAGIC_OKLI 0x4f4b4c49 +#define IH_MAGIC_OKLI0x4f4b4c49 +#define OKLI_MAGIC_ELF 0x7f454c46 +#define OKLI_NUM_PARTS 2 +#define OKLI_SEARCH_STEP 0x1000 -static ssize_t uimage_verify_okli(u_char *buf, size_t len, int *extralen) +static int uimage_verify_okli(struct uimage_header *header) { - struct uimage_header *header = (struct uimage_header *)buf; - /* default sanity checks */ if (be32_to_cpu(header->ih_magic) != IH_MAGIC_OKLI) { pr_debug("invalid uImage magic: %08x\n", @@ -439,13 +440,124 @@ static ssize_t uimage_verify_okli(u_char *buf, size_t len, int *extralen) return 0; } +static ssize_t +uimage_okli_find_offset(struct mtd_info *master, + size_t *uimage_size) +{ + struct uimage_header *buf; + size_t buf_len = sizeof(struct uimage_header); + size_t offset; + int ret; + + buf = vmalloc(buf_len); + if (!buf) + return -ENOMEM; + + /* use default okli step size to search for uImage */ + for (offset = 0; offset < master->size; offset += OKLI_SEARCH_STEP) { + *uimage_size = 0; + + ret = read_uimage_header(master, offset, (u_char *)buf, buf_len); + if (ret) + continue; + + ret = uimage_verify_okli(buf); + if (ret) { + pr_debug("no valid uImage found in \"%s\" at offset %llx\n", + master->name, (unsigned long long) offset); + continue; + } + + *uimage_size = sizeof(*buf) + be32_to_cpu(buf->ih_size); + + if ((offset + *uimage_size) > master->size) { + pr_debug("uImage exceeds MTD device \"%s\"\n", master->name); + *uimage_size = 0; + continue; + } + break; + } + + vfree(buf); + + if (offset == master->size) { + pr_debug("no uImage found in \"%s\"\n", master->name); + return -ENODEV; + } + + return offset; +} + static int mtdsplit_uimage_parse_okli(struct mtd_info *master, const struct mtd_partition **pparts, struct mtd_part_parser_data *data) { - return __mtdsplit_parse_uimage(master, pparts, data, - uimage_verify_okli); + struct mtd_partition *parts; + size_t uimage_offset; + size_t uimage_size = 0; + size_t rootfs_offset; + size_t rootfs_size = 0; + int ret; + enum mtdsplit_part_type type; + + uint32_t magic; + ret = read_uimage_header(master, 0, (u_char *), sizeof(magic)); + if (ret) + return ret; + + switch (be32_to_cpu(magic)) { + case OKLI_MAGIC_ELF: + case IH_MAGIC_OKLI: + break; + default: + pr_debug("invalid partition magic: %08x\n", be32_to_cpu(magic)); + return -EINVAL; + } + +
[no subject]
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 --- [resubmission after openwrt-devel list DMARC issues] To enable dynamic kernel/rootfs splitting for devices that require an ELF loader, I decided to modify the current splitter for openwrt,okli compatible partitions. openwrt,okli is currently used by one device: PISEN WMB001N. For this device, this patch could remove the custom build directives for the factory images. For TP-Link CPE devices, it could enable a dynamic firmware partition, where these devices currently employ a fixed partition split. The modifications are placed inside mtdsplit_uimage.c to leverage the existing uImage definitions. Alternatively, this loader could be moved to a separate file, but then I would prefer to create an extra mtdsplit_uimage.h header for the common parts. This would touch more parts of the code, but might be better moving forward. This patch was also posted on github as part of pull request #3130 https://github.com/openwrt/openwrt/pull/3130 Sander Vanheule (1): kernel: mtdsplit: support okli loader splitting .../drivers/mtd/mtdsplit/mtdsplit_uimage.c| 124 +- 1 file changed, 118 insertions(+), 6 deletions(-) -- 2.26.2 --- End Message --- ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org http://lists.infradead.org/mailman/listinfo/openwrt-devel
[no subject]
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 --- To enable dynamic kernel/rootfs splitting for devices that require an ELF loader, I decided to modify the current splitter for openwrt,okli compatible partitions. openwrt,okli is currently used by one device: PISEN WMB001N. For this device, this patch could remove the custom build directives for the factory images. For TP-Link CPE devices, it could enable a dynamic firmware partition, while these devices currently employ a fixed partition split. The modifications are placed inside mtdsplit_uimage.c to leverage the existing uImage definitions. Alternatively, this loader could be moved to a separate file, but then I would prefer to create an extra mtdsplit_uimage.h header for the common parts. This would touch more parts of the code, but might be better moving forward. This patch was also posted on github with pull request #3130 https://github.com/openwrt/openwrt/pull/3130 Sander Vanheule (1): kernel: mtdsplit: support okli loader splitting .../drivers/mtd/mtdsplit/mtdsplit_uimage.c| 124 +- 1 file changed, 118 insertions(+), 6 deletions(-) -- 2.26.2 --- End Message --- ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org http://lists.infradead.org/mailman/listinfo/openwrt-devel
[no subject]
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 --- okli images always have the following structure: * ELF kernel loader * kernel uImage * rootfs Because the kernel loader is limited in size, the uImage can start within the same erase block. The current version of the the uImage splitter doesn't handle uImages not starting at an erase block boundary, requiring fixed partition splits. A fixed rootfs/kernel split may require future tuning if the kernel size changes. A fixed loader/firmware split enabled the current uImage splitter, but would require sysupgrade files without a loader, complicating build directives. This patch implements a basic partition scan, assuming the order listed above. If the ELF loader is present at the start of the firmware partition, it is included in the kernel partition. If not, then the dynamic kernel partition only comprises the uImage. This is done for backwards compatibility with other devices that use an openwrt,okli compatible firmware partition with a separate loader partition. Signed-off-by: Sander Vanheule --- .../drivers/mtd/mtdsplit/mtdsplit_uimage.c| 124 +- 1 file changed, 118 insertions(+), 6 deletions(-) diff --git a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c index 525ad8218b..5476ed3508 100644 --- a/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c +++ b/target/linux/generic/files/drivers/mtd/mtdsplit/mtdsplit_uimage.c @@ -411,12 +411,13 @@ static struct mtd_part_parser uimage_fonfxc_parser = { * OKLI (OpenWrt Kernel Loader Image) **/ -#define IH_MAGIC_OKLI 0x4f4b4c49 +#define IH_MAGIC_OKLI0x4f4b4c49 +#define OKLI_MAGIC_ELF 0x7f454c46 +#define OKLI_NUM_PARTS 2 +#define OKLI_SEARCH_STEP 0x1000 -static ssize_t uimage_verify_okli(u_char *buf, size_t len, int *extralen) +static int uimage_verify_okli(struct uimage_header *header) { - struct uimage_header *header = (struct uimage_header *)buf; - /* default sanity checks */ if (be32_to_cpu(header->ih_magic) != IH_MAGIC_OKLI) { pr_debug("invalid uImage magic: %08x\n", @@ -439,13 +440,124 @@ static ssize_t uimage_verify_okli(u_char *buf, size_t len, int *extralen) return 0; } +static ssize_t +uimage_okli_find_offset(struct mtd_info *master, + size_t *uimage_size) +{ + struct uimage_header *buf; + size_t buf_len = sizeof(struct uimage_header); + size_t offset; + int ret; + + buf = vmalloc(buf_len); + if (!buf) + return -ENOMEM; + + /* use default okli step size to search for uImage */ + for (offset = 0; offset < master->size; offset += OKLI_SEARCH_STEP) { + *uimage_size = 0; + + ret = read_uimage_header(master, offset, (u_char *)buf, buf_len); + if (ret) + continue; + + ret = uimage_verify_okli(buf); + if (ret) { + pr_debug("no valid uImage found in \"%s\" at offset %llx\n", + master->name, (unsigned long long) offset); + continue; + } + + *uimage_size = sizeof(*buf) + be32_to_cpu(buf->ih_size); + + if ((offset + *uimage_size) > master->size) { + pr_debug("uImage exceeds MTD device \"%s\"\n", master->name); + *uimage_size = 0; + continue; + } + break; + } + + vfree(buf); + + if (offset == master->size) { + pr_debug("no uImage found in \"%s\"\n", master->name); + return -ENODEV; + } + + return offset; +} + static int mtdsplit_uimage_parse_okli(struct mtd_info *master, const struct mtd_partition **pparts, struct mtd_part_parser_data *data) { - return __mtdsplit_parse_uimage(master, pparts, data, - uimage_verify_okli); + struct mtd_partition *parts; + size_t uimage_offset; + size_t uimage_size = 0; + size_t rootfs_offset; + size_t rootfs_size = 0; + int ret; + enum mtdsplit_part_type type; + + uint32_t magic; + ret = read_uimage_header(master, 0, (u_char *), sizeof(magic)); + if (ret) + return ret; + + switch (be32_to_cpu(magic)) { + case OKLI_MAGIC_ELF: + case IH_MAGIC_OKLI: + break; + default: + pr_debug("invalid partition magic: %08x\n", be32_to_cpu(magic)); + return -EINVAL; + } + +