pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/sysutils/xenkernel3 Switch from using the pre-build bi...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e42424f186e1
branches:  trunk
changeset: 532379:e42424f186e1
user:      bouyer <bouyer%pkgsrc.org@localhost>
date:      Fri Aug 17 17:26:03 2007 +0000

description:
Switch from using the pre-build binaries to building our own Xen kernel.
Apply a patch (patch-b*) to xen-3.1.0 to fix the ELF loader so that the
symbol table is properly loaded for the NetBSD dom0 kernel. This is from
the Xen repository, based on a patch inistally submitted by Christoph Egger
to Xen (thanks !). Should fix PR port-xen/36671.
While there also provide a debug Xen kernel, built with debug=1.
Bump PKGREVISION.

diffstat:

 sysutils/xenkernel3/Makefile         |   39 ++++++--
 sysutils/xenkernel3/PLIST            |    3 +-
 sysutils/xenkernel3/distinfo         |   16 ++-
 sysutils/xenkernel3/patches/patch-aa |   13 ++
 sysutils/xenkernel3/patches/patch-ab |   13 ++
 sysutils/xenkernel3/patches/patch-ac |   22 ++++
 sysutils/xenkernel3/patches/patch-ad |    6 +
 sysutils/xenkernel3/patches/patch-ba |   14 ++
 sysutils/xenkernel3/patches/patch-bb |   18 +++
 sysutils/xenkernel3/patches/patch-bc |  166 +++++++++++++++++++++++++++++++++++
 sysutils/xenkernel3/patches/patch-bd |  112 +++++++++++++++++++++++
 11 files changed, 407 insertions(+), 15 deletions(-)

diffs (truncated from 487 to 300 lines):

diff -r 8d519adc6f27 -r e42424f186e1 sysutils/xenkernel3/Makefile
--- a/sysutils/xenkernel3/Makefile      Fri Aug 17 16:39:37 2007 +0000
+++ b/sysutils/xenkernel3/Makefile      Fri Aug 17 17:26:03 2007 +0000
@@ -1,28 +1,47 @@
-# $NetBSD: Makefile,v 1.2 2007/07/01 20:20:24 bouyer Exp $
+# $NetBSD: Makefile,v 1.3 2007/08/17 17:26:03 bouyer Exp $
 #
 
 VERSION=       3.1.0
-DISTNAME=      xen-${VERSION}-install-x86_32
+DISTNAME=      xen-${VERSION}-src
 PKGNAME=       xenkernel3-${VERSION}
+PKGREVISION=   1
 CATEGORIES=    sysutils
-MASTER_SITES=  http://www.cl.cam.ac.uk/Research/SRG/netos/xen/downloads/ \
-               http://bits.xensource.com/oss-xen/release/${VERSION}/bin.tgz/
+MASTER_SITES=  http://www.cl.cam.ac.uk/research/srg/netos/xen/downloads/ \
+               http://bits.xensource.com/oss-xen/release/${VERSION}/src.tgz/
 EXTRACT_SUFX=  .tgz
 
-MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
-HOMEPAGE=      http://www.NetBSD.org/Ports/xen/
+MAINTAINER=    bouyer%NetBSD.org@localhost
+HOMEPAGE=      http://www.cl.cam.ac.uk/research/srg/netos/xen/
 COMMENT=       Xen3 Kernel
+
+ONLY_FOR_PLATFORM=     Linux-2.[46]*-i386 NetBSD-*-i386
 CONFLICTS=     xenkernel30-*
 
-ONLY_FOR_PLATFORM=     Linux-2.[46]*-i386 NetBSD-*-i386
 
-WRKSRC=                ${WRKDIR}/dist
+WRKSRC=                ${WRKDIR}/xen-${VERSION}-src
 
 NO_CONFIGURE=  yes
-NO_BUILD=      yes
+USE_TOOLS+=    gmake
+
+PYTHON_VERSIONS_ACCEPTED= 24 23
+PY_PATCHPLIST=         no
 
+SUBST_CLASSES+=                py
+SUBST_STAGE.py=                pre-build
+SUBST_FILES.py=                xen/include/public/foreign/Makefile
+SUBST_SED.py=          -e "s,python,${PYTHONBIN},g"
+
+do-build:
+       cd ${WRKSRC} && ${GMAKE} XEN_TARGET_X86_PAE=n debug=n xen
+       ${CP} ${WRKSRC}/dist/install/boot/xen.gz ${WRKDIR}/xen.gz
+       cd ${WRKSRC} && ${GMAKE} clean && \
+           ${GMAKE} XEN_TARGET_X86_PAE=n debug=y xen
+       ${CP} ${WRKSRC}/dist/install/boot/xen.gz ${WRKDIR}/xen-debug.gz
+       
 do-install:
        ${INSTALL_DATA_DIR} ${PREFIX}/xen3-kernel
