1873 Commits

Author SHA1 Message Date
14fc614405 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-07-29 16:55:54 +08:00
11aa0fc6fb base-files: find_mmc_part: Silence error when no MMC exists
When running find_mmc_part on a system without MMC or when the given
root device does not exist, an error message is printed to stderr.

    grep: /sys/block/mmcblk*/mmcblk*p*/uevent: No such file or directory

Silence this error message.

Since find_mmc_part is mostly used to get block devices of MMC
partitions and the negative result (partion not found) is checked for by
the caller, the error message can be silenced without causing any
negative impact.

Signed-off-by: Andreas Gnau <andreas.gnau@iopsys.eu>
Link: https://github.com/openwrt/openwrt/pull/19492
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-07-27 18:08:44 +02:00
c5875166d0 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-07-18 17:09:03 +08:00
a0fe3cfb62 base-files: introduce a function to get kernel version number
A new function "get_linux_version()" to normalize and print the
kernel version as an integer. In some migration scripts, it is
useful for checking the Linux kernel version.

Signed-off-by: Shiji Yang <yangshiji66@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/19172
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-07-14 22:30:20 +02:00
37f8f6b62d Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-06-25 20:15:57 +08:00
47b6b9de1a base-files: handle packages alternatives when apk removes packages
On commit 3010ab8 ("base-files: add update_alternatives function") was
implemented the function to handle ALTERNATIVES when using APK (OPKG
handle it internally) but in commit bcc6415 ("base-files: add
compatibility for APK and OPKG") was only called when adding a package,
so call it also when removing packages.

While we are here, check for a more specific *.alternatives files instead
of *.list, and remove redundant "filelist" variable definition.

Fixes: bcc6415 ("base-files: add compatibility for APK and OPKG")
Fixes: https://github.com/openwrt/openwrt/issues/19090
Fixes: https://github.com/openwrt/openwrt/issues/16991
Reported-and-tested-by: Eric Fahlgren <ericfahlgren@gmail.com>
Signed-off-by: Mario Andrés Pérez <mapb_@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/19093
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-06-23 09:39:12 +02:00
f9743c5190 base-files: add dtb support to emmc_upgrade_tar()
Add dtb support for emmc_upgrade_tar() to update dtb separately.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16904
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-06-22 22:17:20 +02:00
21347caf7e base-files: add gzip-compressed tar support to emmc_upgrade_tar()
Add support for the tar archive compressed by gzip to emmc_upgrade_tar()
function.

Signed-off-by: INAGAKI Hiroshi <musashino.open@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/16904
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-06-22 22:17:19 +02:00
07dfb9b710 base-files: ignore initscript output in sysupgrade
Suppress output from `/etc/init.d/service enabled` to avoid corrupting
of the sysupgrade tarball.

Fixes: 0ad062a21b ("base-files: sysupgrade: add uci-defaults script disabling services #2")
Signed-off-by: Niall McGee <niall.mcgee@bt.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2025-06-22 19:45:02 +01:00
465535d75b base-files: fix apple ntp domain
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-06-20 21:48:38 +08:00
fbf5ebf90b Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-06-01 19:51:49 +08:00
c6c29d7b38 sysupgrade: create 10_disable_services w/ fixed modified time
Every time "sysupgrade -b -" runs it would generate a new
(synthetic) "/etc/uci-defaults/10_disable_services" file with
the current time as the modified time.  This unfortunately
creates a non-deterministic tarball, so if you run a cron job
to save your state, you don't have a trivial way of seeing if
it changed or not without unpacking the archive, deleting this
file, and comparing the entire directory tree to the previous
backup.

Fixes: #16145
Fixes: 0ad062a21b ("base-files: sysupgrade: include uci-defaults script disabling services #2")
Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
2025-05-31 11:18:50 -06:00
d989d9a8ec base-files: use cidr for config_generate
Generate network configuration replacing netmask with CIDR.

Depends on:
https://github.com/openwrt/openwrt/pull/13765

Using CIDR provides the following advantages:
* Consolidate notation for IPv4 and IPv6 addresses.
* Consolidate notation for IP addresses and routing targets.
* Simplify network configuration and troubleshooting.
* Follow the transition from net-tools to iproute2.

Resulting configuration example:
```
config interface 'loopback'
	option device 'lo'
	option proto 'static'
	list ipaddr '127.0.0.1/8'

config interface 'lan'
	option device 'br-lan'
	option proto 'static'
	list ipaddr '192.168.1.1/24'
```

Signed-off-by: Vladislav Grigoryev <vg.aetera@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/13780
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-05-30 22:55:27 +02:00
32ed3db1a0 base-files: treat 'ipaddr is inside range' as warning again
The call to 'ipcalc' is used in 'dnsmasq' init script to create the
configuration. If the 'ipaddr' is in the configured range then 'ipcalc' exited
with an error whereby the START/STOP variables are unavailable.

This behaviour has changed during 'ipcalc' refactoring and now leads to a
problem when starting 'dnsmasq' if the 'ipaddr' is inside this range. To
restore the old behaviour, only a warning is issued as before and the
required variables for the 'dnsmasq' are still set.

Fixes: 854739b32c (base-files: ipcalc.sh: Rewrite in pure shell)

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
Link: https://github.com/openwrt/openwrt/pull/18641
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-05-29 23:54:18 +02:00
09241815a1 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-05-01 22:33:10 +08:00
8266ff6591 package: basefiles: add oem image dectection to fwtool.sh
with more new device, now able to flash oem
images from luci, fwtools erroneously marks
firmware as incompatible and does not warn
across keeping configs during update.

this patch aims to add both oem detection
and a warning msg advising firmware is compatible
(OpenWrt -> OEM) but configuration is not

tested on ipq5018: gl-b3000

Signed-off-by: Scott Mercer <TheRootEd24@gmail.com>

package: basefiles: add oem image dectection to fwtool

    some new devices are now able to flash oem
    images from luci, fwtools erroneously marks
    firmware as incompatible and does not warn
    of keeping configs during update for this condition.

    this patch aims to add both oem detection
    and trigger the existing warning msg, advising firmware is compatible
    (OpenWrt -> OEM) but configuration is not

tested on ipq5018: gl-b3000

Signed-off-by: Scott Mercer <TheRootEd24@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/18554
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-04-30 13:15:42 +02:00
9691b5d1b2 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-04-23 17:17:35 +08:00
5175d0a623 base-files: allow platform_check_image to prevent --force
Introduce special handling for return code 74 (EBADMSG) of
platform_check_image which will mark the image as broken and hence
not allow the user to override the check using the --force option.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
2025-04-21 16:12:42 +01:00
c8fbaa7d15 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-03-17 21:09:01 +08:00
5f0f8d23a1 base-files: add support for creating a provisioning partition on sysupgrade
This partition can be used to store sensitive config items (e.g. keys/certificates)
across factory resets.

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2025-03-17 13:17:52 +01:00
6557260f49 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-02-13 16:47:28 +08:00
094b6f593f base-files: fix offset conversion on caldata_patch_data()
`$(( ))` will convert uninitialized variable to "0". If we want to
use "-n" to check the string length, it's necessary to make sure the
converted variable is not empty.

Fixes: 652a6677d5 ("base-files: Add new functions for ath11k caldata")
Fixes: https://github.com/openwrt/openwrt/issues/17818
Signed-off-by: Shiji Yang <yangshiji66@qq.com>
Link: https://github.com/openwrt/openwrt/pull/17892
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-02-13 00:26:23 +01:00
0656e97227 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-02-05 16:09:07 +08:00
63e178f067 build: lock versions for special APK packages
The three packages base-files, libc and kernel are special, the former
can't be upgraded in place since it's content are modified on startup,
the latter two are virtual packages only used as constraints for the
package manager.

Historically base-files was "locked" via a special OPKG function, the
latter two were hidden from the package index and thereby never picked
as possible upgrade.

Time moved forward and we now have APK and tools like OWUT. The latter
compares available packages with installed packages and generates user
readable output, requiring versions for libc and kernel, too. At the
same time, APK uses a different looking mechanism, which is set during
installation instead of part of the package metadata.

In short, this patch adds version constraints to the three packages,
allowing them to be part of the package index.

Fixes: #17774
Fixes: #17775
Fixes: efahl/owut#31

Signed-off-by: Paul Spooren <mail@aparcar.org>
2025-02-04 13:48:59 +00:00
2d97143148 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-02-02 19:45:33 +08:00
17f8a197f3 config: add VERSION_FIRMWARE_URL
This new value points to where firmware can be downloaded. It's not
about a single release but all available firmware releases.

In the next step, this URL should be exposed via `ubus call system
board` as an entry of the `distribution` field. With that value, the
running firmware can check for newer releases.

We already have VERSION_REPO however that's different and only meant for
package managers to download their fitting package indexes/packages.

Signed-off-by: Paul Spooren <mail@aparcar.org>
Link: https://github.com/openwrt/openwrt/pull/17780
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2025-01-30 19:25:37 +01:00
389ecee729 base-files: sysupgrade: Add new option -s to perform upgrade on current partition
Add new option to be able to perform upgrade on current partition for dual firmware devices:
  "-s           stay on current partition (for dual firmware devices)"

Signed-off-by: Paweł Owoc <frut3k7@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/14720
Signed-off-by: Robert Marko <robimarko@gmail.com>
2025-01-29 16:53:21 +01:00
482b69f47e Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2025-01-07 21:27:09 +08:00
551e04f3c9 base-files: strip space and tab characters from ASCII mac address
Spaces and tabs are widely used in variable definitions. We have to
remove them to ensure that get_mac_ascii() works properly.

Signed-off-by: Shiji Yang <yangshiji66@qq.com>
Link: https://github.com/openwrt/openwrt/pull/17262
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-01-04 16:20:46 +01:00
3410ad2f40 base-files: enable get_mac_ascii() to handle redundant strings
The function get_mac_ascii() will fail when there are two or more
same MAC address variable names in the mtd partition. Only retain
the first variable to workaround this rare situation.

Fixes: https://github.com/openwrt/openwrt/issues/17236
Signed-off-by: Shiji Yang <yangshiji66@qq.com>
Link: https://github.com/openwrt/openwrt/pull/17262
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
2025-01-04 16:20:46 +01:00
f039c12f83 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-12-29 16:02:58 +08:00
cee18af704 base-files: sysupgrade: add saving list of installed packages for APK
Add support for saving list of installed packages for APK in the same way
we do it for OPKG.

Unlike OPKG, we dont generate .control files for packages so lets use .list
files instead.

Fixes: #16947
Link: https://github.com/openwrt/openwrt/pull/17123
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-12-28 10:59:50 +01:00
b83f5b92a2 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-12-19 16:36:45 +08:00
8c5826b140 procd: do not overwrite service data by default
Allows a running servie to manage its own data if untouched by the init script

Signed-off-by: Felix Fietkau <nbd@nbd.name>
2024-12-17 21:54:54 +01:00
f330936396 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-12-17 23:33:33 +08:00
3c7134fa32 base-files: fix shell scope error for the default LED brightness
This fixes "sh: write error: Invalid argument" for all default!=1 LEDs
as an empty $brightness was used.

Setting up LEDs via luci also now works again.

Fixes cbdfd03e: "base-files: add option to set LED brightness"
Signed-off-by: Andre Heider <a.heider@gmail.com>
Link: https://github.com/openwrt/openwrt/issues/17269
Signed-off-by: John Crispin <john@phrozen.org>
2024-12-14 19:51:50 +01:00
3ec15a0993 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-12-13 20:00:37 +08:00
4a08383339 base-files: fix luci TZ default show zonename
fix default timezone to correct GMT0,
origin value 'UTC' is zonename, not timezone.

Signed-off-by: Jiale Liu <admin@licsber.site>

Link: https://github.com/openwrt/openwrt/pull/15128
Signed-off-by: John Crispin <john@phrozen.org>
2024-12-12 19:54:09 +01:00
06c2d5524c base-files: fix cleanup after settings restore
Some devices use file '/tmp/sysupgrade.tar' during settings restore and
this potentially big file was not being cleaned up from RAM afterwards.

See: do_mount_root() (base-files/files/lib/preinit/80_mount_root)

Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>

Link: https://github.com/openwrt/openwrt/pull/15339
Signed-off-by: John Crispin <john@phrozen.org>
2024-12-12 11:01:56 +01:00
cbdfd03e42 base-files: add option to set LED brightness
Add option to set LED brightness via uci:

config led 'led_blue'
        option name 'blue'
        option sysfs 'blue:status'
        option brightness '1'

Signed-off-by: Paweł Owoc <frut3k7@gmail.com>

Link: https://github.com/openwrt/openwrt/pull/17190
Signed-off-by: John Crispin <john@phrozen.org>
2024-12-12 09:46:38 +01:00
08e44a6900 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-12-03 14:27:52 +08:00
8349196571 fstools: update to latest HEAD
Rename jffs2reset to factoryreset. Convert all scripts to using the new command
line. Print a deprecation notice when jffs2reset is invoked.

49d36ba jffs2reset: rename to factoryreset
b135064 jffs2reset: print deprecation message

Signed-off-by: John Crispin <john@phrozen.org>
2024-12-02 14:43:09 +01:00
1af15e8a2b base-files: allow forcing all LEDs to on/off/blink state
* add a UCI option to disable all LEDs.
* add an init.d parameter to blink all LEDs
* add on/off parameters to init.d

Signed-off-by: John Crispin <john@phrozen.org>
2024-12-02 13:55:36 +01:00
d0c7cfe085 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-11-30 00:35:04 +08:00
6f9384f4a4 base-files: fix manger->manager typo
It was reported, that a small typo sneaked in, so lets fix it.

Reported-by: @dave14305
Fixes: c19c31f7aa ("base-files: add migration information for APK")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2024-11-28 08:10:44 +00:00
c19c31f7aa base-files: add migration information for APK
If the `apk` package manager is installed, show a table of common
commands to deal with the system.

Signed-off-by: Paul Spooren <mail@aparcar.org>
2024-11-27 22:08:28 +01:00
6f07609c65 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-11-27 21:59:45 +08:00
341cc047b9 Revert "target,base-files: unify handling of procd-ujail"
This reverts commit ac640718aa as it
removes base-files package when KERNEL_NAMESPACES is deselected, as
base-files depends on procd-ujail which needs KERNEL_NAMESPACES.

Fixes: #17075
Link: https://github.com/openwrt/openwrt/pull/17081
Link: https://github.com/openwrt/openwrt/pull/17081
Signed-off-by: Petr Štetiar <ynezz@true.cz>
2024-11-26 05:07:33 +00:00
c2cb2b26c7 Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
2024-11-24 23:35:44 +08:00
a48ec449cc config: rename SECCOMP to USE_SECCOMP
It seems that we have some kind of a symbol name conflict which causes
CONFIG_SECCOMP to always be read as y.

Unfortunatelly, I could not figure out what is causing this, but simply
renaming SECCOMP to USE_SECCOMP seems to properly work and leaves the
symbol unset unless arch dependencies are satisfied.

This fixes qoriq and others that dont support seccomp from failing due
to procd-seccomp package being selected to get included but it cannot be
built for them:
ERROR: unable to select packages:
  procd-seccomp (no such package):
    required by: base-files-1637~52b6c92479[procd-seccomp]

Fixes: 4c65359af4 ("build: fix including busybox, procd and apk/opkg in imagebuilder")
Link: https://github.com/openwrt/openwrt/pull/17048
Signed-off-by: Robert Marko <robimarko@gmail.com>
2024-11-24 12:18:21 +01:00