Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Aug 1998 23:30:37 -0500 (CDT)
From:      Joel Ray Holveck <joelh@gnu.org>
To:        freebsd-hackers@FreeBSD.ORG
Subject:   Patch: Booting with -v
Message-ID:  <199808140430.XAA00473@detlev.UUCP>

next in thread | raw e-mail | index | archive | help
Okay, I've finally found my round tuit (it was in the square hole,
natch).  This means that I finally wrote the patch to allow -v (and
other flags) to be in the /boot.config (yay!).

In the process of saving a few bytes, I did change the boot message
bit that says "internal", "internal/dual", "serial", or "serial/dual"
to read just "internal", "serial", or "dual".  Is the distinction
between serial/dual and internal/dual  in that message a useful one?

Enclosed is the patch to /sys/i386/boot/biosboot/boot.c (against
-current sources); I've tested it a total of once.  Caveat emptor, and
vivat hacker, and all that.

If nobody has any objections, I'll submit a pr on this (after a little
stylistic cleanup and a manpage change).  But I would appreciate
people looking over it and trying it out before I submit a patch that
will leave every third system unbootable.  Send results-- good, bad or
indifferent-- to me personally.

Again: This has been tested only once.  Although I don't see any
reason it should fail, be sure that you have a boot and fixit floppy
and your old boot2 handy.

Happy hacking,
joelh

-----cut here-----
*** boot.c-orig	Thu Aug 13 23:18:19 1998
--- boot.c	Thu Aug 13 22:23:49 1998
***************
*** 86,91 ****
--- 86,92 ----
  boot(int drive)
  {
  	int ret;
+ 	int cfg_loadflags = 0;
  
  	/* Pick up the story from the Bios on geometry of disks */
  
***************
*** 142,177 ****
  		name = "kernel";
  	if (boot_config[0] != '\0') {
  		printf("boot.config: %s", boot_config);
! 		getbootdev(boot_config, &loadflags);
  		if (openrd() != 0)
  			name = "kernel";
  	}
  loadstart:
  	/* print this all each time.. (saves space to do so) */
  	/* If we have looped, use the previous entries as defaults */
! 	printf("\r \n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory, %s%s console\n"
! 	       "Boot default: %d:%s(%d,%c)%s\n"
  	       "%s\n"
  	       "boot: ",
  	       ouraddr, bootinfo.bi_basemem, bootinfo.bi_extmem,
  	       (loadflags & RB_SERIAL) ? "serial" : "internal",
- 	       (loadflags & RB_DUAL) ? "/dual" : "",
  	       dosdev & 0x7f, devs[maj], unit, 'a' + part,
  	       name ? name : "*specify_a_kernel_name*",
  	       boot_help);
  
! 	/*
! 	 * Ignore flags from previous attempted boot, if any.
! 	 * XXX this is now too strict.  Settings given in boot.config should
! 	 * not be changed.
! 	 */
! 	loadflags &= (RB_DUAL | RB_SERIAL);
! 
  	/*
  	 * Be paranoid and make doubly sure that the input buffer is empty.
  	 */
  	if (loadflags & (RB_DUAL | RB_SERIAL))
  		init_serial();
  
  	if (!gets(linebuf))
  		putchar('\n');
--- 143,177 ----
  		name = "kernel";
  	if (boot_config[0] != '\0') {
  		printf("boot.config: %s", boot_config);
! 		getbootdev(boot_config, &cfg_loadflags);
  		if (openrd() != 0)
  			name = "kernel";
  	}
  loadstart:
+ 	/* Ignore flags from previous attempted boot, if any. */
+ 	loadflags = cfg_loadflags;
+ 
  	/* print this all each time.. (saves space to do so) */
  	/* If we have looped, use the previous entries as defaults */
! 	printf("\r \n>> FreeBSD BOOT @ 0x%x: %d/%d k of memory, %s console\n"
! 	       "Boot default: %d:%s(%d,%c)%s (flags 0x%x)\n"
  	       "%s\n"
  	       "boot: ",
  	       ouraddr, bootinfo.bi_basemem, bootinfo.bi_extmem,
+ 	       (loadflags & RB_DUAL) ? "dual" :
  	       (loadflags & RB_SERIAL) ? "serial" : "internal",
  	       dosdev & 0x7f, devs[maj], unit, 'a' + part,
  	       name ? name : "*specify_a_kernel_name*",
+ 	       loadflags,
  	       boot_help);
  
! #if 0
  	/*
  	 * Be paranoid and make doubly sure that the input buffer is empty.
  	 */
  	if (loadflags & (RB_DUAL | RB_SERIAL))
  		init_serial();
+ #endif
  
  	if (!gets(linebuf))
  		putchar('\n');
***************
*** 376,382 ****
  	char *p;
  
  	/* Copy the flags to save some bytes. */
! 	f = *howto;
  
  	c = *ptr;
  	for (;;) {
--- 376,382 ----
  	char *p;
  
  	/* Copy the flags to save some bytes. */
! 	f = *howto & (RB_DUAL | RB_SERIAL | RB_PROBEKBD);
  
  	c = *ptr;
  	for (;;) {
-----cut here-----

-- 
Joel Ray Holveck - joelh@gnu.org - http://www.wp.com/piquan
   Fourth law of programming:
   Anything that can go wrong wi
sendmail: segmentation violation - core dumped

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199808140430.XAA00473>