Index: boot/arch/arm32/loader/Makefile
===================================================================
--- boot/arch/arm32/loader/Makefile	(revision 136edca07dac4855f2401e71778a4078795a3216)
+++ boot/arch/arm32/loader/Makefile	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -33,5 +33,4 @@
 #
 
-BFD = elf32-littlearm
 BFD_NAME = elf32-littlearm
 BFD_ARCH = arm
@@ -112,6 +111,6 @@
 	-rm -f _components.h _components.c _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 _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) _link.ld.in
+	../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 4096 "unsigned int" $(COMPONENTS)
 
 %.o: %.S
Index: boot/arch/arm32/loader/_link.ld.in
===================================================================
--- boot/arch/arm32/loader/_link.ld.in	(revision 136edca07dac4855f2401e71778a4078795a3216)
+++ boot/arch/arm32/loader/_link.ld.in	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -1,2 +1,6 @@
+OUTPUT_FORMAT("elf32-littlearm")
+ENTRY(start)
+
+SECTIONS {
 	.boot 0x0: AT (0) {
 		*(BOOTSTRAP);
@@ -16,2 +20,5 @@
 		. = 0x4000;
 		*(PT);			/* page table placed at 0x4000 */
+[[COMPONENTS]]
+	}
+}
Index: boot/arch/ia64/loader/Makefile
===================================================================
--- boot/arch/ia64/loader/Makefile	(revision 136edca07dac4855f2401e71778a4078795a3216)
+++ boot/arch/ia64/loader/Makefile	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -33,4 +33,6 @@
 #
 
+BFD_NAME = elf64-ia64-little
+BFD_ARCH = ia64
 TARGET = ia64-pc-linux-gnu
 TOOLCHAIN_DIR = /usr/local/ia64/bin
@@ -78,4 +80,5 @@
 	../../../generic/string.c \
 	../../../genarch/balloc.c \
+	_components.c \
 	asm.S \
 	boot.S
@@ -96,5 +99,4 @@
 	$(USPACEDIR)/app/klog/klog
 
-
 OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
 COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS))))
@@ -106,5 +108,4 @@
 -include Makefile.depend
 
-
 hello.efi: image.boot
 	make -C gefi/HelenOS PREFIX=$(GEFI_PREFIX)
@@ -114,5 +115,5 @@
 
 image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS)
-	$(LD) -Map boot.map -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) -o $@
+	$(LD) -Map image.map -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) -o $@
 
 depend:
@@ -120,9 +121,9 @@
 
 clean:
-	-rm -f _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot boot.disasm Makefile.depend
+	-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot image.map image.disasm Makefile.depend
 	make -C gefi/HelenOS clean
 
-_components.h _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS)
-	./pack $(IMAGE) $(OBJCOPY) $(COMPONENTS)
+_components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) _link.ld.in
+	../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 16384 "unsigned long" $(COMPONENTS)
 
 %.o: %.S
@@ -133,3 +134,3 @@
 
 disasm: image.boot
