[PATCH fstools] libfstools: support custom executable validating overlay
From: Rafał Miłecki This results in calling /usr/libexec/overlay_verify which may either modify overlay (e.g. wipe it) or refuse it. It's needed by targets that need to validate that "rootfs_data" doesn't come from a previous firmware. They may provide a script that will wipe such /outdated/ overlays. Signed-off-by: Rafał Miłecki --- libfstools/overlay.c | 35 +++ 1 file changed, 35 insertions(+) diff --git a/libfstools/overlay.c b/libfstools/overlay.c index 6790337..281626d 100644 --- a/libfstools/overlay.c +++ b/libfstools/overlay.c @@ -14,6 +14,7 @@ #include #include #include +#include #include @@ -36,6 +37,7 @@ #define SWITCH_JFFS2 "/tmp/.switch_jffs2" #define OVERLAYDIR "/rom/overlay" +#define OVERLAY_VERIFY "/usr/libexec/overlay_verify" static bool keep_sysupgrade; @@ -412,6 +414,33 @@ int fs_state_set(const char *dir, enum fs_state state) return symlink(valstr, path); } +/* + * Call user custom script (if present) that may perform some extra overlay + * validation. + */ +static int overlay_verify(const char *overlay_mp) +{ + struct stat s; + pid_t pid; + + if (stat(OVERLAY_VERIFY, &s)) + return 0; + + pid = fork(); + if (!pid) { + execl(OVERLAY_VERIFY, OVERLAY_VERIFY, overlay_mp, NULL); + exit(EXIT_FAILURE); + } else if (pid > 0) { + int wstatus; + + waitpid(pid, &wstatus, 0); + + if (WIFEXITED(wstatus)) + return WEXITSTATUS(wstatus); + } + + return -1; +} int mount_overlay(struct volume *v) { @@ -432,6 +461,12 @@ int mount_overlay(struct volume *v) if (err) return err; + err = overlay_verify(overlay_mp); + if (err) { + ULOG_ERR("failed to verify overlay: %d\n", err); + return err; + } + /* * Check for extroot config in overlay (rootfs_data) and if present then * prefer it over rootfs_data. -- 2.31.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH fstools 2/2] libfstools: use variable for overlay mount-point
From: Rafał Miłecki This avoids duplicating path over and over. Signed-off-by: Rafał Miłecki --- libfstools/overlay.c | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libfstools/overlay.c b/libfstools/overlay.c index 26f0d6e..6790337 100644 --- a/libfstools/overlay.c +++ b/libfstools/overlay.c @@ -344,16 +344,16 @@ jffs2_switch(struct volume *v) return 0; } -static int overlay_mount_fs(struct volume *v) +static int overlay_mount_fs(struct volume *v, const char *overlay_mp) { char *fstype = overlay_fs_name(volume_identify(v)); - if (mkdir("/tmp/overlay", 0755)) { + if (mkdir(overlay_mp, 0755)) { ULOG_ERR("failed to mkdir /tmp/overlay: %m\n"); return -1; } - if (mount(v->blk, "/tmp/overlay", fstype, + if (mount(v->blk, overlay_mp, fstype, #ifdef OVL_MOUNT_FULL_ACCESS_TIME MS_RELATIME, #else @@ -415,6 +415,7 @@ int fs_state_set(const char *dir, enum fs_state state) int mount_overlay(struct volume *v) { + const char *overlay_mp = "/tmp/overlay"; char *mp, *fs_name; int err; @@ -427,7 +428,7 @@ int mount_overlay(struct volume *v) return -1; } - err = overlay_mount_fs(v); + err = overlay_mount_fs(v, overlay_mp); if (err) return err; @@ -435,21 +436,21 @@ int mount_overlay(struct volume *v) * Check for extroot config in overlay (rootfs_data) and if present then * prefer it over rootfs_data. */ - if (!mount_extroot("/tmp/overlay")) { + if (!mount_extroot(overlay_mp)) { ULOG_INFO("switched to extroot\n"); return 0; } - switch(fs_state_get("/tmp/overlay")) { + switch (fs_state_get(overlay_mp)) { case FS_STATE_UNKNOWN: - fs_state_set("/tmp/overlay", FS_STATE_PENDING); - if (fs_state_get("/tmp/overlay") != FS_STATE_PENDING) { + fs_state_set(overlay_mp, FS_STATE_PENDING); + if (fs_state_get(overlay_mp) != FS_STATE_PENDING) { ULOG_ERR("unable to set filesystem state\n"); break; } case FS_STATE_PENDING: ULOG_INFO("overlay filesystem has not been fully initialized yet\n"); - overlay_delete("/tmp/overlay", true); + overlay_delete(overlay_mp, true); break; case FS_STATE_READY: break; -- 2.31.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH fstools 1/2] libfstools: get rid of "extroot_prefix" global variable
From: Rafał Miłecki Replace it with mount_extroot() argument. It's cleaner than a global var. Signed-off-by: Rafał Miłecki --- libfstools/extroot.c| 7 +-- libfstools/libfstools.h | 3 +-- libfstools/overlay.c| 3 +-- mount_root.c| 3 +-- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/libfstools/extroot.c b/libfstools/extroot.c index 418df94..7cc0b19 100644 --- a/libfstools/extroot.c +++ b/libfstools/extroot.c @@ -23,13 +23,11 @@ #include "libfstools.h" -char const *extroot_prefix = NULL; - /* * This will execute "block extroot" and make use of mounted extroot or return * an error. */ -int mount_extroot(void) +int mount_extroot(char const *extroot_prefix) { char ldlib_path[32]; char block_path[32]; @@ -37,9 +35,6 @@ int mount_extroot(void) struct stat s; pid_t pid; - if (!extroot_prefix) - return -1; - /* try finding the library directory */ snprintf(ldlib_path, sizeof(ldlib_path), "%s/upper/lib", extroot_prefix); diff --git a/libfstools/libfstools.h b/libfstools/libfstools.h index 6aa0e41..340e2dc 100644 --- a/libfstools/libfstools.h +++ b/libfstools/libfstools.h @@ -39,8 +39,7 @@ enum fs_state { __FS_STATE_LAST = FS_STATE_READY, }; -extern char const *extroot_prefix; -extern int mount_extroot(void); +extern int mount_extroot(char const *extroot_prefix); extern int mount_snapshot(struct volume *v); extern int mount_overlay(struct volume *v); diff --git a/libfstools/overlay.c b/libfstools/overlay.c index 352f0f2..26f0d6e 100644 --- a/libfstools/overlay.c +++ b/libfstools/overlay.c @@ -435,8 +435,7 @@ int mount_overlay(struct volume *v) * Check for extroot config in overlay (rootfs_data) and if present then * prefer it over rootfs_data. */ - extroot_prefix = "/tmp/overlay"; - if (!mount_extroot()) { + if (!mount_extroot("/tmp/overlay")) { ULOG_INFO("switched to extroot\n"); return 0; } diff --git a/mount_root.c b/mount_root.c index ca2c31c..d343909 100644 --- a/mount_root.c +++ b/mount_root.c @@ -45,8 +45,7 @@ start(int argc, char *argv[1]) } /* Check for extroot config in rootfs before even trying rootfs_data */ - extroot_prefix = ""; - if (!mount_extroot()) { + if (!mount_extroot("")) { ULOG_NOTE("switched to extroot\n"); return 0; } -- 2.31.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [RFC PATCH 0/5] add support mikrotik routerboard hex poe
Hi, On Sun, 2021-12-26 at 20:41 +0200, Oskari Lemmela wrote: > RFC patchset because of following open questions: > > --- [...] > POE driver is implemented as a kernel module. Every port is separate > hwmon device with same label as the DSA port. [...] > > Should this be implemented in Realtek POE switches as well? > > I haven't created any userspace tools for ubus integration yet > Because I'm not sure if this is the right way to go. > > The hwmon part should be upstremable. Only thing is two non-standard sysfs > controls (force_enable, port_state). They are also possible to implement > as debugfs files if they are not accepted by the upstream. A short general comment, as this would be at least the fourth way to manage PoE devices in OpenWrt (GPIO controlled, realtek poe tool, ubiquiti poe tool). So this is more related to how OpenWrt could interface with PoE hardware in a more generic way, rather than this specific implementation (and I'm certainly not asking you to rewrite anything, Oskari). For controlling the outputs of PoE PSE ports, I had actually been thinking of using the the regulator framework in some way. This could range from simple GPIO controlled PoE ports (fixed-regulator), to actual PoE-controllers with current limits (PoE, PoE+...) and overload detection. That way existing interfaces could be used to manage (regulator) and monitor (regulator or hwmon) the outputs. I fear that adding custom hwmon interfaces for every type of PoE PSE out there just won't scale very well. Not that I've ever actually worked with a regulator driver, so maybe I'm just talking nonsense. I would be happy to hear other opinions about this. :-) Best, Sander ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH v2 2/3] mikrotik: add support for mtd erase of varying sizes
Add support for variable size erase blocks. Enable it in all targets with mikrotik devices. Signed-off-by: Oskari Lemmela Tested-by: Stefan Hellermann --- target/linux/ath79/mikrotik/config-default| 1 + target/linux/generic/config-5.10 | 1 + ...support-for-minor-aligned-partitions.patch | 397 ++ target/linux/ipq40xx/mikrotik/config-default | 1 + target/linux/ramips/mt7621/config-5.10| 1 + 5 files changed, 401 insertions(+) create mode 100644 target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch diff --git a/target/linux/ath79/mikrotik/config-default b/target/linux/ath79/mikrotik/config-default index 74cfdf0423..ee2e4ebe9a 100644 --- a/target/linux/ath79/mikrotik/config-default +++ b/target/linux/ath79/mikrotik/config-default @@ -19,6 +19,7 @@ CONFIG_MTD_NAND_RB91X=y CONFIG_MTD_RAW_NAND=y CONFIG_MTD_ROUTERBOOT_PARTS=y CONFIG_MTD_SPI_NAND=y +CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y CONFIG_MTD_SPLIT_MINOR_FW=y CONFIG_MTD_UBI=y CONFIG_MTD_UBI_BLOCK=y diff --git a/target/linux/generic/config-5.10 b/target/linux/generic/config-5.10 index c37e33b13d..ab7c9b915c 100644 --- a/target/linux/generic/config-5.10 +++ b/target/linux/generic/config-5.10 @@ -3640,6 +3640,7 @@ CONFIG_MTD_ROOTFS_ROOT_DEV=y # CONFIG_MTD_SPI_NOR is not set # CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set CONFIG_MTD_SPI_NOR_USE_4K_SECTORS_LIMIT=4096 +# CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE is not set CONFIG_MTD_SPLIT=y # CONFIG_MTD_SPLIT_BCM63XX_FW is not set # CONFIG_MTD_SPLIT_BCM_WFI_FW is not set diff --git a/target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch b/target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch new file mode 100644 index 00..fe92530081 --- /dev/null +++ b/target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch @@ -0,0 +1,397 @@ +From patchwork Tue Jun 8 04:07:19 2021 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: John Thomson +X-Patchwork-Id: 1489105 +X-Patchwork-Delegate: tudor.amba...@gmail.com +Return-Path: + +X-Original-To: incom...@patchwork.ozlabs.org +Delivered-To: patchwork-incom...@bilbo.ozlabs.org +Authentication-Results: ozlabs.org; + spf=none (no SPF record) smtp.mailfrom=lists.infradead.org + (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; + envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs@lists.infradead.org; + receiver=) +Authentication-Results: ozlabs.org; + dkim=pass (2048-bit key; + secure) header.d=lists.infradead.org header.i=@lists.infradead.org + header.a=rsa-sha256 header.s=bombadil.20210309 header.b=EMabhVoR; + dkim=fail reason="signature verification failed" (2048-bit key; + unprotected) header.d=fastmail.com.au header.i=@fastmail.com.au + header.a=rsa-sha256 header.s=fm3 header.b=dLzuZ6dB; + dkim=fail reason="signature verification failed" (2048-bit key; + unprotected) header.d=messagingengine.com header.i=@messagingengine.com + header.a=rsa-sha256 header.s=fm3 header.b=nSRGsW+C; + dkim-atps=neutral +Received: from bombadil.infradead.org (bombadil.infradead.org + [IPv6:2607:7c80:54:e::133]) + (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) +key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest + SHA256) + (No client certificate requested) + by ozlabs.org (Postfix) with ESMTPS id 4FzcFN1j1nz9sW8 + for ; Tue, 8 Jun 2021 14:09:28 +1000 (AEST) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20210309; h=Sender: + Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: + List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc + :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: + Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: + List-Owner; bh=6mUWQd71FwsINycGYY1qOhKz+ecWJVNtwDkTebG3XkA=; b=EMabhVoRE3ad89 + o3L2AgyKrs+blSofUC3hoSsQe7gi3m4si8S9HW8Z+8SsS5TufUsvGwDl80qSYGlQOytQF+1yRUWvE + 6FJ/+bqv+TwjqZFibgJ6+9OVsQN9dZ/no1R0bBXIpmrf8ORUmv58QK4ZQquaFKbyXKpFeWOC2MSv4 + H2MAhyhTU8a3gtooH6G8+KvsJEfVgh6C+aDbwxyh2UY3chHKuw1kvL6AktbfUE2xl4zxi3x3kc70B + Wi3LiJBFokxVdgnROXxTU5tI0XboWYkQV64gLuQNV4XKClcuhVpzloDK8Iok6NTd7b32a7TdEFlCS + lGKsEKmxtUlW2FpfoduA==; +Received: from localhost ([::1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) + id 1lqT1r-006OAW-DX; Tue, 08 Jun 2021 04:07:51 + +Received: from new1-smtp.messagingengine.com ([66.111.4.221]) + by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) + id 1lqT1l-006O9b-Fq + for linux-...@lists.infradead.org; T
[PATCH v2 0/3] mikrotik: make soft_config partition writable
In order to change boot loader variables in small soft_config partition SPI NOR need to support erasing 4k blocks. Adding support for variable size erase blocks and enable it in all targets with mikrotik devices. In some of mikrotik devices parent mtd device is read-only. It makes soft_config read-only, so changing it to writable. v2 changes: - Collect Tested-by tags - Reword commit messages Oskari Lemmela (3): generic: platform/mikrotik: allow soft_config writes without 4k sectors mikrotik: add support for mtd erase of varying sizes mikrotik: make soft_config writable .../ar9344_mikrotik_routerboard-sxt-5n.dtsi | 1 - .../dts/qca9533_mikrotik_routerboard-16m.dtsi | 1 - ...6_mikrotik_routerboard-wap-g-5hact2hnd.dts | 1 - target/linux/ath79/mikrotik/config-default| 1 + target/linux/generic/config-5.10 | 1 + .../drivers/platform/mikrotik/rb_softconfig.c | 17 +- ...support-for-minor-aligned-partitions.patch | 397 ++ target/linux/ipq40xx/mikrotik/config-default | 1 + target/linux/ramips/dts/mt7621_mikrotik.dtsi | 1 - target/linux/ramips/mt7621/config-5.10| 1 + 10 files changed, 404 insertions(+), 18 deletions(-) create mode 100644 target/linux/generic/pending-5.10/402-mtd-spi-nor-write-support-for-minor-aligned-partitions.patch -- 2.25.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH v2 1/3] generic: platform/mikrotik: allow soft_config writes without 4k sectors
Always allow writing to the soft_config partition. The kernel sets the partition to read-only mode if the mtd device does not support 4k erase size. Signed-off-by: Oskari Lemmela Tested-by: Stefan Hellermann --- .../drivers/platform/mikrotik/rb_softconfig.c | 17 +++-- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/target/linux/generic/files/drivers/platform/mikrotik/rb_softconfig.c b/target/linux/generic/files/drivers/platform/mikrotik/rb_softconfig.c index 070bd32d5a..31d06c423a 100644 --- a/target/linux/generic/files/drivers/platform/mikrotik/rb_softconfig.c +++ b/target/linux/generic/files/drivers/platform/mikrotik/rb_softconfig.c @@ -59,20 +59,9 @@ #define RB_SOFTCONFIG_VER "0.03" #define RB_SC_PR_PFX "[rb_softconfig] " -/* - * mtd operations before 4.17 are asynchronous, not handled by this code - * Also make the driver act read-only if 4K_SECTORS are not enabled, since they - * are require to handle partial erasing of the small soft_config partition. - */ -#if defined(CONFIG_MTD_SPI_NOR_USE_4K_SECTORS) - #define RB_SC_HAS_WRITE_SUPPORT true - #define RB_SC_WMODE S_IWUSR - #define RB_SC_RMODE S_IRUSR -#else - #define RB_SC_HAS_WRITE_SUPPORT false - #define RB_SC_WMODE 0 - #define RB_SC_RMODE S_IRUSR -#endif +#define RB_SC_HAS_WRITE_SUPPORTtrue +#define RB_SC_WMODES_IWUSR +#define RB_SC_RMODES_IRUSR /* ID values for software settings */ #define RB_SCID_UART_SPEED 0x01// u32*1 -- 2.25.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH v2 3/3] mikrotik: make soft_config writable
The parent partition must be writable. Otherwise, all child partitions are in read-only mode. Signed-off-by: Oskari Lemmela Tested-by: Stefan Hellermann --- target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi | 1 - target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi | 1 - .../ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts | 1 - target/linux/ramips/dts/mt7621_mikrotik.dtsi | 1 - 4 files changed, 4 deletions(-) diff --git a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi index 3ed50abefa..86136289de 100644 --- a/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi +++ b/target/linux/ath79/dts/ar9344_mikrotik_routerboard-sxt-5n.dtsi @@ -99,7 +99,6 @@ partition@0 { label = "RouterBoot"; reg = <0x0 0x2>; - read-only; compatible = "mikrotik,routerboot-partitions"; #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi index f0473c7497..dbbe67d33d 100644 --- a/target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi +++ b/target/linux/ath79/dts/qca9533_mikrotik_routerboard-16m.dtsi @@ -38,7 +38,6 @@ partition@0 { label = "RouterBoot"; reg = <0x0 0x2>; - read-only; compatible = "mikrotik,routerboot-partitions"; #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts b/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts index f5c6731bb7..f6e04ae0a4 100644 --- a/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts +++ b/target/linux/ath79/dts/qca9556_mikrotik_routerboard-wap-g-5hact2hnd.dts @@ -73,7 +73,6 @@ partition@0 { label = "RouterBoot"; reg = <0x0 0x2>; - read-only; compatible = "mikrotik,routerboot-partitions"; #address-cells = <1>; #size-cells = <1>; diff --git a/target/linux/ramips/dts/mt7621_mikrotik.dtsi b/target/linux/ramips/dts/mt7621_mikrotik.dtsi index 1fc523ea14..ace194c6d6 100644 --- a/target/linux/ramips/dts/mt7621_mikrotik.dtsi +++ b/target/linux/ramips/dts/mt7621_mikrotik.dtsi @@ -37,7 +37,6 @@ partition@0 { label = "RouterBoot"; reg = <0x0 0x4>; - read-only; compatible = "mikrotik,routerboot-partitions"; #address-cells = <1>; #size-cells = <1>; -- 2.25.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
Re: [PATCH 0/3] mikrotik: make soft_config partition writable
Hi, On 21.12.2021 15.19, Stefan Hellermann wrote: > Hi, > > I tested the series on a Mikrotik LHG 2. > > # cat /proc/mtd > dev:size erasesize name > mtd0: 0002 0001 "RouterBoot" > mtd1: e000 0001 "bootloader1" > mtd2: 1000 0001 "hard_config" > mtd3: 1000 0001 "bios" > mtd4: f000 0001 "bootloader2" > mtd5: 1000 1000 "soft_config" > mtd6: 00fe 0001 "firmware" > mtd7: 0029 0001 "kernel" > mtd8: 00d5 0001 "rootfs" > mtd9: 009e 0001 "rootfs_data" > > => erasesize of soft_config is smaller > > # cat /sys/firmware/mikrotik/soft_config/boot_proto > [bootp] dhcp > # echo dhcp > /sys/firmware/mikrotik/soft_config/boot_proto > # cat /sys/firmware/mikrotik/soft_config/commit > dirty > # echo 1 > /sys/firmware/mikrotik/soft_config/commit > # cat /sys/firmware/mikrotik/soft_config/boot_proto > bootp [dhcp] > # cat /sys/firmware/mikrotik/soft_config/commit > clean > > => No error, change is written to flash > > sysupgrade is also ok, configuration ist saved. > > Tested-by: Stefan Hellermann Thanks for testing! I will send v2 series with updated tags. Oskari ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH fstools 2/2] Update / fix extroot comments
From: Rafał Miłecki Comment in start() was invalid as mount_extroot() doesn't handle any mounting internally. It was a misunderstanding coming from block.s function called just the same. Signed-off-by: Rafał Miłecki --- libfstools/overlay.c | 4 mount_root.c | 6 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libfstools/overlay.c b/libfstools/overlay.c index 87fad11..352f0f2 100644 --- a/libfstools/overlay.c +++ b/libfstools/overlay.c @@ -431,6 +431,10 @@ int mount_overlay(struct volume *v) if (err) return err; + /* +* Check for extroot config in overlay (rootfs_data) and if present then +* prefer it over rootfs_data. +*/ extroot_prefix = "/tmp/overlay"; if (!mount_extroot()) { ULOG_INFO("switched to extroot\n"); diff --git a/mount_root.c b/mount_root.c index dffb0a6..ca2c31c 100644 --- a/mount_root.c +++ b/mount_root.c @@ -44,11 +44,7 @@ start(int argc, char *argv[1]) mount("/dev/root", "/", NULL, MS_NOATIME | MS_REMOUNT, 0); } - /* -* Before trying to mount and use "rootfs_data" let's check if there is -* extroot configured. Following call will handle reading config from -* the "rootfs_data" on its own. -*/ + /* Check for extroot config in rootfs before even trying rootfs_data */ extroot_prefix = ""; if (!mount_extroot()) { ULOG_NOTE("switched to extroot\n"); -- 2.31.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel
[PATCH fstools 1/2] libfstools: check for overlay mounting errors
From: Rafał Miłecki Signed-off-by: Rafał Miłecki --- libfstools/overlay.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libfstools/overlay.c b/libfstools/overlay.c index 5de12c5..87fad11 100644 --- a/libfstools/overlay.c +++ b/libfstools/overlay.c @@ -416,6 +416,7 @@ int fs_state_set(const char *dir, enum fs_state state) int mount_overlay(struct volume *v) { char *mp, *fs_name; + int err; if (!v) return -1; @@ -426,7 +427,9 @@ int mount_overlay(struct volume *v) return -1; } - overlay_mount_fs(v); + err = overlay_mount_fs(v); + if (err) + return err; extroot_prefix = "/tmp/overlay"; if (!mount_extroot()) { -- 2.31.1 ___ openwrt-devel mailing list openwrt-devel@lists.openwrt.org https://lists.openwrt.org/mailman/listinfo/openwrt-devel