aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files
Commit message (Collapse)AuthorAgeFilesLines
* base-files: upgrade: nand: add JFFS2 cleanmarkers supportÁlvaro Fernández Rojas2023-06-151-2/+10
| | | | | | | | | Some Broadcom MIPS devices require JFFS2 cleanmarkers to be present on the kernel partition or the bootloader will identify the partition as corrupt and won't boot the kernel. Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com> (cherry picked from commit 434df8df549a4d709be9eb19c0d2bd8abb4d4881)
* base-files: enable BPF JIT kallsyms by defaultTony Ambardar2023-06-091-0/+1
| | | | | | | | | | | Set net.core.bpf_jit_kallsyms=1 in /etc/sysctl.d/10-default.conf. For privileged users, this exports addresses of JIT-compiled programs to appear in /proc/kallsyms when present, allowing their use for debugging and in traces. Signed-off-by: Tony Ambardar <itugrok@yahoo.com> (cherry picked from commit b3aaede2a7b14f2be850db8ae0c826e2782a60e8)
* base-files: add protocol ncm support for ucidef_set_interface()Arınç ÜNAL2023-05-181-0/+1
| | | | | | | Make it possible to set up a default network (interface) for devices with cellular modems using NCM. Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
* base-files: Do not break on non-eth portsOlliver Schinagl2023-05-091-2/+0
| | | | | | | | | | | | | | When using OpenWRT with DSA and 'lan' ports, we could get an empty `next_eth`. This is of course not desirable, as this causes `sh: out of range` errors when trying to determine which one would be greater. It turns out, that we don't even need this check at all because, when looking for all existin eth*s on a system, and take the highest index and then iterate a set of devices and rename to eth${highest_index+n}, it is guaranteed that there will be no conflict. Fixes: b688bf83f9d6 ("base-files: rename ethernet devs on known boards") Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
* base-files: add 'isup' to the wifi scriptAndre Heider2023-04-121-1/+18
| | | | | | | | | | | | | | This is a silent command that allows easy wifi up/down automation for scripts. It takes one or multiple devices as arguments (or all if none are passed), and the exit code indicates if any of those is not up. E.g.: wifi isup && echo "all wifi devices are up" wifi isup radio0 || echo "this wifi is down" Signed-off-by: Andre Heider <a.heider@gmail.com>
* base-files: use named variables in the wifi scriptAndre Heider2023-04-121-2/+2
| | | | | | | Use the already present but unused $cmd and $dev variables instead of positional parameters in ubus_wifi_cmd() to improve readability. Signed-off-by: Andre Heider <a.heider@gmail.com>
* base-files: fix nand_upgrade_ubinized()Rafał Miłecki2023-04-111-1/+3
| | | | | | | | | | | | | | | | | | When using "ubiformat" with stdin it requires passing image size using the -S argument. Provide it just like we do for "ubiupdatevol". This fixes: ubiformat: error!: must use '-S' with non-zero value when reading from stdin This change fixes sysupgrade for bcm53xx and bcm4908 NAND devices possibly some other targets too. Cc: Rodrigo Balerdi <lanchon@gmail.com> Cc: Daniel Golle <daniel@makrotopia.org> Fixes: 971071212052 ("base-files: accept gzipped nand sysupgrade images") Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Daniel Golle <daniel@makrotopia.org> Tested-by: Koen Vandeputte <koen.vandeputte@citymesh.com>
* base-files: add support for retrieving IPv6 assignmentsMark Baker2023-02-241-0/+14
| | | | | | | In DHCPv6-PD enabled environments, addresses are assigned to interfaces. These new functions retrieve the IPv6 assigned prefix(es). Signed-off-by: Mark Baker <mark@vpost.net>
* base-files: sysfixtime: Fix time on the fake RTCYuan Tao2023-02-191-6/+16
| | | | | | | | | | | | | | | On some devices the chip has RTC but no battery save time. This leads back to getting the wrong time and skipping the check of the last file modification date. This commit ensures that the file time is checked even if the RTC exists. which would ordinarily return an approbiate system time used for e.g. certificate generation. Tested-on: NanoPi R2S Signed-off-by: Yuan Tao <ty@wevs.org>
* treewide: replace /sys/devices/virtual/ubi by /sys/class/ubiDaniel Golle2023-02-151-5/+4
| | | | | | | | | | Starting from Linux Kernel version 6.3 UBI devices will no longer be considered virtual, but rather have an MTD device parent. Hence they will no longer be listed under /sys/devices/virtual/ubi which is used in multiple places in OpenWrt. Prepare for future kernels by using /sys/class/ubi instead of /sys/devuces/virtual/ubi. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: ipcalc.sh: fix awk regex syntaxLeon M. George2023-02-071-1/+1
| | | | | | It worked fine before but gawk warns about it. Signed-off-by: Leon M. George <leon@georgemail.eu>
* base-files: ipcalc.sh: trim for statementLeon M. George2023-02-071-2/+8
| | | | | | For gawk compatibility. Signed-off-by: Leon M. George <leon@georgemail.eu>
* base-files: ipcalc.sh: use shebang to invoke awkLeon M. George2023-02-071-3/+1
| | | | | | | | | | | There's hardly an shell logic in ipcalc.sh and a $* that would garble parameter positions. Move the awk invokation to the shebang. A rename from "ipcalc.sh" to "ipcalc" is desirable but could prove tricky with packages in other repositories depending on the filename. Signed-off-by: Leon M. George <leon@georgemail.eu>
* base-files: ipcalc.sh: fail when network is too smallLeon M. George2023-02-071-1/+7
| | | | | | | | It's possible to move range boundaries in a way that the start address lies behind the end address. Detect this condition and exit with an error message. Signed-off-by: Leon M. George <leon@georgemail.eu>
* base-files: ipcalc.sh: don't include own address in rangeLeon M. George2023-02-071-0/+7
| | | | | | Make sure our own address doesn't lie in the calculated range. Signed-off-by: Leon M. George <leon@georgemail.eu>
* base-files: ipcalc.sh: check for params before calculating start/endLeon M. George2023-02-071-12/+13
| | | | | | | With this patch, ipcalc only calculates range boundaries if the corresponding parameters are supplied. Signed-off-by: Leon M. George <leon@georgemail.eu>
* base-files: upgrade: Fix export_partdevice() quotingBrian Norris2023-02-031-1/+1
| | | | | | | | | | $BOOTDEV_MAJOR may be empty for many of the uevents parsed in this function. This condition thus tends to fail benignly (we just skip to the next device), but it can really clutter the stage2 sysupgrade stderr, since it looks like the "=" operand doesn't have an appropriate left-hand argument. Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* base-files: fix nand_do_platform_check failChen Minqiang2023-01-291-1/+5
| | | | | | | | | | | | This change ensures compatibility with both types of sysupgrade-tar files. 1. For some boards like xiaomi,redmi-router-ax6s, sysupgrade-tar is pack in directory `vendor,name/` 2. For some boards like xiaomi,mi-router-3g, sysupgrade-tar is pack in directory `vendor_name/` Signed-off-by: Chen Minqiang <ptpt52@gmail.com>
* base-files: Remove nand.sh dependency from emmc upgradeBrian Norris2023-01-213-31/+30
| | | | | | | | | | | | emmc_do_upgrade() relies on identify() from the nand.sh upgrade helper. This only works because FEATURES=emmc targets also tend to include FEATURES=nand. Rename identify_magic() to identify_magic_long() to match the common.sh style and make it clear it pairs with other *_long() variants (and not, say *_word()). Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* base-files: rework mtd_get_mac_text()Michael Pratt2023-01-061-11/+5
| | | | | | | | | | | | | | It's necessary to be able to specify the length for MAC addresses that are stored in flash, for example, in a case where it is stored without any delimiter. Let both offset and length have default values. Add a sanity check related to partition size. Also, clean up syntax and unnecessary lines. Signed-off-by: Michael Pratt <mcpratt@pm.me>
* ramips: add basic support for tp-link er605-v2Nikolay Martynov2023-01-041-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a MT7621-based device with 128MB NAND flash, 256MB RAM, and a USB port. The board has headers to attach console. In order for them to work two solder bridges near those pads need to be made. The defice has the following partition table: ``` 0x000000000000-0x000000080000 : "u-boot" 0x000000080000-0x000000100000 : "u-boot-env" 0x000000100000-0x000000140000 : "factory" 0x000000140000-0x000007e00000 : "firmware" 0x000007e00000-0x000008000000 : "panic-ops" ``` `firmware` partition contains UBI volumes. Unfortunately I accidentally wiped partition and I no longer have access to it. `firmware` partition contains 'secondary' U-Boot which is run by 'first' u-boot. It also contains various configuration partitions that include device info and MAC address. There also seems to be 'primary' and 'backup' set of 'main' volumes. U-boot has `mtkupgrade` command that just overrides data on firmware partitions. Firmware file provided by TP-Link cannot be used with that command. U-boot also has 'recovery' http server. Unfortunately I was not able to make it work with manufacturer's firmware. Manufacturer's firmware essentially contains multiple UBI volumes along with 'partition table'. Unfortunately I no longer can properly run manufacturer's firmware so I cannot at the moment try to a support for building 'factory' images. This patch adds support for initramfs image as well as sysupgrade image. This seems to be pretty standard MT7621 board otherwise. Things that work: * network * leds * usb * factory MAC detection Signed-off-by: Nikolay Martynov <mar.kolya@gmail.com>
* base-files: stage2: add 'tail' to sysupgrade environmentTony Ambardar2022-12-311-1/+1
| | | | | | | This is used to access footer data in firmare files, and is simpler and less error-prone than using 'dd' with calculated offsets. Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
* sunxi: ensure NanoPi R1 has unique MAC addressJan-Niklas Burfeind2022-12-251-0/+8
| | | | | | | | | | | | | | | | | | | | Ensure the MAC address for all NanoPi R1 boards is assigned uniquely for each board. The vendor ships the device in two variants; one with and one without eMMC; but both without static mac-addresses. In order to assign both board types unique MAC addresses, fall back on the same method used for the NanoPi R2S and R4S in case the EEPROM chip is not present by generating the board MAC from the SD card CID. [0] https://wiki.friendlyelec.com/wiki/index.php/NanoPi_R1#Hardware_Spec Similar too and based on: commit b5675f500daf ("rockchip: ensure NanoPi R4S has unique MAC address") Co-authored-by: David Bauer <mail@david-bauer.net> Signed-off-by: Jan-Niklas Burfeind <git@aiyionpri.me>
* base-files: sysupgrade-tar: allow separated kernel/rootfs ubiChuanhong Guo2022-12-171-14/+27
| | | | | | | | | | There are some devices putting kernel and rootfs on separated ubi volumes. To make OpenWrt compatible with their bootloader, we need to put kernel and rootfs into separated ubi volumes. Add support for CI_KERN_UBIPART and CI_ROOT_UBIPART for this situation. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* base-files: split ubi attaching out of nand_upgrade_prepare_ubiChuanhong Guo2022-12-171-27/+38
| | | | | | | split ubi reformat/attach into nand_attach_ubi in preparation for reusing this code in other functions. Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
* base-files: bring back nand_do_upgrade_successDaniel Golle2022-10-301-1/+9
| | | | | | | | | | | | Several Broadcom targets were using the nand_do_upgrade_success shell function which has been removed by commit e25e6d8e54 ("base-files: fix and clean up nand sysupgrade code"). Refactor the new nand_do_upgrade to bring back nand_do_upgrade_success with the behavior expected by those users. Fixes: e25e6d8e54 ("base-files: fix and clean up nand sysupgrade code") Reported-by: Chen Minqiang <ptpt52@gmail.com> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: verify nand sysupgrade imagesRodrigo Balerdi2022-10-302-20/+58
| | | | | | | For nand sysupgrade image files having tar/gzip/tgz envelopes, verify envelope integrity before starting sysupgrade. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: accept gzipped nand sysupgrade imagesRodrigo Balerdi2022-10-301-31/+55
| | | | | | | | | | | | | | | | When firmware images only contained compressed kernels and squashfs roots, uncompressed tar files were a good option. We are now using UBIFS images, both raw and tarred, as well as ubinized (full UBI partition) images, all of which benefit greatly from compression. For example, a raw ubinized backup taken from a running Askey RT4230W REV6 (such full backups can be restored via the LUCI's sysupgrade UI) is over 400 MB, but compresses to less than 10 MB. This commit adds support for gzipped versions of all file types already accepted by the nand sysupgrade mechanism, be them raw or tarred. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: fix ubinized nand sysupgradeRodrigo Balerdi2022-10-302-14/+33
| | | | | | | | | | | | It has been reported that ubinized nand sysupgrade fails under certain circumstances, being unable to detach the existing ubi partition due to volumes within the partition being mounted. This is an attempt to solve such issues by unmounting and removing ubiblock devices and unmounting ubi volumes within the target partition prior to detaching and formatting it. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: fix and clean up nand sysupgrade codeRodrigo Balerdi2022-10-301-38/+42
| | | | | | | | | | - Never return from 'nand_do_upgrade', not even in case of errors, as that would cause execution of sysupgrade code not intended for NAND devices. - Unify handling of sysupgrade success and failure. - Detect and report more error conditions. - Fix outdated/incorrect/unclear comments. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: wifi: for wifi reconf, scan_wifi after network reloadBob Cantor2022-10-251-1/+1
| | | | | | | | | | | Commit e8b542960921 included an unintended change and we now call scan_wifi before a network reload. Restore the original behaviour and call scan_wifi only after a network reload. Fixes: e8b542960921 ("base-files: wifi: tidy up the reconf code") Signed-off-by: Bob Cantor <bobc@confidesk.com>
* base-files: wifi: for wifi up, scan_wifi after network reloadBob Cantor2022-10-251-1/+1
| | | | | | | | | | | Commit b82cc8071366 included an unintended change and we now call scan_wifi before a network reload. Restore the original behaviour and call scan_wifi only after a network reload. Fixes: b82cc8071366 ("base-files: wifi: swap the order of some ubus calls") Signed-off-by: Bob Cantor <bobc@confidesk.com>
* base-files: add protocol qmi/mbim support for ucidef_set_interface()Andrey Butirsky2022-10-181-0/+8
| | | | | | | | Make it possible to setup default WAN interface for devices with built-in LTE modems, using QMI or MBIM. Signed-off-by: Andrey Butirsky <butirsky@gmail.com> Reviewed-by: Lech Perczak <lech.perczak@gmail.com>
* base-files: add helper functions for adding wlan device entries to board.jsonFelix Fietkau2022-10-142-0/+19
| | | | | | | | | | | These will be used to give WLAN PHYs a specific name based on path specified in board.json. The platform board.d script can assign a specific order based on available slots (PCIe slots, WMAC device) and device tree configuration. This helps with maintaining config compatibility in case the device path changes due to kernel upgrades. Signed-off-by: Felix Fietkau <nbd@nbd.name>
* base-files: Actually set default nameOlliver Schinagl2022-09-221-1/+1
| | | | | | | | | | | The currently used shell expansion doesn't seem to exist [0] and also does not work. This surely was not intended, so lets allow default naming to actually work. [0]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html Fixes: be09c5a3cd65 ("base-files: add board.d support for bridge device") Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
* ath79: add support for TP-Link Deco S4Nick French2022-09-111-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for TP-Link Deco S4 wifi router The label refers to the device as S4R and the TP-Link firmware site calls it the Deco S4 v2. (There does not appear to be a v1) Hardware (and FCC id) are identical to the Deco M4R v2 but the flash layout is ordered differently and the OEM firmware encrypts some config parameters (including the label mac address) in flash In order to set the encrypted mac address, the wlan's caldata node is removed from the DTS so the mac can be decrypted with the help of the uencrypt tool and patched into the wlan fw via hotplug Specifications: SoC: QCA9563-AL3A RAM: Zentel A3R1GE40JBF Wireless 2.4GHz: QCA9563-AL3A (main SoC) Wireless 5GHz: QCA9886 Ethernet Switch: QCA8337N-AL3C Flash: 16 MB SPI NOR UART serial access (115200N1) on board via solder pads: RX = TP1 pad TX = TP2 pad GND = C201 (pad nearest board edge) The device's bootloader and web gui will only accept images that were signed using TP-Link's RSA key, however a memory safety bug in the bootloader can be leveraged to install openwrt without accessing the serial console. See developer forum S4 support page for link to a "firmware" file that starts a tftp client, or you may generate one on your own like this: ``` python - > deco_s4_faux_fw_tftp.bin <<EOF import sys from struct import pack b = pack('>I', 0x00008000) + b'X'*16 + b"fw-type:" \ + b'x'*256 + b"S000S001S002" + pack('>I', 0x80060200) \ b += b"\x00"*(0x200-len(b)) \ + pack(">33I", *[0x3c0887fc, 0x35083ddc, 0xad000000, 0x24050000, 0x3c048006, 0x348402a0, 0x3c1987f9, 0x373947f4, 0x0320f809, 0x00000000, 0x24050000, 0x3c048006, 0x348402d0, 0x3c1987f9, 0x373947f4, 0x0320f809, 0x00000000, 0x24050000, 0x3c048006, 0x34840300, 0x3c1987f9, 0x373947f4, 0x0320f809, 0x00000000, 0x24050000, 0x3c048006, 0x34840400, 0x3c1987f9, 0x373947f4, 0x0320f809, 0x00000000, 0x1000fff1, 0x00000000]) b += b"\xff"*(0x2A0-len(b)) + b"setenv serverip 192.168.0.2\x00" b += b"\xff"*(0x2D0-len(b)) + b"setenv ipaddr 192.168.0.1\x00" b += b"\xff"*(0x300-len(b)) + b"tftpboot 0x81000000 initramfs-kernel.bin\x00" b += b"\xff"*(0x400-len(b)) + b"bootm 0x81000000\x00" b += b"\xff"*(0x8000-len(b)) sys.stdout.buffer.write(b) EOF ``` Installation: 1. Run tftp server on pc with static ip 192.168.0.2 2. Place openwrt "initramfs-kernel.bin" image in tftp root dir 3. Connect pc to router ethernet port1 4. While holding in reset button on bottom of router, power on router 5. From pc access router webgui at http://192.168.0.1 6. Upload deco_s4_faux_fw_tftp.bin 7. Router will load and execture in-memory openwrt 8. Switch pc back to dhcp or static 192.168.1.x 9. Flash openwrt sysupgrade image via luci/ssh at 192.168.1.1 Revert to stock: Press and hold reset button while powering device to start the bootloader's recovery mode, where stock firmware can be uploaded via web gui at 192.168.0.1 Please note that one additional non-github commits is also needed: firmware-utils: add tplink-safeloader support for Deco S4 Signed-off-by: Nick French <nickfrench@gmail.com>
* base-files: rename ethernet devs on known boardsMartin Kennedy2022-09-102-0/+51
| | | | | | | | | | | | | | | | Some platforms lack an established way to name netdevs; for example, on x86, PCIe-based ethernet interfaces will be named starting from eth0 in the order they are probed. This is a problem for many devices supported explicitly by OpenWrt which have hard-wired, standalone or on-CPU NICs not supported by DSA (which is usually used to rename the ports based on their ostensible function). To fix this, add a mapping between ethernet device name and sysfs device path to board.json; this allows us to configure ethernet device names we know about for a given board so that they correspond to external labeling. Signed-off-by: Martin Kennedy <hurricos@gmail.com>
* base-files: support "metric" in board.jsonRafał Miłecki2022-09-101-1/+2
| | | | | | | It allows prepopulating /etc/config/network interface-s with predefined metric. It may be useful for devices with multiple WAN ports. Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
* base-files: add mtd_get_mac_encrypted_arcadyan functionMikhail Zhilkin2022-08-191-0/+31
| | | | | | | | | Some Arcadyan devices (e.g. MTS WG430223) keep their config in encrypted mtd. This adds mtd_get_mac_encrypted_arcadyan() function to get the MAC address from the encrypted partition. Function uses uencrypt utility for decryption (and openssl if the uencrypt wasn't found). Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
* base-files: LED/trigger/heartbeat: Add support for inversionOlliver Schinagl2022-08-061-0/+4
| | | | | | | | | The heartbeat trigger has the option to be inverted, however openwrt/uci/luci have no way to set this. This patch adds this support. Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
* base-files: LED/gpio: Ensure inverted is read as a booleanOlliver Schinagl2022-08-061-1/+1
| | | | | | | The sysfs interface for the GPIO takes a boolean value. Ensure we get one from uci. Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
* failsafe: run on all consoles listed in /proc/cmdlineMark Mentovai2022-06-192-35/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On x86, when both CONFIG_GRUB_CONSOLE and CONFIG_GRUB_SERIAL are set (as they are by default), the kernel command line will have two console= entries, such as console=tty0 console=ttyS0,115200n8 Failsafe was only running a shell on the first defined console, the VGA console. This is a problem for devices like apu2, where there is only a serial console and it appears on ttyS0. Moreover, the console prompt to enter failsafe during boot was delivered to, and its input read from, the last console= on the kernel command line. So while the failsafe shell was on the first defined console, only the last defined console could be used to enter failsafe during boot. In contrast, the x86 bootloader (GRUB) operates on both the serial console and the VGA console by virtue of "terminal_{input,output} console serial". GRUB also provided an alternate means to enter failsafe from either console. The presence of two console= kernel command line parameters causes kernel messages to be delivered to both. Under normal operation (not failsafe), procd runs login in accordance with inittab, which on x86 specifies ttyS0, hvc0, and tty1, allowing login through any of serial, hypervisor, or VGA console. Thus, serial access was consistently available on x86 devices with serial consoles under normal operation, except for shell access in failsafe mode (without editing the kernel command line). By presenting the failsafe prompt, reading failsafe prompt input, and running failsafe shells on all consoles listed in /proc/cmdline, failsafe mode will work correctly on devices with a serial console (like apu2), and the same image without any need for reconfiguration can be shared by devices with the more traditional (for x86) VGA console. This improvement should benefit any system with multiple console= arguments, including x86 and bcm27xx (Raspberry Pi). Signed-off-by: Mark Mentovai <mark at moxienet.com>
* base-files: allow ignoring minor compat-version checkDavid Bauer2022-06-182-0/+5
| | | | | | | | | | | | Downstream projects might re-generate device-specific configuration based on OpenWrt's defaults on each upgrade, thus being unaffected by forward- as well as backwards-breaking configuration. Add a new sysupgrade parameter, which allows sysupgrades between minor compat-versions. Upgrades will still fail upon mismatching major compat versions. Signed-off-by: David Bauer <mail@david-bauer.net>
* base-files: simplify restorecon logicDaniel Golle2022-05-021-2/+2
| | | | | | | | | Remove forgotten redundant selinuxenabled call and skip the whole thing in case $IPKG_INSTROOT is set as labels are anyway applied only later on in fakeroot when squashfs is created. Fixes: 6d7272852e ("base-files: add missing $IPKG_INSTROOT to restorecon call") Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: add missing $IPKG_INSTROOT to restorecon callDaniel Golle2022-05-021-1/+3
| | | | | | | Update to overlooked v2 version of Dominick Grift's patch. Fixes: 5109bd164c ("base-files: address sed in-place without SELinux awareness") Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: address sed in-place without SELinux awarenessDominick Grift2022-05-021-0/+1
| | | | | | | | | | | | sed(1) in busybox does not support this functionality: https://git.savannah.gnu.org/cgit/sed.git/tree/sed/execute.c#n598 This causes /etc/group to become mislabeled when a package requests that a uid/gid be added on OpenWrt with SELinux Signed-off-by: Daniel Golle <daniel@makrotopia.org> [move restorecon inside lock] Signed-off-by: Dominick Grift <dominick.grift@defensec.nl>
* base-files: fix sysupgrade for kernel-out-of-UBIRodrigo Balerdi2022-05-021-2/+6
| | | | | | | | | | | | | | | | | | | | Commit ecbcc0b59551 bricks devices on which the raw kernel and UBI mtd partitions overlap. This is the case of the ZyXEL NR7101 for example. Its OEM bootloader has no UBI support. OpenWrt splits the stock kernel mtd partition into a raw kernel part used by the bootloader and a UBI part used to store rootfs and rootfs_data. Running mtd erase on the complete partition during sysupgrade erases the UBI part and results in a soft brick. Arguably the best solution would be to fix the partition layouts so that kernel and UBI partitions do not overlap, also including a stock_kernel partition to help reverting to stock firmware. This would have the added benefit of protecting UBI from kernel images that are excessively large. Fixes: ecbcc0b59551 ("base-files: safer sysupgrade.tar for kernel-out-of-UBI") Reported-by: Bjørn Mork <bjorn@mork.no> Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: minimize critical time in sysupgradeRodrigo Balerdi2022-04-191-5/+6
| | | | | | | | Attempt to minimize the time during which an interrupted nand sysupgrade can lead to a non-functional device by flushing caches before starting the upgrade procedure. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: trim unnecessary nand sysupgrade codeRodrigo Balerdi2022-04-191-4/+1
| | | | | | Remove unnecessary sync commands during nand sysupgrade. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: fix issues in nand sysupgradeRodrigo Balerdi2022-04-191-10/+21
| | | | | | | | | Fix issues while retaining configuration during nand sysupgrade: - abort configuration saving if data partition is not found - generate diagnostics if saving fails (eg, because of lack of space) - do not output "sysupgrade successful" in case of errors Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>