-       ${INSTALL_DATA} ${WRKSRC}/install/boot/xen.gz ${PREFIX}/xen3-kernel/xen.gz
+       ${INSTALL_DATA} ${WRKDIR}/xen.gz ${PREFIX}/xen3-kernel/xen.gz
+       ${INSTALL_DATA} ${WRKDIR}/xen-debug.gz ${PREFIX}/xen3-kernel/xen-debug.gz
 
+.include "../../lang/python/application.mk"
 .include "../../mk/bsd.pkg.mk"
diff -r 8d519adc6f27 -r e42424f186e1 sysutils/xenkernel3/PLIST
--- a/sysutils/xenkernel3/PLIST Fri Aug 17 16:39:37 2007 +0000
+++ b/sysutils/xenkernel3/PLIST Fri Aug 17 17:26:03 2007 +0000
@@ -1,3 +1,4 @@
-@comment $NetBSD: PLIST,v 1.1.1.1 2007/06/14 19:37:00 bouyer Exp $
+@comment $NetBSD: PLIST,v 1.2 2007/08/17 17:26:03 bouyer Exp $
 xen3-kernel/xen.gz
+xen3-kernel/xen-debug.gz
 @dirrm xen3-kernel
diff -r 8d519adc6f27 -r e42424f186e1 sysutils/xenkernel3/distinfo
--- a/sysutils/xenkernel3/distinfo      Fri Aug 17 16:39:37 2007 +0000
+++ b/sysutils/xenkernel3/distinfo      Fri Aug 17 17:26:03 2007 +0000
@@ -1,5 +1,13 @@
-$NetBSD: distinfo,v 1.1.1.1 2007/06/14 19:37:00 bouyer Exp $
+$NetBSD: distinfo,v 1.2 2007/08/17 17:26:03 bouyer Exp $
 
