Show pagesourceOld revisionsBacklinksBack to top × Table of Contents Procd system init and daemon management Help with the development of procd Buttons with procd Init scripts with procd early state and preinit procd start up /etc/inittab ubus command interface hotplug procd (process management daemon) – Technical Reference OpenWrt – operating system architecture History Procd system init and daemon management procd is the OpenWrt process management daemon written in C. It keeps track of processes started from init scripts (via ubus calls), and can suppress redundant service start/restart requests when the config/environment has not changed. procd has replaced ... , e.g. hotplug2, a dynamic device management subsystem for embedded systems. Hotplug2 is a trivial replacement of some of the UDev functionality in a tiny pack, intended for Linux early userspace: Init RAM FS and InitRD. busybox-klogd and busybox-syslogd busybox-watchdog procd is intended to stay compatible with the existing format of /etc/config/; exceptions ... Help with the development of procd test what has been ported review of the code Buttons with procd see commit in https://dev.openwrt.org/log/trunk/package/base-files/files/etc/rc.button see use case hardware.button Init scripts with procd see procd-init-scripts early state and preinit Before the real procd runs, a small init process is started. This process has the job of early system init. It will do the following things in the listed order bring up basic mounts such as /proc /sys/{,fs/cgroup} /dev/{,shm,pts} create some required folder, /tmp/{run,lock,state} bring up /dev/console and map the processes stdin/out/err to the console (this is the “Console is alive” message) setup the PATH environment variable check if “init_debug=” is set in the kernel command line and apply the debug level if set initialise the watchdog start kmodloader and load the modules listed in /etc/modules-boot.d/ start hotplug with the preinit rules (/etc/hotplug-preinit.json) start preinit scripts found inside /lib/preinit/ Once preinit is complete the init process is done and will do an exec on the real procd. This will replace init as pid1 with an instance of procd running as the new pid 1. The watchdog file descriptor is not closed. Instead it is handed over to the new procd process. The debug_level will also be handed over to the new procd instance if it was set via command line or during preinit. procd start up Procd will first do some basic process init such as setting itself to be owner of its own process group and setting up signals. We are now ready to bring up the userland in the following order find out if a watchdog file descriptor was passed by the init process and start up the watchdog setup /dev/console to be our stdin/out/err start the coldplug process using the full rule set (/etc/hotplug.json). This is done by manually triggering all events that have already happened using udevtrigger start ubus, register it as a service and connect to it. The basic system bringup is now complete, procd is up and running and can start handling daemons and services /etc/inittab Procd supports four commands inside inittab respawn - this works just like you expect it. It starts a process and will respawn it once it has completed. respawnlate - this works like the respawn but will start the process only when the procd init is completed. askfirst - this works just like respawn but will print the line “Please press Enter to activate this console.” before starting the process askconsole - this works like askfirst but, instead of running on the tty passed as a parameter, it will look for the tty defined in the kernel command line using “console=” askconsolelate - this works like the askconsole but will start the process only when the procd init is completed. sysinit - this will trigger procd to run the command, given as a parameter, only once. This is usually used to trigger execution of /etc/rc.d/ Once all items inside /etc/inittab are processed, procd enter its normal run mode and will handle messages coming in via ubus. It will stay in this state until a reboot/shutdown is triggered. ubus command interface hotplug Hotplug scripts are located inside /etc/hotplug.d and are based on json_script. This is a json based if then else syntax. Procd hotplug service offers the following actions: makedev rm exec button load-firmware Under Construction! This page is currently under construction. You can edit the article to help completing it. procd (process management daemon) – Technical Reference Project's git procd is available in OpenWrt since r34865 (trunk). It consists of files under GPLv2, LGPLv2.1 and ISC licenses. commits to OpenWrt trunk regarding procd OpenWrt – operating system architecture Whereas desktop distributions use glib+dbus+udev(part of systemd), OpenWrt uses libubox+ubus+procd. This provides some pretty awesome functionality without requiring huge libraries with huge dependencies (*cough* glib). Desktop Distributions OpenWrt Android Replicant mer-based Typical main memory size 128 MiB to 16 GiB (or more) 32 MiB to 512 MiB1) min 92 MiB for Android 2.1 min 340 MiB for Android 4.0 ? Supported instruction sets almost anything almost anything x86, 86-64, ARM, MIPS32 non-volatile storage space 100 MiB 8 MiB2) 150MiB for Android 2.1 512MiB for Android 4.0 ? kernel Linux kernel FOSS and binary drivers FOSS drivers: e.g. 802.11; Iaccess Android binary drivers C standard library glibc uClibc, musl bionic glibc + libhybris eglibc 2.15 init init Upstart Initng systemd busybox-initd procd Android init-fork systemd rsyslog / syslog-ng busybox-klogd, busybox-syslogd watchdog busybox-watchdog udev hotplug2 cron busybox-crond atd na D-Bus ubus Binder ? D-Bus network configuration NetworkManager + GUI netifd ConnectivityManager (not ConnMan = ConnectionManager!) ? ConnMan GLib (GObject, Glib, GModule, GThread, GIO) libubox ? ? Qt-based? PulseAudio pulseaudio (optional) PulseAudio PulseAudio PulseAudio Package management system dpkg/APT RPM/yum portage pacman ... opkg apk ? RPM What's the difference between ubus vs dbus? dbus is bloated, its C API is very annoying to use and requires writing large amounts of boilerplate code. In fact, the pure C API is so annoying that its own API documentation states: “If you use this low-level API directly, you're signing up for some pain.” ubus is tiny and has the advantage of being easy to use from regular C code, as well as automatically making all exported API functionality also available to shell scripts with no extra effort. “Of course, NetworkManager should be renamed to “unetwork”, dbus to “ubus”, PulseAudio to “usound”, and X.Org-Server/Wayland-Compositor to “udisplay”; and then indescribable happiness would come down to all people of this world.” – Lennart Poettering →OpenWrt Buildroot – About → OpenWrt Buildroot – Installation →OpenWrt Buildroot – Usage →OpenWrt Buildroot – Patches →file_system / flash.layout →internal.layout →preinit_mount/process.boot/requirements.boot.process PulseAudio does not depend on GLib and does not seem to depends on D-Bus neither: LFS FOSDEM2013: Can Linux network configuration suck less? History Package history is available at: current history: https://dev.openwrt.org/log/trunk/package/system/procd old history pre r37007 https://dev.openwrt.org/log/trunk/package/procd/Makefile?rev=36995 r34865: procd: add initial implementation r34866: base-files: add basic procd integration, let procd start (and restart) ubus instead of having an ubus init script r34867: dropbear: convert init script to procd r36003: base-files: make basefiles aware of procd r36005: busybox: make init and logread depend on !PROCD_INIT r36446: hotplug2: make it depend on !PROCD_INIT r36896: procd: make the preinit rules wildcard all buttons for failsafe r36987: hotplug2: procd does the hotplugging now r36998: base-files: procd is now the init process r36999: base-files: diag does not need to insmod any drivers, procd already did it for us r37000: base-files: input/button drivers get loaded before preinit by procd r37002: base-files: /etc/init.d/rcS is no longer needed, procd handles this for us now r37039: busybox: disable syslogd/klogd by default, procd replaces them r37106: busybox: disable the watchdog utility by default (procd handles watchdog devices) r37242, 37243, 37244: busybox: convert telnet, crond and sysntpd init scripts to procd r37245: dropbear: register a config.change trigger: procd_add_config_trigger "dropbear" "/etc/init.d/dropbear" "restart" r37429: procd: add proto and trigger support to the /etc/init.d/log r37336: procd: make old button hotplug rules work until all packages are migrated 1) yes, heavily stripped OpenWrt can run on 16 or even 8MiB 2) yes, 4MiB and 2MiB possible This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.OKMore information about cookies Last modified: 2019/09/02 13:45by tmomas