# HG changeset patch
# User djm@xxxxxxxxxxxxxxx
# Node ID 97dbd9524a7e918f2ffb2d5155a7e32c48f7f355
# Parent babbdd896024460e365332c0656706283a26f75a
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.
diff -r babbdd896024 -r 97dbd9524a7e
xen/arch/ia64/tools/xelilo/elilo-3.4.11.xen.patch
--- /dev/null Thu Sep 22 12:59:57 2005
+++ b/xen/arch/ia64/tools/xelilo/elilo-3.4.11.xen.patch Thu Sep 22 17:34:14 2005
@@ -0,0 +1,402 @@
+<Sign-off: fred.yang@xxxxxxxxx>
+diff -Naur base/bootparams.c elilo/bootparams.c
+--- base/bootparams.c 2005-09-20 19:51:07.000000000 -0700
++++ elilo/bootparams.c 2005-09-20 19:33:00.000000000 -0700
+@@ -38,7 +38,7 @@
+ * bp : the address of the bootparams otherwise (opaque type)
+ */
+ VOID *
+-create_boot_params(CHAR16 *args, memdesc_t *initrd, UINTN *cookie)
++create_boot_params(CHAR16 *args, memdesc_t *initrd, memdesc_t *vmcode, UINTN
*cookie)
+ {
+ /*
+ * XXX: need cleanup
+@@ -95,7 +95,7 @@
+ */
+ Memset(bp, 0, BOOT_PARAM_MEMSIZE);
+
+- if (sysdeps_create_boot_params(bp, cp, initrd, cookie) == -1) return 0;
++ if (sysdeps_create_boot_params(bp, cp, initrd, vmcode, cookie) == -1)
return 0;
+
+ /*
+ * Convert kernel command line args from UNICODE to ASCII and put them
where
+diff -Naur base/choosers/simple.c elilo/choosers/simple.c
+--- base/choosers/simple.c 2005-09-20 19:51:07.000000000 -0700
++++ elilo/choosers/simple.c 2005-09-20 19:28:15.000000000 -0700
+@@ -37,6 +37,7 @@
+ {
+ CHAR16 *desc;
+ CHAR16 initrd_name[CMDLINE_MAXLEN];
++ CHAR16 vmcode_name[CMDLINE_MAXLEN];
+ CHAR16 options_tmp[CMDLINE_MAXLEN];
+ CHAR16 options[CMDLINE_MAXLEN];
+ CHAR16 kname[FILENAME_MAXLEN];
+@@ -46,9 +47,9 @@
+ Print(L"desc : %s\n", desc);
+ }
+
+- initrd_name[0] = options_tmp[0] = kname[0] = CHAR_NULL;
++ initrd_name[0] = vmcode_name[0] = options_tmp[0] = kname[0] = CHAR_NULL;
+
+- if (find_label(name, kname, options_tmp, initrd_name) == -1) {
++ if (find_label(name, kname, options_tmp, initrd_name, vmcode_name) ==
-1) {
+ StrCpy(kname, name);
+ Print(L"\n");
+ }
+@@ -56,6 +57,7 @@
+
+ Print(L"cmdline: %s %s\n", kname, options);
+ if (initrd_name[0]) Print(L"initrd : %s\n", initrd_name);
++ if (vmcode_name[0]) Print(L"vmcode : %s\n", vmcode_name);
+ }
+
+ static VOID
+@@ -247,6 +249,7 @@
+ CHAR16 buffer[CMDLINE_MAXLEN];
+ CHAR16 alt_buffer[CMDLINE_MAXLEN];
+ CHAR16 initrd_name[CMDLINE_MAXLEN];
++ CHAR16 vmcode_name[CMDLINE_MAXLEN];
+ CHAR16 args[CMDLINE_MAXLEN];
+ CHAR16 devname[CMDLINE_MAXLEN];
+ CHAR16 dpath[FILENAME_MAXLEN];
+@@ -259,7 +262,7 @@
+ display_message();
+
+ restart:
+- initrd_name[0] = kname[0] = cmdline[0] = args[0] = CHAR_NULL;
++ initrd_name[0] = vmcode_name[0] = kname[0] = cmdline[0] = args[0] =
CHAR_NULL;
+
+ /* reset per image loader options */
+ Memset(&elilo_opt.img_opt, 0, sizeof(elilo_opt.img_opt));
+@@ -303,7 +306,7 @@
+ * if no match is found, the args and initrd arguments may
+ * still be modified by global options in the config file.
+ */
+- ret = find_label((index < argc) ? argv[index] : NULL, kname, args,
initrd_name);
++ ret = find_label((index < argc) ? argv[index] : NULL, kname, args,
initrd_name, vmcode_name);
+
+ /*
+ * not found, so assume first argument is kernel name and
+@@ -335,6 +338,10 @@
+ StrCpy(elilo_opt.initrd, initrd_name);
+ }
+
++ if (elilo_opt.vmcode[0] == CHAR_NULL && vmcode_name[0] != CHAR_NULL) {
++ StrCpy(elilo_opt.vmcode, vmcode_name);
++ }
++
+ VERB_PRT(1, { Print(L"kernel is '%s'\n", kname);
+ Print(L"arguments are '%s'\n", args);
+ if (elilo_opt.initrd[0]) Print(L"initrd is
'%s'\n", elilo_opt.initrd);
+diff -Naur base/choosers/textmenu.c elilo/choosers/textmenu.c
+--- base/choosers/textmenu.c 2005-09-20 19:51:07.000000000 -0700
++++ elilo/choosers/textmenu.c 2005-09-20 19:28:29.000000000 -0700
+@@ -358,6 +358,7 @@
+ # define BOOT_IMG_STR L"BOOT_IMAGE="
+ CHAR16 label[CMDLINE_MAXLEN];
+ CHAR16 initrd_name[CMDLINE_MAXLEN];
++ CHAR16 vmcode_name[CMDLINE_MAXLEN];
+ CHAR16 args[CMDLINE_MAXLEN];
+ CHAR16 devname[CMDLINE_MAXLEN];
+ CHAR16 dpath[FILENAME_MAXLEN];
+@@ -412,9 +413,9 @@
+ * still be modified by global options in the config file.
+ */
+ if (label[0])
+- ret = find_label(label, kname, args, initrd_name);
++ ret = find_label(label, kname, args, initrd_name, vmcode_name);
+ else
+- ret = find_label(argv[index], kname, args, initrd_name);
++ ret = find_label(argv[index], kname, args, initrd_name,
vmcode_name);
+
+ /*
+ * not found, so assume first argument is kernel name and
+@@ -448,6 +449,10 @@
+ StrCpy(elilo_opt.initrd, initrd_name);
+ }
+
++ if (elilo_opt.vmcode[0] == CHAR_NULL && vmcode_name[0] != CHAR_NULL) {
++ StrCpy(elilo_opt.vmcode, vmcode_name);
++ }
++
+ VERB_PRT(1, { Print(L"kernel is '%s'\n", kname);
+ Print(L"arguments are '%s'\n", args);
+ if (elilo_opt.initrd[0]) Print(L"initrd is
'%s'\n", elilo_opt.initrd);
+diff -Naur base/config.c elilo/config.c
+--- base/config.c 2005-09-20 19:51:07.000000000 -0700
++++ elilo/config.c 2005-09-20 19:33:26.000000000 -0700
+@@ -68,6 +68,7 @@
+ CHAR16 kname[FILENAME_MAXLEN];
+ CHAR16 options[MAX_STRING];
+ CHAR16 initrd[FILENAME_MAXLEN];
++ CHAR16 vmcode[FILENAME_MAXLEN];
+ CHAR16 root[FILENAME_MAXLEN];
+ CHAR16 fallback[MAX_STRING];
+ CHAR16 description[MAX_STRING];
+@@ -93,6 +94,7 @@
+ typedef struct {
+ CHAR16 root[FILENAME_MAXLEN]; /* globally defined root fs */
+ CHAR16 initrd[FILENAME_MAXLEN];/* globally defined initrd */
++ CHAR16 vmcode[FILENAME_MAXLEN];/* globally defined boot-time
module */
+ CHAR16 options[MAX_STRING];
+ CHAR16 default_image_name[MAX_STRING];
+ CHAR16 message_file[MAX_MESSAGES][FILENAME_MAXLEN];
+@@ -144,6 +146,7 @@
+ {OPT_BOOL, OPT_GLOBAL, L"noedd30", NULL, NULL,
&global_config.edd30_no_force},
+ {OPT_CMD, OPT_GLOBAL, L"append", NULL, NULL,
global_config.options},
+ {OPT_FILE, OPT_GLOBAL, L"initrd", NULL, NULL,
global_config.initrd},
++{OPT_FILE, OPT_GLOBAL, L"vmm", NULL, NULL,
global_config.vmcode},
+ {OPT_FILE, OPT_GLOBAL, L"image", do_image, NULL,
opt_offsetof(kname)},
+ {OPT_BOOL, OPT_GLOBAL, L"checkalt", NULL, NULL,
&global_config.alt_check},
+ {OPT_STR, OPT_GLOBAL, L"chooser", NULL, check_chooser,
global_config.chooser},
+@@ -168,6 +171,7 @@
+ {OPT_CMD, OPT_IMAGE, L"append", do_options, NULL,
opt_offsetof(options)},
+ {OPT_CMD, OPT_IMAGE, L"literal", do_literal, NULL, NULL},
+ {OPT_FILE, OPT_IMAGE, L"initrd", NULL, NULL,
opt_offsetof(initrd)},
++ {OPT_FILE, OPT_IMAGE, L"vmm", NULL, NULL,
opt_offsetof(vmcode)},
+ {OPT_STR, OPT_IMAGE, L"label", NULL, NULL,
opt_offsetof(label)},
+ {OPT_FILE, OPT_IMAGE, L"image", do_image, NULL,
opt_offsetof(kname)},
+ {OPT_STR, OPT_IMAGE, L"description", NULL, NULL,
opt_offsetof(description)},
+@@ -974,7 +978,7 @@
+ }
+
+ INTN
+-find_label(CHAR16 *label, CHAR16 *kname, CHAR16 *options, CHAR16 *initrd)
++find_label(CHAR16 *label, CHAR16 *kname, CHAR16 *options, CHAR16 *initrd,
CHAR16 *vmcode)
+ {
+ boot_image_t *img;
+
+@@ -1007,6 +1011,7 @@
+ if (global_config.readonly) StrCat(options, L" ro");
+
+ if (global_config.initrd[0]) StrCpy(initrd, global_config.initrd);
++ if (global_config.vmcode[0]) StrCpy(vmcode, global_config.vmcode);
+
+ /* make sure we don't get garbage here */
+ elilo_opt.sys_img_opts = NULL;
+@@ -1044,12 +1049,17 @@
+ else if (global_config.initrd[0])
+ StrCpy(initrd, global_config.initrd);
+
++ if (img->vmcode[0])
++ StrCpy(vmcode, img->vmcode);
++ else if (global_config.vmcode[0])
++ StrCpy(vmcode, global_config.vmcode);
++
+ /*
+ * point to architecture dependent options for this image
+ */
+ elilo_opt.sys_img_opts = &img->sys_img_opts;
+
+- DBG_PRT((L"label %s: kname=%s options=%s initrd=%s", img->label, kname,
options, initrd));
++ DBG_PRT((L"label %s: kname=%s options=%s initrd=%s vmcode=%s",
img->label, kname, options, initrd, vmcode));
+
+ return 0;
+ }
+diff -Naur base/elilo.c elilo/elilo.c
+--- base/elilo.c 2005-09-20 19:51:07.000000000 -0700
++++ elilo/elilo.c 2005-09-20 19:33:41.000000000 -0700
+@@ -84,10 +84,23 @@
+ }
+
+ INTN
+-kernel_load(EFI_HANDLE image, CHAR16 *kname, kdesc_t *kd, memdesc_t *imem)
++kernel_load(EFI_HANDLE image, CHAR16 *kname, kdesc_t *kd, memdesc_t *imem,
memdesc_t *mmem)
+ {
+
+ /*
++ * Do the vm image switch here
++ * if there is "vmm=" then elilo should load image specified
++ * in "vmm=" and then give the "image" to vmm as target kernel image
++ */
++ if (elilo_opt.vmcode[0]) {
++ CHAR16 buffer[CMDLINE_MAXLEN];
++ VERB_PRT(1,Print(L"swapping vmm=%s with image=%s\n", elilo_opt.vmcode,
++ kname));
++ StrCpy(buffer, kname);
++ StrCpy(kname, elilo_opt.vmcode);
++ StrCpy(elilo_opt.vmcode, buffer);
++ }
++ /*
+ * Now let's try to load the kernel !
+ */
+ switch(do_kernel_load(kname, kd)) {
+@@ -134,10 +147,32 @@
+ return ELILO_LOAD_RETRY;
+ }
+ }
++
++ if (elilo_opt.vmcode[0]) {
++
++ mmem->start_addr = 0; /* let the allocator decide */
++
++ switch(load_initrd(elilo_opt.vmcode, mmem)) {
++ case ELILO_LOAD_SUCCESS:
++ break;
++ case ELILO_LOAD_ERROR:
++ goto exit_error;
++ case ELILO_LOAD_ABORTED:
++ free_kmem();
++ /* we drop initrd in case we aborted the load */
++ elilo_opt.vmcode[0] = CHAR_NULL;
++ elilo_opt.prompt = 1;
++ elilo_opt.timeout = ELILO_DEFAULT_TIMEOUT;
++ elilo_opt.delay = 0;
++
++ return ELILO_LOAD_RETRY;
++ }
++ }
+ return ELILO_LOAD_SUCCESS;
+ exit_error:
+ free_kmem();
+ if (imem->start_addr) free(imem->start_addr);
++ if (mmem->start_addr) free(mmem->start_addr);
+
+ return ELILO_LOAD_ERROR;
+ }
+@@ -152,7 +187,7 @@
+ UINTN cookie;
+ EFI_STATUS status = EFI_SUCCESS;
+ kdesc_t kd;
+- memdesc_t imem;
++ memdesc_t imem, mmem;
+ INTN r;
+
+ /*
+@@ -169,7 +204,7 @@
+
+ if (kernel_chooser(argv, argc, index, kname, cmdline_tmp) ==
-1) goto exit_error;
+
+- switch (kernel_load(image, kname, &kd, &imem)) {
++ switch (kernel_load(image, kname, &kd, &imem, &mmem)) {
+ case ELILO_LOAD_SUCCESS:
+ goto do_launch;
+ case ELILO_LOAD_ERROR:
+@@ -187,7 +222,7 @@
+ close_devices();
+
+ /* No console output permitted after create_boot_params()! */
+- if ((bp=create_boot_params(cmdline, &imem, &cookie)) == 0) goto error;
++ if ((bp=create_boot_params(cmdline, &imem, &mmem, &cookie)) == 0) goto
error;
+
+ /* terminate bootservices */
+ status = BS->ExitBootServices(image, cookie);
+@@ -221,6 +256,7 @@
+ Print(L"-v verbose level(can appear multiple times)\n");
+ Print(L"-a always check for alternate kernel image\n");
+ Print(L"-i file load file as the initial ramdisk\n");
++ Print(L"-m file load file as additional boot time vmm module\n");
+ Print(L"-C file indicate the config file to use\n");
+ Print(L"-P parse config file only (verify syntax)\n");
+ Print(L"-D enable debug prints\n");
+@@ -491,6 +527,13 @@
+ }
+ StrCpy(elilo_opt.initrd, Optarg);
+ break;
++ case 'm':
++ if (StrLen(Optarg) >= FILENAME_MAXLEN-1) {
++ Print(L"vmm module filename is limited
to %d characters\n", FILENAME_MAXLEN);
++ goto do_exit;
++ }
++ StrCpy(elilo_opt.vmcode, Optarg);
++ break;
+ case 'C':
+ if (StrLen(Optarg) >= FILENAME_MAXLEN-1) {
+ Print(L"config filename is limited to
%d characters\n", FILENAME_MAXLEN);
+diff -Naur base/elilo.h elilo/elilo.h
+--- base/elilo.h 2005-09-20 19:51:07.000000000 -0700
++++ elilo/elilo.h 2005-09-20 19:32:19.000000000 -0700
+@@ -75,6 +75,7 @@
+ UINTN delay; /* delay before booting the image */
+ UINTN verbose; /* verbosity level [1-5] */
+ CHAR16 initrd[FILENAME_MAXLEN]; /* name of file for initial
ramdisk */
++ CHAR16 vmcode[FILENAME_MAXLEN]; /* name of file for boot time module*/
+ UINT8 delay_set; /* mark whether or not delay was specified on
cmdline */
+ UINT8 edd30_on; /* true is EDD30 variable is TRUE */
+ UINT8 edd30_no_force; /* don't force EDD30 variable to true */
+@@ -131,7 +132,7 @@
+ #endif
+
+ #define VERB_PRT(n,cmd) \
+- { if (elilo_opt.verbose >= (n)) { cmd; } }
++ { if (elilo_opt.verbose >= (n)) { cmd; } }
+
+
+ /* from alloc.c */
+@@ -163,7 +164,7 @@
+ /* from config.c (more in config.h) */
+ extern EFI_STATUS read_config(CHAR16 *, INTN retry);
+ extern VOID print_config_options(VOID);
+-extern INTN find_label(CHAR16 *, CHAR16 *, CHAR16 *, CHAR16 *);
++extern INTN find_label(CHAR16 *, CHAR16 *, CHAR16 *, CHAR16 *, CHAR16 *);
+ extern VOID print_label_list(VOID);
+ extern INTN config_init(VOID);
+ extern CHAR16 *get_message_filename(INTN which);
+@@ -178,7 +179,7 @@
+ extern INTN alternate_kernel(CHAR16 *, INTN);
+
+ /* from bootparams.c */
+-extern VOID *create_boot_params (CHAR16 *, memdesc_t *, UINTN *);
++extern VOID *create_boot_params (CHAR16 *, memdesc_t *, memdesc_t *, UINTN *);
+ extern VOID free_boot_params(VOID *bp);
+
+ /*
+@@ -186,7 +187,7 @@
+ */
+
+
+-extern INTN sysdeps_create_boot_params(boot_params_t *, CHAR8 *, memdesc_t *,
UINTN *);
++extern INTN sysdeps_create_boot_params(boot_params_t *, CHAR8 *, memdesc_t *,
memdesc_t *, UINTN *);
+ extern VOID sysdeps_free_boot_params(boot_params_t *);
+ extern INTN sysdeps_init(EFI_HANDLE dev);
+ extern INTN sysdeps_initrd_get_addr(kdesc_t *, memdesc_t *);
+diff -Naur base/ia32/system.c elilo/ia32/system.c
+--- base/ia32/system.c 2005-09-20 19:51:07.000000000 -0700
++++ elilo/ia32/system.c 2005-09-20 19:30:10.000000000 -0700
+@@ -408,6 +408,7 @@
+ boot_params_t *bp,
+ CHAR8 *cmdline,
+ memdesc_t *initrd,
++ memdesc_t *vmcode, /* no use for ia32 now*/
+ UINTN *cookie)
+ {
+ mmap_desc_t mdesc;
+diff -Naur base/ia64/sysdeps.h elilo/ia64/sysdeps.h
+--- base/ia64/sysdeps.h 2005-09-20 19:51:07.000000000 -0700
++++ elilo/ia64/sysdeps.h 2005-09-20 19:29:07.000000000 -0700
+@@ -65,8 +65,11 @@
+ UINTN initrd_start; /* virtual address where the initial
ramdisk begins */
+ UINTN initrd_size; /* how big is the initial ramdisk */
+
++ UINTN vmcode_start; /* virtual address where the boot time
vmcode begins */
++ UINTN vmcode_size; /* how big is the boot module */
+ UINTN loader_addr; /* start address of boot loader */
+ UINTN loader_size; /* size of loader code & data */
++
+ } boot_params_t;
+
+ typedef struct sys_img_options {
+diff -Naur base/ia64/system.c elilo/ia64/system.c
+--- base/ia64/system.c 2005-09-20 19:51:07.000000000 -0700
++++ elilo/ia64/system.c 2005-09-20 19:29:28.000000000 -0700
+@@ -39,7 +39,7 @@
+ * IA-64 specific boot paramters initialization routine
+ */
+ INTN
+-sysdeps_create_boot_params(boot_params_t *bp, CHAR8 *cmdline, memdesc_t
*initrd, UINTN *cookie)
++sysdeps_create_boot_params(boot_params_t *bp, CHAR8 *cmdline, memdesc_t
*initrd, memdesc_t *vmcode, UINTN *cookie)
+ {
+ UINTN cols, rows;
+ SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
+@@ -65,6 +65,11 @@
+ bp->command_line = (UINTN)cmdline;
+ bp->initrd_start = (UINTN) initrd->start_addr;
+ bp->initrd_size = initrd->size;
++ DBG_PRT((L"Got initrd @ 0x%lx (%d bytes)", initrd->start_addr,
initrd->size));
++
++ bp->vmcode_start = (UINTN) vmcode->start_addr;
++ bp->vmcode_size = vmcode->size;
++ DBG_PRT((L"Got vmcode @ 0x%lx (%d bytes)", vmcode->start_addr,
vmcode->size));
+
+ /* fetch console parameters: */
+ conout = systab->ConOut;
diff -r babbdd896024 -r 97dbd9524a7e xen/arch/ia64/tools/xelilo/elilo.README
--- /dev/null Thu Sep 22 12:59:57 2005
+++ b/xen/arch/ia64/tools/xelilo/elilo.README Thu Sep 22 17:34:14 2005
@@ -0,0 +1,35 @@
+Elilo update for Xen/ia64 HowTo 9/20/2005
+
+1. Build the new elilo
+ a. Get the elilo RPM
+
http://fedora.mirrors.pair.com/linux/core/development/SRPMS/elilo-3.4-11.src.rpm
+
+ b. Get the elilo-3.4.11.xen.patch
+
+ c. Create elilo development tree
+ > mkdir elilo
+ > cd elilo
+ > rpm2cpio ../elilo-3.4-11.src.rpm | cpio -div
+ > tar xvfz elilo-3.4.tar.gz
+ > cd elilo-3.4
+ > // read elilo.spc for deatiled patch steps
+ > patch -p1 < ../elilo-3.3a-makefile.patch
+ > patch -p1 < ../elilo-3.4-debug.patch
+ > patch -p2 < ../elilo-initrd-size-fix.patch
+ > patch -p1 < ../elilo-argv-fix.patch
+ > patch -p1 < ../elilo-kill-warnings.patch
+ > patch -p1 < ../../elilo-3.4.11.xen.patch
+ > make <=== get the elilo.efi
+
+2. How to run with the new elilo.efi?
+ a. Example to run
+ modify elilo.conf with following entry
+
+ image=XenoLinux.uncompressed
+ label=xen
+ vmm=xen.gz
+ initrd=initrd-2.6.9-5.7.EL.img
+ read-only
+ append="com2=57600,8n1 console=com2 sched=bvt -- nomca
console=ttyS1,576 00 console=tty0 root=/dev/sda3"
+
+
diff -r babbdd896024 -r 97dbd9524a7e xen/arch/ia64/tools/xelilo/xen4elilo.patch
--- /dev/null Thu Sep 22 12:59:57 2005
+++ b/xen/arch/ia64/tools/xelilo/xen4elilo.patch Thu Sep 22 17:34:14 2005
@@ -0,0 +1,187 @@
+<Sign-Off: Fred.Yang@xxxxxxxxx>
+diff -r f2309ac2648a xen/arch/ia64/xen/dom_fw.c
+--- a/xen/arch/ia64/xen/dom_fw.c Tue Sep 20 19:03:25 2005
++++ b/xen/arch/ia64/xen/dom_fw.c Tue Sep 20 20:10:36 2005
+@@ -686,6 +686,12 @@
+ bp->console_info.orig_x = 0;
+ bp->console_info.orig_y = 24;
+ bp->fpswa = 0;
++ bp->initrd_start = (dom0_start+dom0_size) -
++ (PAGE_ALIGN(ia64_boot_param->initrd_size) + 4*1024*1024);
++ bp->initrd_size = ia64_boot_param->initrd_size;
++ printf(" initrd start %0xlx", bp->initrd_start);
++ printf(" initrd size %0xlx", bp->initrd_size);
++
+
+ return bp;
+ }
+diff -r f2309ac2648a xen/arch/ia64/xen/domain.c
+--- a/xen/arch/ia64/xen/domain.c Tue Sep 20 19:03:25 2005
++++ b/xen/arch/ia64/xen/domain.c Tue Sep 20 20:10:36 2005
+@@ -830,6 +830,7 @@
+ unsigned long pkern_start;
+ unsigned long pkern_entry;
+ unsigned long pkern_end;
++ unsigned long pinitrd_start = 0;
+ unsigned long ret, progress = 0;
+
+ //printf("construct_dom0: starting\n");
+@@ -848,12 +849,6 @@
+ alloc_start = dom0_start;
+ alloc_end = dom0_start + dom0_size;
+ d->tot_pages = d->max_pages = dom0_size/PAGE_SIZE;
+- image_start = __va(ia64_boot_param->initrd_start);
+- image_len = ia64_boot_param->initrd_size;
+-//printk("image_start=%lx, image_len=%lx\n",image_start,image_len);
+-//printk("First word of image: %lx\n",*(unsigned long *)image_start);
+-
+-//printf("construct_dom0: about to call parseelfimage\n");
+ dsi.image_addr = (unsigned long)image_start;
+ dsi.image_len = image_len;
+ rc = parseelfimage(&dsi);
+@@ -890,11 +885,18 @@
+ return -EINVAL;
+ }
+
++ if(initrd_start&&initrd_len){
++ pinitrd_start=(dom0_start+dom0_size) -
++ (PAGE_ALIGN(initrd_len) + 4*1024*1024);
++
++ memcpy(__va(pinitrd_start),initrd_start,initrd_len);
++ }
++
+ printk("METAPHYSICAL MEMORY ARRANGEMENT:\n"
+ " Kernel image: %lx->%lx\n"
+ " Entry address: %lx\n"
+- " Init. ramdisk: (NOT IMPLEMENTED YET)\n",
+- pkern_start, pkern_end, pkern_entry);
++ " Init. ramdisk: %lx len %lx\n",
++ pkern_start, pkern_end, pkern_entry, pinitrd_start,
initrd_len);
+
+ if ( (pkern_end - pkern_start) > (d->max_pages * PAGE_SIZE) )
+ {
+diff -r f2309ac2648a xen/arch/ia64/xen/xensetup.c
+--- a/xen/arch/ia64/xen/xensetup.c Tue Sep 20 19:03:25 2005
++++ b/xen/arch/ia64/xen/xensetup.c Tue Sep 20 20:10:36 2005
+@@ -153,7 +153,8 @@
+ void *heap_start;
+ int i;
+ unsigned long max_mem, nr_pages, firsthole_start;
+- unsigned long dom0_memory_start, dom0_memory_end;
++ unsigned long dom0_memory_start, dom0_memory_size;
++ unsigned long dom0_initrd_start, dom0_initrd_size;
+ unsigned long initial_images_start, initial_images_end;
+
+ running_on_sim = is_platform_hp_ski();
+@@ -191,7 +192,18 @@
+ efi_memmap_walk(xen_find_first_hole, &firsthole_start);
+
+ initial_images_start = xenheap_phys_end;
+- initial_images_end = initial_images_start + ia64_boot_param->initrd_size;
++ initial_images_end = initial_images_start +
++ PAGE_ALIGN(ia64_boot_param->domain_size);
++
++ /* also reserve space for initrd */
++ if (ia64_boot_param->initrd_start && ia64_boot_param->initrd_size)
++ initial_images_end += PAGE_ALIGN(ia64_boot_param->initrd_size);
++ else {
++ /* sanity cleanup */
++ ia64_boot_param->initrd_size = 0;
++ ia64_boot_param->initrd_start = 0;
++ }
++
+
+ /* Later may find another memory trunk, even away from xen image... */
+ if (initial_images_end > firsthole_start) {
+@@ -203,11 +215,21 @@
+
+ /* This copy is time consuming, but elilo may load Dom0 image
+ * within xenheap range */
+- printk("ready to move Dom0 to 0x%lx...", initial_images_start);
++ printk("ready to move Dom0 to 0x%lx with len %lx...",
initial_images_start,
++ ia64_boot_param->domain_size);
++
+ memmove(__va(initial_images_start),
++ __va(ia64_boot_param->domain_start),
++ ia64_boot_param->domain_size);
++// ia64_boot_param->domain_start = initial_images_start;
++
++ printk("ready to move initrd to 0x%lx with len %lx...",
++ initial_images_start+PAGE_ALIGN(ia64_boot_param->domain_size),
++ ia64_boot_param->initrd_size);
++
memmove(__va(initial_images_start+PAGE_ALIGN(ia64_boot_param->domain_size)),
++
+ __va(ia64_boot_param->initrd_start),
+ ia64_boot_param->initrd_size);
+- ia64_boot_param->initrd_start = initial_images_start;
+ printk("Done\n");
+
+ /* first find highest page frame number */
+@@ -335,23 +357,26 @@
+ * above our heap. The second module, if present, is an initrd ramdisk.
+ */
+ printk("About to call construct_dom0()\n");
+- dom0_memory_start = __va(ia64_boot_param->initrd_start);
+- dom0_memory_end = ia64_boot_param->initrd_size;
+- if ( construct_dom0(dom0, dom0_memory_start, dom0_memory_end,
+- 0,
+- 0,
++ dom0_memory_start = __va(initial_images_start);
++ dom0_memory_size = ia64_boot_param->domain_size;
++ dom0_initrd_start = __va(initial_images_start +
++ PAGE_ALIGN(ia64_boot_param->domain_size));
++ dom0_initrd_size = ia64_boot_param->initrd_size;
++
++ if ( construct_dom0(dom0, dom0_memory_start, dom0_memory_size,
++ dom0_initrd_start,dom0_initrd_size,
+ 0) != 0)
+ panic("Could not set up DOM0 guest OS\n");
+ #ifdef CLONE_DOMAIN0
+ {
+ int i;
+- dom0_memory_start = __va(ia64_boot_param->initrd_start);
+- dom0_memory_end = ia64_boot_param->initrd_size;
++ dom0_memory_start = __va(ia64_boot_param->domain_start);
++ dom0_memory_size = ia64_boot_param->domain_size;
++
+ for (i = 0; i < CLONE_DOMAIN0; i++) {
+ printk("CONSTRUCTING DOMAIN0 CLONE #%d\n",i+1);
+- if ( construct_domU(clones[i], dom0_memory_start, dom0_memory_end,
+- 0,
+- 0,
++ if ( construct_domU(clones[i], dom0_memory_start, dom0_memory_size,
++ dom0_initrd_start,dom0_initrd_size,
+ 0) != 0)
+ panic("Could not set up DOM0 clone %d\n",i);
+ }
+@@ -359,8 +384,14 @@
+ #endif
+
+ /* The stash space for the initial kernel image can now be freed up. */
+- init_domheap_pages(ia64_boot_param->initrd_start,
+- ia64_boot_param->initrd_start +
ia64_boot_param->initrd_size);
++ init_domheap_pages(ia64_boot_param->domain_start,
++ ia64_boot_param->domain_size);
++ /* throw away initrd area passed from elilo */
++ if (ia64_boot_param->initrd_size) {
++ init_domheap_pages(ia64_boot_param->initrd_start,
++ ia64_boot_param->initrd_size);
++ }
++
+ if (!running_on_sim) // slow on ski and pages are pre-initialized to zero
+ scrub_heap_pages();
+
+diff -r f2309ac2648a xen/include/asm-ia64/linux-xen/asm/system.h
+--- a/xen/include/asm-ia64/linux-xen/asm/system.h Tue Sep 20 19:03:25 2005
++++ b/xen/include/asm-ia64/linux-xen/asm/system.h Tue Sep 20 20:10:36 2005
+@@ -56,6 +56,10 @@
+ __u64 fpswa; /* physical address of the fpswa interface */
+ __u64 initrd_start;
+ __u64 initrd_size;
++//for loading initrd for dom0
++ __u64 domain_start; /* virtual address where the boot time domain
begins */
++ __u64 domain_size; /* how big is the boot domain */
++
+ } *ia64_boot_param;
+
+ /*
diff -r babbdd896024 -r 97dbd9524a7e xen/arch/ia64/tools/xelilo/xlilo.efi
--- /dev/null Thu Sep 22 12:59:57 2005
+++ b/xen/arch/ia64/tools/xelilo/xlilo.efi Thu Sep 22 17:34:14 2005
@@ -0,0 +1,1629 @@
+MZ? ÿÿ |