Files
Konstantin Belousov 4c9f648852 init(8): extract reroot transient code into reroot_seed
Since init become dynamically linked, reroot appeared to be broken
because init copies itself into a transient tmpfs mount to continue
controlling execution right after the reboot(REROOT) syscall.  Because
the binary is dynamically linked, it cannot be properly executed.

Provide a minimal static binary 'reroot_seed' embedded into the init as
byte stream, which performs what the 'init -r' did, namely, the second
phase reroot.

For the static build of init as part of the /rescue crunch, keep the
inline reroot code.

Reported and tested by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D58164
2026-07-14 18:43:45 +03:00

21 lines
393 B
Makefile

CONFGROUPS= CONFTTYS
PACKAGE=runtime
PROG= init
MAN= init.8
SRCS= init.c
PRECIOUSPROG=
INSTALLFLAGS=-b -B.bak
CFLAGS.init.c+=-DDEBUGSHELL -DSECURE -DLOGIN_CAP -DCOMPAT_SYSV_INIT
.ifdef RESCUE
CFLAGS.init.c+=-DRESCUE
.else
SRCS+= reroot_seed.embed.s
ACFLAGS.reroot_seed.embed.s+=-I${OBJTOP}/sbin/reroot_seed
.endif
LIBADD= util crypt
CONFTTYSNAME= ttys
CONFTTYS+= ttys
.include <bsd.prog.mk>