Subversion Repositories HelenOS

Compare Revisions

No changes between revisions

Ignore whitespace Rev 3023 → Rev 3022

/trunk/boot/arch/ppc32/loader/_link.ld.in
File deleted
/trunk/boot/arch/ppc32/loader/Makefile
32,9 → 32,6
## Toolchain configuration
#
 
BFD = elf32-powerpc
BFD_NAME = elf32-powerpc
BFD_ARCH = powerpc:common
TARGET = ppc-linux-gnu
TOOLCHAIN_DIR = /usr/local/ppc/bin
 
75,7 → 72,6
SOURCES = \
main.c \
ofwarch.c \
_components.c \
../../../genarch/ofw.c \
../../../generic/printf.c \
asm.S \
112,10 → 108,10
-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null
 
clean:
-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend
-rm -f _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend
 
_components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS)
../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD) $(BFD_ARCH) 4096 $(COMPONENTS)
_components.h _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS)
./pack $(OBJCOPY) $(COMPONENTS)
 
%.o: %.S
$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
/trunk/boot/arch/ppc32/loader/main.c
96,10 → 96,10
{
version_print();
component_t components[COMPONENTS];
init_components(components);
init_components();
unsigned int i;
for (i = 0; i < COMPONENTS; i++)
check_align(components[i].start, components[i].name);
/trunk/boot/arch/ppc32/loader/pack
0,0 → 1,115
#! /bin/sh
 
#
# Copyright (C) 2006 Martin Decky
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# - The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
 
[ "$#" -lt 1 ] && exit 1
 
OBJCOPY="$1"
LINK="_link.ld"
HEADER="_components.h"
 
shift
 
echo 'OUTPUT_FORMAT("elf32-powerpc")
OUTPUT_ARCH(powerpc:common)
ENTRY(start)
 
SECTIONS {
.boot 0x10000000: AT (0) {
*(BOOTSTRAP);
*(REALMODE);
*(.text);
*(.rodata);
*(.rodata.*);
*(.data); /* initialized data */
*(.sdata);
*(.sdata2);
*(.sbss);
*(.bss); /* uninitialized static variables */
*(COMMON); /* global variables */' > "$LINK"
 
echo '#ifndef ___COMPONENTS_H__
#define ___COMPONENTS_H__
 
typedef struct {
char *name;
void *start;
void *end;
unsigned int size;
} component_t;' > "$HEADER"
 
COUNT="0"
DATA=""
 
for TASK in "$@" ; do
BASENAME="`basename "$TASK" | sed 's/^\(.*\)\.[^.]*$/\1/'`"
OBJECT="${BASENAME}.o"
SYMBOL="`echo "_binary_$TASK" | tr "./" "__"`"
MACRO="`echo "$BASENAME" | tr [:lower:] [:upper:]`"
echo "$TASK -> $OBJECT"
echo "
. = ALIGN(4096);
*(.${BASENAME}_image);" >> "$LINK"
echo "
extern int ${SYMBOL}_start;
extern int ${SYMBOL}_end;
 
#define ${MACRO}_START ((void *) &${SYMBOL}_start)
#define ${MACRO}_END ((void *) &${SYMBOL}_end)
#define ${MACRO}_SIZE ((unsigned int) ${MACRO}_END - (unsigned int) ${MACRO}_START)" >> "$HEADER"
"$OBJCOPY" -I binary -O elf32-powerpc -B powerpc:common --rename-section ".data=.${BASENAME}_image" "$TASK" "$OBJECT"
DATA="${DATA}
components[$COUNT].name = \"${BASENAME}\";
components[$COUNT].start = ${MACRO}_START;
components[$COUNT].end = ${MACRO}_END;
components[$COUNT].size = ${MACRO}_SIZE;";
COUNT="`expr "$COUNT" + 1`"
done
 
echo ' }
}' >> "$LINK"
 
echo "
#define COMPONENTS $COUNT
 
component_t components[COMPONENTS];
 
static void init_components(void)
{
$DATA
}
 
#endif
" >> "$HEADER"
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/trunk/boot/arch/ppc64/loader/_link.ld.in
File deleted
/trunk/boot/arch/ppc64/loader/Makefile
32,9 → 32,6
## Toolchain configuration
#
 
BFD = elf64-powerpc
BFD_NAME = elf64-powerpc
BFD_ARCH = powerpc:common64
TARGET = ppc64-linux-gnu
TOOLCHAIN_DIR = /usr/local/ppc64/bin
 
75,7 → 72,6
SOURCES = \
main.c \
ofwarch.c \
_components.c \
../../../genarch/ofw.c \
../../../generic/printf.c \
asm.S \
112,10 → 108,10
-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null
 
clean:
-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend
-rm -f _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend
 
_components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS)
../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD) $(BFD_ARCH) 4096 $(COMPONENTS)
_components.h _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS)
./pack $(OBJCOPY) $(COMPONENTS)
 
