diff options
author | Michael Shalayeff <mickey@cvs.openbsd.org> | 1998-07-27 15:41:11 +0000 |
---|---|---|
committer | Michael Shalayeff <mickey@cvs.openbsd.org> | 1998-07-27 15:41:11 +0000 |
commit | 8337f7abf6c4e45325d634d1a45a9918b70a77c5 (patch) | |
tree | a714ddf421886f1ae0e97e1bf0a94408fe5c95ae /sys/arch/hppa/stand/mkboot | |
parent | 07169dda497cae9a1635eaa9512a71e40e741551 (diff) |
make LIF definitions machine-wide
fix bug w/ blank LIF file names (\t crept into "" string), use memset
don't prepend names w/ SYS_
Diffstat (limited to 'sys/arch/hppa/stand/mkboot')
-rw-r--r-- | sys/arch/hppa/stand/mkboot/mkboot.c | 34 | ||||
-rw-r--r-- | sys/arch/hppa/stand/mkboot/volhdr.h | 88 |
2 files changed, 14 insertions, 108 deletions
diff --git a/sys/arch/hppa/stand/mkboot/mkboot.c b/sys/arch/hppa/stand/mkboot/mkboot.c index 4402fea50a6..26c37eb2e90 100644 --- a/sys/arch/hppa/stand/mkboot/mkboot.c +++ b/sys/arch/hppa/stand/mkboot/mkboot.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mkboot.c,v 1.2 1998/07/13 02:11:29 millert Exp $ */ +/* $OpenBSD: mkboot.c,v 1.3 1998/07/27 15:41:08 mickey Exp $ */ /* * Copyright (c) 1990, 1993 @@ -43,7 +43,7 @@ static char copyright[] = #endif /* not lint */ #ifndef lint -static char rcsid[] = "$OpenBSD: mkboot.c,v 1.2 1998/07/13 02:11:29 millert Exp $"; +static char rcsid[] = "$OpenBSD: mkboot.c,v 1.3 1998/07/27 15:41:08 mickey Exp $"; #endif /* not lint */ #endif @@ -61,7 +61,12 @@ static char rcsid[] = "$OpenBSD: mkboot.c,v 1.2 1998/07/13 02:11:29 millert Exp #include <sys/exec_aout.h> #include <sys/exec_elf.h> -#include "volhdr.h" +#ifndef hppa +/* hack for cross compile XXX */ +#include "../../include/lifvar.h" +#else +#include <machine/lifvar.h> +#endif #include <stdio.h> #include <ctype.h> @@ -72,17 +77,6 @@ void bcddate __P((char *, char *)); char *lifname __P((char *)); int cksum __P((int, int *, int)); -#define LIF_NUMDIR 8 - -#define LIF_VOLSTART 0 -#define LIF_VOLSIZE sizeof(struct lifvol) -#define LIF_DIRSTART 2048 -#define LIF_DIRSIZE (LIF_NUMDIR * sizeof(struct lifdir)) -#define LIF_FILESTART 4096 - -#define btolifs(b) (((b) + (SECTSIZE - 1)) / SECTSIZE) -#define lifstob(s) ((s) * SECTSIZE) - char *to_file; int loadpoint, verbose; u_long entry; @@ -139,7 +133,7 @@ main(argc, argv) bzero(buf, sizeof(buf)); /* clear possibly unused directory entries */ - strncpy(lifd[1].dir_name, " ", 10); + memset(lifd[1].dir_name, ' ', 10); lifd[1].dir_type = -1; lifd[1].dir_addr = 0; lifd[1].dir_length = 0; @@ -164,11 +158,11 @@ main(argc, argv) argv += optind; argc -= optind; optind = 0; - for (pos = btolifs(LIF_FILESTART); optind < argc; optind++) { + for (pos = LIF_FILESTART; optind < argc; optind++) { /* output bootfile */ - lseek(to, lifstob(pos), 0); - lifd[optind].dir_addr = htobe32(pos); + lseek(to, pos, 0); + lifd[optind].dir_addr = htobe32(btolifs(pos)); n = btolifs(putfile(argv[optind], to)); if (lifv->ipl_entry == 0) { lifv->ipl_entry = htobe32(loadpoint + entry); @@ -358,10 +352,10 @@ char * lifname(str) char *str; { - static char lname[10] = "SYS_XXXXXX"; + static char lname[10] = "XXXXXXXXXX"; register int i; - for (i = 4; i < 9; i++) { + for (i = 0; i < 9; i++) { if (islower(*str)) lname[i] = toupper(*str); else if (isalnum(*str) || *str == '_') diff --git a/sys/arch/hppa/stand/mkboot/volhdr.h b/sys/arch/hppa/stand/mkboot/volhdr.h deleted file mode 100644 index 437898df70e..00000000000 --- a/sys/arch/hppa/stand/mkboot/volhdr.h +++ /dev/null @@ -1,88 +0,0 @@ -/* $OpenBSD: volhdr.h,v 1.1 1998/06/23 18:46:43 mickey Exp $ */ -/* $NetBSD: volhdr.h,v 1.4 1994/10/26 07:28:08 cgd Exp $ */ - -/* - * Copyright (c) 1988 University of Utah. - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * 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. - * - * @(#)volhdr.h 8.1 (Berkeley) 6/10/93 - */ - -/* - * vohldr.h: volume header for "LIF" format volumes - */ - -struct lifvol { - short vol_id; - char vol_label[6]; - u_int vol_addr; - short vol_oct; - short vol_dummy; - u_int vol_dirsize; - short vol_version; - short vol_zero; - u_int vol_number; - u_int vol_lastvol; - u_int vol_length; - char vol_toc[6]; - char vol_dummy1[198]; - - u_int ipl_addr; - u_int ipl_size; - u_int ipl_entry; -}; - -struct lifdir { - char dir_name[10]; - short dir_type; - u_int dir_addr; - u_int dir_length; - char dir_toc[6]; - short dir_flag; - u_int dir_implement; -}; - -struct load { - int address; - int count; -}; - -#define VOL_ID -32768 -#define VOL_OCT 4096 -#define DIR_TYPE -5822 -#define DIR_ISL -12800 -#define DIR_FLAG 0x8001 /* dont ask me! */ -#define SECTSIZE 256 |