diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2017-12-01 11:05:32 -0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-12-10 22:45:19 +0000 |
commit | 72d677b2bd267b8ff1ae84a93b4ac01fe9f7803c (patch) | |
tree | c975c99c889b93d511fb07a1a0da7343d6bc799a /meta | |
parent | 5e82878c5d32256f7b539fff1881ea67694cbfd7 (diff) | |
download | poky-72d677b2bd267b8ff1ae84a93b4ac01fe9f7803c.tar.gz |
initramfs-framework: Add exec module
This new module allow for easy execution of external scripts or
applications. It runs anything found in /exec.d directory in order and
in case of no scripts to be available, it opens a shell.
(From OE-Core rev: 9b98c97338b4c3f985eca572d6a1e21324fa0fbc)
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-core/initrdscripts/initramfs-framework/exec | 29 | ||||
-rw-r--r-- | meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | 9 |
2 files changed, 38 insertions, 0 deletions
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework/exec b/meta/recipes-core/initrdscripts/initramfs-framework/exec new file mode 100644 index 0000000000..a8e2432bb6 --- /dev/null +++ b/meta/recipes-core/initrdscripts/initramfs-framework/exec | |||
@@ -0,0 +1,29 @@ | |||
1 | #!/bin/sh | ||
2 | # Copyright (C) 2017 O.S. Systems Software LTDA. | ||
3 | # Licensed on MIT | ||
4 | |||
5 | EXEC_DIR=/exec.d # place to look for modules | ||
6 | |||
7 | exec_enabled() { | ||
8 | return 0 | ||
9 | } | ||
10 | |||
11 | exec_run() { | ||
12 | if [ ! -d $EXEC_DIR ]; then | ||
13 | msg "No contents to exec in $EXEC_DIR. Starting shell ..." | ||
14 | sh | ||
15 | fi | ||
16 | |||
17 | # Load and run modules | ||
18 | for m in $EXEC_DIR/*; do | ||
19 | # Skip backup files | ||
20 | if [ "`echo $m | sed -e 's/\~$//'`" != "$m" ]; then | ||
21 | continue | ||
22 | fi | ||
23 | |||
24 | debug "Starting $m" | ||
25 | |||
26 | # process module | ||
27 | ./$m | ||
28 | done | ||
29 | } | ||
diff --git a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb index 2afc37ee75..75d965f069 100644 --- a/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb +++ b/meta/recipes-core/initrdscripts/initramfs-framework_1.0.bb | |||
@@ -8,6 +8,7 @@ PR = "r4" | |||
8 | inherit allarch | 8 | inherit allarch |
9 | 9 | ||
10 | SRC_URI = "file://init \ | 10 | SRC_URI = "file://init \ |
11 | file://exec \ | ||
11 | file://rootfs \ | 12 | file://rootfs \ |
12 | file://finish \ | 13 | file://finish \ |
13 | file://mdev \ | 14 | file://mdev \ |
@@ -26,6 +27,9 @@ do_install() { | |||
26 | install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs | 27 | install -m 0755 ${WORKDIR}/rootfs ${D}/init.d/90-rootfs |
27 | install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish | 28 | install -m 0755 ${WORKDIR}/finish ${D}/init.d/99-finish |
28 | 29 | ||
30 | # exec | ||
31 | install -m 0755 ${WORKDIR}/exec ${D}/init.d/89-exec | ||
32 | |||
29 | # mdev | 33 | # mdev |
30 | install -m 0755 ${WORKDIR}/mdev ${D}/init.d/01-mdev | 34 | install -m 0755 ${WORKDIR}/mdev ${D}/init.d/01-mdev |
31 | 35 | ||
@@ -45,6 +49,7 @@ do_install() { | |||
45 | } | 49 | } |
46 | 50 | ||
47 | PACKAGES = "${PN}-base \ | 51 | PACKAGES = "${PN}-base \ |
52 | initramfs-module-exec \ | ||
48 | initramfs-module-mdev \ | 53 | initramfs-module-mdev \ |
49 | initramfs-module-udev \ | 54 | initramfs-module-udev \ |
50 | initramfs-module-e2fs \ | 55 | initramfs-module-e2fs \ |
@@ -62,6 +67,10 @@ FILES_${PN}-base = "/init /init.d/99-finish /dev" | |||
62 | # and mounts the rootfs. Then 90-rootfs will proceed immediately. | 67 | # and mounts the rootfs. Then 90-rootfs will proceed immediately. |
63 | RRECOMMENDS_${PN}-base += "initramfs-module-rootfs" | 68 | RRECOMMENDS_${PN}-base += "initramfs-module-rootfs" |
64 | 69 | ||
70 | SUMMARY_initramfs-module-exec = "initramfs support for easy execution of applications" | ||
71 | RDEPENDS_initramfs-module-exec = "${PN}-base" | ||
72 | FILES_initramfs-module-exec = "/init.d/89-exec" | ||
73 | |||
65 | SUMMARY_initramfs-module-mdev = "initramfs support for mdev" | 74 | SUMMARY_initramfs-module-mdev = "initramfs support for mdev" |
66 | RDEPENDS_initramfs-module-mdev = "${PN}-base busybox-mdev" | 75 | RDEPENDS_initramfs-module-mdev = "${PN}-base busybox-mdev" |
67 | FILES_initramfs-module-mdev = "/init.d/01-mdev" | 76 | FILES_initramfs-module-mdev = "/init.d/01-mdev" |