mirror of
https://git.busybox.net/buildroot.git
synced 2024-11-23 05:23:39 +08:00
package/tinyinit: new package
This package contains a Linux init script suitable for resource-limited systems which can be used as an alternative to the one provided by Busybox. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com> Cc: Yann E. MORIN <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com> Reviewed-by: Damien Le Moal <dlemoal@kernel.org> [yann.morin.1998@free.fr: drop 'imply busybox'] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
This commit is contained in:
parent
24cac9c4e6
commit
c1daa35cd9
@ -793,6 +793,7 @@ F: configs/stm32f769_disco_sd_defconfig
|
||||
F: package/armadillo/
|
||||
F: package/babeld/
|
||||
F: package/sscep/
|
||||
F: package/tinyinit/
|
||||
F: package/uuu/
|
||||
|
||||
N: Dario Binacchi <dariobin@libero.it>
|
||||
|
@ -2870,6 +2870,7 @@ menu "System tools"
|
||||
source "package/tar/Config.in"
|
||||
source "package/tealdeer/Config.in"
|
||||
source "package/thermald/Config.in"
|
||||
source "package/tinyinit/Config.in"
|
||||
source "package/tpm-tools/Config.in"
|
||||
source "package/tpm2-abrmd/Config.in"
|
||||
source "package/tpm2-tools/Config.in"
|
||||
|
@ -68,6 +68,7 @@ BUSYBOX_DEPENDENCIES = \
|
||||
$(if $(BR2_PACKAGE_UNZIP),unzip) \
|
||||
$(if $(BR2_PACKAGE_USBUTILS),usbutils) \
|
||||
$(if $(BR2_PACKAGE_UTIL_LINUX),util-linux) \
|
||||
$(if $(BR2_PACKAGE_TINYINIT),tinyinit) \
|
||||
$(if $(BR2_PACKAGE_VIM),vim) \
|
||||
$(if $(BR2_PACKAGE_WATCHDOG),watchdog) \
|
||||
$(if $(BR2_PACKAGE_WGET),wget) \
|
||||
|
7
package/tinyinit/Config.in
Normal file
7
package/tinyinit/Config.in
Normal file
@ -0,0 +1,7 @@
|
||||
config BR2_PACKAGE_TINYINIT
|
||||
bool "tinyinit"
|
||||
depends on BR2_INIT_TINYINIT
|
||||
help
|
||||
A Linux tiny initialization script suitable for resource
|
||||
limited systems, which can be used as an alternative to the
|
||||
one provided by Busybox.
|
32
package/tinyinit/init
Normal file
32
package/tinyinit/init
Normal file
@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script replaces the default busybox init process to avoid having that
|
||||
# process staying alive and sleeping in the background, (uselessly) consuming
|
||||
# precious memory.
|
||||
|
||||
# Mount procfs and sysfs
|
||||
/bin/mount -t proc proc /proc
|
||||
/bin/mount -t sysfs sysfs /sys
|
||||
|
||||
# When the kernel is directly booted, devtmpfs is not automatically mounted.
|
||||
# Manually mount it if needed.
|
||||
devmnt=$(mount | grep -c devtmpfs)
|
||||
if [ "${devmnt}" -eq 0 ]; then
|
||||
/bin/mount -t devtmpfs devtmpfs /dev
|
||||
fi
|
||||
|
||||
# Use the /dev/console device node from devtmpfs if possible to not
|
||||
# confuse glibc's ttyname_r().
|
||||
# This may fail (E.G. booted with console=), and errors from exec will
|
||||
# terminate the shell, so use a subshell for the test
|
||||
if (exec 0</dev/console) 2>/dev/null; then
|
||||
exec 0</dev/console
|
||||
exec 1>/dev/console
|
||||
exec 2>/dev/console
|
||||
fi
|
||||
|
||||
# Clear memory to reduce page fragmentation
|
||||
echo 3 > /proc/sys/vm/drop_caches
|
||||
|
||||
# Finally, let's start an interactive shell
|
||||
exec /bin/sh
|
13
package/tinyinit/tinyinit.mk
Normal file
13
package/tinyinit/tinyinit.mk
Normal file
@ -0,0 +1,13 @@
|
||||
################################################################################
|
||||
#
|
||||
# tinyinit
|
||||
#
|
||||
################################################################################
|
||||
|
||||
define TINYINIT_INSTALL_TARGET_CMDS
|
||||
$(INSTALL) -m 0755 -D $(TINYINIT_PKGDIR)/init $(TARGET_DIR)/sbin/init
|
||||
# Downside: In non-initramfs systems the symlink isn't used/needed
|
||||
(cd $(TARGET_DIR); ln -sf /sbin/init init)
|
||||
endef
|
||||
|
||||
$(eval $(generic-package))
|
@ -165,6 +165,15 @@ config BR2_INIT_TINI
|
||||
|
||||
https://github.com/krallin/tini
|
||||
|
||||
config BR2_INIT_TINYINIT
|
||||
bool "tiny init"
|
||||
select BR2_PACKAGE_TINYINIT
|
||||
select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT
|
||||
help
|
||||
A Linux tiny initialization script suitable for resource
|
||||
limited systems, which can be used as an alternative to the
|
||||
one provided by Busybox.
|
||||
|
||||
config BR2_INIT_NONE
|
||||
bool "Custom (none)"
|
||||
select BR2_PACKAGE_SKELETON_INIT_NONE if BR2_ROOTFS_SKELETON_DEFAULT
|
||||
|
Loading…
Reference in New Issue
Block a user