Index: arch/ppc64/Makefile.inc
===================================================================
--- arch/ppc64/Makefile.inc	(revision 0ab829cf6b58a08e954b5cce7b6c82a0d37916df)
+++ arch/ppc64/Makefile.inc	(revision 6bbb161000a0620cf3d6ce3262e283d63efc9b7b)
@@ -29,11 +29,11 @@
 build: image.boot
 
-image.boot: kernel
-	make -C arch/$(ARCH)/loader COMPILER=$(COMPILER) KERNEL=../../../$(KERNELDIR)/kernel.bin
+image.boot: kernel uspace
+	make -C arch/$(ARCH)/loader COMPILER=$(COMPILER) KERNELDIR=../../../$(KERNELDIR) USPACEDIR=../../../$(USPACEDIR)
 	cp arch/$(ARCH)/loader/image.boot image.boot
 
-clean: clean_kernel
-	make -C arch/$(ARCH)/loader clean
+clean: clean_kernel clean_uspace
+	make -C arch/$(ARCH)/loader clean KERNELDIR=../../../$(KERNELDIR) USPACEDIR=../../../$(USPACEDIR)
 	-rm -f image.boot
 
-arch_distclean: distclean_kernel
+arch_distclean: distclean_kernel distclean_uspace
Index: arch/ppc64/loader/Makefile
===================================================================
--- arch/ppc64/loader/Makefile	(revision 0ab829cf6b58a08e954b5cce7b6c82a0d37916df)
+++ arch/ppc64/loader/Makefile	(revision 6bbb161000a0620cf3d6ce3262e283d63efc9b7b)
@@ -31,5 +31,5 @@
 
 TARGET = ppc-linux-gnu
-TOOLCHAIN_DIR = /usr/local/ppc/bin
+TOOLCHAIN_DIR = /usr/local/ppc64/bin
 
 ifeq ($(COMPILER),native)
@@ -47,5 +47,5 @@
 endif
 
-CFLAGS = -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -mcpu=powerpc64 -m64
+CFLAGS = -nostdinc -nostdlib -fno-builtin -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 -mcpu=powerpc64 -msoft-float -m64
 DEFS = 
 
@@ -57,5 +57,12 @@
 	boot.S
 
+COMPONENTS = \
+	$(KERNELDIR)/kernel.bin \
+	$(USPACEDIR)/ns/ns \
+	$(USPACEDIR)/init/init \
+	$(USPACEDIR)/fb/fb
+
 OBJECTS := $(addsuffix .o,$(basename $(SOURCES)))
+COMPONENT_OBJECTS := $(addsuffix .o,$(basename $(notdir $(COMPONENTS))))
 
 .PHONY: all clean depend
@@ -65,6 +72,6 @@
 -include Makefile.depend
 
-image.boot: depend $(OBJECTS) kernel.o
-	$(LD) -no-check-sections -N -T _link.ld $(OBJECTS) kernel.o -o $@
+image.boot: depend _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) kernel.o 
+	$(LD) -no-check-sections -N -T _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) -o $@
 
 depend:
@@ -72,8 +79,8 @@
 
 clean:
-	-rm -f $(OBJECTS) image.boot kernel.o Makefile.depend
+	-rm -f _components.h _link.ld $(COMPONENT_OBJECTS) $(OBJECTS) image.boot Makefile.depend
 
-kernel.o: $(KERNEL)
-	$(OBJCOPY) -I binary -O elf64-powerpc -B powerpc --rename-section .data=.image $(KERNEL) $@
+_components.h _link.ld $(COMPONENT_OBJECTS): $(COMPONENTS)
+	./pack $(OBJCOPY) $(COMPONENTS)
 
 %.o: %.S