-SHA1 (xen-3.1.0-install-x86_32.tgz) = f60f1cd09592b24993c718cd380a5b125a716916
-RMD160 (xen-3.1.0-install-x86_32.tgz) = 6cab7f894fb3770005c11c1d1ae08647ea953679
-Size (xen-3.1.0-install-x86_32.tgz) = 23112271 bytes
+SHA1 (xen-3.1.0-src.tgz) = fa4b54c36626f2cce9b15dc99cafda0b42c54777
+RMD160 (xen-3.1.0-src.tgz) = 2fd65a3b81e522d0ed2d62fd11e5977167f1ceb3
+Size (xen-3.1.0-src.tgz) = 6831094 bytes
+SHA1 (patch-aa) = 1be644e7edd3735c2850d3e581002f53bd50eb59
+SHA1 (patch-ab) = 58ba3a1ec8c1bbc895dd70d286eb5a70778b7c7f
+SHA1 (patch-ac) = 3eb6179c90090d5b05f97a66b50cf78ce50e6f56
+SHA1 (patch-ad) = 0af2e62c4a1469d03b3999cf0864c62e28d95ed0
+SHA1 (patch-ba) = a90ffef881c3fadcf3c25e4c638ef33158ec9e87
+SHA1 (patch-bb) = 7338e5a512c909d4b043654dab882761de274f94
+SHA1 (patch-bc) = fa35699da6ad2a4950418a02432c2ccdb5d34844
+SHA1 (patch-bd) = 2a07955b1285d288458066813f8ebc801b8038c1
diff -r 8d519adc6f27 -r e42424f186e1 sysutils/xenkernel3/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xenkernel3/patches/patch-aa      Fri Aug 17 17:26:03 2007 +0000
@@ -0,0 +1,13 @@
+$NetBSD: patch-aa,v 1.1 2007/08/17 17:26:04 bouyer Exp $
+
+--- xen/include/asm-x86/page.h.orig    2007-08-16 22:23:58.000000000 +0200
++++ xen/include/asm-x86/page.h 2007-08-16 22:24:43.000000000 +0200
+@@ -331,7 +331,7 @@
+  * WARNING: This will need to be disabled to run OSes that use the spare PTE
+  * bits themselves (e.g., *BSD).
+  */
+-#ifndef NDEBUG
++#if 0
+ #define _PAGE_GNTTAB   _PAGE_AVAIL2
+ #else
+ #define _PAGE_GNTTAB   0
diff -r 8d519adc6f27 -r e42424f186e1 sysutils/xenkernel3/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xenkernel3/patches/patch-ab      Fri Aug 17 17:26:03 2007 +0000
@@ -0,0 +1,13 @@
+$NetBSD: patch-ab,v 1.1 2007/08/17 17:26:04 bouyer Exp $
+
+--- ./xen/arch/x86/shutdown.c.orig     2007-08-16 21:52:39.000000000 +0200
++++ ./xen/arch/x86/shutdown.c  2007-08-16 21:53:03.000000000 +0200
+@@ -197,7 +197,7 @@
+ 
+ #endif
+ 
+-void machine_restart(char * __unused)
++void machine_restart(char * __unused u)
+ {
+     int i;
+ 
diff -r 8d519adc6f27 -r e42424f186e1 sysutils/xenkernel3/patches/patch-ac
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xenkernel3/patches/patch-ac      Fri Aug 17 17:26:03 2007 +0000
@@ -0,0 +1,22 @@
+$NetBSD: patch-ac,v 1.1 2007/08/17 17:26:04 bouyer Exp $
+
+--- xen/tools/symbols.c.orig   2007-08-16 21:46:28.000000000 +0200
++++ xen/tools/symbols.c        2007-08-16 21:51:22.000000000 +0200
+@@ -103,7 +103,7 @@
+               _sextratext = s->addr;
+       else if (strcmp(sym, "_eextratext") == 0)
+               _eextratext = s->addr;
+-      else if (toupper(stype) == 'A')
++      else if (toupper((int)stype) == 'A')
+       {
+               /* Keep these useful absolute symbols */
+               if (strcmp(sym, "__kernel_syscall_via_break") &&
+@@ -113,7 +113,7 @@
+                       return -1;
+ 
+       }
+-      else if (toupper(stype) == 'U' ||
++      else if (toupper((int)stype) == 'U' ||
+                is_arm_mapping_symbol(sym))
+               return -1;
+       /* exclude also MIPS ELF local symbols ($L123 instead of .L123) */
diff -r 8d519adc6f27 -r e42424f186e1 sysutils/xenkernel3/patches/patch-ad
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xenkernel3/patches/patch-ad      Fri Aug 17 17:26:03 2007 +0000
@@ -0,0 +1,6 @@
+$NetBSD: patch-ad,v 1.1 2007/08/17 17:26:04 bouyer Exp $
+
+--- config/NetBSD.mk.orig      2007-08-16 21:44:15.000000000 +0200
++++ config/NetBSD.mk   2007-08-16 21:44:08.000000000 +0200
+@@ -0,0 +1 @@
++include $(XEN_ROOT)/config/StdGNU.mk
diff -r 8d519adc6f27 -r e42424f186e1 sysutils/xenkernel3/patches/patch-ba
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xenkernel3/patches/patch-ba      Fri Aug 17 17:26:03 2007 +0000
@@ -0,0 +1,14 @@
+$NetBSD: patch-ba,v 1.1 2007/08/17 17:26:04 bouyer Exp $
+
+--- xen/arch/x86/domain_build.c.orig   2007-08-16 21:34:39.000000000 +0200
++++ xen/arch/x86/domain_build.c        2007-08-16 21:43:18.000000000 +0200
+@@ -312,6 +312,9 @@
+            parms.pae       ? ", PAE"  : "",
+            elf_msb(&elf)   ? "msb"    : "lsb",
+            elf.pstart, elf.pend);
++    if ( elf.bsd_symtab_pstart )
++        printk(" Dom0 symbol map 0x%" PRIx64 " -> 0x%" PRIx64 "\n",
++               elf.bsd_symtab_pstart, elf.bsd_symtab_pend);
+ 
+     if ( !compatible )
+     {
diff -r 8d519adc6f27 -r e42424f186e1 sysutils/xenkernel3/patches/patch-bb
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xenkernel3/patches/patch-bb      Fri Aug 17 17:26:03 2007 +0000
@@ -0,0 +1,18 @@
+$NetBSD: patch-bb,v 1.1 2007/08/17 17:26:04 bouyer Exp $
+
+--- xen/common/libelf/libelf-dominfo.c.orig    2007-05-18 16:45:21.000000000 +0200
++++ xen/common/libelf/libelf-dominfo.c 2007-08-16 21:43:18.000000000 +0200
+@@ -378,6 +378,13 @@
+     if ( parms->virt_entry == UNSET_ADDR )
+         parms->virt_entry = elf_uval(elf, elf->ehdr, e_entry);
+ 
++    if ( parms->bsd_symtab )
++    {
++        elf_parse_bsdsyms(elf, parms->virt_kend);
++        if ( elf->bsd_symtab_pend )
++            parms->virt_kend = elf->bsd_symtab_pend + parms->virt_offset;
++    }
++
+     elf_msg(elf, "%s: addresses:\n", __FUNCTION__);
+     elf_msg(elf, "    virt_base        = 0x%" PRIx64 "\n", parms->virt_base);
+     elf_msg(elf, "    elf_paddr_offset = 0x%" PRIx64 "\n", parms->elf_paddr_offset);
diff -r 8d519adc6f27 -r e42424f186e1 sysutils/xenkernel3/patches/patch-bc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/sysutils/xenkernel3/patches/patch-bc      Fri Aug 17 17:26:03 2007 +0000
@@ -0,0 +1,166 @@
+$NetBSD: patch-bc,v 1.1 2007/08/17 17:26:05 bouyer Exp $
+
+--- xen/common/libelf/libelf-loader.c.orig     2007-05-18 16:45:21.000000000 +0200
++++ xen/common/libelf/libelf-loader.c  2007-08-16 21:43:18.000000000 +0200
+@@ -20,11 +20,15 @@
+     memset(elf, 0, sizeof(*elf));
+     elf->image = image;
+     elf->size = size;
+-    elf->ehdr = (elf_ehdr *) image;
++    elf->ehdr = (elf_ehdr *)image;
+     elf->class = elf->ehdr->e32.e_ident[EI_CLASS];
+     elf->data = elf->ehdr->e32.e_ident[EI_DATA];
+ 
+-    /* sanity check phdr */
++#ifdef VERBOSE
++    elf_set_verbose(elf);
++#endif
++
++    /* Sanity check phdr. */
+     offset = elf_uval(elf, elf->ehdr, e_phoff) +
+         elf_uval(elf, elf->ehdr, e_phentsize) * elf_phdr_count(elf);
+     if ( offset > elf->size )
+@@ -34,7 +38,7 @@
+         return -1;
+     }
+ 
+-    /* sanity check shdr */
++    /* Sanity check shdr. */
+     offset = elf_uval(elf, elf->ehdr, e_shoff) +
+         elf_uval(elf, elf->ehdr, e_shentsize) * elf_shdr_count(elf);
+     if ( offset > elf->size )
+@@ -44,13 +48,13 @@
+         return -1;
+     }
+ 
+-    /* find section string table */
++    /* Find section string table. */
+     section = elf_uval(elf, elf->ehdr, e_shstrndx);
+     shdr = elf_shdr_by_index(elf, section);
+     if ( shdr != NULL )
+         elf->sec_strtab = elf_section_start(elf, shdr);
+ 
+-    /* find symbol table, symbol string table */
++    /* Find symbol table and symbol string table. */
+     count = elf_shdr_count(elf);
+     for ( i = 0; i < count; i++ )
+     {
+@@ -67,6 +71,7 @@
+         elf->sym_strtab = elf_section_start(elf, shdr);
+         break;
+     }
++
+     return 0;
+ }
+ 
+@@ -83,6 +88,101 @@
+ }
+ #endif
+ 
++/* Calculate the required additional kernel space for the elf image */
++void elf_parse_bsdsyms(struct elf_binary *elf, uint64_t pstart)
++{
++    uint64_t sz;
++    const elf_shdr *shdr;
++    int i, type;
++
++    if ( !elf->sym_tab )
++        return;
++
++    pstart = elf_round_up(elf, pstart);
++
++    /* Space to store the size of the elf image */
++    sz = sizeof(uint32_t);
++
++    /* Space for the elf and elf section headers */
++    sz += (elf_uval(elf, elf->ehdr, e_ehsize) +
++           elf_shdr_count(elf) * elf_uval(elf, elf->ehdr, e_shentsize));
++    sz = elf_round_up(elf, sz);
++
++    /* Space for the symbol and string tables. */
++    for ( i = 0; i < elf_shdr_count(elf); i++ )
++    {
++        shdr = elf_shdr_by_index(elf, i);
++        type = elf_uval(elf, (elf_shdr *)shdr, sh_type);
++        if ( (type == SHT_STRTAB) || (type == SHT_SYMTAB) )
++            sz = elf_round_up(elf, sz + elf_uval(elf, shdr, sh_size));
++    }
++
++    elf->bsd_symtab_pstart = pstart;
++    elf->bsd_symtab_pend   = pstart + sz;
++}
++
++static void elf_load_bsdsyms(struct elf_binary *elf)
++{
++    elf_ehdr *sym_ehdr;



Home | Main Index | Thread Index | Old Index