Skip to content

Commit 46ab9f3

Browse files
Jascha-Sundaresanhauke
authored andcommitted
filogic: add support for Netgear EAX17
Hardware -------- SOC: MediaTek MT7981 RAM: 512MB DDR4 FLASH: 128MB SPI-NAND WIFI: Mediatek MT7915 (integrated) 2x2 802.11ax 2.4 / 5 GHz ETH: Mediatek MT7981 internal 1 GbE PHY UART: 3V3 115200 8N1 (Pinout silkscreened / Do not connect VCC) Installation ------------ 1. Download the OpenWrt initramfs image. Copy the image to a TFTP server 2. Connect the TFTP server to the EAX17. Conect to the serial console, interrupt the autoboot process by pressing '0' when prompted. 3. Download & Boot the OpenWrt initramfs image. $ tftpboot openwrt.bin $ bootm 4. Wait for OpenWrt to boot. Transfer the sysupgrade image to the device using scp and install using sysupgrade. $ sysupgrade -n <path-to-sysupgrade.bin> Signed-off-by: Jascha Sundaresan <[email protected]> Link: openwrt/openwrt#20354 Signed-off-by: Hauke Mehrtens <[email protected]>
1 parent 1748ce8 commit 46ab9f3

File tree

9 files changed

+458
-1
lines changed

9 files changed

+458
-1
lines changed

include/image-commands.mk

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ define Build/initrd_compression
430430
$(if $(CONFIG_TARGET_INITRAMFS_COMPRESSION_ZSTD),.zstd)
431431
endef
432432

433-
define Build/fit
433+
define Build/fit-its
434434
$(if $(findstring with-rootfs,$(word 3,$(1))), \
435435
$(call locked,dd if=$(IMAGE_ROOTFS) of=$(IMAGE_ROOTFS).pagesync bs=4096 conv=sync, \
436436
gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME)))))
@@ -452,12 +452,20 @@ define Build/fit
452452
$(if $(DEVICE_DTS_OVERLAY),$(foreach dtso,$(DEVICE_DTS_OVERLAY), -O $(dtso):$(KERNEL_BUILD_DIR)/image-$(dtso).dtbo)) \
453453
-c $(if $(DEVICE_DTS_CONFIG),$(DEVICE_DTS_CONFIG),"config-1") \
454454
-A $(LINUX_KARCH) -v $(LINUX_VERSION)
455+
endef
456+
457+
define Build/fit-image
455458
$(call locked,PATH=$(LINUX_DIR)/scripts/dtc:$(PATH) mkimage $(if $(findstring external,$(word 3,$(1))),\
456459
-E -B 0x1000 $(if $(findstring static,$(word 3,$(1))),-p 0x1000)) -f $@.its $@.new, \
457460
gen-cpio$(if $(TARGET_PER_DEVICE_ROOTFS),.$(ROOTFS_ID/$(DEVICE_NAME))))
458461
@mv $@.new $@
459462
endef
460463

464+
define Build/fit
465+
$(call Build/fit-its,$(1))
466+
$(call Build/fit-image,$(1))
467+
endef
468+
461469
define Build/libdeflate-gzip
462470
$(STAGING_DIR_HOST)/bin/libdeflate-gzip -f -12 -c $@ $(1) > $@.new
463471
@mv $@.new $@

