ia64/xen-unstable

view buildconfigs/mk.linux-2.6-xen @ 13631:db3d03dfe92f

add libelf: an ELF binary parser library.

This patch adds a library with a small collection of helper functions
to parse and load elf binaries. The library handles endianess and
elfsize at runtime.

The patch also shuffles around the include files a bit. Now there is
*one* include file holding all the elf structures
(xen/include/public/elfstructs.h) which is included by everyone who
needs them.

It's dead code with this patch only, putting the code into use happens
in followup patches.

Signed-off-by: Gerd Hoffmann <kraxel@suse.de>
---
tools/libxc/xc_elf.h | 525 -----------------------------------
xen/arch/x86/boot/mkelf32.c | 2
xen/common/Makefile | 2
xen/common/libelf/Makefile | 4
xen/common/libelf/README | 1
xen/common/libelf/libelf-dominfo.c | 420 ++++++++++++++++++++++++++++
xen/common/libelf/libelf-loader.c | 156 ++++++++++
xen/common/libelf/libelf-private.h | 51 +++
xen/common/libelf/libelf-relocate.c | 345 +++++++++++++++++++++++
xen/common/libelf/libelf-tools.c | 225 +++++++++++++++
xen/include/public/elfstructs.h | 527 ++++++++++++++++++++++++++++++++++++
xen/include/public/libelf.h | 238 ++++++++++++++++
xen/include/xen/elf.h | 490 ---------------------------------
13 files changed, 1972 insertions(+), 1014 deletions(-)
author Emmanuel Ackaouy <ack@xensource.com>
date Thu Jan 25 22:16:52 2007 +0000 (2007-01-25)
parents 3c8bb086025e
children 98efd2e410ae 3fcd0b9fd083
line source
1 LINUX_SERIES = 2.6
2 LINUX_VER = 2.6.18
4 EXTRAVERSION ?= xen
6 LINUX_SRCDIR = linux-$(LINUX_VER)-xen
7 LINUX_DIR = build-linux-$(LINUX_VER)-$(EXTRAVERSION)_$(XEN_TARGET_ARCH)
9 IMAGE_TARGET ?= vmlinuz
10 INSTALL_BOOT_PATH ?= $(DESTDIR)
12 ifeq ($(XEN_TARGET_ARCH),ia64)
13 INSTALL_BOOT_PATH := $(DESTDIR)/boot
14 endif
16 LINUX_VER3 := $(LINUX_SERIES).$(word 3, $(subst ., ,$(LINUX_VER)))
18 include buildconfigs/Rules.mk
20 # The real action starts here!
21 .PHONY: build
22 build: $(LINUX_DIR)/include/linux/autoconf.h
23 if grep "^CONFIG_MODULES=" $(LINUX_DIR)/.config ; then \
24 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) modules ; \
25 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) INSTALL_MOD_PATH=$(DESTDIR) modules_install ; \
26 fi
27 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) INSTALL_PATH=$(DESTDIR) $(IMAGE_TARGET)
28 mkdir -p $(INSTALL_BOOT_PATH)
29 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) INSTALL_PATH=$(INSTALL_BOOT_PATH) install
31 $(LINUX_SRCDIR)/.valid-src: ref-linux-$(LINUX_VER)/.valid-ref
32 rm -rf $(LINUX_SRCDIR)
33 cp -al $(<D) $(LINUX_SRCDIR)
34 # Apply arch-xen patches
35 ( cd linux-$(LINUX_SERIES)-xen-sparse && \
36 LINUX_ARCH=$(LINUX_ARCH) bash ./mkbuildtree ../$(LINUX_SRCDIR) )
37 # Patch kernel Makefile to set EXTRAVERSION
38 ( cd $(LINUX_SRCDIR) ; \
39 sed -e 's,^EXTRAVERSION.*,&$$(XENGUEST),' \
40 -e 's,^KERNELRELEASE,XENGUEST := $$(shell [ -r $$(objtree)/.xenguest ] \&\& cat $$(objtree)/.xenguest)\n&,' Makefile >Mk.tmp ; \
41 rm -f Makefile ; mv Mk.tmp Makefile )
42 touch $@
44 $(LINUX_DIR)/include/linux/autoconf.h: $(LINUX_SRCDIR)/.valid-src
45 rm -rf $(LINUX_DIR)
46 mkdir -p $(LINUX_DIR)
47 # Re-use config from install dir if one exits else use default config
48 CONFIG_VERSION=$$(sed -ne 's/$$(XENGUEST)//; s/^EXTRAVERSION = //p' $(LINUX_SRCDIR)/Makefile); \
49 [ -r $(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION-$(EXTRAVERSION) ] && \
50 cp $(DESTDIR)/boot/config-$(LINUX_VER3)$$CONFIG_VERSION-$(EXTRAVERSION) $(LINUX_DIR)/.config \
51 || sh buildconfigs/create_config.sh $(LINUX_DIR)/.config $(EXTRAVERSION) $(XEN_TARGET_ARCH) $(XEN_SYSTYPE)
52 # See if we need to munge config to enable PAE
53 $(MAKE) CONFIG_FILE=$(LINUX_DIR)/.config -f buildconfigs/Rules.mk config-update-pae
54 echo "-$(EXTRAVERSION)" >$(LINUX_DIR)/.xenguest
55 $(MAKE) -C $(LINUX_SRCDIR) ARCH=$(LINUX_ARCH) oldconfig O=$$(/bin/pwd)/$(LINUX_DIR)
57 .PHONY: prep
58 prep: $(LINUX_DIR)/include/linux/autoconf.h
60 .PHONY: config
61 config: CONFIGMODE = menuconfig
62 config: $(LINUX_DIR)/include/linux/autoconf.h
63 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) $(CONFIGMODE)
65 .PHONY: clean
66 clean::
67 [ ! -d $(LINUX_DIR) ] || \
68 $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) clean
71 .PHONY: delete
72 delete:
73 rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR)
75 .PHONY: mrpropper
76 mrpropper:
77 rm -rf $(LINUX_SRCDIR)
78 rm -f linux-$(LINUX_VER).tar.bz2