Commit Graph
72426 Commits
Author SHA1 Message Date
John Audia 9ea2ee3974 kernel: bump 6.18 to 6.18.59
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.18.59

Removed upstreamed:
  linux/generic/backport-6.18/950-v7.3-cgroup-fix-spurious-SIGKILL-of-CLONE_INTO_CGROUP-children.patch[1]
  linux/bcm27xx/patches-6.18/0783-drm-vc4-hdmi-Move-packet-RAM-enable-to-pm_runtime.patch[2]
  linux/qualcommax/patches-6.18/0092-v7.3-pinctrl-qcom-ipq5018-add-missing-pwm3-function-on-gpio13.patch[3]

All other patches automatically rebased via update_kernel.sh

Linux 6.18.59 makes ICE select LIBETH_XDP, so add kmod-libeth-xdp
to package libeth_xdp.ko and make kmod-ice depend on it.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.59&id=2f9dd8214d4213cac785e4e4441538053cce52fb
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.59&id=6b03e354526f6bad60ed3a7f08fec8b7d29d2f27
3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.59&id=e76e6284de2ba2c0da9aa21ab4e17a885186a4b2

Build system: x86/64
Build-tested: x86/64-glibc
Run-tested: x86/64-glibc

Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/25925
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-10-31 23:24:46 +01:00
John Audia 350501f839 kernel: bump 6.18 to 6.18.58
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.18.58

All patches automatically rebased via update_kernel.sh

Build system: x86/64
Build-tested: x86/64-glibc
Run-tested: x86/64-glibc

Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/25925
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-10-31 23:24:46 +01:00
John Audia fb7bd8633b kernel: bump 6.18 to 6.18.57
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.18.57

Removed upstreamed:
  linux/generic/backport-6.18/948-v7.1-net-dsa-mt7530-fix-.get_stats64-sleeping-in-atomic-c.patch[1]
  linux/rockchip/patches-6.18/045-15-v7.0-media-v4l2-mem2mem-Add-a-kref-to-the-v4l2_m2m_dev-structure.patch[2]
  linux/rockchip/patches-6.18/045-16-v7.0-media-verisilicon-Avoid-G2-bus-error-while-decoding-H.264-an.patch[3]
  linux/rockchip/patches-6.18/045-43-v7.0-media-verisilicon-Fix-kernel-panic-due-to-__initconst-misuse.patch[4]

Manually rebased:
  linux/generic/backport-6.18/706-03-v7.2-netfilter-flowtable-bail-out-if-forward-path-cannot-b.patch
  linux/generic/pending-6.18/151-net-bridge-do-not-send-arp-replies-if-src-and-target.patch
  linux/bcm27xx/patches-6.18/0319-drivers-iommu-Add-BCM2712-IOMMU.patch
  linux/bcm27xx/patches-6.18/0351-brcmfmac-Fix-interoperating-DPP-and-other-encryption.patch

All other patches automatically rebased via update_kernel.sh

mac80211: 6.18.57 backports struct sockaddr_unsized[5], so add
160-backports-sockaddr_unsized-is-in-6.18.57.patch to only define it
in backports for older kernels.

kernel: 6.18.57 makes rpcsec_gss_krb5 use crypto/krb5[6], so add
kmod-crypto-krb5 and make kmod-fs-nfs-common-rpcsec depend on it.

ltq-ifxos: 6.18.57 converts proto_ops bind() to sockaddr_unsized[5],
so cast the bind address accordingly on 6.18.57+.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.57&id=af98611ad109efcbfe3ba68eb10124ebc3257224
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.57&id=6c5d98f24f99596c0075c05d17b099d298f0246b
3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.57&id=5133ef7c893c2c3aee7dd12503dc480de9dbfbb5
4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.57&id=07861e84b766c6db8014bc34138f3be4a62aad2a
5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.57&id=946dc5835c8fbe5eb5ceb13f5717778911ff4586
6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.57&id=08efba8d6256053ac1f2fabd2b7b2ac60ab97aae

Build system: x86/64
Build-tested: x86/64-glibc
Run-tested: x86/64-glibc

Co-developed-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/25925
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-10-31 23:24:46 +01:00
John Audia a1b5d54cf9 kernel: bump 6.18 to 6.18.56
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.18.56

Removed upstreamed:
  linux/generic/backport-6.18/438-v7.3-mtd-spinand-Do-not-update-the-QE-bit-on-devices-without-one.patch[1]
  linux/generic/backport-6.18/782-v7.3-USB-serial-option-add-Quectel-EG060W.patch[2]
  linux/generic/backport-6.18/787-v7.3-net-usb-qmi_wwan-add-Quectel-EG120K-EA.patch[3]
  linux/bcm27xx/patches-6.18/0008-of-overlay-Correct-symbol-path-fixups.patch[4]

Manually rebased:
  linux/generic/pending-6.18/304-LoongArch-vdso-keep-the-prefix-map-flags.patch
  linux/bcm27xx/patches-6.18/0110-bcmgenet-Better-coalescing-parameter-defaults.patch

All other patches automatically rebased via update_kernel.sh

Add CC_OPT_ to config-filter for the new CONFIG_CC_OPT_INLINE_MEMSET.

1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.56&id=1a62eb293f60a3b761786ee35534c4061231b10c
2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.56&id=8b495843267b93bc1b395d51f929bcb1f97f84ba
3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.56&id=626deff23b544ae4384b3e25580e1ec254808e59
4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.18.56&id=b8cbeda043e479b2e83019e18b1609f2f5e44fd7

Build system: x86/64
Build-tested: x86/64-glibc
Run-tested: x86/64-glibc

Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/25925
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2026-10-31 23:24:45 +01:00
Markus Stockhausen 1c763084f1 realtek: dsa: use the otto_stp function namespace
Rename all functions in stp.c and stp.h to the otto_stp_ namespace,
including the four family-specific setters. Update the DSA callbacks,
bridge join/leave paths, debugfs, VLAN users and family configuration
tables together with the declarations and documentation.

Name hardware slot management helpers otto_stp_slot_* and the shared
port state helper otto_stp_port_slot_state_set. Retain mst only in
otto_stp_port_mst_state_set to distinguish the MST callback from the
ordinary port state callback. Keep protocol fields, external API member
names and the existing MST slot structure unchanged.

