summaryrefslogtreecommitdiffstats
path: root/package/base-files/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* base-files: skip fix-group-user uci-default for APK installationChristian Marangi2024-06-111-0/+2
| | | | | | | | | | For APK installation we don't have /usr/lib/opkg/info and user fixup are handled dirrectly. Skip the script in such case. Also remove this uci-defaults if we have CONFIG_USE_APK enabled. Link: https://github.com/openwrt/openwrt/pull/15543 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* build: generate private key for APK earlyDaniel Golle2024-05-221-6/+0
| | | | | | | | | | | | Other than OPKG which only uses signed package list, APK uses individually signed packages in addition to signed package lists. Hence, in order to be able to generate package, the private key needs to be generated before compiling packages. Express that dependency and generate the private key before building any packages instead of doing so as part of the base-files package build. Fixes: d788ab376f ("build: add APK package build capabilities") Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: correctly split install-key function for APKPaul Spooren2024-05-171-4/+7
| | | | | | | | | The function incorrectly tried to APK keys even if there were none. Correctly separate it into its own `ifdef` section. Signed-off-by: Paul Spooren <mail@aparcar.org> Link: https://github.com/openwrt/openwrt/pull/15519 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* build: add APK package build capabilitiesPaul Spooren2024-05-171-4/+21
| | | | | | | | | A new option called `USE_APK` is added which generated APK packages (.apk) instead of OPKG packages (.ipk). Some features like fstools `snapshot` command are not yet ported Signed-off-by: Paul Spooren <mail@aparcar.org>
* treewide: use APK compatible version schemaPaul Spooren2024-03-221-1/+1
| | | | | | | | | | | | | | | | | Different from OPKG, APK uses a deterministic version schema which chips the version into chunks and compares them individually. This enforces a certain schema which was previously entirely flexible. - Releases are added at the very and end prefixed with an `r` like `1.2.3-r3`. - Hashes are prefixed with a `~` like `1.2.3~abc123`. - Dates become semantic versions, like `2024.04.01` - Extra tags are possible like `_git`, `_alpha` and more. For full details see the APK test list: https://gitlab.alpinelinux.org/alpine/apk-tools/-/blob/master/test/version.data Signed-off-by: Paul Spooren <mail@aparcar.org>
* base-files: Create /root w/ appropriate permissionsPhilip Prindeville2023-11-121-1/+2
| | | | | | | If /root is created with too permissive permissions, then sshd won't trust the contents of /root/.ssh as being adequately protected. Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
* treewide: disable QUILT refresh for unsupported packagesChristian Marangi2023-10-201-0/+3
| | | | | | | | | Some packages won't ever have something to patch as they normally install files or are meta-packages. For these special packages, disable QUILT refresh. Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
* build: add option to use preinit IP as LAN IPStijn Tintel2023-02-171-0/+13
| | | | | | | | | | | We currently have build options to customize the IP address used in the preinit phase of the boot process, but not to set the default LAN IP. Introduce a boolean build option that, when enabled, results in the IP address configured for the preinit phase, to be also used as the default LAN IP address. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
* base-files: add eMMC sysupgrade supportEnrico Mioso2021-12-021-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | Adds generic support for sysupgrading on eMMC-based devices. Provide function emmc_do_upgrade and emmc_copy_config to be used in /lib/upgrade/platform.sh instead of redundantly implementing the same logic over and over again. Similar to generic sysupgrade on NAND, use environment variables CI_KERNPART, CI_ROOTPART and newly introduce CI_DATAPART to indicate GPT partition names to be used. On devices with more than one MMC block device, CI_ROOTDEV can be used to specify the MMC device for partition name lookups. Also allow to select block devices directly using EMMC_KERN_DEV, EMMC_ROOT_DEV and EMMC_DATA_DEV, as using GPT partition names is not always an option (e.g. when forced to use MBR). To easily handle writing kernel and rootfs make use of sysupgrade.tar format convention which is also already used for generic NAND support. Signed-off-by: Enrico Mioso <mrkiko.rs@gmail.com> Signed-off-by: Daniel Golle <daniel@makrotopia.org> CC: Li Zhang <li.zhang@gl-inet.com> CC: TruongSinh Tran-Nguyen <i@truongsinh.pro>
* base-files: reduce number of `mkdir` callsPaul Spooren2021-09-231-17/+19
| | | | | | | | | | | | | The `mkdir` commands supports passing multiple arguments to batch create multiple folders, instead of calling the tool every single time. If the creation of one of the folders fails, all other folder are still created and therefore doesn't change the error handling. Also stop creating `/etc/` explicitly after subfolders of `/etc/` were already created. Signed-off-by: Paul Spooren <mail@aparcar.org>
* base-files: reduce `sed` callsPaul Spooren2021-09-231-4/+2
| | | | | | | | | The `sed`-script shouldn't be called multiple times, especially not with the same files. This commit merges all files together in a single `sed`-script call. Signed-off-by: Paul Spooren <mail@aparcar.org>
* base-files: fix option to make /var persistentStijn Tintel2021-08-231-1/+1
| | | | | | | | | | | | The option was initially named TARGET_ROOTFS_LN_VAR_TMP, and the check was correct. When renaming the option to something more suitable, the check was changed to check for n, but when an option is not set, it's not n but empty. This results in the check always evaluating to false. Fix the check by checking for y with ifneq. Fixes: 57807f50ded6 ("base-files: add option to make /var persistent") Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
* base-files: add option to make /var persistentStijn Tintel2021-08-221-0/+5
| | | | | | | | | | | | | | | | In OpenWrt, /var is symlinked to /tmp by default. This is done to reduce the amount of writes to the flash chip, which often have not the greatest durability. As a result, things like DHCP or UPnP lease files, are not persistent across reboots. Since OpenWrt can run on devices with more durable storage, it makes sense to have an option for a persistent /var. Add an option to make /var persistent. When enabled, /var will no longer be symlinked to /tmp, but /var/run will be symlink to /tmp/run, as it should contains only files that should not be kept during reboot. The option is off by default, to maintain the current behaviour. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
* base-files: rename 'sdcard' to 'legacy-sdcard'Daniel Golle2021-08-161-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While an image layout based on MBR and 'bootfs' partition may be easy to understand for users who are very used to the IBM PC and always have the option to access the SD card outside of the device (and hence don't really depend on other recovery methods or dual-boot), in my opinion it's a dead end for many desirable features on embedded systems, especially when managed remotely (and hence without an easy option to access the SD card using another device in case things go wrong, for example). Let me explain: * using a MSDOS/VFAT filesystem to store kernel(s) is problematic, as a single corruption of the bootfs can render the system into a state that it no longer boots at all. This makes dual-boot useless, or at least very tedious to setup with then 2 independent boot partitions to avoid the single point of failure on a "hot" block (the FAT index of the boot partition, written every time a file is changed in bootfs). And well: most targets even store the bootloader environment in a file in that very same FAT filesystem, hence it cannot be used to script a reliable dual-boot method (as loading the environment itself will already fail if the filesystem is corrupted). * loading the kernel uImage from bootfs and using rootfs inside an additional partition means the bootloader can only validate the kernel -- if rootfs is broken or corrupted, this can lead to a reboot loop, which is often a quite costly thing to happen in terms of hardware lifetime. * imitating MBR-boot behavior with a FAT-formatted bootfs partition (like IBM PC in the 80s and 90s) is just one of many choices on embedded targets. There are much better options with modern U-Boot (which is what we use and build from source for all targets booting off SD cards), see examples in mediatek/mt7622 and mediatek/mt7623. Hence rename the 'sdcard' feature to 'legacy-sdcard', and prefix functions with 'legacy_sdcard_' instead of 'sdcard_'. Tested-by: Stijn Tintel <stijn@linux-ipv6.be> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: add generic sdcard upgrade methodStijn Tintel2021-08-071-0/+9
| | | | | | | | Add a generic sdcard upgrade method instead of duplicating code in yet another target, and add a feature flag to only install this upgrade method in targets that set this flag. Copied from mvebu. Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
* busybox: preserve crontabsPhilip Prindeville2021-05-191-1/+0
| | | | | | | | | | | | /etc/syslog.conf is used by sysklogd, and /etc/crontabs is used by crond, both features of busybox. Given this, ownership for these files should be bound to busybox, especially if one day there's a way to do an in-place opkg update of busybox. There's also the busybox provided syslogd which uses this file if CONFIG_BUSYBOX_FEATURE_SYSLOGD_CFG is set. Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com>
* build: introduce $(MKHASH)Leonardo Mörlein2021-05-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, it was assumed that mkhash is in the PATH. While this was fine for the normal build workflow, this led to some issues if make TOPDIR="$(pwd)" -C "$pkgdir" compile was called manually. In most of the cases, I just saw warnings like this: make: Entering directory '/home/.../package/gluon-status-page' bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found bash: line 1: mkhash: command not found [...] While these were only warnings and the package still compiled sucessfully, I also observed that some package even fail to build because of this. After applying this commit, the variable $(MKHASH) is introduced. This variable points to $(STAGING_DIR_HOST)/bin/mkhash, which is always the correct path. Signed-off-by: Leonardo Mörlein <me@irrelefant.net>
* base-files: bump Copyright to 2021Paul Spooren2021-01-261-1/+1
| | | | | | | | | | This commit is only added to keep the PKG_RELEASE correct after fixing the $(COMMITCOUNT) logic in the previous commit. This way the PKG_RELEASE stays the same while the compiled packages content isn't changed. Signed-off-by: Paul Spooren <mail@aparcar.org>
* base-files: use $(COMMITCOUNT) in PKG_RELEASEPaul Spooren2021-01-221-1/+1
| | | | | | | | | The newly added `$(COMMITCOUNT)` varialbe allows automatic versioning based on the number of Git commits of a package. Replace *tedious to bump* and *merge conflict causing* `PKG_RELEASE` and replace it with `$(COMMITCOUNT)`. Signed-off-by: Paul Spooren <mail@aparcar.org>
* base-files: read all 3 bytes in get_magic_vfat() at onceAdrian Schmutzler2021-01-071-1/+1
| | | | | | | While the speed improvement might be negligible, there is still no reason to read individual bytes. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: wifi: add support for 802.11adDaniel Golle2021-01-051-1/+1
| | | | Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: allow reusing of boolean value extraction logicOldřich Jedlička2021-01-011-1/+1
| | | | | | | | | | | | | | | | | | | The `functions.sh` script has `config_get_bool()` function, which is usable when using UCI config direct access API, but there is no equivalent for the callback API. Introduce `get_bool()` function to allow reusing it from init scripts. Example: ```sh option_cb() { local option="$1" local value="$(get_bool "$2")" ... } ``` Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
* base-files: sysupgrade: add function for conffiles retrievalAdrian Schmutzler2020-12-301-1/+1
| | | | | | | | | | | | The find command to retrieve files from /etc/sysupgrade.conf and /lib/upgrade/keep.d/* is used twice in almost the same way. Move it into a function to consolidate, enhance readability and make future adjustments easier. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> Acked-by: Paul Spooren <mail@aparcar.org> Reviewed-by: Philip Prindeville <philipp@redfish-solutions.com>
* base-files: drop banner.failsafe if failsafe is disabledPiotr Dymacz2020-12-221-1/+4
| | | | Signed-off-by: Piotr Dymacz <pepe2k@gmail.com>
* base-files: upgrade: fix initramfs detectionRobert Marko2020-12-201-1/+1
| | | | | | | | | | | | | | | Commit "initramfs: switch to tmpfs to fix ujail" switched initramfs to now use tmpfs, it causes $(rootfs_type) to now return tmpfs when running initramfs image instead of being empty. This broke initramfs detection which prevents config files from being saved as it does not work from initramfs. So, lets test for $(rootfs_type) returning "tmpfs" instead. Fixes: 7fd3c68 ("initramfs: switch to tmpfs to fix ujail) Signed-off-by: Robert Marko <robimarko@gmail.com>
* package/base-files: caldata: use dd iflag fullblockJohn Thomson2020-12-111-1/+1
| | | | | | | | | | | | | | | | This dd flag ensures that the requested size is retrieved from pipes or special filesystems (if available). Without this flag, on multi-core systems, Piped or special filesystem data can be truncated when a size greater than PIPE_BUF is requested. Fixes: FS#3494 Fixes: 7557e7f ("package/base-files: caldata: work around dd's limitation") Cc: Thibaut VARÈNE <hacks@slashdirt.org> Signed-off-by: John Thomson <git@johnthomson.fastmail.com.au>
* base-files: informative service command in /etc/shinit. service command ↵Stan Grishin2020-12-031-1/+1
| | | | | | | | | | | | | | shows services enabled/disabled and running status, when the service command is invoked with no/invalid arguments, like this: Usage: service <service> [command] The following services are available: /etc/init.d/acme enabled stopped /etc/init.d/boot enabled stopped /etc/init.d/cron enabled running /etc/init.d/dnsmasq enabled running ... Signed-off-by: Stan Grishin <stangri@melmac.net>
* base-files: merge /etc/passwd on rw-rootfsImran Khan2020-11-271-1/+1
| | | | | | | | | Support installations without root-overlayfs (and hence without /rom) when migrating user accounts. Signed-off-by: Imran Khan <gururug@gmail.com> Signed-off-by: Daniel Golle <daniel@makrotopia.org> [simplified patch, bumped PKG_RELEASE, cleaned message]
* base-files: fix backwards compatiblity of rc.common EXTRA_COMMANDSMatthias Schiffer2020-11-171-1/+1
| | | | | | | | | | | | | | Avoid needlessly breaking old initscripts that set EXTRA_COMMANDS. This will aid in debugging (as it simplifies reverting to an older version of a package) and unbreaks third-party feeds (and packages that maintain their OpenWrt initscripts as part of the software's repo instead of the OpenWrt feed like fastd). Without this, initscripts that set EXTRA_COMMANDS become completely unusable, as all default commands like start/stop cease working. Fixes: 1a69f50dc627 ("base-files: fix rc.common help alignment") Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
* base-files: bump PKG_RELEASEYousong Zhou2020-11-111-1/+1
| | | | Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
* base-files: add board.d support for bridge deviceJohn Crispin2020-11-041-1/+1
| | | | | | | | | Latest netifd allows us to setup network bridges with implicit vlan tagging. For this to work, we need to setup several additional uci sections. This feature is particularly usefull for DSA tupe devices. Add board.d and uci-defaults support for generating the sections. Signed-off-by: John Crispin <john@phrozen.org>
* base-files: fix rc.common help alignmentFlorian Eckert2020-11-021-1/+1
| | | | | | | | | | | | | | This commit introduces a new function `extra_command` to better format the help text without having to calculate the indentation in every startup script that wants to add a new command. So far it looks weird and is not formatted correctly on some startup scripts. After using the new `extra_command` wrapper the alignement looks correctly. And if the indentation is not sufficient in the future, this can be changed in the function extra_command at a central location. Signed-off-by: Florian Eckert <fe@dev.tdt.de>
* base-files: merge /etc/passwd et al at sysupgrade config restoreDaniel Golle2020-10-221-1/+1
| | | | Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* target: include selinux-variants if CONFIG_SELINUX is setDaniel Golle2020-10-211-1/+1
| | | | | | | | Rather than unconditionally adding busybox and procd to the set of default packages, add busybox-selinux and procd-selinux in case CONFIG_SELINUX is set. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: allow exceptions when removing devicename from LEDsAdrian Schmutzler2020-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Without the model-based devicename for LEDs, there are still cases where a third component is required, typically when it refers to internal "devices" like phys etc. An example are the following two found on ramips: - rt2800soc-phy0::radio - rt2800pci-phy0::radio So far, the rt2800*-phy: prefixes would be removed by the devicename removal ("migration") script, and the configuration for these LEDs would be broken. To address this, this patch allows to add arguments to a call of remove_devicename_leds, which will be compared against the first part of the LED names/labels, and then be ignored by the routine, and thus not removed: remove_devicename_leds "rt2800soc-phy0" "rt2800pci-phy0" This mechanism is supposed to be used when a "devicename" applies to several devices. If only a single device is affected, it might be more effective to use a case statement and exclude the device from migration by that entirely. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: add function to remove devicename from LED labelsAdrian Schmutzler2020-10-021-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, we request LED labels in OpenWrt to follow the scheme modelname:color:function However, specifying the modelname at the beginning is actually entirely useless for the devices we support in OpenWrt. In patches subsequent to this one, we will thus remove the modelname from the label definitions on various targets. To migrate the existing definitions from older installations, a migration script needs to be deployed that does modelname:color:function -> color:function e.g. dir-789:green:status -> green:status This patch introduces two functions that do exactly that: For each entry in /etc/config/system, the routine will check whether two (or more) colons are present, and then remove everything up to (and including) the first colon. For now, this will be applied unconditionally, i.e. if the function is called for a device, all labels will be cut like this. However, for a future case of mixed three-part and two-part labels, it should not be too hard to provide a function argument with exceptions to the removal. Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: drop default setup for vconfigAdrian Schmutzler2020-09-161-1/+1
| | | | | | | | | | | | | | | | | vconfig has been disabled by default since 2015 [1] and there are no remaining uses in entire OpenWrt trunk. However, we still set up a specific name_type for it during boot. While this setup is properly implemented to be only triggered when vconfig is present, it still seems anachronistic and unnecessary to set up a standard for a tool that is not used anymore. Therefore, this removes the set_name_type initialization and leaves it for those people actually using the tool to configure it as needed. [1] 899a23227e55 ("busybox: improve applets & deprecate ifconfig, route") Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: disable LEDs if default state is undefinedDavid Bauer2020-09-111-1/+1
| | | | | | | | | | | | | | | Set the default state for LEDs to off. When a trigger is set, the trigger will turn the LED automatically on. Currently LEDs might stay on, e.g. when the LED trigger is set to a netdev trigger and the interface is never activated or the 'none' trigger is selected without setting the 'default' option to 0 and it's set for the LED indicating the system running state. Using off as a default value is also consistent with the documentation in the OpenWrt wiki. Signed-off-by: David Bauer <mail@david-bauer.net>
* base-files: support label-property-less in get_dt_ledsChristian Lamparter2020-09-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The LED's "label" property has been deprecated in upstream by: |commit c5d18dd6b64e09dd6984bda9bdd55160af537a8c |Author: Jacek Anaszewski <jacek.anaszewski@gmail.com> |Date: Sun Jun 9 20:19:04 2019 +0200 | | dt-bindings: leds: Add properties for LED name construction | | Introduce dedicated properties for conveying information about | LED function and color. Mark old "label" property as deprecated. | | Additionally function-enumerator property is being provided | for the cases when neither function nor color can be used | for LED differentiation. in order to be somewhat prepared, this patch adds a fallback as a last resort to make the current led code work by falling back to the node-name as the "label". Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
* treewide: bump PKG_RELEASE after replacing `which`Adrian Schmutzler2020-08-121-1/+1
| | | | | | | | | Bump PKG_RELEASE for the affected packages as replacing "which" by "command -v" represents a content change. Fixes: 1fdf6b745cc3 ("treewide: replace `which` with `command -v`") Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
* base-files: functions.sh: fix config_get() on invalid identifiersJo-Philipp Wich2020-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When passing a section or option value to config_get() which contains characters that happen to be valid variable interpolation expressions, the function returns a nonsensical expression result instead of the expected empty string. When the passed section or option name contains other characters which are not valid within a shell variable name, a substitution error is occuring instead. The issue can be easily reproduced by one of the following examples: root@OpenWrt:~# . /lib/functions.sh root@OpenWrt:~# config load system root@OpenWrt:~# config_get variable invalid-section option root@OpenWrt:~# echo "$variable" section_option:- root@OpenWrt:~# . /lib/functions.sh root@OpenWrt:~# config load system root@OpenWrt:~# config_get variable section invalid-option root@OpenWrt:~# echo "$variable" option:- root@OpenWrt:~# . /lib/functions.sh root@OpenWrt:~# config load system root@OpenWrt:~# config_get variable section invalid@option -ash: eval: syntax error: bad substitution Fix this issue by only performing interpolations when the given section and option arguments are free of illegal characters. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* base-files: mount bpffs at bootTony Ambardar2020-07-311-1/+1
| | | | | | | | | | Explicitly mount the BPF filesystem if available. This is used for pinning eBPF programs and maps, making them accessible to other eBPF programs or from userspace with the help of libbpf or bpftool. Signed-off-by: Tony Ambardar <itugrok@yahoo.com> [daniel@makrotopia.org: bumped PKG_RELEASE] Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* base-files: add function for generating random MACDavid Bauer2020-07-281-1/+1
| | | | | | | | | | This adds a function for generating a valid random MAC address (unset MC bit / set locally administered bit). It is necessary for devices which do not have a MAC address programmed by the manufacturer. Signed-off-by: David Bauer <mail@david-bauer.net>
* base-files: remove urandom-seed definitionSungbo Eo2020-06-231-9/+0
| | | | | | | | urandom-seed has a separate Makefile, we can safely remove the definition here. Fixes: 27bfde9c9f78 ("base-files: move urandom seed bits into separate package") Signed-off-by: Sungbo Eo <mans0n@gorani.run>
* base-files: gpio switch: add named GPIO supportKuan-Yi Li2020-06-181-1/+1
| | | | | | | | | | | | | | | | Previously, gpio_switch only accepts GPIO pin number as input. Once a GPIO pin is exported and named by device tree, its pin state cannot be configured and saved across reboots by UCI. This patch adds support for named GPIO pins. Thus GPIO pin can be exported by device tree with active high/low correctly configured, having human-readable name in /sys/class/gpio/ is also now possible. More importantly, GPIO pins which are referenced by name will be immune from pin mapping breakage while unintentional pin number changes are introduced by kernel or driver updates. Signed-off-by: Kuan-Yi Li <kyli@abysm.org>
* package/base-files: caldata: work around dd's limitationThibaut VARÈNE2020-05-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | tl;dr: dd will silently truncate the output if reading from special files (e.g. sysfs attributes) with a too large bs parameter. This problem was exposed on some RouterBOARD ipq40xx devices which use a caldata payload which is larger than PAGE_SIZE, contrary to all other currently supported RouterBOARD devices: the caldata would fail to properly load with the current scripts. Background: dd doesn't seem to correctly handle read() results that return less than requested data. sysfs attributes have a kernel exchange buffer which is at most PAGE_SIZE big, so only 1 page can be read() at a time. In this case, if bs is larger than PAGE_SIZE, dd will silently truncate blocks to PAGE_SIZE. With the current scripts using bs=<size> count=1, the data is truncated to PAGE_SIZE as soon as the requested <size> exceeds this value. This commit works around this problem by using `cat` in the caldata routines that can read from a file (routines that read from mtd devices are untouched). cat correctly handles partial read requests. The output is then piped to dd with the same parameters as before, to ensure that the resulting file remains exactly the same. This is a simple workaround, the downside is that it uses a pipe and one more executable, and therefore has a larger memory footprint and is slower. This is deemed acceptable considering these routines are only used at boot time. Tested-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* base-files: switch_to_ramfs: add nand-utilsÁlvaro Fernández Rojas2020-05-181-1/+1
| | | | Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
* package/base-files: add caldata_sysfsload_from_file()Thibaut VARÈNE2020-05-081-1/+1
| | | | | | | | This routine enables loading caldata binary via the kernel sysfs loader See https://www.kernel.org/doc/html/v4.19/driver-api/firmware/fallback-mechanisms.html Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* package/base-files: caldata: allow setting target fileThibaut VARÈNE2020-05-081-1/+1
| | | | | | | This will enable platforms to extract caldata to an arbitrary file, or patch mac in an abitrary file. Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
* base-files: don't ship local build key when on buildbotDaniel Golle2020-04-121-1/+3
| | | | | | | | | | Including the local build key in /etc/opkg/keys isn't feasible when building on the buildbot: The included key collides with its copy already in openwrt-keyring which breaks the ImageBuilder. Not including a locally generated key also makes the base-files package more reproducible. Signed-off-by: Daniel Golle <daniel@makrotopia.org>