Index: ch/ppc64/loader/_link.ld
===================================================================
--- arch/ppc64/loader/_link.ld	(revision 0ab829cf6b58a08e954b5cce7b6c82a0d37916df)
+++ 	(revision )
@@ -1,28 +1,0 @@
-/*
- *  PPC linker script
- *
- */
-
-OUTPUT_FORMAT("elf64-powerpc")
-OUTPUT_ARCH("powerpc:common64")
-ENTRY(start)
-
-SECTIONS {
-	.boot 0x0000000010000000: AT (0) { 
-		*(BOOTSTRAP);
-		*(REALMODE);
-		*(.text);
-		
-		*(.rodata);
-		*(.rodata.*);
-		*(.data);		/* initialized data */
-		*(.sdata);
-		*(.sdata2);
-		*(.sbss);
-		*(.bss);		/* uninitialized static variables */	
-		*(COMMON); 		/* global variables */
-		
-		. = ALIGN(4096);
-		*(.image);
-	}
-}
Index: arch/ppc64/loader/asm.S
===================================================================
--- arch/ppc64/loader/asm.S	(revision 0ab829cf6b58a08e954b5cce7b6c82a0d37916df)
+++ arch/ppc64/loader/asm.S	(revision 6bbb161000a0620cf3d6ce3262e283d63efc9b7b)
@@ -107,9 +107,16 @@
 	# r4 = bootinfo_size
 	# r5 = trans (pa)
-	# r6 = kernel size
-	# r7 = framebuffer (pa)
-	# r8 = real_mode (pa)
-	
-	mtspr srr0, r8
+	# r6 = bytes to copy
+	# r7 = real_mode (pa)
+	
+	# disable interrupts
+	
+	mfmsr r31
+	rlwinm r31, r31, 0, 17, 15
+	mtmsr r31
+	
+	# set real_mode meeting point address
+	
+	mtspr srr0, r7
 	
 	# jumps to real_mode
@@ -125,5 +132,5 @@
 	rfid
 
-.section REALMODE
+.section REALMODE, "ax"
 .align PAGE_WIDTH
 .global real_mode
@@ -134,6 +141,5 @@
 	#
 	# r5 = trans (pa)
-	# r6 = kernel size
-	# r7 = framebuffer (pa)
+	# r6 = bytes to copy
 	
 	li r31, PAGE_SIZE >> 2
@@ -169,72 +175,21 @@
 	copy_end:
 	
-	# invalidate segment registers
+	# initially fill segment registers
 
 	li r31, 16
 	mtctr r31
 	li r31, 0
-	li r30, 0
+	li r30, 0x2000
 
 	seg_fill:
 	
 		mtsrin r30, r31
+		addi r30, r30, 0x111
 		addis r31, r31, 0x1000    # move to next SR
 		
 		bdnz seg_fill
 	
-	# invalidate block address translation registers
-	
-	mtspr ibat0u, r30
-	mtspr ibat0l, r30
-	
-	mtspr ibat1u, r30
-	mtspr ibat1l, r30
-	
-	mtspr ibat2u, r30
-	mtspr ibat2l, r30
-	
-	mtspr ibat3u, r30
-	mtspr ibat3l, r30
-	
-	mtspr dbat0u, r30
-	mtspr dbat0l, r30
-	
-	mtspr dbat1u, r30
-	mtspr dbat1l, r30
-	
-	mtspr dbat2u, r30
-	mtspr dbat2l, r30
-	
-	mtspr dbat3u, r30
-	mtspr dbat3l, r30
-	
-	# create identity mapping
-	
-	# FIXME: map exactly the size of RAM
-	
-	lis r31, 0x8000
-	ori r31, r31, 0x0ffe
-	
-	lis r30, 0x0000
-	ori r30, r30, 0x0002
-	
-	mtspr ibat0u, r31
-	mtspr ibat0l, r30
-	
-	mtspr dbat0u, r31
-	mtspr dbat0l, r30
-	
-	# FIXME: temporal framebuffer mapping
-	
-	lis r31, 0xf000
-	ori r31, r31, 0x0ffe
-	
-	mr r30, r7
-	ori r30, r30, 0x0002
-	
-	mtspr dbat1u, r31
-	mtspr dbat1l, r30
-	
 	tlbia
+	tlbsync
 	
 	# start the kernel
