All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix pxe boot
@ 2009-05-11 13:27 Christoph Egger
  2009-05-11 14:36 ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Egger @ 2009-05-11 13:27 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]


Hi,

Attached patch unbreaks PXE boot.
It effectively backs out c/s 19146.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>

-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

[-- Attachment #2: xen_fixpxe.diff --]
[-- Type: text/x-diff, Size: 5355 bytes --]

diff -r 2656ab6fa828 xen/arch/x86/Makefile
--- a/xen/arch/x86/Makefile	Fri May 08 11:50:12 2009 +0100
+++ b/xen/arch/x86/Makefile	Mon May 11 15:22:09 2009 +0200
@@ -92,4 +92,3 @@ boot/mkelf32: boot/mkelf32.c
 clean::
 	rm -f asm-offsets.s xen.lds boot/*.o boot/*~ boot/core boot/mkelf32
 	rm -f $(BASEDIR)/.xen-syms.[0-9]* boot/.*.d
-	rm -f boot/reloc.S boot/reloc.lnk boot/reloc.bin
diff -r 2656ab6fa828 xen/arch/x86/boot/Makefile
--- a/xen/arch/x86/boot/Makefile	Fri May 08 11:50:12 2009 +0100
+++ b/xen/arch/x86/boot/Makefile	Mon May 11 15:22:09 2009 +0200
@@ -1,7 +1,1 @@
 obj-y += head.o
-
-head.o: reloc.S
-
-# NB. BOOT_TRAMPOLINE == 0x8c000
-%.S: %.c
-	RELOC=0x8c000 $(MAKE) -f build32.mk $@
diff -r 2656ab6fa828 xen/arch/x86/boot/build32.mk
--- a/xen/arch/x86/boot/build32.mk	Fri May 08 11:50:12 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-XEN_ROOT=../../../..
-override XEN_TARGET_ARCH=x86_32
-CFLAGS =
-include $(XEN_ROOT)/Config.mk
-
-# Disable PIE/SSP if GCC supports them. They can break us.
-$(call cc-option-add,CFLAGS,CC,-nopie)
-$(call cc-option-add,CFLAGS,CC,-fno-stack-protector)
-$(call cc-option-add,CFLAGS,CC,-fno-stack-protector-all)
-
-CFLAGS += -Werror -fno-builtin -msoft-float
-
-# NB. awk invocation is a portable alternative to 'head -n -1'
-%.S: %.bin
-	(od -v -t x $< | awk 'NR > 1 {print s} {s=$$0}' | \
-	sed 's/ /,0x/g' | sed 's/^[0-9]*,/ .long /') >$@
-
-%.bin: %.lnk
-	$(OBJCOPY) -O binary $< $@
-
-%.lnk: %.o
-	$(LD) $(LDFLAGS_DIRECT) -N -Ttext 0x8c000 -o $@ $<
-
-%.o: %.c
-	$(CC) $(CFLAGS) -c $< -o $@
diff -r 2656ab6fa828 xen/arch/x86/boot/head.S
--- a/xen/arch/x86/boot/head.S	Fri May 08 11:50:12 2009 +0100
+++ b/xen/arch/x86/boot/head.S	Mon May 11 15:22:09 2009 +0200
@@ -79,11 +79,8 @@ __start:
         cmp     $0x2BADB002,%eax
         jne     not_multiboot
 
-        /* Save the Multiboot info struct (after relocation) for later use. */
-        mov     $sym_phys(cpu0_stack)+1024,%esp
-        push    %ebx
-        call    reloc
-        mov     %eax,sym_phys(multiboot_ptr)
+        /* Save the Multiboot info structure for later use. */
+        mov     %ebx,sym_phys(multiboot_ptr)
 
         /* Initialize BSS (no nasty surprises!) */
         mov     $sym_phys(__bss_start),%edi
@@ -195,9 +192,6 @@ 2:      cmp     $L1_PAGETABLE_ENTRIES,%e
 
 #include "cmdline.S"
 
-reloc:
-#include "reloc.S"
-
         .align 16
         .globl trampoline_start, trampoline_end
 trampoline_start:
diff -r 2656ab6fa828 xen/arch/x86/boot/reloc.c
--- a/xen/arch/x86/boot/reloc.c	Fri May 08 11:50:12 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-/******************************************************************************
- * reloc.c
- * 
- * 32-bit flat memory-map routines for relocating Multiboot structures
- * and modules. This is most easily done early with paging disabled.
- * 
- * Copyright (c) 2009, Citrix Systems, Inc.
- * 
- * Authors:
- *    Keir Fraser <keir.fraser@citrix.com>
- */
-
-asm (
-    "    .text                         \n"
-    "    .globl _start                 \n"
-    "_start:                           \n"
-    "    mov  $_start,%edi             \n"
-    "    call 1f                       \n"
-    "1:  pop  %esi                     \n"
-    "    sub  $1b-_start,%esi          \n"
-    "    mov  $__bss_start-_start,%ecx \n"
-    "    rep  movsb                    \n"
-    "    xor  %eax,%eax                \n"
-    "    mov  $_end,%ecx               \n"
-    "    sub  %edi,%ecx                \n"
-    "    rep  stosb                    \n"
-    "    mov  $reloc,%eax              \n"
-    "    jmp  *%eax                    \n"
-    );
-
-typedef unsigned int u32;
-#include "../../../include/xen/multiboot.h"
-
-extern char _start[];
-
-static void *memcpy(void *dest, const void *src, unsigned int n)
-{
-    char *s = (char *)src, *d = dest;
-    while ( n-- )
-        *d++ = *s++;
-    return dest;
-}
-
-static void *reloc_mbi_struct(void *old, unsigned int bytes)
-{
-    static void *alloc = &_start;
-    alloc = (void *)(((unsigned long)alloc - bytes) & ~15ul);
-    return memcpy(alloc, old, bytes);
-}
-
-static char *reloc_mbi_string(char *old)
-{
-    char *p;
-    for ( p = old; *p != '\0'; p++ )
-        continue;
-    return reloc_mbi_struct(old, p - old + 1);
-}
-
-multiboot_info_t *reloc(multiboot_info_t *mbi_old)
-{
-    multiboot_info_t *mbi = reloc_mbi_struct(mbi_old, sizeof(*mbi));
-    int i;
-
-    if ( mbi->flags & MBI_CMDLINE )
-        mbi->cmdline = (u32)reloc_mbi_string((char *)mbi->cmdline);
-
-    if ( mbi->flags & MBI_MODULES )
-    {
-        module_t *mods = reloc_mbi_struct(
-            (module_t *)mbi->mods_addr, mbi->mods_count * sizeof(module_t));
-        mbi->mods_addr = (u32)mods;
-        for ( i = 0; i < mbi->mods_count; i++ )
-            if ( mods[i].string )
-                mods[i].string = (u32)reloc_mbi_string((char *)mods[i].string);
-    }
-
-    if ( mbi->flags & MBI_MEMMAP )
-        mbi->mmap_addr = (u32)reloc_mbi_struct(
-            (memory_map_t *)mbi->mmap_addr, mbi->mmap_length);
-
-    /* Mask features we don't understand or don't relocate. */
-    mbi->flags &= (MBI_MEMLIMITS |
-                   MBI_DRIVES |
-                   MBI_CMDLINE |
-                   MBI_MODULES |
-                   MBI_MEMMAP);
-
-    return mbi;
-}

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix pxe boot
  2009-05-11 13:27 [PATCH] fix pxe boot Christoph Egger
@ 2009-05-11 14:36 ` Keir Fraser
  2009-05-11 15:40   ` Christoph Egger
  0 siblings, 1 reply; 4+ messages in thread
From: Keir Fraser @ 2009-05-11 14:36 UTC (permalink / raw)
  To: Christoph Egger, xen-devel@lists.xensource.com

On 11/05/2009 14:27, "Christoph Egger" <Christoph.Egger@amd.com> wrote:

> Attached patch unbreaks PXE boot.
> It effectively backs out c/s 19146.

PXE boot does generally work -- we boot all our systems via pxelinux and its
mboot.c32 module. At this point we'll have to target a fix for your setup
for 3.4.1, as 3.4.0 is locked down now.

 -- Keir

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix pxe boot
  2009-05-11 14:36 ` Keir Fraser
@ 2009-05-11 15:40   ` Christoph Egger
  2009-05-11 15:47     ` Keir Fraser
  0 siblings, 1 reply; 4+ messages in thread
From: Christoph Egger @ 2009-05-11 15:40 UTC (permalink / raw)
  To: xen-devel; +Cc: Keir Fraser

On Monday 11 May 2009 16:36:01 Keir Fraser wrote:
> On 11/05/2009 14:27, "Christoph Egger" <Christoph.Egger@amd.com> wrote:
> > Attached patch unbreaks PXE boot.
> > It effectively backs out c/s 19146.
>
> PXE boot does generally work -- we boot all our systems via pxelinux and
> its mboot.c32 module. At this point we'll have to target a fix for your
> setup for 3.4.1, as 3.4.0 is locked down now.

I use pxegrub.

Christoph

-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Karl-Hammerschmidt-Str. 34, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Thomas M. McCoy, Giuliano Meroni
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fix pxe boot
  2009-05-11 15:40   ` Christoph Egger
@ 2009-05-11 15:47     ` Keir Fraser
  0 siblings, 0 replies; 4+ messages in thread
From: Keir Fraser @ 2009-05-11 15:47 UTC (permalink / raw)
  To: Christoph Egger, xen-devel@lists.xensource.com

On 11/05/2009 16:40, "Christoph Egger" <Christoph.Egger@amd.com> wrote:

>> PXE boot does generally work -- we boot all our systems via pxelinux and
>> its mboot.c32 module. At this point we'll have to target a fix for your
>> setup for 3.4.1, as 3.4.0 is locked down now.
> 
> I use pxegrub.

Hmm, maybe I can set that up at home and give it a try. I f I can repro it
then it won't be hard to fix.

 -- Keir

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-05-11 15:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-11 13:27 [PATCH] fix pxe boot Christoph Egger
2009-05-11 14:36 ` Keir Fraser
2009-05-11 15:40   ` Christoph Egger
2009-05-11 15:47     ` Keir Fraser

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.