Commit Graph

62578 Commits

Author SHA1 Message Date
Shiji Yang 98f26346cb ath79: lzma-loader: fix syntax error
C compiler can't parse '#else if'.

Fixes: f84a9f7dc0 ("ath79: add support for Huawei AP6010DN")
Signed-off-by: Shiji Yang <yangshiji66@qq.com>
Link: https://github.com/openwrt/openwrt/pull/16989
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-11-17 16:26:41 +01:00
Rosen Penev cd92cbddf8 kernel: filter out compiler opts from config
These get dynamically set based on compiler version. Not relevant for
targets.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16770
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-11-17 14:55:16 +01:00
Rosen Penev da8abd4a1e kernel: remove GCC11_NO_ARRAY_BOUNDS
This symbol is no longer present.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16770
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-11-17 14:55:16 +01:00
Mieczyslaw Nalewaj 84665993d6 kernel: move CONFIG_INTEL_MEI settings to target generic
Move settings CONFIG_INTEL_MEI_GSC_PROXY, CONFIG_INTEL_MEI_HDCP
and CONFIG_INTEL_MEI_PXP to target generic.

Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/16971
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-17 12:41:51 +01:00
Hauke Mehrtens 371e7bef40 omnia-eeprom: Mark it nonshared
This tool was build in the phase 2 build, there the
TARGET_mvebu_cortexa9_DEVICE_cznic_turris-omnia dependecy was probably
not meat. Mark it as non shared to build it together with the target
where this option is set.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Link: https://github.com/openwrt/openwrt/pull/16975
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-17 12:30:16 +01:00
Hauke Mehrtens febe1db43d debugcc: Mark it nonshared
This tool was build in the phase 2 build, there the TARGET dependencies
are probably not meat. Mark it as non shared to build it together with
the targets where this option is set.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Link: https://github.com/openwrt/openwrt/pull/16975
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-17 12:30:16 +01:00
Mieczyslaw Nalewaj 226f74badd kernel: disable drm-i915 module for x86/geode
Disable drm-i915 module for target x86/geode.

Fixes: 77cfe8f ("x86: make i915 as a kmod with required firmware")
Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com>
Link: https://github.com/openwrt/openwrt/pull/16977
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-17 12:28:58 +01:00
Rodrigo Balerdi 491121288e ipq807x: delete unused legacy eMMC sysupgrade code
All ipq807x devices that were using the legacy 'mmc_do_upgrade' eMMC
sysupgrade code were ported to the replacement 'emmc_do_upgrade' code.

Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16505
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-17 12:24:43 +01:00
Rodrigo Balerdi 17f84bba44 ipq807x: order devices alphabetically
Alphabetically sort devices in platform.sh

Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16505
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-17 12:24:43 +01:00
Rodrigo Balerdi fe481c9c47 ipq807x: prpl haze & qnap 301w: use the standard eMMC sysupgrade code
Note that the old ad-hoc method did not explicitly align backup data
to 64 KiB boundaries.

Also note that the qnap 301w has a 'rootfs_data' partition in the eMMC
that is being ignored by fstools during boot, presumably due to a bug.
This is why the partition is also ignored in the sysupgrade code and
there is no definition of CI_DATAPART="rootfs_data".

Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16505
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-17 12:24:43 +01:00
Rodrigo Balerdi 5583d23189 ipq807x: nbg7815: use the standard eMMC sysupgrade code
Note that the old ad-hoc method did not explicitly align backup data
to 64 KiB boundaries.

Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16505
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-17 12:24:43 +01:00
Petr Štetiar bdfae5a166 image: apk: remove explicit distfeeds handling
Currently the build fails due to the following:

 mv: cannot stat 'linux-mediatek_filogic/target-dir-7872e783/etc/apk/repositories': No such file or directory

