Index: build/jam/ImageRules
===================================================================
--- build/jam/ImageRules	(revision 24336)
+++ build/jam/ImageRules	(working copy)
@@ -38,7 +38,8 @@
 actions InitScript1
 {
 	rm -f $(1)
-	echo -n > $(1)
+#	echo -n > $(1)
+	echo > $(1)
 }
 
 rule AddVariableToScript script : variable : value
Index: src/tools/fs_shell/unistd.cpp
===================================================================
--- src/tools/fs_shell/unistd.cpp	(revision 24336)
+++ src/tools/fs_shell/unistd.cpp	(working copy)
@@ -25,7 +25,9 @@
 #		include <sys/ioctl.h>
 #		include <sys/stat.h>
 #		include <sys/disk.h>
-#		include <sys/disklabel.h>
+#		ifndef HAIKU_HOST_PLATFORM_DARWIN
+#			include <sys/disklabel.h>
+#		endif
 #	else
 		// the (POSIX) correct place of definition for ioctl()
 #		include <stropts.h>
Index: src/system/boot/platform/bios_ia32/video.cpp
===================================================================
--- src/system/boot/platform/bios_ia32/video.cpp	(revision 24336)
+++ src/system/boot/platform/bios_ia32/video.cpp	(working copy)
@@ -13,6 +13,7 @@
 
 #include <edid.h>
 
+#include <OS.h>
 #include <arch/cpu.h>
 #include <boot/stage2.h>
 #include <boot/platform.h>
@@ -48,8 +49,200 @@
 static addr_t sFrameBuffer;
 static bool sModeChosen;
 static bool sSettingsLoaded;
+static bootSplashImage* splashImage = NULL;
+static bootSplashImage* splashIcons = NULL;
+static bootSplashPalette* splashPalette = NULL;
+static int bootStage = 0;
+static bool bootLogoMode = false;
 