-	$(OBJDUMP) -d image.boot > boot.disasm
+	$(OBJDUMP) -d image.boot > image.disasm
Index: boot/arch/ia64/loader/_link.ld.in
===================================================================
--- boot/arch/ia64/loader/_link.ld.in	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
+++ boot/arch/ia64/loader/_link.ld.in	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -0,0 +1,26 @@
+OUTPUT_FORMAT("elf64-ia64-little")
+ENTRY(start)
+
+SECTIONS {
+	.boot 0x4400000: AT (0x4400000) {
+		*(BOOTSTRAP);
+[[COMPONENTS]]		
+		. = ALIGN (16384);
+		*(.text);
+		*(.rodata);
+		*(.rodata.*);
+		*(.data);               /* initialized data */
+		_got = . ;
+		*(.got .got.*);               
+		*(.sdata);
+		*(.sdata2);
+		*(.sbss);
+		*(.bss);                /* uninitialized static variables */
+		*(COMMON);
+	}
+	
+	/DISCARD/ : {
+		*(.comment);
+		*(.note*);
+	}
+}
Index: ot/arch/ia64/loader/pack
===================================================================
--- boot/arch/ia64/loader/pack	(revision 136edca07dac4855f2401e71778a4078795a3216)
+++ 	(revision )
@@ -1,121 +1,0 @@
-#! /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-ia64-little")
-ENTRY(start)
-
-SECTIONS {
-	.boot 0x4400000: AT (0x4400000) {
-		*(BOOTSTRAP);
-		
-		. = ALIGN (0x4000);
-		
-' > "$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 "
-		*(.${BASENAME}_image);
-		. = ALIGN (0x4000);" >> "$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-ia64-little -B ia64 --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 '		
-		*(.text);
-		*(.rodata);
-		*(.rodata.*);
-		*(.data);               /* initialized data */
-		_got = . ;
-		*(.got .got.*);               
-		*(.sdata);
-		*(.sdata2);
-		*(.sbss);
-		*(.bss);                /* uninitialized static variables */
-		*(COMMON);' >> "$LINK"
-
-echo '	}
-	/DISCARD/ : {
-		*(.comment);
-		*(.note*);
-	}
-}' >> "$LINK"
-
-echo "
-#define COMPONENTS $COUNT
-
-static void init_components(component_t components[])
-{
-$DATA
-}
-
-#endif
-" >> "$HEADER"
Index: boot/arch/mips32/loader/Makefile
===================================================================
--- boot/arch/mips32/loader/Makefile	(revision 136edca07dac4855f2401e71778a4078795a3216)
+++ boot/arch/mips32/loader/Makefile	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -34,8 +34,8 @@
 
 ifeq ($(IMAGE),binary)
-	BFD = binary
+	LD_IN = binary
 endif
 ifeq ($(IMAGE),ecoff)
-	BFD = ecoff-littlemips
+	LD_IN = ecoff
 endif
 BFD_NAME = elf32-tradlittlemips
@@ -109,8 +109,11 @@
 
 clean:
-	-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend
+	-rm -f _components.h _components.c _link.ld _link.ld.in $(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 _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) _link.ld.in
+	../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 4096 "unsigned int" $(COMPONENTS)
+
+_link.ld.in: _link.ld.in.$(LD_IN)
+	cp $< $@
 
 %.o: %.S
Index: ot/arch/mips32/loader/_link.ld.in
===================================================================
--- boot/arch/mips32/loader/_link.ld.in	(revision 136edca07dac4855f2401e71778a4078795a3216)
+++ 	(revision )
@@ -1,14 +1,0 @@
-	.boot 0xbfc00000: AT (0) {
-		*(BOOTSTRAP);
-		*(.text);
-		
-		*(.rodata);
-		*(.rodata.*);
-		*(.data);		/* initialized data */
-		*(.sdata);
-		*(.sdata2);
-		*(.sbss);
-		*(.scommon);
-		*(.bss);		/* uninitialized static variables */	
-		*(COMMON); 		/* global variables */
-		*(.reginfo);
Index: boot/arch/mips32/loader/_link.ld.in.binary
===================================================================
--- boot/arch/mips32/loader/_link.ld.in.binary	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
+++ boot/arch/mips32/loader/_link.ld.in.binary	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -0,0 +1,21 @@
+OUTPUT_FORMAT("binary") 
+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);
+[[COMPONENTS]]
+	}
+}
Index: boot/arch/mips32/loader/_link.ld.in.ecoff
===================================================================
--- boot/arch/mips32/loader/_link.ld.in.ecoff	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
+++ boot/arch/mips32/loader/_link.ld.in.ecoff	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -0,0 +1,21 @@
+OUTPUT_FORMAT("ecoff-littlemips")
+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);
+[[COMPONENTS]]
+	}
+}
Index: boot/arch/ppc32/loader/Makefile
===================================================================
--- boot/arch/ppc32/loader/Makefile	(revision 136edca07dac4855f2401e71778a4078795a3216)
+++ boot/arch/ppc32/loader/Makefile	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -33,5 +33,4 @@
 #
 
-BFD = elf32-powerpc
 BFD_NAME = elf32-powerpc
 BFD_ARCH = powerpc:common
@@ -107,6 +106,6 @@
 	-rm -f _components.h _components.c _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 _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) _link.ld.in
+	../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 4096 "unsigned int" $(COMPONENTS)
 
 %.o: %.S
Index: boot/arch/ppc32/loader/_link.ld.in
===================================================================
--- boot/arch/ppc32/loader/_link.ld.in	(revision 136edca07dac4855f2401e71778a4078795a3216)
+++ boot/arch/ppc32/loader/_link.ld.in	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -1,2 +1,7 @@
+OUTPUT_FORMAT("elf32-powerpc") 
+OUTPUT_ARCH(powerpc:common) 
+ENTRY(start) 
+ 
+SECTIONS {
 	.boot 0x10000000: AT (0) { 
 		*(BOOTSTRAP);
@@ -12,2 +17,5 @@
 		*(.bss);		/* uninitialized static variables */	
 		*(COMMON); 		/* global variables */
+[[COMPONENTS]]
+	}
+}
Index: boot/arch/ppc64/loader/Makefile
===================================================================
--- boot/arch/ppc64/loader/Makefile	(revision 136edca07dac4855f2401e71778a4078795a3216)
+++ boot/arch/ppc64/loader/Makefile	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -33,5 +33,4 @@
 #
 
