aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* base-files: clean up nand sysupgrade codeRodrigo Balerdi2022-04-191-9/+9
| | | | | | Fix some inconsistent quoting in nand sysupgrade code. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: clean up ubinized sysupgrade codeRodrigo Balerdi2022-04-191-7/+3
| | | | | | | | Remove redundant check from nand ubinized sysupgrade code. This check has already been done in the only caller of the affected function: nand_do_upgrade. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: clean up nand tar sysupgrade codeRodrigo Balerdi2022-04-191-34/+34
| | | | | | | | | | | | | | | | | Prepares code for ubirename-based safe sysupgrade implementation. Fixes several issues: - the special CI_KERNPART value "none" is ignored if an MTD partition named "none" exists - misleading variable names (such as has_kernel to mean "tar has kernel and it should not be written to an MTD partition but a UBI volume") - inconsistent treatment of zero-length tar member files - inconsistent meaning of "0" and "" variable values - redundant operations (unneeded untaring, repeated untaring, unneeded partition lookups) - inconsistent variable quoting Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: safer sysupgrade.tar for kernel-out-of-UBIRodrigo Balerdi2022-04-191-1/+5
| | | | | | | | | Ensure that the kernel CRC is invalidated while rootfs is being updated. This allows the bootloader to detect an interrupted sysupgrade and fall back to an alternate booting method, such as TFTP, instead of just going ahead with normal boot and effectively bricking the device. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: safer sysupgrade for kernel-in-UBI devicesRodrigo Balerdi2022-04-191-7/+7
| | | | | | | | | | | | | | Ensure that the kernel CRC is invalidated while rootfs is being updated. This allows the bootloader to detect an interrupted sysupgrade and fall back to an alternate booting method, instead of just going ahead with normal boot and effectively bricking the device. Possible fallbacks include a recovery initramfs partition or UBI volume and TFTP. See here for an example U-Boot configuration with fallbacks: https://shorturl.at/befsA (https://github.com/Lanchon/openwrt-tr4400-v2/ blob/e7d707d6bd7839fbd0b8d0bd180fce451df77e47/install-recovery.sh#L52-L63) Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: fix nand sysupgrade commentsRodrigo Balerdi2022-04-191-3/+3
| | | | | | Erroneous comments possibly applied to an earlier code revision. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: improve sysupgrade ubiblock handlingRodrigo Balerdi2022-04-191-16/+18
| | | | | | Only remove ubiblock devices required for nand sysupgrade. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: emit diagnostics on sysupgrade abortRodrigo Balerdi2022-04-191-11/+16
| | | | | | | Emit diagnostics if nand sysupgrade is aborted because UBI partition cannot be attached. Also avoid redudndant checks. Signed-off-by: Rodrigo Balerdi <lanchon@gmail.com>
* base-files: more robust sysupgrade on NANDDaniel Golle2022-04-131-4/+10
| | | | | | | | | Make sure sysupgrade on NAND also works in case of UBI volumes having index >9. While at it, also make sure UBI device is detected and abort in case it isn't. Use Shell built-in shorthand ':' instead of 'true'. Fixes #9708 Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* ipq40xx: Support Chromium OS image-type creationBrian Norris2022-03-251-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | See firmware-utils.git commits [1], which implemented the cros-vbutil verified-boot payload-packing tool, and extended ptgen for the CrOS kernel partition type. With these, it's now possible to package kernel + rootfs to make disk images that can boot a Chrome OS-based system (e.g., Chromebooks, or even a few AP models). Regarding PARTUUID= changes: Chromium bootloaders work well with a partition number offset (i.e., relative to the kernel partition), so we'll be using a slightly different root UUID line. NB: I've made this support specific to ip40xx for now, because I only plan to support an IPQ4019-based AP that uses a Chromium-based bootloader, but this image format can be used for essentially any Chromebook, as well as the Google OnHub, a prior Chromium-based AP using an IPQ8064 chipset. [1] ptgen: add Chromium OS kernel partition support https://git.openwrt.org/?p=project/firmware-utils.git;a=commit;h=6c95945b5de973026dc6f52eb088d0943efa96bb cros-vbutil: add Chrome OS vboot kernel-signing utility https://git.openwrt.org/?p=project/firmware-utils.git;a=commit;h=8e7274e02fdc6f2cb61b415d6e5b2e1c7e977aa1 Signed-off-by: Brian Norris <computersforpeace@gmail.com>
* base-files: add wrapper for procd service list commandFlorian Eckert2022-03-191-0/+8
| | | | | | | | | | | | | | | | A service managed by procd does have a json object with usefull information. This information could by dumped with the following command. ubus call service list "{ 'verbose':true, 'name': '<service-name>)'". }" This line is long and complicated to enter. This commit adds a wrapper call to the procd service section tool to simplify the input and get the output faster. We could now enter the command /etc/initd/<service> info to get the info faster. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* procd: move service command to procdFlorian Eckert2022-03-191-21/+0
| | | | | | | | The service command belongs to the procd and does not belong in the shinit. In the course of the move, the script was also checked with shellcheck and cleaned up. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* base-files: Align rootfs_data upgrades to 64KiB on eMMCBrian Norris2022-03-161-1/+4
| | | | | | | | | | | Rootfs overlays get created at a ROOTDEV_OVERLAY_ALIGN (64KiB) alignment after the rootfs, but emmc_do_upgrade() is assuming it comes at the very next 512-byte sector. Suggested-by: Christian Lamparter <chunkeey@gmail.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com> (move spaces around, mention fstools' libtoolfs) Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
* base-files: call "sync" after initial setupRafał Miłecki2022-03-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | OpenWrt uses a lot of (b)ash scripts for initial setup. This isn't the best solution as they almost never consider syncing files / data. Still this is what we have and we need to try living with it. Without proper syncing OpenWrt can easily get into an inconsistent state on power cut. It's because: 1. Actual (flash) inode and data writes are not synchronized 2. Data writeback can take up to 30 seconds (dirty_expire_centisecs) 3. ubifs adds extra 5 seconds (dirty_writeback_centisecs) "delay" Some possible cases (examples) for new files: 1. Power cut during 5 seconds after write() can result in all data loss 2. Power cut happening between 5 and 35 seconds after write() can result in empty file (inode flushed after 5 seconds, data flush queued) Above affects e.g. uci-defaults. After executing some migration script it may get deleted (whited out) without generated data getting actually written. Power cut will result in missing data and deleted file. There are three ways of dealing with that: 1. Rewriting all user-space init to proper C with syncs 2. Trying bash hacks (like creating tmp files & moving them) 3. Adding sync and hoping for no power cut during critical section This change introduces the last solution that is the simplest. It reduces time during which things may go wrong from ~35 seconds to probably less than a second. Of course it applies only to IO operations performed before /etc/init.d/boot . It's probably the stage when the most new files get created. All later changes are usually done using smarter C apps (e.g. busybox or uci) that creates tmp files and uses rename() that is expected to be atomic. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Sergey Ryazanov <ryazanov.s.a@gmail.com>
* base-file: remove password aging feature form /etc/shadowRucke Teg2022-02-241-1/+1
| | | | | | | | | | | | | | In the default shadow file, as visible in the failsafe mode, the user root has value of `0` set in the 3rd field, the date of last password change. This setting means that the password needs to be changed the next time the user will log in the system. `dropbear` server is ignoring this setting but `openssh-server` tries to enforce it and fails in the failsafe mode because the rootfs is R/O. Disable the password aging feature for user root by setting the 3rd filed empty. Signed-off-by: Rucke Teg <rucketeg@protonmail.com>
* base-files: make sure tools are present in sysupgrade ramdiskDaniel Golle2022-02-221-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not all targets create /var/lock or touch /var/lock/fw_printenv.lock in their platform.sh. This is problematic as fw_printenv then fails in case /var/lock/fw_printenv.lock has not been created by previous calls to fw_printenv/fw_setenv before sysupgrade is run. Targets using fw_printenv/fw_setenv during sysupgrade: * ath79/* * ipq40xx/* * ipq806x/* * kirkwood/* * layerscape/* * mediatek/mt7622 * mvebu/* * ramips/* * realtek/* Targets currently using additional steps in /lib/upgrade/platform.sh to make sure /var/lock/fw_printenv.lock (or at least /var/lock) actually exists: * ath79/* (openmesh devices) * ipq40xx/* (linksys devices) * ipq806x/* (linksys devices) * kirkwood/* (linksys devices) * layerscape/* * mvebu/cortexa9 (linksys devices) Given that accessing the U-Boot environment during sysupgrade is not uncommon and the situation across targets is currently quite diverse, just make sure both tools as well fw_env.config are always copied to the ramdisk used for sysupgrade. Also make sure /var/lock always exists. This now allows to remove copying of fw_printenv/fw_setenv as well as fw_env.config, creation of /var/lock or even /var/lock/fw_printenv.lock from lib/upgrade/platform.sh or files included there. As the same applies also to 'fwtool' which is used by generic eMMC sysupgrade, also always copy that to ramdisk. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: add support for heartbeat led triggerAlexey Smirnov2022-02-191-0/+9
| | | | | | | | | | | This patch adds support for creation heartbeat led trigger with, for example, this command: ucidef_set_led_heartbeat "..." "..." "..." from /etc/board.d/01_leds. Signed-off-by: Alexey Smirnov <s.alexey@gmail.com>
* base-files: Make sure rootfs_data_max is consideredDaniel Golle2022-02-171-8/+5
| | | | | | | | | | | | | | | For sysupgrade on NAND/UBI devices there is the U-Boot environment variable rootfs_data_max which can be used to limit the size of the rootfs_data volume created on sysupgrade. This stopped working reliable with recent kernels, probably due to a race condition when reading the number of free erase blocks from sysfs just after removing a volume. Change the script to just try creating rootfs_data with the desired size and retry with maximum size in case that fails. Hence calculating the available size in the script can be dropped which works around the problem. Signed-off-by: Daniel Golle <daniel@makrotopia.org>