[PATCH 2/2] treewide: remove INITRAMFS check for preinit_main hook

Florian Eckert fe at dev.tdt.de
Thu Sep 5 05:42:18 PDT 2024


The 'preinit' script '/lib/preinit/70_initramfs_test' [1] checks whether
the system is running in an 'initramfs'. If this is the case, the loop [2]
in which the function is called is exited via a 'break' call. All further
'preinit_main' hooks are no longer processed. Therefore, the check whether
we are running in an initramfs is not necessary and are therefore removed.

[1] https://github.com/openwrt/openwrt/blob/master/package/base-files/files/lib/preinit/70_initramfs_test
[2] https://github.com/openwrt/openwrt/blob/master/package/base-files/files/lib/functions/preinit.sh#L57

Signed-off-by: Florian Eckert <fe at dev.tdt.de>
---
 package/base-files/files/lib/preinit/80_mount_root           | 2 +-
 package/utils/zyxel-bootconfig/files/95_apply_bootconfig     | 2 +-
 target/linux/bcm27xx/base-files/lib/preinit/81_set_root_part | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/base-files/files/lib/preinit/80_mount_root b/package/base-files/files/lib/preinit/80_mount_root
index 940c56c925..d58ffcd3db 100644
--- a/package/base-files/files/lib/preinit/80_mount_root
+++ b/package/base-files/files/lib/preinit/80_mount_root
@@ -51,4 +51,4 @@ do_mount_root() {
 	}
 }
 
-[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main do_mount_root
+boot_hook_add preinit_main do_mount_root
diff --git a/package/utils/zyxel-bootconfig/files/95_apply_bootconfig b/package/utils/zyxel-bootconfig/files/95_apply_bootconfig
index c98bc8fbe2..9abf138e4a 100644
--- a/package/utils/zyxel-bootconfig/files/95_apply_bootconfig
+++ b/package/utils/zyxel-bootconfig/files/95_apply_bootconfig
@@ -12,4 +12,4 @@ apply_bootconfig() {
 	esac
 }
 
-[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main apply_bootconfig
+boot_hook_add preinit_main apply_bootconfig
diff --git a/target/linux/bcm27xx/base-files/lib/preinit/81_set_root_part b/target/linux/bcm27xx/base-files/lib/preinit/81_set_root_part
index a915150213..fd3f98dd3f 100644
--- a/target/linux/bcm27xx/base-files/lib/preinit/81_set_root_part
+++ b/target/linux/bcm27xx/base-files/lib/preinit/81_set_root_part
@@ -9,4 +9,4 @@ do_set_root_part() {
 	fi
 }
 
-[ "$INITRAMFS" = "1" ] || boot_hook_add preinit_main do_set_root_part
+boot_hook_add preinit_main do_set_root_part
-- 
2.39.2




More information about the openwrt-devel mailing list