+status_t
+load_splash_data(stage2_args* args, Directory* volume)
+{
+	dprintf("load_splash_data: enter\n");
+	
+	// splash.raw
+	int fd = open_from(volume, "home/config/settings/kernel/splash.raw", O_RDONLY);
+	if (fd < 0)
+	{
+		dprintf("load_splash_data: error opening home/config/settings/kernel/splash.raw\n");
+		unload_splash_data();
+		return fd;
+	}
+	dprintf("load_splash_data: home/config/settings/kernel/splash.raw opened\n");
+	splashImage = (bootSplashImage*)malloc(sizeof(bootSplashImage));
+	if (!splashImage)
+	{
+		dprintf("load_splash_data: not enough memory to alloc splash image\n");
+		return B_NO_MEMORY;
+	}
+	dprintf("load_splash_data: splashImage=%p\n", splashImage);
+	memset(splashImage, 0, sizeof(bootSplashImage));
+	if(read(fd, &(splashImage->width), sizeof(unsigned int)) != sizeof(unsigned int))
+	{
+		dprintf("load_splash_data: cant read image width from splash image\n");
+		unload_splash_data();
+		return B_IO_ERROR;
+	}
+	if(read(fd, &(splashImage->height), sizeof(unsigned int)) != sizeof(unsigned int))
+	{
+		dprintf("load_splash_data: cant read image height from splash image\n");
+		unload_splash_data();
+		return B_IO_ERROR;
+	}
+	if(read(fd, &(splashImage->size), sizeof(unsigned int)) != sizeof(unsigned int))
+	{
+		dprintf("load_splash_data: cant read image size from splash image\n");
+		unload_splash_data();
+		return B_IO_ERROR;
+	}
+	splashImage->data = (unsigned char*)malloc(splashImage->size);
+	if(!splashImage->data)
+	{
+		dprintf("load_splash_data: not enough memory to alloc splash image data\n");
+		unload_splash_data();
+		return B_NO_MEMORY;
+	}
+	memset(splashImage->data, 0, splashImage->size);
+	if(read(fd, splashImage->data, splashImage->size) != splashImage->size)
+	{
+		dprintf("load_splash_data: cant read image data from splash image\n");
+		unload_splash_data();
+		return B_IO_ERROR;
+	}
+	dprintf("load_splash_data: splash image width=%d, height=%d, size=%d, pointer=%p, data pointer=%p\n", splashImage->width, splashImage->height, splashImage->size, splashImage, splashImage->data);
+	close(fd);
 
+	// icons.raw
+	fd = open_from(volume, "home/config/settings/kernel/icons.raw", O_RDONLY);
+	if (fd < 0)
+	{
+		dprintf("load_splash_data: error opening home/config/settings/kernel/icons.raw\n");
+		unload_splash_data();
+		return fd;
+	}
+	dprintf("load_splash_data: home/config/settings/kernel/icons.raw opened\n");
+	splashIcons = (bootSplashImage*)malloc(sizeof(bootSplashImage));
+	if (!splashIcons)
+	{
+		dprintf("load_splash_data: not enough memory to alloc splash icons image\n");
+		return B_NO_MEMORY;
+	}
+	dprintf("load_splash_data: splashIcons=%p\n", splashIcons);
+	memset(splashIcons, 0, sizeof(bootSplashImage));
+	if(read(fd, &(splashIcons->width), sizeof(unsigned int)) != sizeof(unsigned int))
+	{
+		dprintf("load_splash_data: cant read image width from splash icons image\n");
+		unload_splash_data();
+		return B_IO_ERROR;
+	}
+	if(read(fd, &(splashIcons->height), sizeof(unsigned int)) != sizeof(unsigned int))
+	{
+		dprintf("load_splash_data: cant read image height from splash icons image\n");
+		unload_splash_data();
+		return B_IO_ERROR;
+	}
+	if(read(fd, &(splashIcons->size), sizeof(unsigned int)) != sizeof(unsigned int))
+	{
+		dprintf("load_splash_data: cant read image size from splash icons image\n");
+		unload_splash_data();
+		return B_IO_ERROR;
+	}
+	splashIcons->data = (unsigned char*)malloc(splashIcons->size);
+	if(!splashIcons->data)
+	{
+		dprintf("load_splash_data: not enough memory to alloc splash icons image data\n");
+		unload_splash_data();
+		return B_NO_MEMORY;
+	}
+	memset(splashIcons->data, 0, splashIcons->size);
+	if(read(fd, splashIcons->data, splashIcons->size) != splashIcons->size)
+	{
+		dprintf("load_splash_data: cant read image data from splash icons image\n");
+		unload_splash_data();
+		return B_IO_ERROR;
+	}
+	dprintf("load_splash_data: splash icons image width=%d, height=%d, size=%d, pointer=%p, data pointer=%p\n", splashIcons->width, splashIcons->height, splashIcons->size, splashIcons, splashIcons->data);
+	close(fd);
+
+	// palette.raw
+	fd = open_from(volume, "home/config/settings/kernel/palette.raw", O_RDONLY);
+	if (fd < 0)
+	{
+		dprintf("load_splash_data: error opening home/config/settings/kernel/palette.raw\n");
+		unload_splash_data();
+		return fd;
+	}
+	dprintf("load_splash_data: home/config/settings/kernel/palette.raw opened\n");
+	splashPalette = (bootSplashPalette*)malloc(sizeof(bootSplashPalette));
+	if (!splashPalette)
+	{
+		dprintf("load_splash_data: not enough memory to alloc splash palette\n");
+		return B_NO_MEMORY;
+	}
+	dprintf("load_splash_data: splashPalette=%p\n", splashPalette);
+	memset(splashPalette, 0, sizeof(bootSplashPalette));
+	if(read(fd, &(splashPalette->size), sizeof(unsigned int)) != sizeof(unsigned int))
+	{
+		dprintf("load_splash_data: cant read size from splash palette\n");
+		unload_splash_data();
+		return B_IO_ERROR;
+	}
+	splashPalette->data = (unsigned char*)malloc(splashPalette->size);
+	if(!splashPalette->data)
+	{
+		dprintf("load_splash_data: not enough memory to alloc splash palette data\n");
+		unload_splash_data();
+		return B_NO_MEMORY;
+	}
+	memset(splashPalette->data, 0, splashPalette->size);
+	if(read(fd, splashPalette->data, splashPalette->size) != splashPalette->size)
+	{
+		dprintf("load_splash_data: cant read data from splash palette\n");
+		unload_splash_data();
+		return B_IO_ERROR;
+	}
+	dprintf("load_splash_data: splash palette size=%d, pointer=%p, data pointer=%p\n", splashPalette->size, splashPalette, splashPalette->data);
+	close(fd);
+
+	return B_OK;
+}
+
+void
+unload_splash_data()
+{
+	dprintf("unload_splash_data\n");
+	if (splashImage)
+	{
+		if (splashImage->data)
+		{
+			free(splashImage->data);
+			splashImage->data = NULL;
+		}
+		free(splashImage);
+		splashImage = NULL;
+	}
+	if (splashIcons)
+	{
+		if (splashIcons->data)
+		{
+			free(splashIcons->data);
+			splashIcons->data = NULL;
+		}
+		free(splashIcons);
+		splashIcons = NULL;
+	}
+	if (splashPalette)
+	{
+		if (splashPalette->data)
+		{
+			free(splashPalette->data);
+			splashPalette->data = NULL;
+		}
+		free(splashPalette);
+		splashPalette = NULL;
+	}
+}
+
 static int
 compare_video_modes(video_mode *a, video_mode *b)
 {
@@ -649,7 +842,45 @@
 	}
 }
 
