bootwhat.h 2.71 KB
Newer Older
1
/*
Mike Hibler's avatar
Mike Hibler committed
2 3
 * EMULAB-COPYRIGHT
 * Copyright (c) 2000-2006 University of Utah and the Flux Group.
4
 * All rights reserved.
5 6
 *
 * boot/bootwhat.h from the OSKit.
7 8 9 10 11
 */

#ifndef _OSKIT_BOOT_BOOTWHAT_H_
#define _OSKIT_BOOT_BOOTWHAT_H_

12
#define BOOTWHAT_DSTPORT		6969
13
#define BOOTWHAT_SRCPORT		9696
14
#define BOOTWHAT_SENDPORT		6970
15 16

/*
17
 * This is the structure we pass back and forth between pxeboot on a node
18
 * and a server running on some other machine, that tells what to do.
19 20 21 22 23
 *
 * 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.
24 25 26 27 28 29
 */
#define  MAX_BOOT_DATA		512
#define  MAX_BOOT_PATH		256
#define  MAX_BOOT_CMDLINE	((MAX_BOOT_DATA - MAX_BOOT_PATH) - 32)

typedef struct {
30 31
	short   version;
	short	opcode;
32 33 34 35 36 37 38
	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 */
39 40 41 42 43 44 45 46 47 48
#define BIOPCODE_BOOTWHAT_ACK		3	/* Ack to Reply */
#define BIOPCODE_BOOTWHAT_ORDER		4	/* Unsolicited command */
#define BIOPCODE_BOOTWHAT_INFO		5	/* Request for bootinfo */

/* Version */
#define BIVERSION_CURRENT		1	/* Old version is zero */

/* Status */
#define BISTAT_SUCCESS			0
#define BISTAT_FAIL			1
49 50

/* BOOTWHAT Reply */
51 52 53
typedef struct boot_what {
	short	flags;
	short	type;
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
	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;
78 79 80 81 82 83 84 85

		/*
		 * 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];
86
	} what;
87 88 89
	/*
	 * Kernel and command line to pass to boot loader or multiboot kernel.
	 */
90 91 92 93 94 95 96
	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 */
97 98 99 100
#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 */
101

102 103
/* Flags */
#define BIBOOTWHAT FLAGS_CMDLINE	0x01	/* Kernel to boot */ 
104 105

#endif /* _OSKIT_BOOT_BOOTWHAT_H_ */