Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153439871
D50832.id156965.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
4 KB
Referenced Files
None
Subscribers
None
D50832.id156965.diff
View Options
diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h
--- a/stand/common/bootstrap.h
+++ b/stand/common/bootstrap.h
@@ -132,6 +132,8 @@
MODULE_VERBOSE_FULL, /* all we have */
};
+extern uint32_t print_delay_usec;
+
/*
* Plug-and-play enumerator/configurator interface.
*/
@@ -372,6 +374,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;
+uint32_t print_delay_usec = 0;
+
static int
module_verbose_set(struct env_var *ev, int flags, const void *value)
{
@@ -178,6 +180,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/common/misc.c b/stand/common/misc.c
--- a/stand/common/misc.c
+++ b/stand/common/misc.c
@@ -204,6 +204,23 @@
return (mount_currdev(ev, flags, value));
}
+/*
+ * 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 (ENAN);
+ if (usec < 0)
+ return (ENUMNEG);
+ print_delay_usec = usec;
+ return (0);
+}
+
/*
* Wrapper to set currdev and loaddev at the same time.
*/
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" # Used to 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,12 @@
.Va beastie_disable
must be set to
.Dq Li YES .
+.It Ar print_delay
+Slows printing of loader messages by delaying by a fixed amount of microseconds
+after each newline character is encountered, which can be useful for debugging.
+If set to
+.Dq Li 0 ,
+no delay will be inserted after printing a newline.
.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);
diff --git a/stand/libsa/stand.h b/stand/libsa/stand.h
--- a/stand/libsa/stand.h
+++ b/stand/libsa/stand.h
@@ -80,7 +80,10 @@
#define ERDLAB (ELAST+6) /* can't read disk label */
#define EUNLAB (ELAST+7) /* unlabeled disk */
#define EOFFSET (ELAST+8) /* relative seek not supported */
-#define ESALAST (ELAST+8) /* */
+#define ENAN (ELAST+9) /* string we're trying to convert to number
+ is not a number */
+#define ENUMNEG (ELAST+10) /* number is negative */
+#define ESALAST (ELAST+10) /* */
/*
* LUA needs sig_atomic_t. This is defined to be long or int on all our
diff --git a/stand/libsa/strerror.c b/stand/libsa/strerror.c
--- a/stand/libsa/strerror.c
+++ b/stand/libsa/strerror.c
@@ -66,6 +66,8 @@
{ERDLAB, "can't read disk label"},
{EUNLAB, "disk unlabelled"},
{EOFFSET, "illegal seek"},
+ {ENAN, "not a number"},
+ {ENUMNEG, "number negative"},
{0, NULL}
};
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 22, 4:40 AM (11 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31953477
Default Alt Text
D50832.id156965.diff (4 KB)
Attached To
Mode
D50832: stand: Add support for `print_delay` environment variable in loader
Attached
Detach File
Event Timeline
Log In to Comment