ia64/xen-unstable

view extras/mini-os/Makefile @ 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 ba18f07cb61c
children 236687fb42d7
line source
1 # Common Makefile for mini-os.
2 #
3 # Every architecture directory below mini-os/arch has to have a
4 # Makefile and a arch.mk.
5 #
7 pae ?= n
9 XEN_ROOT = ../..
10 include $(XEN_ROOT)/Config.mk
12 XEN_INTERFACE_VERSION := 0x00030205
13 export XEN_INTERFACE_VERSION
15 # Set TARGET_ARCH
16 override TARGET_ARCH := $(XEN_TARGET_ARCH)
18 # Set mini-os root path, used in mini-os.mk.
19 MINI-OS_ROOT=$(PWD)
20 export MINI-OS_ROOT
22 # Try to find out the architecture family TARGET_ARCH_FAM.
23 # First check whether x86_... is contained (for x86_32, x86_32y, x86_64).
24 # If not x86 then use $(TARGET_ARCH) -> for ia64, ...
25 ifeq ($(findstring x86_,$(TARGET_ARCH)),x86_)
26 TARGET_ARCH_FAM = x86
27 else
28 TARGET_ARCH_FAM = $(TARGET_ARCH)
29 endif
31 # The architecture family directory below mini-os.
32 TARGET_ARCH_DIR := arch/$(TARGET_ARCH_FAM)
34 # Export these variables for possible use in architecture dependent makefiles.
35 export TARGET_ARCH
36 export TARGET_ARCH_DIR
37 export TARGET_ARCH_FAM
39 # This is used for architecture specific links.
40 # This can be overwritten from arch specific rules.
41 ARCH_LINKS =
43 # For possible special header directories.
44 # This can be overwritten from arch specific rules.
45 EXTRA_INC =
47 # Special build dependencies.
48 # Build all after touching this/these file(s) (see minios.mk)
49 SPEC_DEPENDS = minios.mk
51 # Include the architecture family's special makerules.
52 # This must be before include minios.mk!
53 include $(TARGET_ARCH_DIR)/arch.mk
55 # Include common mini-os makerules.
56 include minios.mk
58 # Define some default flags for linking.
59 LDLIBS :=
60 LDFLAGS :=
61 LDARCHLIB := -L$(TARGET_ARCH_DIR) -l$(ARCH_LIB_NAME)
62 LDFLAGS_FINAL := -N -T $(TARGET_ARCH_DIR)/minios-$(TARGET_ARCH).lds
64 # Prefix for global API names. All other symbols are localised before
65 # linking with EXTRA_OBJS.
66 GLOBAL_PREFIX := xenos_
67 EXTRA_OBJS =
69 TARGET := mini-os
71 # Subdirectories common to mini-os
72 SUBDIRS := lib xenbus console
74 # The common mini-os objects to build.
75 OBJS := $(patsubst %.c,%.o,$(wildcard *.c))
76 OBJS += $(patsubst %.c,%.o,$(wildcard lib/*.c))
77 OBJS += $(patsubst %.c,%.o,$(wildcard xenbus/*.c))
78 OBJS += $(patsubst %.c,%.o,$(wildcard console/*.c))
81 .PHONY: default
82 default: $(TARGET)
84 # Create special architecture specific links. The function arch_links
85 # has to be defined in arch.mk (see include above).
86 ifneq ($(ARCH_LINKS),)
87 $(ARCH_LINKS):
88 $(arch_links)
89 endif
91 .PHONY: links
92 links: $(ARCH_LINKS)
93 [ -e include/xen ] || ln -sf ../../../xen/include/public include/xen
95 .PHONY: arch_lib
96 arch_lib:
97 $(MAKE) --directory=$(TARGET_ARCH_DIR) || exit 1;
99 $(TARGET): links $(OBJS) arch_lib
100 $(LD) -r $(LDFLAGS) $(HEAD_OBJ) $(OBJS) $(LDARCHLIB) -o $@.o
101 $(OBJCOPY) -w -G $(GLOBAL_PREFIX)* -G _start $@.o $@.o
102 $(LD) $(LDFLAGS) $(LDFLAGS_FINAL) $@.o $(EXTRA_OBJS) -o $@
103 gzip -f -9 -c $@ >$@.gz
105 .PHONY: clean arch_clean
107 arch_clean:
108 $(MAKE) --directory=$(TARGET_ARCH_DIR) clean || exit 1;
110 clean: arch_clean
111 for dir in $(SUBDIRS); do \
112 rm -f $$dir/*.o; \
113 done
114 rm -f *.o *~ core $(TARGET).elf $(TARGET).raw $(TARGET) $(TARGET).gz
115 find . -type l | xargs rm -f
116 rm -f tags TAGS
119 define all_sources
120 ( find . -follow -name SCCS -prune -o -name '*.[chS]' -print )
121 endef
123 .PHONY: cscope
124 cscope:
125 $(all_sources) > cscope.files
126 cscope -k -b -q
128 .PHONY: tags
129 tags:
130 $(all_sources) | xargs ctags