aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/Makefile
diff options
context:
space:
mode:
authorThibaut VARÈNE <hacks@slashdirt.org>2020-05-16 22:18:15 +0200
committerKoen Vandeputte <koen.vandeputte@ncentric.com>2020-05-28 11:22:22 +0200
commit7557e7f267e845db5a403139c49f2637f9021992 (patch)
tree02abb31c408b1d3ba5df0a854fdc8dbb4ddd1085 /package/base-files/Makefile
parentf10da7cb4d44dde346bef73ff4500d91c5730767 (diff)
downloadupstream-7557e7f267e845db5a403139c49f2637f9021992.tar.gz
upstream-7557e7f267e845db5a403139c49f2637f9021992.tar.bz2
upstream-7557e7f267e845db5a403139c49f2637f9021992.zip
package/base-files: caldata: work around dd's limitation
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>
Diffstat (limited to 'package/base-files/Makefile')
-rw-r--r--package/base-files/Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/package/base-files/Makefile b/package/base-files/Makefile
index 5fb275533d..5bf783d0e8 100644
--- a/package/base-files/Makefile
+++ b/package/base-files/Makefile
@@ -12,7 +12,7 @@ include $(INCLUDE_DIR)/version.mk
include $(INCLUDE_DIR)/feeds.mk
PKG_NAME:=base-files
-PKG_RELEASE:=221
+PKG_RELEASE:=222
PKG_FLAGS:=nonshared
PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/