+// data - image data
+// imageLeft - cropped image left point 
+// imageRight - cropped image right point
+// imageTop - cropped image top point
+// imageBottom - cropped image bottom point
+// imageWidth - image width
+// imageHeight - image height
+// palette - image palette
+static void
+blit16_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop, uint16 imageRight, uint16 imageBottom,
+	uint16 imageWidth, uint16 imageHeight, const uint8 *palette, uint16 left, uint16 top)
+{
+	int32 dataOffset = (imageWidth * imageTop) + imageLeft;
 
+	uint16 *start = (uint16 *)(sFrameBuffer
+		+ gKernelArgs.frame_buffer.bytes_per_row * top + 2 * left);
+
+	for (int32 y = imageTop; y < imageBottom; y++) {
+		for (int32 x = imageLeft; x < imageRight; x++) {
+			uint16 color = data[(y * (imageWidth)) + x] * 3;
+
+			start[x] = ((palette[color + 0] >> 3) << 11)
+				| ((palette[color + 1] >> 2) << 5)
+				| ((palette[color + 2] >> 3));
+			dataOffset += imageWidth;
+		}
+
+
+		start = (uint16 *)((addr_t)start
+			+ gKernelArgs.frame_buffer.bytes_per_row);
+	}
+
+//	for (int32 i = 0; i < (imageBottom - imageTop); i++) {
+//		memcpy((void *)(start + gKernelArgs.frame_buffer.bytes_per_row * i),
+//			&data[dataOffset], imageRight - imageLeft);
+//			dataOffset += imageWidth;
+//	}
+}
+
 static void
 blit4(const uint8 *data, uint16 width, uint16 height,
 	const uint8 *palette, uint16 left, uint16 top)
@@ -719,6 +950,22 @@
 	}
 }
 
+static void
+blit_8bit_image_cropped(const uint8 *data, uint16 imageLeft, uint16 imageTop, uint16 imageRight, uint16 imageBottom,
+	uint16 imageWidth, uint16 imageHeight, const uint8 *palette, uint16 left, uint16 top)
+{
+	dprintf("blit_8bit_image_cropped: depth=%d\n", gKernelArgs.frame_buffer.depth);
+	switch (gKernelArgs.frame_buffer.depth) {
+		case 16:
+			return blit16_cropped(data, imageLeft, imageTop, imageRight, imageBottom, imageWidth, imageHeight, palette, left, top);
+		case 8:
+		case 4:
+		case 15:
+		case 24:
+		case 32:
+			return;
+	}
+}
 
 //	#pragma mark -
 
@@ -730,6 +977,8 @@
 	if ((platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) != 0)
 		return;
 
+	bootLogoMode = true;
+
 	addr_t lastBase = gKernelArgs.frame_buffer.physical_buffer.start;
 	size_t lastSize = gKernelArgs.frame_buffer.physical_buffer.size;
 
@@ -786,17 +1035,6 @@
 			gKernelArgs.frame_buffer.physical_buffer.start,
 			gKernelArgs.frame_buffer.physical_buffer.size, kDefaultPageFlags);
 	}
-
-	// clear the video memory
-	memset((void *)sFrameBuffer, 0,
-		gKernelArgs.frame_buffer.physical_buffer.size);
-
-	// TODO: The image should be compressed, and eventually added by
-	//	the build process.
-
-	blit_8bit_image(kImageData, kWidth, kHeight, kPalette,
-		gKernelArgs.frame_buffer.width - kWidth - 40,
-		gKernelArgs.frame_buffer.height - kHeight - 60);
 }
 
 
@@ -877,3 +1115,37 @@
 	return B_OK;
 }
 