This is a naming cleanup with no functional changes.

Assisted-by: ChatGPT (OpenAI GPT-6 Astra)
Link: https://github.com/openwrt/openwrt/pull/26333
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-31 23:18:23 +01:00
Markus Stockhausen 368ddb3df2 realtek: dsa: rename VLAN profile type to otto_vlan_profile
Rename the VLAN profile structure and all references, including
family-specific helpers, compound literals, the configuration callback
and debugfs. Keep the structure layout and behavior unchanged.

Assisted-by: ChatGPT (OpenAI GPT-6 Astra)
Link: https://github.com/openwrt/openwrt/pull/26333
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-31 23:18:23 +01:00
Carlo Szelinsky 7eb9f10a83 realtek: dsa: write a router MAC entry whole
otto_l3_alloc_router_mac() scans the table for a free or matching row
with one struct, which cfg->get_router_mac() fills in on every pass, and
then sets the fields of the entry it wants on top of whatever the last
row it read left behind. p_mask is never among them.

On the RTL930x that field is not programmed, so nothing came of it. It
is part of the RTL931x row, and a leftover 1 there makes the port type a
part of the key the entry matches on instead of a don't care. Nothing
clears L3_ROUTER_MAC during setup, so the row the scan ends on can hold
whatever the bootloader left.

Assign the whole struct instead of nine of its ten fields. Zeroing it at
its declaration would not do: the scan runs after that and overwrites it
in full.

Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
Link: https://github.com/openwrt/openwrt/pull/26247
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-31 19:33:01 +01:00
Carlo Szelinsky 1c58daa6c5 realtek: otto_table: the RTL9310 route tables span 16384 addresses
The row count in a table descriptor is the address space the table
spans, not the number of entries it holds, and the two differ wherever a
table implements only part of its addresses. Both RTL9310 route tables
implement six of every eight, so the SDK's 12288 entries sit at 16384
addresses - which is also the whole of the access register's 14 bit
address field.

The RTL9300 host route table is the same conversion already made in this
array: 6144 entries in the SDK's metadata against the 8192 recorded
here. Reading the RTL9300 row counts as entry counts is what made 12288
look right, and that is the one cross-check the commit below offered as
evidence the array was being read correctly.

It is not harmless. otto_table_index_ok() bounds the address a caller
passes, so a table short by a quarter refuses every access at 12288 and
above with -EINVAL and a WARN_ONCE, and hands back a zero filled buffer.
Nothing reaches that far yet - the driver uses hash table 0, whose
addresses stop at 8189 - but it is what the second hash table would need.