-BFD = elf64-powerpc
 BFD_NAME = elf64-powerpc
 BFD_ARCH = powerpc:common64
@@ -107,6 +106,6 @@
 	-rm -f _components.h _components.c _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 _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) _link.ld.in
+	../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 4096 "unsigned long" $(COMPONENTS)
 
 %.o: %.S
Index: boot/arch/ppc64/loader/_link.ld.in
===================================================================
--- boot/arch/ppc64/loader/_link.ld.in	(revision 136edca07dac4855f2401e71778a4078795a3216)
+++ boot/arch/ppc64/loader/_link.ld.in	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -1,2 +1,7 @@
+OUTPUT_FORMAT("elf64-powerpc") 
+OUTPUT_ARCH(powerpc:common64) 
+ENTRY(start) 
+ 
+SECTIONS {
 	.boot 0x0000000010000000: AT (0) { 
 		*(BOOTSTRAP);
@@ -14,2 +19,9 @@
 		*(.bss);		/* uninitialized static variables */	
 		*(COMMON); 		/* global variables */
+[[COMPONENTS]]
+	} 
+ 
+    /DISCARD/ : { 
+        *(*); 
+    } 
+}
Index: boot/arch/sparc64/loader/Makefile
===================================================================
--- boot/arch/sparc64/loader/Makefile	(revision 136edca07dac4855f2401e71778a4078795a3216)
+++ boot/arch/sparc64/loader/Makefile	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -33,4 +33,6 @@
 #
 
+BFD_NAME = elf64-sparc
+BFD_ARCH = sparc
 TARGET = sparc64-linux-gnu
 TOOLCHAIN_DIR = /usr/local/sparc64/bin
@@ -64,4 +66,5 @@
 SOURCES = \
 	main.c \
+	_components.c \
 	../../../generic/printf.c \
 	../../../generic/string.c \
@@ -104,8 +107,8 @@
 
 clean:
-	-rm -f _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot boot.disasm Makefile.depend
+	-rm -f _components.h _components.c _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot image.map image.disasm Makefile.depend
 
-_components.h _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS)
-	./pack $(IMAGE) $(OBJCOPY) $(COMPONENTS)
+_components.h _components.c _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS) _link.ld.in
+	../../../tools/pack.py $(OBJCOPY) $(BFD_NAME) $(BFD_ARCH) 1 "unsigned long" $(COMPONENTS)
 
 %.o: %.S
@@ -116,3 +119,3 @@
 
 disasm: image.boot
