bootwhat.h 3.94 KB
Newer Older
1
/*
2
 * Copyright (c) 2000-2011 University of Utah and the Flux Group.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 * 
 * {{{EMULAB-LICENSE
 * 
 * This file is part of the Emulab network testbed software.
 * 
 * This file is free software: you can redistribute it and/or modify it
 * under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or (at
 * your option) any later version.
 * 
 * This file is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public
 * License for more details.
 * 
 * You should have received a copy of the GNU Affero General Public License
 * along with this file.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * }}}
22
 *
23
 * Derived from boot/bootwhat.h in the OSKit.
24 25
 */

26 27
#ifndef _EMULAB_BOOTWHAT_H_
#define _EMULAB_BOOTWHAT_H_
28

29
#define BOOTWHAT_DSTPORT		6969
30
#define BOOTWHAT_SRCPORT		9696
31
#define BOOTWHAT_SENDPORT		6970
32 33

/*
34
 * This is the structure we pass back and forth between pxeboot on a node
35
 * and a server running on some other machine, that tells what to do.
36 37 38 39 40
 *
 * The structure below was changed, adding the version slot by splitting
 * the opcode from an int into a short. Old clients conveniently look like a
 * version zero client. The same was done for the "type" field, splitting 
 * that into "flags" and "type" shorts.
41 42 43 44 45
 */
#define  MAX_BOOT_DATA		512
#define  MAX_BOOT_PATH		256
#define  MAX_BOOT_CMDLINE	((MAX_BOOT_DATA - MAX_BOOT_PATH) - 32)

46 47
#define	 HOSTKEY_LENGTH 	129

48
typedef struct boot_info {
49 50
	short   version;
	short	opcode;
51 52 53 54 55 56 57
	int	status;
	char	data[MAX_BOOT_DATA];
} boot_info_t;

/* Opcode */
#define BIOPCODE_BOOTWHAT_REQUEST	1	/* What to boot request */
#define BIOPCODE_BOOTWHAT_REPLY		2	/* What to boot reply */
58 59 60
#define BIOPCODE_BOOTWHAT_ACK		3	/* Ack to Reply */
#define BIOPCODE_BOOTWHAT_ORDER		4	/* Unsolicited command */
#define BIOPCODE_BOOTWHAT_INFO		5	/* Request for bootinfo */
61
#define BIOPCODE_BOOTWHAT_KEYED_REQUEST 6	/* Request for bootinfo, with key data stuffed into the data portion */
62 63

/* Version */
64
#define BIVERSION_CURRENT		1	/* First version is zero */
65 66 67 68

/* Status */
#define BISTAT_SUCCESS			0
#define BISTAT_FAIL			1
69 70

/* BOOTWHAT Reply */
71 72 73
typedef struct boot_what {
	short	flags;
	short	type;
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
	union {
		/*
		 * Type is BIBOOTWHAT_TYPE_PART
		 *
		 * Specifies the partition number.
		 */
		int			partition;
		
		/*
		 * Type is BIBOOTWHAT_TYPE_SYSID
		 *
		 * Specifies the PC BIOS filesystem type.
		 */
		int			sysid;
		
		/*
		 * Type is BIBOOTWHAT_TYPE_MB
		 *
		 * Specifies a multiboot kernel pathway suitable for TFTP.
		 */
		struct {
			struct in_addr	tftp_ip;
			char		filename[MAX_BOOT_PATH];
		} mb;
98 99 100 101 102 103 104 105

		/*
		 * Type is BIBOOTWHAT_TYPE_MFS
		 *
		 * Specifies network path to MFS (boss:/tftpboot/frisbee)
		 * With no host spec, defaults to bootinfo server IP.
		 */
		char			mfs[MAX_BOOT_PATH];
106 107 108 109 110 111 112 113 114 115

		/*
		 * Type is BIBOOTWHAT_TYPE_DISKPART
		 *
		 * Specifies the BIOS disk and partition numbers.
		 */
		struct {
			int disk;
			int partition;
		} dp;
116
	} what;
117 118 119
	/*
	 * Kernel and command line to pass to boot loader or multiboot kernel.
	 */
120 121 122 123 124 125 126
	char	cmdline[1];
} boot_what_t;

/* What type of thing to boot */
#define BIBOOTWHAT_TYPE_PART	1	/* Boot a partition number */
#define BIBOOTWHAT_TYPE_SYSID	2	/* Boot a system ID */
#define BIBOOTWHAT_TYPE_MB	3	/* Boot a multiboot image */
127 128 129 130
#define BIBOOTWHAT_TYPE_WAIT    4	/* Wait, no boot until later */
#define BIBOOTWHAT_TYPE_REBOOT	5	/* Reboot */
#define BIBOOTWHAT_TYPE_AUTO	6	/* Do a bootinfo query */
#define BIBOOTWHAT_TYPE_MFS	7	/* Boot an MFS from server:/path */
131
#define BIBOOTWHAT_TYPE_RESTART	8	/* Restart ourselves without reset */
132
#define BIBOOTWHAT_TYPE_DISKPART 9      /* Boot a partition from a specific disk */
133

134
/* Flags */
135
#define BIBOOTWHAT_FLAGS_CMDLINE	0x01	/* Kernel to boot */ 
136
#define BIBOOTWHAT_FLAGS_SECURE		0x02	/* Part of secure boot chain */
137

138
#endif /* _EMULAB_BOOTWHAT_H_ */