1 /*	$OpenBSD: i386_installboot.h,v 1.7 2021/07/20 14:51:56 kettenis Exp $	*/
2 /*
3  * Copyright (c) 2011 Joel Sing <jsing@openbsd.org>
4  * Copyright (c) 2003 Tom Cosgrove <tom.cosgrove@arches-consulting.com>
5  * Copyright (c) 1997 Michael Shalayeff
6  * Copyright (c) 1994 Paul Kranenburg
7  * All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *      This product includes software developed by Paul Kranenburg.
20  * 4. The name of the author may not be used to endorse or promote products
21  *    derived from this software without specific prior written permission
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #define INODESEG        0x07e0  /* where we will put /boot's inode's block */
36 #define BOOTSEG         0x07c0  /* biosboot loaded here */
37 
38 #define INODEOFF  ((INODESEG-BOOTSEG) << 4)
39 
40 #define SR_FS_BLOCKSIZE (16 * 1024)
41 
42 struct  sym_data {
43 	char		*sym_name;		/* Must be initialised */
44 	int		sym_size;		/* And this one */
45 	int		sym_set;		/* Rest set at runtime */
46 	u_int32_t	sym_value;
47 };
48 
49 extern struct sym_data pbr_symbols[];
50 
51 struct nlist;
52 
53 int	nlist_elf32(const char *, struct nlist *);
54 void	pbr_set_symbols(char *, char *, struct sym_data *);
55 void	sym_set_value(struct sym_data *, char *, u_int32_t);
56 void	write_bootblocks(int, char *, struct disklabel *);
57 int	findgptefisys(int, struct disklabel *);
58 int	create_filesystem(struct disklabel *, char);
59 void	write_filesystem(struct disklabel *, char);
60