Commit Graph
55 Commits
Author SHA1 Message Date
Joachim Nilsson 077a7e82e0 Debian now boots to X!
finit.conf:
        Use this as /etc/finit.conf on a Debian 6.0 based system with X
        installed and sysklogd instead of rsyslogd.  Works.

services:
        Alternative method for extending the finit boot procedure. Simply
        place this script file in an /etc/finit.d/ directory.  The script
        uses the standard run-parts tool to chain load other start scripts.

helpers.c:
        o New functions:
          - run(): home grown system() replacement
          - run_interactive(): display progress and status when called

        o Bugfix start_process(), make sure to use same signal setup for
          children as in run() and run_interactive(). Also, use execvp()
          instead of execv() to allow searching $PATH for executables.

finit.h:
        o Move signal specific code to new signal.h.
        o Bypass verbosity setting to let echo() always print to screen.

finit.c:
        o Make run_parts() the default, remove external deps, it works.

        o Use run() and run_interactive() to speed up execution further
          on embedded systems where forking is expensive.

        o Kernel cmdline "quiet" should not close STDIO since this makes
          it impossible to run some daemons and start scripts.  Instead,
          we let "quiet" toggle the finit verbosity setting.

        o Remove kernel cmdline "--verbose" (Upstart compat), to be used
          to enable verbose finit when kernel should be quiet.

        o Setup kernel specific settings in /etc/sysctl.conf

        o Fix D-Bus startup problems. Probably what caused X from not
          working initially. Silly rabbit.

        o Use system() workaround to start X, cannot get it to start
          at all using run() or run_interactive() at the moment.

signal.h:
        New file, header file for signal.c.  Was about time.

signal.c:
        Remove blocking of SIGCHLD from sig_setup(), instead we setup
        SIGCHLD early in sig_init() to handle fork() in run() & C:o.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-09-20 17:50:53 +02:00
Joachim Nilsson d21dc2b477 Westermo service starter and supervisor, inspired by daemontools
finit.c:
        o New service and shell_service stanzas for finit.conf
        o Run service_startup() before /etc/finit.d/ hooks
        o Run service_monitor() at end of startup

helpers.c:
        o Several new functions:
          - print_desc() displays a service starting up
          - print_result() shows if service started OK or not
          - start_process() is used by the services framework

svc.c:
        Generic API for managing svc_t structures

ipc.o:
        TIPC based framework for communicating with the service monitor.
        E.g., to relay (re)configuration signals from a Web/CLI
        front-end via finit to one or many setup daemons, and back.

services.c:
        Service monitor framework

strlcpy.c:
        Secure strncpy() replacement from OpenBSD under the free ISC License.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-09-20 01:16:00 +02:00
Joachim Nilsson c0356b5c7a Massive cleanup to be able to boot Debian 6.0
Update license and copyright information details in all files.
Much cleanup by moving hard coded strings/data to #defines and using more
common default values for each such #define.

finit.c:
        o Make sdown[], startx[] allocated strings by default NULL
        o This fixes the issues where the shutdown handler segfaulted
        o Add ability to handle NULL input to build_cmd() by allocating space
        o Ignore kernel cmdline "quiet" if in debug mode
        o Add support for "network" stanza in finit.conf
        o Mount -n to skip removing /etc/mtab
        o Call swapon to enable swap if enabled in /etc/fstab
        o Cleanup /tmp, /var/run and /var/lock
        o Move sig_setup() *after* mount, sig_init() otoh runs early
        o Start initctl monitor before forking off startx/getty process
        o The startx process is now the console process. Only a getty is
          started when in debug mode. Otherwise only X is started if it
          is properly setup in /etc/finit.conf
        o NOTE: Currently X evdev does not work!
        o Support for /usr/sbin/services.sh has been replaced with finit
          now instead supporting builtin run-parts for /etc/finit.d/

helpers.c:
        o Bug fixes in run_parts() and also added chdir(oldpwd) at bottom.
        o New functions:
          - getuser() similar to getgroup()
          - cls() clear screen, only runs when not in debug mode
          - set_procname() used to set name "console" on console process
          - set_hostname() encapsulates /etc/hostname and sethostname()

signal.c:
        o Split sig_setup() in two: sig_init() and sig_setup()
          The former to be called as soon as possible, while latter is
          supposed to run when the base filesystem is properly up.
        o Remove hard coded distribution specific progress bar write()
        o Add debug messages to do_shutdown()
        o Remove any lingering sync files in sig_setup()

initctl.c:
        o Add debug messages and a new default: case to catch stray runlevels

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-09-19 18:06:12 +02:00
Joachim Nilsson 855c7d8251 Assume kernel has devtmpfs enabled --> cleanup device creation & mount
Cleanup device creation and initial mount by assuming that the kernel
has devtmpfs enabled.  This is the default for most modern GNU/Linux
distributions.  See http://lwn.net/Articles/331818/ for more info.

