backports 7.2 ship the rtw89 USB drivers. Backport four upstream commits
for them from 7.4: the fix for a crash when a device ID is added through
sysfs, the IDs of TP-Link TBE400U and ASUS USB-BE93 for RTL8922AU, and
the shorter RX aggregation hold for RTL8922AU on USB 3.
Tested on a Turris Omnia with RTL8922AU (Cudy BE6500) as AP on 2.4 and
5 GHz, including a probe through a device ID added with new_id.
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26877
Signed-off-by: Robert Marko <robimarko@gmail.com>
backports ship the rtw89 USB drivers, but only RTL8852AU is packaged.
Add the USB variants of RTL8851B, RTL8852B, RTL8852C and RTL8922A.
The chip modules (rtw89_8851b.ko and so on) are shared by the PCI and
the USB variant, so each of them moves to its own hidden package, which
also pulls the firmware, as kmod-rtw89-8852a already does.
kmod-rtw89-8852b-common no longer depends on kmod-rtw89-pci, the module
only needs the core.
Tested on a Turris Omnia with RTL8922AU (Cudy BE6500) as AP on 2.4 and
5 GHz.
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26877
Signed-off-by: Robert Marko <robimarko@gmail.com>
The package installs rtw8852c_fw.bin, the oldest firmware format. The
rtw89 driver asks for rtw8852c_fw-2.bin first and only falls back to the
older files when that one is missing. Ship the file the driver prefers,
so RTL8852CE and the USB variant RTL8852CU run the firmware the driver
is used with elsewhere.
The firmware grows from 1.5 MB to 2.7 MB.
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26877
Signed-off-by: Robert Marko <robimarko@gmail.com>
The package installs rtw8922a_fw.bin, the oldest firmware format. The
rtw89 driver asks for rtw8922a_fw-4.bin first and only falls back to the
older files when that one is missing. Ship the file the driver prefers.
It is also the file RTL8922AU on USB loads in the logs of
morrownr/rtw89#23 and morrownr/rtw89#86.
The firmware grows from 1.5 MB to 1.8 MB.
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26877
Signed-off-by: Robert Marko <robimarko@gmail.com>
On apk systems, sysupgrade -o leaves out every package conffile the
user changed. The conffile list is built with cut -f2, which fits the
opkg status lines with their leading space. The apk conffiles_static
lines start with the path, so field 2 is the checksum. The conffiles
are then treated as plain package files and filtered out.
Print the first field with awk, which gives the path in both formats.
Tested on 25.12.6 and a master snapshot: changed /etc/dnsmasq.conf
and /etc/logrotate.conf are back in sysupgrade -o -l, a modified
package binary stays excluded.
Fixes: 37c5aade23 ("base-files: sysupgrade: -u option was broken with apk")
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
Install busybox-history-file.sh into /usr/lib/profile.d, which
/etc/profile sources for packages, and leave /etc/profile.d to the
administrator. A uci-defaults script removes the copy that sysupgrade
restored into /etc/profile.d when it matches one of the two versions
busybox has shipped; an edited file stays.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
With some SFP modules, including the ProLabs GLC-SX-MMD, the RTL8214FC
can fail to regain link after the fibre cable is reconnected. The module
reports signal again, but the PHY link stays down until the module is
reseated or the fibre receiver is reset.
Schedule a per-port check 500 ms after SFP link-up to allow time for
normal link acquisition. If BMSR reports link down, preserve the latched
indication for phylib and read BMSR again. If the link is still down,
pulse the fibre RX reset bit for 100 ms as in the vendor SDK.
Using delayed work keeps both delays out of the SFP link-up callback.
Cancel the work on link-down, module removal and detach.
Assisted-by: ChatGPT (OpenAI GPT-6.2 Astra)
Link: https://github.com/openwrt/openwrt/pull/26965
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Ship 00-passwordless-root.sh in /usr/lib/profile.d. A system upgraded
with sysupgrade still has the copy its backup restored into
/etc/profile.d, as well as apk-cheatsheet.sh, which commit 07c29c4482
("package: drop apk cheatsheet from base-files") stopped shipping. Add
profile_d_retire() to functions.sh, which removes a file from
/etc/profile.d when its SHA-256 starts with one of the checksums given,
those being the ones a package has shipped, so a file the administrator
has edited stays. A checksum may be shortened, 16 digits are plenty to
tell an edited file apart. Call it for both files from a uci-defaults
script.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
/etc/profile is listed in keep.d/base-files-essential, so sysupgrade
carries it into the new image whether or not it was modified, and an
upgraded system keeps running the profile of the release it was first
installed with. Such a profile never sources /usr/lib/profile.d. Drop
/etc/profile from keep.d and from the conffiles of base-files, leaving
/etc/profile.d as the place for local changes.
The backup is built by the system being upgraded, so the old file still
arrives. Add profile_migrate() to functions.sh, which replaces an
/etc/profile that does not source /usr/lib/profile.d with a pristine
copy. A file matching one of the revisions shipped since 18.06.2, with
the PATH line normalised as that is set at build time, is discarded.
Anything else is saved as /etc/profile.d/profile.legacy, which survives
upgrades but is not sourced: every profile since commit ef2f50829d
("base-files: add /etc/profile.d support") loops over
/etc/profile.d/*.sh and would recurse into itself if it were sourced
from there. A snippet in /usr/lib/profile.d tells the administrator
about the saved file until it is removed.
Call profile_migrate() where an old profile can come back: in preinit
and in sysupgrade -r, both of which keep a copy of the image's file
before extracting the backup, and from a uci-defaults script for the
package manager cases. apk keeps a modified file in /etc and installs
the new one as /etc/profile.apk-new. opkg overwrites a file which is no
longer a conffile and leaves the modified one behind as
/etc/profile-opkg.backup, which is put back first so that both cases
take the same path.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Packages install their login shell snippets into /etc/profile.d, which
base-files lists in its conffiles, so sysupgrade carries every file in
it into the new image, where a restored copy shadows the snippet the
new image ships and a snippet a package has dropped stays for good.
Source /usr/lib/profile.d before /etc/profile.d in /etc/profile to give
packages a directory of their own and leave /etc/profile.d to the
administrator. A file in /etc/profile.d takes the place of the snippet
of the same name in /usr/lib/profile.d, so a packaged snippet is changed
by editing a copy of it there, and a <name>.hush file in /etc/profile.d
silences the snippet of that name in either directory.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
The rkvdec HEVC code reads the reference picture set controls before
it applies the request and beyond the elements userspace passed, lets
sets derived by prediction outgrow their arrays, and rebuilds the
short-term set table only when the first set changes. The VDPU381 back
end, which the RK356x VDPU346 shares, starts the decoder without the
sets, which resets an RK3568, and the VDPU383 back end leaves the
request of a refused job incomplete.
Add the seven fixes of a series pending upstream, the last of which
checks the scratch allocation of the short-term set table.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
The RK3566 and RK3568 carry a VDPU346 video decoder for H.264, HEVC
and VP9, which Linux 6.18 does not drive, so these SoCs have no
hardware HEVC or VP9 decoding.
Add the VDPU346 variant of the rkvdec driver and the RK356x device
tree nodes. The variant shares the VDPU381 back ends of the RK3588,
which gain VP9 support along the way. The patches are a bounds fix
backported from Linux 7.3, pending upstream series, fixes posted
upstream for the interrupt handler and the runtime PM clocks, and own
changes that are being submitted upstream.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Cargo packages get the rustc flags of the build system in
CARGO_TARGET_<TRIPLE>_RUSTFLAGS, the environment form of the
configuration key target.<triple>.rustflags. Cargo joins it with the
entries of that key and of target.<cfg>.rustflags in the
.cargo/config.toml of the sources. ripgrep sets
-Ctarget-feature=+crt-static there for x86_64-unknown-linux-musl, rustc
lets it win over -crt-static, and the static PIE link of rg fails on
the non-PIC libpcre2-8.a.
Pass the flags in RUSTFLAGS. Cargo takes the rustc flags from a single
source and prefers RUSTFLAGS to the target and build keys of the
configuration, so that a target crate is compiled with the flags of
the build system alone. Package builds name the target with --target
or CARGO_BUILD_TARGET, and cargo then keeps RUSTFLAGS off build scripts
and proc macros, also when the target triple is the build host's. A
package that needs a flag from the configuration of its sources adds
it to CARGO_RUSTFLAGS.
Fixes: 32f1c26eb6 ("build: add Rust package build helpers")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Refresh config-6.18 with make kernel_menuconfig. This drops symbols
that are no longer written to the subtarget config:
CONFIG_CC_HAVE_SHADOW_CALL_STACK
CONFIG_CC_HAVE_STACKPROTECTOR_SYSREG
CONFIG_DRM_CLIENT_DEFAULT
CONFIG_DRM_CLIENT_DEFAULT_FBDEV
CONFIG_RAVE_SP_CORE
No functional change intended.
Signed-off-by: Joshua Covington <joshuacov@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26804
Signed-off-by: Robert Marko <robimarko@gmail.com>
Full list of changes, from a clone of
https://github.com/raspberrypi/utils:
git log --oneline ebc4a56bac3a..7e9cdb55b7d7
Install the new rpi-manufacture-info script. On Pi 4 and Pi 5 family
boards, it shows the manufacturing information stored in OTP and
compares the factory RAM size with the board revision. Patch it to
use hexdump instead of od, which the default OpenWrt busybox lacks.
Signed-off-by: Joshua Covington <joshuacov@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26804
Signed-off-by: Robert Marko <robimarko@gmail.com>
Some patches were refreshed, dropped or reverted after exporting from
rpi-6.18.y, which left gaps in the numbering. Rename all patches to
950-NNNN-*.patch, numbered from 0001 in their original order. Patch
contents are not changed.
Signed-off-by: Joshua Covington <joshuacov@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26804
Signed-off-by: Robert Marko <robimarko@gmail.com>
The official Raspberry Pi kernel branch rpi-6.18.y adds support for
RTL8852AU based USB Wi-Fi 6 adapters with commits
06d78c7572d6...3f9bc550f0bf: 24 backported upstream rtw89 commits
(upstream 89acd6c49322 "wifi: rtw89: Add rtw89_core_get_ch_dma_v2()"
up to 8368970b6240 "wifi: rtw89: usb: Support switching to USB 3 mode")
plus a defconfig change enabling CONFIG_RTW89_8852AU.
The driver changes are already present in OpenWrt via backports 7.2, so
no patches need to be carried. Only the packaging is missing, which is
the OpenWrt equivalent of the Raspberry Pi defconfig change:
- add hidden kmod-rtw89-usb (rtw89_usb.ko)
- split rtw89_8852a.ko out of kmod-rtw89-8852ae into a hidden
kmod-rtw89-8852a, so the PCIe and USB variants can share it
(same pattern as kmod-rtw89-8852b-common)
- add kmod-rtw89-8852au (rtw89_8852au.ko)
RTL8852AU uses the same firmware as RTL8852AE (rtw89/rtw8852a_fw.bin),
so kmod-rtw89-8852a depends on rtl8852ae-firmware.
Signed-off-by: Joshua Covington <joshuacov@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26804
Signed-off-by: Robert Marko <robimarko@gmail.com>
Both boards are based on the BCM2711 SoC. Their device trees were
added with the recent rpi-6.18.y patch update. Build them into the
32-bit (bcm2709) and 64-bit (bcm2711) images and add their
compatibles to SUPPORTED_DEVICES.
Neither board has Ethernet, so set wlan0 as the default LAN
interface.
On the Zero 3 W, Wi-Fi does not work yet. Its chip (CYW43436) is a
BCM43430 rev 2 or later, for which brcmfmac requests
brcmfmac43430b0-sdio, as on Zero 2 W boards with the same chip.
Raspberry Pi ships this firmware only in its own firmware package,
not in linux-firmware, so it is not available in OpenWrt yet. The
wlan0 default is already in place for when the firmware is added.
Signed-off-by: Joshua Covington <joshuacov@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26804
Signed-off-by: Robert Marko <robimarko@gmail.com>
These patches were generated from:
https://github.com/raspberrypi/linux/commits/rpi-6.18.y
Patches were generated from the diff between linux kernel branch linux-6.18.y
and rpi-6.18.y from raspberry pi kernel source:
git format-patch -N linux-6.18.y..rpi-6.18.y (HEAD)
(HEAD -> b0b7d2006113562307ade2f6a075b03f3a781346) as of 20261117
"Commit: drm/vc4: Keep the source offset for an async page flip"
Exceptions:
- github workflow patches
- applied and reverted patches
- README patches
- (def)configs
- patches merged upstream
- wireless/wifi patches (net/wireless, net/mac80211 and
drivers/net/wireless are built from the mac80211 backports
package, e.g. rtw89, brcmfmac, cfg80211 regdb certificates)
Patches refreshed against current OpenWrt-kernel.
Add the new CONFIG_VIDEO_IMX678 and CONFIG_VIDEO_SONY_STARVIS2 symbols,
disabled by default, to the generic config.
Signed-off-by: Joshua Covington <joshuacov@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26804
Signed-off-by: Robert Marko <robimarko@gmail.com>
The pse-pd patch 899 no longer refreshes cleanly after d253e623cc
("generic: 6.18: sync MxL862xx DSA switch driver"): make
target/linux/refresh moves its hunks, and CI's "Check Kernel patches
(realtek, rtl838x)" fails on every pull request that builds all kernels.
Refreshed, hunk offsets only.
Signed-off-by: Ville Takio <ville+git@takio.fi>
Link: https://github.com/openwrt/openwrt/pull/26949
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
RTL931x boards with more than 256 MB RAM have the extra memory at
0x90000000, which Linux handles as HIGHMEM. Streaming DMA from
page-cache buffers in that bank returns corrupted file data while
small kmalloc buffers in lowmem are fine. Two explanations were on
the table:
- the host controllers cannot address the second bank. The vendor
kernel gives EHCI and OHCI a 0x3fffffff DMA mask, registers RTL9310
highmem at 0x90000000 with its bus-address conversion disabled
(RTL9300 instead maps highmem through an OCP zone at 0x20000000 and
converts bus addresses), and the stock firmware runs with mem=64M,
so the vendor never DMAs into that bank.
- cache maintenance on HIGHMEM-backed buffers does not reach DRAM
(no IOCU). This has no mechanism behind it; MIPS flushes highmem
pages by physical address like any other page.
A test on a 512 MB S1300WP without this change settles it in favour
of the first: an O_DIRECT read of 64 MB from a USB stick into a
pattern-filled user buffer in HIGHMEM completes without any error but
leaves every byte of the pattern in place, with two different
patterns. The same read into a lowmem buffer (highmem filled up with
tmpfs beforehand) returns the data, and the few megabytes that still
landed in highmem keep the pattern. Nothing else in memory is
disturbed, so the writes are lost rather than aliased.
The device must not be handed addresses above the first bank, and
buffers that already live there have to be copied. Cap device DMA
with a dma-ranges constraint on the soc bus and enable SWIOTLB, so the
kernel bounces such transfers through a small lowmem pool and the
whole RAM stays usable. The pool is sized to 1 MB in code, as the
observed peak under USB storage load was two slabs, and boards without
the second bank allocate none; swiotlb= on the command line still
overrides the size. The platform hook lives in board-realtek.c.
The constraint applies to every child of the bus. The SPI-NAND
controller maps buffers with dma_map_single() and bounces the same
way; the ECC engine allocates with dma_alloc_noncoherent(), which
simply lands inside the window.
Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
Link: https://github.com/openwrt/openwrt/pull/26742
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Add three ubus methods to dnsmasq's existing ubus interface:
- add_lease: inject a DHCP lease (IPv4/IPv6) via ubus
- delete_lease: remove a lease by IP address
- get_leases: enumerate all active leases as JSON
These methods provide ubus parity with dnsmasq's existing D-Bus
AddDhcpLease/DeleteDhcpLease (since v2.73), with improvements:
script suppression for HA setups, hostname validation, correct
IPv6 domain lookup, and lease enumeration (no D-Bus equivalent).
The patch follows the same patterns as the existing ubus metrics
and set_connmark_allowlist methods. ~400 lines, all behind
#ifdef HAVE_DHCP guards.
Also submitted upstream to dnsmasq-discuss. If accepted upstream,
this carried patch can be dropped.
Tested on: OpenWrt 25.12 (x86_64 + filogic), production.
Signed-off-by: Pierre Gaufillet <pierre.gaufillet@bergamote.eu>
Link: https://github.com/openwrt/openwrt/pull/22904
Signed-off-by: Nick Hainke <nick.hainke@posteo.de>
Replace the open callback and file_operations for the RTL839x routes
dump with DEFINE_SHOW_ATTRIBUTE(). The macro provides the same
single_open() wrapper and seq_file operations.
Assisted-by: ChatGPT (OpenAI GPT-6.2 Astra)
Link: https://github.com/openwrt/openwrt/pull/26936
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
RTL931x counts the packets each egress queue drops in a 16 bit counter
per port and queue, which wraps, as RTL930x does. The counters are not
registers but one entry of four words per port in a table of their own.
Add the table and read it into the drop counts of the queues, so an
offloaded TBF or ETS reports its drops as on RTL930x. The counters are
polled by a work that otto_tc_init() sets up, which ran only for the
families with flower offload, so run it on RTL931x as well.
The bytes and packets a root TBF or ETS reports come from the port
statistics, which RTL931x refreshes every 3 seconds, so they lag by as
much as the statistics of the port do.
On an RTL9313 with 400 Mbit/s of UDP offered to a 10G port, a root TBF
of 100 Mbit/s reported 208933 drops where iperf3 counted 208923 lost
datagrams, and 67663 packets sent for 67352 received. A TBF of
100 Mbit/s on the band of the load of an ETS, and the ETS, reported
208938 drops for 208898 lost. Without this change they reported none.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Quinn O'Shea <qoshea@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26935
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Give the TBF offload what it needs on RTL931x: the limiter of the port,
which is the one the egress police uses, and the limiters of the queues
in the egress queue bandwidth table.
The bucket takes the full 16 bit of burst here: unlike on RTL930x, a
burst of 65535 bytes still limits frames of 9018 bytes.
On an RTL9313, a root TBF of 100 Mbit/s held two UDP flows of 200 Mbit/s
to 48.3 and 48.5 Mbit/s and a TCP flow to 95.2 Mbit/s, where without
this change it let all 400 Mbit/s and 9.37 Gbit/s of TCP through. A TBF
of 20 Mbit/s on a band of an ETS held the flow of that band to
19.4 Mbit/s.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Quinn O'Shea <qoshea@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26935
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
The rate limiters of the egress queues of RTL931x are not registers but
one table entry of 29 words per port, behind the fourth table access
register. Add the table so that the switch driver can reach it.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Quinn O'Shea <qoshea@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26935
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
The ETS offload needs one thing from the family: how to write the
weight and the strict bit of a queue. RTL931x has the weight in the same
bits as RTL930x and the strict bit one position higher, in registers of
its own for the ports with eight and with twelve queues.
Add the function, use it for the default weights as well and offer it to
the offload. Port 51 now gets its default weights in its own registers:
the loop wrote them through the set of ports 52 to 55, 48 bytes below
them, which went unnoticed as every default weight is 1.
On an RTL9313 with the egress of a 10G port held to 100 Mbit/s by an
offloaded police and two UDP flows of 200 Mbit/s, one in queue 0 and one
in queue 5, an ETS with strict 2 quanta 6000 5000 4000 3000 2000 1000
gave the flow in queue 5 80.1 Mbit/s and the other 14.9 Mbit/s, and a
strict band took 94.5 Mbit/s against 0.7 Mbit/s. Without this change
both flows got 48 Mbit/s whatever the ETS. A port with eight queues gave
the same.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Quinn O'Shea <qoshea@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26935
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
The RTL930x shaper offload cuts a burst larger than its bucket can hold
without a word, so a TBF that tc shows as offloaded allows smaller
bursts than it asked for and nothing tells why.
Let the family give the largest burst its shapers hold, cut the burst of
a TBF to it where the TBF is set up, and say so once when the TBF is
offloaded with the cut burst. The shaper itself is programmed again
whenever the ETS above a band TBF changes, so it is not the place for
the message.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Quinn O'Shea <qoshea@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26935
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
The family callbacks of the other modules carry the name of their
module, as stat_, vlan_, pie_, lag_ and qos_init do, but the callbacks
the qdisc offloads use do not. Name the ones the families implement in
qos.c qos_queue_sched_set, qos_red_set and qos_queue_drops_update, and
the one in tc.c tc_egress_shaper_set.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Quinn O'Shea <qoshea@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26935
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
In 802.1Q tagger mode, the user-port egress catchalls strip the
outer tag even on frames switched directly between user ports.
This removes customer tags on tagged VLANs and breaks inter-port
ARP resolution.
Limit the downstream tagger's stripping rules to the assigned
management VID and skip them if there is no management VID.
Add a separate pending patch for VLAN-aware untagged egress.
Match the outer customer VID without filtering on the inner TPID,
so mixed 802.1Q/802.1ad frames get their outer tag removed in
both tagger modes.
Fixes: f0204d78e1 ("generic: 6.18: sync MxL862xx DSA switch driver")
Link: https://github.com/openwrt/openwrt/issues/25979
Signed-off-by: Yoshifumi Ko <iedonami@gmail.com>
gemtek_prepare_factory() copies the MT7996 EEPROM out of the vendor
partition through a pipe, so the exit status of the copy is the one of
the second dd. A short read from NAND, as an uncorrectable ECC error can
give, is not noticed, and the blocks that were not read are left as the
zeros the image was filled with. The volume is then written with a
damaged EEPROM and the board loses its Wi-Fi calibration; the MAC
addresses come from the DSD block and are unaffected.
Read the EEPROM into a temporary file of its own, check the read itself
as well as its length, and only then build the image and check its size
and that it starts with the 0x7990 EEPROM magic. If a check fails the
volume is left alone and a later sysupgrade can retry. Both files come
from mktemp, so a failed read cannot pick up a stale one, and mktemp is
added to RAMFS_COPY_BIN because the upgrade runs from the ramfs that
stage2 builds.
This detects a truncated read, not corruption: /dev/mtdX can return the
full length after an uncorrectable ECC error, and damage past the
two-byte magic still passes these checks.
Fixes: 980a7404d7 ("airoha: add support for Gemtek XR1710G")
Suggested-by: Vitaliy Sochnev <sochnev.v.74@gmail.com>
Signed-off-by: Andrey Korshunov <razor1702@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26928
Signed-off-by: Robert Marko <robimarko@gmail.com>
The bcm2712 config enables both RP1 drivers, CONFIG_MFD_RP1 and
CONFIG_MISC_RP1, but only one should be set (raspberrypi/linux#7275).
When the upstream rp1_pci driver can't apply its overlay
("node label 'clk_rp1_xosc' not found"), its probe fails. On 6.18.60
the MFD driver then took over. Since 6.18.61, the backport of
82aa033fef52 ("misc: rp1: clear chained IRQ handlers on teardown")
clears the chained handlers on this error path. On BCM2712 this calls
irq_chip_ack_parent() into the MIP MSI chip, which has no irq_ack, and
the kernel panics at boot:
pc : 0x0
lr : irq_chip_ack_parent+0x1c/0x28
Call trace:
__irq_do_set_handler+0x248/0x24c
irq_set_chained_handler_and_data+0x6c/0x94
rp1_unregister_interrupts+0x3c/0xa8
rp1_probe+0x2ec/0x3c0
Disable CONFIG_MISC_RP1 so that only the MFD driver handles RP1.
Fixes: fe4f62644e ("bcm27xx: drop unused clocks/DMA, enable RP1 overlay on bcm2712")
Link: https://github.com/openwrt/openwrt/pull/26530
Link: https://github.com/raspberrypi/linux/issues/7275
Signed-off-by: Joshua Covington <joshuacov@gmail.com>
On LoongArch the kernel unflattens a device tree even on ACPI systems and
then creates an empty root node without compatible or model. That makes
/sys/firmware/devicetree/base exist, so 01_sysinfo_acpi returned before
writing the DMI based model and board_name, and 02_sysinfo wrote an empty
board_name from the missing compatible.
As a result `ubus call system board` has no board_name or model on QEMU
and on UEFI/ACPI Loongson machines.
Only defer to the generic device tree handling if the tree has a
compatible property.
Link: https://github.com/openwrt/openwrt/pull/26899
Signed-off-by: Paul Spooren <mail@aparcar.org>
The repacked VR9 firmware tarballs store the original packer's uid/gid
(11609555/2222). When the build runs inside a user namespace, e.g. in
rootless Docker containers, restoring that ownership fails with EINVAL
because the uid is not mappable there; GNU tar exits non-zero and the
package build fails.
Restoring the original ownership of these firmware blobs serves no
purpose, so pass --no-same-owner to the tar invocations.
Signed-off-by: Andreas Ziegler <dev@andreas-ziegler.de>
Link: https://github.com/openwrt/openwrt/pull/26943
Signed-off-by: Paul Spooren <mail@aparcar.org>
Linux 6.18.64 carries upstream commit 0f554506a3fc ("driver core: fix
parent lock use-after-free on USB disconnect"), which moved
need_parent_lock from struct bus_type to struct device_type, so
device_schedule_reprobe() fails to build. Update the helper to v4 of
its stand-alone series and let it test need_parent_lock on the device
type.
Link: https://lore.kernel.org/all/4ffa0608d32b6a68e064b41b17b6d35096b9a7fc.1792203271.git.daniel@makrotopia.org/
Fixes: d253e623cc ("generic: 6.18: sync MxL862xx DSA switch driver")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Fixed-HZ targets such as AT91 set CONFIG_HZ without setting a
CONFIG_HZ_<value> choice. The MIPS configuration used for BPF headers
then defaults to 250 Hz, while timeconst.h is generated at the target
frequency. Including linux/jiffies.h fails when those values differ.
Derive the MIPS Kconfig choice from the target CONFIG_HZ value so
both generated headers use the same frequency.
Tested by rebuilding bpf-headers and unetd for AT91 sam9x.
Assisted-by: LLM
Link: https://github.com/openwrt/openwrt/pull/26878
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The PCS ops were chosen at the top of the setup function while the
firmware version was still zero, which selected the legacy SFP API
fallback on every firmware. Update the firmware update and MCUboot
rescue patches to v19 of the series, which sets up the SerDes PCS
instances once the firmware has reported ready and its version has
been read. Rebinding after a flash now goes through the new driver
core helper device_schedule_reprobe(). Backport the upstream stats
poll teardown fix the series builds on.
Fixes: f0204d78e1 ("generic: 6.18: sync MxL862xx DSA switch driver")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
With current driver implement, it's hard to notify the SMP2P driver that
the Q6 remoteproc has restarted and need to re-negotiate.
So here is just a hack to make the restart sequence be able to complete.
Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
Signed-off-by: Robert Marko <robimarko@gmail.com>
The KN-1012 kernel image embeds this U-Boot, and an image builder build
compiles the kernel of every device in the subtarget. With only another
filogic board selected the binary was never built, so the build failed
when the KN-1012 kernel tried to read it.
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
Link: https://github.com/openwrt/openwrt/pull/25757
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
The VisionFive 2 v1.2A's second port (gmac1, eth1, WAN) has a Motorcomm
YT8512 100 Mbit/s RMII PHY on the Generic PHY driver. When the link
partner supports EEE, 100BASE-TX EEE gets negotiated and the link drops
every few seconds while the port transmits: through the DUT's NAT, TCP
upload ran at 0.1-5 Mbit/s and 50-90% of an 80 Mbit/s UDP upload was
lost (openwrt-tests probe_lan.test_speedtest*). With 'ethtool --set-eee
eth1 eee off' the same tests ran at 94 Mbit/s with no link drop, and
turning EEE back on broke it again.
Mark 100BASE-TX EEE as broken for that PHY.
Signed-off-by: Paul Spooren <mail@aparcar.org>
TP-Link TL-ST5008F v2.0 is a managed switch with 8 SFP+ cages, based on
the Realtek RTL9303. This is the Chinese-market unit running firmware
1.0.2 Build 20220311. Its board differs from the TL-ST1008F v2.0.
Specification:
- SoC : Realtek RTL9303
- RAM : 512 MiB
- Flash : SPI-NOR 32 MiB (Winbond W25Q256)
- Ethernet : 8x 10G SFP+ (SoC switch)
1x RJ45 Management port, not supported yet
- LEDs/Keys (GPIO): 1x/0x (no reset button on the front or rear)
- other LEDs : PWR, 8x port LEDs left as the bootloader sets them
- UART : RJ45 console port on the front panel
(micro-USB console port also present, not used)
- settings : 38400n8
- Power : 100-240 VAC, 50/60 Hz, 0.6 A (internal PSU, IEC C14)
Flash instructions:
U-Boot and its environment stay unchanged. It boots the uImage at flash
offset 0x1300000 and ignores bootcmd, so the firmware partition starts
at the stock sys partition and spans sys and usrappfs. The stock usrimg2
and usrimg1 partitions (the stock root filesystems) are concatenated
behind it, which leaves about 23 MiB for the overlay. U-Boot only checks
the first bytes of usrimg1 for a squashfs or JFFS2 header and boots sys
either way. The serial upload below takes about 35 minutes.
1. Connect the console at 38400n8 and power on the switch
2. Press Ctrl+B at the "Hit Ctrl+B" prompt to reach "tplink>"
3. Enter 16 to leave the menu and reach the "RTL9300#" prompt
4. Send the initramfs image over YMODEM and boot it:
loady 0x84f00000
bootm 0x84f00000
5. Insert a module in any cage and connect to 192.168.1.1
6. Back up the u-boot, u-boot-env, fwconcat1, fwconcat0, tp_head and
para partitions off the device. fwconcat0 holds the stock sys and
usrappfs images and fwconcat1 the stock usrimg2 and usrimg1 images;
OpenWrt overwrites both
7. Upload the sysupgrade image and flash it:
sysupgrade -n <sysupgrade image>
Reverting to stock firmware (derived from the layout, not tested yet):
Boot the initramfs as in steps 1 to 4, so that nothing on the flash is
mounted, and write back both dumps saved in step 6:
mtd write fwconcat1.bin fwconcat1
mtd -r write fwconcat0.bin fwconcat0
Notes:
- SFP TX-disable sits on the LED shift chain, so there is no led_set
node and lasers cannot be turned off.
- GPIO3 to GPIO5 are the presence pins for cages 4 to 6. They need
pinmux_disable_spi0 when booted from the U-Boot prompt, as in the
install above, or those cages stay in error. A normal boot without
it was not tested. The flash controller is not affected.
MAC addresses:
LAN : 78:60:5B:xx:xx:xx (para partition, offset 0xfdff4)
label: 78:60:5B:xx:xx:xx (same)
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: John-Michael Mulesa <jmulesa@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26535
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
Gemtek XR1710G, sold by Brightspeed, is an AN7581 Wi-Fi 7 gateway.
It is a close relative of the Gemtek W1700K: the Silabs
Bluetooth/Zigbee radio and the Airoha GPS are gone, and the LEDs of
the two 1 GbE ports are driven by the internal switch PHYs instead of
GPIOs. The device tree shares an7581-gemtek-common.dtsi with
the W1700K and only adds these LEDs and the label MAC.
Specification:
- SoC : Airoha AN7581GT, 4x Cortex-A53
- RAM : 2 GiB DDR4-2666 (ESMT M16U8G16512A)
- Flash : 512 MiB SPI-NAND (Winbond W25N04KV)
- WLAN : MediaTek MT7996 (BE19000) on PCIe
- 2.4 GHz : 4x4, MT7976GN
- 5 GHz : 4x4, MT7977BN
- 6 GHz : 4x4, MT7977AN
- Ethernet : 2x 10 GbE (Realtek RTL8261BE, wan and lan2),
2x 1 GbE (AN7581 internal switch, lan3 and lan4)
- LEDs : 1x status, red/green/blue/white (GPIO),
2x2 lan3/lan4 green/amber (switch PHY)
- Button : reset
- Fan : PWM controlled by a Nuvoton NCT7802 on I2C
- UART : 5-pin header next to the case screw, 115200n8
- pinout : TX, GND, VCC, N/C, RX, starting at the screw
- Power : 12 VDC, 5 A, barrel jack, center positive
- Bootloader: U-Boot 2014.04-rc1 "AXON 1.6", signed, vendor BMT/BBT
The vendor bootloader verifies the image it boots by default and uses
Airoha BMT/BBT for bad block management, which Linux does not know
about. As on the W1700K, a U-Boot chainloader is therefore placed into
the "chainloader" partition (the start of the first vendor firmware
bank), which the vendor bootloader writes and loads, and everything
else lives in UBI, which handles bad blocks itself. The vendor
bootloader and its 66 MiB BMT pool at the end of flash are left alone.
The factory UBI volume holds the MT7996 EEPROM and the MAC addresses.
All of it comes from the vendor partition, which OpenWrt never writes:
the DSD block at 0x400000 holds the MACs, fan_id and the serial number
as text, the EEPROM is in the first good block from 0x405000. When the
volume is missing or holds no valid EEPROM and MACs, as on a new
install, sysupgrade builds it from there before writing the firmware.
The serial number has to match the board, and nothing is written when
the vendor data does not look right.
Installation (via serial console):
1. Open the case: there is a Torx T10 screw under the QR code label,
then pry the grey and white halves apart starting at the ports.
2. Connect to the UART header and interrupt the vendor bootloader with
any key.
3. Make the vendor bootloader boot the chainloader from flash, write
the chainloader with TFTP (server 192.168.1.254), and erase the rest
of the stock firmware. The vendor Ethernet driver is flaky, the
tftpboot may need a few attempts:
setenv serverip 192.168.1.254
setenv ipaddr 192.168.1.1
tftpboot 0x89000000 openwrt-airoha-an7581-gemtek_xr1710g-ubi-chainload-uboot.itb
setenv one flash read 0x600000 0x100000 \$loadaddr
setenv two "; bootm"
setenv bootcmd "$one$two"
saveenv
flash erase 0x600000 0x100000
flash write 0x600000 0x100000 0x89000000
flash erase 0x700000 0x1b700000
reset
The last erase matters: the stock firmware keeps its own UBI in this
area, which the chainloader would otherwise attach and keep.
If tftpboot keeps failing, load the chainloader over the serial
console instead: run "loady 0x89000000" in place of the tftpboot,
send the file with YMODEM (about 30 s at 115200 baud), then go on
with the setenv commands.
4. The chainloader creates UBI in the erased ubi partition with the
ubootenv, ubootenv2 and an empty factory volume, and saves its
environment. With nothing to boot, it lights the blue LED and loads
openwrt-airoha-an7581-gemtek_xr1710g-ubi-initramfs-recovery.itb via
TFTP from 192.168.1.254 until a server answers.
5. In the recovery system (192.168.1.1), copy over the sysupgrade.itb
image and run sysupgrade. It fills the factory volume with the Wi-Fi
calibration data and the MAC addresses from the vendor partition and
installs OpenWrt. The recovery volume is optional; without it, the
chainloader falls back to TFTP when the system does not boot.
6. Further updates use the sysupgrade.itb image.
Reverting to the stock firmware is not documented: the stock firmware
needs an ISP account to be useful.
MAC addresses ("factory" UBI volume):
- WAN : 0x5000 xx:xx:xx:xx:xx:xx
- LAN : 0x6000 xx:xx:xx:xx:xx:xx
- 2.4 GHz : 0x6000 + 1
- 5 GHz : 0x6000 + 2
- 6 GHz : 0x6000 + 3
Known issues:
- The 10 GbE ports (wan and lan2) may come up without link or lose
link: the AN7581 USXGMII PCS sometimes fails RX calibration ("No
FBCK Lock") with the RTL8261BE. The PCS and PHY fixes are being
worked on separately.
Based on the XR1710G support by Kenneth Kasilag (openwrt/openwrt#22397).
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Andrey Korshunov <razor1702@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26296
Signed-off-by: Robert Marko <robimarko@gmail.com>
The Gemtek XR1710G (Brightspeed XR1710G) runs the same AXON vendor
bootloader as the Gemtek W1700K, including its Airoha BMT/BBT
handling, so it needs the same chainloader: the vendor bootloader only
loads this U-Boot from the "chainloader" partition, and all OpenWrt data
lives in UBI, which does its own bad block management.
The parts of the board U-Boot uses (UART, reset button, status LEDs,
SPI-NAND and the flash layout) match the W1700K, so the configuration is
the W1700K one with the names changed, plus:
- CONFIG_PINCONF is replaced by CONFIG_PINCTRL_AIROHA_AN7581, as for the
AN7581 reference board. The W1700K configuration lacks the pin
controller driver, so U-Boot finds neither the reset button nor the
status LEDs there ("LED 'status:red' not found (err=-19)").
- The reset button is read when the chainloader starts. If it is held,
the blue status LED lights up and the recovery image
(openwrt-airoha-an7581-gemtek_xr1710g-ubi-initramfs-recovery.itb) is
booted via TFTP from 192.168.1.254, retrying until a server answers.
This allows recovery without a serial console. The button has to be
pressed after power is applied: held at power-on, it makes the AN7581
boot ROM wait for a UART download instead. The chainloader starts about
15 s after power-on.
- The default menu entry runs boot_ubi instead of boot_production, so a
broken production volume falls back to the recovery volume, and when
neither boots the recovery image is loaded via TFTP until a server
answers. boot_recovery only runs bootm after the recovery volume was
read, so a warm reset cannot boot a stale image left in RAM.
- As on the Nokia boards, a ubi partition that does not attach is
formatted, missing ubootenv, ubootenv2 and factory volumes are
created, and the environment is saved once, so fw_printenv and
fw_setenv work. CONFIG_ENV_SIZE is set to the ubootenv volume size
that uboot-envtools uses. The factory volume holds the Wi-Fi EEPROM
and the MAC addresses and is filled by sysupgrade from the vendor
partition. Created empty here, it lets the kernel fall back to random
MAC addresses instead of deferring the Ethernet probe, so the recovery
image has a working network.
- MMC support is disabled, as on the Nokia boards. The board has no
eMMC, and with the environment in MMC or UBI the saveenv right after a
format went to MMC: when no location holds an environment yet,
env_load() selects the first one.
- The installer variables and menu entry of the W1700K are dropped: the
device is installed by booting the recovery image and running
sysupgrade.
- CONFIG_CMD_ASKENV is enabled, as on the Nokia boards: the TFTP and
recovery menu entries wait for Enter with askenv when they fail. The
W1700K configuration lacks it, so there they print "Unknown command
'askenv'" and return to the menu at once.
Based on the XR1710G chainloader by Kenneth Kasilag.
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Andrey Korshunov <razor1702@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26296
Signed-off-by: Robert Marko <robimarko@gmail.com>
The Gemtek XR1710G is a close relative of the W1700K and shares almost
all of its device tree: flash layout and UBI volumes, MAC addresses,
Wi-Fi, Ethernet, the 10G PHYs, the reset button and the status LEDs.
Move these parts into an7581-gemtek-common.dtsi and keep only
what is specific to the W1700K in its DTS: the GPIO driven lan3/lan4
LEDs, the 10G PHY LEDs and the UARTs of the Bluetooth/Zigbee radio and
the GPS.
While at it, reference the wan_mac cell without an argument: it is a
plain cell, not a "mac-base" one with #nvmem-cell-cells, so the
trailing 0 was invalid and only worked because the nvmem core ignores
it for index 0. Also use generic node names for the Wi-Fi and the BMT
partition, and sort the status LEDs by GPIO (white 20 before red 29),
which swaps the led-2 and led-3 node names. The resulting devicetree
is otherwise unchanged.
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Andrey Korshunov <razor1702@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26296
Signed-off-by: Robert Marko <robimarko@gmail.com>