Initial Commit
- initial default booting image
This commit is contained in:
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))
|
||||
Reference in New Issue
Block a user