Also, since finit is targeted at deeply embedded systems hooks for the
BusyBox udev replacement, mdev has been added.  If MDEV is defined in
the build it will take care of both hotplugging of devices and initial
setup of /dev

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-09-17 16:05:41 +02:00
Joachim Nilsson b0aec188bc Further cleanup, move signal setup to a file of its own.
finit.c:
        o Perform signal setup as soon as possible, no need to do any
          mounting of /proc or /sys beforehand
        o Move signal setup and callbacks to a file of its own
        o Use more #defines for hard coded strings
        o Use a more neutral default hostname

signal.c:
        o New file, for setup and signal handlers
        o Add support for SIGSTOP/SIGSTP and SIGCONT.  This pauses finit
          respawning of xinit/shell.  Useful for, e.g., debugging
        o Document each ignored and handled signal better
        o Disable SIGUSR1 and SIGUSR2 for now, will be reenabled later

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-09-17 10:41:18 +02:00
Joachim Nilsson 4657d9713a Minor cleanup. Moved code around a bit, to functions, away from main().
This commit is in preparation for importing the Westermo code changes.
Slowly refactoring the finit core into a more modularized unit to be a
bit more maintainable.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-09-17 01:51:37 +02:00
Joachim Nilsson a654d99b92 Archive previous versions for reference.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-09-14 13:23:17 +02:00
Joachim Nilsson e2c4a6ceaf Remove optional --directisa call to hwclock, this is the default anyway.
This is a followup to Olivier Blin's patch from 88ffb93 in that it
applies the same patch to finit-mod.c that is already in finit.c, or
finit-alt.c as it was called then.

Also, the optional --directisa argument to hwclock is not necessary.
The hwclock utility has a built-in fallback to use excplicit I/O over
the /dev/rtc in case the latter does not exist.  See the hwclock(8) man
page for more information on this.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-09-14 13:11:31 +02:00
Joachim Nilsson 5816c9cab9 Embedded finit for small embedded Linux systems and servers.
o Make finit-alt.c the new finit.c, save old finit.c as finit-org.c
o Keep original finit-alt.c for reference.
o Update README and ChangeLog with direction of this fork
o Correct ChangeLog date for v0.1 and set release date for
  the 0.6-pre release to 20100614, which is the last commit
  by the original author.
o Add standard LICENSE file for MIT License
o Add standard AUTHORS file to document history of project
o Bump version to 1.0-pre to distance fork from original

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2012-09-14 13:10:39 +02:00
Claudio Matsuoka b9583fb354 Don't set Pentium M arch by default
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2009-04-14 12:59:48 -03:00
Claudio Matsuoka 37af9970d4 Disable annoying warning caused by attribute warn_unused_result
Example:
gcc -c -Os -Wall -DVERSION=\"0.6-pre\" -DWHOAMI=\"`whoami`@`hostname`\" -march=pentium-m -DBUILTIN_RUNPARTS -o finit-mod.o finit-mod.c
finit-mod.c: In function ‘main’:
finit-mod.c:107: warning: ignoring return value of ‘chdir’, declared with attribute warn_unused_result
finit-mod.c:137: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result
finit-mod.c:164: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result
finit-mod.c:168: warning: ignoring return value of ‘system’, declared with attribute warn_unused_result

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2009-04-14 12:55:44 -03:00
Claudio Matsuoka 65c971925c Remove usplash and nologin from Asus legacy code
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-10-10 13:03:31 -03:00
Claudio Matsuoka 52feb6f51c Invoke xinit directly instead of startx
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-26 19:10:09 -03:00
Claudio Matsuoka 3811275df5 Post-0.5 release
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-21 15:32:55 -03:00
Claudio Matsuoka 7360ef1f08 Fix distribution filelist
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-21 15:31:38 -03:00
Claudio Matsuoka 529224153f Update docs for 0.5
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-21 15:30:34 -03:00
Claudio Matsuoka a6f534621c Fix filesystem initialization order
Fsck filesystems before mounting root as read-write. Mountdev and
device creation can stay there because they're tmpfs.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-08-13 13:14:33 -03:00
Claudio Matsuoka 33469873a5 Don't build vanilla finit
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-06-02 18:20:03 -03:00
Claudio Matsuoka 9f99f38561 Initial eeeXubuntu port merged from smurfy's port
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-31 10:43:43 -03:00
Claudio Matsuoka f94504ad96 Write runlevel to utmp
This is needed by Printerdrake (by Pascal Terjan)

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-28 12:51:30 -03:00
Claudio Matsuoka d5037d1352 Finit-alt listens to /dev/initctl
This allows us to use the standard reboot utility in Linux to perform
a fast reboot.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-27 16:29:34 -03:00
Claudio Matsuoka 57ad91136b Build finit-alt from finit-alt.c
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-26 20:09:25 -03:00
Claudio Matsuoka df14fd5255 Post-0.4
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-16 16:23:19 -03:00
Claudio Matsuoka 821a6853fe Version 0.4
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-16 16:20:29 -03:00
Claudio Matsuoka 9d164ac312 Enable runtime debug in finit-alt if DEBUG parameter is specified
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-05-02 15:34:13 -03:00
Claudio Matsuoka c79b823f17 Fix default user setting in Makefile
Otherwise the default user name is set to the name of the current user

