4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
23 * Copyright 2012 Nexenta Systems, Inc. All rights reserved.
24 * Copyright 2016 Toomas Soome <tsoome@me.com>
27 #ifndef _INSTALLBOOT_H
28 #define _INSTALLBOOT_H
34 #include <sys/multiboot.h>
35 #include <sys/types.h>
37 #define SECTOR_SIZE (512)
39 /* partitioning type for device */
46 /* file system type */
54 /* partition info for boot block location. */
56 char *path
; /* device name */
57 int fd
; /* open file descriptor */
58 int id
; /* partition/slice number */
59 enum ig_devtype_t devtype
; /* partitioning type */
60 enum ig_fstype_t fstype
; /* none or pcfs */
61 uint64_t start
; /* partition LBA */
62 uint64_t size
; /* partition size */
63 uint64_t offset
; /* block offset */
66 /* boot device data */
67 typedef struct _ib_device
{
68 char *path
; /* whole disk */
69 int fd
; /* whole disk fd */
70 enum ig_devtype_t devtype
;
71 struct stage_part stage
; /* location of boot block */
72 struct stage_part target
; /* target file system */
73 char mbr
[SECTOR_SIZE
];
76 /* stage 2 location */
77 typedef struct _ib_bootblock
{
81 multiboot_header_t
*mboot
;
88 typedef struct _ib_data
{
89 unsigned char stage1
[SECTOR_SIZE
]; /* partition boot block */
90 ib_device_t device
; /* boot device */
91 ib_bootblock_t bootblock
; /* stage 2 */
94 #define BBLK_BLKLIST_OFF 50 /* vtoc/disk boot offset */
95 #define BBLK_ZFS_BLK_OFF 1024 /* vdev boot offset */
96 #define BBLK_ZFS_BLK_SIZE (7ULL << 19) /* vdev max boot size */
98 /* locations of MBR parts, must be reviewd if mbr code is changed */
99 #define STAGE1_BPB_OFFSET (0x3) /* technically BPB starts at 0xb */
100 #define STAGE1_BPB_SIZE (0x3b)
101 #define STAGE1_MBR_VERSION (0xfa) /* 2 bytes, not used */
102 #define STAGE1_STAGE2_SIZE (0xfc) /* 16bits */
103 #define STAGE1_STAGE2_LBA (0xfe) /* 64bits */
104 #define STAGE1_STAGE2_UUID (0x106) /* 128bits */
105 #define STAGE1_SIG (0x1b8) /* 4+2 bytes */
106 #define STAGE1_PARTTBL (0x1be) /* MBR partition table */
107 #define STAGE1_MAGIC (0x1fe) /* 0xAA55 */
112 #endif /* _INSTALLBOOT_H */