-	$(OBJDUMP) -d image.boot > boot.disasm
+	$(OBJDUMP) -d image.boot > image.disasm
Index: boot/arch/sparc64/loader/_link.ld.in
===================================================================
--- boot/arch/sparc64/loader/_link.ld.in	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
+++ boot/arch/sparc64/loader/_link.ld.in	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -0,0 +1,23 @@
+OUTPUT_FORMAT("elf64-sparc")
+ENTRY(start)
+
+SECTIONS {
+	.boot 0x4000: AT (0x4000) {
+		*(BOOTSTRAP);
+		*(.text);
+		*(.rodata);
+		*(.rodata.*);
+		*(.data);               /* initialized data */
+		*(.sdata);
+		*(.sdata2);
+		*(.sbss);
+		*(.bss);                /* uninitialized static variables */
+		*(COMMON);
+[[COMPONENTS]]
+	}
+	
+	/DISCARD/ : {
+		*(.comment);
+		*(.note*);
+	}
+}
Index: ot/arch/sparc64/loader/pack
===================================================================
--- boot/arch/sparc64/loader/pack	(revision 136edca07dac4855f2401e71778a4078795a3216)
+++ 	(revision )
@@ -1,113 +1,0 @@
-#! /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-sparc")
-ENTRY(start)
-
-SECTIONS {
-	.boot 0x4000: AT (0x4000) {
-		*(BOOTSTRAP);
-		*(.text);
-		*(.rodata);
-		*(.rodata.*);
-		*(.data);               /* initialized data */
-		*(.sdata);
-		*(.sdata2);
-		*(.sbss);
-		*(.bss);                /* uninitialized static variables */
-		*(COMMON);' > "$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 "
-		*(.${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-sparc -B sparc --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/ : {
-		*(.comment);
-		*(.note*);
-	}
-}' >> "$LINK"
-
-echo "
-#define COMPONENTS $COUNT
-
-static void init_components(component_t components[])
-{
-$DATA
-}
-
-#endif
-" >> "$HEADER"
Index: boot/tools/pack.py
===================================================================
--- boot/tools/pack.py	(revision 136edca07dac4855f2401e71778a4078795a3216)
+++ boot/tools/pack.py	(revision 960f84768e13fb491ebebcac42ca8af66a4cd0d3)
@@ -37,5 +37,5 @@
 def usage(prname):
 	"Print usage syntax"
-	print prname + " <OBJCOPY> <FORMAT> <OUTPUT_FORMAT> <ARCH> <ALIGNMENT>"
+	print prname + " <OBJCOPY> <FORMAT> <ARCH> <ALIGNMENT> <UINTPTR>"
 
 def main():
@@ -44,37 +44,18 @@
 		return
 	
-	if (not sys.argv[5].isdigit()):
+	if (not sys.argv[4].isdigit()):
 		print "<ALIGNMENT> must be a number"
 		return
 	
-	templatename = "_link.ld.in"
-	workdir = os.getcwd()
 	objcopy = sys.argv[1]
 	format = sys.argv[2]
-	output_format = sys.argv[3]
-	arch = sys.argv[4]
-	align = int(sys.argv[5], 0)
+	arch = sys.argv[3]
+	align = int(sys.argv[4], 0)
+	uintptr = sys.argv[5]
 	
-	link = file("_link.ld", "w")
+	workdir = os.getcwd()
+	
 	header = file("_components.h", "w")
 	data = file("_components.c", "w")
-	
-	link.write("OUTPUT_FORMAT(\"" + output_format + "\")\n")
-	link.write("OUTPUT_ARCH(" + arch + ")\n")
-	link.write("ENTRY(start)\n\n")
-	link.write("SECTIONS {\n")
-	
-	size = os.path.getsize(templatename)
-	rd = 0
-	template = file(templatename, "r")
-	
-	while (rd < size):
-		buf = template.read(4096)
-		link.write(buf)
-		rd += len(buf)
-	
-	template.close()
-	
-	link.write("\n")
 	
 	header.write("#ifndef ___COMPONENTS_H__\n")
@@ -86,4 +67,5 @@
 	
 	cnt = 0
+	link = ""
 	for task in sys.argv[6:]:
 		basename = os.path.basename(task)
@@ -96,6 +78,8 @@
 		print task + " -> " + object
 		
-		link.write("\t\t. = ALIGN(" + ("%d" % align) + ");\n")
-		link.write("\t\t*(." + plainname + "_image);\n\n")
+		if (align > 1):
+			link += "\t\t. = ALIGN(" + ("%d" % align) + ");\n"
+		
+		link += "\t\t*(." + plainname + "_image);\n"
 		
 		header.write("extern int " + symbol + "_start;\n")
@@ -103,5 +87,5 @@
 		header.write("#define " + macro + "_START ((void *) &" + symbol + "_start)\n")
 		header.write("#define " + macro + "_END ((void *) &" + symbol + "_end)\n")
-		header.write("#define " + macro + "_SIZE ((unsigned int) " + macro + "_END - (unsigned int) " + macro + "_START)\n\n")
+		header.write("#define " + macro + "_SIZE ((" + uintptr + ") " + macro + "_END - (" + uintptr + ") " + macro + "_START)\n\n")
 		
 		data.write("\tcomponents[" + ("%d" % cnt) + "].name = \"" + plainname + "\";\n")
@@ -119,9 +103,6 @@
 		os.chdir(workdir)
 		
-		cnt = cnt + 1
+		cnt += 1
 		
-	link.write("\t}\n")
-	link.write("}\n")
-	
 	header.write("#define COMPONENTS " + ("%d" % cnt) + "\n\n")
 	header.write("typedef struct {\n")
@@ -129,5 +110,5 @@
 	header.write("\tvoid *start;\n")
 	header.write("\tvoid *end;\n")
-	header.write("\tunsigned int size;\n")
+	header.write("\t" + uintptr + " size;\n")
 	header.write("} component_t;\n\n")
 	header.write("extern void init_components(component_t *components);\n\n")
@@ -136,7 +117,15 @@
 	data.write("}\n")
 	
-	link.close()
 	header.close()
 	data.close()
+	
+	linkname = "_link.ld"
+	link_in = file(linkname + ".in", "r")
+	template = link_in.read(os.path.getsize(linkname + ".in"))
+	link_in.close()
+	
+	link_out = file(linkname, "w")
+	link_out.write(template.replace("[[COMPONENTS]]", link))
+	link_out.close()
 
 if __name__ == '__main__':
