Changeset e2b73d4f in mainline for kernel


Ignore:
Timestamp:
2010-03-21T09:25:29Z (16 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
19f857a
Parents:
facebd56 (diff), 4e9aaf5 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

Location:
kernel
Files:
2 deleted
12 edited

Legend:

Unmodified
Added
Removed
  • kernel/Makefile

    rfacebd56 re2b73d4f  
    2727#
    2828
    29 include Makefile.common
     29## Configuration
     30#
     31
     32ROOT_PATH = ..
     33
     34VERSION_DEF = $(ROOT_PATH)/version
     35
     36COMMON_MAKEFILE = $(ROOT_PATH)/Makefile.common
     37COMMON_HEADER = $(ROOT_PATH)/common.h
     38COMMON_HEADER_ARCH = arch/$(KARCH)/include/common.h
     39
     40CONFIG_MAKEFILE = $(ROOT_PATH)/Makefile.config
     41CONFIG_HEADER = $(ROOT_PATH)/config.h
     42
     43-include $(VERSION_DEF)
     44-include $(COMMON_MAKEFILE)
     45-include $(CONFIG_MAKEFILE)
     46
     47## Common names
     48#
     49
     50DEPEND = Makefile.depend
     51DEPEND_PREV = $(DEPEND).prev
     52RAW = kernel.raw
     53BIN = kernel.bin
     54MAP = kernel.map
     55JOB = kernel.job
     56MAP_PREV = $(MAP).prev
     57DISASM = kernel.disasm
     58DUMP = kernel.dump
     59REAL_MAP = generic/src/debug/real_map
     60
     61ARCH_INCLUDE = generic/include/arch
     62GENARCH_INCLUDE = generic/include/genarch
     63
     64GENMAP = tools/genmap.py
     65JOBFILE = $(ROOT_PATH)/tools/jobfile.py
     66
     67LINK = arch/$(KARCH)/_link.ld
     68EMPTY_MAP = generic/src/debug/empty_map.o
     69SIZEOK_MAP = generic/src/debug/sizeok_map.o
     70
     71INCLUDES = generic/include
     72OPTIMIZATION = 3
    3073
    3174.PHONY: all clean
    3275
    33 all: ../version ../Makefile.config ../config.h ../config.defs
    34         -[ -f $(DEPEND) ] && mv -f $(DEPEND) $(DEPEND_PREV)
    35         $(MAKE) -f Makefile.build PRECHECK=$(PRECHECK)
     76all: $(VERSION_DEF) $(COMMON_MAKEFILE) $(COMMON_HEADER) $(CONFIG_MAKEFILE) $(CONFIG_HEADER) $(BIN) $(DISASM)
     77        -[ -f $(DEPEND) ] && cp -a $(DEPEND) $(DEPEND_PREV)
    3678
    3779clean:
    38         rm -f $(DEPEND) $(DEPEND_PREV) $(RAW) $(BIN) $(MAP) $(JOB) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* $(ARCH_INCLUDE) $(GENARCH_INCLUDE) arch/*/_link.ld
     80        rm -f $(DEPEND) $(DEPEND_PREV) $(RAW) $(BIN) $(MAP) $(JOB) $(MAP_PREV) $(DISASM) $(DUMP) $(REAL_MAP).* $(ARCH_INCLUDE) $(GENARCH_INCLUDE) arch/*/_link.ld arch/*/include/common.h
    3981        find generic/src/ arch/*/src/ genarch/src/ test/ -name '*.o' -follow -exec rm \{\} \;
     82
     83## Common compiler flags
     84#
     85
     86DEFS = -DKERNEL -DRELEASE=$(RELEASE) "-DNAME=$(NAME)" -D__$(BITS)_BITS__ -D__$(ENDIANESS)__
     87
     88GCC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
     89        -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
     90        -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
     91        -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
     92        -Werror-implicit-function-declaration -Wwrite-strings \
     93        -Werror -pipe
     94
     95ICC_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
     96        -ffreestanding -fno-builtin -nostdlib -nostdinc -Wall -Wmissing-prototypes \
     97        -Werror-implicit-function-declaration -Werror -wd170
     98
     99SUNCC_CFLAGS = -I$(INCLUDES) -xO$(OPTIMIZATION) \
     100        -xnolib -xc99=all -features=extensions \
     101        -erroff=E_ZERO_SIZED_STRUCT_UNION
     102
     103CLANG_CFLAGS = -I$(INCLUDES) -O$(OPTIMIZATION) -imacros ../config.h \
     104        -fexec-charset=UTF-8 -fwide-exec-charset=UTF-32$(ENDIANESS) \
     105        -finput-charset=UTF-8 -ffreestanding -fno-builtin -nostdlib -nostdinc \
     106        -Wall -Wextra -Wno-unused-parameter -Wmissing-prototypes \
     107        -Werror-implicit-function-declaration -Wwrite-strings \
     108        -pipe -arch $(CLANG_ARCH)
     109
     110LFLAGS = -M
     111AFLAGS =
     112
     113-include arch/$(KARCH)/Makefile.inc
     114-include genarch/Makefile.inc
     115-include $(DEPEND)
     116
     117## The at-sign
     118#
     119# The $(ATSIGN) variable holds the ASCII character representing the at-sign
     120# ('@') used in various $(AS) constructs (e.g. @progbits). On architectures that
     121# don't use '@' for starting a comment, $(ATSIGN) is merely '@'. However, on
     122# those that do use it for starting a comment (e.g. arm32), $(ATSIGN) must be
     123# defined as the percentile-sign ('%') in the architecture-dependent
     124# Makefile.inc.
     125#
     126
     127ATSIGN ?= @
     128
     129## Cross-platform assembly to start a symtab.data section
     130#
     131
     132SYMTAB_SECTION = ".section symtab.data, \"a\", $(ATSIGN)progbits;"
     133
     134## Compilation options
     135#
     136
     137ifeq ($(COMPILER),gcc_native)
     138        CFLAGS = $(GCC_CFLAGS)
     139        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     140endif
     141
     142ifeq ($(COMPILER),gcc_cross)
     143        CFLAGS = $(GCC_CFLAGS)
     144        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     145endif
     146
     147ifeq ($(COMPILER),icc)
     148        CFLAGS = $(ICC_CFLAGS)
     149        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     150endif
     151
     152ifeq ($(COMPILER),suncc)
     153        CFLAGS = $(SUNCC_CFLAGS)
     154        DEFS += $(CONFIG_DEFS)
     155        DEPEND_DEFS = $(DEFS)
     156endif
     157
     158ifeq ($(COMPILER),clang)
     159        CFLAGS = $(CLANG_CFLAGS)
     160        DEPEND_DEFS = $(DEFS) $(CONFIG_DEFS)
     161endif
     162
     163## Generic kernel sources
     164#
     165
     166GENERIC_SOURCES = \
     167        generic/src/adt/avl.c \
     168        generic/src/adt/bitmap.c \
     169        generic/src/adt/btree.c \
     170        generic/src/adt/hash_table.c \
     171        generic/src/adt/list.c \
     172        generic/src/console/chardev.c \
     173        generic/src/console/console.c \
     174        generic/src/cpu/cpu.c \
     175        generic/src/ddi/ddi.c \
     176        generic/src/ddi/irq.c \
     177        generic/src/ddi/device.c \
     178        generic/src/debug/symtab.c \
     179        generic/src/debug/stacktrace.c \
     180        generic/src/interrupt/interrupt.c \
     181        generic/src/main/main.c \
     182        generic/src/main/kinit.c \
     183        generic/src/main/uinit.c \
     184        generic/src/main/version.c \
     185        generic/src/main/shutdown.c \
     186        generic/src/proc/program.c \
     187        generic/src/proc/scheduler.c \
     188        generic/src/proc/thread.c \
     189        generic/src/proc/task.c \
     190        generic/src/proc/the.c \
     191        generic/src/proc/tasklet.c \
     192        generic/src/syscall/syscall.c \
     193        generic/src/syscall/copy.c \
     194        generic/src/mm/buddy.c \
     195        generic/src/mm/frame.c \
     196        generic/src/mm/page.c \
     197        generic/src/mm/tlb.c \
     198        generic/src/mm/as.c \
     199        generic/src/mm/backend_anon.c \
     200        generic/src/mm/backend_elf.c \
     201        generic/src/mm/backend_phys.c \
     202        generic/src/mm/slab.c \
     203        generic/src/lib/func.c \
     204        generic/src/lib/memstr.c \
     205        generic/src/lib/sort.c \
     206        generic/src/lib/string.c \
     207        generic/src/lib/elf.c \
     208        generic/src/lib/rd.c \
     209        generic/src/printf/printf_core.c \
     210        generic/src/printf/printf.c \
     211        generic/src/printf/snprintf.c \
     212        generic/src/printf/vprintf.c \
     213        generic/src/printf/vsnprintf.c \
     214        generic/src/time/clock.c \
     215        generic/src/time/timeout.c \
     216        generic/src/time/delay.c \
     217        generic/src/preempt/preemption.c \
     218        generic/src/synch/spinlock.c \
     219        generic/src/synch/condvar.c \
     220        generic/src/synch/rwlock.c \
     221        generic/src/synch/mutex.c \
     222        generic/src/synch/semaphore.c \
     223        generic/src/synch/smc.c \
     224        generic/src/synch/waitq.c \
     225        generic/src/synch/futex.c \
     226        generic/src/smp/ipi.c \
     227        generic/src/smp/smp.c \
     228        generic/src/ipc/ipc.c \
     229        generic/src/ipc/sysipc.c \
     230        generic/src/ipc/ipcrsc.c \
     231        generic/src/ipc/irq.c \
     232        generic/src/ipc/event.c \
     233        generic/src/security/cap.c \
     234        generic/src/sysinfo/sysinfo.c
     235
     236## Kernel console support
     237#
     238
     239ifeq ($(CONFIG_KCONSOLE),y)
     240GENERIC_SOURCES += \
     241        generic/src/console/kconsole.c \
     242        generic/src/console/cmd.c
     243endif
     244
     245## Udebug interface sources
     246#
     247
     248ifeq ($(CONFIG_UDEBUG),y)
     249GENERIC_SOURCES += \
     250        generic/src/ipc/kbox.c \
     251        generic/src/udebug/udebug.c \
     252        generic/src/udebug/udebug_ops.c \
     253        generic/src/udebug/udebug_ipc.c
     254endif
     255
     256## Test sources
     257#
     258
     259ifeq ($(CONFIG_TEST),y)
     260        CFLAGS += -Itest/
     261        GENERIC_SOURCES += \
     262                test/test.c \
     263                test/atomic/atomic1.c \
     264                test/btree/btree1.c \
     265                test/avltree/avltree1.c \
     266                test/fault/fault1.c \
     267                test/mm/falloc1.c \
     268                test/mm/falloc2.c \
     269                test/mm/mapping1.c \
     270                test/mm/slab1.c \
     271                test/mm/slab2.c \
     272                test/synch/rwlock1.c \
     273                test/synch/rwlock2.c \
     274                test/synch/rwlock3.c \
     275                test/synch/rwlock4.c \
     276                test/synch/rwlock5.c \
     277                test/synch/semaphore1.c \
     278                test/synch/semaphore2.c \
     279                test/print/print1.c \
     280                test/print/print2.c \
     281                test/print/print3.c \
     282                test/print/print4.c \
     283                test/thread/thread1.c \
     284                test/sysinfo/sysinfo1.c
     285       
     286        ifeq ($(KARCH),mips32)
     287                GENERIC_SOURCES += test/debug/mips1.c
     288        else
     289                GENERIC_SOURCES += test/debug/mips1_skip.c
     290        endif
     291       
     292        ifeq ($(KARCH),ia64)
     293                GENERIC_SOURCES += test/mm/purge1.c
     294        else
     295                GENERIC_SOURCES += test/mm/purge1_skip.c
     296        endif
     297       
     298        ifeq ($(CONFIG_FPU),y)
     299                ifeq ($(KARCH),ia32)
     300                        TEST_FPU1 = y
     301                        TEST_SSE1 = y
     302                        GENERIC_SOURCES += test/fpu/fpu1_x86.c
     303                endif
     304               
     305                ifeq ($(KARCH),amd64)
     306                        TEST_FPU1 = y
     307                        TEST_SSE1 = y
     308                        GENERIC_SOURCES += test/fpu/fpu1_x86.c
     309                endif
     310               
     311                ifeq ($(KARCH),ia64)
     312                        TEST_FPU1 = y
     313                        GENERIC_SOURCES += test/fpu/fpu1_ia64.c
     314                endif
     315               
     316                ifeq ($(KARCH),mips32)
     317                        TEST_MIPS2 = y
     318                endif
     319        endif
     320       
     321        ifneq ($(TEST_FPU1),y)
     322                GENERIC_SOURCES += test/fpu/fpu1_skip.c
     323        endif
     324       
     325        ifeq ($(TEST_SSE1),y)
     326                GENERIC_SOURCES += test/fpu/sse1.c
     327        else
     328                GENERIC_SOURCES += test/fpu/sse1_skip.c
     329        endif
     330       
     331        ifeq ($(TEST_MIPS2),y)
     332                GENERIC_SOURCES += test/fpu/mips2.c
     333        else
     334                GENERIC_SOURCES += test/fpu/mips2_skip.c
     335        endif
     336       
     337endif
     338
     339GENERIC_OBJECTS := $(addsuffix .o,$(basename $(GENERIC_SOURCES)))
     340ARCH_OBJECTS := $(addsuffix .o,$(basename $(ARCH_SOURCES)))
     341GENARCH_OBJECTS := $(addsuffix .o,$(basename $(GENARCH_SOURCES)))
     342
     343ifeq ($(CONFIG_SYMTAB),y)
     344        SYMTAB_OBJECTS := generic/src/debug/real_map.o
     345else
     346        SYMTAB_OBJECTS :=
     347endif
     348
     349
     350
     351$(BIN): $(RAW)
     352        $(OBJCOPY) -O $(BFD) $< $@
     353
     354$(DISASM): $(RAW)
     355        $(OBJDUMP) -d $< > $@
     356
     357$(RAW): $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(SYMTAB_OBJECTS)
     358        $(LD) -T $(LINK) $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SYMTAB_OBJECTS) -o $@ -Map $(MAP)
     359
     360$(LINK): $(LINK).in $(DEPEND)
     361        $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -D__LINKER__ -E -x c $< | grep -v "^\#" > $@
     362
     363%.o: %.S $(DEPEND)
     364        $(GCC) $(DEFS) $(GCC_CFLAGS) -D__ASM__ -c $< -o $@
     365ifeq ($(PRECHECK),y)
     366        $(JOBFILE) $(JOB) $< $@ as asm/preproc $(DEFS) $(GCC_CFLAGS) -D__ASM__
     367endif
     368
     369%.o: %.s $(DEPEND)
     370        $(AS) $(AFLAGS) $< -o $@
     371ifeq ($(PRECHECK),y)
     372        $(JOBFILE) $(JOB) $< $@ as asm $(DEFS) $(CFLAGS) $(EXTRA_FLAGS)
     373endif
     374
     375#
     376# The FPU tests are the only objects for which we allow the compiler to generate
     377# FPU instructions.
     378#
     379
     380test/fpu/%.o: test/fpu/%.c $(DEPEND)
     381        $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) -c $< -o $@
     382ifeq ($(PRECHECK),y)
     383        $(JOBFILE) $(JOB) $< $@ cc test $(DEFS) $(CFLAGS) $(EXTRA_FLAGS)
     384endif
     385
     386#
     387# Ordinary objects.
     388#
     389
     390%.o: %.c $(DEPEND)
     391        $(CC) $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS) -c $< -o $@
     392ifeq ($(PRECHECK),y)
     393        $(JOBFILE) $(JOB) $< $@ cc core $(DEFS) $(CFLAGS) $(EXTRA_FLAGS) $(FPU_NO_CFLAGS)
     394endif
     395
     396$(REAL_MAP).o: $(REAL_MAP).bin
     397        echo $(SYMTAB_SECTION)" .incbin \"$<\"" | $(AS) $(AFLAGS) -o $@
     398
     399$(REAL_MAP).bin: $(LINK) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS)
     400        echo $(SYMTAB_SECTION) | $(AS) $(AFLAGS) -o $(EMPTY_MAP)
     401        $(LD) -T $(LINK) $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(EMPTY_MAP) -o $@ -Map $(MAP_PREV)
     402        $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
     403        $(GENMAP) $(MAP_PREV) $(DUMP) $@
     404       
     405        # Do it once again, this time to get correct even the symbols
     406        # on architectures that have bss after symtab
     407       
     408        echo $(SYMTAB_SECTION)" .incbin \"$@\"" | $(AS) $(AFLAGS) -o $(SIZEOK_MAP)
     409        $(LD) -T $(LINK) $(LFLAGS) $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) $(EXTRA_OBJECTS) $(SIZEOK_MAP) -o $@ -Map $(MAP_PREV)
     410        $(OBJDUMP) -t $(ARCH_OBJECTS) $(GENARCH_OBJECTS) $(GENERIC_OBJECTS) > $(DUMP)
     411        $(GENMAP) $(MAP_PREV) $(DUMP) $@
     412
     413$(DEPEND): $(ARCH_INCLUDE) $(GENARCH_INCLUDE) $(COMMON_HEADER_ARCH)
     414        makedepend -f - -- $(DEPEND_DEFS) $(CFLAGS) -- $(ARCH_SOURCES) $(GENARCH_SOURCES) $(GENERIC_SOURCES) > $@ 2> /dev/null
     415        -[ -f $(DEPEND_PREV) ] && diff -q $(DEPEND_PREV) $@ && mv -f $(DEPEND_PREV) $@
     416
     417$(ARCH_INCLUDE): arch/$(KARCH)/include/
     418        ln -sfn ../../$< $@
     419
     420$(GENARCH_INCLUDE): genarch/include/
     421        ln -sfn ../../$< $@
     422
     423$(COMMON_HEADER_ARCH): $(COMMON_HEADER)
     424        ln -sfn ../../../$< $@
  • kernel/arch/abs32le/Makefile.inc

    rfacebd56 re2b73d4f  
    2727#
    2828
    29 ## Toolchain configuration
    30 #
    31 
    3229BFD = binary
    3330
    3431ifeq ($(COMPILER),gcc_cross)
    35         TOOLCHAIN_DIR = $(CROSS_PREFIX)/$(CROSS_TARGET)
    36        
    3732        ifeq ($(CROSS_TARGET),arm32)
    38                 TARGET = arm-linux-gnu
    3933                ATSIGN = %
    4034        endif
    4135       
    42         ifeq ($(CROSS_TARGET),ia32)
    43                 TARGET = i686-pc-linux-gnu
    44         endif
    45        
    4636        ifeq ($(CROSS_TARGET),mips32)
    47                 TARGET = mipsel-linux-gnu
    4837                GCC_CFLAGS += -mno-abicalls
    4938        endif
  • kernel/arch/amd64/Makefile.inc

    rfacebd56 re2b73d4f  
    2727#
    2828
    29 ## Toolchain configuration
    30 #
    31 
    3229BFD_NAME = elf64-x86-64
    3330BFD_ARCH = i386:x86-64
    3431BFD = binary
    35 TARGET = amd64-linux-gnu
    3632CLANG_ARCH = x86_64
    37 TOOLCHAIN_DIR = $(CROSS_PREFIX)/amd64
    3833
    3934FPU_NO_CFLAGS = -mno-sse -mno-sse2
  • kernel/arch/arm32/Makefile.inc

    rfacebd56 re2b73d4f  
    2727#
    2828
    29 ## Toolchain configuration
    30 #
    31 
    3229BFD_NAME = elf32-littlearm
    3330BFD_ARCH = arm
    3431BFD = binary
    35 TARGET = arm-linux-gnu
    36 TOOLCHAIN_DIR = $(CROSS_PREFIX)/arm32
    3732
    3833ATSIGN = %
  • kernel/arch/arm32/src/dummy.S

    rfacebd56 re2b73d4f  
    11#
    2 # Copyright (c) 2007 Michal Kebry, Pavel Jancik, Petr Stepan
     2# Copyright (c) 2007 Michal Kebrt, Pavel Jancik, Petr Stepan
    33# All rights reserved.
    44#
  • kernel/arch/ia32/Makefile.inc

    rfacebd56 re2b73d4f  
    2727#
    2828
    29 ## Toolchain configuration
    30 #
    31 
    3229BFD_NAME = elf32-i386
    3330BFD_ARCH = i386
    3431BFD = binary
    35 TARGET = i686-pc-linux-gnu
    3632CLANG_ARCH = i386
    37 TOOLCHAIN_DIR = $(CROSS_PREFIX)/ia32
    3833
    3934BITS = 32
     
    5348        SUNCC_CFLAGS += -xarch=ssea
    5449endif
     50
    5551ifeq ($(PROCESSOR),athlon_mp)
    5652        CMN2 = -march=athlon-mp
    5753        SUNCC_CFLAGS += xarch=ssea
    5854endif
     55
    5956ifeq ($(PROCESSOR),pentium3)
    6057        CMN2 = -march=pentium3
    6158        SUNCC_CFLAGS += -xarch=sse
    6259endif
     60
    6361ifeq ($(PROCESSOR),pentium4)
    6462        CMN2 = -march=pentium4
    6563        SUNCC_CFLAGS += -xarch=sse2
    6664endif
     65
    6766ifeq ($(PROCESSOR),core)
    6867        CMN2 = -march=prescott
  • kernel/arch/ia32/include/types.h

    rfacebd56 re2b73d4f  
    2727 */
    2828
    29 /** @addtogroup ia32   
     29/** @addtogroup ia32
    3030 * @{
    3131 */
     
    3636#define KERN_ia32_TYPES_H_
    3737
    38 typedef signed char int8_t;
    39 typedef signed short int16_t;
    40 typedef signed long int32_t;
    41 typedef signed long long int64_t;
    42 
    43 typedef unsigned char uint8_t;
    44 typedef unsigned short uint16_t;
    45 typedef unsigned long uint32_t;
    46 typedef unsigned long long uint64_t;
     38#include <arch/common.h>
    4739
    4840typedef uint32_t size_t;
  • kernel/arch/ia64/Makefile.inc

    rfacebd56 re2b73d4f  
    2727#
    2828
    29 ## Toolchain configuration
    30 #
    31 
    3229BFD_NAME = elf64-little
    3330BFD_ARCH = ia64-elf64
    34 TARGET = ia64-pc-linux-gnu
    35 TOOLCHAIN_DIR = $(CROSS_PREFIX)/ia64
    3631
    3732CMN1 = -mconstant-gp -fno-unwind-tables -mfixed-range=f32-f127
  • kernel/arch/mips32/Makefile.inc

    rfacebd56 re2b73d4f  
    2727#
    2828
    29 ## Toolchain configuration
    30 #
    31 
    3229BFD_ARCH = mips
    3330BFD = binary
    34 TARGET = mipsel-linux-gnu
    35 TOOLCHAIN_DIR = $(CROSS_PREFIX)/mips32
    36 
    3731GCC_CFLAGS += -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3
    3832
     
    4842ifeq ($(MACHINE),bgxemul)
    4943        BFD_NAME = elf32-tradbigmips
    50         TOOLCHAIN_DIR = $(CROSS_PREFIX)/mips32eb
    51         TARGET = mips-linux-gnu
    5244        ENDIANESS = BE
    5345        GCC_CFLAGS += -D__BE__
  • kernel/arch/ppc32/Makefile.inc

    rfacebd56 re2b73d4f  
    2727#
    2828
    29 ## Toolchain configuration
    30 #
    31 
    3229BFD_NAME = elf32-powerpc
    3330BFD_ARCH = powerpc:common
    3431BFD = binary
    35 TARGET = ppc-linux-gnu
    36 TOOLCHAIN_DIR = $(CROSS_PREFIX)/ppc32
    3732
    3833GCC_CFLAGS += -mcpu=powerpc -msoft-float -m32
  • kernel/arch/sparc64/Makefile.inc

    rfacebd56 re2b73d4f  
    2727#
    2828
    29 ## Toolchain configuration
    30 #
    31 
    3229BFD_NAME = elf64-sparc
    3330BFD_ARCH = sparc
    3431BFD = binary
    35 TARGET = sparc64-linux-gnu
    36 TOOLCHAIN_DIR = $(CROSS_PREFIX)/sparc64
    3732
    3833GCC_CFLAGS += -m64 -mcpu=ultrasparc
  • kernel/tools/genmap.py

    rfacebd56 re2b73d4f  
    11#!/usr/bin/env python
     2#
     3# Copyright (c) 2006 Ondrej Palkovsky
     4# All rights reserved.
     5#
     6# Redistribution and use in source and binary forms, with or without
     7# modification, are permitted provided that the following conditions
     8# are met:
     9#
     10# - Redistributions of source code must retain the above copyright
     11#   notice, this list of conditions and the following disclaimer.
     12# - Redistributions in binary form must reproduce the above copyright
     13#   notice, this list of conditions and the following disclaimer in the
     14#   documentation and/or other materials provided with the distribution.
     15# - The name of the author may not be used to endorse or promote products
     16#   derived from this software without specific prior written permission.
     17#
     18# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     19# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     20# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     21# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     22# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     23# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     24# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     25# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     26# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     27# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     28#
     29
     30"""
     31Create binary symbol map out of linker map file
     32"""
    233
    334import sys
     
    536import re
    637
    7 MAXSTRING=63
    8 symtabfmt = "<Q%ds" % (MAXSTRING+1)
    9 
     38MAXSTRING = 63
     39symtabfmt = "<Q%ds" % (MAXSTRING + 1)
    1040
    1141funcline = re.compile(r'([0-9a-f]+)\s+[lg]\s+.\s+\.text\s+([0-9a-f]+)\s+(.*)$')
     
    1343dataline = re.compile(r'([0-9a-f]+)\s+[lg]\s+[a-zA-Z]\s+\.data\s+([0-9a-f]+)\s+(.*)$')
    1444fileexp = re.compile(r'([^\s]+):\s+file format')
     45startfile = re.compile(r'\.(text|bss|data)\s+(0x[0-9a-f]+)\s+0x[0-9a-f]+\s+(.*)$')
     46
    1547def read_obdump(inp):
    16     funcs = {}
    17     data = {}
    18     bss ={}
    19     fname = ''
    20     for line in inp:
    21         line = line.strip()
    22         res = funcline.match(line)
    23         if res:
    24             funcs.setdefault(fname,[]).append((int(res.group(1),16),
    25                                                res.group(3)))
    26             continue
    27         res = bssline.match(line)
    28         if res:
    29             start = int(res.group(1),16)
    30             end = int(res.group(2),16)
    31             if end:
    32                 bss.setdefault(fname,[]).append((start,res.group(3)))
    33         res = dataline.match(line)
    34         if res:
    35             start = int(res.group(1),16)
    36             end = int(res.group(2),16)
    37             if end:
    38                 data.setdefault(fname,[]).append((start,res.group(3)))
    39         res = fileexp.match(line)
    40         if res:
    41             fname = res.group(1)
    42             continue
     48        "Parse input"
     49       
     50        funcs = {}
     51        data = {}
     52        bss = {}
     53        fname = ''
     54       
     55        for line in inp:
     56                line = line.strip()
     57                res = funcline.match(line)
     58                if (res):
     59                        funcs.setdefault(fname, []).append((int(res.group(1), 16), res.group(3)))
     60                        continue
     61               
     62                res = bssline.match(line)
     63                if (res):
     64                        start = int(res.group(1), 16)
     65                        end = int(res.group(2), 16)
     66                        if (end):
     67                                bss.setdefault(fname, []).append((start, res.group(3)))
     68               
     69                res = dataline.match(line)
     70                if (res):
     71                        start = int(res.group(1), 16)
     72                        end = int(res.group(2), 16)
     73                        if (end):
     74                                data.setdefault(fname, []).append((start, res.group(3)))
     75               
     76                res = fileexp.match(line)
     77                if (res):
     78                        fname = res.group(1)
     79                        continue
     80       
     81        return {'text' : funcs, 'bss' : bss, 'data' : data}
    4382
    44     return {
    45         'text' : funcs,
    46         'bss' : bss,
    47         'data' : data
    48         }
    49 
    50 startfile = re.compile(r'\.(text|bss|data)\s+(0x[0-9a-f]+)\s+0x[0-9a-f]+\s+(.*)$')
    5183def generate(kmapf, obmapf, out):
    52     obdump = read_obdump(obmapf)   
    53 
    54     def sorter(x,y):
    55         return cmp(x[0],y[0])
    56 
    57     for line in kmapf:
    58         line = line.strip()
    59         res = startfile.match(line)
    60 
    61         if res and obdump[res.group(1)].has_key(res.group(3)):
    62             offset = int(res.group(2),16)
    63             fname = res.group(3)
    64             symbols = obdump[res.group(1)][fname]
    65             symbols.sort(sorter)
    66             for addr,symbol in symbols:               
    67                 value = fname + ':' + symbol
    68                 data = struct.pack(symtabfmt,addr+offset,value[:MAXSTRING])
    69                 out.write(data)
    70                
    71     out.write(struct.pack(symtabfmt,0,''))
     84        "Generate output file"
     85       
     86        obdump = read_obdump(obmapf)
     87       
     88        def sorter(x,y):
     89                return cmp(x[0],y[0])
     90       
     91        for line in kmapf:
     92                line = line.strip()
     93                res = startfile.match(line)
     94               
     95                if ((res) and (obdump[res.group(1)].has_key(res.group(3)))):
     96                        offset = int(res.group(2), 16)
     97                        fname = res.group(3)
     98                        symbols = obdump[res.group(1)][fname]
     99                        symbols.sort(sorter)
     100                        for addr, symbol in symbols:
     101                                value = fname + ':' + symbol
     102                                data = struct.pack(symtabfmt, addr + offset, value[:MAXSTRING])
     103                                out.write(data)
     104                       
     105        out.write(struct.pack(symtabfmt, 0, ''))
    72106
    73107def main():
    74     if len(sys.argv) != 4:
    75         print "Usage: %s <kernel.map> <nm dump> <output.bin>" % sys.argv[0]
    76         sys.exit(1)
    77 
    78     kmapf = open(sys.argv[1],'r')
    79     obmapf = open(sys.argv[2],'r')
    80     out = open(sys.argv[3],'w')
    81     generate(kmapf,obmapf,out)
    82     kmapf.close()
    83     obmapf.close()
    84     out.close()
     108        if (len(sys.argv) != 4):
     109                print "Usage: %s <kernel.map> <nm dump> <output.bin>" % sys.argv[0]
     110                return 1
     111       
     112        kmapf = open(sys.argv[1], 'r')
     113        obmapf = open(sys.argv[2], 'r')
     114        out = open(sys.argv[3], 'w')
     115       
     116        generate(kmapf, obmapf, out)
     117       
     118        kmapf.close()
     119        obmapf.close()
     120        out.close()
    85121
    86122if __name__ == '__main__':
    87     main()
     123        sys.exit(main())
Note: See TracChangeset for help on using the changeset viewer.