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