ia64/xen-unstable

changeset 6879:97dbd9524a7e

Patches and recipe to build an elilo.efi that will boot domain0 with initrd
and pre-built "xlilo.efi". Courtesy of Anthony Xu and Fred Yang.
author djm@kirby.fc.hp.com
date Thu Sep 22 11:34:14 2005 -0600 (2005-09-22)
parents babbdd896024
children 06d84bf87159
files xen/arch/ia64/tools/xelilo/elilo-3.4.11.xen.patch xen/arch/ia64/tools/xelilo/elilo.README xen/arch/ia64/tools/xelilo/xen4elilo.patch xen/arch/ia64/tools/xelilo/xlilo.efi
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xen/arch/ia64/tools/xelilo/elilo-3.4.11.xen.patch	Thu Sep 22 11:34:14 2005 -0600
     1.3 @@ -0,0 +1,402 @@
     1.4 +<Sign-off: fred.yang@intel.com>
     1.5 +diff -Naur base/bootparams.c elilo/bootparams.c
     1.6 +--- base/bootparams.c	2005-09-20 19:51:07.000000000 -0700
     1.7 ++++ elilo/bootparams.c	2005-09-20 19:33:00.000000000 -0700
     1.8 +@@ -38,7 +38,7 @@
     1.9 +  * 	bp  : the address of the bootparams otherwise (opaque type)
    1.10 +  */
    1.11 + VOID *
    1.12 +-create_boot_params(CHAR16 *args, memdesc_t *initrd, UINTN *cookie)
    1.13 ++create_boot_params(CHAR16 *args, memdesc_t *initrd, memdesc_t *vmcode, UINTN *cookie)
    1.14 + {
    1.15 + /* 
    1.16 +  * XXX: need cleanup
    1.17 +@@ -95,7 +95,7 @@
    1.18 + 	 */
    1.19 + 	Memset(bp, 0, BOOT_PARAM_MEMSIZE);
    1.20 + 
    1.21 +-	if (sysdeps_create_boot_params(bp, cp, initrd, cookie) == -1) return 0;
    1.22 ++	if (sysdeps_create_boot_params(bp, cp, initrd, vmcode, cookie) == -1) return 0;
    1.23 + 
    1.24 + 	/*
    1.25 + 	 * Convert kernel command line args from UNICODE to ASCII and put them where
    1.26 +diff -Naur base/choosers/simple.c elilo/choosers/simple.c
    1.27 +--- base/choosers/simple.c	2005-09-20 19:51:07.000000000 -0700
    1.28 ++++ elilo/choosers/simple.c	2005-09-20 19:28:15.000000000 -0700
    1.29 +@@ -37,6 +37,7 @@
    1.30 + {
    1.31 + 	CHAR16 *desc;
    1.32 + 	CHAR16 initrd_name[CMDLINE_MAXLEN];
    1.33 ++	CHAR16 vmcode_name[CMDLINE_MAXLEN];
    1.34 + 	CHAR16 options_tmp[CMDLINE_MAXLEN];
    1.35 + 	CHAR16 options[CMDLINE_MAXLEN];
    1.36 + 	CHAR16 kname[FILENAME_MAXLEN];
    1.37 +@@ -46,9 +47,9 @@
    1.38 + 		Print(L"desc   : %s\n", desc);
    1.39 + 	}
    1.40 + 
    1.41 +-	initrd_name[0] = options_tmp[0] = kname[0] = CHAR_NULL;
    1.42 ++	initrd_name[0] = vmcode_name[0] = options_tmp[0] = kname[0] = CHAR_NULL;
    1.43 + 
    1.44 +-	if (find_label(name, kname, options_tmp, initrd_name) == -1) {
    1.45 ++	if (find_label(name, kname, options_tmp, initrd_name, vmcode_name) == -1) {
    1.46 + 		StrCpy(kname, name);
    1.47 + 		Print(L"\n");
    1.48 + 	}
    1.49 +@@ -56,6 +57,7 @@
    1.50 + 
    1.51 + 	Print(L"cmdline: %s %s\n", kname, options);
    1.52 + 	if (initrd_name[0]) Print(L"initrd : %s\n", initrd_name);
    1.53 ++	if (vmcode_name[0]) Print(L"vmcode : %s\n", vmcode_name);
    1.54 + }
    1.55 + 
    1.56 + static VOID
    1.57 +@@ -247,6 +249,7 @@
    1.58 + 	CHAR16 buffer[CMDLINE_MAXLEN];
    1.59 + 	CHAR16 alt_buffer[CMDLINE_MAXLEN];
    1.60 + 	CHAR16 initrd_name[CMDLINE_MAXLEN];
    1.61 ++	CHAR16 vmcode_name[CMDLINE_MAXLEN];
    1.62 + 	CHAR16 args[CMDLINE_MAXLEN];
    1.63 + 	CHAR16 devname[CMDLINE_MAXLEN];
    1.64 + 	CHAR16 dpath[FILENAME_MAXLEN];
    1.65 +@@ -259,7 +262,7 @@
    1.66 + 	display_message();
    1.67 + 
    1.68 + restart:
    1.69 +-	initrd_name[0] = kname[0] = cmdline[0] = args[0] = CHAR_NULL;
    1.70 ++	initrd_name[0] = vmcode_name[0] = kname[0] = cmdline[0] = args[0] = CHAR_NULL;
    1.71 + 
    1.72 + 	/* reset per image loader options */
    1.73 + 	Memset(&elilo_opt.img_opt, 0, sizeof(elilo_opt.img_opt));
    1.74 +@@ -303,7 +306,7 @@
    1.75 + 	 * if no match is found, the args and initrd arguments may
    1.76 + 	 * still be modified by global options in the config file.
    1.77 + 	 */
    1.78 +-	ret = find_label((index < argc) ? argv[index] : NULL, kname, args, initrd_name);
    1.79 ++	ret = find_label((index < argc) ? argv[index] : NULL, kname, args, initrd_name, vmcode_name);
    1.80 + 
    1.81 + 	/*
    1.82 + 	 * not found, so assume first argument is kernel name and
    1.83 +@@ -335,6 +338,10 @@
    1.84 + 		StrCpy(elilo_opt.initrd, initrd_name);
    1.85 + 	}
    1.86 + 
    1.87 ++	if (elilo_opt.vmcode[0] == CHAR_NULL && vmcode_name[0] != CHAR_NULL) {
    1.88 ++		StrCpy(elilo_opt.vmcode, vmcode_name);
    1.89 ++	}
    1.90 ++
    1.91 + 	VERB_PRT(1,  { Print(L"kernel     is  '%s'\n", kname);
    1.92 + 		       Print(L"arguments  are '%s'\n", args);
    1.93 + 			if (elilo_opt.initrd[0]) Print(L"initrd      is '%s'\n", elilo_opt.initrd);
    1.94 +diff -Naur base/choosers/textmenu.c elilo/choosers/textmenu.c
    1.95 +--- base/choosers/textmenu.c	2005-09-20 19:51:07.000000000 -0700
    1.96 ++++ elilo/choosers/textmenu.c	2005-09-20 19:28:29.000000000 -0700
    1.97 +@@ -358,6 +358,7 @@
    1.98 + #	define BOOT_IMG_STR	L"BOOT_IMAGE="
    1.99 + 	CHAR16 label[CMDLINE_MAXLEN];
   1.100 + 	CHAR16 initrd_name[CMDLINE_MAXLEN];
   1.101 ++	CHAR16 vmcode_name[CMDLINE_MAXLEN];
   1.102 + 	CHAR16 args[CMDLINE_MAXLEN];
   1.103 + 	CHAR16 devname[CMDLINE_MAXLEN];
   1.104 + 	CHAR16 dpath[FILENAME_MAXLEN];
   1.105 +@@ -412,9 +413,9 @@
   1.106 + 	 * still be modified by global options in the config file.
   1.107 + 	 */
   1.108 + 	if (label[0])
   1.109 +-		ret = find_label(label, kname, args, initrd_name);
   1.110 ++		ret = find_label(label, kname, args, initrd_name, vmcode_name);
   1.111 + 	else
   1.112 +-		ret = find_label(argv[index], kname, args, initrd_name);
   1.113 ++		ret = find_label(argv[index], kname, args, initrd_name, vmcode_name);
   1.114 + 
   1.115 + 	/*
   1.116 + 	 * not found, so assume first argument is kernel name and
   1.117 +@@ -448,6 +449,10 @@
   1.118 + 		StrCpy(elilo_opt.initrd, initrd_name);
   1.119 + 	}
   1.120 + 
   1.121 ++	if (elilo_opt.vmcode[0] == CHAR_NULL && vmcode_name[0] != CHAR_NULL) {
   1.122 ++		StrCpy(elilo_opt.vmcode, vmcode_name);
   1.123 ++	}
   1.124 ++
   1.125 + 	VERB_PRT(1,  { Print(L"kernel     is  '%s'\n", kname);
   1.126 + 		       Print(L"arguments  are '%s'\n", args);
   1.127 + 			if (elilo_opt.initrd[0]) Print(L"initrd      is '%s'\n", elilo_opt.initrd);
   1.128 +diff -Naur base/config.c elilo/config.c
   1.129 +--- base/config.c	2005-09-20 19:51:07.000000000 -0700
   1.130 ++++ elilo/config.c	2005-09-20 19:33:26.000000000 -0700
   1.131 +@@ -68,6 +68,7 @@
   1.132 + 	CHAR16	kname[FILENAME_MAXLEN];
   1.133 + 	CHAR16  options[MAX_STRING];
   1.134 + 	CHAR16	initrd[FILENAME_MAXLEN];
   1.135 ++	CHAR16	vmcode[FILENAME_MAXLEN];
   1.136 + 	CHAR16	root[FILENAME_MAXLEN];
   1.137 + 	CHAR16	fallback[MAX_STRING];
   1.138 + 	CHAR16	description[MAX_STRING];
   1.139 +@@ -93,6 +94,7 @@
   1.140 + typedef struct {
   1.141 + 	CHAR16		root[FILENAME_MAXLEN];	/* globally defined root fs */
   1.142 + 	CHAR16		initrd[FILENAME_MAXLEN];/* globally defined initrd  */
   1.143 ++	CHAR16		vmcode[FILENAME_MAXLEN];/* globally defined boot-time module  */
   1.144 + 	CHAR16		options[MAX_STRING];
   1.145 + 	CHAR16		default_image_name[MAX_STRING];
   1.146 + 	CHAR16		message_file[MAX_MESSAGES][FILENAME_MAXLEN]; 
   1.147 +@@ -144,6 +146,7 @@
   1.148 + {OPT_BOOL,	OPT_GLOBAL,	L"noedd30",	NULL,		NULL,			&global_config.edd30_no_force},
   1.149 + {OPT_CMD,	OPT_GLOBAL,	L"append",	NULL,		NULL,			global_config.options},
   1.150 + {OPT_FILE,	OPT_GLOBAL,	L"initrd",	NULL,		NULL,			global_config.initrd},
   1.151 ++{OPT_FILE,	OPT_GLOBAL,	L"vmm",		NULL,		NULL,			global_config.vmcode},
   1.152 + {OPT_FILE,	OPT_GLOBAL,	L"image",	do_image,	NULL,			opt_offsetof(kname)},
   1.153 + {OPT_BOOL,	OPT_GLOBAL,	L"checkalt",	NULL,		NULL,			&global_config.alt_check},
   1.154 + {OPT_STR,	OPT_GLOBAL,	L"chooser",	NULL,		check_chooser,		global_config.chooser},
   1.155 +@@ -168,6 +171,7 @@
   1.156 +     {OPT_CMD,	OPT_IMAGE,	L"append",	do_options,	NULL,	opt_offsetof(options)},
   1.157 +     {OPT_CMD,	OPT_IMAGE,	L"literal",	do_literal,	NULL,	NULL},
   1.158 +     {OPT_FILE,	OPT_IMAGE,	L"initrd",	NULL,		NULL,	opt_offsetof(initrd)},
   1.159 ++    {OPT_FILE,	OPT_IMAGE,	L"vmm",		NULL,		NULL,	opt_offsetof(vmcode)},
   1.160 +     {OPT_STR,	OPT_IMAGE,	L"label",	NULL,		NULL,	opt_offsetof(label)},
   1.161 +     {OPT_FILE,	OPT_IMAGE,	L"image",	do_image,	NULL,	opt_offsetof(kname)},
   1.162 +     {OPT_STR,	OPT_IMAGE,	L"description",	NULL,		NULL,	opt_offsetof(description)},
   1.163 +@@ -974,7 +978,7 @@
   1.164 + }
   1.165 + 
   1.166 + INTN
   1.167 +-find_label(CHAR16 *label, CHAR16 *kname, CHAR16 *options, CHAR16 *initrd)
   1.168 ++find_label(CHAR16 *label, CHAR16 *kname, CHAR16 *options, CHAR16 *initrd, CHAR16 *vmcode)
   1.169 + {
   1.170 + 	boot_image_t *img;
   1.171 + 
   1.172 +@@ -1007,6 +1011,7 @@
   1.173 + 	if (global_config.readonly) StrCat(options, L" ro");
   1.174 + 
   1.175 + 	if (global_config.initrd[0]) StrCpy(initrd, global_config.initrd);
   1.176 ++	if (global_config.vmcode[0]) StrCpy(vmcode, global_config.vmcode);
   1.177 + 
   1.178 + 	/* make sure we don't get garbage here */
   1.179 + 	elilo_opt.sys_img_opts = NULL;
   1.180 +@@ -1044,12 +1049,17 @@
   1.181 + 	else if (global_config.initrd[0])
   1.182 + 		StrCpy(initrd, global_config.initrd);
   1.183 + 
   1.184 ++	if (img->vmcode[0]) 
   1.185 ++		StrCpy(vmcode, img->vmcode);
   1.186 ++	else if (global_config.vmcode[0])
   1.187 ++		StrCpy(vmcode, global_config.vmcode);
   1.188 ++
   1.189 + 	/*
   1.190 + 	 * point to architecture dependent options for this image
   1.191 + 	 */
   1.192 + 	elilo_opt.sys_img_opts = &img->sys_img_opts;
   1.193 + 
   1.194 +-	DBG_PRT((L"label %s: kname=%s options=%s initrd=%s", img->label, kname, options, initrd));
   1.195 ++	DBG_PRT((L"label %s: kname=%s options=%s initrd=%s vmcode=%s", img->label, kname, options, initrd, vmcode));
   1.196 + 
   1.197 + 	return 0;
   1.198 + }
   1.199 +diff -Naur base/elilo.c elilo/elilo.c
   1.200 +--- base/elilo.c	2005-09-20 19:51:07.000000000 -0700
   1.201 ++++ elilo/elilo.c	2005-09-20 19:33:41.000000000 -0700
   1.202 +@@ -84,10 +84,23 @@
   1.203 + }
   1.204 + 
   1.205 + INTN
   1.206 +-kernel_load(EFI_HANDLE image, CHAR16 *kname, kdesc_t *kd, memdesc_t *imem)
   1.207 ++kernel_load(EFI_HANDLE image, CHAR16 *kname, kdesc_t *kd, memdesc_t *imem, memdesc_t *mmem)
   1.208 + {
   1.209 + 
   1.210 + 	/*
   1.211 ++	 * Do the vm image switch here
   1.212 ++	 * if there is "vmm=" then elilo should load image specified
   1.213 ++	 *    in "vmm=" and then give the "image" to vmm as target kernel image
   1.214 ++	 */
   1.215 ++	if (elilo_opt.vmcode[0]) {
   1.216 ++		CHAR16 buffer[CMDLINE_MAXLEN];
   1.217 ++	VERB_PRT(1,Print(L"swapping vmm=%s with image=%s\n", elilo_opt.vmcode,
   1.218 ++			kname));
   1.219 ++		StrCpy(buffer, kname);
   1.220 ++		StrCpy(kname, elilo_opt.vmcode);
   1.221 ++		StrCpy(elilo_opt.vmcode, buffer);
   1.222 ++	}
   1.223 ++	/*
   1.224 + 	 * Now let's try to load the kernel !
   1.225 + 	 */
   1.226 + 	switch(do_kernel_load(kname, kd)) {
   1.227 +@@ -134,10 +147,32 @@
   1.228 + 				return ELILO_LOAD_RETRY;
   1.229 + 		}
   1.230 + 	}
   1.231 ++
   1.232 ++	if (elilo_opt.vmcode[0]) {
   1.233 ++
   1.234 ++		mmem->start_addr = 0; /* let the allocator decide */
   1.235 ++
   1.236 ++		switch(load_initrd(elilo_opt.vmcode, mmem)) {
   1.237 ++			case ELILO_LOAD_SUCCESS:
   1.238 ++				break;
   1.239 ++			case ELILO_LOAD_ERROR:
   1.240 ++				goto exit_error;
   1.241 ++			case ELILO_LOAD_ABORTED:
   1.242 ++				free_kmem();
   1.243 ++				/* we drop initrd in case we aborted the load */
   1.244 ++				elilo_opt.vmcode[0] = CHAR_NULL;
   1.245 ++				elilo_opt.prompt    = 1; 
   1.246 ++				elilo_opt.timeout   = ELILO_DEFAULT_TIMEOUT;
   1.247 ++				elilo_opt.delay     = 0;
   1.248 ++
   1.249 ++				return ELILO_LOAD_RETRY;
   1.250 ++		}
   1.251 ++	}
   1.252 + 	return ELILO_LOAD_SUCCESS;
   1.253 + exit_error:
   1.254 + 	free_kmem();
   1.255 + 	if (imem->start_addr) free(imem->start_addr);
   1.256 ++	if (mmem->start_addr) free(mmem->start_addr);
   1.257 + 
   1.258 + 	return ELILO_LOAD_ERROR;
   1.259 + }
   1.260 +@@ -152,7 +187,7 @@
   1.261 + 	UINTN cookie;
   1.262 + 	EFI_STATUS status = EFI_SUCCESS;
   1.263 + 	kdesc_t kd;
   1.264 +-	memdesc_t imem;
   1.265 ++	memdesc_t imem, mmem;
   1.266 + 	INTN r;
   1.267 + 
   1.268 + 	/*
   1.269 +@@ -169,7 +204,7 @@
   1.270 + 
   1.271 + 		if (kernel_chooser(argv, argc, index, kname, cmdline_tmp) == -1) goto exit_error;
   1.272 + 
   1.273 +-		switch (kernel_load(image, kname, &kd, &imem)) {
   1.274 ++		switch (kernel_load(image, kname, &kd, &imem, &mmem)) {
   1.275 + 			case ELILO_LOAD_SUCCESS: 
   1.276 + 				goto do_launch;
   1.277 + 			case ELILO_LOAD_ERROR:
   1.278 +@@ -187,7 +222,7 @@
   1.279 + 	close_devices();
   1.280 + 
   1.281 + 	/* No console output permitted after create_boot_params()! */
   1.282 +-	if ((bp=create_boot_params(cmdline, &imem, &cookie)) == 0) goto error;
   1.283 ++	if ((bp=create_boot_params(cmdline, &imem, &mmem, &cookie)) == 0) goto error;
   1.284 + 
   1.285 + 	/* terminate bootservices */
   1.286 + 	status = BS->ExitBootServices(image, cookie);
   1.287 +@@ -221,6 +256,7 @@
   1.288 + 	Print(L"-v        verbose level(can appear multiple times)\n");
   1.289 + 	Print(L"-a        always check for alternate kernel image\n");
   1.290 + 	Print(L"-i file   load file as the initial ramdisk\n");
   1.291 ++	Print(L"-m file   load file as additional boot time vmm module\n");
   1.292 + 	Print(L"-C file   indicate the config file to use\n");
   1.293 + 	Print(L"-P        parse config file only (verify syntax)\n");
   1.294 + 	Print(L"-D        enable debug prints\n");
   1.295 +@@ -491,6 +527,13 @@
   1.296 + 				}
   1.297 + 				StrCpy(elilo_opt.initrd, Optarg);
   1.298 + 				break;
   1.299 ++			case 'm':
   1.300 ++				if (StrLen(Optarg) >= FILENAME_MAXLEN-1) {
   1.301 ++					Print(L"vmm module filename is limited to %d characters\n", FILENAME_MAXLEN);
   1.302 ++					goto do_exit;
   1.303 ++				}
   1.304 ++				StrCpy(elilo_opt.vmcode, Optarg);
   1.305 ++				break;
   1.306 + 			case 'C':
   1.307 + 				if (StrLen(Optarg) >= FILENAME_MAXLEN-1) {
   1.308 + 					Print(L"config filename is limited to %d characters\n", FILENAME_MAXLEN);
   1.309 +diff -Naur base/elilo.h elilo/elilo.h
   1.310 +--- base/elilo.h	2005-09-20 19:51:07.000000000 -0700
   1.311 ++++ elilo/elilo.h	2005-09-20 19:32:19.000000000 -0700
   1.312 +@@ -75,6 +75,7 @@
   1.313 + 	UINTN delay;		/* delay before booting the image */
   1.314 + 	UINTN verbose;		/* verbosity level [1-5] */
   1.315 + 	CHAR16 initrd[FILENAME_MAXLEN];		/* name of file for initial ramdisk */
   1.316 ++	CHAR16 vmcode[FILENAME_MAXLEN];	/* name of file for boot time module*/
   1.317 + 	UINT8 delay_set;	/* mark whether or not delay was specified on cmdline */
   1.318 + 	UINT8 edd30_on;		/* true is EDD30 variable is TRUE */
   1.319 + 	UINT8 edd30_no_force;	/* don't force EDD30 variable to true */
   1.320 +@@ -131,7 +132,7 @@
   1.321 + #endif
   1.322 + 
   1.323 + #define VERB_PRT(n,cmd) \
   1.324 +-	{ if (elilo_opt.verbose >= (n)) { cmd; } }
   1.325 ++  { if (elilo_opt.verbose >= (n)) { cmd; } }
   1.326 + 
   1.327 + 
   1.328 + /* from alloc.c */
   1.329 +@@ -163,7 +164,7 @@
   1.330 + /* from config.c (more in config.h) */
   1.331 + extern EFI_STATUS read_config(CHAR16 *, INTN retry);
   1.332 + extern VOID print_config_options(VOID);
   1.333 +-extern INTN find_label(CHAR16 *, CHAR16 *, CHAR16 *, CHAR16 *);
   1.334 ++extern INTN find_label(CHAR16 *, CHAR16 *, CHAR16 *, CHAR16 *, CHAR16 *);
   1.335 + extern VOID print_label_list(VOID);
   1.336 + extern INTN config_init(VOID);
   1.337 + extern CHAR16 *get_message_filename(INTN which);
   1.338 +@@ -178,7 +179,7 @@
   1.339 + extern INTN alternate_kernel(CHAR16 *, INTN);
   1.340 + 
   1.341 + /* from bootparams.c */
   1.342 +-extern VOID *create_boot_params (CHAR16 *, memdesc_t *, UINTN *);
   1.343 ++extern VOID *create_boot_params (CHAR16 *, memdesc_t *, memdesc_t *, UINTN *);
   1.344 + extern VOID free_boot_params(VOID *bp);
   1.345 + 
   1.346 + /*
   1.347 +@@ -186,7 +187,7 @@
   1.348 +  */
   1.349 + 
   1.350 + 
   1.351 +-extern INTN sysdeps_create_boot_params(boot_params_t *, CHAR8 *, memdesc_t *, UINTN *);
   1.352 ++extern INTN sysdeps_create_boot_params(boot_params_t *, CHAR8 *, memdesc_t *, memdesc_t *, UINTN *);
   1.353 + extern VOID sysdeps_free_boot_params(boot_params_t *);
   1.354 + extern INTN sysdeps_init(EFI_HANDLE dev);
   1.355 + extern INTN sysdeps_initrd_get_addr(kdesc_t *, memdesc_t *);
   1.356 +diff -Naur base/ia32/system.c elilo/ia32/system.c
   1.357 +--- base/ia32/system.c	2005-09-20 19:51:07.000000000 -0700
   1.358 ++++ elilo/ia32/system.c	2005-09-20 19:30:10.000000000 -0700
   1.359 +@@ -408,6 +408,7 @@
   1.360 + 	boot_params_t *bp,
   1.361 + 	CHAR8 *cmdline,
   1.362 + 	memdesc_t *initrd,
   1.363 ++	memdesc_t *vmcode, /* no use for ia32 now*/
   1.364 + 	UINTN *cookie)
   1.365 + {
   1.366 + 	mmap_desc_t mdesc;
   1.367 +diff -Naur base/ia64/sysdeps.h elilo/ia64/sysdeps.h
   1.368 +--- base/ia64/sysdeps.h	2005-09-20 19:51:07.000000000 -0700
   1.369 ++++ elilo/ia64/sysdeps.h	2005-09-20 19:29:07.000000000 -0700
   1.370 +@@ -65,8 +65,11 @@
   1.371 + 	UINTN initrd_start;		/* virtual address where the initial ramdisk begins */
   1.372 + 	UINTN initrd_size;		/* how big is the initial ramdisk */
   1.373 + 
   1.374 ++	UINTN vmcode_start;		/* virtual address where the boot time vmcode begins */
   1.375 ++	UINTN vmcode_size;		/* how big is the boot module */
   1.376 + 	UINTN loader_addr;		/* start address of boot loader */
   1.377 + 	UINTN loader_size;		/* size of loader code & data */
   1.378 ++
   1.379 + } boot_params_t;
   1.380 + 
   1.381 + typedef struct sys_img_options {
   1.382 +diff -Naur base/ia64/system.c elilo/ia64/system.c
   1.383 +--- base/ia64/system.c	2005-09-20 19:51:07.000000000 -0700
   1.384 ++++ elilo/ia64/system.c	2005-09-20 19:29:28.000000000 -0700
   1.385 +@@ -39,7 +39,7 @@
   1.386 +  * IA-64 specific boot paramters initialization routine
   1.387 +  */
   1.388 + INTN
   1.389 +-sysdeps_create_boot_params(boot_params_t *bp, CHAR8 *cmdline, memdesc_t *initrd, UINTN *cookie)
   1.390 ++sysdeps_create_boot_params(boot_params_t *bp, CHAR8 *cmdline, memdesc_t *initrd, memdesc_t *vmcode, UINTN *cookie)
   1.391 + {
   1.392 + 	UINTN cols, rows;
   1.393 + 	SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
   1.394 +@@ -65,6 +65,11 @@
   1.395 + 	bp->command_line	= (UINTN)cmdline;
   1.396 + 	bp->initrd_start	= (UINTN) initrd->start_addr;
   1.397 + 	bp->initrd_size		= initrd->size;
   1.398 ++	DBG_PRT((L"Got initrd @ 0x%lx (%d bytes)", initrd->start_addr, initrd->size));
   1.399 ++
   1.400 ++	bp->vmcode_start	= (UINTN) vmcode->start_addr;
   1.401 ++	bp->vmcode_size		= vmcode->size;
   1.402 ++	DBG_PRT((L"Got vmcode @ 0x%lx (%d bytes)", vmcode->start_addr, vmcode->size));
   1.403 + 
   1.404 + 	/* fetch console parameters: */
   1.405 + 	conout = systab->ConOut;
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/xen/arch/ia64/tools/xelilo/elilo.README	Thu Sep 22 11:34:14 2005 -0600
     2.3 @@ -0,0 +1,35 @@
     2.4 +Elilo update for Xen/ia64 HowTo   9/20/2005
     2.5 +
     2.6 +1. Build the new elilo
     2.7 +	a. Get the elilo RPM
     2.8 +	http://fedora.mirrors.pair.com/linux/core/development/SRPMS/elilo-3.4-11.src.rpm
     2.9 +
    2.10 +	b. Get the elilo-3.4.11.xen.patch
    2.11 +
    2.12 +	c. Create elilo development tree
    2.13 +		> mkdir elilo
    2.14 +		> cd elilo
    2.15 +		> rpm2cpio ../elilo-3.4-11.src.rpm | cpio -div
    2.16 +		> tar xvfz elilo-3.4.tar.gz
    2.17 +		> cd elilo-3.4
    2.18 +		> // read elilo.spc for deatiled patch steps
    2.19 +		> patch -p1 < ../elilo-3.3a-makefile.patch
    2.20 +		> patch -p1 < ../elilo-3.4-debug.patch
    2.21 +		> patch -p2 < ../elilo-initrd-size-fix.patch
    2.22 +		> patch -p1 < ../elilo-argv-fix.patch
    2.23 +		> patch -p1 < ../elilo-kill-warnings.patch
    2.24 +		> patch -p1 < ../../elilo-3.4.11.xen.patch
    2.25 +		> make		<=== get the elilo.efi
    2.26 +
    2.27 +2. How to run with the new elilo.efi?
    2.28 +	a. Example to run
    2.29 +		modify elilo.conf with following entry
    2.30 +
    2.31 +		image=XenoLinux.uncompressed
    2.32 +        		label=xen
    2.33 +        		vmm=xen.gz
    2.34 +        		initrd=initrd-2.6.9-5.7.EL.img
    2.35 +        		read-only
    2.36 +        		append="com2=57600,8n1 console=com2 sched=bvt -- nomca console=ttyS1,576 00 console=tty0 root=/dev/sda3"
    2.37 +
    2.38 +
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/xen/arch/ia64/tools/xelilo/xen4elilo.patch	Thu Sep 22 11:34:14 2005 -0600
     3.3 @@ -0,0 +1,187 @@
     3.4 +<Sign-Off: Fred.Yang@intel.com>
     3.5 +diff -r f2309ac2648a xen/arch/ia64/xen/dom_fw.c
     3.6 +--- a/xen/arch/ia64/xen/dom_fw.c	Tue Sep 20 19:03:25 2005
     3.7 ++++ b/xen/arch/ia64/xen/dom_fw.c	Tue Sep 20 20:10:36 2005
     3.8 +@@ -686,6 +686,12 @@
     3.9 + 	bp->console_info.orig_x = 0;
    3.10 + 	bp->console_info.orig_y = 24;
    3.11 + 	bp->fpswa = 0;
    3.12 ++        bp->initrd_start = (dom0_start+dom0_size) -
    3.13 ++                (PAGE_ALIGN(ia64_boot_param->initrd_size) + 4*1024*1024);
    3.14 ++        bp->initrd_size = ia64_boot_param->initrd_size;
    3.15 ++                printf(" initrd start %0xlx", bp->initrd_start);
    3.16 ++                printf(" initrd size %0xlx", bp->initrd_size);
    3.17 ++
    3.18 + 
    3.19 + 	return bp;
    3.20 + }
    3.21 +diff -r f2309ac2648a xen/arch/ia64/xen/domain.c
    3.22 +--- a/xen/arch/ia64/xen/domain.c	Tue Sep 20 19:03:25 2005
    3.23 ++++ b/xen/arch/ia64/xen/domain.c	Tue Sep 20 20:10:36 2005
    3.24 +@@ -830,6 +830,7 @@
    3.25 + 	unsigned long pkern_start;
    3.26 + 	unsigned long pkern_entry;
    3.27 + 	unsigned long pkern_end;
    3.28 ++	unsigned long pinitrd_start = 0;
    3.29 + 	unsigned long ret, progress = 0;
    3.30 + 
    3.31 + //printf("construct_dom0: starting\n");
    3.32 +@@ -848,12 +849,6 @@
    3.33 + 	alloc_start = dom0_start;
    3.34 + 	alloc_end = dom0_start + dom0_size;
    3.35 + 	d->tot_pages = d->max_pages = dom0_size/PAGE_SIZE;
    3.36 +-	image_start = __va(ia64_boot_param->initrd_start);
    3.37 +-	image_len = ia64_boot_param->initrd_size;
    3.38 +-//printk("image_start=%lx, image_len=%lx\n",image_start,image_len);
    3.39 +-//printk("First word of image: %lx\n",*(unsigned long *)image_start);
    3.40 +-
    3.41 +-//printf("construct_dom0: about to call parseelfimage\n");
    3.42 + 	dsi.image_addr = (unsigned long)image_start;
    3.43 + 	dsi.image_len  = image_len;
    3.44 + 	rc = parseelfimage(&dsi);
    3.45 +@@ -890,11 +885,18 @@
    3.46 + 	    return -EINVAL;
    3.47 + 	}
    3.48 + 
    3.49 ++        if(initrd_start&&initrd_len){
    3.50 ++             pinitrd_start=(dom0_start+dom0_size) -
    3.51 ++                          (PAGE_ALIGN(initrd_len) + 4*1024*1024);
    3.52 ++
    3.53 ++             memcpy(__va(pinitrd_start),initrd_start,initrd_len);
    3.54 ++        }
    3.55 ++
    3.56 + 	printk("METAPHYSICAL MEMORY ARRANGEMENT:\n"
    3.57 + 	       " Kernel image:  %lx->%lx\n"
    3.58 + 	       " Entry address: %lx\n"
    3.59 +-	       " Init. ramdisk:   (NOT IMPLEMENTED YET)\n",
    3.60 +-	       pkern_start, pkern_end, pkern_entry);
    3.61 ++               " Init. ramdisk: %lx len %lx\n",
    3.62 ++               pkern_start, pkern_end, pkern_entry, pinitrd_start, initrd_len);
    3.63 + 
    3.64 + 	if ( (pkern_end - pkern_start) > (d->max_pages * PAGE_SIZE) )
    3.65 + 	{
    3.66 +diff -r f2309ac2648a xen/arch/ia64/xen/xensetup.c
    3.67 +--- a/xen/arch/ia64/xen/xensetup.c	Tue Sep 20 19:03:25 2005
    3.68 ++++ b/xen/arch/ia64/xen/xensetup.c	Tue Sep 20 20:10:36 2005
    3.69 +@@ -153,7 +153,8 @@
    3.70 +     void *heap_start;
    3.71 +     int i;
    3.72 +     unsigned long max_mem, nr_pages, firsthole_start;
    3.73 +-    unsigned long dom0_memory_start, dom0_memory_end;
    3.74 ++    unsigned long dom0_memory_start, dom0_memory_size;
    3.75 ++    unsigned long dom0_initrd_start, dom0_initrd_size;
    3.76 +     unsigned long initial_images_start, initial_images_end;
    3.77 + 
    3.78 +     running_on_sim = is_platform_hp_ski();
    3.79 +@@ -191,7 +192,18 @@
    3.80 +     efi_memmap_walk(xen_find_first_hole, &firsthole_start);
    3.81 + 
    3.82 +     initial_images_start = xenheap_phys_end;
    3.83 +-    initial_images_end = initial_images_start + ia64_boot_param->initrd_size;
    3.84 ++    initial_images_end = initial_images_start +
    3.85 ++       PAGE_ALIGN(ia64_boot_param->domain_size);
    3.86 ++
    3.87 ++    /* also reserve space for initrd */
    3.88 ++    if (ia64_boot_param->initrd_start && ia64_boot_param->initrd_size)
    3.89 ++       initial_images_end += PAGE_ALIGN(ia64_boot_param->initrd_size);
    3.90 ++    else {
    3.91 ++       /* sanity cleanup */
    3.92 ++       ia64_boot_param->initrd_size = 0;
    3.93 ++       ia64_boot_param->initrd_start = 0;
    3.94 ++    }
    3.95 ++
    3.96 + 
    3.97 +     /* Later may find another memory trunk, even away from xen image... */
    3.98 +     if (initial_images_end > firsthole_start) {
    3.99 +@@ -203,11 +215,21 @@
   3.100 + 
   3.101 +     /* This copy is time consuming, but elilo may load Dom0 image
   3.102 +      * within xenheap range */
   3.103 +-    printk("ready to move Dom0 to 0x%lx...", initial_images_start);
   3.104 ++    printk("ready to move Dom0 to 0x%lx with len %lx...", initial_images_start,
   3.105 ++          ia64_boot_param->domain_size);
   3.106 ++
   3.107 +     memmove(__va(initial_images_start),
   3.108 ++          __va(ia64_boot_param->domain_start),
   3.109 ++          ia64_boot_param->domain_size);
   3.110 ++//    ia64_boot_param->domain_start = initial_images_start;
   3.111 ++
   3.112 ++    printk("ready to move initrd to 0x%lx with len %lx...",
   3.113 ++          initial_images_start+PAGE_ALIGN(ia64_boot_param->domain_size),
   3.114 ++          ia64_boot_param->initrd_size);
   3.115 ++    memmove(__va(initial_images_start+PAGE_ALIGN(ia64_boot_param->domain_size)),
   3.116 ++
   3.117 + 	   __va(ia64_boot_param->initrd_start),
   3.118 + 	   ia64_boot_param->initrd_size);
   3.119 +-    ia64_boot_param->initrd_start = initial_images_start;
   3.120 +     printk("Done\n");
   3.121 + 
   3.122 +     /* first find highest page frame number */
   3.123 +@@ -335,23 +357,26 @@
   3.124 +      * above our heap. The second module, if present, is an initrd ramdisk.
   3.125 +      */
   3.126 + printk("About to call construct_dom0()\n");
   3.127 +-    dom0_memory_start = __va(ia64_boot_param->initrd_start);
   3.128 +-    dom0_memory_end = ia64_boot_param->initrd_size;
   3.129 +-    if ( construct_dom0(dom0, dom0_memory_start, dom0_memory_end,
   3.130 +-			0,
   3.131 +-                        0,
   3.132 ++    dom0_memory_start = __va(initial_images_start);
   3.133 ++    dom0_memory_size = ia64_boot_param->domain_size;
   3.134 ++    dom0_initrd_start = __va(initial_images_start +
   3.135 ++                       PAGE_ALIGN(ia64_boot_param->domain_size));
   3.136 ++    dom0_initrd_size = ia64_boot_param->initrd_size;
   3.137 ++
   3.138 ++    if ( construct_dom0(dom0, dom0_memory_start, dom0_memory_size,
   3.139 ++                       dom0_initrd_start,dom0_initrd_size,
   3.140 + 			0) != 0)
   3.141 +         panic("Could not set up DOM0 guest OS\n");
   3.142 + #ifdef CLONE_DOMAIN0
   3.143 +     {
   3.144 +     int i;
   3.145 +-    dom0_memory_start = __va(ia64_boot_param->initrd_start);
   3.146 +-    dom0_memory_end = ia64_boot_param->initrd_size;
   3.147 ++    dom0_memory_start = __va(ia64_boot_param->domain_start);
   3.148 ++    dom0_memory_size = ia64_boot_param->domain_size;
   3.149 ++
   3.150 +     for (i = 0; i < CLONE_DOMAIN0; i++) {
   3.151 + printk("CONSTRUCTING DOMAIN0 CLONE #%d\n",i+1);
   3.152 +-        if ( construct_domU(clones[i], dom0_memory_start, dom0_memory_end,
   3.153 +-                        0, 
   3.154 +-                        0,
   3.155 ++        if ( construct_domU(clones[i], dom0_memory_start, dom0_memory_size,
   3.156 ++                       dom0_initrd_start,dom0_initrd_size,
   3.157 + 			0) != 0)
   3.158 +             panic("Could not set up DOM0 clone %d\n",i);
   3.159 +     }
   3.160 +@@ -359,8 +384,14 @@
   3.161 + #endif
   3.162 + 
   3.163 +     /* The stash space for the initial kernel image can now be freed up. */
   3.164 +-    init_domheap_pages(ia64_boot_param->initrd_start,
   3.165 +-		       ia64_boot_param->initrd_start + ia64_boot_param->initrd_size);
   3.166 ++    init_domheap_pages(ia64_boot_param->domain_start,
   3.167 ++                       ia64_boot_param->domain_size);
   3.168 ++    /* throw away initrd area passed from elilo */
   3.169 ++    if (ia64_boot_param->initrd_size) {
   3.170 ++        init_domheap_pages(ia64_boot_param->initrd_start,
   3.171 ++                          ia64_boot_param->initrd_size);
   3.172 ++    }
   3.173 ++
   3.174 +     if (!running_on_sim)  // slow on ski and pages are pre-initialized to zero
   3.175 + 	scrub_heap_pages();
   3.176 + 
   3.177 +diff -r f2309ac2648a xen/include/asm-ia64/linux-xen/asm/system.h
   3.178 +--- a/xen/include/asm-ia64/linux-xen/asm/system.h	Tue Sep 20 19:03:25 2005
   3.179 ++++ b/xen/include/asm-ia64/linux-xen/asm/system.h	Tue Sep 20 20:10:36 2005
   3.180 +@@ -56,6 +56,10 @@
   3.181 + 	__u64 fpswa;		/* physical address of the fpswa interface */
   3.182 + 	__u64 initrd_start;
   3.183 + 	__u64 initrd_size;
   3.184 ++//for loading initrd for dom0
   3.185 ++       __u64 domain_start;     /* virtual address where the boot time domain begins */
   3.186 ++       __u64 domain_size;      /* how big is the boot domain */
   3.187 ++
   3.188 + } *ia64_boot_param;
   3.189 + 
   3.190 + /*
     4.1 Binary file xen/arch/ia64/tools/xelilo/xlilo.efi has changed