Page MenuHomeFreeBSD

D50832.diff
No OneTemporary

D50832.diff

diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h
--- a/stand/common/bootstrap.h
+++ b/stand/common/bootstrap.h
@@ -372,6 +372,8 @@
/* This must be provided by the MD code, but should it be in the archsw? */
void delay(int delay);
+int setprint_delay(struct env_var *ev, int flags, const void *value);
+
/* common code to set currdev variable. */
int gen_setcurrdev(struct env_var *ev, int flags, const void *value);
int mount_currdev(struct env_var *, int, const void *);
diff --git a/stand/common/console.c b/stand/common/console.c
--- a/stand/common/console.c
+++ b/stand/common/console.c
@@ -44,6 +44,8 @@
#endif
int module_verbose = MODULE_VERBOSE;
+static uint32_t print_delay_usec = 0;
+
static int
module_verbose_set(struct env_var *ev, int flags, const void *value)
{
@@ -65,6 +67,23 @@
return (CMD_OK);
}
+/*
+ * Hook to set the print delay
+ */
+int
+setprint_delay(struct env_var *ev, int flags, const void *value)
+{
+ char *end;
+ int usec = strtol(value, &end, 10);
+
+ if (*(char *)value == '\0' || *end != '\0')
+ return (EINVAL);
+ if (usec < 0)
+ return (EINVAL);
+ print_delay_usec = usec;
+ return (0);
+}
+
/*
* Detect possible console(s) to use. If preferred console(s) have been
* specified, mark them as active. Else, mark the first probed console
@@ -178,6 +197,10 @@
(C_PRESENTOUT | C_ACTIVEOUT))
consoles[cons]->c_out(c);
}
+
+ /* Pause after printing newline character if a print delay is set */
+ if (print_delay_usec != 0 && c == '\n')
+ delay(print_delay_usec);
}
/*
diff --git a/stand/defaults/loader.conf b/stand/defaults/loader.conf
--- a/stand/defaults/loader.conf
+++ b/stand/defaults/loader.conf
@@ -95,6 +95,8 @@
# Default is unset and disabled (no delay).
#autoboot_delay="10" # Delay in seconds before autobooting,
# -1 for no user interrupts, NO to disable
+#print_delay="1000000" # Slow printing of loader messages, useful for
+ # debugging. Given in microseconds.
#password="" # Prevent changes to boot options
#bootlock_password="" # Prevent booting (see check-password.4th(8))
#geom_eli_passphrase_prompt="NO" # Prompt for geli(8) passphrase to mount root
diff --git a/stand/defaults/loader.conf.5 b/stand/defaults/loader.conf.5
--- a/stand/defaults/loader.conf.5
+++ b/stand/defaults/loader.conf.5
@@ -21,7 +21,7 @@
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
-.Dd June 5, 2025
+.Dd June 12, 2025
.Dt LOADER.CONF 5
.Os
.Sh NAME
@@ -116,6 +116,10 @@
.Va beastie_disable
must be set to
.Dq Li YES .
+.It Ar print_delay
+Add a delay in microseconds after printing each line.
+Default
+.Dq Li 0 .
.It Ar boot_*
See list in
.Xr loader.efi 8
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -1241,6 +1241,9 @@
#endif
cons_probe();
+ /* Set print_delay variable to have hooks in place. */
+ env_setenv("print_delay", EV_VOLATILE, "", setprint_delay, env_nounset);
+
/* Set up currdev variable to have hooks in place. */
env_setenv("currdev", EV_VOLATILE, "", gen_setcurrdev, env_nounset);

File Metadata

Mime Type
text/plain
Expires
Sun, Oct 12, 10:07 PM (6 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
23643176
Default Alt Text
D50832.diff (3 KB)

Event Timeline