scripts/gen_netgear_rootfs_node.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/bin/sh
2+
#
3+
# SPDX-License-Identifier: GPL-2.0-or-later
4+
#
5+
# Author: Jascha Sundaresan <[email protected]>
6+
#
7+
# This helper script generates a top-level 'rootfs' node for inclusion
8+
# in a Flattened Image Tree (FIT) source (.its) file. The node includes
9+
# the size and SHA1 hash of a given root filesystem image and is used by
10+
# certain Netgear devices which expect this metadata at the top level of
11+
# the FIT structure.
12+
#
13+
# The resulting block is written to standard output and can be appended
14+
# or inserted into an existing .its file by the OpenWrt build system.
15+
# Example:
16+
# scripts/gen_netgear_rootfs_node.sh build_dir/.../root.squashfs > node.txt
17+
#
18+
# See also: scripts/mkits.sh, which generates the main FIT .its source.
19+
20+
ROOTFS_FILE="$1"
21+
ROOTFS_SIZE=$(stat -c %s "${ROOTFS_FILE}")
22+
ROOTFS_SHA1=$(
23+
sha1sum "${ROOTFS_FILE}" | awk '{ print "<0x" substr($0, 1, 8) \
24+
" 0x" substr($0, 9, 8) \
25+
" 0x" substr($0, 17, 8) \
26+
" 0x" substr($0, 25, 8) \
27+
" 0x" substr($0, 33, 8) ">" }'
28+
)
29+
cat <<EOF | sed 's/^/\t/'
30+
rootfs {
31+
size = <${ROOTFS_SIZE}>;
32+
33+
hash-1 {
34+
value = ${ROOTFS_SHA1};
35+
algo = "sha1";
36+
};
37+
};
38+
39+
EOF
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
From 06e92afca89075628b12c9b4085b4cc7320081ac Mon Sep 17 00:00:00 2001
2+
From: Jascha Sundaresan <[email protected]>
3+
Date: Thu, 23 Oct 2025 03:07:41 +0400
4+
Subject: nvmem: layouts: u-boot-env: add optional "env-size" property
5+
6+
Some devices reserve a larger NVMEM region for the U-Boot environment
7+
than the actual environment data length used by U-Boot itself. The CRC32
8+
in the U-Boot header is calculated over the smaller data length, causing
9+
CRC validation to fail when Linux reads the full partition.
10+
11+
Allow an optional device tree property "env-size" to specify the
12+
environment data size to use for CRC computation.
13+
14+
v2: add missing $ref line to DT binding
15+
16+
Signed-off-by: Jascha Sundaresan <[email protected]>
17+
Reviewed-by: Rob Herring (Arm) <[email protected]>
18+
Signed-off-by: Srinivas Kandagatla <[email protected]>
19+
---
20+
Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml | 7 +++++++
21+
drivers/nvmem/layouts/u-boot-env.c | 4 +++-
22+
2 files changed, 10 insertions(+), 1 deletion(-)
23+
24+
--- a/Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml
25+
+++ b/Documentation/devicetree/bindings/nvmem/layouts/u-boot,env.yaml
26+
@@ -46,6 +46,12 @@ properties:
27+
type: object
28+
description: Command to use for automatic booting
29+
30+
+ env-size:
31+
+ description:
32+
+ Size in bytes of the environment data used by U-Boot for CRC
33+
+ calculation. If omitted, the full NVMEM region size is used.
34+
+ $ref: /schemas/types.yaml#/definitions/uint32
35+
+
36+
ethaddr:
37+
type: object
38+
description: Ethernet interfaces base MAC address.
39+
@@ -104,6 +110,7 @@ examples:
40+
41+
partition-u-boot-env {
42+
compatible = "brcm,env";
43+
+ env-size = <0x20000>;
44+
45+
ethaddr {
46+
};
47+
--- a/drivers/nvmem/layouts/u-boot-env.c
48+
+++ b/drivers/nvmem/layouts/u-boot-env.c
49+
@@ -99,10 +99,12 @@ int u_boot_env_parse(struct device *dev,
50+
uint32_t crc32;
51+
uint32_t calc;
52+
uint8_t *buf;
53+
+ u32 env_size;
54+
int bytes;
55+
int err;
56+
57+
- dev_size = nvmem_dev_size(nvmem);
58+
+ dev_size = device_property_read_u32(dev, "env-size", &env_size) ?
59+
+ nvmem_dev_size(nvmem) : (size_t)env_size;
60+
61+
buf = kzalloc(dev_size, GFP_KERNEL);
62+
if (!buf) {

0 commit comments

Comments
 (0)