%.o: %.S
$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
/trunk/boot/arch/ppc64/loader/main.c
96,9 → 96,8
{
version_print();
component_t components[COMPONENTS];
init_components(components);
init_components();
unsigned int i;
for (i = 0; i < COMPONENTS; i++)
/trunk/boot/arch/ppc64/loader/pack
0,0 → 1,124
#! /bin/sh
 
#
# Copyright (C) 2006 Martin Decky
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# - The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
 
[ "$#" -lt 1 ] && exit 1
 
OBJCOPY="$1"
LINK="_link.ld"
HEADER="_components.h"
 
shift
 
echo 'OUTPUT_FORMAT("elf64-powerpc")
OUTPUT_ARCH(powerpc:common64)
ENTRY(start)
 
SECTIONS {
.boot 0x0000000010000000: AT (0) {
*(BOOTSTRAP);
*(REALMODE);
*(.text);
*(.toc);
*(.opd);
*(.rodata);
*(.rodata.*);
*(.data); /* initialized data */
*(.sdata);
*(.sdata2);
*(.sbss);
*(.bss); /* uninitialized static variables */
*(COMMON); /* global variables */
. = ALIGN(4096);
*(.kernel_image);' > "$LINK"
 
echo '#ifndef ___COMPONENTS_H__
#define ___COMPONENTS_H__
 
typedef struct {
char *name;
void *start;
void *end;
unsigned long size;
} component_t;' > "$HEADER"
 
COUNT="0"
DATA=""
 
for TASK in "$@" ; do
BASENAME="`basename "$TASK" | sed 's/^\(.*\)\.[^.]*$/\1/'`"
OBJECT="${BASENAME}.o"
SYMBOL="`echo "_binary_$TASK" | tr "./" "__"`"
MACRO="`echo "$BASENAME" | tr [:lower:] [:upper:]`"
echo "$TASK -> $OBJECT"
echo "
. = ALIGN(4096);
*(.${BASENAME}_image);" >> "$LINK"
echo "
extern int ${SYMBOL}_start;
extern int ${SYMBOL}_end;
 
#define ${MACRO}_START ((void *) &${SYMBOL}_start)
#define ${MACRO}_END ((void *) &${SYMBOL}_end)
#define ${MACRO}_SIZE ((unsigned long) ${MACRO}_END - (unsigned long) ${MACRO}_START)" >> "$HEADER"
"$OBJCOPY" -I binary -O elf64-powerpc -B powerpc:common64 --rename-section ".data=.${BASENAME}_image" "$TASK" "$OBJECT"
DATA="${DATA}
components[$COUNT].name = \"${BASENAME}\";
components[$COUNT].start = ${MACRO}_START;
components[$COUNT].end = ${MACRO}_END;
components[$COUNT].size = ${MACRO}_SIZE;";
COUNT="`expr "$COUNT" + 1`"
done
 
echo '}
 
/DISCARD/ : {
*(*);
}
}' >> "$LINK"
 
echo "
#define COMPONENTS $COUNT
 
component_t components[COMPONENTS];
 
static void init_components(void)
{
$DATA
}
 
#endif
" >> "$HEADER"
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/trunk/boot/arch/mips32/loader/_link.ld.in
File deleted
/trunk/boot/arch/mips32/loader/Makefile
32,14 → 32,6
## Toolchain configuration
#
 
ifeq ($(IMAGE),binary)
BFD = binary
endif
ifeq ($(IMAGE),ecoff)
BFD = ecoff-littlemips
endif
BFD_NAME = elf32-tradlittlemips
BFD_ARCH = mips
TARGET = mipsel-linux-gnu
TOOLCHAIN_DIR = /usr/local/mipsel/bin
 
80,7 → 72,6
SOURCES = \
main.c \
msim.c \
_components.c \
../../../generic/printf.c \
asm.S \
boot.S
116,10 → 107,10
-makedepend $(DEFS) $(CFLAGS) -f - $(SOURCES) > Makefile.depend 2> /dev/null
 
clean:
-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend
-rm -f _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend
 
_components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS)
../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD) $(BFD_ARCH) 4096 $(COMPONENTS)
_components.h _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS)
./pack $(IMAGE) $(OBJCOPY) $(COMPONENTS)
 
