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