Fixes: 6c9452a35b ("realtek: otto_table: add the RTL9310 L3 table descriptors")
Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
Link: https://github.com/openwrt/openwrt/pull/26247
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-31 19:33:01 +01:00
Carlo Szelinsky 74ca8f0ee3 realtek: dsa: do not report a route with no switch port as an error
Commit 9154fd858f ("realtek: dsa: do not call a route left to the CPU a
failure") stopped the FIB worker shouting about a route the driver
deliberately leaves to the CPU, but the same boot says it twice more
from inside otto_l3_fib_add_v4(): a nexthop device with no switch port
under it is reported with dev_err before the destination is handed the
trapping row that was always the plan for it.

Same normal outcome, same treatment.

Signed-off-by: Carlo Szelinsky <github@szelinsky.de>
Link: https://github.com/openwrt/openwrt/pull/26247
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-31 19:33:01 +01:00
Daniel Golle feb8ac5e7e rockchip: enable the RV1126 RGA
The RGA node of the RV1126 was added disabled, and no board enables
it, so the rockchip-rga module loads without a device to bind. The
engine has no pins or external interfaces, so like the RGA nodes of
the other Rockchip SoCs it carries no status property and is enabled
by the SoC dtsi. The driver binds through the rk3288-rga fallback
compatible of the node; the dts patches that follow the node are
re-contexted.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-31 10:52:53 +00:00
Daniel Golle 25835fd97e rockchip: add the RV1126 ISPP driver
Add the image post-processing unit behind the RV1126 ISP 2.0, which
applies temporal noise reduction, noise reduction, sharpening and
scaling to the YUV422 output of the ISP:

 - 184-01: the ISPP params blocks (TNR, NR, SHP, FEC, ORB) and stats
   blocks (ORB points, FEC motion mesh) in the rkisp2 uapi header, in
   the extensible V4L2 ISP block format, and the FEC request structure.
 - 184-02 and 184-03: the ISPP output port of the ISP binding, and the
   ISPP binding with its two interrupts, three clocks, power domain and
   reserved memory region.
 - 184-04: the ISP pipe mode: the mainpath writes every frame as YUV422
   plus a gain map into a buffer pool the ISPP owns, through a new
   output pad whose width is a multiple of 16 pixels.
 - 184-05: the driver: a subdev with input, output, params and stats
   pads, one video device per output (the module bypass with NV12 and
   NV12M, three scalers), the II input, the params and stats devices
   and a debugfs node.
 - 184-06: the stand-alone FEC mem2mem node behind its own Kconfig
   option, sharing the core with the pipeline.
 - 184-07: the ISPP node, its IOMMU, the PD_ISPP power domain with its
   QoS nodes and the ISP to ISPP link in the SoC dtsi.

Add the kmod-video-rockchip-ispp package.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-31 10:52:53 +00:00
Daniel Golle ab8f8fa7f8 rockchip: rework the RV1126 ISP 2.0 series ahead of the ISPP
Replace the stack of fixes on top of the rkisp2 driver with the series
as it goes upstream, which the ISPP builds on:

 - 181-11: document that the ISP 2.0 colour gain registers hold 10 bits,
   so AWB gains from 4 upwards wrap.
 - 181-12: patch 185, the preserved capture stride, renumbered into the
   rkisp2 fix series.
 - 181-13: stop a readback-fed capture directly when the readback
   channels are idle, as no frame end follows the last raw buffer; the
   stop used to run into its one second timeout every time.
 - 182-04: describe only the ISP 2.0 node with its IOMMU and CMA region;
   the ISPP node and the PD_ISPP QoS nodes move to the ISPP series. The
   rkvenc and OTP dts patches follow the moved QoS nodes.
 - 182-06: rework the VICAP feed: readback start, stop and queueing in
   helpers, the VICAP subdevice bound through an async notifier, the
   readback input selected before the first trigger, and a raw readback
   register dump in debugfs.
 - 182-07: the readback restart as its own patch: a stream whose second
   readback frame does not complete within 400 ms is stopped and
   restarted, up to four attempts.
 - 182-08: the AWB means patch renumbered; 182-05 is refreshed.

All patches carry the sign-off.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-31 10:52:53 +00:00
Daniel Golle bf610ebb84 rockchip: rkvenc: retry a frame whose bitstream overflowed
A job whose bitstream overflows the capture buffer counts as a
hardware fault: two in a row put both queues into error and end the
stream. The rate controller reaches that state on its own whenever a
few dark frames drive the QP to the floor and the next bright frame
no longer fits, which a start into a sunlit scene does on every other
attempt even with the step limiter fixed.

Handle the overflow as the rate-control event it is: force clear, feed
the controller the buffer size as the frame size, restart that frame
type from its control QP and run the same frame again while the job
stays running for the mem2mem framework, so user space sees one late
frame and no dropped one. An IDR that carried the joined parameter
sets carries them again on the retry. A frame that overflows twice is
a fault as before, and the consecutive error count stays with the bus
errors, the hardware watchdog and the job timeout. A timed out job
clears the latched status before it starts so that it is never taken
for an overflow.

Fixes: 64129c4282 ("rockchip: add the RKVENC H.264 and HEVC encoder")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-31 10:52:53 +00:00
Daniel Golle feeb032824 rockchip: rkvenc: evaluate the encoder clock once per round
The devfreq governor runs at every job end over the busy time since
the previous evaluation. With two encoder contexts of different sizes
the load alternates between the two jobs and the governor flips the
clock on every single job, 63 times a second between 500 and 594 MHz
for a 4K and a 720p stream.

Run the governor once per round of the streaming contexts: a job end
evaluates when the context that opened the round completes again, so
the load covers one job of every context and the clock settles at the
lowest point that sustains all of them together. A context that stops
streaming or closes releases the round it opened.

Fixes: 64129c4282 ("rockchip: add the RKVENC H.264 and HEVC encoder")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-31 10:52:53 +00:00
Daniel Golle 4d88332bc4 rockchip: rkvenc: keep the QP step limiter signed
rkvenc_rc_pick() limits the QP change per frame to RKVENC_RC_QP_STEP,
an unsigned constant, while the previous QP is a signed value. Below a
previous QP of 4 the subtraction wraps, the lower bound test always
succeeds and the clamp that follows turns the result into min_qp. A
few dark frames at stream start drive the QP there in eight steps and
the controller never raises it again; the first bright 4K frame at QP
1 is larger than the capture buffer, the second overflow in a row puts
the queues into error and the stream stops.

Make the step a signed constant and the picked QP an int, so the step
limit holds at the low end as well.

Fixes: 64129c4282 ("rockchip: add the RKVENC H.264 and HEVC encoder")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-31 10:52:53 +00:00
Daniel Golle de7287983a rockchip: rkvenc: honour the chroma plane data offset
rkvenc_device_run() programs the chroma plane base of an NV12M input
from the plane's DMA address alone and ignores the plane's data_offset.
A buffer that holds both planes in one allocation, as the ISPP scaler
output does when GStreamer imports it into the encoder as two planes,
keeps its chroma at an offset inside that allocation, so the encoder
took the luma data as chroma and produced wrong colours.

Add the data_offset to the chroma plane base. The diffstat in the
patch header follows the refreshed driver patch, and the frequency
scaling patch is re-contexted on top of it.

Fixes: 64129c4282 ("rockchip: add the RKVENC H.264 and HEVC encoder")
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-31 10:52:23 +00:00
Yanase Yuki b2ea590e51 qualcommax: replace deprecated dts properties
Upstream deprecated qcom,ath11k-calibration-variant[1].
Linux 6.13+ supports qcom,calibration-variant.

1. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1bd9ffec4cdb9a1f

Signed-off-by: Yanase Yuki <dev@zpc.st>
Link: https://github.com/openwrt/openwrt/pull/26204
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-10-31 11:06:17 +01:00
Semih Baskan fc8ff4d2ed ppp: give the jailed pppd copies of the secrets files
50-ppp-secrets-mode.sh makes chap-secrets and pap-secrets readable for
the ppp group, so that the jailed pppd can read them. pppd 2.5.4 refuses
a secrets file with any group or other permission while
strict-secrets-files is on, which is the default, and logs "Can't use
/etc/ppp/chap-secrets: secret file has world and/or group access".
After the script neither the jailed pppd nor a pppd running as root,
such as the one pptpd starts, can use the files.

pppd also wants the file owned by root or by its own uid, so one file
cannot serve both. Have the jail setup copy each secrets file to
/var/run/pppd, owned by ppp with mode 0600, the same way it writes the
options file. The chap-secrets and pap-secrets options point the
jailed pppd at the copies, and teardown removes them.

The script now puts the files back to the 0600 root:root mode they are
installed with, so that a pppd running as root can read them again. It
only touches a file in the state it left: owned by root, group ppp,
mode 0640.

A jailed pppd reads the copies made when the interface was set up, so a
change to the secrets files reaches it at the next setup. A pppd running
as root rereads them at every authentication.

The RADIUS servers file stays group readable, because the radius plugin
reads it without the secrets file check.

Fixes: b855f33ea9 ("ppp: run pppd in ujail as an unprivileged user")
Signed-off-by: Semih Baskan <strst.gs@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26319
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-10-31 10:23:47 +01:00
Semih Baskan 7be6b668ad ppp: do not follow links when writing the options file
The jail setup hands /var/run/pppd to the ppp user, and root writes the
options file with the credentials into it. The redirection that writes
the file and the chown after it both follow a symbolic link. A process
running as ppp, such as a jailed pppd taken over through a bug, can put
a link where the options file of an interface will be written. At the
next setup root then writes the credentials into the file the link
points to and hands that file to ppp.

Write the options into a temporary file in the root-owned /var/run,
chown it there and move it into place with mv -T. The rename replaces a
link without following it, and -T makes mv fail when the name points to
a directory. mktemp creates the file with mode 0600, so the umask is no
longer needed.

Fixes: ab60d82ca5 ("ppp: keep credentials off the ujail command line")
Signed-off-by: Semih Baskan <strst.gs@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26319
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-10-31 10:23:47 +01:00
Semih Baskan bd4d64e08b ppp: hand the pptp socket directory to the jailed pppd
The pptp plugin starts a call manager that binds its control socket in
/var/run/pptp/ and creates the directory first if it is missing. Since
pppd runs in ujail as user ppp, the call manager runs as that user too
and cannot create the directory in the root-owned /var/run. It exits
with "Could not make path to /var/run/pptp/...: Permission denied",
pppd ends with CONNECT_FAILED and netifd starts it again, in a loop.

Prepare /var/run/pptp the same way the jail setup prepares
/var/run/pppd: create it and chown it to ppp. The chown runs at every
setup, so a directory left by a pppd that ran as root is handed over
too.

Fixes: b855f33ea9 ("ppp: run pppd in ujail as an unprivileged user")
Signed-off-by: Semih Baskan <strst.gs@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26319
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-10-31 10:23:47 +01:00
Markus Stockhausen 3b7e7c00e2 realtek: dsa: use the SoC table API for RTL839x QoS
Read SCHED and OUT_Q through the shared table API and hold its register
lock across each SCHED read-modify-write. Keep reg_mutex around the
multi-step E0014503 sequence, releasing the table lock before accessing
OUT_Q because both tables share the same engine.

Check access errors before updating a row. Save the original rate before
attempting the temporary unlimited setting, and attempt OAM/rate
restoration on workaround failures. Preserve the existing queue-drain retry
policy and the public rate accessor signatures.

Remove the DSA table command wrappers, raw data-window accesses,
execute/poll helper and its declaration. Field encoding remains in the QoS
driver.

Assisted-by: ChatGPT (OpenAI GPT-6 Astra)
Link: https://github.com/openwrt/openwrt/pull/26315
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-31 08:01:05 +01:00
Markus Stockhausen 3d48853188 realtek: dsa: add RTL8390 scheduling and queue table descriptors
Expose the three tables reached through the existing OTTO_REG_8390_2
engine. Use the Cypress SDK dimensions: SCHED has 53 nine-word entries,
SPG_PORT has 52 seven-word entries, and OUT_Q has 53 eight-word entries.
All three share the existing per-register mutex.

Assisted-by: ChatGPT (OpenAI GPT-6 Astra)
Link: https://github.com/openwrt/openwrt/pull/26315
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-31 08:01:05 +01:00
Markus Stockhausen 1bb839094a realtek: dsa: mask the upper RTL839x egress rate fragment
Only bits 7:0 of data word 7 belong to EGR_RATE. Mask them before joining
the twelve bits from word 8, as the setter already does when reading the
previous rate. Otherwise token flags and queue-weight bits contaminate the
returned value.

Assisted-by: ChatGPT (OpenAI GPT-6 Astra)
Link: https://github.com/openwrt/openwrt/pull/26315
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-31 08:01:04 +01:00
Markus Stockhausen 031e587f67 realtek: dsa: fix RTL839x scheduling queue weight fields
The Cypress SCHED fields are ten bits wide, at bit 48 + 10 * queue. Use the
bit position within the word rather than subtracting the reversed register
index. This avoids negative shift counts and overlapping queue fields. Use
unsigned masks and split only fields that cross a word boundary.

Assisted-by: ChatGPT (OpenAI GPT-6 Astra)
Link: https://github.com/openwrt/openwrt/pull/26315
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-31 08:01:04 +01:00
Markus Stockhausen 508ee51ccb realtek: dsa: avoid recursive QoS register mutex locking
Keep the register mutex held across the RTL839x WRR-to-WFQ workaround, but
use a locked egress-rate helper for its nested updates. Read the old
scheduling mode under the same lock so the decision and update are
serialized. The public rate setter still acquires the mutex itself.

Assisted-by: ChatGPT (OpenAI GPT-6 Astra)
Link: https://github.com/openwrt/openwrt/pull/26315
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-31 08:01:04 +01:00
Markus Stockhausen ea80bab79c realtek: dts: declare address cells for populated I2C buses
Declare #address-cells = <1> and #size-cells = <0> on I2C child buses
that contain statically described devices. These properties are not
inherited from the parent controller, so the single-cell device reg
properties otherwise trigger i2c_bus_bridge and reg_format warnings.

Assisted-by: ChatGPT (OpenAI GPT-6 Astra)
Link: https://github.com/openwrt/openwrt/pull/26321
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-31 07:57:27 +01:00
Jonas Jelonek a516fe3151 realtek: add support for Zyxel XGS2220-30HP
Add support for the RTL9311-based Zyxel XGS2220-30HP, a 30-port Gigabit
PoE++, stackable switch with 10G ports.

Hardware
========

- RTL9311 switch SoC
- 1GB DDR3 RAM
- 64MB SPI-NOR flash (across two flash ICs)
- 24x 10/100/1000M RJ45 ports (RTL8218E)
- 2x Multi-Gig RJ45 ports (AQR113C)
- 4x SFP+ ports
- PoE:
  - ports 1-16: 802.3at
  - ports 17-26: 802.3bt (60W)
  - 400W total power budget
- RTL8231 as GPIO expander
- TI PW564A I2C multiplexer (for SFP slots)
- 7-segment display for stacking ID
- Front LEDs: PWR/SYS, CLOUD, LOCATOR, POE MAX
- Buttons: RESET, RESTORE
- Console: USB-C port with integrated CP210x, 115200 8N1
- 3 fans (controllable as HIGH/LOW via GPIOs)
- Stock software chain:
  - Bootbase/stripped-down U-boot
  - RAS/ZyNOS

MAC address
===========

Single MAC address derived from the board partition. Applied to all
switch ports.

Disclaimer
==========

Flashing OpenWrt overwrites ZyNOS. The Bootbase/U-boot remains intact
and can be used for recovery.

The port LEDs of the 24x 1G ports do not work correctly yet. That's due
to that - in contrast to a lot of other switches - they are not driven
by the SoC but directly by the PHY instead. Support for that in the PHY
driver is missing yet.

Installation
============

Simple web upgrade:

1. Take the OpenWrt factory.bin image generated by a build.

2. In the ZyNOS web UI, login and go to Maintenance -> Firmware Upgrade.

3. If the device runs ZyNOS 5.00, untick "Enhanced firmware integrity
   check sha256sum". Otherwise the upload check will reject the image.

4. Select and upload the factory.bin image and click "Upgrade".

5. After flashing has finished, reboot the switch. It will now boot into
   OpenWrt.

Initramfs boot
==============

Initramfs boot can be accomplished either from Bootbase/U-boot or
BootExtension. The Bootbase/U-boot way is preferred because there might
be a chance to get networking to run in that environment and - if not -
ymodem works much more reliable than the xmodem in BootExtension.

1. Connect to the serial console and interrupt the boot process by
   spamming '$' during the DRAM test to drop into the shell.

2. Unlock the Bootloader shell via [1] or [2].

3. Try to bring up networking. The default board profile doesn't match
   the real hardware and other existing profiles don't even work with
   the RTL8218E. However, it still might be possible to get the SFP
   ports running with some SFP modules.

4a. If networking is up, normal U-boot TFTP boot can be used to transfer
    the image.

4b. Otherwise, use ymodem to transfer the image.

5. Boot the initramfs image. Just note that - since the initramfs image
   doesn't have a uImage header, you need to boot it with 'go' command
   instead of 'bootm' command.

6. From within the ram-booted OpenWrt, backups of the flash can be made
   and sysupgrade can be performed.

Return to stock firmware
========================

1. Download the stock firmware for the switch from the Zyxel website and
   unzip it; there should be a bin file with an alphanumeric name.

2. Upload that file to the running OpenWrt instance.

3. Flash it (use -F since the image has no OpenWrt metadata):

   > sysupgrade -F <stock-firmware>.bin

4. Wait for the sysupgrade to finish and the switch to reboot. ZyNOS
   should come up again.

[1] https://akao.co.uk/tools/zyxel_unlocker/
[2] https://www.ixo.de/info/zyxel_uclinux/

Link: https://github.com/openwrt/openwrt/pull/26243
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
2026-10-30 22:04:42 +01:00
Jonas Jelonek 2968547158 kernel: i2c: load PCA954x muxes during early boot
PCA954x muxes can provide the I2C adapters used by SFP cages. Load the
module during early boot so these suppliers are available for preinit
networking and failsafe instead of waiting for normal module autoload.

Link: https://github.com/openwrt/openwrt/pull/26243
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
2026-10-30 22:04:42 +01:00
Jonas Jelonek 41ab3e1f38 kernel: add GPIO seven-segment display module package
Package the GPIO seven-segment driver together with the line-display
core, enable the required AUXDISPLAY menu and autoload the driver.

Add generic kernel configuration defaults for the options exposed by
AUXDISPLAY to avoid interactive configuration prompts. Disable unused
display drivers and custom boot messages while retaining the upstream
character LCD backlight default.

Link: https://github.com/openwrt/openwrt/pull/26243
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
2026-10-30 22:04:40 +01:00
João Silva 116414a355 realtek: l3: rtl930x: handle egress interface programming errors
The RTL930x egress-interface setter discards the table write status.
Allocation therefore caches the descriptor, programs its source MAC and
increments its reference count even if the descriptor write failed.
Later routes can reuse that interface as though it had been installed.

Return the table write status through set_egress_intf() and check it
before publishing the cached interface or programming the source MAC.
Release the register lock and return the original error on failure.

Signed-off-by: João Silva <jgc3silva@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26230
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-30 14:45:04 +01:00
João Silva 5ee26cbc97 realtek: l3: unwind failed catch-all route writes
Check the table write when installing the IPv4 and IPv6 catch-all trap
routes. On failure, tear down the allocated route and return the original
programming error instead of reporting a successful installation.

This lets L3 setup detect that its CPU fallback route was not installed.

Signed-off-by: João Silva <jgc3silva@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26229
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-30 12:33:01 +01:00
João Silva 9cf980770f realtek: l3: propagate route installation write errors
Return the host or prefix table write status from otto_l3_route_install()
instead of reporting success unconditionally after programming.

Prefix placement may already have shifted other routes before the write
fails. Keep a placed trap route in the list and mark its row reserved
until a write succeeds, so the prefix block retains the correct size.
Free only unplaced routes on the IPv4 trap installation failure path.

On removal, invalidate and compact a reserved row even if the initial
write never reached hardware. A completed invalidation drains preceding
table commands before the slot is reused. If invalidation, compaction or
clearing the duplicate tail fails, stop further prefix placement rather
than allowing rows or resources still in use to be reused. Once the rows
are stale, retain the existing readback checks before touching a row.

Signed-off-by: João Silva <jgc3silva@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26229
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-30 12:33:01 +01:00
João Silva 06870bc01b realtek: l3: return host route write failures
Make otto_l3_930x_host_route_write() and its callback return an error
code. Return the table write status and reject unsupported multicast
layouts with -EOPNOTSUPP instead of silently returning.

This exposes host route programming failures to callers that need to
verify installation.

Signed-off-by: João Silva <jgc3silva@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26229
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-30 12:33:01 +01:00
João Silva d109b71475 realtek: l3: propagate host route read errors
Return table access errors from otto_l3_930x_host_route_read() before
decoding the entry. Pass them through find_slot() so an unreadable
entry cannot be mistaken for an available or missing host route.

Route installation already distinguishes absence from other lookup
errors and now returns the original read failure without retrying.

Signed-off-by: João Silva <jgc3silva@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26229
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-30 12:33:01 +01:00
João Silva ef1df3e11a realtek: l3: distinguish missing host routes from full buckets
Return -ENOENT when find_slot() cannot find an existing host route and
-ENOSPC when no free slot is available, instead of using -1 for both.

Check the named errors during route installation. Look for a free slot
only when the route is absent, report exhausted capacity explicitly,
and preserve other lookup errors.

Signed-off-by: João Silva <jgc3silva@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/26229
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
2026-10-30 12:33:01 +01:00
Daniel Golle a1788e6156 tools/sccache: add sccache Rust compiler cache
RUST_SCCACHE builds sccache 0.18.0 from a vendor tarball and makes it
the RUSTC_WRAPPER of the cargo builds of host tools, target packages
and libstd-rust. For target packages, scripts/rust-target-wrapper.sh
runs it in turn. The option sits next to CCACHE and is available with
any Rust toolchain of the build system. The packages feed defines
RUST_SCCACHE as well, without a dependency, and Kconfig merges both
definitions, so the tools and the cargo variables check for a Rust
toolchain once more.

sccache is built without default features: the local disk cache stays,
the remote storage backends and their HTTP and TLS stacks are left out,
so the build needs no host library. sccache needs rustc to build, so
the rustc build from source and the sccache build run unwrapped.

sccache keeps its cache and configuration in $(TOPDIR)/.sccache, or in
RUST_SCCACHE_DIR when set, and its server listens on a socket in
$(TMP_DIR), so that each tree has a server of its own. distclean
removes .sccache, and the SCCACHE_* variables of the environment are
unexported.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Daniel Golle 996ae0e113 build: pass Rust variables to CMake packages
Pass the Rust target, selected compiler, Cargo executable and
Corrosion module location to CMake packages using rust-values.mk, told
by its include guard. Cargo goes as Rust_CARGO as well, which FindRust
of corrosion reads, as projects such as fish carry it; it looks in PATH
and in ~/.cargo/bin otherwise. Carry the target Cargo environment
through configure, build and install for both Ninja and Makefiles,
keeping native probes on the host sysroot.

Register the libstd build dependency and Rust configuration inputs for
target consumers. Package CMAKE_OPTIONS can override generated options.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Daniel Golle 0508180cc7 tools/meson: add rust entry to meson cross file
Add target and native Rust compiler entries when a package includes
rust-values.mk. Its include guard tells, as the packages feed has a
rust-values.mk of its own, which python3-host.mk includes for every
Python package. The target entry carries the triple, CPU flags,
target-owned sysroot and standard-library linkage choice; native probes
use the host sysroot.

Supply bindgen with the toolchain sysroot and selected LLVM paths.
Register the target libstd build dependency and configuration inputs
for Rust consumers.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Daniel Golle 9115e6ee48 kernel: modules: add kmod-phy-ax88796b-rust package
Package ax88796b_rust, the Rust reference driver for the Asix PHYs used
by the AX88772 USB Ethernet adapters. It is equivalent to the C driver
of kmod-phy-ax88796b and provides that package, so kmod-usb-net-asix
works with either; the C driver stays the default variant.

Upstream builds only one of the two drivers. A hack patch makes
AX88796B_RUST_PHY a module of its own so that both are built. The Rust
PHY abstractions are part of the kernel's Rust crate in vmlinux and
need a built-in PHY library, so the package enables
RUST_PHYLIB_ABSTRACTIONS and PHYLIB=y. Answer the options these make
visible in the generic configuration.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Daniel Golle 8ce797daed kernel: support building Rust in the kernel
With CONFIG_KERNEL_RUST pass RUSTC, BINDGEN, RUST_LIB_SRC and
LIBCLANG_PATH to the kernel build. These are the variables
scripts/rust_is_available.sh checks.

KERNEL_RUST is enabled by default with any Rust toolchain, selects
bindgen and follows the kernel's architecture requirements: ARM32 needs
little-endian ARMv7, and ARM32 and LoongArch require KASAN to be
disabled.

CONFIG_RUST makes further symbols visible, which kconfig asks for
because the generic configuration does not answer them. Answer them in
the generic configuration so that targets need no changes. Filter the
rustc and bindgen version texts out of the kernel configuration
comparison.

Suggested-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Daniel Golle c59b9de355 generic: rust: accept the old OPP in config_clks
The generic patch "OPP: Provide old opp to config_clks on _set_opp"
adds the old OPP to config_clks_t. The Rust trampoline for the
callback has the previous signature, so rust/kernel.o fails to build
with CONFIG_RUST and CONFIG_PM_OPP enabled.

Accept the extra argument and ignore it, which keeps the Rust ConfigOps
interface unchanged.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Daniel Golle 32f1c26eb6 build: add Rust package build helpers
Add rust-package.mk for target packages written in Rust. The Cargo
environment carries the target triple, CPU flags, the C and C++ flags
for cc-rs, the linker and the ABI-specific sysroot of libstd-rust,
while native build scripts and proc macros keep the host sysroot and
linker. Builds run in the crate's working directory with an explicit
target and offline from the vendor tarball; with a source tree override
(git-src, USE_SOURCE_DIR), which has none, Cargo fetches the locked
crates. Target packages depend on libstd-rust at build time and track
its configuration inputs for rebuilds.

rustc runs the linker with arguments of its own, without TARGET_LDFLAGS.
The linker selection and the -z options that hardening.mk and
package.mk set for every package are passed to rustc, for packages and
for libstd-rust.

When the target triple is the build host's, cc-rs takes the host
compiler for target C code as well. For that triple the C and C++
compiler of cc-rs is scripts/rust-cc-wrapper.sh, linked into
$(STAGING_DIR_HOST)/bin by tools/rust. It runs the target compiler with
the target flags for build scripts whose OUT_DIR lies in the target
triple's directory, and the host compiler for the others.

RUST_PREFER_DYNAMIC is available with any Rust toolchain, controls the
default userspace standard-library linkage and defaults to shared
linking. Packages can override it. Release builds use LTO either way;
rustc runs LTO next to -Cprefer-dynamic only with the unstable
-Zdylib-lto. RUST_PKG_DEPENDS carries the architecture dependencies
and, with shared linking, the libstd-rust runtime dependency. For
packages that keep the default, that dependency is conditional on
RUST_PREFER_DYNAMIC, as .config is not read while package metadata is
collected.

Release builds emit no unwind tables and take the size options of
unstable rustc that libstd-rust is built with: panics without location,
derived Debug output reduced to type names and, with
RUST_PANIC_IMMEDIATE_ABORT, -Cpanic=immediate-abort. Permitting unstable
options for every crate with RUSTC_BOOTSTRAP=1 changes the code of
dependencies: the build scripts of anyhow, thiserror and proc-macro2
then detect unstable features and use them.
scripts/rust-target-wrapper.sh, the RUSTC_WRAPPER of package builds,
adds the options, and -Zdylib-lto with a shared libstd, only to the
target crates cargo compiles, recognised by --target, -C metadata and
--error-format=json, and permits unstable options for that crate alone.
Build scripts and their probes see neither. A package keeps panic
locations with RUST_PKG_LOCATION_DETAIL:=1 and selects the Debug output
with RUST_PKG_FMT_DEBUG. None of this applies with CONFIG_DEBUG.
Packages build the release profile, as maturin, CMake and autotools
projects do, and CONFIG_DEBUG gives it the settings of the dev profile,
ahead of the profile settings of the package. Build paths are mapped out
of packages as out of libstd-rust.

Without a Rust toolchain of the build system, Rust packages build with
rust/host of the packages feed, which installs to $(STAGING_DIR)/host,
so that packages can move from the Rust support of the packages feed
one at a time. RUSTC and CARGO point there, there is neither a sysroot
of libstd-rust nor a shared libstd, the mips64 triples are those its
std is built for, and on the build host's triple the target linker is
set through the Cargo variable. The build dependencies, on libstd-rust
or rust/host, follow USE_RUST_TOOLCHAIN in the package metadata, also
for host builds through rust-host-build.mk. After a switch from None to
a Rust toolchain, the cargo of rust/host still comes first in PATH, so
the help of the toolchain choice names its clean-up.

The file is derived from lang/rust in the packages feed by Luca Barbato
and Donald Hoskins.

Reported-by: Andre Heider <a.heider@gmail.com>
Co-developed-by: Brian Redbeard <redbeard@dead-city.org>
Signed-off-by: Brian Redbeard <redbeard@dead-city.org>
Co-developed-by: Aditya Nugraha <vortexilation@gmail.com>
Signed-off-by: Aditya Nugraha <vortexilation@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Daniel Golle db310ff0fb libstd-rust: build and package the Rust standard library
Build the sysroot crate with the selected Cargo and rustc, using the
source tarball's vendored crates and shared target CPU flags. Stage the
rlibs and shared library through normal package-owned target staging,
and include that sysroot in the SDK.
Separate Cargo output by ABI identity to keep dependency artefacts from
different configurations in their own build directories.

Name the shared library and package ABI from compiler, source, target
and build configuration inputs, with configuration changes triggering
a rebuild. Declare libgcc as a runtime dependency for libgcc_s.so.1.

Release builds optimise for size, abort on panic and emit no unwind
tables. They also take the size options of unstable rustc, which the
sysroot build permits anyway: panics carry no location
(-Zlocation-detail=none) and derived Debug output is reduced to type
names (-Zfmt-debug=shallow). RUST_PANIC_IMMEDIATE_ABORT, on by default,
builds with -Cpanic=immediate-abort and without the panic-unwind
feature: a panic stops the program at once, without formatting a
message. rustc requires the same panic strategy for all crates of a
program, the standard library included, so this is a build-wide option.
Debug builds retain unwinding, panic messages and full Debug output.

Build paths are mapped out of the library as iremap in rules.mk does
for C, unless CONFIG_DEBUG is set without
CONFIG_REPRODUCIBLE_DEBUG_INFO. The map stays out of the inputs of the
ABI identity, which would otherwise depend on the build path.

rust-values.mk maps the OpenWrt target to its Rust target triple and CPU
flags; the mapping is derived from lang/rust in the packages feed by
Luca Barbato and Donald Hoskins. The mips64 ABI comes from
CONFIG_MIPS64_ABI, which every mips64 configuration sets, and n64 maps
to the muslabi64 and gnuabi64 triples. These are hard-float, so
soft-float mips64 with musl uses mips64-openwrt-linux-musl, the
soft-float n64 target of rustc, and the other soft-float mips64 and
mips64el configurations, which have no Rust target, get no Rust
packages. The e500v2 of mpc85xx has no FPU but shares the hard-float
powerpc triple, whose hard-float feature is turned off with
CONFIG_SOFT_FLOAT. When the target triple is the build host's, as for
x86_64 and aarch64 glibc targets, Cargo links build scripts with the
target linker as well but keeps target rustflags off them, so the target
linker is passed as a rustflag in that case.

include/scan.mk rescans the package metadata when an include/rust-*.mk
file changes, as for include/package*.mk.

Co-developed-by: Brian Redbeard <redbeard@dead-city.org>
Signed-off-by: Brian Redbeard <redbeard@dead-city.org>
Co-developed-by: Aditya Nugraha <vortexilation@gmail.com>
Signed-off-by: Aditya Nugraha <vortexilation@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Daniel Golle 0557493657 tools/corrosion: add corrosion-rs CMake-Cargo integration
Build corrosion-rs 0.5.1 from its GitHub release archive and install
its CMake modules into $(STAGING_DIR_HOST)/lib/cmake/Corrosion. CMake
projects use them through find_package(Corrosion) and
corrosion_import_crate(). USE_CORROSION is enabled by default with any
Rust toolchain.

With CMake 3.19 or later corrosion builds its generator only for
CORROSION_NATIVE_TOOLING, so the release archive is the whole source.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Daniel Golle 0ced767f14 tools/cbindgen: add cbindgen host tool
Build cbindgen 0.28.0 from a vendor tarball. cbindgen generates C
headers from Rust code and is needed by Mesa for the NIL and NAK
components of the Nouveau driver. USE_CBINDGEN is enabled by default
with any Rust toolchain.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Daniel Golle 84e70f447e tools/bindgen: add bindgen-cli host tool
Build bindgen-cli 0.73.2 from a vendor tarball. bindgen loads libclang
from the BPF LLVM toolchain: the prebuilt one unpacked into the source
tree, the one built by tools/llvm-bpf or the host LLVM. Versions before
0.72.1 generate opaque structures together with libclang 22 or newer,
which tools/llvm-bpf provides.

BUILD_BINDGEN is enabled by default with any Rust toolchain and selects
the built LLVM when neither the host nor the prebuilt LLVM is in use.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Daniel Golle c4116f3904 build: add Rust host build helpers
Add rust-host-build.mk for host tools written in Rust.
Host/Compile/Cargo installs the crate with the staged rustc and cargo,
offline and with the locked dependencies of its vendor tarball by
default, and RustBinHostBuild installs the binaries into the host
package staging directory.

The file is derived from lang/rust in the packages feed by Luca Barbato
and Donald Hoskins.

Co-developed-by: Brian Redbeard <redbeard@dead-city.org>
Signed-off-by: Brian Redbeard <redbeard@dead-city.org>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Daniel Golle 6362669c09 build: add cargo vendor download methods
Add download methods which try the OpenWrt mirror, then verify an
upstream source and generate an offline vendor archive with
scripts/gen-cargo-vendor-tarball.sh. cargo-vendor-crate takes a .crate
and cargo-vendor-github a GitHub tag archive. cargo-vendor-archive
takes any other archive tar unpacks: release archives in other
compressions, PyPI source archives, crates published with build
metadata in their version. meson-vendor-wraps puts the files of the
selected [wrap-file] wraps of a meson project into
subprojects/packagecache, as mesa fetches its crates through meson
wraps at configure time.

The GitHub method serves the Rust packages of the packages feed, which
are released as tag archives, some with the Cargo project in a
subdirectory. It fetches the archive from codeload.github.com as
$(PKG_NAME)-$(PKG_VERSION).tar.gz. The top directory of every vendor
archive is the one PKG_BUILD_DIR unpacks to, and an existing
.cargo/config.toml of the project stays in front of the vendor
configuration. With the Cargo project in a subdirectory, both are in
the top directory, where cargo finds them wherever a build runs it.
Canonical tar metadata, checksum normalisation and the staged zstd
compressor keep generated archive contents stable. The archive has mode
0644, which the buildbots keep when they copy new files of dl/ to the
source mirror.

Verify PKG_HASH before atomically publishing the archive. Parse cache
options before selecting Cargo, and use the existing locked, verified
downloader for the pinned official Cargo fallback. The generator keeps
its Cargo home in staging_dir/hostpkg/cargo and its work directory in
tmp/, clears inherited CARGO_* settings and takes the staged cargo or
the pinned official one.

Co-developed-by: Brian Redbeard <redbeard@dead-city.org>
Signed-off-by: Brian Redbeard <redbeard@dead-city.org>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Daniel Golle 429ccec264 tools/rust: add Rust host compiler
Provide rustc, cargo, the host rust-std, rust-src and llvm-tools in
$(STAGING_DIR_HOST) in one of three ways. RUST_TOOLCHAIN_BUILD builds
them from the rustc source tarball with x.py. RUST_TOOLCHAIN_PREBUILT
installs the pinned components from static.rust-lang.org. For
RUST_TOOLCHAIN_HOST the components come from a relocatable toolchain on
the build host, which has to match the Rust version and is checked after
installation. The pinned components cover Linux hosts with glibc or
musl and macOS hosts, on x86_64 and aarch64; other hosts get an error
that names the host.

The choice sits in a "Rust toolchain options" menu of the developer
options, next to the external toolchain options and independent of
them. EXPERIMENTAL defaults to the prebuilt toolchain. As a Kconfig
choice resolves to none while its menu is hidden, USE_RUST_PREBUILT
carries that default in this case.

The xz2 crate of bootstrap is linked statically so that the compiler
needs no host liblzma at run time.

host-build.mk empties MAKEFLAGS for the build; x.py gets the jobserver
of make in MAKEFLAGS, so that bootstrap leaves the job count of ninja
and cargo to it, and one job when make runs without a jobserver.

The LLVM of a Rust release sinks the leading fence of a weak cmpxchg
into the reservation. On the e500v2 of mpc85xx the sync there clears
the reservation, so compare_exchange_weak loops never end. tools/rust
carries the LLVM change of rust/host in the packages feed, and on
mpc85xx the source build is the only choice and the default.

All three ways install into a prefix in one build directory, whose
prepared stamp depends on the choice, and the prefix is copied to
$(STAGING_DIR_HOST). As all three enable the same tool, the stamp of
the tools stage depends on the choice too. The installed files are
recorded in $(STAGING_DIR_HOST)/stamp and removed on clean and before
the next installation. The rust-installer metadata is removed from the
prefix: its manifests name absolute paths, which its uninstall.sh and
a later install.sh into the same prefix delete, those of the build
host's toolchain included.

Cargo reads .cargo/config.toml in every parent directory of its working
directory, and cargo and rustc take settings from the environment. The
build stops when such a file exists in TOPDIR or a parent directory,
and the CARGO, CARGO_* and RUST* variables of the environment are
unexported.

rust-values.mk holds the Rust version, the host triple, the hashes of
the pinned components and the Cargo home. The Cargo home is
$(STAGING_DIR_HOSTPKG)/cargo, shared by all targets, so that $(DL_DIR)
holds downloads only.

The xz2 and LLVM patches, the Rust build recipe and rust-values.mk are
derived from lang/rust in the packages feed by Luca Barbato and Donald
Hoskins.

Suggested-by: Andre Heider <a.heider@gmail.com>
Co-developed-by: Brian Redbeard <redbeard@dead-city.org>
Signed-off-by: Brian Redbeard <redbeard@dead-city.org>
Co-developed-by: Aditya Nugraha <vortexilation@gmail.com>
Signed-off-by: Aditya Nugraha <vortexilation@gmail.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2026-10-30 12:06:08 +02:00
Semih Baskan d6934586b6 ppp: quote the string arguments passed to pppd
ppp.sh expands two free-form values unquoted when it builds the pppd
argument list, so the shell splits a value containing whitespace and every
word after the first becomes a stray positional argument. pppd prints its
usage and exits with EXIT_OPTION_ERROR when the word matches no option.
The protocol handler treats that exit code as terminal and blocks the
restart, so the interface stays down until the configuration changes. A
bare number does not fail at all, because pppd's wildcard matcher takes
it as the serial port speed.

reqprefix is declared with proto_config_add_string and carries no
validation pattern. ip6table is a core interface attribute that netifd
passes through as a string, and when system_resolve_rt_table() cannot
parse it netifd only logs a debug message, so the raw value still reaches
this argument list.

Quote both so the value survives as one element. Values without whitespace
produce the same argument list as before, so no working configuration
changes.

Quoting on its own would drop the extra reqprefix values without a trace,
because ppp6-up expands REQPREFIX unquoted as well and forwards only the
first word. Log a warning when more than one value is given, matching how
dhcpv6.sh reports a prefix hint it cannot use. The count is taken in a
subshell so that ppp_generic_setup keeps its own argument list, which it
still needs for the per-protocol options.

Fixes: d5221d5a41 ("ppp: honor ip6table for IPv6 PPP interfaces")
Fixes: 7079e456ad ("ppp: add reqprefix norelease ac_mac")
Signed-off-by: Semih Baskan <strst.gs@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24489
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-10-30 10:52:28 +01:00