+void
+set_bootsplash_stage(int stage)
+{
+	bootStage = stage;
+
+	if (!bootLogoMode)
+		return;
+
+	// clear the video memory
+	memset((void *)sFrameBuffer, 0,
+		gKernelArgs.frame_buffer.physical_buffer.size);
+
+	dprintf("set_bootsplash_stage: drawing logo\n");
+	if (splashImage && splashImage->data && splashPalette && splashPalette->data)
+	{
+		blit_8bit_image(splashImage->data, splashImage->width, splashImage->height, splashPalette->data,
+			gKernelArgs.frame_buffer.width - splashImage->width - 80,
+			gKernelArgs.frame_buffer.height - splashImage->height );
+	}
+	dprintf("set_bootsplash_stage: drawing icons\n");
+	if (splashIcons && splashIcons->data && splashPalette && splashPalette->data)
+	{
+		int iconsx = (gKernelArgs.frame_buffer.width / 2) - (splashIcons->width / 2);
+		int iconsy = (gKernelArgs.frame_buffer.height / 2) - (splashIcons->height / 4);
+		blit_8bit_image_cropped(splashIcons->data, 0, 32, splashIcons->width, 64, splashIcons->width, splashIcons->height,
+			splashPalette->data, iconsx, iconsy );
+		if (bootStage > 0)
+		{
+			blit_8bit_image_cropped(splashIcons->data, 0, 0, bootStage * 32, 32, splashIcons->width, splashIcons->height,
+				splashPalette->data, iconsx, iconsy );
+		}
+	}
+}
+
Index: src/system/boot/platform/bios_ia32/start.c
===================================================================
--- src/system/boot/platform/bios_ia32/start.c	(revision 24336)
+++ src/system/boot/platform/bios_ia32/start.c	(working copy)
@@ -74,11 +74,14 @@
 		// to the assembler inline below - might be a bug in GCC
 		// or I don't see something important...
 	addr_t stackTop = gKernelArgs.cpu_kstack[0].start + gKernelArgs.cpu_kstack[0].size;
-
+	
+	// all commented calls was here only to test
+	// set_bootsplash_stage(3);
 	smp_init_other_cpus();
 	serial_cleanup();
 	mmu_init_for_kernel();
 	smp_boot_other_cpus();
+	// set_bootsplash_stage(4);
 
 	dprintf("kernel entry at %lx\n", gKernelArgs.kernel_image.elf_header.e_entry);
 
Index: src/system/boot/loader/main.cpp
===================================================================
--- src/system/boot/loader/main.cpp	(revision 24336)
+++ src/system/boot/loader/main.cpp	(working copy)
@@ -101,9 +101,15 @@
 			register_boot_file_system(volume);
 
 			if ((platform_boot_options() & BOOT_OPTION_DEBUG_OUTPUT) == 0)
-				platform_switch_to_logo();
-
+			{
+				if (load_splash_data(args, volume) == B_OK)
+					platform_switch_to_logo();
+			}
+			
+			// all commented calls was here only to test
+			// set_bootsplash_stage(1);
 			load_modules(args, volume);
+			// set_bootsplash_stage(2);
 			load_driver_settings(args, volume);
 
 			// set up kernel args version info
Index: headers/private/kernel/boot/platform.h
===================================================================
--- headers/private/kernel/boot/platform.h	(revision 24336)
+++ headers/private/kernel/boot/platform.h	(working copy)
@@ -35,8 +35,35 @@
 
 extern uint32 platform_boot_options(void);
 
+/* bootsplash structs */
+typedef struct
+{
+	unsigned int width;
+	unsigned int height;
+	unsigned int size;
+	unsigned char* data;
+} bootSplashImage;
+
+typedef struct
+{
+	unsigned int width;
+	unsigned int height;
+	unsigned int iconWidth;
+	unsigned int iconHeight;
+	unsigned int size;
+	unsigned char* data;
+} bootSplashIcons;
+
+typedef struct
+{
+	unsigned int size;
+	unsigned char* data;
+} bootSplashPalette;
+
 /* misc functions */
 extern status_t platform_init_video(void);
+extern void unload_splash_data();
+extern void set_bootsplash_stage(int stage);
 extern void platform_switch_to_logo(void);
 extern void platform_switch_to_text_mode(void);
 extern void platform_start_kernel(void);
@@ -59,6 +86,7 @@
 extern status_t platform_get_boot_partition(struct stage2_args *args, Node *bootDevice,
 					NodeList *partitions, boot::Partition **_partition);
 extern status_t platform_register_boot_device(Node *device);
+extern status_t load_splash_data(struct stage2_args *args, Directory *volume);
 
 /* menu functions */
 