%.o: %.S
$(CC) $(DEFS) $(CFLAGS) -D__ASM__ -c $< -o $@
/trunk/boot/arch/mips32/loader/main.c
59,10 → 59,9
version_print();
component_t components[COMPONENTS];
bootinfo_t bootinfo;
init_components(components);
bootinfo_t bootinfo;
printf("\nMemory statistics\n");
printf(" kernel entry point at %L\n", KERNEL_VIRTUAL_ADDRESS);
printf(" %L: boot info structure\n", &bootinfo);
/trunk/boot/arch/mips32/loader/pack
0,0 → 1,126
#! /bin/sh
 
#
# Copyright (C) 2006 Martin Decky
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# - Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# - The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
 
[ "$#" -lt 1 ] && exit 1
 
case "$1" in
"binary")
BFD="binary"
;;
"ecoff")
BFD="ecoff-littlemips"
;;
*)
echo "Undefined image format" >&1
exit 1
;;
esac
 
OBJCOPY="$2"
LINK="_link.ld"
HEADER="_components.h"
 
shift 2
 
echo "OUTPUT_FORMAT(\"${BFD}\")
ENTRY(start)
 
SECTIONS {
.boot 0xbfc00000: AT (0) {
*(BOOTSTRAP);
*(.text);
*(.rodata);
*(.rodata.*);
*(.data); /* initialized data */
*(.sdata);
*(.sdata2);
*(.sbss);
*(.scommon);
*(.bss); /* uninitialized static variables */
*(COMMON); /* global variables */
*(.reginfo);" > "$LINK"
 
echo '#ifndef ___COMPONENTS_H__
#define ___COMPONENTS_H__
 
typedef struct {
char *name;
void *start;
void *end;
unsigned int size;
} component_t;' > "$HEADER"
 
COUNT="0"
DATA=""
 
for TASK in "$@" ; do
BASENAME="`basename "$TASK" | sed 's/^\(.*\)\.[^.]*$/\1/'`"
OBJECT="${BASENAME}.o"
SYMBOL="`echo "_binary_$TASK" | tr "./" "__"`"
MACRO="`echo "$BASENAME" | tr [:lower:] [:upper:]`"
echo "$TASK -> $OBJECT"
echo "
. = ALIGN(4096);
*(.${BASENAME}_image);" >> "$LINK"
echo "
extern int ${SYMBOL}_start;
extern int ${SYMBOL}_end;
 
#define ${MACRO}_START ((void *) &${SYMBOL}_start)
#define ${MACRO}_END ((void *) &${SYMBOL}_end)
#define ${MACRO}_SIZE ((unsigned int) ${MACRO}_END - (unsigned int) ${MACRO}_START)" >> "$HEADER"
"$OBJCOPY" -I binary -O elf32-tradlittlemips -B mips --rename-section ".data=.${BASENAME}_image" "$TASK" "$OBJECT"
DATA="${DATA}
components[$COUNT].name = \"${BASENAME}\";
components[$COUNT].start = ${MACRO}_START;
components[$COUNT].end = ${MACRO}_END;
components[$COUNT].size = ${MACRO}_SIZE;";
COUNT="`expr "$COUNT" + 1`"
done
 
echo ' }
}' >> "$LINK"
 
echo "
#define COMPONENTS $COUNT
 
static void init_components(component_t components[])
{
$DATA
}
 
#endif
" >> "$HEADER"
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/trunk/boot/tools/pack.py
File deleted
Property changes:
Deleted: svn:executable
-*
\ No newline at end of property