Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 02 Feb 1998 14:34:15 -0600
From:      Ade Lovett <ade@demon.net>
To:        Mike Smith <mike@smith.net.au>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: boot floppy banner 
Message-ID:  <E0xzSZL-0005It-00@sphinx.lovett.com>
In-Reply-To: Your message of "Mon, 02 Feb 1998 11:49:09 %2B1030." <199802020119.LAA00856@word.smith.net.au> 

next in thread | previous in thread | raw e-mail | index | archive | help
Mike Smith writes:
>
>Hmm, if you want to save space, try removing the bad144 stuff.  It 
>wastes a great deal of space for almost zero functionality.

Right.  By removing the DO_BAD144 define I've now got the space to
implement the next attempt at the boot.banner stuff, also keeping
the "Can't find <xxx>" printf's, though I've moved this to openrd()
itself to remove a little bit of code duplication.

If /boot.banner exists then that will be displayed and, if /boot.help
exists, the boot prompt is modified to tell the use that more information
can be found by typing 'help'.

If it doesn't exist, then /boot.help will be displayed (if it exists)
followed by the regular boot prompt messages.

If the user then types 'help', the contents of /boot.help will be
displayed (with the regular boot prompt message), otherwise they'll
be told that no further help is available.

Patch (with cvs diff -c this time :) is attached at the end.

I guess the main question is whether losing BAD144 support entirely
is an acceptable loss..

-aDe

----------------------------------------------------------------------
gorgon 80# cvs diff -c
cvs diff: Diffing .
Index: Makefile
===================================================================
RCS file: /code/FreeBSD/src/sys/i386/boot/biosboot/Makefile,v
retrieving revision 1.61
diff -c -r1.61 Makefile
*** Makefile	1998/01/27 16:56:43	1.61
--- Makefile	1998/02/02 20:12:34
***************
*** 12,18 ****
  		-mno-486 \
  		-DBOOTWAIT=${BOOTWAIT} -DTIMEOUT=${TIMEOUT}
  CFLAGS+=	-DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK}
! CFLAGS+=	-DDO_BAD144
  CFLAGS+=	-DVESA_SUPPORT
  CFLAGS+=	-I${.CURDIR}/../../..
  CFLAGS+=	${CWARNFLAGS}
--- 12,18 ----
  		-mno-486 \
  		-DBOOTWAIT=${BOOTWAIT} -DTIMEOUT=${TIMEOUT}
  CFLAGS+=	-DBOOTSEG=${BOOTSEG} -DBOOTSTACK=${BOOTSTACK}
! #CFLAGS+=	-DDO_BAD144
  CFLAGS+=	-DVESA_SUPPORT
  CFLAGS+=	-I${.CURDIR}/../../..
  CFLAGS+=	${CWARNFLAGS}
Index: boot.c
===================================================================
RCS file: /code/FreeBSD/src/sys/i386/boot/biosboot/boot.c,v
retrieving revision 1.70
diff -c -r1.70 boot.c
*** boot.c	1998/02/01 05:24:24	1.70
--- boot.c	1998/02/02 20:28:25
***************
*** 61,71 ****
--- 61,73 ----
  
  #define	BOOT_CONFIG_SIZE	512
  #define	BOOT_HELP_SIZE		2048
+ #define BOOT_BANNER_SIZE	512
  #define	KERNEL_CONFIG_SIZE	512
  #define	NAMEBUF_LEN		1024	/* oversized to defend against gets() */
  
  static char boot_config[BOOT_CONFIG_SIZE];
  static char boot_help[BOOT_HELP_SIZE];
+ static char boot_banner[BOOT_BANNER_SIZE];
  #ifdef NAMEBLOCK
  char *dflt_name;
  #endif
***************
*** 86,91 ****
--- 88,95 ----
  boot(int drive)
  {
  	int ret;
+ 	char *boot_text = boot_banner;
+ 	char *boot_helpinfo = "For more information, type 'help'\n";
  
  	/* Pick up the story from the Bios on geometry of disks */
  
***************
*** 127,132 ****
--- 131,146 ----
  #ifndef RAWBOOT
  	readfile("boot.config", boot_config, BOOT_CONFIG_SIZE);
  	readfile("boot.help", boot_help, BOOT_HELP_SIZE);
+ 	readfile("boot.banner", boot_banner, BOOT_BANNER_SIZE);
+ 	if (boot_banner[0] == '\0') {
+ 		boot_text = boot_help;
+ 		boot_helpinfo = "";
+ 	} else {
+ 		boot_text = boot_help;
+ 		if (boot_help[0] == '\0')
+ 			boot_helpinfo = "";
+ 	}
+ 
  #endif
  #ifdef	NAMEBLOCK
  	/*
***************
*** 152,164 ****
  	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.
--- 166,179 ----
  	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"
+ 	       "%s"
  	       "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_text, boot_helpinfo);
  
  	/*
  	 * Ignore flags from previous attempted boot, if any.
***************
*** 175,190 ****
  
  	if (!gets(linebuf))
  		putchar('\n');
! 	else
  		getbootdev(linebuf, &loadflags);
  	if (name == NULL)
  		goto loadstart;
! 	ret = openrd();
! 	if (ret != 0) {
! 		if (ret > 0)
! 			printf("Can't find %s\n", name);
  		goto loadstart;
- 	}
  /*	if (inode.i_mode&IEXEC)
  		loadflags |= RB_KDB;
  */
--- 190,207 ----
  
  	if (!gets(linebuf))
  		putchar('\n');
! 	else if (!strcmp(linebuf, "help")) {
! 		if (boot_help[0] == '\0')
! 			printf( "No extended help available\n" );
! 		boot_text = boot_help;
! 		boot_helpinfo = "";
! 		goto loadstart;
! 	} else
  		getbootdev(linebuf, &loadflags);
  	if (name == NULL)
  		goto loadstart;
! 	if (openrd() != 0)
  		goto loadstart;
  /*	if (inode.i_mode&IEXEC)
  		loadflags |= RB_KDB;
  */
***************
*** 353,367 ****
  static void
  readfile(char *path, char *buf, size_t nbytes)
  {
- 	int openstatus;
- 
  	buf[0] = '\0';
  	name = path;
! 	openstatus = openrd();
! 	if (openstatus != 0) {
! 		if (openstatus > 0)
! 			printf("Can't find file %s\n", name);
! 	} else {
  		/* XXX no way to determine file size. */
  		read(buf, nbytes);
  	}
--- 370,378 ----
  static void
  readfile(char *path, char *buf, size_t nbytes)
  {
  	buf[0] = '\0';
  	name = path;
! 	if (openrd() == 0) {
  		/* XXX no way to determine file size. */
  		read(buf, nbytes);
  	}
Index: sys.c
===================================================================
RCS file: /code/FreeBSD/src/sys/i386/boot/biosboot/sys.c,v
retrieving revision 1.21
diff -c -r1.21 sys.c
*** sys.c	1997/06/09 05:10:56	1.21
--- sys.c	1998/02/02 19:56:39
***************
*** 302,309 ****
  	\***********************************************/
  	ret = find(cp);
  	name = cp;
! 	if (ret == 0)
  		return 1;
  	if (ret < 0) {
  		name = NULL;
  		return -1;
--- 302,311 ----
  	\***********************************************/
  	ret = find(cp);
  	name = cp;
! 	if (ret == 0) {
! 		printf( "Can't find %s\n", name );
  		return 1;
+ 	}
  	if (ret < 0) {
  		name = NULL;
  		return -1;
----------------------------------------------------------------------

-- 
Ade Lovett, Demon Internet, Austin, Texas.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E0xzSZL-0005It-00>