as the changes done in the commit e031dab93e ("base-files: move apk
distfeeds into directory") forget to adapt image generation part.

While looking into this, I've realized, that we don't need this explicit
handling in the image generating code since the feeds are solely
configured by `base-files` and `apk` packages, so those should always
provide the correct feeds content, so lets simply drop this unnecessary
code.

Moving away /etc/opkg is done to prevent opkg from picking up the remote
feeds defined from base-files and only use the local feeds, but for apk
we explicitly pass --repositories-file which disables parsing of
/etc/apk/repositories and /etc/apk/repositories.d, so we do not need to
backup anything.

Fixes: #16981
Fixes: e031dab93e ("base-files: move apk distfeeds into directory")
Reported-by: Chen Minqiang <ptpt52@gmail.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
[jonas.gorski: add an explicit explanation where the original mv comes
from and why we don't need it for apk].
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
2024-11-17 11:57:45 +01:00
Ryan Keane afffcd09e5 elfutils: Backport some patches to fix errors
On aarch64 musl gcc 14.x compiler, trying compiling elfutils 0.192 with
lto option enabled will cause null-dereference error.
Example error message:

...
elf_compress.c: In function 'elf_compress':
elf_compress.c:675:26: error: potential null pointer dereference [-Werror=null-dereference]
  675 |           shdr->sh_flags |= SHF_COMPRESSED;
      |                          ^
elf_compress_gnu.c: In function 'elf_compress_gnu':
elf_compress_gnu.c:127:25: error: potential null pointer dereference [-Werror=null-dereference]
  127 |           shdr->sh_size = new_size;
      |                         ^                      ^
...

This is a false postive warning but will abort compilation if gcc has
`-Werror` flag. This commit add a patch for this, see the bugzilla
report below.

This commit backports a series of patches to fix some errors.

Add patch:
- 007-add-libeu-symbols-to-libelf.patch
- 008-fix-autoconf-ENABLE_IMA_VERIFICATION.patch
- 009-fix-null-dereference-with-lto.patch

Link: https://sourceware.org/bugzilla/show_bug.cgi?id=32311
Signed-off-by: Ryan Keane <the.ra2.ifv@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16886
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-16 19:57:58 +01:00
Ryan Keane 63caa2b168 elfutils: Add mirrors.kernel.org as mirrror
Add mirrors.kernel.org as mirror, listed on sourceware mirror sites
page.

Link: https://sourceware.org/mirrors.html
Signed-off-by: Ryan Keane <the.ra2.ifv@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16886
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-16 19:57:58 +01:00
Ryan Keane f5132df69d elfutils: Update to 0.192
Add a patch still under review to fix some errors.

Refresh patch:
- 003-libintl-compatibility.patch
- 005-build_only_libs.patch
- 006-Fix-build-on-aarch64-musl.patch

Add patch:
- 102-fix-potential-deref-of-null-error.patch

Release notes are in the link below.

Link: https://inbox.sourceware.org/elfutils-devel/CAJDtP-T3+gXqHWp3T0mejWWbPr0_1tHetEXwfB67-o+zz7ShiA@mail.gmail.com/T/#u
Signed-off-by: Ryan Keane <the.ra2.ifv@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16886
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-16 19:57:58 +01:00
Markus Stockhausen 65964c42f8 realtek: align kernel config with upstream
Since the start of the Realtek target OpenWrt works with RTL83XX as the
target architecture. Upstream is using MACH_REALTEK_RTL instead. To
simplify further development align that.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/16963
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-11-16 18:02:18 +01:00
Jonas Gorski a6e98a810d
apk: add a customfeeds.list configuration file
Analog to how we handle custom feeds in opkg, add a customfeeds.list for
custom package feeds and mark it as a configuration file.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16940
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-16 17:26:27 +01:00
Jonas Gorski e031dab93e
base-files: move apk distfeeds into directory
Analog to how we handle distfeeds with opkg, have the base feeds defined
in a file in repositories.d instead of the base /etc/apk/repositories.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16940
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-16 17:26:27 +01:00
Rosen Penev 8f6972df36
apk: remove HOST_LDFLAGS hack
No longer needed as upstream respects -Ddefault_library now.

Refreshed patches.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16945
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-16 17:24:33 +01:00
Jeronimo Pellegrini 0000ba6ab8
libreadlne: create symlinks for .so
Currently, libreadline only installs

```
 /usr/lib/libhistory.so.8 -> libhistory.so.8.2
 /usr/lib/libhistory.so.8.2
 /usr/lib/libreadline.so.8 -> libreadline.so.8.2
 /usr/lib/libreadline.so.8.2
```

But there is no `libreadline.so` or `libhistory.so` available.

So this happens:

```
root@OpenWRT:~# cat a.c
int main() {
}
root@OpenWRT:~# gcc a.c -lreadline
/usr/bin/ld: cannot find -lreadline: No such file or directory
collect2: error: ld returned 1 exit status
```

Unless, of course, one uses `-l:libreadline.so.8`... But that
doesn't help with binaries that try to dynamically open

`libreadline.so`. I have one of those here (the STklos Scheme
compiler -- I didn't make a PR for it because it's far from
being ready, but one issue is that it does use dlopen to use
readline...)

With the symlink, it works:

```
root@OpenWRT:~# ln -s /usr/lib/libreadline.so.8 /usr/lib/libreadline.so
root@OpenWRT:~#
root@OpenWRT:~# gcc a.c -lreadline
root@OpenWRT:~#
```

Another example: when trying to package rlwrap, the build failed
complaining it could not find readline (using `-lreadline`).
It would then be necessary to change rlwrap's `configure.ac`
(and also in all packages that use readline), but it seems
simpler to add the symlinks...

This PR changes the Makefile so it will include the links.

Signed-off-by: Jeronimo Pellegrini <j_p@aleph0.info>
Link: https://github.com/openwrt/openwrt/pull/16445
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-16 17:20:12 +01:00
John Audia 31111680f6
x86: switch config to a tickless kernel
This commit fixes and closes #16313.

Switch the x86 kernel's timer to tickless operation which is
more power efficient since it is not woken up by periodic timer
interrupts when idle.  Also add several other options for CPU
idle governors particularly the upstream default for tickless
kernels, CONFIG_CPU_IDLE_GOV_MENU. Without this commit, my AMD
Ryzen 7 5800U can only achieve a minimum core frequency of 1,384
MHz which is over 3x higher than the processor's minimum
frequency of 400 MHz which is accessible with this modification.
In addition to the lower clock rate, I have seen a concomitant
reduction in both idle temps and at-the-wall power consumption.

Summary:
* Idle CPU freqs dropped from 1,384 MHz to 400 Mhz.
* Idle power consumption dropped from 7 W avg to 5 W.
* Idle temps have dropped from 50C on avg to 43C.

There are other well known reasons to switch to a tickless
timer including: reduced interrupt overhead, better use of CPU
resources, and reduced latency to name a few.

Build system: x86/64
Build-tested: x86/64/AMD Cezanne
Run-tested: x86/64/AMD Cezanne

Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/16317
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-16 14:33:58 +01:00
Shiji Yang 3dbe730080
ppp: remove more unnecessary kernel checks
The ppp package can support all features since Linux 4.7.0 kernel.
Therefore, most kernel version checks can pass unconditionally on
OpenWrt v18.06 and later version. This patch can reduce the size
of ppp package by approximately 2.5 KB.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
Link: https://github.com/openwrt/openwrt/pull/16695
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-16 14:26:47 +01:00
Hauke Mehrtens b88d51898d
base-files: Mount debugfs and pstore with nosuid,nodev,noexec
These permissions are not needed. Systemd also mounts these file systems
without these permissions on other Linux distributions.

Dropping these permissions should make the system more secure.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Link: https://github.com/openwrt/openwrt/pull/16960
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-16 14:23:08 +01:00
Hauke Mehrtens 3b710375dd
base-files: Create /run and /run/lock folder
Create the folder /run and /run/lock using symlinks. Other Linux
distributions also have these folders and some applications might already
depend on them. Just create symlinks pointing to the older folder.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Link: https://github.com/openwrt/openwrt/pull/16961
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-16 14:22:22 +01:00
Hauke Mehrtens 71c14cbee5
build: apk: Remove /run/apk/db.lock
Do not add the file /run/apk/db.lock to the root file system. The /run
folder should be on a tmpfs.

At runtime we should make /run point to a tmpfs. At build time we should
just remove the folder.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Link: https://github.com/openwrt/openwrt/pull/16961
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-16 14:22:22 +01:00
John Audia 487ca61f91 kernel: bump 6.6 to 6.6.61
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.6.61

Manually rebased:
	bcm27xx/patches-6.6/950-0998-i2c-designware-Add-support-for-bus-clear-feature.patch

All other patches automatically rebased.

Build system: x86/64
Build-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3
Run-tested: x86/64/AMD Cezanne, flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3

Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/16959
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2024-11-16 00:25:14 +01:00
Joe Zheng 77cfe8fd15 x86: make i915 as a kmod with required firmware
i915 driver requires to load correct firmware to work on latest x86
GPU, it is more reasonable to make it as a kernel module, so that
initramfs is not required, and it can also save some space from the
kernel image comparing being a built-in driver

Signed-off-by: Joe Zheng <joe.zheng@intel.com>
Link: https://github.com/openwrt/openwrt/pull/16276
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-15 19:03:21 +01:00
Joe Zheng ca00bafd7e linux-firmware: rename packages for i915 firmware
Change the package name from intel-igpu-firmware-* to i915-firmware-*,
the prefix "intel-igpu" is misleading, i915 firmware is not only for
iGPU but also for dGPU now.

Remove the redundant "intel" as i915 is already well known.

More accurate file classification to handle following files correctly:

  adlp_dmc.bin
  mtl_huc.bin
  mtl_huc_gsc.bin
  mtl_gsc_1.bin

The pattern in regex is "([[:alnum:]]+)_([[:alnum:]]+)(_[\w-.]+)?\.bin",
where $1 is the platform, $2 is the firmware type (dmc, guc, huc, etc.),
and the optional $3 which is revision or other suffix.

Glob first to narrow down the target file set, and then split with "_"
to extract the firmware type (remove the ".bin" in case there is no $3)

Add package "i915-firmware" as a meta package to install all the i915
firmwares, it is a balance between simplicity and optimization.

* Installing all the available firmwares as a whole, can support all the
  platforms, not only the current one but also the future ones. The
  price to pay is the increased size.
* If we want to minimize the storage, we can customize to install the
  necessary ones only, even for the target platform only (e.g. ADL) and
  skip the others. The price to pay is the time to tune.

What I am going to do is:

* Let drm-i915 driver depend on i915-firmware-dmc, which is small and
  can cover most of the old platforms
* Let the user select i915-firmware to install all the i915 firmwares as
  a whole to cover the latest or future platforms

Signed-off-by: Joe Zheng <joe.zheng@intel.com>
Link: https://github.com/openwrt/openwrt/pull/16276
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-15 19:03:21 +01:00
Marek Behún 749a43325b utils: Add the omnia-eeprom utility
Add a new utility, `omnia-eeprom`, which can be used to print / set
EEPROM fields on Turris Omnia.

One example when this utility might be useful is if the board
experiences random crashes due to newer versions of the DDR training
algorithm in newer U-Boot. The user can change the DDR speed from 1600K
to 1333H to solve these issues, with

  ```
  omnia-eeprom set ddr_speed 1333H
  ```

Signed-off-by: Marek Behún <kabel@kernel.org>
Link: https://github.com/openwrt/openwrt/pull/16264
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-15 13:01:31 +01:00
Christian Marangi 8c018dcb56
package: use /dev/null for apk --repositories-file
In preparation for APK version bump, use /dev/null instead of /dev/zero
for --repositories-file to mute an error in recent APK files.

New APK version use modern istream logic that are more sensible to the
kind of file passed and /dev/null is required to correctly handle an
empty repository file.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-15 12:27:44 +01:00
Petr Štetiar a6c248e8ad
apk: fix long package description handling
Currently its not possible to generate apk package.adb package index if
the package has longer description field, which leads to following
failure:

 (2352/2353) Installing zoneinfo-all (2024b-r1)
 (2353/2353) Installing zstd (1.5.6-r1)
 ERROR: System state may be inconsistent: failed to write database: No buffer space available
 1 error; 2704 MiB in 2353 packages

The code to read/write installeddb does not really handle long
description well. Until the database is converted to apkv3 format,
truncate the apkv3 descriptions to allow existing code to work.

APKv3 index and packages still contain the original long description
unmodified, so no package rebuild will be needed.

Fixing the issue by backporting the single upstream fix as its not
possible to to upstep apk to the latest Git HEAD due to some
regressions, see commit 692052cdc0e7 ("Revert "apk: update to Git
417a93ceae540444fdbd3f76d1dadf0e15621fdc (2024-11-13)"") for more
details.

Fixes: #16929
References: https://gitlab.alpinelinux.org/alpine/apk-tools/-/issues/11038
Upstream-Status: Backport [417a93ceae]
Link: https://github.com/openwrt/openwrt/pull/16951
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2024-11-15 08:52:54 +00:00
Daniel Golle 1e8505ac4e procd: update to git HEAD
7330fa5 initd: mount /sys and /proc with MS_RELATIME

Fixes mounting /proc in unpriviledged user namespace.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2024-11-15 02:54:56 +00:00
Felix Fietkau 6720c4ccba mt76: update to Git HEAD (2024-10-28)
8dfead68c202 wifi: mt76: mt7915: hold dev->mutex while interacting with the thermal state
d508a6eb935d wifi: mt76: mt7996: use mac80211 .sta_state op
57019e663f57 wifi: mt76: add code for emulating hardware scanning
dc4c2bdf7c56 wifi: mt76: add support for allocating a phy without hw
8cd0263f92e1 wifi: mt76: rename struct mt76_vif to mt76_vif_link
99df84d62883 wifi: mt76: add vif link specific data structure
dcc6f158d759 wifi: mt76: mt7996: split link specific data from struct mt7996_vif
d388deab9e73 wifi: mt76: initialize more wcid fields mt76_wcid_init
d026be405c54 wifi: mt76: add chanctx functions for multi-channel phy support
0b05795ca81c wifi: mt76: remove dev->wcid_phy_mask
0b526090de95 wifi: mt76: add multi-radio support to a few core hw ops
aeedee5c0a2c wifi: mt76: add multi-radio support to tx scheduling
fc0ff17b53ff wifi: mt76: add multi-radio support to scanning code
f19cbcf83400 wifi: mt76: add multi-radio remain_on_channel functions
42429ae0eaf6 wifi: mt76: mt7996: use emulated hardware scan support
f9d593d4a6b4 wifi: mt76: mt7996: pass wcid to mt7996_mcu_sta_hdr_trans_tlv
807090b28661 wifi: mt76: mt7996: prepare mt7996_mcu_add_dev/bss_info for MLO support
252baa7bf477 wifi: mt76: mt7996: prepare mt7996_mcu_add_beacon for MLO support
9ee990050305 wifi: mt76: mt7996: prepare mt7996_mcu_set_tx for MLO support
bf12cc404334 wifi: mt76: mt7996: prepare mt7996_mcu_set_timing for MLO support
60bf2bef95dc wifi: mt76: connac: prepare mt76_connac_mcu_sta_basic_tlv for MLO support
1289737e12a8 wifi: mt76: mt7996: prepare mt7996_mcu_update_bss_color for MLO support
7c00df0e7e57 wifi: mt76: connac: rework connac helpers
484e3f289a40 wifi: mt76: mt7996: move all debugfs files to the primary phy
d258f4e3e1ca wifi: mt76: mt7996: switch to single multi-radio wiphy
c246fa545119 wifi: mt76: mt7996: fix monitor mode

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-11-14 13:03:38 +01:00
Jonas Gorski b67db1b0fc apk: explicitly enable help
Explicitly enable help so that the build will fail when an appropriate
lua binary isn't found instead of silently disabling the feature.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
2024-11-14 12:03:44 +01:00
Jonas Gorski 954d2ad81b apk: move common meson args to its own variable
Most apk meson args are shared between host and target builds, so lets
have a common variable for them.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
2024-11-14 12:03:14 +01:00
Jonas Gorski deeb29e6fe apk: host: set lua version to 5.1 to fix help
Commit b2a84c86e3 ("apk: host: make the help available") enabled the
host build for lua (5.1) as a dependency, but apk defaults to lua 5.3.
This caused it to ignore our lua, and only build the help if the host
system had lua 5.3 installed.

Fix this by explicitly setting the lua version to ours.

Fixes: b2a84c86e3 ("apk: host: make the help available")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
2024-11-14 11:58:39 +01:00
Petr Štetiar dab5ca818e
Revert "apk: update to Git 417a93ceae540444fdbd3f76d1dadf0e15621fdc (2024-11-13)"
This reverts commit c6a3a11c07 as it was
reported, that it causes issues:

 ERROR: failed to read repositories: /dev/zero: No buffer space available
 ERROR: unable to select packages:
   ca-bundle-20240203-r1:
     error: uninstallable
     arch: all
     satisfies: world[ca-bundle]

Reported-by: xiao bo <peterwillcn@gmail.com>
References: c6a3a11c07 (commitcomment-149072959)
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2024-11-14 09:31:54 +00:00
Rodrigo Balerdi 0e59eaa796 ipq806x: tr4400v2: revert nesting of MTD partitions that bricks device
This reverts commit e1043a746a, that
attempts to nest partitions that overlap but are not nested. This
causes the 'ubi' partition to be truncated, making rootfs inaccessible
and bricking the device.

Also, had this commit worked, it would have renumbered MTD partitions
in a way that would have broken documented scripts for installation and
update of main and recovery OSes, making backups, return to stock, etc,
and broken user configurations that put the 'extra' partition to use.

Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16944
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-14 10:01:30 +01:00
Enrico Mioso b43194e041 mediatek: filogic: add support for GatoNetworks GDSP
The GatoNetworks GDSP is a re-branded version of the R5000 5G Industrial
router from Yinghua Technologies.
The re-branded device comes with OpenWrt preinstalled, and an OpenWrt-based
U-Boot bootloader version. While the flash layout has been kept compatible
with the OpenWrt version found on the stock device (see [5]), the image format
changed, making a bootloader upgrade necessary.

Specifications:
SoC: Mediatek MT7981BA
RAM: 256MB
Flash: SPI-NOR 32 MiB (Winbond W25Q256)
WLAN: MT7976CN DBDC AX Wi-Fi
Switch: MT7531AE (4x LAN Gigabit ports, 1x WAN Gigabit port)
5G: Quectel RM520N modem
Watchdog: an external WDT connected to GPIO 6 is present and always running;
          the built-in Mediatek watchdog is also present and effective, but
          not used at the moment.

This porting has been tested only with 1x 5G modems installed (the device
supports up to two).

Installation:
Installation is possible via sysupgrade both in the stock device and
re-branded version. However, in the former case, updating the bootloader is
required.

OpenWrt-based U-Boot Bootloader installation
--------------------------------------------
The firmware flashed in the re-branded device at manifacturing time will
flash an OpenWrt-based U-Boot bootloader with some extra recovery features
(see [1]) at first boot.
To update the bootloader, you need to install the mtd-rw module and
insmod it:

insmod mtd-rw i_want_a_brick=1

Then update relevant flash partitions:

mtd erase u-boot-env
mtd erase BL2
mtd erase FIP
mtd write openwrt-mediatek-filogic-gatonetworks_gdsp-preloader.bin BL2
mtd write openwrt-mediatek-filogic-gatonetworks_gdsp-bl31-uboot.fip FIP

And reboot, making sure all previous commands ran succesfully.
If something goes wrong, you can recover your device via the mtk_uartboot
tool.
In my testing, it was possible to start the process even without (un)-plugging
the device, may be handy for remote recovery.

Installation from stock device and firmware
-------------------------------------------
To install vanilla OpenWrt in the stock device (R5000 5G Industrial router
from Yinghua Technologies) running the stock vendor firmware, you will need
to update your bootloader as described in previous section. Remember to use
-F (force upgrade) and -n (not keeping settings).

U-Boot Recovery
---------------
This procedure has been tested only with the OpenWrt-based U-boot bootloader.
Assign your system static IP address 192.168.1.1 and start a TFTP server. The
device will look for an initramfs image named
openwrt-mediatek-filogic-gatonetworks_gdsp-initramfs-kernel.bin
(so you may use openwrt/bin/targets/mediatek/filogic as root dir for your
TFTP server).
Power on the device while keeping the reset button pressed, until you see
a TFTP request from 192.168.1.10. Your environment will be restored to it's
default state.

MAC addresses assignment
------------------------
MAC addresses are assigned slightly differently than in stock firmware. In
particular, the 5 GHz Wi-Fi uses 2.4 GHZ MAC + 1, rather than reusing it with
LA bit set as done in stock firmware. This MAC address is allocated to the
device, so it can be used.
The 2.4 GHz Wi-Fi MAC address is the label MAC. LAN MAC is used to set the
special U-Boot environment ethaddr variable.

device					MAC address		U-Boot env variable		factory partition offset
2.4 GHz Wi-Fi		:84						wifi_mac							0x4
5.8 GHz Wi-Fi		:85						not present						not present
WAN							:86						wan_mac								0x24
LAN							:87						lan_mac								0x2A

Notes
-----
[1]: the OpenWrt-based U-Boot bootloader you will find installed in the
re-branded device is configured to request for the initramfs image via
TFTP for $gdsp_tftp_tries times before trying normal boot from NOR flash.
Setting this U-Boot environment variable to 0x0 will disable the feature,
which is not implemented in this patch.
[2]: the exposed UART port is connected to ttyS1; the ttyS0 console port is
not exposed.
[3]: the provided bootloader environment has no provision for operating on
BL2 and the FIP partitions. This is an intentional choice to make it
(slightly) more difficult to brick the device.
[4]: it seems GPIO 6 is used both for the "SYS" LED and external WDT.
[5] BL2 expects to find FIP payload at a fixed offset, so some constraints
apply.

Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
2024-11-14 04:14:23 +00:00
Enrico Mioso 785ebf2baf uboot-envtools: add support for GatoNetworks GDSP
This configuration should work with both stock and OpenWrt-based U-Boot.

Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
2024-11-14 04:14:23 +00:00
Enrico Mioso 7f2c7b3238 uboot-mediatek: add support for GatoNetworks GDSP
The GatoNetworks GDSP is a re-branded version of the R5000 5G Industrial
router from Yinghua Technologies.

Advantages over stock bootloader:
1. supports serving the external GPIO WDT, allowing for easier work in U-Boot
   shell
2. supports cool features like netconsole, easy recovery, scripting and so on
3. allows using FIT image and image integrity validation

and ultimately gives you much more flexibility to implement your tweaks.

Known issues
------------
To make it easier to operate the device, console I/O multiplexing support has
been enabled in U-Boot configuration. Setting I/O related U-Boot environment
variables to something like "serial,nc" will have the desired effect. Still,
setting these variables to such a value in the persistent environment will
lead to a crash and make it impossible to boot the system or recover it. I
decided to leave it on anyway since I think it can be very practical in
development.

Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com>
2024-11-14 04:14:23 +00:00
Petr Štetiar 27c2c140b1
scripts: download-check-artifact.sh: fix shellcheck and improve
Fixes following shellcheck's recommendations:

 In scripts/download-check-artifact.sh line 24:
	exit $1
             ^-- SC2086 (info): Double quote to prevent globbing and word splitting.

 In scripts/download-check-artifact.sh line 53:
		local sum="$(shasum -a 256 "$image_file")";
                      ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values.

 In scripts/download-check-artifact.sh line 72:
 cd "/tmp/verify.$$"
 ^-----------------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

 In scripts/download-check-artifact.sh line 114:
		printf "Keyserver to use? [$keyserver_url] > "
                       ^-- SC2059 (info): Don't use variables in the printf format string. Use printf '..%s..' "$foo".

 In scripts/download-check-artifact.sh line 115:
		read url; case "${url:-$keyserver_url}" in
                ^--^ SC2162 (info): read without -r will mangle backslashes.

While at it make it clear, that it is possible to download/check any
build artifacts like even SDK or ImageBuilder.

Link: https://github.com/openwrt/openwrt/pull/16871
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2024-11-13 20:26:46 +00:00
David S. H. Rosenthal 4c9031fda2
scripts: add download-check-artifact.sh script
While checking wiki documentation about GPG signatures checking I found
this nice script and I've thought, that it would be nice to provide it
officially instead of some random internet site.

Usage example:

  $ ./scripts/download-check-artifact.sh https://downloads.openwrt.org/snapshots/targets/mediatek/filogic/openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb

  1) Downloading image file
  =========================
  ########################################### 100.0%

  2) Downloading checksum file
  ============================
  ########################################### 100.0%

  3) Downloading the GPG signature
  ================================
  ########################################### 100.0%

  4) Verifying GPG signature
  ==========================
  gpg: Signature made Tue 05 Nov 2024 05:21:50 PM UTC
  gpg:                using EDDSA key 92C561DE55AE6552F3C736B82B0151090606D1D9
  gpg: Good signature from "OpenWrt Build System (Nitrokey3) <contact@openwrt.org>" [ultimate]
  Primary key fingerprint: 8A8B C12F 46B8 36C0 F9CD  B36F 1D53 D187 7742 E911
       Subkey fingerprint: 92C5 61DE 55AE 6552 F3C7  36B8 2B01 5109 0606 D1D9

  5) Verifying SHA256 checksum
  ============================
  openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb: OK

  Verification done!
  ==================
  Downloaded artifact placed in '/var/home/ynezz/dev/openwrt/openwrt.git/openwrt-mediatek-filogic-openwrt_one-squashfs-sysupgrade.itb'

  Cleaning up.