Index: arch/ppc64/loader/asm.h
===================================================================
--- arch/ppc64/loader/asm.h	(revision 0ab829cf6b58a08e954b5cce7b6c82a0d37916df)
+++ arch/ppc64/loader/asm.h	(revision 6bbb161000a0620cf3d6ce3262e283d63efc9b7b)
@@ -34,5 +34,5 @@
 
 #define TRANS_SIZE 1024
-#define TRANS_ITEM_SIZE 4
+#define TRANS_ITEM_SIZE 8
 
 #define KERNEL_START_ADDR 0x80004000
@@ -45,5 +45,5 @@
 
 extern void halt();
-extern void jump_to_kernel(void *bootinfo, unsigned long bootinfo_size, void *trans, unsigned long kernel_size, void *framebuffer, void *real_mode) __attribute__((noreturn));
+extern void jump_to_kernel(void *bootinfo, unsigned long bootinfo_size, void *trans, unsigned long kernel_size, void *real_mode) __attribute__((noreturn));
 extern void real_mode();
 
Index: arch/ppc64/loader/boot.S
===================================================================
--- arch/ppc64/loader/boot.S	(revision 0ab829cf6b58a08e954b5cce7b6c82a0d37916df)
+++ arch/ppc64/loader/boot.S	(revision 6bbb161000a0620cf3d6ce3262e283d63efc9b7b)
@@ -29,5 +29,5 @@
 #include "regname.h"
 
-.section BOOTSTRAP
+.section BOOTSTRAP, "ax"
 
 .global start
Index: arch/ppc64/loader/main.c
===================================================================
--- arch/ppc64/loader/main.c	(revision 0ab829cf6b58a08e954b5cce7b6c82a0d37916df)
+++ arch/ppc64/loader/main.c	(revision 6bbb161000a0620cf3d6ce3262e283d63efc9b7b)
@@ -30,8 +30,5 @@
 #include "printf.h"
 #include "asm.h"
-
-#define KERNEL_START ((void *) &_binary_____________kernel_kernel_bin_start)
-#define KERNEL_END ((void *) &_binary_____________kernel_kernel_bin_end)
-#define KERNEL_SIZE ((unsigned long) KERNEL_END - (unsigned long) KERNEL_START)
+#include "_components.h"
 
 #define HEAP_GAP 1024000