Signed-off-by: Claudio Matsuoka <claudio@frohike.(none)>
2008-03-20 05:10:07 -03:00
Claudio Matsuoka 71ce4b98e9 Minor documentation updates
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-18 16:38:08 -03:00
Claudio Matsuoka a52c932085 Cosmetic changes
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-16 18:03:23 -03:00
Claudio Matsuoka 494f182b13 Minor fixes, updated comments
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-16 17:17:17 -03:00
Claudio Matsuoka 89854a579f Add nash-plugin patch, move Mandriva specifics to its own README file
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-16 13:57:22 -03:00
Claudio Matsuoka 1c88ae1f61 Run-parts code cleanup and minor fixes
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-16 12:47:37 -03:00
Claudio Matsuoka 904c12d06a Add a contrib directory
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-15 14:37:46 -03:00
Claudio Matsuoka 434ec4c533 Add option to use built-in run-parts instead of /bin/run-parts
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-15 10:34:05 -03:00
Claudio Matsuoka 2a9bfa7fd7 Default user for finit-alt configurable from Makefile
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-03-10 17:41:11 -03:00
Claudio Matsuoka 6565cc67ee Update version information to post-0.3
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-23 08:55:12 -03:00
Claudio Matsuoka 08d0dc6ee9 Disable debug
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-23 08:50:19 -03:00
Claudio Matsuoka 2679c1b1c5 Mount /var/lock and /var/run as tmpfs
Also create /var/run/console/<user> for X authentication

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-22 18:02:45 -03:00
Claudio Matsuoka fb8c341168 Change poweroff method to reboot(RB_POWER_OFF) (Metalshark)
Metalshark says:
February 19th, 2008 at 9:10 pm

There is an issue with some ACPI/Kernel combinations to do with shutdown.

It isn’t always powering off (tried /proc/acpi and /sys methods) - however
removing all the fd > 5 stuff and putting in the simple line
“reboot(RB_POWER_OFF);” worked for all thus far. Although semantically
incorrect it is a working solution.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-21 09:43:35 -03:00
Claudio Matsuoka 7137573534 Post-0.2 adjustments
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-19 20:24:33 -03:00
Claudio Matsuoka dbb31994a0 Moved helpers to a separate file
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-16 22:03:16 -02:00
Claudio Matsuoka ef3071b957 Disable NO_HCTOSYS by default to match stock Eeepc kernel
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-15 16:56:05 -02:00
Claudio Matsuoka 7af37f1fb7 Update version number after release
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-14 22:21:27 -02:00
Claudio Matsuoka 8ad87be029 Add dist target, build timestamp and version information
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-14 22:10:14 -02:00
Claudio Matsuoka 37144d58b2 Add Metalshark's patches:
*) Add -march=pentium-m if compiling finit or finit-mod (as the target will
   be an eeepc).
*) Add a -DNO_HCTOSYS make option that omits the first /sbin/hwclock if the
   user has enabled CONFIG_RTC_HCTOSYS in the kernel.
*) Add a -DDIRECTISA make option to append –directisa to /sbin/hwclock lines
   if the user has disabled CONFIG_GENRTC and enabled CONFIG_RTC but not
   enabled CONFIG_HPET_TIMER and CONFIG_HPET_RTC_IRQ.

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-14 21:55:09 -02:00
Claudio Matsuoka 7c3e97c18b Add makepath() to avoid forking mkdir
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-05 10:48:19 -02:00
Claudio Matsuoka 53e92b28c3 Renamed ffinit.c to finit-alt.c, added finit-mod.c
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-02-05 10:33:09 -02:00
Claudio Matsuoka 7348225111 Reset mtab on boot (workaround, fix it properly later)
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-01-10 18:53:34 -02:00
Claudio Matsuoka ebb0d03034 Make home directory and default user configurable
Use home= and user= parameters in the kernel command line to set
the home device and the default user

Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-01-10 15:43:26 -02:00
Claudio Matsuoka bfab7e0c4f Added license information to improved fastinit
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-01-04 08:41:52 -02:00
Claudio Matsuoka 9eb9eb1ef6 Implement improved/optimized version of finit
Signed-off-by: Claudio Matsuoka <cmatsuoka@gmail.com>
2008-01-02 13:32:05 -02:00