From 128250e8fc615aebe05642f023375dd7902808e1 Mon Sep 17 00:00:00 2001 From: "Daniel A. Maierhofer" Date: Wed, 26 Feb 2020 21:44:45 +0100 Subject: [PATCH 01/29] lldpd: add management IP setting add option to set management IP pattern also add missing 'unconfigure system hostname' for example pattern '!192.168.1.1' makes it possible that WAN IP is selected instead of LAN IP Signed-off-by: Daniel A. Maierhofer [grammar and spelling fixes in commit message] Signed-off-by: Stijn Tintel --- package/network/services/lldpd/Makefile | 2 +- package/network/services/lldpd/files/lldpd.config | 4 +++- package/network/services/lldpd/files/lldpd.init | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/package/network/services/lldpd/Makefile b/package/network/services/lldpd/Makefile index 48a3993492..7c00685008 100644 --- a/package/network/services/lldpd/Makefile +++ b/package/network/services/lldpd/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=lldpd PKG_VERSION:=1.0.5 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://media.luffy.cx/files/lldpd diff --git a/package/network/services/lldpd/files/lldpd.config b/package/network/services/lldpd/files/lldpd.config index e16643c1f7..5e7c51ba7e 100644 --- a/package/network/services/lldpd/files/lldpd.config +++ b/package/network/services/lldpd/files/lldpd.config @@ -5,7 +5,7 @@ config lldpd config option enable_edp 1 option agentxsocket /var/run/agentx.sock - + option lldp_class 4 option lldp_location "2:FR:6:Commercial Rd:3:Roseville:19:4" @@ -13,6 +13,8 @@ config lldpd config #option lldp_description "OpenWrt System" #option lldp_hostname "Modified Hostname" + #option lldp_mgmt_ip "!192.168.1.1" + # interfaces to listen on list interface "loopback" list interface "lan" diff --git a/package/network/services/lldpd/files/lldpd.init b/package/network/services/lldpd/files/lldpd.init index 9fb3a82559..7a5b25e016 100644 --- a/package/network/services/lldpd/files/lldpd.init +++ b/package/network/services/lldpd/files/lldpd.init @@ -42,11 +42,15 @@ write_lldpd_conf() fi done + local lldp_mgmt_ip + config_get lldp_mgmt_ip 'config' 'lldp_mgmt_ip' + # Clear out the config file first echo -n > "$LLDPD_CONF" [ -n "$ifnames" ] && echo "configure system interface pattern" "$ifnames" >> "$LLDPD_CONF" [ -n "$lldp_description" ] && echo "configure system description" "\"$lldp_description\"" >> "$LLDPD_CONF" [ -n "$lldp_hostname" ] && echo "configure system hostname" "\"$lldp_hostname\"" >> "$LLDPD_CONF" + [ -n "$lldp_mgmt_ip" ] && echo "configure system ip management pattern" "\"$lldp_mgmt_ip\"" >> "$LLDPD_CONF" # Since lldpd's sysconfdir is /tmp, we'll symlink /etc/lldpd.d to /tmp/$LLDPD_CONFS_DIR [ -e $LLDPD_CONFS_DIR ] || ln -s /etc/lldpd.d $LLDPD_CONFS_DIR @@ -103,6 +107,8 @@ reload_service() { unconfigure lldp custom-tlv unconfigure system interface pattern unconfigure system description + unconfigure system hostname + unconfigure system ip management pattern EOF # Rewrite lldpd.conf # If something changed it should be included by the lldpcli call From 03fd38d6128873de0d3b1be9615917c0679efc0f Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Fri, 8 May 2020 05:11:27 +0300 Subject: [PATCH 02/29] kernel: add missing symbol to 5.4 config This symbol is exposed if KERNEL_PROVE_LOCKING is enabled. Signed-off-by: Stijn Tintel --- target/linux/generic/config-5.4 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index a4ff887aa1..fc9b9664da 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -4104,6 +4104,7 @@ CONFIG_PROC_SYSCTL=y # CONFIG_PROFILING is not set # CONFIG_PROVE_LOCKING is not set # CONFIG_PROVE_RCU is not set +# CONFIG_PROVE_RCU_LIST is not set # CONFIG_PROVE_RCU_REPEATEDLY is not set # CONFIG_PSAMPLE is not set # CONFIG_PSB6970_PHY is not set From ee5ee99dcfb87a48a9f5d63e0ad597a7e0062c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Fri, 20 Mar 2020 22:38:51 +0100 Subject: [PATCH 03/29] generic: routerbootpart MTD parser for RouterBoot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This driver provides an OF MTD parser to properly assign the RouterBoot partitions on the flash. This parser builds from the "fixed-partitions" one (see ofpart.c), but it can handle dynamic partitions as found on routerboot devices. The parent node must contain the following: compatible = "mikrotik,routerboot-partitions"; #address-cells = <1>; #size-cells = <1>; Children routerbootpart DTS nodes are defined as follows: For fixed partitions node-name@unit-address { reg = ; label = ; read-only; lock; }; All properties but reg are optional. For dynamic partitions: node-name { size = ; label = ; read-only; lock; }; size property is mandatory unless the next partition is a fixed one or a "well-known" one (matched from the strings defined below) in which case it can be omitted or set to 0; other properties are optional. By default dynamic partitions are appended after the preceding one, except for "well-known" ones which are automatically located on flash. Well-known partitions (matched via label or node-name): - "hard_config" - "soft_config" - "dtb_config" This parser requires the DTS to list partitions in ascending order as expected on the MTD device. This parser has been successfully tested on BE (ath79) and LE (ipq40xx and ramips) hardware. Tested-by: Baptiste Jonglez Tested-by: Roger Pueyo Centelles Tested-by: Tobias Schramm Tested-by: Christopher Hill Signed-off-by: Thibaut VARÈNE --- .../drivers/mtd/parsers/routerbootpart.c | 365 ++++++++++++++++++ 1 file changed, 365 insertions(+) create mode 100644 target/linux/generic/files/drivers/mtd/parsers/routerbootpart.c diff --git a/target/linux/generic/files/drivers/mtd/parsers/routerbootpart.c b/target/linux/generic/files/drivers/mtd/parsers/routerbootpart.c new file mode 100644 index 0000000000..e019094058 --- /dev/null +++ b/target/linux/generic/files/drivers/mtd/parsers/routerbootpart.c @@ -0,0 +1,365 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Parser for MikroTik RouterBoot partitions. + * + * Copyright (C) 2020 Thibaut VARÈNE + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * This parser builds from the "fixed-partitions" one (see ofpart.c), but it can + * handle dynamic partitions as found on routerboot devices. + * + * DTS nodes are defined as follows: + * For fixed partitions: + * node-name@unit-address { + * reg = ; + * label = ; + * read-only; + * lock; + * }; + * + * reg property is mandatory; other properties are optional. + * reg format is
. length can be 0 if the next partition is + * another fixed partition or a "well-known" partition as defined below: in that + * case the partition will extend up to the next one. + * + * For dynamic partitions: + * node-name { + * size = ; + * label = ; + * read-only; + * lock; + * }; + * + * size property is normally mandatory. It can only be omitted (or set to 0) if: + * - the partition is a "well-known" one (as defined below), in which case + * the partition size will be automatically adjusted; or + * - the next partition is a fixed one or a "well-known" one, in which case + * the current partition will extend up to the next one. + * Other properties are optional. + * size format is . + * By default dynamic partitions are appended after the preceding one, except + * for "well-known" ones which are automatically located on flash. + * + * Well-known partitions (matched via label or node-name): + * - "hard_config" + * - "soft_config" + * - "dtb_config" + * + * Note: this parser will happily register 0-sized partitions if misused. + * + * This parser requires the DTS to list partitions in ascending order as + * expected on the MTD device. + * + * Since only the "hard_config" and "soft_config" partitions are used in OpenWRT, + * a minimal working DTS could define only these two partitions dynamically (in + * the right order, usually hard_config then soft_config). + * + * Note: some mips RB devices encode the hard_config offset and length in two + * consecutive u32 located at offset 0x14 (for ramips) or 0x24 (for ath79) on + * the SPI NOR flash. Unfortunately this seems inconsistent across machines and + * does not apply to e.g. ipq-based ones, so we ignore that information. + * + * Note: To find well-known partitions, this parser will go through the entire + * top mtd partition parsed, _before_ the DTS nodes are processed. This works + * well in the current state of affairs, and is a simpler implementation than + * searching for known partitions in the "holes" left between fixed-partition, + * _after_ processing DTS nodes. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#define RB_MAGIC_HARD (('H') | ('a' << 8) | ('r' << 16) | ('d' << 24)) +#define RB_MAGIC_SOFT (('S') | ('o' << 8) | ('f' << 16) | ('t' << 24)) +#define RB_BLOCK_SIZE 0x1000 + +struct routerboot_dynpart { + const char * const name; + const u32 magic; + int (* const size_fixup)(struct mtd_info *, struct routerboot_dynpart *); + size_t offset; + size_t size; + bool found; +}; + +static int routerboot_dtbsfixup(struct mtd_info *, struct routerboot_dynpart *); + +static struct routerboot_dynpart rb_dynparts[] = { + { + .name = "hard_config", + .magic = RB_MAGIC_HARD, // stored in CPU-endianness on flash + .size_fixup = NULL, + .offset = 0x0, + .size = RB_BLOCK_SIZE, + .found = false, + }, { + .name = "soft_config", + .magic = RB_MAGIC_SOFT, // stored in CPU-endianness on flash + .size_fixup = NULL, + .offset = 0x0, + .size = RB_BLOCK_SIZE, + .found = false, + }, { + .name = "dtb_config", + .magic = fdt32_to_cpu(OF_DT_HEADER), // stored BE on flash + .size_fixup = routerboot_dtbsfixup, + .offset = 0x0, + .size = 0x0, + .found = false, + } +}; + +static int routerboot_dtbsfixup(struct mtd_info *master, struct routerboot_dynpart *rbdpart) +{ + int err; + size_t bytes_read, psize; + struct { + fdt32_t magic; + fdt32_t totalsize; + fdt32_t off_dt_struct; + fdt32_t off_dt_strings; + fdt32_t off_mem_rsvmap; + fdt32_t version; + fdt32_t last_comp_version; + fdt32_t boot_cpuid_phys; + fdt32_t size_dt_strings; + fdt32_t size_dt_struct; + } fdt_header; + + err = mtd_read(master, rbdpart->offset, sizeof(fdt_header), + &bytes_read, (u8 *)&fdt_header); + if (err) + return err; + + if (bytes_read != sizeof(fdt_header)) + return -EIO; + + psize = fdt32_to_cpu(fdt_header.totalsize); + if (!psize) + return -EINVAL; + + rbdpart->size = psize; + return 0; +} + +static void routerboot_find_dynparts(struct mtd_info *master) +{ + size_t bytes_read, offset; + bool allfound; + int err, i; + u32 buf; + + /* + * Dynamic RouterBoot partitions offsets are aligned to RB_BLOCK_SIZE: + * read the whole partition at RB_BLOCK_SIZE intervals to find sigs. + * Skip partition content when possible. + */ + offset = 0; + while (offset < master->size) { + err = mtd_read(master, offset, sizeof(buf), &bytes_read, (u8 *)&buf); + if (err) { + pr_err("%s: mtd_read error while parsing (offset: 0x%X): %d\n", + master->name, offset, err); + continue; + } + + allfound = true; + + for (i = 0; i < ARRAY_SIZE(rb_dynparts); i++) { + if (rb_dynparts[i].found) + continue; + + allfound = false; + + if (rb_dynparts[i].magic == buf) { + rb_dynparts[i].offset = offset; + + if (rb_dynparts[i].size_fixup) { + err = rb_dynparts[i].size_fixup(master, &rb_dynparts[i]); + if (err) { + pr_err("%s: size fixup error while parsing \"%s\": %d\n", + master->name, rb_dynparts[i].name, err); + continue; + } + } + + rb_dynparts[i].found = true; + + /* + * move offset to skip the whole partition on + * next iteration if size > RB_BLOCK_SIZE. + */ + if (rb_dynparts[i].size > RB_BLOCK_SIZE) + offset += ALIGN_DOWN((rb_dynparts[i].size - RB_BLOCK_SIZE), RB_BLOCK_SIZE); + + break; + } + } + + offset += RB_BLOCK_SIZE; + + if (allfound) + break; + } +} + +static int routerboot_partitions_parse(struct mtd_info *master, + const struct mtd_partition **pparts, + struct mtd_part_parser_data *data) +{ + struct device_node *rbpart_node, *pp; + struct mtd_partition *parts; + const char *partname; + size_t master_ofs; + int np; + + /* Pull of_node from the master device node */ + rbpart_node = mtd_get_of_node(master); + if (!rbpart_node) + return 0; + + /* First count the subnodes */ + np = 0; + for_each_child_of_node(rbpart_node, pp) + np++; + + if (!np) + return 0; + + parts = kcalloc(np, sizeof(*parts), GFP_KERNEL); + if (!parts) + return -ENOMEM; + + /* Preemptively look for known parts in flash */ + routerboot_find_dynparts(master); + + np = 0; + master_ofs = 0; + for_each_child_of_node(rbpart_node, pp) { + const __be32 *reg, *sz; + size_t offset, size; + int i, len, a_cells, s_cells; + + partname = of_get_property(pp, "label", &len); + /* Allow deprecated use of "name" instead of "label" */ + if (!partname) + partname = of_get_property(pp, "name", &len); + /* Fallback to node name per spec if all else fails: partname is always set */ + if (!partname) + partname = pp->name; + parts[np].name = partname; + + reg = of_get_property(pp, "reg", &len); + if (reg) { + /* Fixed partition */ + a_cells = of_n_addr_cells(pp); + s_cells = of_n_size_cells(pp); + + if ((len / 4) != (a_cells + s_cells)) { + pr_debug("%s: routerboot partition %pOF (%pOF) error parsing reg property.\n", + master->name, pp, rbpart_node); + goto rbpart_fail; + } + + offset = of_read_number(reg, a_cells); + size = of_read_number(reg + a_cells, s_cells); + } else { + /* Dynamic partition */ + /* Default: part starts at current offset, 0 size */ + offset = master_ofs; + size = 0; + + /* Check if well-known partition */ + for (i = 0; i < ARRAY_SIZE(rb_dynparts); i++) { + if (!strcmp(partname, rb_dynparts[i].name) && rb_dynparts[i].found) { + offset = rb_dynparts[i].offset; + size = rb_dynparts[i].size; + break; + } + } + + /* Standalone 'size' property? Override size */ + sz = of_get_property(pp, "size", &len); + if (sz) { + s_cells = of_n_size_cells(pp); + if ((len / 4) != s_cells) { + pr_debug("%s: routerboot partition %pOF (%pOF) error parsing size property.\n", + master->name, pp, rbpart_node); + goto rbpart_fail; + } + + size = of_read_number(sz, s_cells); + } + } + + if (np > 0) { + /* Minor sanity check for overlaps */ + if (offset < (parts[np-1].offset + parts[np-1].size)) { + pr_err("%s: routerboot partition %pOF (%pOF) \"%s\" overlaps with previous partition \"%s\".\n", + master->name, pp, rbpart_node, + partname, parts[np-1].name); + goto rbpart_fail; + } + + /* Fixup end of previous partition if necessary */ + if (!parts[np-1].size) + parts[np-1].size = (offset - parts[np-1].offset); + } + + if ((offset + size) > master->size) { + pr_err("%s: routerboot partition %pOF (%pOF) \"%s\" extends past end of segment.\n", + master->name, pp, rbpart_node, partname); + goto rbpart_fail; + } + + parts[np].offset = offset; + parts[np].size = size; + parts[np].of_node = pp; + + if (of_get_property(pp, "read-only", &len)) + parts[np].mask_flags |= MTD_WRITEABLE; + + if (of_get_property(pp, "lock", &len)) + parts[np].mask_flags |= MTD_POWERUP_LOCK; + + /* Keep master offset aligned to RB_BLOCK_SIZE */ + master_ofs = ALIGN(offset + size, RB_BLOCK_SIZE); + np++; + } + + *pparts = parts; + return np; + +rbpart_fail: + pr_err("%s: error parsing routerboot partition %pOF (%pOF)\n", + master->name, pp, rbpart_node); + of_node_put(pp); + kfree(parts); + return -EINVAL; +} + +static const struct of_device_id parse_routerbootpart_match_table[] = { + { .compatible = "mikrotik,routerboot-partitions" }, + {}, +}; +MODULE_DEVICE_TABLE(of, parse_routerbootpart_match_table); + +static struct mtd_part_parser routerbootpart_parser = { + .parse_fn = routerboot_partitions_parse, + .name = "routerbootpart", + .of_match_table = parse_routerbootpart_match_table, +}; +module_mtd_part_parser(routerbootpart_parser); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("MTD partitioning for RouterBoot"); +MODULE_AUTHOR("Thibaut VARENE"); From 2976e423dc6e8dd08e39569a57d75330abf6df14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Tue, 24 Mar 2020 11:19:41 +0100 Subject: [PATCH 04/29] generic: routerboot partition build bits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thibaut VARÈNE --- target/linux/generic/config-4.14 | 1 + target/linux/generic/config-4.19 | 1 + target/linux/generic/config-5.4 | 1 + ...mtd-add-routerbootpart-parser-config.patch | 43 +++++++++++++++++++ ...mtd-add-routerbootpart-parser-config.patch | 41 ++++++++++++++++++ ...mtd-add-routerbootpart-parser-config.patch | 38 ++++++++++++++++ 6 files changed, 125 insertions(+) create mode 100644 target/linux/generic/pending-4.14/435-mtd-add-routerbootpart-parser-config.patch create mode 100644 target/linux/generic/pending-4.19/435-mtd-add-routerbootpart-parser-config.patch create mode 100644 target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch diff --git a/target/linux/generic/config-4.14 b/target/linux/generic/config-4.14 index cd087227ae..c8b3c602dd 100644 --- a/target/linux/generic/config-4.14 +++ b/target/linux/generic/config-4.14 @@ -2877,6 +2877,7 @@ CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 # CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set # CONFIG_MTD_ROM is not set CONFIG_MTD_ROOTFS_ROOT_DEV=y +# CONFIG_MTD_ROUTERBOOT_PARTS is not set # CONFIG_MTD_SLRAM is not set # CONFIG_MTD_SM_COMMON is not set # CONFIG_MTD_SPINAND_MT29F is not set diff --git a/target/linux/generic/config-4.19 b/target/linux/generic/config-4.19 index 4ce3de57ad..9e3e35f793 100644 --- a/target/linux/generic/config-4.19 +++ b/target/linux/generic/config-4.19 @@ -3024,6 +3024,7 @@ CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 # CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set # CONFIG_MTD_ROM is not set CONFIG_MTD_ROOTFS_ROOT_DEV=y +# CONFIG_MTD_ROUTERBOOT_PARTS is not set # CONFIG_MTD_SLRAM is not set # CONFIG_MTD_SM_COMMON is not set # CONFIG_MTD_SPINAND_MT29F is not set diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index fc9b9664da..67a69ef741 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -3221,6 +3221,7 @@ CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1 # CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set # CONFIG_MTD_ROM is not set CONFIG_MTD_ROOTFS_ROOT_DEV=y +# CONFIG_MTD_ROUTERBOOT_PARTS is not set # CONFIG_MTD_SLRAM is not set # CONFIG_MTD_SM_COMMON is not set # CONFIG_MTD_SPINAND_MT29F is not set diff --git a/target/linux/generic/pending-4.14/435-mtd-add-routerbootpart-parser-config.patch b/target/linux/generic/pending-4.14/435-mtd-add-routerbootpart-parser-config.patch new file mode 100644 index 0000000000..192886b102 --- /dev/null +++ b/target/linux/generic/pending-4.14/435-mtd-add-routerbootpart-parser-config.patch @@ -0,0 +1,43 @@ +From 4437e01fb6bca63fccdba5d6c44888b0935885c2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= +Date: Tue, 24 Mar 2020 11:45:07 +0100 +Subject: [PATCH] generic: routerboot partition build bits (4.14) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch adds routerbootpart kernel build bits + +Signed-off-by: Thibaut VARÈNE +--- + drivers/mtd/parsers/Kconfig | 9 +++++++++ + drivers/mtd/parsers/Makefile | 1 + + 2 files changed, 10 insertions(+) + +diff --git a/drivers/mtd/parsers/Kconfig b/drivers/mtd/parsers/Kconfig +index d206b3c..58cbdd6 100644 +--- a/drivers/mtd/parsers/Kconfig ++++ b/drivers/mtd/parsers/Kconfig +@@ -6,3 +6,12 @@ config MTD_PARSER_TRX + may contain up to 3/4 partitions (depending on the version). + This driver will parse TRX header and report at least two partitions: + kernel and rootfs. ++ ++config MTD_ROUTERBOOT_PARTS ++ tristate "RouterBoot flash partition parser" ++ depends on MTD && OF ++ help ++ MikroTik RouterBoot is implemented as a multi segment system on the ++ flash, some of which are fixed and some of which are located at ++ variable offsets. This parser handles both cases via properly ++ formatted DTS. +diff --git a/drivers/mtd/parsers/Makefile b/drivers/mtd/parsers/Makefile +index 4d9024e..41d363a 100644 +--- a/drivers/mtd/parsers/Makefile ++++ b/drivers/mtd/parsers/Makefile +@@ -1 +1,2 @@ + obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o ++obj-$(CONFIG_MTD_ROUTERBOOT_PARTS) += routerbootpart.o +-- +2.11.0 + diff --git a/target/linux/generic/pending-4.19/435-mtd-add-routerbootpart-parser-config.patch b/target/linux/generic/pending-4.19/435-mtd-add-routerbootpart-parser-config.patch new file mode 100644 index 0000000000..678eaed4ce --- /dev/null +++ b/target/linux/generic/pending-4.19/435-mtd-add-routerbootpart-parser-config.patch @@ -0,0 +1,41 @@ +From 4437e01fb6bca63fccdba5d6c44888b0935885c2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= +Date: Tue, 24 Mar 2020 11:45:07 +0100 +Subject: [PATCH] generic: routerboot partition build bits (4.19) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch adds routerbootpart kernel build bits + +Signed-off-by: Thibaut VARÈNE +--- + drivers/mtd/parsers/Kconfig | 9 +++++++++ + drivers/mtd/parsers/Makefile | 1 + + 2 files changed, 10 insertions(+) + +diff --git a/drivers/mtd/parsers/Kconfig b/drivers/mtd/parsers/Kconfig +index de6f5f8..0afa89c 100644 +--- a/drivers/mtd/parsers/Kconfig ++++ b/drivers/mtd/parsers/Kconfig +@@ -22,3 +22,12 @@ config MTD_SHARPSL_PARTS + This provides the read-only FTL logic necessary to read the partition + table from the NAND flash of Sharp SL Series (Zaurus) and the MTD + partition parser using this code. ++ ++config MTD_ROUTERBOOT_PARTS ++ tristate "RouterBoot flash partition parser" ++ depends on MTD && OF ++ help ++ MikroTik RouterBoot is implemented as a multi segment system on the ++ flash, some of which are fixed and some of which are located at ++ variable offsets. This parser handles both cases via properly ++ formatted DTS. +diff --git a/drivers/mtd/parsers/Makefile b/drivers/mtd/parsers/Makefile +index 44ff342..0543362 100644 +--- a/drivers/mtd/parsers/Makefile ++++ b/drivers/mtd/parsers/Makefile +@@ -1,2 +1,3 @@ + obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o + obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o ++obj-$(CONFIG_MTD_ROUTERBOOT_PARTS) += routerbootpart.o diff --git a/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch b/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch new file mode 100644 index 0000000000..3ab78838b0 --- /dev/null +++ b/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch @@ -0,0 +1,38 @@ +From 4437e01fb6bca63fccdba5d6c44888b0935885c2 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= +Date: Tue, 24 Mar 2020 11:45:07 +0100 +Subject: [PATCH] generic: routerboot partition build bits (5.4) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch adds routerbootpart kernel build bits + +Signed-off-by: Thibaut VARÈNE +--- + drivers/mtd/parsers/Kconfig | 9 +++++++++ + drivers/mtd/parsers/Makefile | 1 + + 2 files changed, 10 insertions(+) + +--- a/drivers/mtd/parsers/Kconfig ++++ b/drivers/mtd/parsers/Kconfig +@@ -160,3 +160,12 @@ config MTD_REDBOOT_PARTS_READONLY + 'FIS directory' images, enable this option. + + endif # MTD_REDBOOT_PARTS ++ ++config MTD_ROUTERBOOT_PARTS ++ tristate "RouterBoot flash partition parser" ++ depends on MTD && OF ++ help ++ MikroTik RouterBoot is implemented as a multi segment system on the ++ flash, some of which are fixed and some of which are located at ++ variable offsets. This parser handles both cases via properly ++ formatted DTS. +--- a/drivers/mtd/parsers/Makefile ++++ b/drivers/mtd/parsers/Makefile +@@ -10,3 +10,4 @@ + obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o + obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o + obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o ++obj-$(CONFIG_MTD_ROUTERBOOT_PARTS) += routerbootpart.o From c8b2ad41857dab598f38d49bc73622f5fb143521 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sat, 21 Mar 2020 12:17:49 +0100 Subject: [PATCH 05/29] ath79/mikrotik: enable CONFIG_MTD_ROUTERBOOT_PARTS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thibaut VARÈNE --- target/linux/ath79/mikrotik/config-default | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/mikrotik/config-default b/target/linux/ath79/mikrotik/config-default index c0c61985bc..e1e30dbe8f 100644 --- a/target/linux/ath79/mikrotik/config-default +++ b/target/linux/ath79/mikrotik/config-default @@ -11,6 +11,7 @@ CONFIG_MTD_NAND_AR934X=y CONFIG_MTD_NAND_CORE=y CONFIG_MTD_NAND_ECC=y CONFIG_MTD_RAW_NAND=y +CONFIG_MTD_ROUTERBOOT_PARTS=y CONFIG_MTD_SPI_NAND=y CONFIG_MTD_SPI_NOR_USE_4K_SECTORS=y CONFIG_MTD_SPLIT_MINOR_FW=y From 8f90dbfd1ff0b0c67a11d3960ca3c2b4384c4abc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sat, 21 Mar 2020 13:07:23 +0100 Subject: [PATCH 06/29] ath79/mikrotik: use routerbootpart partitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable routerbootpart partitions on MikroTik devices. Tested-by: Roger Pueyo Centelles Signed-off-by: Thibaut VARÈNE --- ...56_mikrotik_routerboard-wap-g-5hact2hnd.dts | 18 +++++++----------- ...558_mikrotik_routerboard-922uags-5hpacd.dts | 17 +++++------------ 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts b/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts index 74cf1315b6..a0190760fb 100644 --- a/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts +++ b/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts @@ -84,37 +84,33 @@ label = "RouterBoot"; reg = <0x0 0x20000>; read-only; - compatible = "fixed-partitions"; + compatible = "mikrotik,routerboot-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "bootloader1"; - reg = <0x0 0xe000>; + reg = <0x0 0x0>; read-only; }; - hard_config: partition@e000 { - label = "hard_config"; - reg = <0xe000 0x1000>; + hard_config: hard_config { read-only; }; - partition@f000 { - label = "bios"; - reg = <0xf000 0x1000>; + bios { + size = <0x1000>; read-only; }; partition@10000 { label = "bootloader2"; - reg = <0x10000 0xf000>; + reg = <0x10000 0x0>; read-only; }; - partition@1f000 { + soft_config { label = "soft_config"; - reg = <0x1f000 0x1000>; }; }; diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts index dd4d523368..7377953f78 100644 --- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts @@ -99,32 +99,25 @@ spi-max-frequency = <25000000>; partitions { - compatible = "fixed-partitions"; + compatible = "mikrotik,routerboot-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "routerboot"; - reg = <0x0000000 0x000c000>; + reg = <0x0 0x0>; read-only; }; - hard_config: partition@c000 { - label = "hard_config"; - reg = <0x000c000 0x0001000>; + hard_config: hard_config { read-only; }; - partition@d000 { - label = "bios"; - reg = <0x000d000 0x0001000>; + bios { read-only; }; - partition@e000 { - label = "soft_config"; - reg = <0x000e000 0x0001000>; - read-only; + soft_config { }; }; }; From 274221a836b51915c2ec60d9badcac1f1acaf549 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Tue, 24 Mar 2020 11:22:00 +0100 Subject: [PATCH 07/29] ramips/mt7621: enable CONFIG_MTD_ROUTERBOOT_PARTS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thibaut VARÈNE --- target/linux/ramips/mt7621/config-5.4 | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ramips/mt7621/config-5.4 b/target/linux/ramips/mt7621/config-5.4 index fda295a93f..b1622b7f2a 100644 --- a/target/linux/ramips/mt7621/config-5.4 +++ b/target/linux/ramips/mt7621/config-5.4 @@ -206,6 +206,7 @@ CONFIG_MTD_NAND_ECC_SW_HAMMING=y CONFIG_MTD_NAND_MT7621=y CONFIG_MTD_PHYSMAP=y CONFIG_MTD_RAW_NAND=y +CONFIG_MTD_ROUTERBOOT_PARTS=y CONFIG_MTD_SPI_NOR=y CONFIG_MTD_SPLIT_MINOR_FW=y CONFIG_MTD_SPLIT_SEAMA_FW=y From 21869e8f80c0af3977bb5bffece6986a556cb389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sat, 21 Mar 2020 22:54:53 +0100 Subject: [PATCH 08/29] ramips: mikrotik: use routerbootpart partitions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable routerbootpart partitions on MikroTik devices. Tested-by: Tobias Schramm Signed-off-by: Thibaut VARÈNE --- .../dts/mt7621_mikrotik_routerboard-750gr3.dts | 12 ++++-------- .../ramips/dts/mt7621_mikrotik_routerboard-m11g.dts | 12 ++++-------- .../ramips/dts/mt7621_mikrotik_routerboard-m33g.dts | 12 ++++-------- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts index af0664a4fa..a075d08556 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts @@ -87,19 +87,17 @@ label = "RouterBoot"; reg = <0x0 0x40000>; read-only; - compatible = "fixed-partitions"; + compatible = "mikrotik,routerboot-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "bootloader1"; - reg = <0x0 0xf000>; + reg = <0x0 0x0>; read-only; }; - hard_config: partition@f000 { - label = "hard_config"; - reg = <0xf000 0x1000>; + hard_config: hard_config { read-only; }; @@ -109,9 +107,7 @@ read-only; }; - partition@20000 { - label = "soft_config"; - reg = <0x20000 0x1000>; + soft_config { }; partition@30000 { diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts index bd58aea951..128b8a2816 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts @@ -95,19 +95,17 @@ label = "RouterBoot"; reg = <0x0 0x40000>; read-only; - compatible = "fixed-partitions"; + compatible = "mikrotik,routerboot-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "bootloader1"; - reg = <0x0 0xf000>; + reg = <0x0 0x0>; read-only; }; - hard_config: partition@f000 { - label = "hard_config"; - reg = <0xf000 0x1000>; + hard_config: hard_config { read-only; }; @@ -117,9 +115,7 @@ read-only; }; - partition@20000 { - label = "soft_config"; - reg = <0x20000 0x1000>; + soft_config { }; partition@30000 { diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts index 19e1a71e99..aff2d0e64f 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts @@ -104,19 +104,17 @@ label = "RouterBoot"; reg = <0x0 0x40000>; read-only; - compatible = "fixed-partitions"; + compatible = "mikrotik,routerboot-partitions"; #address-cells = <1>; #size-cells = <1>; partition@0 { label = "bootloader1"; - reg = <0x0 0xf000>; + reg = <0x0 0x0>; read-only; }; - hard_config: partition@f000 { - label = "hard_config"; - reg = <0xf000 0x1000>; + hard_config: hard_config { read-only; }; @@ -126,9 +124,7 @@ read-only; }; - partition@20000 { - label = "soft_config"; - reg = <0x20000 0x1000>; + soft_config { }; partition@30000 { From 5ecf7d96540ffa7c7446fa75adfa9e118f211c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sun, 22 Mar 2020 21:46:42 +0100 Subject: [PATCH 09/29] generic: routerboot sysfs platform driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This driver exposes the data encoded in the "hard_config" flash segment of MikroTik RouterBOARDs devices. It presents the data in a sysfs folder named "hard_config". The WLAN calibration data is available on demand via the 'wlan_data' sysfs file in that folder. This driver permanently allocates a chunk of RAM as large as the "hard_config" MTD partition (typically 4KB), although it is technically possible to operate entirely from the MTD device without using a local buffer (except when requesting WLAN calibration data), at the cost of a performance penalty. This driver does not reuse any of the existing code previously found in routerboot.c. This driver has been successfully tested on BE (ath79) and LE (ipq40xx and ramips) hardware. Tested-by: Roger Pueyo Centelles Tested-by: Baptiste Jonglez Tested-by: Tobias Schramm Tested-by: Christopher Hill Signed-off-by: Thibaut VARÈNE --- .../files/drivers/platform/mikrotik/Kconfig | 18 + .../files/drivers/platform/mikrotik/Makefile | 4 + .../drivers/platform/mikrotik/rb_hardconfig.c | 481 ++++++++++++++++++ .../drivers/platform/mikrotik/routerboot.c | 183 +++++++ .../drivers/platform/mikrotik/routerboot.h | 31 ++ 5 files changed, 717 insertions(+) create mode 100644 target/linux/generic/files/drivers/platform/mikrotik/Kconfig create mode 100644 target/linux/generic/files/drivers/platform/mikrotik/Makefile create mode 100644 target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c create mode 100644 target/linux/generic/files/drivers/platform/mikrotik/routerboot.c create mode 100644 target/linux/generic/files/drivers/platform/mikrotik/routerboot.h diff --git a/target/linux/generic/files/drivers/platform/mikrotik/Kconfig b/target/linux/generic/files/drivers/platform/mikrotik/Kconfig new file mode 100644 index 0000000000..195a1e8fd3 --- /dev/null +++ b/target/linux/generic/files/drivers/platform/mikrotik/Kconfig @@ -0,0 +1,18 @@ +menuconfig MIKROTIK + bool "Platform support for MikroTik RouterBoard virtual devices" + default n + depends on MTD + select LZO_DECOMPRESS + help + Say Y here to get to see options for the MikroTik RouterBoard platform. + This option alone does not add any kernel code. + + +if MIKROTIK + +config MIKROTIK_RB_SYSFS + tristate "RouterBoot sysfs support" + help + This driver exposes RouterBoot configuration in sysfs. + +endif # MIKROTIK diff --git a/target/linux/generic/files/drivers/platform/mikrotik/Makefile b/target/linux/generic/files/drivers/platform/mikrotik/Makefile new file mode 100644 index 0000000000..4d50ede9ff --- /dev/null +++ b/target/linux/generic/files/drivers/platform/mikrotik/Makefile @@ -0,0 +1,4 @@ +# +# Makefile for MikroTik RouterBoard platform specific drivers +# +obj-$(CONFIG_MIKROTIK_RB_SYSFS) += routerboot.o rb_hardconfig.o diff --git a/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c b/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c new file mode 100644 index 0000000000..0aa8cb189a --- /dev/null +++ b/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c @@ -0,0 +1,481 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver for MikroTik RouterBoot hard config. + * + * Copyright (C) 2020 Thibaut VARÈNE + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + * + * This driver exposes the data encoded in the "hard_config" flash segment of + * MikroTik RouterBOARDs devices. It presents the data in a sysfs folder + * named "hard_config". The WLAN calibration data is available on demand via + * the 'wlan_data' sysfs file in that folder. + * + * This driver permanently allocates a chunk of RAM as large as the hard_config + * MTD partition, although it is technically possible to operate entirely from + * the MTD device without using a local buffer (except when requesting WLAN + * calibration data), at the cost of a performance penalty. + * + * Some constant defines extracted from routerboot.{c,h} by Gabor Juhos + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "routerboot.h" + +#define RB_HARDCONFIG_VER "0.01" +#define RB_HC_PR_PFX "[rb_hardconfig] " + +/* ID values for hardware settings */ +#define RB_ID_FLASH_INFO 0x03 +#define RB_ID_MAC_ADDRESS_PACK 0x04 +#define RB_ID_BOARD_PRODUCT_CODE 0x05 +#define RB_ID_BIOS_VERSION 0x06 +#define RB_ID_SDRAM_TIMINGS 0x08 +#define RB_ID_DEVICE_TIMINGS 0x09 +#define RB_ID_SOFTWARE_ID 0x0A +#define RB_ID_SERIAL_NUMBER 0x0B +#define RB_ID_MEMORY_SIZE 0x0D +#define RB_ID_MAC_ADDRESS_COUNT 0x0E +#define RB_ID_HW_OPTIONS 0x15 +#define RB_ID_WLAN_DATA 0x16 +#define RB_ID_BOARD_IDENTIFIER 0x17 +#define RB_ID_PRODUCT_NAME 0x21 +#define RB_ID_DEFCONF 0x26 + +/* Bit definitions for hardware options */ +#define RB_HW_OPT_NO_UART BIT(0) +#define RB_HW_OPT_HAS_VOLTAGE BIT(1) +#define RB_HW_OPT_HAS_USB BIT(2) +#define RB_HW_OPT_HAS_ATTINY BIT(3) +#define RB_HW_OPT_NO_NAND BIT(14) +#define RB_HW_OPT_HAS_LCD BIT(15) +#define RB_HW_OPT_HAS_POE_OUT BIT(16) +#define RB_HW_OPT_HAS_uSD BIT(17) +#define RB_HW_OPT_HAS_SIM BIT(18) +#define RB_HW_OPT_HAS_SFP BIT(20) +#define RB_HW_OPT_HAS_WIFI BIT(21) +#define RB_HW_OPT_HAS_TS_FOR_ADC BIT(22) +#define RB_HW_OPT_HAS_PLC BIT(29) + +static struct kobject *hc_kobj; +static u8 *hc_buf; // ro buffer after init(): no locking required +static size_t hc_buflen; + +/* Array of known hw_options bits with human-friendly parsing */ +static struct hc_hwopt { + const u32 bit; + const char *str; +} const hc_hwopts[] = { + { + .bit = RB_HW_OPT_NO_UART, + .str = "no UART\t\t", + }, { + .bit = RB_HW_OPT_HAS_VOLTAGE, + .str = "has Vreg\t", + }, { + .bit = RB_HW_OPT_HAS_USB, + .str = "has usb\t\t", + }, { + .bit = RB_HW_OPT_HAS_ATTINY, + .str = "has ATtiny\t", + }, { + .bit = RB_HW_OPT_NO_NAND, + .str = "no NAND\t\t", + }, { + .bit = RB_HW_OPT_HAS_LCD, + .str = "has LCD\t\t", + }, { + .bit = RB_HW_OPT_HAS_POE_OUT, + .str = "has POE out\t", + }, { + .bit = RB_HW_OPT_HAS_uSD, + .str = "has MicroSD\t", + }, { + .bit = RB_HW_OPT_HAS_SIM, + .str = "has SIM\t\t", + }, { + .bit = RB_HW_OPT_HAS_SFP, + .str = "has SFP\t\t", + }, { + .bit = RB_HW_OPT_HAS_WIFI, + .str = "has WiFi\t", + }, { + .bit = RB_HW_OPT_HAS_TS_FOR_ADC, + .str = "has TS ADC\t", + }, { + .bit = RB_HW_OPT_HAS_PLC, + .str = "has PLC\t\t", + }, +}; + +static ssize_t hc_tag_show_string(const u8 *pld, u16 pld_len, char *buf) +{ + return snprintf(buf, pld_len+1, "%s\n", pld); +} + +static ssize_t hc_tag_show_u32(const u8 *pld, u16 pld_len, char *buf) +{ + char *out = buf; + u32 data; // cpu-endian + + /* Caller ensures pld_len > 0 */ + if (pld_len % sizeof(data)) + return -EINVAL; + + data = *(u32 *)pld; + + do { + out += sprintf(out, "0x%08x\n", data); + data++; + } while ((pld_len -= sizeof(data))); + + return out - buf; +} + +/* + * The MAC is stored network-endian on all devices, in 2 32-bit segments: + * . Kernel print has us covered. + */ +static ssize_t hc_tag_show_mac(const u8 *pld, u16 pld_len, char *buf) +{ + if (8 != pld_len) + return -EINVAL; + + return sprintf(buf, "%pM\n", pld); +} + +/* + * Print HW options in a human readable way: + * The raw number and in decoded form + */ +static ssize_t hc_tag_show_hwoptions(const u8 *pld, u16 pld_len, char *buf) +{ + char *out = buf; + u32 data; // cpu-endian + int i; + + if (sizeof(data) != pld_len) + return -EINVAL; + + data = *(u32 *)pld; + out += sprintf(out, "raw\t\t: 0x%08x\n\n", data); + + for (i = 0; i < ARRAY_SIZE(hc_hwopts); i++) + out += sprintf(out, "%s: %s\n", hc_hwopts[i].str, + (data & hc_hwopts[i].bit) ? "true" : "false"); + + return out - buf; +} + +static ssize_t hc_wlan_data_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, char *buf, + loff_t off, size_t count); + +static struct hc_wlan_attr { + struct bin_attribute battr; + u16 pld_ofs; + u16 pld_len; +} hc_wlandata_battr = { + .battr = __BIN_ATTR(wlan_data, S_IRUSR, hc_wlan_data_bin_read, NULL, 0), +}; + +static ssize_t hc_attr_show(struct kobject *kobj, struct kobj_attribute *attr, + char *buf); + +/* Array of known tags to publish in sysfs */ +static struct hc_attr { + const u16 tag_id; + ssize_t (* const tshow)(const u8 *pld, u16 pld_len, char *buf); + struct kobj_attribute kattr; + u16 pld_ofs; + u16 pld_len; +} hc_attrs[] = { + { + .tag_id = RB_ID_FLASH_INFO, + .tshow = hc_tag_show_u32, + .kattr = __ATTR(flash_info, S_IRUSR, hc_attr_show, NULL), + }, { + .tag_id = RB_ID_MAC_ADDRESS_PACK, + .tshow = hc_tag_show_mac, + .kattr = __ATTR(mac_base, S_IRUSR, hc_attr_show, NULL), + }, { + .tag_id = RB_ID_BOARD_PRODUCT_CODE, + .tshow = hc_tag_show_string, + .kattr = __ATTR(board_product_code, S_IRUSR, hc_attr_show, NULL), + }, { + .tag_id = RB_ID_BIOS_VERSION, + .tshow = hc_tag_show_string, + .kattr = __ATTR(booter_version, S_IRUSR, hc_attr_show, NULL), + }, { + .tag_id = RB_ID_SERIAL_NUMBER, + .tshow = hc_tag_show_string, + .kattr = __ATTR(board_serial, S_IRUSR, hc_attr_show, NULL), + }, { + .tag_id = RB_ID_MEMORY_SIZE, + .tshow = hc_tag_show_u32, + .kattr = __ATTR(mem_size, S_IRUSR, hc_attr_show, NULL), + }, { + .tag_id = RB_ID_MAC_ADDRESS_COUNT, + .tshow = hc_tag_show_u32, + .kattr = __ATTR(mac_count, S_IRUSR, hc_attr_show, NULL), + }, { + .tag_id = RB_ID_HW_OPTIONS, + .tshow = hc_tag_show_hwoptions, + .kattr = __ATTR(hw_options, S_IRUSR, hc_attr_show, NULL), + }, { + .tag_id = RB_ID_WLAN_DATA, + .tshow = NULL, + }, { + .tag_id = RB_ID_BOARD_IDENTIFIER, + .tshow = hc_tag_show_string, + .kattr = __ATTR(board_identifier, S_IRUSR, hc_attr_show, NULL), + }, { + .tag_id = RB_ID_PRODUCT_NAME, + .tshow = hc_tag_show_string, + .kattr = __ATTR(product_name, S_IRUSR, hc_attr_show, NULL), + }, { + .tag_id = RB_ID_DEFCONF, + .tshow = hc_tag_show_string, + .kattr = __ATTR(defconf, S_IRUSR, hc_attr_show, NULL), + } +}; + +/* + * If the RB_ID_WLAN_DATA payload starts with RB_MAGIC_ERD, then past + * that magic number the payload itself contains a routerboot tag node + * locating the LZO-compressed calibration data at id 0x1. + */ +static int hc_wlan_data_unpack_erd(const u8 *inbuf, size_t inlen, + void *outbuf, size_t *outlen) +{ + u16 lzo_ofs, lzo_len; + int ret; + + /* Find embedded tag */ + ret = routerboot_tag_find(inbuf, inlen, 0x1, // always id 1 + &lzo_ofs, &lzo_len); + if (ret) { + pr_debug(RB_HC_PR_PFX "ERD data not found\n"); + goto fail; + } + + if (lzo_len > inlen) { + pr_debug(RB_HC_PR_PFX "Invalid ERD data length\n"); + ret = -EINVAL; + goto fail; + } + + ret = lzo1x_decompress_safe(inbuf+lzo_ofs, lzo_len, outbuf, outlen); + if (ret) + pr_debug(RB_HC_PR_PFX "LZO decompression error (%d)\n", ret); + +fail: + return ret; +} + +static int hc_wlan_data_unpack(const size_t tofs, size_t tlen, + void *outbuf, size_t *outlen) +{ + const u8 *lbuf; + u32 magic; + int ret; + + /* Caller ensure tlen > 0. tofs is aligned */ + if ((tofs + tlen) > hc_buflen) + return -EIO; + + lbuf = hc_buf + tofs; + magic = *(u32 *)lbuf; + + ret = -ENODATA; + switch (magic) { + case RB_MAGIC_ERD: + /* Skip magic */ + lbuf += sizeof(magic); + tlen -= sizeof(magic); + ret = hc_wlan_data_unpack_erd(lbuf, tlen, outbuf, outlen); + break; + default: + /* + * If the RB_ID_WLAN_DATA payload doesn't start with a + * magic number, the payload itself is the raw RLE-encoded + * calibration data. + */ + ret = routerboot_rle_decode(lbuf, tlen, outbuf, outlen); + if (ret) + pr_debug(RB_HC_PR_PFX "RLE decoding error (%d)\n", ret); + break; + } + + return ret; +} + +static ssize_t hc_attr_show(struct kobject *kobj, struct kobj_attribute *attr, + char *buf) +{ + struct hc_attr *hc_attr; + const u8 *pld; + u16 pld_len; + + hc_attr = container_of(attr, typeof(*hc_attr), kattr); + + if (!hc_attr->pld_len) + return -ENOENT; + + pld = hc_buf + hc_attr->pld_ofs; + pld_len = hc_attr->pld_len; + + return hc_attr->tshow(pld, pld_len, buf); +} + +/* + * This function will allocate and free memory every time it is called. This + * is not the fastest way to do this, but since the data is rarely read (mainly + * at boot time to load wlan caldata), this makes it possible to save memory for + * the system. + */ +static ssize_t hc_wlan_data_bin_read(struct file *filp, struct kobject *kobj, + struct bin_attribute *attr, char *buf, + loff_t off, size_t count) +{ + struct hc_wlan_attr *hc_wattr; + size_t outlen; + void *outbuf; + int ret; + + hc_wattr = container_of(attr, typeof(*hc_wattr), battr); + + if (!hc_wattr->pld_len) + return -ENOENT; + + outlen = RB_ART_SIZE; + + /* Don't bother unpacking if the source is already too large */ + if (hc_wattr->pld_len > outlen) + return -EFBIG; + + outbuf = kmalloc(outlen, GFP_KERNEL); + if (!outbuf) + return -ENOMEM; + + ret = hc_wlan_data_unpack(hc_wattr->pld_ofs, hc_wattr->pld_len, outbuf, &outlen); + if (ret) { + kfree(outbuf); + return ret; + } + + if (off >= outlen) { + kfree(outbuf); + return 0; + } + + if (off + count > outlen) + count = outlen - off; + + memcpy(buf, outbuf + off, count); + + kfree(outbuf); + return count; +} + +int __init rb_hardconfig_init(struct kobject *rb_kobj) +{ + struct mtd_info *mtd; + size_t bytes_read, buflen; + const u8 *buf; + int i, ret; + u32 magic; + + // TODO allow override + mtd = get_mtd_device_nm(RB_MTD_HARD_CONFIG); + if (IS_ERR(mtd)) + return -ENODEV; + + hc_buflen = mtd->size; + hc_buf = kmalloc(hc_buflen, GFP_KERNEL); + if (!hc_buf) + return -ENOMEM; + + ret = mtd_read(mtd, 0, hc_buflen, &bytes_read, hc_buf); + + if (bytes_read != hc_buflen) { + ret = -EIO; + goto fail; + } + + /* Check we have what we expect */ + magic = *(const u32 *)hc_buf; + if (RB_MAGIC_HARD != magic) { + ret = -EINVAL; + goto fail; + } + + /* Skip magic */ + buf = hc_buf + sizeof(magic); + buflen = hc_buflen - sizeof(magic); + + /* Populate sysfs */ + ret = -ENOMEM; + hc_kobj = kobject_create_and_add(RB_MTD_HARD_CONFIG, rb_kobj); + if (!hc_kobj) + goto fail; + + /* Locate and publish all known tags */ + for (i = 0; i < ARRAY_SIZE(hc_attrs); i++) { + ret = routerboot_tag_find(buf, buflen, hc_attrs[i].tag_id, + &hc_attrs[i].pld_ofs, &hc_attrs[i].pld_len); + if (ret) { + hc_attrs[i].pld_ofs = hc_attrs[i].pld_len = 0; + continue; + } + + /* Account for skipped magic */ + hc_attrs[i].pld_ofs += sizeof(magic); + + /* Special case RB_ID_WLAN_DATA to prep and create the binary attribute */ + if ((RB_ID_WLAN_DATA == hc_attrs[i].tag_id) && hc_attrs[i].pld_len) { + hc_wlandata_battr.pld_ofs = hc_attrs[i].pld_ofs; + hc_wlandata_battr.pld_len = hc_attrs[i].pld_len; + + ret = sysfs_create_bin_file(hc_kobj, &hc_wlandata_battr.battr); + if (ret) + pr_err(RB_HC_PR_PFX "Could not create %s sysfs entry (%d)\n", + hc_wlandata_battr.battr.attr.name, ret); + } + /* All other tags are published via standard attributes */ + else { + ret = sysfs_create_file(hc_kobj, &hc_attrs[i].kattr.attr); + if (ret) + pr_err(RB_HC_PR_PFX "Could not create %s sysfs entry (%d)\n", + hc_attrs[i].kattr.attr.name, ret); + } + } + + pr_info("MikroTik RouterBOARD hardware configuration sysfs driver v" RB_HARDCONFIG_VER "\n"); + + return 0; + +fail: + kfree(hc_buf); + return ret; +} + +void __exit rb_hardconfig_exit(void) +{ + kobject_put(hc_kobj); + kfree(hc_buf); +} diff --git a/target/linux/generic/files/drivers/platform/mikrotik/routerboot.c b/target/linux/generic/files/drivers/platform/mikrotik/routerboot.c new file mode 100644 index 0000000000..172db02533 --- /dev/null +++ b/target/linux/generic/files/drivers/platform/mikrotik/routerboot.c @@ -0,0 +1,183 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Driver for MikroTik RouterBoot flash data. Common routines. + * + * Copyright (C) 2020 Thibaut VARÈNE + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 as published + * by the Free Software Foundation. + */ + +#include +#include +#include +#include + +#include "routerboot.h" + +static struct kobject *rb_kobj; + +/** + * routerboot_tag_find() - Locate a given tag in routerboot config data. + * @bufhead: the buffer to look into. Must start with a tag node. + * @buflen: size of bufhead + * @tag_id: the tag identifier to look for + * @pld_ofs: will be updated with tag payload offset in bufhead, if tag found + * @pld_len: will be updated with tag payload size, if tag found + * + * This incarnation of tag_find() does only that: it finds a specific routerboot + * tag node in the input buffer. Routerboot tag nodes are u32 values: + * - The low nibble is the tag identification number, + * - The high nibble is the tag payload length (node excluded) in bytes. + * The payload immediately follows the tag node. Tag nodes are 32bit-aligned. + * The returned pld_ofs will always be aligned. pld_len may not end on 32bit + * boundary (the only known case is when parsing ERD data). + * The nodes are cpu-endian on the flash media. The payload is cpu-endian when + * applicable. Tag nodes are not ordered (by ID) on flash. + * + * Return: 0 on success (tag found) or errno + */ +int routerboot_tag_find(const u8 *bufhead, const size_t buflen, const u16 tag_id, + u16 *pld_ofs, u16 *pld_len) +{ + const u32 *datum, *bufend; + u32 node; + u16 id, len; + int ret; + + if (!bufhead || !tag_id) + return -EINVAL; + + ret = -ENOENT; + datum = (const u32 *)bufhead; + bufend = (const u32 *)(bufhead + buflen); + + while (datum < bufend) { + node = *datum++; + + /* Tag list ends with null node */ + if (!node) + break; + + id = node & 0xFFFF; + len = node >> 16; + + if (tag_id == id) { + if (datum >= bufend) + break; + + if (pld_ofs) + *pld_ofs = (u16)((u8 *)datum - bufhead); + if (pld_len) + *pld_len = len; + + ret = 0; + break; + } + + /* + * The only known situation where len may not end on 32bit + * boundary is within ERD data. Since we're only extracting + * one tag (the first and only one) from that data, we should + * never need to forcefully ALIGN(). Do it anyway, this is not a + * performance path. + */ + len = ALIGN(len, sizeof(*datum)); + datum += len / sizeof(*datum); + } + + return ret; +} + +/** + * routerboot_rle_decode() - Simple RLE (MikroTik variant) decoding routine. + * @in: input buffer to decode + * @inlen: size of in + * @out: output buffer to write decoded data to + * @outlen: pointer to out size when function is called, will be updated with + * size of decoded output on return + * + * MikroTik's variant of RLE operates as follows, considering a signed run byte: + * - positive run => classic RLE + * - negative run => the next - bytes must be copied verbatim + * The API is matched to the lzo1x routines for convenience. + * + * NB: The output buffer cannot overlap with the input buffer. + * + * Return: 0 on success or errno + */ +int routerboot_rle_decode(const u8 *in, size_t inlen, u8 *out, size_t *outlen) +{ + int ret, run, nbytes; // use native types for speed + u8 byte; + + if (!in || (inlen < 2) || !out) + return -EINVAL; + + ret = -ENOSPC; + nbytes = 0; + while (inlen >= 2) { + run = *in++; + inlen--; + + /* Verbatim copies */ + if (run & 0x80) { + /* Invert run byte sign */ + run = ~run & 0xFF; + run++; + + if (run > inlen) + goto fail; + + inlen -= run; + + nbytes += run; + if (nbytes > *outlen) + goto fail; + + /* Basic memcpy */ + while (run-- > 0) + *out++ = *in++; + } + /* Stream of half-words RLE: . run == 0 is ignored */ + else { + byte = *in++; + inlen--; + + nbytes += run; + if (nbytes > *outlen) + goto fail; + + while (run-- > 0) + *out++ = byte; + } + } + + ret = 0; +fail: + *outlen = nbytes; + return ret; +} + +static int __init routerboot_init(void) +{ + rb_kobj = kobject_create_and_add("mikrotik", firmware_kobj); + if (!rb_kobj) + return -ENOMEM; + + return rb_hardconfig_init(rb_kobj); +} + +static void __exit routerboot_exit(void) +{ + rb_hardconfig_exit(); + kobject_put(rb_kobj); // recursive afaict +} + +module_init(routerboot_init); +module_exit(routerboot_exit); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("MikroTik RouterBoot sysfs support"); +MODULE_AUTHOR("Thibaut VARENE"); diff --git a/target/linux/generic/files/drivers/platform/mikrotik/routerboot.h b/target/linux/generic/files/drivers/platform/mikrotik/routerboot.h new file mode 100644 index 0000000000..d2ca41fb1b --- /dev/null +++ b/target/linux/generic/files/drivers/platform/mikrotik/routerboot.h @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Common definitions for MikroTik RouterBoot data. + * + * Copyright (C) 2020 Thibaut VARÈNE + */ + + +#ifndef _ROUTERBOOT_H_ +#define _ROUTERBOOT_H_ + +#include + +// these magic values are stored in cpu-endianness on flash +#define RB_MAGIC_HARD (('H') | ('a' << 8) | ('r' << 16) | ('d' << 24)) +#define RB_MAGIC_SOFT (('S') | ('o' << 8) | ('f' << 16) | ('t' << 24)) +#define RB_MAGIC_LZOR (('L') | ('Z' << 8) | ('O' << 16) | ('R' << 24)) +#define RB_MAGIC_ERD (('E' << 16) | ('R' << 8) | ('D')) + +#define RB_ART_SIZE 0x10000 + +#define RB_MTD_HARD_CONFIG "hard_config" +#define RB_MTD_SOFT_CONFIG "soft_config" + +int routerboot_tag_find(const u8 *bufhead, const size_t buflen, const u16 tag_id, u16 *pld_ofs, u16 *pld_len); +int routerboot_rle_decode(const u8 *in, size_t inlen, u8 *out, size_t *outlen); + +int __init rb_hardconfig_init(struct kobject *rb_kobj); +void __exit rb_hardconfig_exit(void); + +#endif /* _ROUTERBOOT_H_ */ From 1dcc2249cd5d28a1f14b576138dbcf84ac011ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Tue, 24 Mar 2020 22:28:26 +0100 Subject: [PATCH 10/29] generic: mikrotik platform build bits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thibaut VARÈNE --- target/linux/generic/config-4.14 | 1 + target/linux/generic/config-4.19 | 1 + target/linux/generic/config-5.4 | 1 + .../270-platform-mikrotik-build-bits.patch | 38 +++++++++++++++++++ .../270-platform-mikrotik-build-bits.patch | 38 +++++++++++++++++++ .../270-platform-mikrotik-build-bits.patch | 31 +++++++++++++++ 6 files changed, 110 insertions(+) create mode 100644 target/linux/generic/pending-4.14/270-platform-mikrotik-build-bits.patch create mode 100644 target/linux/generic/pending-4.19/270-platform-mikrotik-build-bits.patch create mode 100644 target/linux/generic/pending-5.4/270-platform-mikrotik-build-bits.patch diff --git a/target/linux/generic/config-4.14 b/target/linux/generic/config-4.14 index c8b3c602dd..a592f2563b 100644 --- a/target/linux/generic/config-4.14 +++ b/target/linux/generic/config-4.14 @@ -2651,6 +2651,7 @@ CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 # CONFIG_MIGRATION is not set CONFIG_MII=y # CONFIG_MIKROTIK_RB532 is not set +# CONFIG_MIKROTIK is not set # CONFIG_MINIX_FS is not set # CONFIG_MINIX_FS_NATIVE_ENDIAN is not set # CONFIG_MINIX_SUBPARTITION is not set diff --git a/target/linux/generic/config-4.19 b/target/linux/generic/config-4.19 index 9e3e35f793..ae1be9e075 100644 --- a/target/linux/generic/config-4.19 +++ b/target/linux/generic/config-4.19 @@ -2791,6 +2791,7 @@ CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 # CONFIG_MIGRATION is not set CONFIG_MII=y # CONFIG_MIKROTIK_RB532 is not set +# CONFIG_MIKROTIK is not set # CONFIG_MINIX_FS is not set # CONFIG_MINIX_FS_NATIVE_ENDIAN is not set # CONFIG_MINIX_SUBPARTITION is not set diff --git a/target/linux/generic/config-5.4 b/target/linux/generic/config-5.4 index 67a69ef741..cdee4c973b 100644 --- a/target/linux/generic/config-5.4 +++ b/target/linux/generic/config-5.4 @@ -2971,6 +2971,7 @@ CONFIG_MESSAGE_LOGLEVEL_DEFAULT=4 # CONFIG_MIGRATION is not set CONFIG_MII=y # CONFIG_MIKROTIK_RB532 is not set +# CONFIG_MIKROTIK is not set # CONFIG_MINIX_FS is not set # CONFIG_MINIX_FS_NATIVE_ENDIAN is not set # CONFIG_MINIX_SUBPARTITION is not set diff --git a/target/linux/generic/pending-4.14/270-platform-mikrotik-build-bits.patch b/target/linux/generic/pending-4.14/270-platform-mikrotik-build-bits.patch new file mode 100644 index 0000000000..5f1009bf31 --- /dev/null +++ b/target/linux/generic/pending-4.14/270-platform-mikrotik-build-bits.patch @@ -0,0 +1,38 @@ +From c2deb5ef01a0ef09088832744cbace9e239a6ee0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= +Date: Tue, 24 Mar 2020 22:11:50 +0100 +Subject: [PATCH] generic: platform/mikrotik build bits (4.14) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch adds platform/mikrotik kernel build bits + +Signed-off-by: Thibaut VARÈNE +--- + drivers/platform/Kconfig | 2 ++ + drivers/platform/Makefile | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/drivers/platform/Kconfig b/drivers/platform/Kconfig +index c11db8b..0283f0b 100644 +--- a/drivers/platform/Kconfig ++++ b/drivers/platform/Kconfig +@@ -8,3 +8,5 @@ endif + source "drivers/platform/goldfish/Kconfig" + + source "drivers/platform/chrome/Kconfig" ++ ++source "drivers/platform/mikrotik/Kconfig" +diff --git a/drivers/platform/Makefile b/drivers/platform/Makefile +index d3a6630..ad290c3 100644 +--- a/drivers/platform/Makefile ++++ b/drivers/platform/Makefile +@@ -8,3 +8,4 @@ obj-$(CONFIG_MIPS) += mips/ + obj-$(CONFIG_OLPC) += olpc/ + obj-$(CONFIG_GOLDFISH) += goldfish/ + obj-$(CONFIG_CHROME_PLATFORMS) += chrome/ ++obj-$(CONFIG_MIKROTIK) += mikrotik/ +-- +2.11.0 + diff --git a/target/linux/generic/pending-4.19/270-platform-mikrotik-build-bits.patch b/target/linux/generic/pending-4.19/270-platform-mikrotik-build-bits.patch new file mode 100644 index 0000000000..e2e8fbfcff --- /dev/null +++ b/target/linux/generic/pending-4.19/270-platform-mikrotik-build-bits.patch @@ -0,0 +1,38 @@ +From c2deb5ef01a0ef09088832744cbace9e239a6ee0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= +Date: Sat, 28 Mar 2020 12:11:50 +0100 +Subject: [PATCH] generic: platform/mikrotik build bits (4.19) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch adds platform/mikrotik kernel build bits + +Signed-off-by: Thibaut VARÈNE +--- + drivers/platform/Kconfig | 2 ++ + drivers/platform/Makefile | 1 + + 2 files changed, 3 insertions(+) + +diff --git a/drivers/platform/Kconfig b/drivers/platform/Kconfig +index c11db8b..0283f0b 100644 +--- a/drivers/platform/Kconfig ++++ b/drivers/platform/Kconfig +@@ -10,3 +10,5 @@ + source "drivers/platform/chrome/Kconfig" + + source "drivers/platform/mellanox/Kconfig" ++ ++source "drivers/platform/mikrotik/Kconfig" +diff --git a/drivers/platform/Makefile b/drivers/platform/Makefile +index d3a6630..ad290c3 100644 +--- a/drivers/platform/Makefile ++++ b/drivers/platform/Makefile +@@ -9,3 +9,4 @@ + obj-$(CONFIG_OLPC) += olpc/ + obj-$(CONFIG_GOLDFISH) += goldfish/ + obj-$(CONFIG_CHROME_PLATFORMS) += chrome/ ++obj-$(CONFIG_MIKROTIK) += mikrotik/ +-- +2.11.0 + diff --git a/target/linux/generic/pending-5.4/270-platform-mikrotik-build-bits.patch b/target/linux/generic/pending-5.4/270-platform-mikrotik-build-bits.patch new file mode 100644 index 0000000000..df738ef97b --- /dev/null +++ b/target/linux/generic/pending-5.4/270-platform-mikrotik-build-bits.patch @@ -0,0 +1,31 @@ +From c2deb5ef01a0ef09088832744cbace9e239a6ee0 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= +Date: Sat, 28 Mar 2020 12:11:50 +0100 +Subject: [PATCH] generic: platform/mikrotik build bits (5.4) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch adds platform/mikrotik kernel build bits + +Signed-off-by: Thibaut VARÈNE +--- + drivers/platform/Kconfig | 2 ++ + drivers/platform/Makefile | 1 + + 2 files changed, 3 insertions(+) + +--- a/drivers/platform/Kconfig ++++ b/drivers/platform/Kconfig +@@ -13,3 +13,5 @@ source "drivers/platform/chrome/Kconfig" + source "drivers/platform/mellanox/Kconfig" + + source "drivers/platform/olpc/Kconfig" ++ ++source "drivers/platform/mikrotik/Kconfig" +--- a/drivers/platform/Makefile ++++ b/drivers/platform/Makefile +@@ -9,3 +9,4 @@ obj-$(CONFIG_MIPS) += mips/ + obj-$(CONFIG_OLPC_EC) += olpc/ + obj-$(CONFIG_GOLDFISH) += goldfish/ + obj-$(CONFIG_CHROME_PLATFORMS) += chrome/ ++obj-$(CONFIG_MIKROTIK) += mikrotik/ From 65d5053045800b04d0f2cebdf3a3f7ea9fe1864d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Tue, 24 Mar 2020 22:31:17 +0100 Subject: [PATCH 11/29] ath79/mikrotik: enable mikrotik platform driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thibaut VARÈNE --- target/linux/ath79/mikrotik/config-default | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ath79/mikrotik/config-default b/target/linux/ath79/mikrotik/config-default index e1e30dbe8f..83be852804 100644 --- a/target/linux/ath79/mikrotik/config-default +++ b/target/linux/ath79/mikrotik/config-default @@ -6,6 +6,8 @@ CONFIG_GPIO_WATCHDOG=y CONFIG_GPIO_WATCHDOG_ARCH_INITCALL=y CONFIG_LEDS_RESET=y CONFIG_LZO_DECOMPRESS=y +CONFIG_MIKROTIK=y +CONFIG_MIKROTIK_RB_SYSFS=y CONFIG_MTD_NAND=y CONFIG_MTD_NAND_AR934X=y CONFIG_MTD_NAND_CORE=y From 00d2ab7602e5366ecf620ce10748474171b92d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Wed, 25 Mar 2020 11:45:51 +0100 Subject: [PATCH 12/29] ar71xx/mikrotik: enable mikrotik platform driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thibaut VARÈNE --- target/linux/ar71xx/mikrotik/config-default | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ar71xx/mikrotik/config-default b/target/linux/ar71xx/mikrotik/config-default index e324e4c252..eb2f362034 100644 --- a/target/linux/ar71xx/mikrotik/config-default +++ b/target/linux/ar71xx/mikrotik/config-default @@ -26,6 +26,8 @@ CONFIG_HW_HAS_PCI=y CONFIG_LEDS_RB750=y CONFIG_LZO_DECOMPRESS=y # CONFIG_MARVELL_PHY is not set +CONFIG_MIKROTIK=y +CONFIG_MIKROTIK_RB_SYSFS=y # CONFIG_MTD_CFI is not set CONFIG_MTD_CFI_I2=y # CONFIG_MTD_CMDLINE_PARTS is not set From 97337d3e5d8e3faa3e9889b5a04f7c62fa7fad21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Tue, 28 Apr 2020 15:57:41 +0200 Subject: [PATCH 13/29] ramips/mt7621: enable mikrotik platform driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thibaut VARÈNE --- target/linux/ramips/mt7621/config-5.4 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/target/linux/ramips/mt7621/config-5.4 b/target/linux/ramips/mt7621/config-5.4 index b1622b7f2a..b2c3ad5ba8 100644 --- a/target/linux/ramips/mt7621/config-5.4 +++ b/target/linux/ramips/mt7621/config-5.4 @@ -173,6 +173,8 @@ CONFIG_MDIO_DEVICE=y CONFIG_MEMFD_CREATE=y CONFIG_MFD_SYSCON=y CONFIG_MIGRATION=y +CONFIG_MIKROTIK=y +CONFIG_MIKROTIK_RB_SYSFS=y CONFIG_MIPS=y CONFIG_MIPS_ASID_BITS=8 CONFIG_MIPS_ASID_SHIFT=0 From 31e99fe3daea9c402571c0bfa42e5d0d17d06809 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Fri, 27 Mar 2020 14:33:48 +0100 Subject: [PATCH 14/29] generic: platform/mikrotik: support LZOR encoding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some newer MikroTik RouterBOARD devices use a new encoding scheme for their WLAN calibration data. This patch provides support for decoding this new scheme. Signed-off-by: Thibaut VARÈNE --- .../drivers/platform/mikrotik/rb_hardconfig.c | 262 +++++++++++++++++- 1 file changed, 261 insertions(+), 1 deletion(-) diff --git a/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c b/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c index 0aa8cb189a..ab78037a03 100644 --- a/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c +++ b/target/linux/generic/files/drivers/platform/mikrotik/rb_hardconfig.c @@ -36,7 +36,7 @@ #include "routerboot.h" -#define RB_HARDCONFIG_VER "0.01" +#define RB_HARDCONFIG_VER "0.02" #define RB_HC_PR_PFX "[rb_hardconfig] " /* ID values for hardware settings */ @@ -75,6 +75,190 @@ static struct kobject *hc_kobj; static u8 *hc_buf; // ro buffer after init(): no locking required static size_t hc_buflen; +/* + * For LZOR style WLAN data unpacking. + * This binary blob is prepended to the data encoded on some devices as + * RB_ID_WLAN_DATA, the result is then first decompressed with LZO, and then + * finally RLE-decoded. + * This binary blob has been extracted from RouterOS by + * https://forum.openwrt.org/u/ius + */ +static const u8 hc_lzor_prefix[] = { + 0x00, 0x05, 0x4c, 0x4c, 0x44, 0x00, 0x34, 0xfe, + 0xfe, 0x34, 0x11, 0x3c, 0x1e, 0x3c, 0x2e, 0x3c, + 0x4c, 0x34, 0x00, 0x52, 0x62, 0x92, 0xa2, 0xb2, + 0xc3, 0x2a, 0x14, 0x00, 0x00, 0x05, 0xfe, 0x6a, + 0x3c, 0x16, 0x32, 0x16, 0x11, 0x1e, 0x12, 0x46, + 0x32, 0x46, 0x11, 0x4e, 0x12, 0x36, 0x32, 0x36, + 0x11, 0x3e, 0x12, 0x5a, 0x9a, 0x64, 0x00, 0x04, + 0xfe, 0x10, 0x3c, 0x00, 0x01, 0x00, 0x00, 0x28, + 0x0c, 0x00, 0x0f, 0xfe, 0x14, 0x00, 0x24, 0x24, + 0x23, 0x24, 0x24, 0x23, 0x25, 0x22, 0x21, 0x21, + 0x23, 0x22, 0x21, 0x22, 0x21, 0x2d, 0x38, 0x00, + 0x0c, 0x25, 0x25, 0x24, 0x25, 0x25, 0x24, 0x23, + 0x22, 0x21, 0x20, 0x23, 0x21, 0x21, 0x22, 0x21, + 0x2d, 0x38, 0x00, 0x28, 0xb0, 0x00, 0x00, 0x22, + 0x00, 0x00, 0xc0, 0xfe, 0x03, 0x00, 0xc0, 0x00, + 0x62, 0xff, 0x62, 0xff, 0xfe, 0x06, 0x00, 0xbb, + 0xff, 0xba, 0xff, 0xfe, 0x08, 0x00, 0x9e, 0xff, + 0xfe, 0x0a, 0x00, 0x53, 0xff, 0xfe, 0x02, 0x00, + 0x20, 0xff, 0xb1, 0xfe, 0xfe, 0xb2, 0xfe, 0xfe, + 0xed, 0xfe, 0xfe, 0xfe, 0x04, 0x00, 0x3a, 0xff, + 0x3a, 0xff, 0xde, 0xfd, 0x5f, 0x04, 0x33, 0xff, + 0x4c, 0x74, 0x03, 0x05, 0x05, 0xff, 0x6d, 0xfe, + 0xfe, 0x6d, 0xfe, 0xfe, 0xaf, 0x08, 0x63, 0xff, + 0x64, 0x6f, 0x08, 0xac, 0xff, 0xbf, 0x6d, 0x08, + 0x7a, 0x6d, 0x08, 0x96, 0x74, 0x04, 0x00, 0x08, + 0x79, 0xff, 0xda, 0xfe, 0xfe, 0xdb, 0xfe, 0xfe, + 0x56, 0xff, 0xfe, 0x04, 0x00, 0x5e, 0xff, 0x5e, + 0xff, 0x6c, 0xfe, 0xfe, 0xfe, 0x06, 0x00, 0x41, + 0xff, 0x7f, 0x74, 0x03, 0x00, 0x11, 0x44, 0xff, + 0xa9, 0xfe, 0xfe, 0xa9, 0xfe, 0xfe, 0xa5, 0x8f, + 0x01, 0x00, 0x08, 0x01, 0x01, 0x02, 0x04, 0x08, + 0x02, 0x04, 0x08, 0x08, 0x01, 0x01, 0xfe, 0x22, + 0x00, 0x4c, 0x60, 0x64, 0x8c, 0x90, 0xd0, 0xd4, + 0xd8, 0x5c, 0x10, 0x09, 0xd8, 0xff, 0xb0, 0xff, + 0x00, 0x00, 0xba, 0xff, 0x14, 0x00, 0xba, 0xff, + 0x64, 0x00, 0x00, 0x08, 0xfe, 0x06, 0x00, 0x74, + 0xff, 0x42, 0xff, 0xce, 0xff, 0x60, 0xff, 0x0a, + 0x00, 0xb4, 0x00, 0xa0, 0x00, 0xa0, 0xfe, 0x07, + 0x00, 0x0a, 0x00, 0xb0, 0xff, 0x96, 0x4d, 0x00, + 0x56, 0x57, 0x18, 0xa6, 0xff, 0x92, 0x70, 0x11, + 0x00, 0x12, 0x90, 0x90, 0x76, 0x5a, 0x54, 0x54, + 0x4c, 0x46, 0x38, 0x00, 0x10, 0x10, 0x08, 0xfe, + 0x05, 0x00, 0x38, 0x29, 0x25, 0x23, 0x22, 0x22, + 0x1f, 0x00, 0x00, 0x00, 0xf6, 0xe1, 0xdd, 0xf8, + 0xfe, 0x00, 0xfe, 0x15, 0x00, 0x00, 0xd0, 0x02, + 0x74, 0x02, 0x08, 0xf8, 0xe5, 0xde, 0x02, 0x04, + 0x04, 0xfd, 0x00, 0x00, 0x00, 0x07, 0x50, 0x2d, + 0x01, 0x90, 0x90, 0x76, 0x60, 0xb0, 0x07, 0x07, + 0x0c, 0x0c, 0x04, 0xfe, 0x05, 0x00, 0x66, 0x66, + 0x5a, 0x56, 0xbc, 0x01, 0x06, 0xfc, 0xfc, 0xf1, + 0xfe, 0x07, 0x00, 0x24, 0x95, 0x70, 0x64, 0x18, + 0x06, 0x2c, 0xff, 0xb5, 0xfe, 0xfe, 0xb5, 0xfe, + 0xfe, 0xe2, 0x8c, 0x24, 0x02, 0x2f, 0xff, 0x2f, + 0xff, 0xb4, 0x78, 0x02, 0x05, 0x73, 0xff, 0xed, + 0xfe, 0xfe, 0x4f, 0xff, 0x36, 0x74, 0x1e, 0x09, + 0x4f, 0xff, 0x50, 0xff, 0xfe, 0x16, 0x00, 0x70, + 0xac, 0x70, 0x8e, 0xac, 0x40, 0x0e, 0x01, 0x70, + 0x7f, 0x8e, 0xac, 0x6c, 0x00, 0x0b, 0xfe, 0x02, + 0x00, 0xfe, 0x0a, 0x2c, 0x2a, 0x2a, 0x28, 0x26, + 0x1e, 0x1e, 0xfe, 0x02, 0x20, 0x65, 0x20, 0x00, + 0x00, 0x05, 0x12, 0x00, 0x11, 0x1e, 0x11, 0x11, + 0x41, 0x1e, 0x41, 0x11, 0x31, 0x1e, 0x31, 0x11, + 0x70, 0x75, 0x7a, 0x7f, 0x84, 0x89, 0x8e, 0x93, + 0x98, 0x30, 0x20, 0x00, 0x02, 0x00, 0xfe, 0x06, + 0x3c, 0xbc, 0x32, 0x0c, 0x00, 0x00, 0x2a, 0x12, + 0x1e, 0x12, 0x2e, 0x12, 0xcc, 0x12, 0x11, 0x1a, + 0x1e, 0x1a, 0x2e, 0x1a, 0x4c, 0x10, 0x1e, 0x10, + 0x11, 0x18, 0x1e, 0x42, 0x1e, 0x42, 0x2e, 0x42, + 0xcc, 0x42, 0x11, 0x4a, 0x1e, 0x4a, 0x2e, 0x4a, + 0x4c, 0x40, 0x1e, 0x40, 0x11, 0x48, 0x1e, 0x32, + 0x1e, 0x32, 0x2e, 0x32, 0xcc, 0x32, 0x11, 0x3a, + 0x1e, 0x3a, 0x2e, 0x3a, 0x4c, 0x30, 0x1e, 0x30, + 0x11, 0x38, 0x1e, 0x27, 0x9a, 0x01, 0x9d, 0xa2, + 0x2f, 0x28, 0x00, 0x00, 0x46, 0xde, 0xc4, 0xbf, + 0xa6, 0x9d, 0x81, 0x7b, 0x5c, 0x61, 0x40, 0xc7, + 0xc0, 0xae, 0xa9, 0x8c, 0x83, 0x6a, 0x62, 0x50, + 0x3e, 0xce, 0xc2, 0xae, 0xa3, 0x8c, 0x7b, 0x6a, + 0x5a, 0x50, 0x35, 0xd7, 0xc2, 0xb7, 0xa4, 0x95, + 0x7e, 0x72, 0x5a, 0x59, 0x37, 0xfe, 0x02, 0xf8, + 0x8c, 0x95, 0x90, 0x8f, 0x00, 0xd7, 0xc0, 0xb7, + 0xa2, 0x95, 0x7b, 0x72, 0x56, 0x59, 0x32, 0xc7, + 0xc3, 0xae, 0xad, 0x8c, 0x85, 0x6a, 0x63, 0x50, + 0x3e, 0xce, 0xc3, 0xae, 0xa4, 0x8c, 0x7c, 0x6a, + 0x59, 0x50, 0x34, 0xd7, 0xc2, 0xb7, 0xa5, 0x95, + 0x7e, 0x72, 0x59, 0x59, 0x36, 0xfc, 0x05, 0x00, + 0x02, 0xce, 0xc5, 0xae, 0xa5, 0x95, 0x83, 0x72, + 0x5c, 0x59, 0x36, 0xbf, 0xc6, 0xa5, 0xab, 0x8c, + 0x8c, 0x6a, 0x67, 0x50, 0x41, 0x64, 0x07, 0x00, + 0x02, 0x95, 0x8c, 0x72, 0x65, 0x59, 0x3f, 0xce, + 0xc7, 0xae, 0xa8, 0x95, 0x86, 0x72, 0x5f, 0x59, + 0x39, 0xfe, 0x02, 0xf8, 0x8b, 0x7c, 0x0b, 0x09, + 0xb7, 0xc2, 0x9d, 0xa4, 0x83, 0x85, 0x6a, 0x6b, + 0x50, 0x44, 0xb7, 0xc1, 0x64, 0x01, 0x00, 0x06, + 0x61, 0x5d, 0x48, 0x3d, 0xae, 0xc4, 0x9d, 0xad, + 0x7b, 0x85, 0x61, 0x66, 0x48, 0x46, 0xae, 0xc3, + 0x95, 0xa3, 0x72, 0x7c, 0x59, 0x56, 0x38, 0x31, + 0x7c, 0x0b, 0x00, 0x0c, 0x96, 0x91, 0x8f, 0x00, + 0xb7, 0xc0, 0xa5, 0xab, 0x8c, 0x8a, 0x6a, 0x64, + 0x50, 0x3c, 0xb7, 0xc0, 0x9d, 0xa0, 0x83, 0x80, + 0x6a, 0x64, 0x50, 0x3d, 0xb7, 0xc5, 0x9d, 0xa5, + 0x83, 0x87, 0x6c, 0x08, 0x07, 0xae, 0xc0, 0x9d, + 0xa8, 0x83, 0x88, 0x6a, 0x6d, 0x50, 0x46, 0xfc, + 0x05, 0x00, 0x16, 0xbf, 0xc0, 0xa5, 0xa2, 0x8c, + 0x7f, 0x6a, 0x57, 0x50, 0x2f, 0xb7, 0xc7, 0xa5, + 0xb1, 0x8c, 0x8e, 0x72, 0x6d, 0x59, 0x45, 0xbf, + 0xc6, 0xa5, 0xa8, 0x8c, 0x87, 0x6a, 0x5f, 0x50, + 0x37, 0xbf, 0xc2, 0xa5, 0xa4, 0x8c, 0x83, 0x6a, + 0x5c, 0x50, 0x34, 0xbc, 0x05, 0x00, 0x0e, 0x90, + 0x00, 0xc7, 0xc2, 0xae, 0xaa, 0x95, 0x82, 0x7b, + 0x60, 0x61, 0x3f, 0xb7, 0xc6, 0xa5, 0xb1, 0x8c, + 0x8d, 0x72, 0x6b, 0x61, 0x51, 0xbf, 0xc4, 0xa5, + 0xa5, 0x8c, 0x82, 0x72, 0x61, 0x59, 0x39, 0x6c, + 0x26, 0x03, 0x95, 0x82, 0x7b, 0x61, 0x61, 0x40, + 0xfc, 0x05, 0x00, 0x00, 0x7e, 0xd7, 0xc3, 0xb7, + 0xa8, 0x9d, 0x80, 0x83, 0x5d, 0x6a, 0x3f, 0xbf, + 0xc7, 0xa5, 0xa8, 0x8c, 0x84, 0x72, 0x60, 0x61, + 0x46, 0xbf, 0xc2, 0xae, 0xb0, 0x9d, 0x92, 0x83, + 0x6f, 0x6a, 0x50, 0xd7, 0xc3, 0xb7, 0xa7, 0x9d, + 0x80, 0x83, 0x5e, 0x6a, 0x40, 0xfe, 0x02, 0xf8, + 0x8d, 0x96, 0x90, 0x90, 0xfe, 0x05, 0x00, 0x8a, + 0xc4, 0x63, 0xb8, 0x3c, 0xa6, 0x29, 0x97, 0x16, + 0x81, 0x84, 0xb7, 0x5b, 0xa9, 0x33, 0x94, 0x1e, + 0x83, 0x11, 0x70, 0xb8, 0xc2, 0x70, 0xb1, 0x4d, + 0xa3, 0x2a, 0x8d, 0x1b, 0x7b, 0xa8, 0xbc, 0x68, + 0xab, 0x47, 0x9d, 0x27, 0x87, 0x18, 0x75, 0xae, + 0xc6, 0x7d, 0xbb, 0x4d, 0xaa, 0x1c, 0x84, 0x11, + 0x72, 0xa3, 0xbb, 0x6e, 0xad, 0x3c, 0x97, 0x24, + 0x85, 0x16, 0x71, 0x80, 0xb2, 0x57, 0xa4, 0x30, + 0x8e, 0x1c, 0x7c, 0x10, 0x68, 0xbb, 0xbd, 0x75, + 0xac, 0x4f, 0x9e, 0x2b, 0x87, 0x1a, 0x76, 0x96, + 0xc5, 0x5e, 0xb5, 0x3e, 0xa5, 0x1f, 0x8c, 0x12, + 0x7a, 0xc1, 0xc6, 0x42, 0x9f, 0x27, 0x8c, 0x16, + 0x77, 0x0f, 0x67, 0x9d, 0xbc, 0x68, 0xad, 0x36, + 0x95, 0x20, 0x83, 0x11, 0x6d, 0x9b, 0xb8, 0x67, + 0xa8, 0x34, 0x90, 0x1f, 0x7c, 0x10, 0x67, 0x9e, + 0xc9, 0x6a, 0xbb, 0x37, 0xa4, 0x20, 0x90, 0x11, + 0x7b, 0xc6, 0xc8, 0x47, 0xa4, 0x2a, 0x90, 0x18, + 0x7b, 0x10, 0x6c, 0xae, 0xc4, 0x5d, 0xad, 0x37, + 0x9a, 0x1f, 0x85, 0x13, 0x75, 0x70, 0xad, 0x42, + 0x99, 0x25, 0x84, 0x17, 0x74, 0x0b, 0x56, 0x87, + 0xc8, 0x57, 0xb8, 0x2b, 0x9e, 0x19, 0x8a, 0x0d, + 0x74, 0xa7, 0xc8, 0x6e, 0xb9, 0x36, 0xa0, 0x1f, + 0x8b, 0x11, 0x75, 0x94, 0xbe, 0x4b, 0xa5, 0x2a, + 0x92, 0x18, 0x7c, 0x0f, 0x6b, 0xaf, 0xc0, 0x58, + 0xa8, 0x34, 0x94, 0x1d, 0x7d, 0x12, 0x6d, 0x82, + 0xc0, 0x52, 0xb0, 0x25, 0x94, 0x14, 0x7f, 0x0c, + 0x68, 0x84, 0xbf, 0x3e, 0xa4, 0x22, 0x8e, 0x10, + 0x76, 0x0b, 0x65, 0x88, 0xb6, 0x42, 0x9b, 0x26, + 0x87, 0x14, 0x70, 0x0c, 0x5f, 0xc5, 0xc2, 0x3e, + 0x97, 0x23, 0x83, 0x13, 0x6c, 0x0c, 0x5c, 0xb1, + 0xc9, 0x76, 0xbc, 0x4a, 0xaa, 0x20, 0x8d, 0x12, + 0x78, 0x93, 0xbf, 0x46, 0xa3, 0x26, 0x8d, 0x14, + 0x74, 0x0c, 0x62, 0xc8, 0xc4, 0x3b, 0x97, 0x21, + 0x82, 0x11, 0x6a, 0x0a, 0x59, 0xa3, 0xb9, 0x68, + 0xa9, 0x30, 0x8d, 0x1a, 0x78, 0x0f, 0x61, 0xa0, + 0xc9, 0x73, 0xbe, 0x50, 0xb1, 0x30, 0x9f, 0x14, + 0x80, 0x83, 0xb7, 0x3c, 0x9a, 0x20, 0x84, 0x0e, + 0x6a, 0x0a, 0x57, 0xac, 0xc2, 0x68, 0xb0, 0x2e, + 0x92, 0x19, 0x7c, 0x0d, 0x63, 0x93, 0xbe, 0x62, + 0xb0, 0x3c, 0x9e, 0x1a, 0x80, 0x0e, 0x6b, 0xbb, + 0x02, 0xa0, 0x02, 0xa0, 0x02, 0x6f, 0x00, 0x75, + 0x00, 0x75, 0x00, 0x00, 0x00, 0xad, 0x02, 0xb3, + 0x02, 0x6f, 0x00, 0x87, 0x00, 0x85, 0xfe, 0x03, + 0x00, 0xc2, 0x02, 0x82, 0x4d, 0x92, 0x6e, 0x4d, + 0xb1, 0xa8, 0x84, 0x01, 0x00, 0x07, 0x7e, 0x00, + 0xa8, 0x02, 0xa4, 0x02, 0xa4, 0x02, 0xa2, 0x00, + 0xa6, 0x00, 0xa6, 0x00, 0x00, 0x00, 0xb4, 0x02, + 0xb4, 0x02, 0x92, 0x00, 0x96, 0x00, 0x96, 0x46, + 0x04, 0xb0, 0x02, 0x64, 0x02, 0x0a, 0x8c, 0x00, + 0x90, 0x02, 0x98, 0x02, 0x98, 0x02, 0x0e, 0x01, + 0x11, 0x01, 0x11, 0x50, 0xc3, 0x08, 0x88, 0x02, + 0x88, 0x02, 0x19, 0x01, 0x02, 0x01, 0x02, 0x01, + 0xf3, 0x2d, 0x00, 0x00 +}; + /* Array of known hw_options bits with human-friendly parsing */ static struct hc_hwopt { const u32 bit; @@ -287,6 +471,76 @@ fail: return ret; } +/* + * If the RB_ID_WLAN_DATA payload starts with RB_MAGIC_LZOR, then past + * that magic number is a payload that must be appended to the hc_lzor_prefix, + * the resulting blob is LZO-compressed. In the LZO decompression result, + * the RB_MAGIC_ERD magic number (aligned) must be located. Following that + * magic, there is a routerboot tag node (id 0x1) locating the RLE-encoded + * calibration data payload. + */ +static int hc_wlan_data_unpack_lzor(const u8 *inbuf, size_t inlen, + void *outbuf, size_t *outlen) +{ + u16 rle_ofs, rle_len; + size_t templen; + u8 *tempbuf; + int ret; + + templen = inlen + sizeof(hc_lzor_prefix); + if (templen > *outlen) + return -EFBIG; + + /* Temporary buffer same size as the outbuf */ + tempbuf = kmalloc(*outlen, GFP_KERNEL); + if (!outbuf) + return -ENOMEM; + + /* Concatenate into the outbuf */ + memcpy(outbuf, hc_lzor_prefix, sizeof(hc_lzor_prefix)); + memcpy(outbuf + sizeof(hc_lzor_prefix), inbuf, inlen); + + /* LZO-decompress templen bytes of outbuf into the tempbuf */ + ret = lzo1x_decompress_safe(outbuf, templen, tempbuf, outlen); + if (ret) { + pr_debug(RB_HC_PR_PFX "LZO decompression error (%d)\n", ret); + goto fail; + } + templen = *outlen; + + /* + * Post decompression we have a blob (possibly byproduct of the lzo + * dictionary). We need to find RB_MAGIC_ERD. The magic number seems to + * be 32bit-aligned in the decompression output. + */ + + while (RB_MAGIC_ERD != *(u32 *)tempbuf) { + tempbuf += 4; + templen -= 4; + } + + /* Past magic. Look for tag node */ + ret = routerboot_tag_find(tempbuf, templen, 0x1, &rle_ofs, &rle_len); + if (ret) { + pr_debug(RB_HC_PR_PFX "RLE data not found\n"); + goto fail; + } + + if (rle_len > templen) { + pr_debug(RB_HC_PR_PFX "Invalid RLE data length\n"); + goto fail; + } + + /* RLE-decode tempbuf back into the outbuf */ + ret = routerboot_rle_decode(tempbuf+rle_ofs, rle_len, outbuf, outlen); + if (ret) + pr_debug(RB_HC_PR_PFX "RLE decoding error (%d)\n", ret); + +fail: + kfree(tempbuf); + return ret; +} + static int hc_wlan_data_unpack(const size_t tofs, size_t tlen, void *outbuf, size_t *outlen) { @@ -303,6 +557,12 @@ static int hc_wlan_data_unpack(const size_t tofs, size_t tlen, ret = -ENODATA; switch (magic) { + case RB_MAGIC_LZOR: + /* Skip magic */ + lbuf += sizeof(magic); + tlen -= sizeof(magic); + ret = hc_wlan_data_unpack_lzor(lbuf, tlen, outbuf, outlen); + break; case RB_MAGIC_ERD: /* Skip magic */ lbuf += sizeof(magic); From 301bc3290df394bd39373ffc081818b56092b05f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sun, 19 Apr 2020 12:09:20 +0200 Subject: [PATCH 15/29] ath79/mikrotik: don't use mtd-mac-address in DTS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As evidenced here[1] the device MAC address can be stored at a random offset in the hard_config partition. Rely on sysfs to update the MAC address correctly. To match sticker and vendor OS behavior, WAN MAC is set to the device base MAC and LAN MAC is incremented from that. Note: this will trigger a harmless kernel message during boot: ag71xx 19000000.eth: invalid MAC address, using random address There is no clean workaround to prevent this message from being emitted. [1] https://github.com/openwrt/openwrt/pull/2850#issuecomment-610809021 Signed-off-by: Thibaut VARÈNE --- .../dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts | 3 --- .../dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts | 2 -- .../ath79/mikrotik/base-files/etc/board.d/02_network | 9 +++++++++ 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts b/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts index a0190760fb..feae550039 100644 --- a/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts +++ b/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts @@ -11,7 +11,6 @@ model = "MikroTik RouterBOARD wAP G-5HacT2HnD"; aliases { - label-mac-device = ð1; mdio-gpio1 = &mdio2; serial0 = &uart; }; @@ -53,8 +52,6 @@ ð1 { status = "okay"; - mtd-mac-address = <&hard_config 0x10>; - pll-data = <0x03000101 0x80000101 0x80001313>; phy-handle = <&phy0>; diff --git a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts index 7377953f78..391c034dab 100644 --- a/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts +++ b/target/linux/ath79/dts/qca9558_mikrotik_routerboard-922uags-5hpacd.dts @@ -11,7 +11,6 @@ model = "MikroTik RouterBOARD 922UAGS-5HPacD"; aliases { - label-mac-device = ð0; led-boot = &led_user; led-failsafe = &led_user; led-upgrade = &led_user; @@ -80,7 +79,6 @@ ð0 { status = "okay"; - mtd-mac-address = <&hard_config 0x10>; phy-handle = <&phy4>; pll-data = <0x8f000000 0xa0000101 0xa0001313>; diff --git a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network index ee795c7496..7f8327f764 100755 --- a/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network +++ b/target/linux/ath79/mikrotik/base-files/etc/board.d/02_network @@ -21,8 +21,17 @@ ath79_setup_interfaces() ath79_setup_macs() { local board="$1" + local lan_mac="" + local wan_mac="" + local label_mac="" + local mac_base="$(cat /sys/firmware/mikrotik/hard_config/mac_base)" case "$board" in + *) + label_mac="$mac_base" + wan_mac="$mac_base" + lan_mac=$(macaddr_add $mac_base 1) + ;; esac [ -n "$lan_mac" ] && ucidef_set_interface_macaddr "lan" $lan_mac From 1e24af5638f1c7263c10157afd7b25b9bf601c0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sun, 19 Apr 2020 11:42:45 +0200 Subject: [PATCH 16/29] ath79/mikrotik: use standard caldata functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit With the implementation of a sysfs interface to access WLAN data, this target no longer needs a special wrapper to extract caldata. Signed-off-by: Thibaut VARÈNE --- target/linux/ath79/image/common-mikrotik.mk | 2 +- .../etc/hotplug.d/firmware/10-ath9k-eeprom | 8 +++--- .../etc/hotplug.d/firmware/11-ath10k-caldata | 7 ++--- .../lib/functions/mikrotik-caldata.sh | 26 ------------------- 4 files changed, 10 insertions(+), 33 deletions(-) delete mode 100644 target/linux/ath79/mikrotik/base-files/lib/functions/mikrotik-caldata.sh diff --git a/target/linux/ath79/image/common-mikrotik.mk b/target/linux/ath79/image/common-mikrotik.mk index 292237c76a..4cf0aa1cac 100644 --- a/target/linux/ath79/image/common-mikrotik.mk +++ b/target/linux/ath79/image/common-mikrotik.mk @@ -1,6 +1,6 @@ define Device/mikrotik DEVICE_VENDOR := MikroTik - DEVICE_PACKAGES := rbextract rbcfg + DEVICE_PACKAGES := rbcfg LOADER_TYPE := elf KERNEL := kernel-bin | append-dtb | lzma | loader-kernel KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma | loader-kernel diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 86995de890..884e150bbb 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -3,7 +3,9 @@ [ -e /lib/firmware/$FIRMWARE ] && exit 0 . /lib/functions/caldata.sh -. /lib/functions/mikrotik-caldata.sh + +wlan_data="/sys/firmware/mikrotik/hard_config/wlan_data" +mac_base="$(cat /sys/firmware/mikrotik/hard_config/mac_base)" board=$(board_name) @@ -11,8 +13,8 @@ case "$FIRMWARE" in "ath9k-eeprom-ahb-18100000.wmac.bin") case $board in mikrotik,routerboard-wap-g-5hact2hnd) - mikrotik_caldata_extract "hard_config" 0x1000 0x440 - ath9k_patch_mac $(macaddr_add $(mtd_get_mac_binary hard_config 0x10) +2) + caldata_from_file $wlan_data 0x1000 0x440 + ath9k_patch_mac $(macaddr_add "$mac_base" +2) ;; *) caldata_die "board $board is not supported yet" diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 2521f0ad96..b486a5720d 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -3,7 +3,8 @@ [ -e /lib/firmware/$FIRMWARE ] && exit 0 . /lib/functions/caldata.sh -. /lib/functions/mikrotik-caldata.sh + +wlan_data="/sys/firmware/mikrotik/hard_config/wlan_data" board=$(board_name) @@ -11,14 +12,14 @@ case "$FIRMWARE" in "ath10k/cal-pci-0000:00:00.0.bin") case $board in mikrotik,routerboard-wap-g-5hact2hnd) - mikrotik_caldata_extract "hard_config" 0x5000 0x844 + caldata_from_file $wlan_data 0x5000 0x844 ;; esac ;; "ath10k/cal-pci-0000:01:00.0.bin") case $board in mikrotik,routerboard-922uags-5hpacd) - mikrotik_caldata_extract "hard_config" 0x5000 0x844 + caldata_from_file $wlan_data 0x5000 0x844 ;; esac ;; diff --git a/target/linux/ath79/mikrotik/base-files/lib/functions/mikrotik-caldata.sh b/target/linux/ath79/mikrotik/base-files/lib/functions/mikrotik-caldata.sh deleted file mode 100644 index 71a1bf02f3..0000000000 --- a/target/linux/ath79/mikrotik/base-files/lib/functions/mikrotik-caldata.sh +++ /dev/null @@ -1,26 +0,0 @@ -# Copyright (C) 2019 Robert Marko -# Copyright (C) 2019 Roger Pueyo Centelles -# -# Helper function to extract MAC addresses and calibration data for MikroTik -# - -mikrotik_caldata_extract() { - local part=$1 - local offset=$(($2)) - local count=$(($3)) - local mtd - local erdfile="/tmp/erd.bin" - local fwfile="/lib/firmware/${FIRMWARE}" - - [ -e $fwfile ] && exit 0 - - mtd=$(find_mtd_chardev $part) - [ -n "$mtd" ] || caldata_die "no mtd device found for partition $part" - - rbextract -e $mtd $erdfile - - dd if=$erdfile of=$fwfile iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ - caldata_die "failed to extract calibration data from $mtd" - - rm -f $erdfile -} From ab68939254b2ebf53561eb47fdd28da016e93b53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sun, 19 Apr 2020 11:46:57 +0200 Subject: [PATCH 17/29] package/utils: remove rbextract MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rationale: 1/ This tool is no longer necessary following the implementation of a sysfs driver 2/ The upstream author, Robert Marko, stated[1] that this tool had been taken from his tree in an unfinished state not suitable for merging [1] https://github.com/openwrt/openwrt/pull/2850#issuecomment-610277863 Signed-off-by: Thibaut VARÈNE --- package/utils/rbextract/Makefile | 38 -- package/utils/rbextract/src/CMakeLists.txt | 14 - package/utils/rbextract/src/rbextract.c | 497 --------------------- package/utils/rbextract/src/rle.c | 80 ---- package/utils/rbextract/src/rle.h | 8 - package/utils/rbextract/src/routerboot.h | 258 ----------- 6 files changed, 895 deletions(-) delete mode 100644 package/utils/rbextract/Makefile delete mode 100644 package/utils/rbextract/src/CMakeLists.txt delete mode 100644 package/utils/rbextract/src/rbextract.c delete mode 100644 package/utils/rbextract/src/rle.c delete mode 100644 package/utils/rbextract/src/rle.h delete mode 100644 package/utils/rbextract/src/routerboot.h diff --git a/package/utils/rbextract/Makefile b/package/utils/rbextract/Makefile deleted file mode 100644 index f50bbea120..0000000000 --- a/package/utils/rbextract/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright (C) 2010 Gabor Juhos -# Copyright (C) 2018 Chris Schimp -# Copyright (C) 2019 Robert Marko -# Copyright (C) 2019 Roger Pueyo Centelles -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=rbextract -PKG_RELEASE:=3 -CMAKE_INSTALL:=1 - -include $(INCLUDE_DIR)/package.mk -include $(INCLUDE_DIR)/cmake.mk - -define Package/rbextract - SECTION:=utils - CATEGORY:=Utilities - SUBMENU:=Boot Loaders - TITLE:=RouterBOOT ART Extractor - DEPENDS:=@TARGET_ath79 +liblzo -endef - -define Package/rbextract/description - This utility is for extracting the WLAN radio calibration data from Mikrotik - Routerboards. -endef - -define Package/rbextract/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/rbextract $(1)/usr/sbin/ -endef - -$(eval $(call BuildPackage,rbextract)) diff --git a/package/utils/rbextract/src/CMakeLists.txt b/package/utils/rbextract/src/CMakeLists.txt deleted file mode 100644 index 0ed5168fb0..0000000000 --- a/package/utils/rbextract/src/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 2.6) - -PROJECT(rbextract C) -ADD_DEFINITIONS(-Wall --std=gnu99 -Wmissing-declarations) - -SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") - -FIND_PATH(lzo_include_dir lzo/lzo1x.h) -INCLUDE_DIRECTORIES(${lzo_include_dir}) - -ADD_EXECUTABLE(rbextract rbextract.c rle.c) -TARGET_LINK_LIBRARIES(rbextract lzo2) - -INSTALL(TARGETS rbextract RUNTIME DESTINATION sbin) diff --git a/package/utils/rbextract/src/rbextract.c b/package/utils/rbextract/src/rbextract.c deleted file mode 100644 index e75d74957a..0000000000 --- a/package/utils/rbextract/src/rbextract.c +++ /dev/null @@ -1,497 +0,0 @@ -/* - * RouterBoot helper routines - * - * Copyright (C) 2012 Gabor Juhos - * Copyright (C) 2018 Chris Schimp - * Copyright (C) 2019 Robert Marko - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "rle.h" -#include "routerboot.h" - -inline uint32_t -get_u32(const void *buf) -{ -#if __BYTE_ORDER == __LITTLE_ENDIAN - return *(uint32_t *)buf; -#elif __BYTE_ORDER == __BIG_ENDIAN - const uint8_t *p = buf; - return ((uint32_t) p[3] + ((uint32_t) p[2] << 8) + - ((uint32_t) p[1] << 16) + ((uint32_t) p[0] << 24)); -#else -#error "Unknown byte order!" -#endif -} - -int -routerboot_find_tag(uint8_t *buf, unsigned int buflen, uint16_t tag_id, - uint8_t **tag_data, uint16_t *tag_len) -{ - uint16_t id; - uint16_t len; - uint32_t magic; - bool align = false; - int ret; - - if (buflen < 4) - return 1; - - magic = get_u32(buf); - - switch (magic) { - case RB_MAGIC_LZOR: - buf += 4; - buflen -= 4; - break; - case RB_MAGIC_ERD: - align = true; - /* fall trough */ - case RB_MAGIC_HARD: - /* skip magic value */ - buf += 4; - buflen -= 4; - break; - - case RB_MAGIC_SOFT: - if (buflen < 8) - return 1; - - /* skip magic and CRC value */ - buf += 8; - buflen -= 8; - - break; - - default: - return 1; - } - - ret = 1; - while (buflen > 4){ - uint32_t id_and_len = get_u32(buf); - buf += 4; - buflen -= 4; - id = id_and_len & 0xFFFF; - len = id_and_len >> 16; - - if (align) - len += (4 - len % 4) % 4; - - if (id == RB_ID_TERMINATOR) { - break; - } - - if (buflen < len) - break; - - if (id == tag_id) { - *tag_len = len; - *tag_data = buf; - ret = 0; - break; - } - - buf += len; - buflen -= len; - } - - return ret; -} - -inline int -rb_find_hard_cfg_tag(uint16_t tag_id, uint8_t **tag_data, uint16_t *tag_len) -{ - if (!rb_hardconfig || - !rb_hardconfig_len) - return 1; - - return routerboot_find_tag(rb_hardconfig, - rb_hardconfig_len, - tag_id, tag_data, tag_len); -} - -const uint8_t * -rb_get_board_product_code(void) -{ - uint16_t tag_len; - uint8_t *tag; - int err; - - err = rb_find_hard_cfg_tag(RB_ID_BOARD_PRODUCT_CODE, &tag, &tag_len); - if (err) - return NULL; - - return tag; -} - -uint32_t -rb_get_board_mac(void) -{ - uint16_t tag_len; - uint8_t *tag; - int err; - - err = rb_find_hard_cfg_tag(RB_ID_MAC_ADDRESS_PACK, &tag, &tag_len); - if (err) - return 0; - - return htonl(get_u32(tag)); -} - -const uint8_t * -rb_get_board_serial(void) -{ - uint16_t tag_len; - uint8_t *tag; - int err; - - err = rb_find_hard_cfg_tag(RB_ID_SERIAL_NUMBER, &tag, &tag_len); - if (err) - return NULL; - - return tag; -} - -const uint8_t * -rb_get_board_identifier(void) -{ - uint16_t tag_len; - uint8_t *tag; - int err; - - err = rb_find_hard_cfg_tag(RB_ID_BOARD_IDENTIFIER, &tag, &tag_len); - if (err) - return NULL; - - return tag; -} - -const uint8_t * -rb_get_board_name(void) -{ - uint16_t tag_len; - uint8_t *tag; - int err; - - err = rb_find_hard_cfg_tag(RB_ID_BOARD_NAME, &tag, &tag_len); - if (err) - return NULL; - - return tag; -} - -const uint8_t * -rb_get_factory_booter_version(void) -{ - uint16_t tag_len; - uint8_t *tag; - int err; - - err = rb_find_hard_cfg_tag(RB_ID_BIOS_VERSION, &tag, &tag_len); - if (err) - return NULL; - - return tag; -} - -uint32_t -rb_get_flash_info(void) -{ - uint16_t tag_len; - uint8_t *tag; - int err; - - err = rb_find_hard_cfg_tag(RB_ID_FLASH_INFO, &tag, &tag_len); - if (err) - return 0; - - return htonl(get_u32(tag)); -} - -uint32_t -rb_get_hw_options(void) -{ - uint16_t tag_len; - uint8_t *tag; - int err; - - err = rb_find_hard_cfg_tag(RB_ID_HW_OPTIONS, &tag, &tag_len); - if (err) - return 0; - - return htonl(get_u32(tag)); -} - -uint8_t * -__rb_get_wlan_data(void) -{ - uint16_t tag_len; - uint8_t *tag; - uint16_t erd_tag_len; - uint8_t *erd_tag; - uint8_t *buf_lzo_in; - uint8_t *buf_lzo_out; - uint8_t *buf_rle_out; - int err; - uint32_t magic; - uint32_t erd_magic; - uint32_t erd_offset; - size_t lzo_out_len; - - err = rb_find_hard_cfg_tag(RB_ID_WLAN_DATA, &tag, &tag_len); - if (err) { - printf("no calibration data found\n"); - goto err; - } - - buf_lzo_in = malloc(RB_ART_SIZE); - if (buf_lzo_in == NULL) { - printf("no memory for calibration data\n"); - goto err; - } - - buf_rle_out = malloc(RB_ART_SIZE); - if (buf_rle_out == NULL) { - printf("no memory for calibration data\n"); - goto err_free_lzo_out; - } - - buf_lzo_out = malloc(RB_ART_SIZE); - if (buf_lzo_out == NULL) { - printf("no memory for calibration data\n"); - goto err_free_lzo_in; - } - - magic = get_u32(tag); - if (magic == RB_MAGIC_LZOR) { - tag += 4; - tag_len -= 4; - if (tag_len + sizeof(lzo_prefix) > RB_ART_SIZE) { - printf("Calibration data too large\n"); - goto err_free_lzo_in; - } - printf("Copying fixed LZO prefix (size: %d)\n", sizeof(lzo_prefix)); - memcpy(buf_lzo_in, lzo_prefix, sizeof(lzo_prefix)); - - printf("Copying input data (size: %d)\n", tag_len); - memcpy(buf_lzo_in + sizeof(lzo_prefix), tag, tag_len); - - printf("Decompressing with LZO\n"); - lzo_out_len = RB_ART_SIZE; - err = lzo1x_decompress_safe(buf_lzo_in, tag_len + sizeof(lzo_prefix), - buf_lzo_out, &lzo_out_len, NULL); - /* For some reason, I get this "input not consumed" error - * even though the output is correct, so ignore it. */ - if (err && err != LZO_E_INPUT_NOT_CONSUMED) { - printf("unable to decompress calibration data: %d\n", - err); - goto err_free_lzo_out; - } - - printf("Looking for ERD data in decompressed output\n"); - erd_magic = 0; - for (erd_offset = 0; erd_offset < lzo_out_len; erd_offset++) { - erd_magic = get_u32(buf_lzo_out + erd_offset); - if (erd_magic == RB_MAGIC_ERD) - break; - } - if (erd_magic != RB_MAGIC_ERD) { - printf("no ERD data found\n"); - goto err_free_lzo_out; - } - printf("Found ERD magic at offset %d\n", erd_offset); - - err = routerboot_find_tag(buf_lzo_out + erd_offset, - lzo_out_len - erd_offset, - 0x1, &erd_tag, &erd_tag_len); - if (err) { - printf("No ERD chunk found\n"); - goto err_free_lzo_out; - } - - printf("Decompress ERD data with RLE\n"); - err = rle_decode(erd_tag, erd_tag_len, buf_rle_out, RB_ART_SIZE, - NULL, NULL); - if (err) { - printf("unable to decode ERD data\n"); - goto err_free_rle_out; - } - } - /* Older ath79-based boards directly show the RB_MAGIC_ERD bytes followed by - the LZO-compressed calibration data with no RLE */ - else if (magic == RB_MAGIC_ERD) { - if (tag_len > RB_ART_SIZE) { - printf("Calibration data too large\n"); - goto err_free_lzo_in; - } - - err = routerboot_find_tag(tag, tag_len, - 0x1, &buf_lzo_in, &erd_tag_len); - if (err) { - printf("No ERD chunk found\n"); - goto err_free_lzo_out; - } - - printf("Decompressing with LZO\n"); - lzo_out_len = RB_ART_SIZE; - err = lzo1x_decompress_safe(buf_lzo_in, tag_len, - buf_lzo_out, &lzo_out_len, NULL); - /* For some reason, I get this "input not consumed" error - * even though the output is correct, so ignore it. */ - if (err && err != LZO_E_INPUT_NOT_CONSUMED) { - printf("unable to decompress calibration data: %d\n", - err); - goto err_free_lzo_out; - } - - buf_rle_out = buf_lzo_out; - } - /* Even older ath79-base boards directly have RLE-encoded calibration data, - without any LZO compresion nor showing RB_MAGIC_ERD bytes */ - else { - printf("Decode calibration data with RLE\n"); - err = rle_decode(tag, tag_len, buf_rle_out, RB_ART_SIZE, - NULL, NULL); - if (err) { - printf("unable to decode ERD data\n"); - goto err_free_rle_out; - } - } - - return buf_rle_out; - -err_free_rle_out: - free(buf_rle_out); -err_free_lzo_out: - free(buf_lzo_out); -err_free_lzo_in: - free(buf_lzo_in); -err: - return NULL; -} - -int -main(int argc, char **argv) -{ - FILE *infile; - FILE *outfile; - uint8_t *buf; - uint32_t magic; - uint32_t i; - - if(argc < 2){ - printf("Not enough arguments\n"); - printf("Use -h for help\n"); - exit(1); - } - - if(strcmp(argv[1], "-h") == 0){ - printf("This program can extract various data from MikroTik devices hard_config partition\n"); - printf("Usage: rbextract (Optional)\n"); - printf("Options:\n"); - printf("-a Prints all possible info\n"); - printf("-n Prints board name\n"); - printf("-p Prints board product code\n"); - printf("-i Prints board identifier\n"); - printf("-s Prints board serial number\n"); - printf("-m Prints board MAC\n"); - printf("-o Prints board HW options\n"); - printf("-r Prints board RouterBoot factory version\n"); - printf("-f Prints board flash identifier\n"); - printf("-e Extract board radio calibration\n"); - printf("hard_config_location: Path to hard_config partiton\n"); - printf("output_file: Path to where caldata will be output\n"); - } else { - infile = fopen(argv[2], "r"); - - if(infile == NULL){ - printf("Cant open given path\n"); - return 1; - } - - fseek(infile, 0L, SEEK_END); - rb_hardconfig_len = ftell(infile); - - fseek(infile, 0L, SEEK_SET); - - rb_hardconfig = (uint8_t*)calloc(rb_hardconfig_len, sizeof(uint8_t)); - if(rb_hardconfig == NULL) - return 1; - - fread(rb_hardconfig, sizeof(uint8_t), rb_hardconfig_len, infile); - fclose(infile); - - magic = get_u32(rb_hardconfig); - if(magic != RB_MAGIC_HARD){ - printf("Routerboot Hard Config not found\n"); - exit(1); - } - - if(strcmp(argv[1], "-a") == 0){ - printf("Board name: %s\n", rb_get_board_name()); - printf("Board product code: %s\n", rb_get_board_product_code()); - printf("Board identifier: %s\n", rb_get_board_identifier()); - printf("Board serial: %s\n", rb_get_board_serial()); - printf("Board MAC: %X\n", rb_get_board_mac()); - printf("HW Options %x\n", rb_get_hw_options()); - printf("Factory RouterBoot version: %s\n", rb_get_factory_booter_version()); - printf("Flash identifier: %x\n", rb_get_flash_info()); - } else if(strcmp(argv[1], "-n") == 0){ - printf("%s\n", rb_get_board_name()); - } else if(strcmp(argv[1], "-p") == 0){ - printf("%s\n", rb_get_board_product_code()); - } else if(strcmp(argv[1], "-i") == 0){ - printf("%s\n", rb_get_board_identifier()); - } else if(strcmp(argv[1], "-s") == 0){ - printf("%s\n", rb_get_board_serial()); - } else if(strcmp(argv[1], "-m") == 0){ - printf("%x\n", rb_get_board_mac()); - } else if(strcmp(argv[1], "-o") == 0){ - printf("%x\n", rb_get_hw_options()); - } else if(strcmp(argv[1], "-r") == 0){ - printf("%s\n", rb_get_factory_booter_version()); - } else if(strcmp(argv[1], "-f") == 0){ - printf("%x\n", rb_get_flash_info()); - } else if(strcmp(argv[1], "-e") == 0){ - buf = __rb_get_wlan_data(); - if (buf == NULL) { - printf("Could not extract calibration data\n"); - return 1; - } - - if(argv[3] == NULL){ - printf("Missing output file argument\n"); - return 1; - } - - outfile = fopen(argv[3], "wb"); - if(outfile == NULL){ - printf("Cant open given path\n"); - return 1; - } - - /* Write 65536 bytes of caldata */ - for(i = 0; i - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#include -#include -#include -#include -#include - -#include "rle.h" - -int rle_decode(const unsigned char *src, size_t srclen, - unsigned char *dst, size_t dstlen, - size_t *src_done, size_t *dst_done) -{ - size_t srcpos, dstpos; - int ret; - - srcpos = 0; - dstpos = 0; - ret = 1; - - /* sanity checks */ - if (!src || !srclen || !dst || !dstlen) - goto out; - - while (1) { - signed char count; - - if (srcpos >= srclen) - break; - - count = (signed char) src[srcpos++]; - if (count == 0) { - ret = 0; - break; - } - - if (count > 0) { - unsigned char c; - - if (srcpos >= srclen) - break; - - c = src[srcpos++]; - - while (count--) { - if (dstpos >= dstlen) - break; - - dst[dstpos++] = c; - } - } else { - count *= -1; - - while (count--) { - if (srcpos >= srclen) - break; - if (dstpos >= dstlen) - break; - dst[dstpos++] = src[srcpos++]; - } - } - } - -out: - if (src_done) - *src_done = srcpos; - if (dst_done) - *dst_done = dstpos; - - return ret; -} diff --git a/package/utils/rbextract/src/rle.h b/package/utils/rbextract/src/rle.h deleted file mode 100644 index 21cf66c993..0000000000 --- a/package/utils/rbextract/src/rle.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef _RLE_H_ -#define _RLE_H_ - -int rle_decode(const unsigned char *src, size_t srclen, - unsigned char *dst, size_t dstlen, - size_t *src_done, size_t *dst_done); - -#endif /* _RLE_H_ */ diff --git a/package/utils/rbextract/src/routerboot.h b/package/utils/rbextract/src/routerboot.h deleted file mode 100644 index 13809d97fc..0000000000 --- a/package/utils/rbextract/src/routerboot.h +++ /dev/null @@ -1,258 +0,0 @@ -/* - * RouterBoot/RBextract definitions - * - * Copyright (C) 2012 Gabor Juhos - * Copyright (C) 2019 Robert Marko - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - */ - -#ifndef _RBEXTRACT_H -#define _RBEXTRACT_H - -/* Used on some newer boards (ipq40xx). This fixed data is concatenated - with data extracted from the hard_config partition, then decompressed - with LZO. There may also be a second decoding step with RLE. */ -uint8_t lzo_prefix[] = { - 0x00, 0x05, 0x4c, 0x4c, 0x44, 0x00, 0x34, 0xfe, - 0xfe, 0x34, 0x11, 0x3c, 0x1e, 0x3c, 0x2e, 0x3c, - 0x4c, 0x34, 0x00, 0x52, 0x62, 0x92, 0xa2, 0xb2, - 0xc3, 0x2a, 0x14, 0x00, 0x00, 0x05, 0xfe, 0x6a, - 0x3c, 0x16, 0x32, 0x16, 0x11, 0x1e, 0x12, 0x46, - 0x32, 0x46, 0x11, 0x4e, 0x12, 0x36, 0x32, 0x36, - 0x11, 0x3e, 0x12, 0x5a, 0x9a, 0x64, 0x00, 0x04, - 0xfe, 0x10, 0x3c, 0x00, 0x01, 0x00, 0x00, 0x28, - 0x0c, 0x00, 0x0f, 0xfe, 0x14, 0x00, 0x24, 0x24, - 0x23, 0x24, 0x24, 0x23, 0x25, 0x22, 0x21, 0x21, - 0x23, 0x22, 0x21, 0x22, 0x21, 0x2d, 0x38, 0x00, - 0x0c, 0x25, 0x25, 0x24, 0x25, 0x25, 0x24, 0x23, - 0x22, 0x21, 0x20, 0x23, 0x21, 0x21, 0x22, 0x21, - 0x2d, 0x38, 0x00, 0x28, 0xb0, 0x00, 0x00, 0x22, - 0x00, 0x00, 0xc0, 0xfe, 0x03, 0x00, 0xc0, 0x00, - 0x62, 0xff, 0x62, 0xff, 0xfe, 0x06, 0x00, 0xbb, - 0xff, 0xba, 0xff, 0xfe, 0x08, 0x00, 0x9e, 0xff, - 0xfe, 0x0a, 0x00, 0x53, 0xff, 0xfe, 0x02, 0x00, - 0x20, 0xff, 0xb1, 0xfe, 0xfe, 0xb2, 0xfe, 0xfe, - 0xed, 0xfe, 0xfe, 0xfe, 0x04, 0x00, 0x3a, 0xff, - 0x3a, 0xff, 0xde, 0xfd, 0x5f, 0x04, 0x33, 0xff, - 0x4c, 0x74, 0x03, 0x05, 0x05, 0xff, 0x6d, 0xfe, - 0xfe, 0x6d, 0xfe, 0xfe, 0xaf, 0x08, 0x63, 0xff, - 0x64, 0x6f, 0x08, 0xac, 0xff, 0xbf, 0x6d, 0x08, - 0x7a, 0x6d, 0x08, 0x96, 0x74, 0x04, 0x00, 0x08, - 0x79, 0xff, 0xda, 0xfe, 0xfe, 0xdb, 0xfe, 0xfe, - 0x56, 0xff, 0xfe, 0x04, 0x00, 0x5e, 0xff, 0x5e, - 0xff, 0x6c, 0xfe, 0xfe, 0xfe, 0x06, 0x00, 0x41, - 0xff, 0x7f, 0x74, 0x03, 0x00, 0x11, 0x44, 0xff, - 0xa9, 0xfe, 0xfe, 0xa9, 0xfe, 0xfe, 0xa5, 0x8f, - 0x01, 0x00, 0x08, 0x01, 0x01, 0x02, 0x04, 0x08, - 0x02, 0x04, 0x08, 0x08, 0x01, 0x01, 0xfe, 0x22, - 0x00, 0x4c, 0x60, 0x64, 0x8c, 0x90, 0xd0, 0xd4, - 0xd8, 0x5c, 0x10, 0x09, 0xd8, 0xff, 0xb0, 0xff, - 0x00, 0x00, 0xba, 0xff, 0x14, 0x00, 0xba, 0xff, - 0x64, 0x00, 0x00, 0x08, 0xfe, 0x06, 0x00, 0x74, - 0xff, 0x42, 0xff, 0xce, 0xff, 0x60, 0xff, 0x0a, - 0x00, 0xb4, 0x00, 0xa0, 0x00, 0xa0, 0xfe, 0x07, - 0x00, 0x0a, 0x00, 0xb0, 0xff, 0x96, 0x4d, 0x00, - 0x56, 0x57, 0x18, 0xa6, 0xff, 0x92, 0x70, 0x11, - 0x00, 0x12, 0x90, 0x90, 0x76, 0x5a, 0x54, 0x54, - 0x4c, 0x46, 0x38, 0x00, 0x10, 0x10, 0x08, 0xfe, - 0x05, 0x00, 0x38, 0x29, 0x25, 0x23, 0x22, 0x22, - 0x1f, 0x00, 0x00, 0x00, 0xf6, 0xe1, 0xdd, 0xf8, - 0xfe, 0x00, 0xfe, 0x15, 0x00, 0x00, 0xd0, 0x02, - 0x74, 0x02, 0x08, 0xf8, 0xe5, 0xde, 0x02, 0x04, - 0x04, 0xfd, 0x00, 0x00, 0x00, 0x07, 0x50, 0x2d, - 0x01, 0x90, 0x90, 0x76, 0x60, 0xb0, 0x07, 0x07, - 0x0c, 0x0c, 0x04, 0xfe, 0x05, 0x00, 0x66, 0x66, - 0x5a, 0x56, 0xbc, 0x01, 0x06, 0xfc, 0xfc, 0xf1, - 0xfe, 0x07, 0x00, 0x24, 0x95, 0x70, 0x64, 0x18, - 0x06, 0x2c, 0xff, 0xb5, 0xfe, 0xfe, 0xb5, 0xfe, - 0xfe, 0xe2, 0x8c, 0x24, 0x02, 0x2f, 0xff, 0x2f, - 0xff, 0xb4, 0x78, 0x02, 0x05, 0x73, 0xff, 0xed, - 0xfe, 0xfe, 0x4f, 0xff, 0x36, 0x74, 0x1e, 0x09, - 0x4f, 0xff, 0x50, 0xff, 0xfe, 0x16, 0x00, 0x70, - 0xac, 0x70, 0x8e, 0xac, 0x40, 0x0e, 0x01, 0x70, - 0x7f, 0x8e, 0xac, 0x6c, 0x00, 0x0b, 0xfe, 0x02, - 0x00, 0xfe, 0x0a, 0x2c, 0x2a, 0x2a, 0x28, 0x26, - 0x1e, 0x1e, 0xfe, 0x02, 0x20, 0x65, 0x20, 0x00, - 0x00, 0x05, 0x12, 0x00, 0x11, 0x1e, 0x11, 0x11, - 0x41, 0x1e, 0x41, 0x11, 0x31, 0x1e, 0x31, 0x11, - 0x70, 0x75, 0x7a, 0x7f, 0x84, 0x89, 0x8e, 0x93, - 0x98, 0x30, 0x20, 0x00, 0x02, 0x00, 0xfe, 0x06, - 0x3c, 0xbc, 0x32, 0x0c, 0x00, 0x00, 0x2a, 0x12, - 0x1e, 0x12, 0x2e, 0x12, 0xcc, 0x12, 0x11, 0x1a, - 0x1e, 0x1a, 0x2e, 0x1a, 0x4c, 0x10, 0x1e, 0x10, - 0x11, 0x18, 0x1e, 0x42, 0x1e, 0x42, 0x2e, 0x42, - 0xcc, 0x42, 0x11, 0x4a, 0x1e, 0x4a, 0x2e, 0x4a, - 0x4c, 0x40, 0x1e, 0x40, 0x11, 0x48, 0x1e, 0x32, - 0x1e, 0x32, 0x2e, 0x32, 0xcc, 0x32, 0x11, 0x3a, - 0x1e, 0x3a, 0x2e, 0x3a, 0x4c, 0x30, 0x1e, 0x30, - 0x11, 0x38, 0x1e, 0x27, 0x9a, 0x01, 0x9d, 0xa2, - 0x2f, 0x28, 0x00, 0x00, 0x46, 0xde, 0xc4, 0xbf, - 0xa6, 0x9d, 0x81, 0x7b, 0x5c, 0x61, 0x40, 0xc7, - 0xc0, 0xae, 0xa9, 0x8c, 0x83, 0x6a, 0x62, 0x50, - 0x3e, 0xce, 0xc2, 0xae, 0xa3, 0x8c, 0x7b, 0x6a, - 0x5a, 0x50, 0x35, 0xd7, 0xc2, 0xb7, 0xa4, 0x95, - 0x7e, 0x72, 0x5a, 0x59, 0x37, 0xfe, 0x02, 0xf8, - 0x8c, 0x95, 0x90, 0x8f, 0x00, 0xd7, 0xc0, 0xb7, - 0xa2, 0x95, 0x7b, 0x72, 0x56, 0x59, 0x32, 0xc7, - 0xc3, 0xae, 0xad, 0x8c, 0x85, 0x6a, 0x63, 0x50, - 0x3e, 0xce, 0xc3, 0xae, 0xa4, 0x8c, 0x7c, 0x6a, - 0x59, 0x50, 0x34, 0xd7, 0xc2, 0xb7, 0xa5, 0x95, - 0x7e, 0x72, 0x59, 0x59, 0x36, 0xfc, 0x05, 0x00, - 0x02, 0xce, 0xc5, 0xae, 0xa5, 0x95, 0x83, 0x72, - 0x5c, 0x59, 0x36, 0xbf, 0xc6, 0xa5, 0xab, 0x8c, - 0x8c, 0x6a, 0x67, 0x50, 0x41, 0x64, 0x07, 0x00, - 0x02, 0x95, 0x8c, 0x72, 0x65, 0x59, 0x3f, 0xce, - 0xc7, 0xae, 0xa8, 0x95, 0x86, 0x72, 0x5f, 0x59, - 0x39, 0xfe, 0x02, 0xf8, 0x8b, 0x7c, 0x0b, 0x09, - 0xb7, 0xc2, 0x9d, 0xa4, 0x83, 0x85, 0x6a, 0x6b, - 0x50, 0x44, 0xb7, 0xc1, 0x64, 0x01, 0x00, 0x06, - 0x61, 0x5d, 0x48, 0x3d, 0xae, 0xc4, 0x9d, 0xad, - 0x7b, 0x85, 0x61, 0x66, 0x48, 0x46, 0xae, 0xc3, - 0x95, 0xa3, 0x72, 0x7c, 0x59, 0x56, 0x38, 0x31, - 0x7c, 0x0b, 0x00, 0x0c, 0x96, 0x91, 0x8f, 0x00, - 0xb7, 0xc0, 0xa5, 0xab, 0x8c, 0x8a, 0x6a, 0x64, - 0x50, 0x3c, 0xb7, 0xc0, 0x9d, 0xa0, 0x83, 0x80, - 0x6a, 0x64, 0x50, 0x3d, 0xb7, 0xc5, 0x9d, 0xa5, - 0x83, 0x87, 0x6c, 0x08, 0x07, 0xae, 0xc0, 0x9d, - 0xa8, 0x83, 0x88, 0x6a, 0x6d, 0x50, 0x46, 0xfc, - 0x05, 0x00, 0x16, 0xbf, 0xc0, 0xa5, 0xa2, 0x8c, - 0x7f, 0x6a, 0x57, 0x50, 0x2f, 0xb7, 0xc7, 0xa5, - 0xb1, 0x8c, 0x8e, 0x72, 0x6d, 0x59, 0x45, 0xbf, - 0xc6, 0xa5, 0xa8, 0x8c, 0x87, 0x6a, 0x5f, 0x50, - 0x37, 0xbf, 0xc2, 0xa5, 0xa4, 0x8c, 0x83, 0x6a, - 0x5c, 0x50, 0x34, 0xbc, 0x05, 0x00, 0x0e, 0x90, - 0x00, 0xc7, 0xc2, 0xae, 0xaa, 0x95, 0x82, 0x7b, - 0x60, 0x61, 0x3f, 0xb7, 0xc6, 0xa5, 0xb1, 0x8c, - 0x8d, 0x72, 0x6b, 0x61, 0x51, 0xbf, 0xc4, 0xa5, - 0xa5, 0x8c, 0x82, 0x72, 0x61, 0x59, 0x39, 0x6c, - 0x26, 0x03, 0x95, 0x82, 0x7b, 0x61, 0x61, 0x40, - 0xfc, 0x05, 0x00, 0x00, 0x7e, 0xd7, 0xc3, 0xb7, - 0xa8, 0x9d, 0x80, 0x83, 0x5d, 0x6a, 0x3f, 0xbf, - 0xc7, 0xa5, 0xa8, 0x8c, 0x84, 0x72, 0x60, 0x61, - 0x46, 0xbf, 0xc2, 0xae, 0xb0, 0x9d, 0x92, 0x83, - 0x6f, 0x6a, 0x50, 0xd7, 0xc3, 0xb7, 0xa7, 0x9d, - 0x80, 0x83, 0x5e, 0x6a, 0x40, 0xfe, 0x02, 0xf8, - 0x8d, 0x96, 0x90, 0x90, 0xfe, 0x05, 0x00, 0x8a, - 0xc4, 0x63, 0xb8, 0x3c, 0xa6, 0x29, 0x97, 0x16, - 0x81, 0x84, 0xb7, 0x5b, 0xa9, 0x33, 0x94, 0x1e, - 0x83, 0x11, 0x70, 0xb8, 0xc2, 0x70, 0xb1, 0x4d, - 0xa3, 0x2a, 0x8d, 0x1b, 0x7b, 0xa8, 0xbc, 0x68, - 0xab, 0x47, 0x9d, 0x27, 0x87, 0x18, 0x75, 0xae, - 0xc6, 0x7d, 0xbb, 0x4d, 0xaa, 0x1c, 0x84, 0x11, - 0x72, 0xa3, 0xbb, 0x6e, 0xad, 0x3c, 0x97, 0x24, - 0x85, 0x16, 0x71, 0x80, 0xb2, 0x57, 0xa4, 0x30, - 0x8e, 0x1c, 0x7c, 0x10, 0x68, 0xbb, 0xbd, 0x75, - 0xac, 0x4f, 0x9e, 0x2b, 0x87, 0x1a, 0x76, 0x96, - 0xc5, 0x5e, 0xb5, 0x3e, 0xa5, 0x1f, 0x8c, 0x12, - 0x7a, 0xc1, 0xc6, 0x42, 0x9f, 0x27, 0x8c, 0x16, - 0x77, 0x0f, 0x67, 0x9d, 0xbc, 0x68, 0xad, 0x36, - 0x95, 0x20, 0x83, 0x11, 0x6d, 0x9b, 0xb8, 0x67, - 0xa8, 0x34, 0x90, 0x1f, 0x7c, 0x10, 0x67, 0x9e, - 0xc9, 0x6a, 0xbb, 0x37, 0xa4, 0x20, 0x90, 0x11, - 0x7b, 0xc6, 0xc8, 0x47, 0xa4, 0x2a, 0x90, 0x18, - 0x7b, 0x10, 0x6c, 0xae, 0xc4, 0x5d, 0xad, 0x37, - 0x9a, 0x1f, 0x85, 0x13, 0x75, 0x70, 0xad, 0x42, - 0x99, 0x25, 0x84, 0x17, 0x74, 0x0b, 0x56, 0x87, - 0xc8, 0x57, 0xb8, 0x2b, 0x9e, 0x19, 0x8a, 0x0d, - 0x74, 0xa7, 0xc8, 0x6e, 0xb9, 0x36, 0xa0, 0x1f, - 0x8b, 0x11, 0x75, 0x94, 0xbe, 0x4b, 0xa5, 0x2a, - 0x92, 0x18, 0x7c, 0x0f, 0x6b, 0xaf, 0xc0, 0x58, - 0xa8, 0x34, 0x94, 0x1d, 0x7d, 0x12, 0x6d, 0x82, - 0xc0, 0x52, 0xb0, 0x25, 0x94, 0x14, 0x7f, 0x0c, - 0x68, 0x84, 0xbf, 0x3e, 0xa4, 0x22, 0x8e, 0x10, - 0x76, 0x0b, 0x65, 0x88, 0xb6, 0x42, 0x9b, 0x26, - 0x87, 0x14, 0x70, 0x0c, 0x5f, 0xc5, 0xc2, 0x3e, - 0x97, 0x23, 0x83, 0x13, 0x6c, 0x0c, 0x5c, 0xb1, - 0xc9, 0x76, 0xbc, 0x4a, 0xaa, 0x20, 0x8d, 0x12, - 0x78, 0x93, 0xbf, 0x46, 0xa3, 0x26, 0x8d, 0x14, - 0x74, 0x0c, 0x62, 0xc8, 0xc4, 0x3b, 0x97, 0x21, - 0x82, 0x11, 0x6a, 0x0a, 0x59, 0xa3, 0xb9, 0x68, - 0xa9, 0x30, 0x8d, 0x1a, 0x78, 0x0f, 0x61, 0xa0, - 0xc9, 0x73, 0xbe, 0x50, 0xb1, 0x30, 0x9f, 0x14, - 0x80, 0x83, 0xb7, 0x3c, 0x9a, 0x20, 0x84, 0x0e, - 0x6a, 0x0a, 0x57, 0xac, 0xc2, 0x68, 0xb0, 0x2e, - 0x92, 0x19, 0x7c, 0x0d, 0x63, 0x93, 0xbe, 0x62, - 0xb0, 0x3c, 0x9e, 0x1a, 0x80, 0x0e, 0x6b, 0xbb, - 0x02, 0xa0, 0x02, 0xa0, 0x02, 0x6f, 0x00, 0x75, - 0x00, 0x75, 0x00, 0x00, 0x00, 0xad, 0x02, 0xb3, - 0x02, 0x6f, 0x00, 0x87, 0x00, 0x85, 0xfe, 0x03, - 0x00, 0xc2, 0x02, 0x82, 0x4d, 0x92, 0x6e, 0x4d, - 0xb1, 0xa8, 0x84, 0x01, 0x00, 0x07, 0x7e, 0x00, - 0xa8, 0x02, 0xa4, 0x02, 0xa4, 0x02, 0xa2, 0x00, - 0xa6, 0x00, 0xa6, 0x00, 0x00, 0x00, 0xb4, 0x02, - 0xb4, 0x02, 0x92, 0x00, 0x96, 0x00, 0x96, 0x46, - 0x04, 0xb0, 0x02, 0x64, 0x02, 0x0a, 0x8c, 0x00, - 0x90, 0x02, 0x98, 0x02, 0x98, 0x02, 0x0e, 0x01, - 0x11, 0x01, 0x11, 0x50, 0xc3, 0x08, 0x88, 0x02, - 0x88, 0x02, 0x19, 0x01, 0x02, 0x01, 0x02, 0x01, - 0xf3, 0x2d, 0x00, 0x00 -}; - -uint8_t *rb_hardconfig; -long rb_hardconfig_len; - -static inline uint32_t get_u32(const void *buf); - -int routerboot_find_tag(uint8_t *buf, unsigned int buflen, uint16_t tag_id, - uint8_t **tag_data, uint16_t *tag_len); - -static inline int -rb_find_hard_cfg_tag(uint16_t tag_id, uint8_t **tag_data, uint16_t *tag_len); - -const uint8_t * rb_get_board_product_code(void); - -uint32_t rb_get_board_mac(void); - -const uint8_t * rb_get_board_serial(void); - -const uint8_t * rb_get_board_identifier(void); - -const uint8_t * rb_get_board_name(void); - -const uint8_t * rb_get_factory_booter_version(void); - -uint32_t rb_get_flash_info(void); - -uint32_t rb_get_hw_options(void); - -int routerboot_find_magic(uint8_t *buf, unsigned int buflen, uint32_t *offset, bool hard); - -uint8_t * __rb_get_wlan_data(void); - -/* - * Magic numbers - */ -#define RB_ART_SIZE 0x10000 -#define RB_MAGIC_HARD 0x64726148 /* "Hard" */ -#define RB_MAGIC_SOFT 0x74666F53 /* "Soft" */ -#define RB_MAGIC_ERD 0x00455244 /* extended radio data */ -#define RB_MAGIC_LZOR 0x524F5A4C - -#define RB_ID_TERMINATOR 0 - -/* - * ID values for Hardware settings - */ -#define RB_ID_HARD_01 1 -#define RB_ID_HARD_02 2 -#define RB_ID_FLASH_INFO 3 -#define RB_ID_MAC_ADDRESS_PACK 4 -#define RB_ID_BOARD_PRODUCT_CODE 5 -#define RB_ID_BIOS_VERSION 6 -#define RB_ID_HARD_07 7 -#define RB_ID_SDRAM_TIMINGS 8 -#define RB_ID_DEVICE_TIMINGS 9 -#define RB_ID_SOFTWARE_ID 10 -#define RB_ID_SERIAL_NUMBER 11 -#define RB_ID_HARD_12 12 -#define RB_ID_MEMORY_SIZE 13 -#define RB_ID_MAC_ADDRESS_COUNT 14 -#define RB_ID_HW_OPTIONS 21 -#define RB_ID_WLAN_DATA 22 -#define RB_ID_BOARD_IDENTIFIER 23 -#define RB_ID_BOARD_NAME 33 - -#endif /* _RBEXTRACT_H */ From e995577e70cbc2c34a843d133d41ad32aabe072e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sun, 19 Apr 2020 16:04:42 +0200 Subject: [PATCH 18/29] ar71xx/mikrotik: ath10k: use new sysfs driver MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fetch ath10k calibration data from new mikrotik sysfs driver Signed-off-by: Thibaut VARÈNE --- .../base-files/etc/hotplug.d/firmware/11-ath10k-caldata | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index 03eeb2ef9c..c0e8f17d94 100644 --- a/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ar71xx/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -121,7 +121,7 @@ case "$FIRMWARE" in ;; rb-952ui-5ac2nd|\ rb-wapg-5hact2hnd) - ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 0x5000 0x844 + ath10kcal_from_file "/sys/firmware/mikrotik/hard_config/wlan_data" 0x5000 0x844 ;; re355|\ re450|\ @@ -158,7 +158,7 @@ case "$FIRMWARE" in rb-921gs-5hpacd-r2|\ rb-922uags-5hpacd|\ rb-962uigs-5hact2hnt) - ath10kcal_from_file "/sys/firmware/routerboot/ext_wlan_data" 0x5000 0x844 + ath10kcal_from_file "/sys/firmware/mikrotik/hard_config/wlan_data" 0x5000 0x844 ;; wlr8100) ath10kcal_extract "art" 0x5000 0x844 From 8f4735297bbfb24976e06bb4f2f115be29a99404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Mon, 20 Apr 2020 13:48:02 +0200 Subject: [PATCH 19/29] package/base-files: caldata: allow setting target file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This will enable platforms to extract caldata to an arbitrary file, or patch mac in an abitrary file. Signed-off-by: Thibaut VARÈNE --- package/base-files/Makefile | 2 +- .../base-files/files/lib/functions/caldata.sh | 29 ++++++++++++++----- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index 156e7bc8b9..f1f0f17a60 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk PKG_NAME:=base-files -PKG_RELEASE:=218 +PKG_RELEASE:=219 PKG_FLAGS:=nonshared PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ diff --git a/package/base-files/files/lib/functions/caldata.sh b/package/base-files/files/lib/functions/caldata.sh index 3bdb1e4dd5..5e969e3409 100644 --- a/package/base-files/files/lib/functions/caldata.sh +++ b/package/base-files/files/lib/functions/caldata.sh @@ -60,15 +60,21 @@ caldata_from_file() { local source=$1 local offset=$(($2)) local count=$(($3)) + local target=$4 - dd if=$source of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ + [ -n "$target" ] || target=/lib/firmware/$FIRMWARE + + dd if=$source of=$target iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ caldata_die "failed to extract calibration data from $source" } caldata_valid() { local expected="$1" + local target=$2 - magic=$(hexdump -v -n 2 -e '1/1 "%02x"' /lib/firmware/$FIRMWARE) + [ -n "$target" ] || target=/lib/firmware/$FIRMWARE + + magic=$(hexdump -v -n 2 -e '1/1 "%02x"' $target) [ "$magic" = "$expected" ] return $? } @@ -77,6 +83,7 @@ caldata_patch_chksum() { local mac=$1 local mac_offset=$(($2)) local chksum_offset=$(($3)) + local target=$4 local xor_mac local xor_fw_mac local xor_fw_chksum @@ -91,38 +98,44 @@ caldata_patch_chksum() { xor_fw_chksum=$(xor $xor_fw_chksum $xor_fw_mac $xor_mac) printf "%b" "\x${xor_fw_chksum:0:2}\x${xor_fw_chksum:2:2}" | \ - dd of=/lib/firmware/$FIRMWARE conv=notrunc bs=1 seek=$chksum_offset count=2 + dd of=$target conv=notrunc bs=1 seek=$chksum_offset count=2 } caldata_patch_mac() { local mac=$1 local mac_offset=$(($2)) local chksum_offset=$3 + local target=$4 [ -z "$mac" -o -z "$mac_offset" ] && return - [ -n "$chksum_offset" ] && caldata_patch_chksum "$mac" "$mac_offset" "$chksum_offset" + [ -n "$target" ] || target=/lib/firmware/$FIRMWARE - macaddr_2bin $mac | dd of=/lib/firmware/$FIRMWARE conv=notrunc oflag=seek_bytes bs=6 seek=$mac_offset count=1 || \ + [ -n "$chksum_offset" ] && caldata_patch_chksum "$mac" "$mac_offset" "$chksum_offset" "$target" + + macaddr_2bin $mac | dd of=$target conv=notrunc oflag=seek_bytes bs=6 seek=$mac_offset count=1 || \ caldata_die "failed to write MAC address to eeprom file" } ath9k_patch_mac() { local mac=$1 + local target=$2 - caldata_patch_mac "$mac" 0x2 + caldata_patch_mac "$mac" 0x2 "" "$target" } ath9k_patch_mac_crc() { local mac=$1 local mac_offset=$2 local chksum_offset=$((mac_offset - 10)) + local target=$4 - caldata_patch_mac "$mac" "$mac_offset" "$chksum_offset" + caldata_patch_mac "$mac" "$mac_offset" "$chksum_offset" "$target" } ath10k_patch_mac() { local mac=$1 + local target=$2 - caldata_patch_mac "$mac" 0x6 0x2 + caldata_patch_mac "$mac" 0x6 0x2 "$target" } From 02a9d3d6a932cdf707f8bcf4555d095839ce8d24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Mon, 20 Apr 2020 13:48:02 +0200 Subject: [PATCH 20/29] package/base-files: add caldata_sysfsload_from_file() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This routine enables loading caldata binary via the kernel sysfs loader See https://www.kernel.org/doc/html/v4.19/driver-api/firmware/fallback-mechanisms.html Signed-off-by: Thibaut VARÈNE --- package/base-files/Makefile | 2 +- package/base-files/files/lib/functions/caldata.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index f1f0f17a60..d8e7c31878 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk include $(INCLUDE_DIR)/feeds.mk PKG_NAME:=base-files -PKG_RELEASE:=219 +PKG_RELEASE:=220 PKG_FLAGS:=nonshared PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/ diff --git a/package/base-files/files/lib/functions/caldata.sh b/package/base-files/files/lib/functions/caldata.sh index 5e969e3409..6862da7164 100644 --- a/package/base-files/files/lib/functions/caldata.sh +++ b/package/base-files/files/lib/functions/caldata.sh @@ -68,6 +68,21 @@ caldata_from_file() { caldata_die "failed to extract calibration data from $source" } +caldata_sysfsload_from_file() { + local source=$1 + local offset=$(($2)) + local count=$(($3)) + + # test extract to /dev/null first + dd if=$source of=/dev/null iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \ + caldata_die "failed to extract calibration data from $source" + + # can't fail now + echo 1 > /sys/$DEVPATH/loading + dd if=$source of=/sys/$DEVPATH/data iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null + echo 0 > /sys/$DEVPATH/loading +} + caldata_valid() { local expected="$1" local target=$2 From 9242d691ec847e20b68a2dcfca3ae3a7f6674be2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Sun, 19 Apr 2020 17:17:03 +0200 Subject: [PATCH 21/29] ath79/mikrotik: load caldata via sysfs loader MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit takes advantages of base-files 220 which introduces routines to perform caldata loading directly via the kernel sysfs loader helper. This has the benefits of not wasting flash space to store caldata. Memory footprint is reduced to the bare minimum: for devices that don't need MAC patching, the caldata is loaded directly, for devices that do need MAC patching, the caldata is extracted to /tmp, patched and then loaded. Signed-off-by: Thibaut VARÈNE --- .../base-files/etc/hotplug.d/firmware/10-ath9k-eeprom | 6 ++++-- .../base-files/etc/hotplug.d/firmware/11-ath10k-caldata | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom index 884e150bbb..d16190d803 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom @@ -13,8 +13,10 @@ case "$FIRMWARE" in "ath9k-eeprom-ahb-18100000.wmac.bin") case $board in mikrotik,routerboard-wap-g-5hact2hnd) - caldata_from_file $wlan_data 0x1000 0x440 - ath9k_patch_mac $(macaddr_add "$mac_base" +2) + caldata_from_file $wlan_data 0x1000 0x440 /tmp/$FIRMWARE + ath9k_patch_mac $(macaddr_add "$mac_base" +2) /tmp/$FIRMWARE + caldata_sysfsload_from_file /tmp/$FIRMWARE 0x0 0x440 + rm -f /tmp/$FIRMWARE ;; *) caldata_die "board $board is not supported yet" diff --git a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata index b486a5720d..531c21678f 100644 --- a/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata +++ b/target/linux/ath79/mikrotik/base-files/etc/hotplug.d/firmware/11-ath10k-caldata @@ -12,14 +12,14 @@ case "$FIRMWARE" in "ath10k/cal-pci-0000:00:00.0.bin") case $board in mikrotik,routerboard-wap-g-5hact2hnd) - caldata_from_file $wlan_data 0x5000 0x844 + caldata_sysfsload_from_file $wlan_data 0x5000 0x844 ;; esac ;; "ath10k/cal-pci-0000:01:00.0.bin") case $board in mikrotik,routerboard-922uags-5hpacd) - caldata_from_file $wlan_data 0x5000 0x844 + caldata_sysfsload_from_file $wlan_data 0x5000 0x844 ;; esac ;; From 5e50515fa6b3e2ddfd7ffb478b2111dc589dfd4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibaut=20VAR=C3=88NE?= Date: Mon, 20 Apr 2020 14:35:57 +0200 Subject: [PATCH 22/29] ramips/mt7621: mikrotik: don't use mtd-mac-address in DTS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As evidenced here[1] the device MAC address can be stored at a random offset in the hard_config partition. Rely on sysfs to update the MAC address correctly. Adjust config so that WAN is base MAC and LAN is base MAC +1 to better match label and vendor OS. [1] https://github.com/openwrt/openwrt/pull/2850#issuecomment-610809021 Signed-off-by: Thibaut VARÈNE --- .../dts/mt7621_mikrotik_routerboard-750gr3.dts | 12 ------------ .../ramips/dts/mt7621_mikrotik_routerboard-m11g.dts | 5 ----- .../ramips/dts/mt7621_mikrotik_routerboard-m33g.dts | 7 ------- .../ramips/mt7621/base-files/etc/board.d/02_network | 5 ++++- 4 files changed, 4 insertions(+), 25 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts index a075d08556..018e83664d 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-750gr3.dts @@ -126,10 +126,6 @@ }; }; -&gmac0 { - mtd-mac-address = <&hard_config 0x0010>; -}; - &switch0 { ports { port@0 { @@ -140,29 +136,21 @@ port@1 { status = "okay"; label = "lan2"; - mtd-mac-address = <&hard_config 0x0010>; - mtd-mac-address-increment = <1>; }; port@2 { status = "okay"; label = "lan3"; - mtd-mac-address = <&hard_config 0x0010>; - mtd-mac-address-increment = <2>; }; port@3 { status = "okay"; label = "lan4"; - mtd-mac-address = <&hard_config 0x0010>; - mtd-mac-address-increment = <3>; }; port@4 { status = "okay"; label = "lan5"; - mtd-mac-address = <&hard_config 0x0010>; - mtd-mac-address-increment = <4>; }; }; }; diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts index 128b8a2816..d7c4a45798 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m11g.dts @@ -134,11 +134,6 @@ }; }; -&gmac0 { - mtd-mac-address = <&hard_config 0x0010>; - mtd-mac-address-increment = <1>; -}; - &switch0 { ports { port@0 { diff --git a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts index aff2d0e64f..30bb36a77f 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts +++ b/target/linux/ramips/dts/mt7621_mikrotik_routerboard-m33g.dts @@ -158,18 +158,11 @@ }; }; -&gmac0 { - mtd-mac-address = <&hard_config 0x0010>; - mtd-mac-address-increment = <1>; -}; - &switch0 { ports { port@0 { status = "okay"; label = "wan"; - mtd-mac-address = <&hard_config 0x0010>; - mtd-mac-address-increment = <2>; }; port@1 { diff --git a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network index 43db9c6f64..34be067085 100755 --- a/target/linux/ramips/mt7621/base-files/etc/board.d/02_network +++ b/target/linux/ramips/mt7621/base-files/etc/board.d/02_network @@ -91,9 +91,12 @@ ramips_setup_macs() wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr) label_mac=$wan_mac ;; + mikrotik,routerboard-750gr3|\ mikrotik,routerboard-m11g|\ mikrotik,routerboard-m33g) - label_mac=$(mtd_get_mac_binary hard_config 0x10) + label_mac=$(cat "/sys/firmware/mikrotik/hard_config/mac_base") + wan_mac=$label_mac + lan_mac=$(macaddr_add $label_mac 1) ;; zbtlink,zbt-we1326|\ zbtlink,zbt-wg3526-16m|\ From 51a7184a7d06078343bdac5dec69cd5f97de4558 Mon Sep 17 00:00:00 2001 From: Koen Vandeputte Date: Fri, 8 May 2020 16:48:19 +0200 Subject: [PATCH 23/29] generic: fix patching error on kernel 5.4 Fixes a build error seen when applying the kernel patches. Applying patch generic/435-mtd-add-routerbootpart-parser-config.patch patching file drivers/mtd/parsers/Kconfig Hunk #1 FAILED at 160. 1 out of 1 hunk FAILED -- rejects in file drivers/mtd/parsers/Kconfig patching file drivers/mtd/parsers/Makefile Hunk #1 FAILED at 10. 1 out of 1 hunk FAILED -- rejects in file drivers/mtd/parsers/Makefile This was missed as 5.4 is currently set as testing kernel while the main kernel being used is 4.19 Fixes: 2976e423dc6e ("generic: routerboot partition build bits") Signed-off-by: Koen Vandeputte --- ...mtd-add-routerbootpart-parser-config.patch | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch b/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch index 3ab78838b0..4e72aa88a0 100644 --- a/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch +++ b/target/linux/generic/pending-5.4/435-mtd-add-routerbootpart-parser-config.patch @@ -16,23 +16,25 @@ Signed-off-by: Thibaut VARÈNE --- a/drivers/mtd/parsers/Kconfig +++ b/drivers/mtd/parsers/Kconfig -@@ -160,3 +160,12 @@ config MTD_REDBOOT_PARTS_READONLY - 'FIS directory' images, enable this option. +@@ -176,3 +176,12 @@ config MTD_MYLOADER_PARTS - endif # MTD_REDBOOT_PARTS + You will still need the parsing functions to be called by the driver + for your particular device. It won't happen automatically. + +config MTD_ROUTERBOOT_PARTS + tristate "RouterBoot flash partition parser" + depends on MTD && OF + help -+ MikroTik RouterBoot is implemented as a multi segment system on the -+ flash, some of which are fixed and some of which are located at -+ variable offsets. This parser handles both cases via properly -+ formatted DTS. ++ MikroTik RouterBoot is implemented as a multi segment system on the ++ flash, some of which are fixed and some of which are located at ++ variable offsets. This parser handles both cases via properly ++ formatted DTS. --- a/drivers/mtd/parsers/Makefile +++ b/drivers/mtd/parsers/Makefile -@@ -10,3 +10,4 @@ +@@ -9,4 +9,5 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o + obj-$(CONFIG_MTD_PARSER_TRX) += parser_trx.o obj-$(CONFIG_MTD_SHARPSL_PARTS) += sharpslpart.o obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o - obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o +-obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o ++obj-$(CONFIG_MTD_MYLOADER_PARTS) += myloader.o +obj-$(CONFIG_MTD_ROUTERBOOT_PARTS) += routerbootpart.o From 22a21b0c18ebce7b7040ce693621f5c77983f3e5 Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Thu, 7 May 2020 22:13:27 +0900 Subject: [PATCH 24/29] ramips: use hex notation for *-mtd-eeprom property Change "0" to "0x0" for consistency. This is an extension of commit 34abfb6e91d1 ("ramips: convert mediatek,mtd-eeprom from decimal to hex notation"). Signed-off-by: Sungbo Eo --- target/linux/ramips/dts/mt7620a_aigale_ai-br100.dts | 2 +- target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts | 2 +- target/linux/ramips/dts/mt7620a_alfa-network_r36m-e4g.dts | 2 +- target/linux/ramips/dts/mt7620a_asus_rp-n53.dts | 2 +- target/linux/ramips/dts/mt7620a_asus_rt-ac51u.dts | 2 +- target/linux/ramips/dts/mt7620a_bdcom_wap2100-sk.dts | 2 +- target/linux/ramips/dts/mt7620a_buffalo_whr-1166d.dts | 2 +- target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts | 2 +- target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts | 2 +- target/linux/ramips/dts/mt7620a_dlink_dch-m225.dts | 2 +- target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts | 2 +- target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts | 2 +- target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi | 2 +- target/linux/ramips/dts/mt7620a_fon_fon2601.dts | 2 +- target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts | 2 +- target/linux/ramips/dts/mt7620a_glinet_gl-mt300n.dts | 2 +- target/linux/ramips/dts/mt7620a_glinet_gl-mt750.dts | 2 +- target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts | 2 +- target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi | 2 +- target/linux/ramips/dts/mt7620a_hnet_c108.dts | 2 +- target/linux/ramips/dts/mt7620a_kimax_u25awf-h1.dts | 2 +- target/linux/ramips/dts/mt7620a_lenovo_newifi-y1.dtsi | 2 +- target/linux/ramips/dts/mt7620a_linksys_e1700.dts | 2 +- target/linux/ramips/dts/mt7620a_microduino_microwrt.dts | 2 +- target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts | 2 +- target/linux/ramips/dts/mt7620a_phicomm_k2g.dts | 2 +- target/linux/ramips/dts/mt7620a_phicomm_psg1208.dts | 2 +- target/linux/ramips/dts/mt7620a_phicomm_psg1218.dtsi | 2 +- target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts | 2 +- target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts | 2 +- target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts | 2 +- target/linux/ramips/dts/mt7620a_planex_mzk-ex300np.dts | 2 +- target/linux/ramips/dts/mt7620a_planex_mzk-ex750np.dts | 2 +- target/linux/ramips/dts/mt7620a_sanlinking_d240.dts | 2 +- target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts | 2 +- target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts | 2 +- target/linux/ramips/dts/mt7620a_youku_yk1.dts | 2 +- target/linux/ramips/dts/mt7620a_yukai_bocco.dts | 2 +- target/linux/ramips/dts/mt7620a_zbtlink_zbt-ape522ii.dts | 2 +- target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi | 2 +- target/linux/ramips/dts/mt7620a_zte_q7.dts | 2 +- target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts | 2 +- target/linux/ramips/dts/mt7620n_asus_rt-n12p.dts | 2 +- target/linux/ramips/dts/mt7620n_asus_rt-n14u.dts | 2 +- target/linux/ramips/dts/mt7620n_buffalo_wmr-300.dts | 2 +- target/linux/ramips/dts/mt7620n_comfast_cf-wr800n.dts | 2 +- target/linux/ramips/dts/mt7620n_elecom_wrh-300cr.dts | 2 +- target/linux/ramips/dts/mt7620n_kimax_u35wf.dts | 2 +- target/linux/ramips/dts/mt7620n_kingston_mlw221.dts | 2 +- target/linux/ramips/dts/mt7620n_kingston_mlwg2.dts | 2 +- target/linux/ramips/dts/mt7620n_nexx_wt3020.dtsi | 2 +- target/linux/ramips/dts/mt7620n_ravpower_wd03.dts | 2 +- target/linux/ramips/dts/mt7620n_vonets_var11n-300.dts | 2 +- target/linux/ramips/dts/mt7620n_wrtnode_wrtnode.dts | 2 +- target/linux/ramips/dts/mt7620n_zbtlink_zbt-cpe102.dts | 2 +- target/linux/ramips/dts/mt7620n_zbtlink_zbt-wa05.dts | 2 +- target/linux/ramips/dts/mt7620n_zbtlink_zbt-we2026.dts | 2 +- target/linux/ramips/dts/mt7620n_zbtlink_zbt-wr8305rt.dts | 2 +- target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni-ii.dts | 2 +- target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni.dts | 2 +- target/linux/ramips/dts/mt7621_dlink_dir-860l-b1.dts | 2 +- target/linux/ramips/dts/mt7621_tplink_re350-v1.dts | 2 +- target/linux/ramips/dts/mt7621_tplink_re650-v1.dts | 2 +- target/linux/ramips/dts/rt2880_airlink101_ar725w.dts | 2 +- target/linux/ramips/dts/rt2880_asus_rt-n15.dts | 2 +- target/linux/ramips/dts/rt2880_buffalo_wli-tx4-ag300n.dts | 2 +- target/linux/ramips/dts/rt2880_buffalo_wzr-agl300nh.dts | 2 +- target/linux/ramips/dts/rt2880_ralink_v11st-fe.dts | 2 +- target/linux/ramips/dts/rt3050_8devices_carambola.dts | 2 +- target/linux/ramips/dts/rt3050_allnet_all0256n.dtsi | 2 +- target/linux/ramips/dts/rt3050_arcwireless_freestation5.dts | 2 +- target/linux/ramips/dts/rt3050_asus_rt-g32-b1.dts | 2 +- target/linux/ramips/dts/rt3050_asus_rt-n10-plus.dts | 2 +- target/linux/ramips/dts/rt3050_asus_wl-330n.dts | 2 +- target/linux/ramips/dts/rt3050_asus_wl-330n3g.dts | 2 +- target/linux/ramips/dts/rt3050_dlink_dcs-930.dts | 2 +- target/linux/ramips/dts/rt3050_dlink_dir-620-a1.dts | 2 +- target/linux/ramips/dts/rt3050_edimax_3g-6200n.dts | 2 +- target/linux/ramips/dts/rt3050_edimax_3g-6200nl.dts | 2 +- target/linux/ramips/dts/rt3050_huawei_d105.dts | 2 +- target/linux/ramips/dts/rt3050_jcg_jhr-n805r.dts | 2 +- target/linux/ramips/dts/rt3050_netcore_nw718.dts | 2 +- target/linux/ramips/dts/rt3050_sparklan_wcr-150gn.dts | 2 +- target/linux/ramips/dts/rt3050_teltonika_rut5xx.dts | 2 +- target/linux/ramips/dts/rt3050_tenda_w150m.dts | 2 +- target/linux/ramips/dts/rt3050_trendnet_tew-638apb-v2.dts | 2 +- target/linux/ramips/dts/rt3052_accton_wr6202.dts | 2 +- target/linux/ramips/dts/rt3052_alfa-network_w502u.dts | 2 +- target/linux/ramips/dts/rt3052_argus_atp-52b.dts | 2 +- target/linux/ramips/dts/rt3052_asiarf_awapn2403.dts | 2 +- target/linux/ramips/dts/rt3052_asus_rt-n13u.dts | 2 +- target/linux/ramips/dts/rt3052_aximcom_mr-102n.dts | 2 +- target/linux/ramips/dts/rt3052_aztech_hw550-3g.dts | 2 +- target/linux/ramips/dts/rt3052_buffalo_whr-g300n.dts | 2 +- target/linux/ramips/dts/rt3052_dlink_dap-1350.dts | 2 +- target/linux/ramips/dts/rt3052_engenius_esr-9753.dts | 2 +- target/linux/ramips/dts/rt3052_fon_fonera-20n.dts | 2 +- target/linux/ramips/dts/rt3052_hauppauge_broadway.dts | 2 +- target/linux/ramips/dts/rt3052_huawei_hg255d.dts | 2 +- target/linux/ramips/dts/rt3052_jcg_jhr-n825r.dts | 2 +- target/linux/ramips/dts/rt3052_jcg_jhr-n926r.dts | 2 +- target/linux/ramips/dts/rt3052_mofinetwork_mofi3500-3gn.dts | 2 +- target/linux/ramips/dts/rt3052_netgear_wnce2001.dts | 2 +- target/linux/ramips/dts/rt3052_nexaira_bc2.dts | 2 +- target/linux/ramips/dts/rt3052_omnima_miniembwifi.dts | 2 +- target/linux/ramips/dts/rt3052_petatel_psr-680w.dts | 2 +- target/linux/ramips/dts/rt3052_planex_mzk-w300nh2.dts | 2 +- target/linux/ramips/dts/rt3052_planex_mzk-wdpr.dts | 2 +- target/linux/ramips/dts/rt3052_prolink_pwh2004.dts | 2 +- target/linux/ramips/dts/rt3052_ralink_v22rw-2x2.dts | 2 +- target/linux/ramips/dts/rt3052_sitecom_wl-351.dts | 2 +- target/linux/ramips/dts/rt3052_skyline_sl-r7205.dts | 2 +- target/linux/ramips/dts/rt3052_tenda_3g300m.dts | 2 +- target/linux/ramips/dts/rt3052_tenda_w306r-v2.dts | 2 +- target/linux/ramips/dts/rt3052_unbranded_wr512-3gn.dtsi | 2 +- target/linux/ramips/dts/rt3052_unbranded_xdx-rn502j.dts | 2 +- target/linux/ramips/dts/rt3052_upvel_ur-326n4g.dts | 2 +- target/linux/ramips/dts/rt3052_upvel_ur-336un.dts | 2 +- target/linux/ramips/dts/rt3052_zyxel_keenetic.dts | 2 +- target/linux/ramips/dts/rt3052_zyxel_nbg-419n.dts | 2 +- target/linux/ramips/dts/rt3352_allnet_all5002.dts | 2 +- target/linux/ramips/dts/rt3352_dlink_dir-615-h1.dts | 2 +- target/linux/ramips/dts/rt3352_dlink_dir-620-d1.dts | 2 +- target/linux/ramips/dts/rt3352_zyxel_nbg-419n-v2.dts | 2 +- target/linux/ramips/dts/rt3662_asus_rt-n56u.dts | 2 +- target/linux/ramips/dts/rt3662_dlink_dir-645.dts | 2 +- target/linux/ramips/dts/rt3662_edimax_br-6475nd.dts | 2 +- target/linux/ramips/dts/rt3662_omnima_hpm.dts | 2 +- target/linux/ramips/dts/rt3662_samsung_cy-swr1100.dts | 2 +- target/linux/ramips/dts/rt3883_belkin_f9k110x.dtsi | 2 +- target/linux/ramips/dts/rt5350_7links_px-4885.dtsi | 2 +- target/linux/ramips/dts/rt5350_airlive_air3gii.dts | 2 +- target/linux/ramips/dts/rt5350_allnet_all5003.dts | 2 +- target/linux/ramips/dts/rt5350_asiarf_awm002-evb.dtsi | 2 +- target/linux/ramips/dts/rt5350_belkin_f7c027.dts | 2 +- target/linux/ramips/dts/rt5350_dlink_dcs-930l-b1.dts | 2 +- target/linux/ramips/dts/rt5350_dlink_dir-300-b7.dts | 2 +- target/linux/ramips/dts/rt5350_dlink_dir-320-b1.dts | 2 +- target/linux/ramips/dts/rt5350_easyacc_wizard-8800.dts | 2 +- target/linux/ramips/dts/rt5350_hame_mpr-a1.dts | 2 +- target/linux/ramips/dts/rt5350_hame_mpr-a2.dts | 2 +- target/linux/ramips/dts/rt5350_hilink_hlk-rm04.dts | 2 +- target/linux/ramips/dts/rt5350_hootoo_ht-tm02.dts | 2 +- target/linux/ramips/dts/rt5350_nexx_wt1520.dtsi | 2 +- target/linux/ramips/dts/rt5350_nixcore_x1.dtsi | 2 +- target/linux/ramips/dts/rt5350_olimex_rt5350f-olinuxino.dtsi | 2 +- target/linux/ramips/dts/rt5350_omnima_miniembplug.dts | 2 +- target/linux/ramips/dts/rt5350_planex_mzk-dp150n.dts | 2 +- target/linux/ramips/dts/rt5350_poray_m3.dts | 2 +- target/linux/ramips/dts/rt5350_poray_m4.dtsi | 2 +- target/linux/ramips/dts/rt5350_poray_x5.dts | 2 +- target/linux/ramips/dts/rt5350_poray_x8.dts | 2 +- target/linux/ramips/dts/rt5350_tenda_3g150b.dts | 2 +- target/linux/ramips/dts/rt5350_trendnet_tew-714tru.dts | 2 +- target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts | 2 +- target/linux/ramips/dts/rt5350_vocore_vocore.dtsi | 2 +- target/linux/ramips/dts/rt5350_wansview_ncs601w.dts | 2 +- target/linux/ramips/dts/rt5350_wiznet_wizfi630a.dts | 2 +- target/linux/ramips/dts/rt5350_zorlik_zl5900v2.dts | 2 +- target/linux/ramips/dts/rt5350_zyxel_keenetic-start.dts | 2 +- 160 files changed, 160 insertions(+), 160 deletions(-) diff --git a/target/linux/ramips/dts/mt7620a_aigale_ai-br100.dts b/target/linux/ramips/dts/mt7620a_aigale_ai-br100.dts index 3a84a30c61..3cd6144508 100644 --- a/target/linux/ramips/dts/mt7620a_aigale_ai-br100.dts +++ b/target/linux/ramips/dts/mt7620a_aigale_ai-br100.dts @@ -110,5 +110,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts b/target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts index 47a8e5a180..f70450eb19 100644 --- a/target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts +++ b/target/linux/ramips/dts/mt7620a_alfa-network_ac1200rm.dts @@ -176,5 +176,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_alfa-network_r36m-e4g.dts b/target/linux/ramips/dts/mt7620a_alfa-network_r36m-e4g.dts index b0ac4a37d4..9bbf266d77 100644 --- a/target/linux/ramips/dts/mt7620a_alfa-network_r36m-e4g.dts +++ b/target/linux/ramips/dts/mt7620a_alfa-network_r36m-e4g.dts @@ -212,5 +212,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_asus_rp-n53.dts b/target/linux/ramips/dts/mt7620a_asus_rp-n53.dts index c32c3f017d..46017c8ccf 100644 --- a/target/linux/ramips/dts/mt7620a_asus_rp-n53.dts +++ b/target/linux/ramips/dts/mt7620a_asus_rp-n53.dts @@ -145,7 +145,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620a_asus_rt-ac51u.dts b/target/linux/ramips/dts/mt7620a_asus_rt-ac51u.dts index a8c6a87577..a86defe3d3 100644 --- a/target/linux/ramips/dts/mt7620a_asus_rt-ac51u.dts +++ b/target/linux/ramips/dts/mt7620a_asus_rt-ac51u.dts @@ -122,7 +122,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620a_bdcom_wap2100-sk.dts b/target/linux/ramips/dts/mt7620a_bdcom_wap2100-sk.dts index 64aafd0a52..878c720c39 100644 --- a/target/linux/ramips/dts/mt7620a_bdcom_wap2100-sk.dts +++ b/target/linux/ramips/dts/mt7620a_bdcom_wap2100-sk.dts @@ -127,7 +127,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &pcie { diff --git a/target/linux/ramips/dts/mt7620a_buffalo_whr-1166d.dts b/target/linux/ramips/dts/mt7620a_buffalo_whr-1166d.dts index 86420bf674..37417aff40 100644 --- a/target/linux/ramips/dts/mt7620a_buffalo_whr-1166d.dts +++ b/target/linux/ramips/dts/mt7620a_buffalo_whr-1166d.dts @@ -164,7 +164,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &pcie { diff --git a/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts b/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts index 60d6d62a4e..459043ac38 100644 --- a/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts +++ b/target/linux/ramips/dts/mt7620a_buffalo_whr-300hp2.dts @@ -149,7 +149,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; pinctrl-names = "default"; pinctrl-0 = <&pa_pins>; }; diff --git a/target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts b/target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts index 2cf26c7ddc..e2db22d760 100644 --- a/target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts +++ b/target/linux/ramips/dts/mt7620a_buffalo_whr-600d.dts @@ -149,7 +149,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &pcie { diff --git a/target/linux/ramips/dts/mt7620a_dlink_dch-m225.dts b/target/linux/ramips/dts/mt7620a_dlink_dch-m225.dts index 59d7b34331..d17802407a 100644 --- a/target/linux/ramips/dts/mt7620a_dlink_dch-m225.dts +++ b/target/linux/ramips/dts/mt7620a_dlink_dch-m225.dts @@ -182,7 +182,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; pinctrl-names = "default"; pinctrl-0 = <&pa_pins>; }; diff --git a/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts b/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts index c3267bb3c0..96cfce272d 100644 --- a/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts +++ b/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts @@ -190,7 +190,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &pcie { diff --git a/target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts b/target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts index 97a89b896c..d50a770968 100644 --- a/target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts +++ b/target/linux/ramips/dts/mt7620a_edimax_ew-7478apc.dts @@ -175,7 +175,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &pcie { diff --git a/target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi b/target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi index 14ac27f2ae..11cf9bb291 100644 --- a/target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi +++ b/target/linux/ramips/dts/mt7620a_edimax_ew-747x.dtsi @@ -173,7 +173,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &pcie { diff --git a/target/linux/ramips/dts/mt7620a_fon_fon2601.dts b/target/linux/ramips/dts/mt7620a_fon_fon2601.dts index 019274a0d3..0e845f3c4c 100644 --- a/target/linux/ramips/dts/mt7620a_fon_fon2601.dts +++ b/target/linux/ramips/dts/mt7620a_fon_fon2601.dts @@ -140,7 +140,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; pinctrl-names = "default"; pinctrl-0 = <&pa_pins>, <&wled_pins>; }; diff --git a/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts b/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts index 9a9d9f45ae..0af9b22d48 100644 --- a/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts +++ b/target/linux/ramips/dts/mt7620a_glinet_gl-mt300a.dts @@ -142,7 +142,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620a_glinet_gl-mt300n.dts b/target/linux/ramips/dts/mt7620a_glinet_gl-mt300n.dts index 5291b5fcca..7a83e584f2 100644 --- a/target/linux/ramips/dts/mt7620a_glinet_gl-mt300n.dts +++ b/target/linux/ramips/dts/mt7620a_glinet_gl-mt300n.dts @@ -133,7 +133,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620a_glinet_gl-mt750.dts b/target/linux/ramips/dts/mt7620a_glinet_gl-mt750.dts index 9df5f464c7..27a3db83e1 100644 --- a/target/linux/ramips/dts/mt7620a_glinet_gl-mt750.dts +++ b/target/linux/ramips/dts/mt7620a_glinet_gl-mt750.dts @@ -137,7 +137,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &pcie { diff --git a/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts b/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts index fbee809893..abc13ee7d0 100644 --- a/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts +++ b/target/linux/ramips/dts/mt7620a_head-weblink_hdrm200.dts @@ -156,7 +156,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi b/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi index 82bc8c9957..2d69199a13 100644 --- a/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi +++ b/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi @@ -120,7 +120,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; pinctrl-names = "default"; pinctrl-0 = <&pa_pins>; }; diff --git a/target/linux/ramips/dts/mt7620a_hnet_c108.dts b/target/linux/ramips/dts/mt7620a_hnet_c108.dts index 15b2a12af7..26ea17b0f4 100644 --- a/target/linux/ramips/dts/mt7620a_hnet_c108.dts +++ b/target/linux/ramips/dts/mt7620a_hnet_c108.dts @@ -169,7 +169,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620a_kimax_u25awf-h1.dts b/target/linux/ramips/dts/mt7620a_kimax_u25awf-h1.dts index ce73886ade..4d070798e5 100644 --- a/target/linux/ramips/dts/mt7620a_kimax_u25awf-h1.dts +++ b/target/linux/ramips/dts/mt7620a_kimax_u25awf-h1.dts @@ -102,7 +102,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1.dtsi b/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1.dtsi index bf83400957..70d52d7554 100644 --- a/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1.dtsi +++ b/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1.dtsi @@ -94,7 +94,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; pinctrl-names = "default"; pinctrl-0 = <&pa_pins>; }; diff --git a/target/linux/ramips/dts/mt7620a_linksys_e1700.dts b/target/linux/ramips/dts/mt7620a_linksys_e1700.dts index 6efe9d2b06..c15d868a8c 100644 --- a/target/linux/ramips/dts/mt7620a_linksys_e1700.dts +++ b/target/linux/ramips/dts/mt7620a_linksys_e1700.dts @@ -156,5 +156,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_microduino_microwrt.dts b/target/linux/ramips/dts/mt7620a_microduino_microwrt.dts index 23d08ad3e4..b87b8a9a08 100644 --- a/target/linux/ramips/dts/mt7620a_microduino_microwrt.dts +++ b/target/linux/ramips/dts/mt7620a_microduino_microwrt.dts @@ -94,7 +94,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts b/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts index b8f86fad50..c1a0655016 100644 --- a/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts +++ b/target/linux/ramips/dts/mt7620a_ohyeah_oy-0001.dts @@ -112,7 +112,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &sdhci { diff --git a/target/linux/ramips/dts/mt7620a_phicomm_k2g.dts b/target/linux/ramips/dts/mt7620a_phicomm_k2g.dts index 63dde14975..30369a322c 100644 --- a/target/linux/ramips/dts/mt7620a_phicomm_k2g.dts +++ b/target/linux/ramips/dts/mt7620a_phicomm_k2g.dts @@ -135,7 +135,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; pinctrl-names = "default"; pinctrl-0 = <&pa_pins>; }; diff --git a/target/linux/ramips/dts/mt7620a_phicomm_psg1208.dts b/target/linux/ramips/dts/mt7620a_phicomm_psg1208.dts index 34dfc9976d..78a3eec743 100644 --- a/target/linux/ramips/dts/mt7620a_phicomm_psg1208.dts +++ b/target/linux/ramips/dts/mt7620a_phicomm_psg1208.dts @@ -116,5 +116,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_phicomm_psg1218.dtsi b/target/linux/ramips/dts/mt7620a_phicomm_psg1218.dtsi index 87e44f0b61..69faf0075c 100644 --- a/target/linux/ramips/dts/mt7620a_phicomm_psg1218.dtsi +++ b/target/linux/ramips/dts/mt7620a_phicomm_psg1218.dtsi @@ -74,5 +74,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts b/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts index 3998ea6019..e4f8444b56 100644 --- a/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts +++ b/target/linux/ramips/dts/mt7620a_planex_cs-qr10.dts @@ -151,5 +151,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts b/target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts index e9c2e295e4..7390a1cc80 100644 --- a/target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts +++ b/target/linux/ramips/dts/mt7620a_planex_db-wrt01.dts @@ -99,5 +99,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts b/target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts index 28473a52c6..7d26679d3b 100644 --- a/target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts +++ b/target/linux/ramips/dts/mt7620a_planex_mzk-750dhp.dts @@ -119,7 +119,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &pcie { diff --git a/target/linux/ramips/dts/mt7620a_planex_mzk-ex300np.dts b/target/linux/ramips/dts/mt7620a_planex_mzk-ex300np.dts index 116d5874e1..e221fdac31 100644 --- a/target/linux/ramips/dts/mt7620a_planex_mzk-ex300np.dts +++ b/target/linux/ramips/dts/mt7620a_planex_mzk-ex300np.dts @@ -135,5 +135,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_planex_mzk-ex750np.dts b/target/linux/ramips/dts/mt7620a_planex_mzk-ex750np.dts index e25b969701..148293af15 100644 --- a/target/linux/ramips/dts/mt7620a_planex_mzk-ex750np.dts +++ b/target/linux/ramips/dts/mt7620a_planex_mzk-ex750np.dts @@ -140,7 +140,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &pcie { diff --git a/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts b/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts index 2bbd68cf7a..22c4a6bb4f 100644 --- a/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts +++ b/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts @@ -174,7 +174,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts b/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts index d8146218c9..28180c5d1b 100644 --- a/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts +++ b/target/linux/ramips/dts/mt7620a_tplink_archer-c2-v1.dts @@ -165,7 +165,7 @@ }; &wmac { - ralink,mtd-eeprom = <&radio 0>; + ralink,mtd-eeprom = <&radio 0x0>; mtd-mac-address = <&rom 0xf100>; }; diff --git a/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts b/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts index 1442151063..d0c3bd0cf9 100644 --- a/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts +++ b/target/linux/ramips/dts/mt7620a_xiaomi_miwifi-mini.dts @@ -135,7 +135,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; pinctrl-names = "default"; pinctrl-0 = <&pa_pins>; }; diff --git a/target/linux/ramips/dts/mt7620a_youku_yk1.dts b/target/linux/ramips/dts/mt7620a_youku_yk1.dts index a95f1e9320..ea1f9363c6 100644 --- a/target/linux/ramips/dts/mt7620a_youku_yk1.dts +++ b/target/linux/ramips/dts/mt7620a_youku_yk1.dts @@ -124,7 +124,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &sdhci { diff --git a/target/linux/ramips/dts/mt7620a_yukai_bocco.dts b/target/linux/ramips/dts/mt7620a_yukai_bocco.dts index 389fa1b62f..62b385bb33 100644 --- a/target/linux/ramips/dts/mt7620a_yukai_bocco.dts +++ b/target/linux/ramips/dts/mt7620a_yukai_bocco.dts @@ -158,5 +158,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-ape522ii.dts b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-ape522ii.dts index c2c6b8b4bb..a0ef5824d2 100644 --- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-ape522ii.dts +++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-ape522ii.dts @@ -116,7 +116,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; pinctrl-names = "default"; pinctrl-0 = <&pa_pins>; }; diff --git a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi index a2051efaad..6cb67d40de 100644 --- a/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi +++ b/target/linux/ramips/dts/mt7620a_zbtlink_zbt-we826.dtsi @@ -79,7 +79,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620a_zte_q7.dts b/target/linux/ramips/dts/mt7620a_zte_q7.dts index 182b7db905..283e0f7232 100644 --- a/target/linux/ramips/dts/mt7620a_zte_q7.dts +++ b/target/linux/ramips/dts/mt7620a_zte_q7.dts @@ -102,7 +102,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &sdhci { diff --git a/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts b/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts index 58c96cd197..d656c27721 100644 --- a/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts +++ b/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts @@ -163,7 +163,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/mt7620n_asus_rt-n12p.dts b/target/linux/ramips/dts/mt7620n_asus_rt-n12p.dts index 04afb68061..5870a20aa3 100644 --- a/target/linux/ramips/dts/mt7620n_asus_rt-n12p.dts +++ b/target/linux/ramips/dts/mt7620n_asus_rt-n12p.dts @@ -113,7 +113,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_asus_rt-n14u.dts b/target/linux/ramips/dts/mt7620n_asus_rt-n14u.dts index 2ae2182862..87d0f5c4a2 100644 --- a/target/linux/ramips/dts/mt7620n_asus_rt-n14u.dts +++ b/target/linux/ramips/dts/mt7620n_asus_rt-n14u.dts @@ -126,7 +126,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_buffalo_wmr-300.dts b/target/linux/ramips/dts/mt7620n_buffalo_wmr-300.dts index df5761664c..122655350a 100644 --- a/target/linux/ramips/dts/mt7620n_buffalo_wmr-300.dts +++ b/target/linux/ramips/dts/mt7620n_buffalo_wmr-300.dts @@ -102,7 +102,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_comfast_cf-wr800n.dts b/target/linux/ramips/dts/mt7620n_comfast_cf-wr800n.dts index a2285ea707..df5b464dfd 100644 --- a/target/linux/ramips/dts/mt7620n_comfast_cf-wr800n.dts +++ b/target/linux/ramips/dts/mt7620n_comfast_cf-wr800n.dts @@ -111,7 +111,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_elecom_wrh-300cr.dts b/target/linux/ramips/dts/mt7620n_elecom_wrh-300cr.dts index 1d44049548..2d9a69d6e4 100644 --- a/target/linux/ramips/dts/mt7620n_elecom_wrh-300cr.dts +++ b/target/linux/ramips/dts/mt7620n_elecom_wrh-300cr.dts @@ -123,7 +123,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_kimax_u35wf.dts b/target/linux/ramips/dts/mt7620n_kimax_u35wf.dts index 337abbb68e..f4b1d140fb 100644 --- a/target/linux/ramips/dts/mt7620n_kimax_u35wf.dts +++ b/target/linux/ramips/dts/mt7620n_kimax_u35wf.dts @@ -102,7 +102,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_kingston_mlw221.dts b/target/linux/ramips/dts/mt7620n_kingston_mlw221.dts index 2d7e39f912..473bfa37d7 100644 --- a/target/linux/ramips/dts/mt7620n_kingston_mlw221.dts +++ b/target/linux/ramips/dts/mt7620n_kingston_mlw221.dts @@ -118,7 +118,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_kingston_mlwg2.dts b/target/linux/ramips/dts/mt7620n_kingston_mlwg2.dts index 2385ca92f8..31963ecf29 100644 --- a/target/linux/ramips/dts/mt7620n_kingston_mlwg2.dts +++ b/target/linux/ramips/dts/mt7620n_kingston_mlwg2.dts @@ -118,7 +118,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_nexx_wt3020.dtsi b/target/linux/ramips/dts/mt7620n_nexx_wt3020.dtsi index a8d0a00441..09df87966e 100644 --- a/target/linux/ramips/dts/mt7620n_nexx_wt3020.dtsi +++ b/target/linux/ramips/dts/mt7620n_nexx_wt3020.dtsi @@ -48,7 +48,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_ravpower_wd03.dts b/target/linux/ramips/dts/mt7620n_ravpower_wd03.dts index 381975d26f..413a7b6bda 100644 --- a/target/linux/ramips/dts/mt7620n_ravpower_wd03.dts +++ b/target/linux/ramips/dts/mt7620n_ravpower_wd03.dts @@ -104,7 +104,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_vonets_var11n-300.dts b/target/linux/ramips/dts/mt7620n_vonets_var11n-300.dts index cc817f78ef..ebd997e3a0 100644 --- a/target/linux/ramips/dts/mt7620n_vonets_var11n-300.dts +++ b/target/linux/ramips/dts/mt7620n_vonets_var11n-300.dts @@ -86,7 +86,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_wrtnode_wrtnode.dts b/target/linux/ramips/dts/mt7620n_wrtnode_wrtnode.dts index 8877f0f95f..d2468f75f5 100644 --- a/target/linux/ramips/dts/mt7620n_wrtnode_wrtnode.dts +++ b/target/linux/ramips/dts/mt7620n_wrtnode_wrtnode.dts @@ -91,7 +91,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-cpe102.dts b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-cpe102.dts index b2a3b0d61d..84a1de96f3 100644 --- a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-cpe102.dts +++ b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-cpe102.dts @@ -114,7 +114,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wa05.dts b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wa05.dts index f441e0fcb5..08139645dc 100644 --- a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wa05.dts +++ b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wa05.dts @@ -118,7 +118,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-we2026.dts b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-we2026.dts index cc3e82ab4b..779d555e50 100644 --- a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-we2026.dts +++ b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-we2026.dts @@ -99,7 +99,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wr8305rt.dts b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wr8305rt.dts index c95c951d21..78269ca784 100644 --- a/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wr8305rt.dts +++ b/target/linux/ramips/dts/mt7620n_zbtlink_zbt-wr8305rt.dts @@ -112,7 +112,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni-ii.dts b/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni-ii.dts index c8fcef1b3d..a6333340b2 100644 --- a/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni-ii.dts +++ b/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni-ii.dts @@ -137,7 +137,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni.dts b/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni.dts index 34f3e7d371..307326fa6b 100644 --- a/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni.dts +++ b/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni.dts @@ -137,7 +137,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/mt7621_dlink_dir-860l-b1.dts b/target/linux/ramips/dts/mt7621_dlink_dir-860l-b1.dts index 7a3afa00dd..36d951759f 100644 --- a/target/linux/ramips/dts/mt7621_dlink_dir-860l-b1.dts +++ b/target/linux/ramips/dts/mt7621_dlink_dir-860l-b1.dts @@ -162,7 +162,7 @@ &pcie1 { wifi1: mt76@0,0 { reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&radio 0>; + mediatek,mtd-eeprom = <&radio 0x0>; ieee80211-freq-limit = <2400000 2500000>; }; }; diff --git a/target/linux/ramips/dts/mt7621_tplink_re350-v1.dts b/target/linux/ramips/dts/mt7621_tplink_re350-v1.dts index d04d87dd37..b46787b42e 100644 --- a/target/linux/ramips/dts/mt7621_tplink_re350-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_re350-v1.dts @@ -135,7 +135,7 @@ &pcie0 { mt76@0,0 { reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&radio 0>; + mediatek,mtd-eeprom = <&radio 0x0>; mtd-mac-address = <&config 0x10008>; mtd-mac-address-increment = <1>; }; diff --git a/target/linux/ramips/dts/mt7621_tplink_re650-v1.dts b/target/linux/ramips/dts/mt7621_tplink_re650-v1.dts index a26ad98cc2..05a3fd5b75 100644 --- a/target/linux/ramips/dts/mt7621_tplink_re650-v1.dts +++ b/target/linux/ramips/dts/mt7621_tplink_re650-v1.dts @@ -146,7 +146,7 @@ wifi@0,0 { compatible = "mediatek,mt76"; reg = <0x0000 0 0 0 0>; - mediatek,mtd-eeprom = <&radio 0>; + mediatek,mtd-eeprom = <&radio 0x0>; mtd-mac-address = <&config 0x10008>; mtd-mac-address-increment = <1>; ieee80211-freq-limit = <2400000 2500000>; diff --git a/target/linux/ramips/dts/rt2880_airlink101_ar725w.dts b/target/linux/ramips/dts/rt2880_airlink101_ar725w.dts index 5890f9958a..f61f690a6e 100644 --- a/target/linux/ramips/dts/rt2880_airlink101_ar725w.dts +++ b/target/linux/ramips/dts/rt2880_airlink101_ar725w.dts @@ -120,5 +120,5 @@ &wmac { status = "okay"; - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt2880_asus_rt-n15.dts b/target/linux/ramips/dts/rt2880_asus_rt-n15.dts index 9bd080ea44..329c51259c 100644 --- a/target/linux/ramips/dts/rt2880_asus_rt-n15.dts +++ b/target/linux/ramips/dts/rt2880_asus_rt-n15.dts @@ -118,5 +118,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt2880_buffalo_wli-tx4-ag300n.dts b/target/linux/ramips/dts/rt2880_buffalo_wli-tx4-ag300n.dts index dcd30eb60f..d8876de06a 100644 --- a/target/linux/ramips/dts/rt2880_buffalo_wli-tx4-ag300n.dts +++ b/target/linux/ramips/dts/rt2880_buffalo_wli-tx4-ag300n.dts @@ -121,5 +121,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt2880_buffalo_wzr-agl300nh.dts b/target/linux/ramips/dts/rt2880_buffalo_wzr-agl300nh.dts index 9a8e052e12..85e0550ffc 100644 --- a/target/linux/ramips/dts/rt2880_buffalo_wzr-agl300nh.dts +++ b/target/linux/ramips/dts/rt2880_buffalo_wzr-agl300nh.dts @@ -143,5 +143,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt2880_ralink_v11st-fe.dts b/target/linux/ramips/dts/rt2880_ralink_v11st-fe.dts index 5007f271bb..004a9c44cb 100644 --- a/target/linux/ramips/dts/rt2880_ralink_v11st-fe.dts +++ b/target/linux/ramips/dts/rt2880_ralink_v11st-fe.dts @@ -86,5 +86,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3050_8devices_carambola.dts b/target/linux/ramips/dts/rt3050_8devices_carambola.dts index 69eea2c7b7..e0eb2a7b28 100644 --- a/target/linux/ramips/dts/rt3050_8devices_carambola.dts +++ b/target/linux/ramips/dts/rt3050_8devices_carambola.dts @@ -73,7 +73,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3050_allnet_all0256n.dtsi b/target/linux/ramips/dts/rt3050_allnet_all0256n.dtsi index 0f07e25685..40018e5e3f 100644 --- a/target/linux/ramips/dts/rt3050_allnet_all0256n.dtsi +++ b/target/linux/ramips/dts/rt3050_allnet_all0256n.dtsi @@ -57,5 +57,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3050_arcwireless_freestation5.dts b/target/linux/ramips/dts/rt3050_arcwireless_freestation5.dts index 9909fab0ae..1b27f78dfb 100644 --- a/target/linux/ramips/dts/rt3050_arcwireless_freestation5.dts +++ b/target/linux/ramips/dts/rt3050_arcwireless_freestation5.dts @@ -104,7 +104,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3050_asus_rt-g32-b1.dts b/target/linux/ramips/dts/rt3050_asus_rt-g32-b1.dts index 3603f163b8..3abe7c7e0e 100644 --- a/target/linux/ramips/dts/rt3050_asus_rt-g32-b1.dts +++ b/target/linux/ramips/dts/rt3050_asus_rt-g32-b1.dts @@ -83,5 +83,5 @@ }; &wmac { - ralink,mtd-eeprom = <&devconf 0>; + ralink,mtd-eeprom = <&devconf 0x0>; }; diff --git a/target/linux/ramips/dts/rt3050_asus_rt-n10-plus.dts b/target/linux/ramips/dts/rt3050_asus_rt-n10-plus.dts index 3b77a4ce3c..dc3d2c65e7 100644 --- a/target/linux/ramips/dts/rt3050_asus_rt-n10-plus.dts +++ b/target/linux/ramips/dts/rt3050_asus_rt-n10-plus.dts @@ -89,5 +89,5 @@ }; &wmac { - ralink,mtd-eeprom = <&devconf 0>; + ralink,mtd-eeprom = <&devconf 0x0>; }; diff --git a/target/linux/ramips/dts/rt3050_asus_wl-330n.dts b/target/linux/ramips/dts/rt3050_asus_wl-330n.dts index 36d80086dc..96e2039ba6 100644 --- a/target/linux/ramips/dts/rt3050_asus_wl-330n.dts +++ b/target/linux/ramips/dts/rt3050_asus_wl-330n.dts @@ -104,5 +104,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3050_asus_wl-330n3g.dts b/target/linux/ramips/dts/rt3050_asus_wl-330n3g.dts index 76de3063c4..f264446741 100644 --- a/target/linux/ramips/dts/rt3050_asus_wl-330n3g.dts +++ b/target/linux/ramips/dts/rt3050_asus_wl-330n3g.dts @@ -109,7 +109,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3050_dlink_dcs-930.dts b/target/linux/ramips/dts/rt3050_dlink_dcs-930.dts index bfcdab6e08..c6cc30bf91 100644 --- a/target/linux/ramips/dts/rt3050_dlink_dcs-930.dts +++ b/target/linux/ramips/dts/rt3050_dlink_dcs-930.dts @@ -106,7 +106,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3050_dlink_dir-620-a1.dts b/target/linux/ramips/dts/rt3050_dlink_dir-620-a1.dts index 48561835dc..1aee3b37fb 100644 --- a/target/linux/ramips/dts/rt3050_dlink_dir-620-a1.dts +++ b/target/linux/ramips/dts/rt3050_dlink_dir-620-a1.dts @@ -121,7 +121,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3050_edimax_3g-6200n.dts b/target/linux/ramips/dts/rt3050_edimax_3g-6200n.dts index d963aba25e..8fefbb0c22 100644 --- a/target/linux/ramips/dts/rt3050_edimax_3g-6200n.dts +++ b/target/linux/ramips/dts/rt3050_edimax_3g-6200n.dts @@ -114,7 +114,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3050_edimax_3g-6200nl.dts b/target/linux/ramips/dts/rt3050_edimax_3g-6200nl.dts index 11912d79c5..214a6d6fb6 100644 --- a/target/linux/ramips/dts/rt3050_edimax_3g-6200nl.dts +++ b/target/linux/ramips/dts/rt3050_edimax_3g-6200nl.dts @@ -101,7 +101,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3050_huawei_d105.dts b/target/linux/ramips/dts/rt3050_huawei_d105.dts index 1f5fbc9379..798764de56 100644 --- a/target/linux/ramips/dts/rt3050_huawei_d105.dts +++ b/target/linux/ramips/dts/rt3050_huawei_d105.dts @@ -97,7 +97,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3050_jcg_jhr-n805r.dts b/target/linux/ramips/dts/rt3050_jcg_jhr-n805r.dts index 9916efdb7c..62d1997079 100644 --- a/target/linux/ramips/dts/rt3050_jcg_jhr-n805r.dts +++ b/target/linux/ramips/dts/rt3050_jcg_jhr-n805r.dts @@ -93,5 +93,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3050_netcore_nw718.dts b/target/linux/ramips/dts/rt3050_netcore_nw718.dts index e17d5a8fcd..807f576fbd 100644 --- a/target/linux/ramips/dts/rt3050_netcore_nw718.dts +++ b/target/linux/ramips/dts/rt3050_netcore_nw718.dts @@ -111,7 +111,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3050_sparklan_wcr-150gn.dts b/target/linux/ramips/dts/rt3050_sparklan_wcr-150gn.dts index b6308290e1..f1e52e1d41 100644 --- a/target/linux/ramips/dts/rt3050_sparklan_wcr-150gn.dts +++ b/target/linux/ramips/dts/rt3050_sparklan_wcr-150gn.dts @@ -103,7 +103,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3050_teltonika_rut5xx.dts b/target/linux/ramips/dts/rt3050_teltonika_rut5xx.dts index 280246cf9a..6a0965d760 100644 --- a/target/linux/ramips/dts/rt3050_teltonika_rut5xx.dts +++ b/target/linux/ramips/dts/rt3050_teltonika_rut5xx.dts @@ -93,7 +93,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3050_tenda_w150m.dts b/target/linux/ramips/dts/rt3050_tenda_w150m.dts index 9c28c2999d..508e058681 100644 --- a/target/linux/ramips/dts/rt3050_tenda_w150m.dts +++ b/target/linux/ramips/dts/rt3050_tenda_w150m.dts @@ -121,5 +121,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3050_trendnet_tew-638apb-v2.dts b/target/linux/ramips/dts/rt3050_trendnet_tew-638apb-v2.dts index a7c5f8342f..a84eeb3355 100644 --- a/target/linux/ramips/dts/rt3050_trendnet_tew-638apb-v2.dts +++ b/target/linux/ramips/dts/rt3050_trendnet_tew-638apb-v2.dts @@ -101,5 +101,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3052_accton_wr6202.dts b/target/linux/ramips/dts/rt3052_accton_wr6202.dts index fa5f740e17..9ae0a0a97c 100644 --- a/target/linux/ramips/dts/rt3052_accton_wr6202.dts +++ b/target/linux/ramips/dts/rt3052_accton_wr6202.dts @@ -109,7 +109,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_alfa-network_w502u.dts b/target/linux/ramips/dts/rt3052_alfa-network_w502u.dts index cbe04e321f..409148f063 100644 --- a/target/linux/ramips/dts/rt3052_alfa-network_w502u.dts +++ b/target/linux/ramips/dts/rt3052_alfa-network_w502u.dts @@ -107,7 +107,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_argus_atp-52b.dts b/target/linux/ramips/dts/rt3052_argus_atp-52b.dts index 6d466cd57d..8b912ee678 100644 --- a/target/linux/ramips/dts/rt3052_argus_atp-52b.dts +++ b/target/linux/ramips/dts/rt3052_argus_atp-52b.dts @@ -99,7 +99,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_asiarf_awapn2403.dts b/target/linux/ramips/dts/rt3052_asiarf_awapn2403.dts index 23418ec5fc..6e4e7a4b44 100644 --- a/target/linux/ramips/dts/rt3052_asiarf_awapn2403.dts +++ b/target/linux/ramips/dts/rt3052_asiarf_awapn2403.dts @@ -89,5 +89,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3052_asus_rt-n13u.dts b/target/linux/ramips/dts/rt3052_asus_rt-n13u.dts index 7382980887..c560751af6 100644 --- a/target/linux/ramips/dts/rt3052_asus_rt-n13u.dts +++ b/target/linux/ramips/dts/rt3052_asus_rt-n13u.dts @@ -101,7 +101,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_aximcom_mr-102n.dts b/target/linux/ramips/dts/rt3052_aximcom_mr-102n.dts index b364c3a865..c9fd313c14 100644 --- a/target/linux/ramips/dts/rt3052_aximcom_mr-102n.dts +++ b/target/linux/ramips/dts/rt3052_aximcom_mr-102n.dts @@ -119,7 +119,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_aztech_hw550-3g.dts b/target/linux/ramips/dts/rt3052_aztech_hw550-3g.dts index 4541f99464..c2bc09294b 100644 --- a/target/linux/ramips/dts/rt3052_aztech_hw550-3g.dts +++ b/target/linux/ramips/dts/rt3052_aztech_hw550-3g.dts @@ -119,7 +119,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_buffalo_whr-g300n.dts b/target/linux/ramips/dts/rt3052_buffalo_whr-g300n.dts index 9e3d2d4d84..136bcc17bf 100644 --- a/target/linux/ramips/dts/rt3052_buffalo_whr-g300n.dts +++ b/target/linux/ramips/dts/rt3052_buffalo_whr-g300n.dts @@ -123,5 +123,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3052_dlink_dap-1350.dts b/target/linux/ramips/dts/rt3052_dlink_dap-1350.dts index a506b792ef..e3d59bf66c 100644 --- a/target/linux/ramips/dts/rt3052_dlink_dap-1350.dts +++ b/target/linux/ramips/dts/rt3052_dlink_dap-1350.dts @@ -128,7 +128,7 @@ }; &wmac { - ralink,mtd-eeprom = <&devdata 0>; + ralink,mtd-eeprom = <&devdata 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_engenius_esr-9753.dts b/target/linux/ramips/dts/rt3052_engenius_esr-9753.dts index 99ce63ba5a..291ed97583 100644 --- a/target/linux/ramips/dts/rt3052_engenius_esr-9753.dts +++ b/target/linux/ramips/dts/rt3052_engenius_esr-9753.dts @@ -101,5 +101,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3052_fon_fonera-20n.dts b/target/linux/ramips/dts/rt3052_fon_fonera-20n.dts index 37ae9438f7..c8fee79495 100644 --- a/target/linux/ramips/dts/rt3052_fon_fonera-20n.dts +++ b/target/linux/ramips/dts/rt3052_fon_fonera-20n.dts @@ -147,7 +147,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_hauppauge_broadway.dts b/target/linux/ramips/dts/rt3052_hauppauge_broadway.dts index b954cdfa61..ef09293140 100644 --- a/target/linux/ramips/dts/rt3052_hauppauge_broadway.dts +++ b/target/linux/ramips/dts/rt3052_hauppauge_broadway.dts @@ -90,7 +90,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_huawei_hg255d.dts b/target/linux/ramips/dts/rt3052_huawei_hg255d.dts index ac60f2b7d2..cfcfc06be2 100644 --- a/target/linux/ramips/dts/rt3052_huawei_hg255d.dts +++ b/target/linux/ramips/dts/rt3052_huawei_hg255d.dts @@ -135,7 +135,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_jcg_jhr-n825r.dts b/target/linux/ramips/dts/rt3052_jcg_jhr-n825r.dts index 15eceec661..f0fd8690b9 100644 --- a/target/linux/ramips/dts/rt3052_jcg_jhr-n825r.dts +++ b/target/linux/ramips/dts/rt3052_jcg_jhr-n825r.dts @@ -88,5 +88,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3052_jcg_jhr-n926r.dts b/target/linux/ramips/dts/rt3052_jcg_jhr-n926r.dts index 9a23ee63da..870c6726ce 100644 --- a/target/linux/ramips/dts/rt3052_jcg_jhr-n926r.dts +++ b/target/linux/ramips/dts/rt3052_jcg_jhr-n926r.dts @@ -134,5 +134,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3052_mofinetwork_mofi3500-3gn.dts b/target/linux/ramips/dts/rt3052_mofinetwork_mofi3500-3gn.dts index 7468441ae2..71284b6d11 100644 --- a/target/linux/ramips/dts/rt3052_mofinetwork_mofi3500-3gn.dts +++ b/target/linux/ramips/dts/rt3052_mofinetwork_mofi3500-3gn.dts @@ -116,7 +116,7 @@ &wmac { status = "okay"; - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_netgear_wnce2001.dts b/target/linux/ramips/dts/rt3052_netgear_wnce2001.dts index 60f637f3c4..9d1942f30b 100644 --- a/target/linux/ramips/dts/rt3052_netgear_wnce2001.dts +++ b/target/linux/ramips/dts/rt3052_netgear_wnce2001.dts @@ -143,5 +143,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3052_nexaira_bc2.dts b/target/linux/ramips/dts/rt3052_nexaira_bc2.dts index 05f20cb863..1539aa23ec 100644 --- a/target/linux/ramips/dts/rt3052_nexaira_bc2.dts +++ b/target/linux/ramips/dts/rt3052_nexaira_bc2.dts @@ -85,7 +85,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_omnima_miniembwifi.dts b/target/linux/ramips/dts/rt3052_omnima_miniembwifi.dts index 0c2f46d885..d2a54f0a80 100644 --- a/target/linux/ramips/dts/rt3052_omnima_miniembwifi.dts +++ b/target/linux/ramips/dts/rt3052_omnima_miniembwifi.dts @@ -95,7 +95,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_petatel_psr-680w.dts b/target/linux/ramips/dts/rt3052_petatel_psr-680w.dts index 8f0a3567ce..1cc6228e0d 100644 --- a/target/linux/ramips/dts/rt3052_petatel_psr-680w.dts +++ b/target/linux/ramips/dts/rt3052_petatel_psr-680w.dts @@ -94,7 +94,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_planex_mzk-w300nh2.dts b/target/linux/ramips/dts/rt3052_planex_mzk-w300nh2.dts index b3f00da2f6..1390d44576 100644 --- a/target/linux/ramips/dts/rt3052_planex_mzk-w300nh2.dts +++ b/target/linux/ramips/dts/rt3052_planex_mzk-w300nh2.dts @@ -118,5 +118,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3052_planex_mzk-wdpr.dts b/target/linux/ramips/dts/rt3052_planex_mzk-wdpr.dts index 83854b3e6c..88219f4d10 100644 --- a/target/linux/ramips/dts/rt3052_planex_mzk-wdpr.dts +++ b/target/linux/ramips/dts/rt3052_planex_mzk-wdpr.dts @@ -83,7 +83,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_prolink_pwh2004.dts b/target/linux/ramips/dts/rt3052_prolink_pwh2004.dts index 24a8346bc8..7de61400df 100644 --- a/target/linux/ramips/dts/rt3052_prolink_pwh2004.dts +++ b/target/linux/ramips/dts/rt3052_prolink_pwh2004.dts @@ -91,5 +91,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3052_ralink_v22rw-2x2.dts b/target/linux/ramips/dts/rt3052_ralink_v22rw-2x2.dts index 17dee2d153..2ce1ef0b2d 100644 --- a/target/linux/ramips/dts/rt3052_ralink_v22rw-2x2.dts +++ b/target/linux/ramips/dts/rt3052_ralink_v22rw-2x2.dts @@ -97,7 +97,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_sitecom_wl-351.dts b/target/linux/ramips/dts/rt3052_sitecom_wl-351.dts index c8a1b125ec..f43a02659b 100644 --- a/target/linux/ramips/dts/rt3052_sitecom_wl-351.dts +++ b/target/linux/ramips/dts/rt3052_sitecom_wl-351.dts @@ -123,7 +123,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_skyline_sl-r7205.dts b/target/linux/ramips/dts/rt3052_skyline_sl-r7205.dts index e158cbee3c..c07e4b5004 100644 --- a/target/linux/ramips/dts/rt3052_skyline_sl-r7205.dts +++ b/target/linux/ramips/dts/rt3052_skyline_sl-r7205.dts @@ -96,7 +96,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_tenda_3g300m.dts b/target/linux/ramips/dts/rt3052_tenda_3g300m.dts index 97b2be0885..428c3baff5 100644 --- a/target/linux/ramips/dts/rt3052_tenda_3g300m.dts +++ b/target/linux/ramips/dts/rt3052_tenda_3g300m.dts @@ -126,7 +126,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_tenda_w306r-v2.dts b/target/linux/ramips/dts/rt3052_tenda_w306r-v2.dts index 54fd6d785e..c5e69c840e 100644 --- a/target/linux/ramips/dts/rt3052_tenda_w306r-v2.dts +++ b/target/linux/ramips/dts/rt3052_tenda_w306r-v2.dts @@ -95,5 +95,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3052_unbranded_wr512-3gn.dtsi b/target/linux/ramips/dts/rt3052_unbranded_wr512-3gn.dtsi index 4994d65e1a..f62c18b0e2 100644 --- a/target/linux/ramips/dts/rt3052_unbranded_wr512-3gn.dtsi +++ b/target/linux/ramips/dts/rt3052_unbranded_wr512-3gn.dtsi @@ -72,7 +72,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_unbranded_xdx-rn502j.dts b/target/linux/ramips/dts/rt3052_unbranded_xdx-rn502j.dts index 352459ab2a..ae743965a3 100644 --- a/target/linux/ramips/dts/rt3052_unbranded_xdx-rn502j.dts +++ b/target/linux/ramips/dts/rt3052_unbranded_xdx-rn502j.dts @@ -95,7 +95,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_upvel_ur-326n4g.dts b/target/linux/ramips/dts/rt3052_upvel_ur-326n4g.dts index df447134c1..53ad90901a 100644 --- a/target/linux/ramips/dts/rt3052_upvel_ur-326n4g.dts +++ b/target/linux/ramips/dts/rt3052_upvel_ur-326n4g.dts @@ -116,7 +116,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_upvel_ur-336un.dts b/target/linux/ramips/dts/rt3052_upvel_ur-336un.dts index 042193fb57..832207a9c4 100644 --- a/target/linux/ramips/dts/rt3052_upvel_ur-336un.dts +++ b/target/linux/ramips/dts/rt3052_upvel_ur-336un.dts @@ -116,7 +116,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_zyxel_keenetic.dts b/target/linux/ramips/dts/rt3052_zyxel_keenetic.dts index b4e01b05d3..e6b6de9e5a 100644 --- a/target/linux/ramips/dts/rt3052_zyxel_keenetic.dts +++ b/target/linux/ramips/dts/rt3052_zyxel_keenetic.dts @@ -115,7 +115,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &otg { diff --git a/target/linux/ramips/dts/rt3052_zyxel_nbg-419n.dts b/target/linux/ramips/dts/rt3052_zyxel_nbg-419n.dts index 9fd3b3eb32..55c2bc5d48 100644 --- a/target/linux/ramips/dts/rt3052_zyxel_nbg-419n.dts +++ b/target/linux/ramips/dts/rt3052_zyxel_nbg-419n.dts @@ -101,5 +101,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3352_allnet_all5002.dts b/target/linux/ramips/dts/rt3352_allnet_all5002.dts index 8f66a7ea4d..6a0b022bd2 100644 --- a/target/linux/ramips/dts/rt3352_allnet_all5002.dts +++ b/target/linux/ramips/dts/rt3352_allnet_all5002.dts @@ -105,7 +105,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt3352_dlink_dir-615-h1.dts b/target/linux/ramips/dts/rt3352_dlink_dir-615-h1.dts index fa82246f31..5fddd80842 100644 --- a/target/linux/ramips/dts/rt3352_dlink_dir-615-h1.dts +++ b/target/linux/ramips/dts/rt3352_dlink_dir-615-h1.dts @@ -123,5 +123,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt3352_dlink_dir-620-d1.dts b/target/linux/ramips/dts/rt3352_dlink_dir-620-d1.dts index e52a838b1f..4f3847fed2 100644 --- a/target/linux/ramips/dts/rt3352_dlink_dir-620-d1.dts +++ b/target/linux/ramips/dts/rt3352_dlink_dir-620-d1.dts @@ -100,7 +100,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt3352_zyxel_nbg-419n-v2.dts b/target/linux/ramips/dts/rt3352_zyxel_nbg-419n-v2.dts index d70ddb2d4a..05cf4a380a 100644 --- a/target/linux/ramips/dts/rt3352_zyxel_nbg-419n-v2.dts +++ b/target/linux/ramips/dts/rt3352_zyxel_nbg-419n-v2.dts @@ -116,7 +116,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt3662_asus_rt-n56u.dts b/target/linux/ramips/dts/rt3662_asus_rt-n56u.dts index ed3ac792c4..411a7ac0cd 100644 --- a/target/linux/ramips/dts/rt3662_asus_rt-n56u.dts +++ b/target/linux/ramips/dts/rt3662_asus_rt-n56u.dts @@ -137,7 +137,7 @@ &wmac { status = "okay"; ralink,2ghz = <0>; - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt3662_dlink_dir-645.dts b/target/linux/ramips/dts/rt3662_dlink_dir-645.dts index 5973e0e175..a7a7c86cc5 100644 --- a/target/linux/ramips/dts/rt3662_dlink_dir-645.dts +++ b/target/linux/ramips/dts/rt3662_dlink_dir-645.dts @@ -138,7 +138,7 @@ &wmac { ralink,5ghz = <0>; - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt3662_edimax_br-6475nd.dts b/target/linux/ramips/dts/rt3662_edimax_br-6475nd.dts index 9f8298b0b3..7740191031 100644 --- a/target/linux/ramips/dts/rt3662_edimax_br-6475nd.dts +++ b/target/linux/ramips/dts/rt3662_edimax_br-6475nd.dts @@ -151,7 +151,7 @@ &wmac { status = "okay"; - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &pci { diff --git a/target/linux/ramips/dts/rt3662_omnima_hpm.dts b/target/linux/ramips/dts/rt3662_omnima_hpm.dts index ee36547798..c2ea3c048b 100644 --- a/target/linux/ramips/dts/rt3662_omnima_hpm.dts +++ b/target/linux/ramips/dts/rt3662_omnima_hpm.dts @@ -148,7 +148,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt3662_samsung_cy-swr1100.dts b/target/linux/ramips/dts/rt3662_samsung_cy-swr1100.dts index 9b1c41cde0..95133777dc 100644 --- a/target/linux/ramips/dts/rt3662_samsung_cy-swr1100.dts +++ b/target/linux/ramips/dts/rt3662_samsung_cy-swr1100.dts @@ -144,7 +144,7 @@ &wmac { status = "okay"; ralink,2ghz = <0>; - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt3883_belkin_f9k110x.dtsi b/target/linux/ramips/dts/rt3883_belkin_f9k110x.dtsi index f1c9a1d52f..848c6eed01 100644 --- a/target/linux/ramips/dts/rt3883_belkin_f9k110x.dtsi +++ b/target/linux/ramips/dts/rt3883_belkin_f9k110x.dtsi @@ -82,7 +82,7 @@ &wmac { status = "okay"; - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &pci { diff --git a/target/linux/ramips/dts/rt5350_7links_px-4885.dtsi b/target/linux/ramips/dts/rt5350_7links_px-4885.dtsi index d9e1cb5397..a4a520cdcb 100644 --- a/target/linux/ramips/dts/rt5350_7links_px-4885.dtsi +++ b/target/linux/ramips/dts/rt5350_7links_px-4885.dtsi @@ -57,5 +57,5 @@ }; &wmac { - ralink,mtd-eeprom = <&devconf 0>; + ralink,mtd-eeprom = <&devconf 0x0>; }; diff --git a/target/linux/ramips/dts/rt5350_airlive_air3gii.dts b/target/linux/ramips/dts/rt5350_airlive_air3gii.dts index f7be825d12..2206410428 100644 --- a/target/linux/ramips/dts/rt5350_airlive_air3gii.dts +++ b/target/linux/ramips/dts/rt5350_airlive_air3gii.dts @@ -97,5 +97,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt5350_allnet_all5003.dts b/target/linux/ramips/dts/rt5350_allnet_all5003.dts index a5500c5c20..e2cd04ef03 100644 --- a/target/linux/ramips/dts/rt5350_allnet_all5003.dts +++ b/target/linux/ramips/dts/rt5350_allnet_all5003.dts @@ -105,7 +105,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_asiarf_awm002-evb.dtsi b/target/linux/ramips/dts/rt5350_asiarf_awm002-evb.dtsi index 7dafd0548a..840db54670 100644 --- a/target/linux/ramips/dts/rt5350_asiarf_awm002-evb.dtsi +++ b/target/linux/ramips/dts/rt5350_asiarf_awm002-evb.dtsi @@ -48,7 +48,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/rt5350_belkin_f7c027.dts b/target/linux/ramips/dts/rt5350_belkin_f7c027.dts index a89cbad80b..9d34b4abe5 100644 --- a/target/linux/ramips/dts/rt5350_belkin_f7c027.dts +++ b/target/linux/ramips/dts/rt5350_belkin_f7c027.dts @@ -130,7 +130,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &state_default { diff --git a/target/linux/ramips/dts/rt5350_dlink_dcs-930l-b1.dts b/target/linux/ramips/dts/rt5350_dlink_dcs-930l-b1.dts index c52e75cab5..dd54751f4e 100644 --- a/target/linux/ramips/dts/rt5350_dlink_dcs-930l-b1.dts +++ b/target/linux/ramips/dts/rt5350_dlink_dcs-930l-b1.dts @@ -104,7 +104,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_dlink_dir-300-b7.dts b/target/linux/ramips/dts/rt5350_dlink_dir-300-b7.dts index 4fd2755d90..f4457d6f5e 100644 --- a/target/linux/ramips/dts/rt5350_dlink_dir-300-b7.dts +++ b/target/linux/ramips/dts/rt5350_dlink_dir-300-b7.dts @@ -107,5 +107,5 @@ &wmac { status = "okay"; ralink,led-polarity = <1>; - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt5350_dlink_dir-320-b1.dts b/target/linux/ramips/dts/rt5350_dlink_dir-320-b1.dts index 9556287760..3429e9d44d 100644 --- a/target/linux/ramips/dts/rt5350_dlink_dir-320-b1.dts +++ b/target/linux/ramips/dts/rt5350_dlink_dir-320-b1.dts @@ -127,7 +127,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_easyacc_wizard-8800.dts b/target/linux/ramips/dts/rt5350_easyacc_wizard-8800.dts index c3016bcda3..d7e6db410a 100644 --- a/target/linux/ramips/dts/rt5350_easyacc_wizard-8800.dts +++ b/target/linux/ramips/dts/rt5350_easyacc_wizard-8800.dts @@ -79,5 +79,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt5350_hame_mpr-a1.dts b/target/linux/ramips/dts/rt5350_hame_mpr-a1.dts index 043cdf4826..05ae3927ea 100644 --- a/target/linux/ramips/dts/rt5350_hame_mpr-a1.dts +++ b/target/linux/ramips/dts/rt5350_hame_mpr-a1.dts @@ -119,7 +119,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_hame_mpr-a2.dts b/target/linux/ramips/dts/rt5350_hame_mpr-a2.dts index bcb828ac1c..252f25044c 100644 --- a/target/linux/ramips/dts/rt5350_hame_mpr-a2.dts +++ b/target/linux/ramips/dts/rt5350_hame_mpr-a2.dts @@ -116,7 +116,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_hilink_hlk-rm04.dts b/target/linux/ramips/dts/rt5350_hilink_hlk-rm04.dts index 95d47e401b..98af63b41c 100644 --- a/target/linux/ramips/dts/rt5350_hilink_hlk-rm04.dts +++ b/target/linux/ramips/dts/rt5350_hilink_hlk-rm04.dts @@ -109,7 +109,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_hootoo_ht-tm02.dts b/target/linux/ramips/dts/rt5350_hootoo_ht-tm02.dts index 2c80536d94..fca2f99222 100644 --- a/target/linux/ramips/dts/rt5350_hootoo_ht-tm02.dts +++ b/target/linux/ramips/dts/rt5350_hootoo_ht-tm02.dts @@ -110,7 +110,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_nexx_wt1520.dtsi b/target/linux/ramips/dts/rt5350_nexx_wt1520.dtsi index ef445603cc..dbe925508a 100644 --- a/target/linux/ramips/dts/rt5350_nexx_wt1520.dtsi +++ b/target/linux/ramips/dts/rt5350_nexx_wt1520.dtsi @@ -30,7 +30,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_nixcore_x1.dtsi b/target/linux/ramips/dts/rt5350_nixcore_x1.dtsi index a0768587a4..191e3c6714 100644 --- a/target/linux/ramips/dts/rt5350_nixcore_x1.dtsi +++ b/target/linux/ramips/dts/rt5350_nixcore_x1.dtsi @@ -141,7 +141,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_olimex_rt5350f-olinuxino.dtsi b/target/linux/ramips/dts/rt5350_olimex_rt5350f-olinuxino.dtsi index 0a49e22de2..87eb888b6d 100644 --- a/target/linux/ramips/dts/rt5350_olimex_rt5350f-olinuxino.dtsi +++ b/target/linux/ramips/dts/rt5350_olimex_rt5350f-olinuxino.dtsi @@ -74,7 +74,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; ralink,led-polarity = <1>; }; diff --git a/target/linux/ramips/dts/rt5350_omnima_miniembplug.dts b/target/linux/ramips/dts/rt5350_omnima_miniembplug.dts index 3e635d9082..a22997ff98 100644 --- a/target/linux/ramips/dts/rt5350_omnima_miniembplug.dts +++ b/target/linux/ramips/dts/rt5350_omnima_miniembplug.dts @@ -115,7 +115,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_planex_mzk-dp150n.dts b/target/linux/ramips/dts/rt5350_planex_mzk-dp150n.dts index bc92859880..9327172242 100644 --- a/target/linux/ramips/dts/rt5350_planex_mzk-dp150n.dts +++ b/target/linux/ramips/dts/rt5350_planex_mzk-dp150n.dts @@ -105,6 +105,6 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; ralink,led-polarity = <1>; }; diff --git a/target/linux/ramips/dts/rt5350_poray_m3.dts b/target/linux/ramips/dts/rt5350_poray_m3.dts index 6f23cd160d..f4e935874e 100644 --- a/target/linux/ramips/dts/rt5350_poray_m3.dts +++ b/target/linux/ramips/dts/rt5350_poray_m3.dts @@ -101,7 +101,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; ralink,led-polarity = <1>; }; diff --git a/target/linux/ramips/dts/rt5350_poray_m4.dtsi b/target/linux/ramips/dts/rt5350_poray_m4.dtsi index f6fb9011b3..2413de2889 100644 --- a/target/linux/ramips/dts/rt5350_poray_m4.dtsi +++ b/target/linux/ramips/dts/rt5350_poray_m4.dtsi @@ -51,7 +51,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; ralink,led-polarity = <1>; }; diff --git a/target/linux/ramips/dts/rt5350_poray_x5.dts b/target/linux/ramips/dts/rt5350_poray_x5.dts index 419d57487c..8d0078ad95 100644 --- a/target/linux/ramips/dts/rt5350_poray_x5.dts +++ b/target/linux/ramips/dts/rt5350_poray_x5.dts @@ -133,7 +133,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; ralink,led-polarity = <1>; }; diff --git a/target/linux/ramips/dts/rt5350_poray_x8.dts b/target/linux/ramips/dts/rt5350_poray_x8.dts index db48a03407..ba3d21242b 100644 --- a/target/linux/ramips/dts/rt5350_poray_x8.dts +++ b/target/linux/ramips/dts/rt5350_poray_x8.dts @@ -94,7 +94,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; ralink,led-polarity = <1>; }; diff --git a/target/linux/ramips/dts/rt5350_tenda_3g150b.dts b/target/linux/ramips/dts/rt5350_tenda_3g150b.dts index 06b632bc5b..7433272fb4 100644 --- a/target/linux/ramips/dts/rt5350_tenda_3g150b.dts +++ b/target/linux/ramips/dts/rt5350_tenda_3g150b.dts @@ -115,7 +115,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; ralink,led-polarity = <1>; }; diff --git a/target/linux/ramips/dts/rt5350_trendnet_tew-714tru.dts b/target/linux/ramips/dts/rt5350_trendnet_tew-714tru.dts index 108d1f0389..489884aea8 100644 --- a/target/linux/ramips/dts/rt5350_trendnet_tew-714tru.dts +++ b/target/linux/ramips/dts/rt5350_trendnet_tew-714tru.dts @@ -115,7 +115,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts b/target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts index 73cd4274f6..cc9e6ebbbb 100644 --- a/target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts +++ b/target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts @@ -121,7 +121,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_vocore_vocore.dtsi b/target/linux/ramips/dts/rt5350_vocore_vocore.dtsi index 76ed58e8f6..791b69448a 100644 --- a/target/linux/ramips/dts/rt5350_vocore_vocore.dtsi +++ b/target/linux/ramips/dts/rt5350_vocore_vocore.dtsi @@ -181,7 +181,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_wansview_ncs601w.dts b/target/linux/ramips/dts/rt5350_wansview_ncs601w.dts index 7fb1fb93da..1c84b0f115 100644 --- a/target/linux/ramips/dts/rt5350_wansview_ncs601w.dts +++ b/target/linux/ramips/dts/rt5350_wansview_ncs601w.dts @@ -63,7 +63,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_wiznet_wizfi630a.dts b/target/linux/ramips/dts/rt5350_wiznet_wizfi630a.dts index ceab5394e5..22a61eb587 100644 --- a/target/linux/ramips/dts/rt5350_wiznet_wizfi630a.dts +++ b/target/linux/ramips/dts/rt5350_wiznet_wizfi630a.dts @@ -144,7 +144,7 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; &ehci { diff --git a/target/linux/ramips/dts/rt5350_zorlik_zl5900v2.dts b/target/linux/ramips/dts/rt5350_zorlik_zl5900v2.dts index 0dbdc6ea6d..2a883c7dfa 100644 --- a/target/linux/ramips/dts/rt5350_zorlik_zl5900v2.dts +++ b/target/linux/ramips/dts/rt5350_zorlik_zl5900v2.dts @@ -98,5 +98,5 @@ }; &wmac { - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; diff --git a/target/linux/ramips/dts/rt5350_zyxel_keenetic-start.dts b/target/linux/ramips/dts/rt5350_zyxel_keenetic-start.dts index c50a08d98a..fe5e5e29b4 100644 --- a/target/linux/ramips/dts/rt5350_zyxel_keenetic-start.dts +++ b/target/linux/ramips/dts/rt5350_zyxel_keenetic-start.dts @@ -109,5 +109,5 @@ &wmac { status = "okay"; ralink,led-polarity = <1>; - ralink,mtd-eeprom = <&factory 0>; + ralink,mtd-eeprom = <&factory 0x0>; }; From fa9e7ca4661d8d5a521ede511a496ae029748595 Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Fri, 8 May 2020 21:00:48 +0900 Subject: [PATCH 25/29] ramips: simplify palmbus/{i2c,spi} in device DTS files As the node is already defined and labeled in SoC DTSI file, we can refer to it outside of root node and reduce redundancy. While at it, remove unused pcf8563 label. Signed-off-by: Sungbo Eo --- .../ramips/dts/mt7621_asus_rt-acx5p.dtsi | 10 +-- .../linux/ramips/dts/mt7621_d-team_pbr-m1.dts | 22 +++-- .../linux/ramips/dts/mt7621_mqmaker_witi.dts | 22 +++-- .../ramips/dts/mt7621_zbtlink_zbt-we3526.dts | 10 +-- .../ramips/dts/mt7621_zbtlink_zbt-wg2626.dts | 10 +-- .../ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi | 10 +-- .../ramips/dts/rt3352_zyxel_nbg-419n-v2.dts | 81 +++++++++---------- 7 files changed, 76 insertions(+), 89 deletions(-) diff --git a/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi b/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi index 37056c7934..7ad6727f51 100644 --- a/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi +++ b/target/linux/ramips/dts/mt7621_asus_rt-acx5p.dtsi @@ -17,12 +17,6 @@ bootargs = "console=ttyS0,57600"; }; - palmbus: palmbus@1E000000 { - i2c@900 { - status = "okay"; - }; - }; - keys { compatible = "gpio-keys"; @@ -60,6 +54,10 @@ }; }; +&i2c { + status = "okay"; +}; + &sdhci { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7621_d-team_pbr-m1.dts b/target/linux/ramips/dts/mt7621_d-team_pbr-m1.dts index 49d8648f8a..ab21785c10 100644 --- a/target/linux/ramips/dts/mt7621_d-team_pbr-m1.dts +++ b/target/linux/ramips/dts/mt7621_d-team_pbr-m1.dts @@ -20,18 +20,6 @@ bootargs = "console=ttyS0,115200"; }; - palmbus: palmbus@1E000000 { - i2c: i2c@900 { - status = "okay"; - - pcf8563: rtc@51 { - status = "okay"; - compatible = "nxp,pcf8563"; - reg = <0x51>; - }; - }; - }; - leds { compatible = "gpio-leds"; @@ -101,6 +89,16 @@ }; }; +&i2c { + status = "okay"; + + rtc@51 { + status = "okay"; + compatible = "nxp,pcf8563"; + reg = <0x51>; + }; +}; + &sdhci { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7621_mqmaker_witi.dts b/target/linux/ramips/dts/mt7621_mqmaker_witi.dts index 87421486a9..aa398b8a80 100644 --- a/target/linux/ramips/dts/mt7621_mqmaker_witi.dts +++ b/target/linux/ramips/dts/mt7621_mqmaker_witi.dts @@ -13,18 +13,6 @@ bootargs = "console=ttyS0,57600"; }; - palmbus: palmbus@1E000000 { - i2c@900 { - status = "okay"; - - pcf8563: rtc@51 { - status = "okay"; - compatible = "nxp,pcf8563"; - reg = <0x51>; - }; - }; - }; - keys { compatible = "gpio-keys"; @@ -36,6 +24,16 @@ }; }; +&i2c { + status = "okay"; + + rtc@51 { + status = "okay"; + compatible = "nxp,pcf8563"; + reg = <0x51>; + }; +}; + &sdhci { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we3526.dts b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we3526.dts index 1f43f2a2dc..6765bee563 100644 --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-we3526.dts +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-we3526.dts @@ -13,12 +13,6 @@ bootargs = "console=ttyS0,115200"; }; - palmbus: palmbus@1E000000 { - i2c@900 { - status = "okay"; - }; - }; - keys { compatible = "gpio-keys"; @@ -30,6 +24,10 @@ }; }; +&i2c { + status = "okay"; +}; + &sdhci { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg2626.dts b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg2626.dts index 5e8e250432..8e6471cf0f 100644 --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg2626.dts +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg2626.dts @@ -20,12 +20,6 @@ bootargs = "console=ttyS0,115200"; }; - palmbus: palmbus@1E000000 { - i2c@900 { - status = "okay"; - }; - }; - keys { compatible = "gpio-keys"; @@ -46,6 +40,10 @@ }; }; +&i2c { + status = "okay"; +}; + &sdhci { status = "okay"; }; diff --git a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi index 8c9d31325a..88360ff252 100644 --- a/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi +++ b/target/linux/ramips/dts/mt7621_zbtlink_zbt-wg3526.dtsi @@ -18,12 +18,6 @@ bootargs = "console=ttyS0,115200"; }; - palmbus: palmbus@1E000000 { - i2c@900 { - status = "okay"; - }; - }; - keys { compatible = "gpio-keys"; @@ -44,6 +38,10 @@ }; }; +&i2c { + status = "okay"; +}; + &sdhci { status = "okay"; }; diff --git a/target/linux/ramips/dts/rt3352_zyxel_nbg-419n-v2.dts b/target/linux/ramips/dts/rt3352_zyxel_nbg-419n-v2.dts index 05cf4a380a..53a5c54ec6 100644 --- a/target/linux/ramips/dts/rt3352_zyxel_nbg-419n-v2.dts +++ b/target/linux/ramips/dts/rt3352_zyxel_nbg-419n-v2.dts @@ -16,47 +16,6 @@ led-upgrade = &led_power; }; - palmbus@10000000 { - spi@b00 { - status = "okay"; - m25p80@0 { - compatible = "jedec,spi-nor"; - reg = <0 0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition@0 { - label = "u-boot"; - reg = <0x0 0x30000>; - read-only; - }; - - partition@30000 { - label = "u-boot-env"; - reg = <0x30000 0x10000>; - read-only; - }; - - factory: partition@40000 { - label = "factory"; - reg = <0x40000 0x10000>; - read-only; - }; - - partition@50000 { - compatible = "denx,uimage"; - label = "firmware"; - reg = <0x50000 0x7b0000>; - }; - }; - }; - }; - }; - leds { compatible = "gpio-leds"; @@ -100,6 +59,46 @@ }; }; +&spi0 { + status = "okay"; + + m25p80@0 { + compatible = "jedec,spi-nor"; + reg = <0 0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@0 { + label = "u-boot"; + reg = <0x0 0x30000>; + read-only; + }; + + partition@30000 { + label = "u-boot-env"; + reg = <0x30000 0x10000>; + read-only; + }; + + factory: partition@40000 { + label = "factory"; + reg = <0x40000 0x10000>; + read-only; + }; + + partition@50000 { + compatible = "denx,uimage"; + label = "firmware"; + reg = <0x50000 0x7b0000>; + }; + }; + }; +}; + &state_default { gpio { groups = "i2c", "jtag", "rgmii", "mdio", "uartf"; From c5fdab84ed4b84d1ad9517b28adca5002f099791 Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 9 May 2020 01:20:53 +0900 Subject: [PATCH 26/29] ramips: tidy up image Makefile - sort recipes alphabetically - simplify subtarget include directives Signed-off-by: Sungbo Eo --- target/linux/ramips/image/Makefile | 200 +++++++++++++---------------- 1 file changed, 89 insertions(+), 111 deletions(-) diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile index f93ea8ab2a..4806226fd0 100644 --- a/target/linux/ramips/image/Makefile +++ b/target/linux/ramips/image/Makefile @@ -25,80 +25,10 @@ KERNEL_LOADADDR := $(loadaddr-y) LOADER_PLATFORM := $(ldrplatform-y) KERNEL_DTB = kernel-bin | append-dtb | lzma -define Device/Default - PROFILES = Default - KERNEL := $(KERNEL_DTB) | uImage lzma - SOC := $(DEFAULT_SOC) - DEVICE_DTS_DIR := ../dts - DEVICE_DTS = $$(SOC)_$(1) - IMAGES := sysupgrade.bin - SUPPORTED_DEVICES := $(subst _,$(comma),$(1)) - sysupgrade_bin := append-kernel | append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size -endef -define Device/uimage-lzma-loader - LOADER_TYPE := bin - KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none -endef - -define Device/seama - SEAMA_MTDBLOCK := 2 - IMAGES += factory.bin - - # 64 bytes offset: - # - 28 bytes seama_header - # - 36 bytes of META data (4-bytes aligned) - IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs - IMAGE/sysupgrade.bin := \ - $$(IMAGE/default) | seama | pad-rootfs | append-metadata | check-size - IMAGE/factory.bin := \ - $$(IMAGE/default) | pad-rootfs -x 64 | seama | seama-seal | check-size - SEAMA_SIGNATURE := -endef - -define Build/jcg-header - $(STAGING_DIR_HOST)/bin/jcgimage -v $(1) \ - $(if $(JCG_MAXSIZE), -m $$(($(subst k, * 1024,$(JCG_MAXSIZE)))),) \ - -u $@ -o $@.new - mv $@.new $@ -endef - -define Build/trx - $(STAGING_DIR_HOST)/bin/trx $(1) \ - -o $@ \ - -m $$(($(subst k, * 1024,$(IMAGE_SIZE)))) \ - -f $(IMAGE_KERNEL) \ - -a 4 -f $(IMAGE_ROOTFS) -endef - -define Build/loader-common - rm -rf $@.src - $(MAKE) -C lzma-loader \ - PKG_BUILD_DIR="$@.src" \ - TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \ - BOARD="$(BOARDNAME)" PLATFORM="$(LOADER_PLATFORM)" \ - LZMA_TEXT_START=0x82000000 LOADADDR=$(KERNEL_LOADADDR) \ - $(1) compile loader.$(LOADER_TYPE) - mv "$@.$(LOADER_TYPE)" "$@" - rm -rf $@.src -endef - -define Build/loader-kernel - $(call Build/loader-common,LOADER_DATA="$@") -endef - -define Build/relocate-kernel - rm -rf $@.relocate - $(CP) ../../generic/image/relocate $@.relocate - $(MAKE) -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS) - ( \ - dd if=$@.relocate/loader.bin bs=32 conv=sync && \ - perl -e '@s = stat("$@"); print pack("V", @s[7])' && \ - cat $@ \ - ) > $@.new - mv $@.new $@ - rm -rf $@.relocate +define Build/edimax-header + $(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1) + @mv $@.new $@ endef define Build/elx-header @@ -121,28 +51,36 @@ define Build/elx-header rm -rf $(KDIR)/tmp/$(DEVICE_NAME).header endef -define Build/umedia-header - fix-u-media-header -T 0x46 -B $(1) -i $@ -o $@.new && mv $@.new $@ -endef - -define Build/edimax-header - $(STAGING_DIR_HOST)/bin/mkedimaximg -i $@ -o $@.new $(1) - @mv $@.new $@ -endef - -define Build/poray-header - $(STAGING_DIR_HOST)/bin/mkporayfw $(1) -f $@ -o $@.new +define Build/fonfxcimage + uimage_padhdr -i $@ -o $@.new mv $@.new $@ endef -define Build/wrg-header - mkwrgimg -i $@ -d "/dev/mtdblock/2" -s $(1) -o $@.new +define Build/jcg-header + $(STAGING_DIR_HOST)/bin/jcgimage -v $(1) \ + $(if $(JCG_MAXSIZE), -m $$(($(subst k, * 1024,$(JCG_MAXSIZE)))),) \ + -u $@ -o $@.new mv $@.new $@ endef +define Build/loader-common + rm -rf $@.src + $(MAKE) -C lzma-loader \ + PKG_BUILD_DIR="$@.src" \ + TARGET_DIR="$(dir $@)" LOADER_NAME="$(notdir $@)" \ + BOARD="$(BOARDNAME)" PLATFORM="$(LOADER_PLATFORM)" \ + LZMA_TEXT_START=0x82000000 LOADADDR=$(KERNEL_LOADADDR) \ + $(1) compile loader.$(LOADER_TYPE) + mv "$@.$(LOADER_TYPE)" "$@" + rm -rf $@.src +endef + +define Build/loader-kernel + $(call Build/loader-common,LOADER_DATA="$@") +endef + # combine kernel and rootfs into one image # mkdlinkfw - define Build/mkdlinkfw -$(STAGING_DIR_HOST)/bin/mkdlinkfw \ -k $(IMAGE_KERNEL) \ @@ -162,8 +100,26 @@ define Build/mkdlinkfw-factory mv $@.new $@ endef -define Build/zyimage - $(STAGING_DIR_HOST)/bin/zyimage $(1) $@ +define Build/poray-header + $(STAGING_DIR_HOST)/bin/mkporayfw $(1) -f $@ -o $@.new + mv $@.new $@ +endef + +define Build/relocate-kernel + rm -rf $@.relocate + $(CP) ../../generic/image/relocate $@.relocate + $(MAKE) -C $@.relocate KERNEL_ADDR=$(KERNEL_LOADADDR) CROSS_COMPILE=$(TARGET_CROSS) + ( \ + dd if=$@.relocate/loader.bin bs=32 conv=sync && \ + perl -e '@s = stat("$@"); print pack("V", @s[7])' && \ + cat $@ \ + ) > $@.new + mv $@.new $@ + rm -rf $@.relocate +endef + +define Build/sercom-footer + $(call Build/sercom-seal,-f) endef define Build/sercom-seal @@ -175,37 +131,59 @@ define Build/sercom-seal $(1) endef -define Build/sercom-footer - $(call Build/sercom-seal,-f) +define Build/trx + $(STAGING_DIR_HOST)/bin/trx $(1) \ + -o $@ \ + -m $$(($(subst k, * 1024,$(IMAGE_SIZE)))) \ + -f $(IMAGE_KERNEL) \ + -a 4 -f $(IMAGE_ROOTFS) endef -define Build/fonfxcimage - uimage_padhdr -i $@ -o $@.new +define Build/umedia-header + fix-u-media-header -T 0x46 -B $(1) -i $@ -o $@.new && mv $@.new $@ +endef + +define Build/wrg-header + mkwrgimg -i $@ -d "/dev/mtdblock/2" -s $(1) -o $@.new mv $@.new $@ endef -ifeq ($(SUBTARGET),rt288x) -include rt288x.mk -endif +define Build/zyimage + $(STAGING_DIR_HOST)/bin/zyimage $(1) $@ +endef -ifeq ($(SUBTARGET),rt305x) -include rt305x.mk -endif +define Device/Default + PROFILES = Default + KERNEL := $(KERNEL_DTB) | uImage lzma + SOC := $(DEFAULT_SOC) + DEVICE_DTS_DIR := ../dts + DEVICE_DTS = $$(SOC)_$(1) + IMAGES := sysupgrade.bin + SUPPORTED_DEVICES := $(subst _,$(comma),$(1)) + sysupgrade_bin := append-kernel | append-rootfs | pad-rootfs + IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size +endef -ifeq ($(SUBTARGET),rt3883) -include rt3883.mk -endif +define Device/seama + SEAMA_MTDBLOCK := 2 + IMAGES += factory.bin -ifeq ($(SUBTARGET),mt7620) -include mt7620.mk -endif + # 64 bytes offset: + # - 28 bytes seama_header + # - 36 bytes of META data (4-bytes aligned) + IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | append-rootfs + IMAGE/sysupgrade.bin := \ + $$(IMAGE/default) | seama | pad-rootfs | append-metadata | check-size + IMAGE/factory.bin := \ + $$(IMAGE/default) | pad-rootfs -x 64 | seama | seama-seal | check-size + SEAMA_SIGNATURE := +endef -ifeq ($(SUBTARGET),mt7621) -include mt7621.mk -endif +define Device/uimage-lzma-loader + LOADER_TYPE := bin + KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | uImage none +endef -ifeq ($(SUBTARGET),mt76x8) -include mt76x8.mk -endif +include $(SUBTARGET).mk $(eval $(call BuildImage)) From a5720d327671588e5028694b51fbcb30b510ba44 Mon Sep 17 00:00:00 2001 From: Sungbo Eo Date: Sat, 9 May 2020 01:21:06 +0900 Subject: [PATCH 27/29] ramips: tidy up image subtarget Makefiles - use tab indent in image build recipes for consistency - harmonize line wrapping Signed-off-by: Sungbo Eo [use different line wrapping for one recipe] Signed-off-by: Adrian Schmutzler --- target/linux/ramips/image/mt7620.mk | 29 +++----- target/linux/ramips/image/mt7621.mk | 103 ++++++++++++++-------------- target/linux/ramips/image/mt76x8.mk | 6 +- target/linux/ramips/image/rt288x.mk | 4 +- target/linux/ramips/image/rt305x.mk | 47 +++++-------- target/linux/ramips/image/rt3883.mk | 6 +- 6 files changed, 85 insertions(+), 110 deletions(-) diff --git a/target/linux/ramips/image/mt7620.mk b/target/linux/ramips/image/mt7620.mk index 69b9b7d7fd..5e281f307d 100644 --- a/target/linux/ramips/image/mt7620.mk +++ b/target/linux/ramips/image/mt7620.mk @@ -362,8 +362,7 @@ define Device/elecom_wrh-300cr SOC := mt7620n IMAGE_SIZE := 14272k IMAGES += factory.bin - IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - elecom-header + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | elecom-header DEVICE_VENDOR := Elecom DEVICE_MODEL := WRH-300CR DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci @@ -604,8 +603,7 @@ define Device/linksys_e1700 SOC := mt7620a IMAGE_SIZE := 7872k IMAGES += factory.bin - IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - umedia-header 0x013326 + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | umedia-header 0x013326 DEVICE_VENDOR := Linksys DEVICE_MODEL := E1700 SUPPORTED_DEVICES += e1700 @@ -631,8 +629,7 @@ define Device/netgear_ex2700 IMAGES += factory.bin KERNEL := $(KERNEL_DTB) | uImage lzma | pad-offset 64k 64 | \ append-uImage-fakehdr filesystem - IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - netgear-dni + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | netgear-dni DEVICE_VENDOR := NETGEAR DEVICE_MODEL := EX2700 SUPPORTED_DEVICES += ex2700 @@ -646,8 +643,7 @@ define Device/netgear_ex3700 BLOCKSIZE := 4k IMAGE_SIZE := 7744k IMAGES += factory.chk - IMAGE/factory.chk := $$(sysupgrade_bin) | check-size | \ - netgear-chk + IMAGE/factory.chk := $$(sysupgrade_bin) | check-size | netgear-chk DEVICE_PACKAGES := kmod-mt76x2 DEVICE_VENDOR := NETGEAR DEVICE_MODEL := EX3700/EX3800 @@ -661,8 +657,7 @@ define Device/netgear_ex6130 BLOCKSIZE := 4k IMAGE_SIZE := 7744k IMAGES += factory.chk - IMAGE/factory.chk := $$(sysupgrade_bin) | check-size | \ - netgear-chk + IMAGE/factory.chk := $$(sysupgrade_bin) | check-size | netgear-chk DEVICE_PACKAGES := kmod-mt76x2 DEVICE_VENDOR := NETGEAR DEVICE_MODEL := EX6130 @@ -678,8 +673,7 @@ define Device/netgear_wn3000rp-v3 IMAGES += factory.bin KERNEL := $(KERNEL_DTB) | uImage lzma | pad-offset 64k 64 | \ append-uImage-fakehdr filesystem - IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - netgear-dni + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | netgear-dni DEVICE_VENDOR := NETGEAR DEVICE_MODEL := WN3000RP DEVICE_VARIANT := v3 @@ -1152,8 +1146,8 @@ define Device/zyxel_keenetic-omni DEVICE_MODEL := Keenetic Omni DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport IMAGES += factory.bin - IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to 64k | \ - check-size | zyimage -d 4882 -v "ZyXEL Keenetic Omni" + IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to 64k | check-size | \ + zyimage -d 4882 -v "ZyXEL Keenetic Omni" SUPPORTED_DEVICES += kn_rc endef TARGET_DEVICES += zyxel_keenetic-omni @@ -1165,8 +1159,7 @@ define Device/zyxel_keenetic-omni-ii DEVICE_MODEL := Keenetic Omni II DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport IMAGES += factory.bin - IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to 64k | \ - check-size | \ + IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to 64k | check-size | \ zyimage -d 2102034 -v "ZyXEL Keenetic Omni II" SUPPORTED_DEVICES += kn_rf endef @@ -1180,8 +1173,8 @@ define Device/zyxel_keenetic-viva DEVICE_PACKAGES := kmod-usb2 kmod-usb-ohci kmod-usb-ledtrig-usbport \ kmod-switch-rtl8366-smi kmod-switch-rtl8367b IMAGES += factory.bin - IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to 64k | \ - check-size | zyimage -d 8997 -v "ZyXEL Keenetic Viva" + IMAGE/factory.bin := $$(sysupgrade_bin) | pad-to 64k | check-size | \ + zyimage -d 8997 -v "ZyXEL Keenetic Viva" SUPPORTED_DEVICES += kng_rc endef TARGET_DEVICES += zyxel_keenetic-viva diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk index 88db43cb65..082bb31b79 100644 --- a/target/linux/ramips/image/mt7621.mk +++ b/target/linux/ramips/image/mt7621.mk @@ -24,61 +24,61 @@ define Build/custom-initramfs-uimage endef define Build/elecom-gst-factory - $(eval product=$(word 1,$(1))) - $(eval version=$(word 2,$(1))) - ( $(STAGING_DIR_HOST)/bin/mkhash md5 $@ | tr -d '\n' ) >> $@ - ( \ - echo -n "ELECOM $(product) v$(version)" | \ - dd bs=32 count=1 conv=sync; \ - dd if=$@; \ - ) > $@.new - mv $@.new $@ - echo -n "MT7621_ELECOM_$(product)" >> $@ + $(eval product=$(word 1,$(1))) + $(eval version=$(word 2,$(1))) + ( $(STAGING_DIR_HOST)/bin/mkhash md5 $@ | tr -d '\n' ) >> $@ + ( \ + echo -n "ELECOM $(product) v$(version)" | \ + dd bs=32 count=1 conv=sync; \ + dd if=$@; \ + ) > $@.new + mv $@.new $@ + echo -n "MT7621_ELECOM_$(product)" >> $@ endef define Build/elecom-wrc-factory - $(eval product=$(word 1,$(1))) - $(eval version=$(word 2,$(1))) - $(STAGING_DIR_HOST)/bin/mkhash md5 $@ >> $@ - ( \ - echo -n "ELECOM $(product) v$(version)" | \ - dd bs=32 count=1 conv=sync; \ - dd if=$@; \ - ) > $@.new - mv $@.new $@ + $(eval product=$(word 1,$(1))) + $(eval version=$(word 2,$(1))) + $(STAGING_DIR_HOST)/bin/mkhash md5 $@ >> $@ + ( \ + echo -n "ELECOM $(product) v$(version)" | \ + dd bs=32 count=1 conv=sync; \ + dd if=$@; \ + ) > $@.new + mv $@.new $@ endef define Build/iodata-factory - $(eval fw_size=$(word 1,$(1))) - $(eval fw_type=$(word 2,$(1))) - $(eval product=$(word 3,$(1))) - $(eval factory_bin=$(word 4,$(1))) - if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(fw_size)" ]; then \ - $(CP) $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) $(factory_bin); \ - $(STAGING_DIR_HOST)/bin/mksenaofw \ - -r 0x30a -p $(product) -t $(fw_type) \ - -e $(factory_bin) -o $(factory_bin).new; \ - mv $(factory_bin).new $(factory_bin); \ - $(CP) $(factory_bin) $(BIN_DIR)/; \ + $(eval fw_size=$(word 1,$(1))) + $(eval fw_type=$(word 2,$(1))) + $(eval product=$(word 3,$(1))) + $(eval factory_bin=$(word 4,$(1))) + if [ -e $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) -a "$$(stat -c%s $@)" -lt "$(fw_size)" ]; then \ + $(CP) $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) $(factory_bin); \ + $(STAGING_DIR_HOST)/bin/mksenaofw \ + -r 0x30a -p $(product) -t $(fw_type) \ + -e $(factory_bin) -o $(factory_bin).new; \ + mv $(factory_bin).new $(factory_bin); \ + $(CP) $(factory_bin) $(BIN_DIR)/; \ else \ echo "WARNING: initramfs kernel image too big, cannot generate factory image" >&2; \ fi endef define Build/iodata-mstc-header - ( \ - data_size_crc="$$(dd if=$@ ibs=64 skip=1 2>/dev/null | \ - gzip -c | tail -c 8 | od -An -tx8 --endian little | tr -d ' \n')"; \ - echo -ne "$$(echo $$data_size_crc | sed 's/../\\x&/g')" | \ - dd of=$@ bs=8 count=1 seek=7 conv=notrunc 2>/dev/null; \ - ) - dd if=/dev/zero of=$@ bs=4 count=1 seek=1 conv=notrunc 2>/dev/null - ( \ - header_crc="$$(dd if=$@ bs=64 count=1 2>/dev/null | \ - gzip -c | tail -c 8 | od -An -N4 -tx4 --endian little | tr -d ' \n')"; \ - echo -ne "$$(echo $$header_crc | sed 's/../\\x&/g')" | \ - dd of=$@ bs=4 count=1 seek=1 conv=notrunc 2>/dev/null; \ - ) + ( \ + data_size_crc="$$(dd if=$@ ibs=64 skip=1 2>/dev/null | gzip -c | \ + tail -c 8 | od -An -tx8 --endian little | tr -d ' \n')"; \ + echo -ne "$$(echo $$data_size_crc | sed 's/../\\x&/g')" | \ + dd of=$@ bs=8 count=1 seek=7 conv=notrunc 2>/dev/null; \ + ) + dd if=/dev/zero of=$@ bs=4 count=1 seek=1 conv=notrunc 2>/dev/null + ( \ + header_crc="$$(dd if=$@ bs=64 count=1 2>/dev/null | gzip -c | \ + tail -c 8 | od -An -N4 -tx4 --endian little | tr -d ' \n')"; \ + echo -ne "$$(echo $$header_crc | sed 's/../\\x&/g')" | \ + dd of=$@ bs=4 count=1 seek=1 conv=notrunc 2>/dev/null; \ + ) endef define Build/netis-tail @@ -221,8 +221,8 @@ define Device/dlink_dir-860l-b1 BLOCKSIZE := 64k SEAMA_SIGNATURE := wrgac13_dlink.2013gui_dir860lb LOADER_TYPE := bin - KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | \ - relocate-kernel | lzma -a0 | uImage lzma + KERNEL := kernel-bin | append-dtb | lzma | loader-kernel | relocate-kernel | \ + lzma -a0 | uImage lzma IMAGE_SIZE := 16064k DEVICE_VENDOR := D-Link DEVICE_MODEL := DIR-860L @@ -454,8 +454,7 @@ TARGET_DEVICES += iptime_a8004t define Device/jcg_jhr-ac876m IMAGE_SIZE := 16064k IMAGES += factory.bin - IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - jcg-header 89.1 + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | jcg-header 89.1 JCG_MAXSIZE := 16064k DEVICE_VENDOR := JCG DEVICE_MODEL := JHR-AC876M @@ -561,8 +560,7 @@ define Device/netgear_ex6150 NETGEAR_BOARD_ID := U12H318T00_NETGEAR IMAGE_SIZE := 14848k IMAGES += factory.chk - IMAGE/factory.chk := $$(sysupgrade_bin) | check-size | \ - netgear-chk + IMAGE/factory.chk := $$(sysupgrade_bin) | check-size | netgear-chk endef TARGET_DEVICES += netgear_ex6150 @@ -674,11 +672,10 @@ define Device/netgear_wndr3700-v5 IMAGES += factory.img IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \ pad-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size IMAGE/factory.img := pad-extra 320k | $$(IMAGE/default) | \ - pad-to $$$$(BLOCKSIZE) | sercom-footer | pad-to 128 | \ - zip WNDR3700v5.bin | sercom-seal + pad-to $$$$(BLOCKSIZE) | sercom-footer | pad-to 128 | zip WNDR3700v5.bin | \ + sercom-seal DEVICE_VENDOR := NETGEAR DEVICE_MODEL := WNDR3700 DEVICE_VARIANT := v5 diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk index 7700265a33..ba8ab1b747 100644 --- a/target/linux/ramips/image/mt76x8.mk +++ b/target/linux/ramips/image/mt76x8.mk @@ -34,8 +34,7 @@ TARGET_DEVICES += buffalo_wcr-1166ds define Device/cudy_wr1000 IMAGE_SIZE := 7872k IMAGES += factory.bin - IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - jcg-header 92.122 + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | jcg-header 92.122 JCG_MAXSIZE := 7872k DEVICE_VENDOR := Cudy DEVICE_MODEL := WR1000 @@ -178,8 +177,7 @@ define Device/netgear_r6120 IMAGES += factory.img IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE)| append-rootfs | \ pad-rootfs - IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \ - check-size + IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size IMAGE/factory.img := pad-extra 576k | $$(IMAGE/default) | \ pad-to $$$$(BLOCKSIZE) | sercom-footer | pad-to 128 | zip R6120.bin | \ sercom-seal diff --git a/target/linux/ramips/image/rt288x.mk b/target/linux/ramips/image/rt288x.mk index 79a61860b8..eff5a22030 100644 --- a/target/linux/ramips/image/rt288x.mk +++ b/target/linux/ramips/image/rt288x.mk @@ -53,8 +53,8 @@ define Device/belkin_f5d8235-v1 DEVICE_VENDOR := Belkin DEVICE_MODEL := F5D8235 DEVICE_VARIANT := V1 - DEVICE_PACKAGES := kmod-switch-rtl8366s kmod-usb-ohci \ - kmod-usb-ohci-pci kmod-usb2 kmod-usb2-pci kmod-usb-ledtrig-usbport + DEVICE_PACKAGES := kmod-switch-rtl8366s kmod-usb-ohci kmod-usb-ohci-pci \ + kmod-usb2 kmod-usb2-pci kmod-usb-ledtrig-usbport SUPPORTED_DEVICES += f5d8235-v1 endef TARGET_DEVICES += belkin_f5d8235-v1 diff --git a/target/linux/ramips/image/rt305x.mk b/target/linux/ramips/image/rt305x.mk index e90ab630d8..d66f0b3a70 100644 --- a/target/linux/ramips/image/rt305x.mk +++ b/target/linux/ramips/image/rt305x.mk @@ -2,13 +2,13 @@ # RT305X Profiles # define Build/buffalo-tftp-header - ( \ - echo -n -e "# Airstation FirmWare\nrun u_fw\nreset\n\n" | \ - dd bs=512 count=1 conv=sync; \ - dd if=$@; \ - ) > $@.tmp && \ - $(STAGING_DIR_HOST)/bin/buffalo-tftp -i $@.tmp -o $@.new - mv $@.new $@ + ( \ + echo -n -e "# Airstation FirmWare\nrun u_fw\nreset\n\n" | \ + dd bs=512 count=1 conv=sync; \ + dd if=$@; \ + ) > $@.tmp && \ + $(STAGING_DIR_HOST)/bin/buffalo-tftp -i $@.tmp -o $@.new + mv $@.new $@ endef define Build/dap-header @@ -309,8 +309,7 @@ define Device/buffalo_whr-g300n DEVICE_VENDOR := Buffalo DEVICE_MODEL := WHR-G300N IMAGES += tftp.bin - IMAGE/tftp.bin := $$(sysupgrade_bin) | check-size | \ - buffalo-tftp-header + IMAGE/tftp.bin := $$(sysupgrade_bin) | check-size | buffalo-tftp-header SUPPORTED_DEVICES += whr-g300n DEFAULT := n endef @@ -588,8 +587,7 @@ define Device/hilink_hlk-rm04 SOC := rt5350 IMAGE_SIZE := 3776k IMAGES += factory.bin - IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - hilink-header + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | hilink-header DEVICE_VENDOR := Hi-Link DEVICE_MODEL := HLK-RM04 SUPPORTED_DEVICES += hlk-rm04 @@ -643,8 +641,7 @@ define Device/jcg_jhr-n805r SOC := rt3050 IMAGE_SIZE := 3776k IMAGES += factory.bin - IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - jcg-header 29.24 + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | jcg-header 29.24 DEVICE_VENDOR := JCG DEVICE_MODEL := JHR-N805R SUPPORTED_DEVICES += jhr-n805r @@ -656,8 +653,7 @@ define Device/jcg_jhr-n825r SOC := rt3052 IMAGE_SIZE := 3776k IMAGES += factory.bin - IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - jcg-header 23.24 + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | jcg-header 23.24 DEVICE_VENDOR := JCG DEVICE_MODEL := JHR-N825R SUPPORTED_DEVICES += jhr-n825r @@ -669,8 +665,7 @@ define Device/jcg_jhr-n926r SOC := rt3052 IMAGE_SIZE := 3776k IMAGES += factory.bin - IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - jcg-header 25.24 + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | jcg-header 25.24 DEVICE_VENDOR := JCG DEVICE_MODEL := JHR-N926R SUPPORTED_DEVICES += jhr-n926r @@ -755,8 +750,7 @@ define Device/nixcore_x1-16m DEVICE_VENDOR := Nixcore DEVICE_MODEL := X1 DEVICE_VARIANT := 16M - DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-i2c-ralink \ - kmod-spi-dev + DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-i2c-ralink kmod-spi-dev SUPPORTED_DEVICES += nixcore-x1 nixcore-x1-16M endef TARGET_DEVICES += nixcore_x1-16m @@ -767,8 +761,7 @@ define Device/nixcore_x1-8m DEVICE_VENDOR := Nixcore DEVICE_MODEL := X1 DEVICE_VARIANT := 8M - DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-i2c-ralink \ - kmod-spi-dev + DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-i2c-ralink kmod-spi-dev SUPPORTED_DEVICES += nixcore-x1 nixcore-x1-8M endef TARGET_DEVICES += nixcore_x1-8m @@ -778,8 +771,7 @@ define Device/olimex_rt5350f-olinuxino IMAGE_SIZE := 7872k DEVICE_VENDOR := OLIMEX DEVICE_MODEL := RT5350F-OLinuXino - DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-i2c-ralink \ - kmod-spi-dev + DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-i2c-ralink kmod-spi-dev SUPPORTED_DEVICES += rt5350f-olinuxino endef TARGET_DEVICES += olimex_rt5350f-olinuxino @@ -789,8 +781,7 @@ define Device/olimex_rt5350f-olinuxino-evb IMAGE_SIZE := 7872k DEVICE_VENDOR := OLIMEX DEVICE_MODEL := RT5350F-OLinuXino-EVB - DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-i2c-ralink \ - kmod-spi-dev + DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-i2c-ralink kmod-spi-dev SUPPORTED_DEVICES += rt5350f-olinuxino-evb endef TARGET_DEVICES += olimex_rt5350f-olinuxino-evb @@ -1146,8 +1137,7 @@ define Device/vocore_vocore-16m DEVICE_VENDOR := VoCore DEVICE_MODEL := VoCore DEVICE_VARIANT := 16M - DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-i2c-ralink \ - kmod-spi-dev + DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-i2c-ralink kmod-spi-dev SUPPORTED_DEVICES += vocore vocore-16M endef TARGET_DEVICES += vocore_vocore-16m @@ -1158,8 +1148,7 @@ define Device/vocore_vocore-8m DEVICE_VENDOR := VoCore DEVICE_MODEL := VoCore DEVICE_VARIANT := 8M - DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-i2c-ralink \ - kmod-spi-dev + DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-i2c-ralink kmod-spi-dev SUPPORTED_DEVICES += vocore vocore-8M endef TARGET_DEVICES += vocore_vocore-8m diff --git a/target/linux/ramips/image/rt3883.mk b/target/linux/ramips/image/rt3883.mk index a1329c49d5..8f4c22097b 100644 --- a/target/linux/ramips/image/rt3883.mk +++ b/target/linux/ramips/image/rt3883.mk @@ -112,8 +112,7 @@ define Device/trendnet_tew-691gr BLOCKSIZE := 64k IMAGE_SIZE := 7872k IMAGES += factory.bin - IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - umedia-header 0x026910 + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | umedia-header 0x026910 DEVICE_VENDOR := TRENDnet DEVICE_MODEL := TEW-691GR SUPPORTED_DEVICES += tew-691gr @@ -125,8 +124,7 @@ define Device/trendnet_tew-692gr BLOCKSIZE := 64k IMAGE_SIZE := 7872k IMAGES += factory.bin - IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | \ - umedia-header 0x026920 + IMAGE/factory.bin := $$(sysupgrade_bin) | check-size | umedia-header 0x026920 DEVICE_VENDOR := TRENDnet DEVICE_MODEL := TEW-692GR SUPPORTED_DEVICES += tew-692gr From 94f344997769a9a18e2d73574d9d17785828955d Mon Sep 17 00:00:00 2001 From: Lech Perczak Date: Fri, 8 May 2020 00:41:36 +0200 Subject: [PATCH 28/29] ath79: dts: add missing 'serial0' alias for TP-Link TL-MR3040v2 Out of all devices currently supported based on AR9331 chipset, this one had the 'serial0' alias missing. Add it to fix setting of /dev/console and login shell on the onboard UART. Signed-off-by: Lech Perczak --- target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts | 1 + 1 file changed, 1 insertion(+) diff --git a/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts b/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts index 5918e611dd..57cefee819 100644 --- a/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts +++ b/target/linux/ath79/dts/ar9331_tplink_tl-mr3040-v2.dts @@ -11,6 +11,7 @@ compatible = "tplink,tl-mr3040-v2", "qca,ar9331"; aliases { + serial0 = &uart; led-boot = &led_lan; led-failsafe = &led_lan; label-mac-device = ð0; From 02656caa7b3c6da24a1c253b8d28887ab5c1bed1 Mon Sep 17 00:00:00 2001 From: Javier Marcet Date: Sat, 4 Apr 2020 17:50:41 +0200 Subject: [PATCH 29/29] base-files: upgrade: fix indent Use same indent as for the rest of the file. Signed-off-by: Javier Marcet [add commit description] Signed-off-by: Adrian Schmutzler --- package/base-files/files/lib/upgrade/common.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/base-files/files/lib/upgrade/common.sh b/package/base-files/files/lib/upgrade/common.sh index a4de7e1666..c375b70742 100644 --- a/package/base-files/files/lib/upgrade/common.sh +++ b/package/base-files/files/lib/upgrade/common.sh @@ -103,11 +103,11 @@ get_magic_long() { } get_magic_gpt() { - (get_image "$@" | dd bs=8 count=1 skip=64) 2>/dev/null + (get_image "$@" | dd bs=8 count=1 skip=64) 2>/dev/null } get_magic_vfat() { - (get_image "$@" | dd bs=1 count=3 skip=54) 2>/dev/null + (get_image "$@" | dd bs=1 count=3 skip=54) 2>/dev/null } part_magic_efi() {