@@ -77,22 +74,28 @@
 void bootstrap(void)
 {
-	printf("\nHelenOS PPC64 Bootloader\n");
+	printf("\nHelenOS PPC Bootloader\n");
 	
-	check_align(KERNEL_START, "Kernel image");
-	check_align(&real_mode, "Bootstrap trampoline");
-	check_align(&trans, "Translation table");
+	init_components();
+	
+	unsigned int i;
+	
+	for (i = 0; i < COMPONENTS; i++)
+		check_align(components[i].start, components[i].name);
+	
+	check_align(&real_mode, "bootstrap trampoline");
+	check_align(&trans, "translation table");
 	
 	if (!ofw_memmap(&bootinfo.memmap)) {
-		printf("Error: Unable to get memory map, halting.\n");
+		printf("Error: unable to get memory map, halting.\n");
 		halt();
 	}
 	
 	if (bootinfo.memmap.total == 0) {
-		printf("Error: No memory detected, halting.\n");
+		printf("Error: no memory detected, halting.\n");
 		halt();
 	}
 	
 	if (!ofw_screen(&bootinfo.screen)) {
-		printf("Error: Unable to get screen properties, halting.\n");
+		printf("Error: unable to get screen properties, halting.\n");
 		halt();
 	}
@@ -104,25 +107,48 @@
 	void *trans_pa = ofw_translate(&trans);
 	void *bootinfo_pa = ofw_translate(&bootinfo);
-	void *fb = (void *) (((unsigned long) bootinfo.screen.addr) & ((unsigned long) ~0 << 17));
 	
 	printf("\nMemory statistics (total %d MB)\n", bootinfo.memmap.total >> 20);
-	printf(" kernel image         at %L (size %d bytes)\n", KERNEL_START, KERNEL_SIZE);
-	printf(" boot info            at %L (physical %L)\n", &bootinfo, bootinfo_pa);
-	printf(" bootstrap trampoline at %L (physical %L)\n", &real_mode, real_mode_pa);
-	printf(" translation table    at %L (physical %L)\n", &trans, trans_pa);
+	printf(" %L: boot info structure (physical %L)\n", &bootinfo, bootinfo_pa);
+	printf(" %L: bootstrap trampoline (physical %L)\n", &real_mode, real_mode_pa);
+	printf(" %L: translation table (physical %L)\n", &trans, trans_pa);
+	for (i = 0; i < COMPONENTS; i++)
+		printf(" %L: %s image (size %d bytes)\n", components[i].start, components[i].name, components[i].size);
 	
-	unsigned long top = ALIGN_UP(KERNEL_SIZE, PAGE_SIZE);
-	unsigned long addr;
-	for (addr = 0; addr < KERNEL_SIZE; addr += PAGE_SIZE) {
-		void *pa = ofw_translate(KERNEL_START + addr);
-		fix_overlap(KERNEL_START + addr, &pa, "Kernel image", &top);
-		trans[addr >> PAGE_WIDTH] = pa;
+	unsigned long top = 0;
+	for (i = 0; i < COMPONENTS; i++)
+		top += ALIGN_UP(components[i].size, PAGE_SIZE);
+	
+	unsigned long pages = ALIGN_UP(KERNEL_SIZE, PAGE_SIZE) >> PAGE_WIDTH;
+	
+	for (i = 0; i < pages; i++) {
+		void *pa = ofw_translate(KERNEL_START + (i << PAGE_WIDTH));
+		fix_overlap(KERNEL_START + (i << PAGE_WIDTH), &pa, "kernel", &top);
+		trans[i] = pa;
 	}
 	
-	fix_overlap(&real_mode, &real_mode_pa, "Bootstrap trampoline", &top);
-	fix_overlap(&trans, &trans_pa, "Translation table", &top);
-	fix_overlap(&bootinfo, &bootinfo_pa, "Boot info", &top);
+	bootinfo.taskmap.count = 0;
+	for (i = 1; i < COMPONENTS; i++) {
+		unsigned long component_pages = ALIGN_UP(components[i].size, PAGE_SIZE) >> PAGE_WIDTH;
+		unsigned long j;
+		
+		for (j = 0; j < component_pages; j++) {
+			void *pa = ofw_translate(components[i].start + (j << PAGE_WIDTH));
+			fix_overlap(components[i].start + (j << PAGE_WIDTH), &pa, components[i].name, &top);
+			trans[pages + j] = pa;
+			if (j == 0) {
+				bootinfo.taskmap.tasks[bootinfo.taskmap.count].addr = (void *) (pages << PAGE_WIDTH);
+				bootinfo.taskmap.tasks[bootinfo.taskmap.count].size = components[i].size;
+				bootinfo.taskmap.count++;
+			}
+		}
+		
+		pages += component_pages;
+	}
+	
+	fix_overlap(&real_mode, &real_mode_pa, "bootstrap trampoline", &top);
+	fix_overlap(&trans, &trans_pa, "translation table", &top);
+	fix_overlap(&bootinfo, &bootinfo_pa, "boot info", &top);
 	
 	printf("\nBooting the kernel...\n");
-	jump_to_kernel(bootinfo_pa, sizeof(bootinfo), trans_pa, KERNEL_SIZE, fb, real_mode_pa);
+	jump_to_kernel(bootinfo_pa, sizeof(bootinfo), trans_pa, pages << PAGE_WIDTH, real_mode_pa);
 }
Index: arch/ppc64/loader/main.h
===================================================================
--- arch/ppc64/loader/main.h	(revision 0ab829cf6b58a08e954b5cce7b6c82a0d37916df)
+++ arch/ppc64/loader/main.h	(revision 6bbb161000a0620cf3d6ce3262e283d63efc9b7b)
@@ -39,11 +39,22 @@
 #define ALIGN_UP(addr, align) (((addr) + ((align) - 1)) & ~((align) - 1))
 
+#define TASKMAP_MAX_RECORDS 32
+
 typedef struct {
+	void *addr;
+	unsigned long size;
+} task_t;
+
+typedef struct {
+	unsigned int count;
+	task_t tasks[TASKMAP_MAX_RECORDS];
+} taskmap_t;
+
+typedef struct {
+	taskmap_t taskmap;
 	memmap_t memmap;
 	screen_t screen;
 } bootinfo_t;
 
-extern long _binary_____________kernel_kernel_bin_start;
-extern long _binary_____________kernel_kernel_bin_end;
 extern void start(void);
 extern void bootstrap(void);
Index: arch/ppc64/loader/ofw.c
===================================================================
--- arch/ppc64/loader/ofw.c	(revision 0ab829cf6b58a08e954b5cce7b6c82a0d37916df)
+++ arch/ppc64/loader/ofw.c	(revision 6bbb161000a0620cf3d6ce3262e283d63efc9b7b)
@@ -34,7 +34,7 @@
 #define BUF_SIZE		1024
 
-typedef unsigned long ofw_arg_t;
-typedef unsigned long ihandle;
-typedef unsigned long phandle;
+typedef unsigned int ofw_arg_t;
+typedef unsigned int ihandle;
+typedef unsigned int phandle;
 
 /** OpenFirmware command structure
@@ -43,6 +43,6 @@
 typedef struct {
 	const char *service;          /**< Command name */
-	unsigned long nargs;           /**< Number of in arguments */
-	unsigned long nret;            /**< Number of out arguments */
+	unsigned int nargs;           /**< Number of in arguments */
+	unsigned int nret;            /**< Number of out arguments */
 	ofw_arg_t args[MAX_OFW_ARGS]; /**< List of arguments */
 } ofw_args_t;
