Skip to content

mediatek: add OpenWrt (U-Boot layout) for Cudy WR3000P v1 + add common ATF DDR4 target#21339

Closed
stavultras wants to merge 550 commits intoopenwrt:mainfrom
stavultras:cudy-wr3000p-v1-ubootmod
Closed

mediatek: add OpenWrt (U-Boot layout) for Cudy WR3000P v1 + add common ATF DDR4 target#21339
stavultras wants to merge 550 commits intoopenwrt:mainfrom
stavultras:cudy-wr3000p-v1-ubootmod

Conversation

@stavultras
Copy link
Copy Markdown
Contributor

@stavultras stavultras commented Dec 31, 2025

This PR adds OpenWrt (U-Boot layout) for the Cudy WR3000P v1 device. (recreated from #21285 due to some merge conflicts with #21225)

The changes are split into 2 commits:

  1. Add a common Cudy DDR4 ATF target
  2. Add support for the ubootmod flash layout.

This structure allows reuse of the ATF target for other similar Cudy devices with DDR4 RAM.

Tested: by 4pda users and #21285 (comment)

@github-actions github-actions bot added core packages pull request/issue for core (in-tree) packages target/mediatek pull request/issue for mediatek target labels Dec 31, 2025
@stavultras stavultras force-pushed the cudy-wr3000p-v1-ubootmod branch from f6487be to de23ac7 Compare December 31, 2025 19:25
@sepich
Copy link
Copy Markdown

sepich commented Jan 4, 2026

I can confirm, this increases available ROM from vanilla 44mb to 95mb:

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
/dev/root                 4.8M      4.8M         0 100% /rom
tmpfs                   242.9M    236.0K    242.6M   0% /tmp
/dev/ubi0_1              95.2M     44.0K     90.4M   0% /overlay
overlayfs:/overlay       95.2M     44.0K     90.4M   0% /
tmpfs                   512.0K         0    512.0K   0% /dev

Thanks!

@stavultras
Copy link
Copy Markdown
Contributor Author

@aiamadeus @hauke please review whenever you have time. Thanks.

@fildunsky
Copy link
Copy Markdown
Contributor

Please add WR3000S ubootmod layout here as another commit inside this PR. I've just flashed your ubootmod firmware for WR3000S, and it works perfectly!

GeorgeSapkin and others added 22 commits February 9, 2026 02:28
DESCRIPTION field has been deprecated since 2007, yet internal exporting
causes intermittent package build failures due to the deprecation check,
even with packages that don't have that fields set. Replace all
DESCRIPTION exports with alternative variables defined through shexport
and shvar helpers and remove the check.

Fixes: 547b127 ("make kernel module packaging code reusable and use it in madwifi")
Fixes: 7558f02 ("DESCRIPTION:= is obselete, so complain if it is used and use TITLE if no description is set")
Fixes: cc43532 ("build: optimize target metadata dump")
Fixes: d081edf ("build: clean up and optimize ipkg control generator code")
Signed-off-by: George Sapkin <george@sapk.in>
Link: #21668
Signed-off-by: Robert Marko <robimarko@gmail.com>
There is a misunderstanding about BIT(7) aka EX_PHY_MAN_24_27 in
SMI_GLB_CTRL register. The SDK sets/clears it at different places and
it is not clear what it is for. Observation shows that it is essential
for a working MAC_LINK_MEDIA_STS register.

A RTL838x device has usally two configurations

- port 24/26 are 2 serdes driven fiber ports
- port 24-27 are 4 PHY driven combo ports

In the combo case the above bit must be set so that a switch between
copper and fiber can be detected. Cleanup the MDIO initialization
and remove the unneeded bit handling in the DSA driver.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: #21653
Signed-off-by: Robert Marko <robimarko@gmail.com>
Bit 11 of registers 16, 19, 20, 21 in page 0x266 denotes if a port
of a RTL8214FC is set/favoured to fibre (0) or copper (1). For unknown
reasons the bit was mixed with BMCR_PDOWN. Convert this to a meaningful
define.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: #21582
Signed-off-by: Robert Marko <robimarko@gmail.com>
Changing the fibre/copper power of a RTL8214FC changes the
extended page via register 29. This is the write only companion
of register 30. The register is afterwards overwritten to 0.

Use the proper extended page register 30 and preserve its content
during the operation.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: #21582
Signed-off-by: Robert Marko <robimarko@gmail.com>
There are some shortcomings in rtl8214fc_media_set()

- It always uses the mdio raw page (4095) of RTL838x for writes.
  That is wrong when the phy is attached to an RTL839x (raw = 8191)
- It uses the internal write only extended page companion (29)
- The extended page content is not preserved

Fix the three issues.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: #21582
Signed-off-by: Robert Marko <robimarko@gmail.com>
A phy is configured in two stages

- phy_probe() for setup of structures
- config_init() for device setup (after reset)

RTL8214FC is a combo phy and the currently active port can be switched
with the SFP helper functions that are triggered during SFP insertion
and removal. In case a fibre SFP is inserted while booting the SFP
trigger is run between the above mentioned stages. During the final
setup in config_init() the phy is reset to the copper port. Thus no
link is available on fibre and the SFP must be reinserted for normal
operation.

For a consistent behaviour the fibre/copper port setup must run before
the SFP probing and not afterwards. Move the setup code from config_init()
into phy_probe().

Fixes: 10ae743 ("realtek: phy: simplify RTL8214FC configuration")
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: #21582
Signed-off-by: Robert Marko <robimarko@gmail.com>
The Gemini reference design-derived devices uses a partition
format which is predictable and we can exploit this to offer
some proper upgrade path.

The kernel for these contains a hack to use this partition
format unaltered by combining the partitions "Kern" and "Ramdisk"
to one image with all of the kernel+ramdisk in memory.

Then the "Application" which is used for the rootfs go into its
own partition.

Standard flash layout:
Kern         2048k |
Ramdisk      6144k | = 9216k
Application  6144k | = 15360k

Following the pattern of the factory image we create three
images named zImage, rd.gz and hddapp.tgz (these filenames
are misleading! They are just required by the old firmware.)
and flash each individually with "mtd" during upgrades.

Since the IB-4220-V has a different layout with a bigger kernel
space we parameterize this so we can handle this too. (More
fixes are needed for that device though.)

A way to upgrade older OpenWrt on these platforms to the latest
and greatest will be to copy the file
target/linux/gemini/base-files/lib/upgrade/platform.sh
to /lib/upgrade/platform.sh
on your running system and then run sysupgrade from the image
produced after this patch.

The script is picky to sanity check the partitions before
commencing upgrade.

This was tested with a full sysupgrade on the iTian SQ201.

Link: #21680
Signed-off-by: Linus Walleij <linusw@kernel.org>
Any ftpd package such as vsftpd or atftpd (are there others?) should
create their own unprivileged user. Both of the aforementioned
packages do not even use this ftp user and run as root. That should be
addressed in separate commits.

Signed-off-by: John Audia <therealgraysky@proton.me>
Link: #19418
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Keenetic devices always use the WAN port MAC address as
the MAC address printed on the label.

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
Link: #21635
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
In the original DTS from the device firmware, there are
no entries that enable SPI calibration. Therefore, it
should be disabled.

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
Link: #21635
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This is a cosmetic change. There is no need to use mac
address increment/decrement in the dts on these devices,
so this can be simplified.

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
Link: #21635
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The indicator is unused by default and not associated
with the wan port. So let’s fix this.

Signed-off-by: Maxim Anisimov <maxim.anisimov.ua@gmail.com>
Link: #21635
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
KERNEL_DCB was introduced in 40f1db9, however the dcb utility is not
enabled for iproute2. Although DCB is not generally available among
Ethernet cards, not having the dcb utility renders it completely
unchangeable.

On aarch64, it takes ~85.3KiB.

Signed-off-by: David Yang <mmyangfl@gmail.com>
Link: #21606
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The `syn_flood` option name is deprecated, `synflood_protect` should
be used instead. firewall3 and firewall4 both support this option since
a long time. LuCI already replaces the option name.
openwrt/luci@0abcb39

Suggested-by: rparge in OpenWrt forum
Link: #21642
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.12.67

Manually rebased:
  rockchip/patches-6.12/160-01-phy-rockchip-inno-usb2-Simplify-rockchip-usbgrf-handling.patch

Build system: x86/64
Build-tested: flogic/glinet_gl-mt6000
Run-tested: flogic/glinet_gl-mt6000

Signed-off-by: John Audia <therealgraysky@proton.me>
Link: #21629
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This allows builds for Bananapi R4 (Pro) with 8GB RAM.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Link: #21437
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This allows builds for Bananapi R4 (Pro) with 8GB RAM.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Link: #21437
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Add builds for Bananapi R4 with 8GB RAM.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Link: #21437
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Add command which gets ramsize and write it to env variable.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Link: #21437
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Add check for 8g and replace filename for bl2 to install the right file.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Link: #21437
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Introduce preemption model selection with PREEMPT_NONE as the default.
PREEMPT_NONE is the traditional Linux preemption model and also the best
choice for servers.

Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
Link: #21413
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Layerscape currently uses the PREEMPT model, which is not aligned with
OpenWrt's default. Switch to PREEMPT_NONE for consistency with
OpenWrt's default configuration. Preemption model selection is now
available via menuconfig for further customization.

Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
Link: #21413
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
@github-actions github-actions bot added target/sunxi pull request/issue for sunxi target target/x86 pull request/issue for x86 target target/ipq40xx pull request/issue for ipq40xx target target/pistachio pull request/issue for pistachio target target/ath79 pull request/issue for ath79 target target/malta pull request/issue for malta target target/imagebuilder pull request/issue for imagebuilder target target/gemini pull request/issue for gemini target target/tegra pull request/issue for tegra target target/rockchip pull request/issue for rockchip target target/realtek pull request/issue for realtek target target/bmips pull request/issue for bmips target GitHub/CI pull requests/issues for GitHub, CI and related stuff target/qoriq pull request/issue for qoriq target target/uml pull request/issue for uml target target/airoha pull request/issue for airoha target target/armsr pull request/issue for armsr target target/sifiveu pull request/issue for sifiveu target target/qualcommax pull request/issue for qualcommax target target/d1 pull request/issue for d1 target target/starfive pull request/issue for starfive target target/loongarch64 pull request/issue for loongarch64 target target/siflower pull request/issue for siflower target target/ixp4xx pull request/issue for ixp4xx target target/stm32 pull request/issue for stm32 target target/qualcommbe pull request/issue for qualcommbe target target/econet pull request/issue for econet (MIPS) target target/microchipsw labels Feb 9, 2026
@stavultras
Copy link
Copy Markdown
Contributor Author

Made a mistake git pull and git push

@stavultras stavultras deleted the cudy-wr3000p-v1-ubootmod branch February 9, 2026 07:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build/scripts/tools pull request/issues for build, scripts and tools related changes core packages pull request/issue for core (in-tree) packages GitHub/CI pull requests/issues for GitHub, CI and related stuff kernel pull request/issue with Linux kernel related changes target/airoha pull request/issue for airoha target target/apm821xx pull request/issue for apm821xx target target/armsr pull request/issue for armsr target target/at91 pull request/issue for at91 target target/ath79 pull request/issue for ath79 target target/bcm27xx pull request/issue for bcm27xx target target/bcm47xx pull request/issue for bcm47xx target target/bcm53xx pull request/issue for bcm53xx target target/bmips pull request/issue for bmips target target/d1 pull request/issue for d1 target target/econet pull request/issue for econet (MIPS) target target/gemini pull request/issue for gemini target target/imagebuilder pull request/issue for imagebuilder target target/ipq40xx pull request/issue for ipq40xx target target/ipq806x pull request/issue for ipq806x target target/ixp4xx pull request/issue for ixp4xx target target/kirkwood pull request/issue for kirkwood target target/lantiq pull request/issue for lantiq target target/layerscape pull request/issue for layerscape target target/loongarch64 pull request/issue for loongarch64 target target/malta pull request/issue for malta target target/mediatek pull request/issue for mediatek target target/microchipsw target/mpc85xx pull request/issue for mpc85xx target target/mvebu pull request/issue for mvebu target target/mxs pull request/issue for mxs target target/octeon pull request/issue for octeon target target/omap pull request/issue for omap target target/pistachio pull request/issue for pistachio target target/qoriq pull request/issue for qoriq target target/qualcommax pull request/issue for qualcommax target target/qualcommbe pull request/issue for qualcommbe target target/ramips pull request/issue for ramips target target/realtek pull request/issue for realtek target target/rockchip pull request/issue for rockchip target target/sifiveu pull request/issue for sifiveu target target/siflower pull request/issue for siflower target target/starfive pull request/issue for starfive target target/stm32 pull request/issue for stm32 target target/sunxi pull request/issue for sunxi target target/tegra pull request/issue for tegra target target/uml pull request/issue for uml target target/x86 pull request/issue for x86 target

Projects

None yet

Development

Successfully merging this pull request may close these issues.