Adding file in a state as downloaded from https://www.abitare.org/bin/download.sh

References: https://openwrt.org/docs/guide-quick-start/verify_firmware_checksum?s[]=gpg#linux
Signed-off-by: David S. H. Rosenthal <dshr@abitare.org>
Link: https://github.com/openwrt/openwrt/pull/16871
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2024-11-13 20:26:44 +00:00
Petr Štetiar c6a3a11c07
apk: update to Git 417a93ceae540444fdbd3f76d1dadf0e15621fdc (2024-11-13)
c1a3e69f24e2 db: validate package arch against compatible arches
2a3dbfc9db58 db: add and use apk_db_parse_file helper to parse files line by line
b231eacd8121 db: simplify add_repos_from_file
98d7196a48d4 db: fix permissions of arch file
d2aaf13ee488 commit: sort matched dependencies on error analysis
c259642c006d tests: rework solver tests to not require apk-test binary
08b4d21f922e tests: move solver test data to separate directory
563d36481166 tests: minor updates to root tests
a236fdd39040 pkg: use memfd_create only if target root has dev/fd working
a5aeb3db113f test: unify makefile and meson tests
d86afdef88b0 db: print message when a file is written to .apk-new
5dd91e3c387d db: consider --force-no-chroot when determining /dev/fd availability
5add6fce22d4 apk-tools-3.0.0_pre4
8a13ed96d1d5 test: fix solver.sh for parallel use
fcd4defc18e6 test: move vertest to cmocka based unit testing infrastructure
e38d5b5a9d04 test: add missing alpine tests makefile
19b1df79ebca blob: refactor apk_blob_for_each_segment into apk_blob_foreach_word
76970a938dd7 package: move the location of executable package scripts
1e0411568dad package: respect libexecdir instead of hard-coding /usr/libexec
a4837ae8ffe2 package: don't call make_device_tree when APK_NO_CHROOT is set
ade0be3449e4 db, extract: handle file/directory extraction errors more consistently
4050f9e69d2e db: fix hardlink handling: root directory and v3 checksums
89e4bf1db040 db, fs: do not extract devices in --usermode
64ff8c72d9fb db: allow files starting with a dot in the root directory of apk3 packages
d26b65d30f55 db, audit: remove support for files without embedded checksum
417a93ceae54 pkg: truncate apkv3 description to 256 bytes