@@ -61,9 +61,9 @@
 
 
-static long ofw_call(const char *service, const long nargs, const long nret, ofw_arg_t *rets, ...)
+static int ofw_call(const char *service, const int nargs, const int nret, ofw_arg_t *rets, ...)
 {
 	va_list list;
 	ofw_args_t args;
-	long i;
+	int i;
 	
 	args.service = service;
@@ -94,5 +94,5 @@
 
 
-static long ofw_get_property(const phandle device, const char *name, const void *buf, const long buflen)
+static int ofw_get_property(const phandle device, const char *name, const void *buf, const int buflen)
 {
 	return ofw_call("getprop", 4, 1, NULL, device, name, buf, buflen);
@@ -100,7 +100,7 @@
 
 
-static unsigned long ofw_get_address_cells(const phandle device)
-{
-	unsigned long ret;
+static unsigned int ofw_get_address_cells(const phandle device)
+{
+	unsigned int ret;
 	
 	if (ofw_get_property(device, "#address-cells", &ret, sizeof(ret)) <= 0)
@@ -112,7 +112,7 @@
 
 
-static unsigned long ofw_get_size_cells(const phandle device)
-{
-	unsigned long ret;
+static unsigned int ofw_get_size_cells(const phandle device)
+{
+	unsigned int ret;
 	
 	if (ofw_get_property(device, "#size-cells", &ret, sizeof(ret)) <= 0)
@@ -185,5 +185,5 @@
 
 
-long ofw_map(const void *phys, const void *virt, const long size, const long mode)
+int ofw_map(const void *phys, const void *virt, const int size, const int mode)
 {
 	return ofw_call("call-method", 6, 1, NULL, "map", ofw_mmu, mode, size, virt, phys);
@@ -191,20 +191,20 @@
 
 
-long ofw_memmap(memmap_t *map)
-{
-	unsigned long buf[BUF_SIZE];
-	long ret = ofw_get_property(ofw_memory, "reg", buf, sizeof(unsigned long) * BUF_SIZE);
+int ofw_memmap(memmap_t *map)
+{
+	unsigned int buf[BUF_SIZE];
+	int ret = ofw_get_property(ofw_memory, "reg", buf, sizeof(unsigned int) * BUF_SIZE);
 	if (ret <= 0)
 		return false;
 		
-	unsigned long ac = ofw_get_address_cells(ofw_memory);
-	unsigned long sc = ofw_get_size_cells(ofw_memory);
-	
-	long pos;
+	unsigned int ac = ofw_get_address_cells(ofw_memory);
+	unsigned int sc = ofw_get_size_cells(ofw_memory);
+	
+	int pos;
 	map->total = 0;
 	map->count = 0;
-	for (pos = 0; (pos < ret / sizeof(unsigned long)) && (map->count < MEMMAP_MAX_RECORDS); pos += ac + sc) {
+	for (pos = 0; (pos < ret / sizeof(unsigned int)) && (map->count < MEMMAP_MAX_RECORDS); pos += ac + sc) {
 		void * start = (void *) buf[pos + ac - 1];
-		unsigned long size = buf[pos + ac + sc - 1];
+		unsigned int size = buf[pos + ac + sc - 1];
 		
 		if (size > 0) {
@@ -218,5 +218,5 @@
 
 
-long ofw_screen(screen_t *screen)
+int ofw_screen(screen_t *screen)
 {
 	char device_name[BUF_SIZE];
Index: arch/ppc64/loader/ofw.h
===================================================================
--- arch/ppc64/loader/ofw.h	(revision 0ab829cf6b58a08e954b5cce7b6c82a0d37916df)
+++ arch/ppc64/loader/ofw.h	(revision 6bbb161000a0620cf3d6ce3262e283d63efc9b7b)
@@ -48,5 +48,5 @@
 typedef struct {
 	unsigned long total;
-	unsigned long count;
+	unsigned int count;
 	memzone_t zones[MEMMAP_MAX_RECORDS];
 } memmap_t;
@@ -54,8 +54,8 @@
 typedef struct {
 	void *addr;
-	unsigned long width;
-	unsigned long height;
-	unsigned long bpp;
-	unsigned long scanline;
+	unsigned int width;
+	unsigned int height;
+	unsigned int bpp;
+	unsigned int scanline;
 } screen_t;
 
@@ -65,7 +65,7 @@
 
 extern void *ofw_translate(const void *virt);
-extern long ofw_map(const void *phys, const void *virt, const long size, const long mode);
-extern long ofw_memmap(memmap_t *map);
-extern long ofw_screen(screen_t *screen);
+extern int ofw_map(const void *phys, const void *virt, const long size, const int mode);
+extern int ofw_memmap(memmap_t *map);
+extern int ofw_screen(screen_t *screen);
 
 #endif
Index: arch/ppc64/loader/pack
===================================================================
--- arch/ppc64/loader/pack	(revision 6bbb161000a0620cf3d6ce3262e283d63efc9b7b)
+++ arch/ppc64/loader/pack	(revision 6bbb161000a0620cf3d6ce3262e283d63efc9b7b)
@@ -0,0 +1,118 @@
+#! /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);
+		
+		*(.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 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"
Index: arch/ppc64/loader/regname.h
===================================================================
--- arch/ppc64/loader/regname.h	(revision 0ab829cf6b58a08e954b5cce7b6c82a0d37916df)
+++ arch/ppc64/loader/regname.h	(revision 6bbb161000a0620cf3d6ce3262e283d63efc9b7b)
@@ -27,6 +27,6 @@
  */
 
-#ifndef __ppc64_REGNAME_H__
-#define __ppc64_REGNAME_H__
+#ifndef __ppc32_REGNAME_H__
+#define __ppc32_REGNAME_H__
 
 /* Condition Register Bit Fields */
@@ -190,20 +190,4 @@
 #define	sprg3	275
 #define	prv		287
-#define ibat0u	528
-#define ibat0l	529
-#define ibat1u	530
-#define ibat1l	531
-#define ibat2u	532
-#define ibat2l	533
-#define ibat3u	534
-#define ibat3l	535
-#define dbat0u	536
-#define dbat0l	537
-#define dbat1u	538
-#define dbat1l	539
-#define dbat2u	540
-#define dbat2l	541
-#define dbat3u	542
-#define dbat3l	543
 #define hid0	1008
 
