pid1: initial "run as PID 1" feature
This one has been inspired by these guys: http://www.informatimago.com/linux/emacs-on-user-mode-linux.html https://raymii.org/s/blog/Vim_as_PID_1_Boot_to_Vim.html It's aimed at building images running their main userspace piece instead of ramdisk's init, that means PID=1, UID=0. Mostly fun of course but it suddenly became interesting with kernel IP autoconfiguration and e.g. elinks running this way (NB: requires patched make-initrd 0.8.8 at the moment to get resolver configured). And startup times are way better than sysvinit and systemd combined!
This commit is contained in:
parent
6f452182fd
commit
1a7eed303d
15
features.in/pid1/README
Normal file
15
features.in/pid1/README
Normal file
@ -0,0 +1,15 @@
|
||||
Эта экспериментальная фича предназначена для обеспечения запуска
|
||||
заданного приложения в моно^Wкачестве единственного, т.е. PID 1.
|
||||
|
||||
Особенности результата:
|
||||
- предельно быстрый запуск;
|
||||
- работа под root;
|
||||
- отсутствие какой бы то ни было инициализации окружения.
|
||||
|
||||
Возможна настройка сетевых интерфейсов средствами ядра, условия:
|
||||
- статически собранный модуль для используемого интерфейса;
|
||||
- доступность DHCP/BOOTP/RARP в сегменте локальной сети.
|
||||
|
||||
Пакет следует добавить в STAGE1_PACKAGES; путь к бинарнику
|
||||
задаётся в PID1_BIN; PID1_PANIC позволяет указать время до
|
||||
перезагрузки ядра при завершении работы приложения.
|
20
features.in/pid1/config.mk
Normal file
20
features.in/pid1/config.mk
Normal file
@ -0,0 +1,20 @@
|
||||
# choose the smallest suitable kernel
|
||||
use/pid1: sub/stage1 use/syslinux/timeout/1
|
||||
@$(call add_feature)
|
||||
@$(call add,STAGE1_PACKAGES,make-initrd)
|
||||
@$(call add,STAGE2_BOOTARGS,quiet)
|
||||
@$(call add,STAGE2_BOOTARGS,panic=$$(PID1_PANIC))
|
||||
@$(call add,STAGE2_BOOTARGS,rdinit=$$(PID1_BIN))
|
||||
@$(call add,SYSLINUX_CFG,pid1)
|
||||
@$(call try,PID1_PANIC,3)
|
||||
@$(call xport,PID1_PANIC)
|
||||
@$(call xport,PID1_BIN)
|
||||
ifeq (i586,$(ARCH))
|
||||
@$(call set,KFLAVOURS,ltsp-client)
|
||||
endif
|
||||
|
||||
# need a kernel with CONFIG_IP_PNP_DHCP
|
||||
# NB: make-initrd must support resolver setup!
|
||||
use/pid1/net: use/pid1
|
||||
@$(call add,STAGE2_BOOTARGS,ip=dhcp)
|
||||
@$(call add,STAGE1_PACKAGES,chrooted-resolv)
|
4
features.in/pid1/stage1/scripts.d/11-initrd-pid1
Executable file
4
features.in/pid1/stage1/scripts.d/11-initrd-pid1
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh
|
||||
# vi's +builtin_terms only cover ansi/xterm
|
||||
|
||||
echo "PUT_FILES += /lib/terminfo/l/linux $GLOBAL_PID1_BIN" >> /etc/initrd.mk
|
3
features.in/pid1/stage1/scripts.d/82-gzip-initfs
Executable file
3
features.in/pid1/stage1/scripts.d/82-gzip-initfs
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
gzip < /boot/initrd.img > /boot/full.cz
|
4
features.in/syslinux/cfg.in/20pid1.cfg
Normal file
4
features.in/syslinux/cfg.in/20pid1.cfg
Normal file
@ -0,0 +1,4 @@
|
||||
label pid1
|
||||
menu label ^Just run as PID 1
|
||||
kernel alt0/vmlinuz
|
||||
append initrd=alt0/full.cz @bootargs@
|
Loading…
Reference in New Issue
Block a user