fluca1978 said:
But this is run also in multimode, and the question was about running something before multimode begins....
Yes, it is. Single mode doesn't have the same meaning as it is in DOS/Windows world, ALL processes, include processes running by/as the superuser runs in user mode, only kernel routines can run in supervisor mode (ring0 of CPU), so in a term of FreeBSD there no real/protected mode that one can distinguish programmatically by making assumed syscalls.
Either you are a kernel module(ring 0) or running process(user mode).
As about hooking, - FreeBSD isn't a Linux (System V to be more correct) and it has only two runlevels - either single or multiuser. Boot process finished by loading either to single or multiuser mode. There's no such stage as
boot->single-mode->multiuser.
If one need to hook up a system on a particular stage, it need to be done either on the end of booting or on beginning of multiuser mode.
Since we are talking about legal(not malicious purpose) bootstrapping then FreeBSD has a legal way to hook initialization process by
placing
[CMD=""]init_script="/path/to/first/script/that/will/be/executed/by/init"[/CMD] in the
/boot/loader.conf.local
This script will be responsible to call
/etc/rc later... if needed, but since thread author wants to load system to "multimode" then IMHO it would be more convenient
to hook up legally a system on a first multimode command because of some housekeeping(
rc(8)()) need to be done
correctly before starting multimode commands, so instead of executing hook before
rc(8)() it better/safety to execute it after
rc(8)() IMHO.