Fixes: #16929
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2024-11-13 20:19:04 +00:00
Kuan-Yi Li 93d005e6bc
imagebuilder: fix APK keys dir creation
Make keys directory for APK instead of OPKG while adding local key.

Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
Link: https://github.com/openwrt/openwrt/pull/16942
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-13 17:42:04 +01:00
John Crispin b902284290 base-files: improve default root-passwd script
The script was not exiting cleanly causing it to not be removed from the
uci-defaults folder.

Signed-off-by: John Crispin <john@phrozen.org>
2024-11-13 07:53:47 +01:00
Felix Fietkau 4c65359af4 build: fix including busybox, procd and apk/opkg in imagebuilder
Since the image builder pulls package lists from metadata directly,
add procd and busybox as depdendencies to base-files.
As for the package manager itself, since it can be disabled it needs
to be added directly in the image builder makefile

Fixes: 44598c233d ("build: remove broken dependency of metadata on toplevel .config variables")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-11-13 07:12:21 +01:00
Eric Fahlgren f84187035e
build: create package index.json
Duplicate the old opkg index.json using the new apk database.
Needed to get the ASU server working on new snapshots.

Signed-off-by: Eric Fahlgren <ericfahlgren@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16931
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-12 18:34:51 +01:00
Sergey Matsievskiy a72c8c7705
build: add comments to makefiles
Add comments to build system makefile functions and variables to help
developers in understanding build system internals and ease the
development process.

This patch adds some documentation examples with proposed doxygen-like
syntax. Hopefully, this would start the discussion and result in
generation of the makefile documentation guidelines.

Signed-off-by: Sergey Matsievskiy <matsievskiysv@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16888
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-12 17:56:07 +01:00
Til Kaiser dbe01f7d99
perf: fix version for APK
Change the version schema of perf to be compatible with APK as
described in this commit: e8725a932e.

Signed-off-by: Til Kaiser <mail@tk154.de>
Link: https://github.com/openwrt/openwrt/pull/16930
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-11-12 17:55:16 +01:00