Index: boot/arch/sparc64/loader/main.c
===================================================================
--- boot/arch/sparc64/loader/main.c	(revision d7e3fa668f022eef3ff46bde138d8a874b93f18d)
+++ boot/arch/sparc64/loader/main.c	(revision b4fa652eb2b10684af9602bd804587917a8ed99d)
@@ -32,4 +32,5 @@
 #include "_components.h"
 #include <ofw.h>
+#include "ofwarch.h"
 #include <align.h>
 
@@ -60,8 +61,10 @@
 	}
 	bootinfo.screen.addr = ofw_translate(bootinfo.screen.addr);
+	/* transform scanline to bytes with respect to potential alignment */
+	bootinfo.screen.scanline = bootinfo.screen.scanline*bpp2align[bootinfo.screen.bpp >> 3];
 	
 	if (!ofw_keyboard(&bootinfo.keyboard))
 		printf("Error: unable to get keyboard properties\n");
-	
+
 	printf("\nDevice statistics\n");
 	printf(" memory: %dM\n", bootinfo.memmap.total>>20);
Index: boot/arch/sparc64/loader/ofwarch.c
===================================================================
--- boot/arch/sparc64/loader/ofwarch.c	(revision d7e3fa668f022eef3ff46bde138d8a874b93f18d)
+++ boot/arch/sparc64/loader/ofwarch.c	(revision b4fa652eb2b10684af9602bd804587917a8ed99d)
@@ -36,4 +36,12 @@
 #include <printf.h>
 
+int bpp2align[] = {
+	[0] = 0,		/** Invalid bpp. */
+	[1] = 1,		/** 8bpp is not aligned. */
+	[2] = 2,		/** 16bpp is naturally aligned. */
+	[3] = 4,		/** 24bpp is aligned on 4 byte boundary. */
+	[4] = 4,		/** 32bpp is naturally aligned. */
+};
+
 void write(const char *str, const int len)
 {
Index: boot/arch/sparc64/loader/ofwarch.h
===================================================================
--- boot/arch/sparc64/loader/ofwarch.h	(revision d7e3fa668f022eef3ff46bde138d8a874b93f18d)
+++ boot/arch/sparc64/loader/ofwarch.h	(revision b4fa652eb2b10684af9602bd804587917a8ed99d)
@@ -33,3 +33,5 @@
 #define OFW_SIZE_CELLS		2
 
+extern int bpp2align[];
+
 #endif
Index: kernel/arch/ia32/src/drivers/vesa.c
===================================================================
--- kernel/arch/ia32/src/drivers/vesa.c	(revision d7e3fa668f022eef3ff46bde138d8a874b93f18d)
+++ kernel/arch/ia32/src/drivers/vesa.c	(revision b4fa652eb2b10684af9602bd804587917a8ed99d)
@@ -68,5 +68,5 @@
 void vesa_init(void)
 {
-	fb_init(vesa_ph_addr, vesa_width, vesa_height, vesa_bpp, vesa_scanline);
+	fb_init(vesa_ph_addr, vesa_width, vesa_height, vesa_bpp, vesa_scanline, false);
 }
 
Index: kernel/arch/mips32/src/mips32.c
===================================================================
--- kernel/arch/mips32/src/mips32.c	(revision d7e3fa668f022eef3ff46bde138d8a874b93f18d)
+++ kernel/arch/mips32/src/mips32.c	(revision b4fa652eb2b10684af9602bd804587917a8ed99d)
@@ -128,5 +128,5 @@
 {
 #ifdef CONFIG_FB
-	fb_init(0x12000000, 640, 480, 24, 1920); // gxemul framebuffer
+	fb_init(0x12000000, 640, 480, 24, 1920, false); // gxemul framebuffer
 #endif
 	sysinfo_set_item_val("machine." STRING(MACHINE),NULL,1);
Index: kernel/arch/ppc32/src/ppc32.c
===================================================================
--- kernel/arch/ppc32/src/ppc32.c	(revision d7e3fa668f022eef3ff46bde138d8a874b93f18d)
+++ kernel/arch/ppc32/src/ppc32.c	(revision b4fa652eb2b10684af9602bd804587917a8ed99d)
@@ -71,5 +71,5 @@
 {
 	if (config.cpu_active == 1) {
-		fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline);
+		fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline, false);
 	
 		/* Initialize PIC */
Index: kernel/arch/ppc64/src/ppc64.c
===================================================================
--- kernel/arch/ppc64/src/ppc64.c	(revision d7e3fa668f022eef3ff46bde138d8a874b93f18d)
+++ kernel/arch/ppc64/src/ppc64.c	(revision b4fa652eb2b10684af9602bd804587917a8ed99d)
@@ -27,5 +27,5 @@
  */
 
- /** @addtogroup ppc64
+/** @addtogroup ppc64
  * @{
  */
@@ -69,5 +69,5 @@
 {
 	if (config.cpu_active == 1) {
-		fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline);	
+		fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height, bootinfo.screen.bpp, bootinfo.screen.scanline, false);
 	
 		/* Merge all zones to 1 big zone */
@@ -111,5 +111,4 @@
 }
 
- /** @}
+/** @}
  */
-
Index: kernel/arch/sparc64/src/console.c
===================================================================
--- kernel/arch/sparc64/src/console.c	(revision d7e3fa668f022eef3ff46bde138d8a874b93f18d)
+++ kernel/arch/sparc64/src/console.c	(revision b4fa652eb2b10684af9602bd804587917a8ed99d)
@@ -59,5 +59,5 @@
 		
 	fb_init(bootinfo.screen.addr, bootinfo.screen.width, bootinfo.screen.height,
-		bootinfo.screen.bpp, bootinfo.screen.scanline);
+		bootinfo.screen.bpp, bootinfo.screen.scanline, true);
 }
 
Index: kernel/genarch/include/fb/fb.h
===================================================================
--- kernel/genarch/include/fb/fb.h	(revision d7e3fa668f022eef3ff46bde138d8a874b93f18d)
+++ kernel/genarch/include/fb/fb.h	(revision b4fa652eb2b10684af9602bd804587917a8ed99d)
@@ -40,5 +40,5 @@
 
 extern spinlock_t fb_lock;
-void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan);
+void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan, bool align);
 
 #endif
Index: kernel/genarch/src/fb/fb.c
===================================================================
--- kernel/genarch/src/fb/fb.c	(revision d7e3fa668f022eef3ff46bde138d8a874b93f18d)
+++ kernel/genarch/src/fb/fb.c	(revision b4fa652eb2b10684af9602bd804587917a8ed99d)
@@ -135,5 +135,12 @@
 }
 
-/** Put pixel - 8-bit depth (3:2:3) */
+/** Put pixel - 8-bit depth (color palette/3:2:3)
+ *
+ * Even though we try 3:2:3 color scheme here, an 8-bit framebuffer
+ * will most likely use a color palette. The color appearance
+ * will be pretty random and depend on the default installed
+ * palette. This could be fixed by supporting custom palette
+ * and setting it to simulate the 8-bit truecolor.
+ */
 static void rgb_1byte(void *dst, int rgb)
 {
@@ -141,5 +148,8 @@
 }
 
-/** Return pixel color - 8-bit depth (3:2:3) */
+/** Return pixel color - 8-bit depth (color palette/3:2:3)
+ *
+ * See the comment for rgb_1byte().
+ */
 static int byte1_rgb(void *src)
 {
@@ -330,12 +340,12 @@
 /** Initialize framebuffer as a chardev output device
  *
- * @param addr Physical address of the framebuffer
- * @param x    Screen width in pixels
- * @param y    Screen height in pixels
- * @param bpp  Bits per pixel (8, 16, 24, 32)
- * @param scan Bytes per one scanline
- *
- */
-void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan)
+ * @param addr 	Physical address of the framebuffer
+ * @param x    	Screen width in pixels
+ * @param y    	Screen height in pixels
+ * @param bpp  	Bits per pixel (8, 16, 24, 32)
+ * @param scan 	Bytes per one scanline
+ * @param align	Request alignment for 24bpp mode.
+ */
+void fb_init(uintptr_t addr, unsigned int x, unsigned int y, unsigned int bpp, unsigned int scan, bool align)
 {
 	switch (bpp) {
@@ -353,5 +363,8 @@
 			rgb2scr = rgb_3byte;
 			scr2rgb = byte3_rgb;
-			pixelbytes = 3;
+			if (align)
+				pixelbytes = 4;
+			else
+				pixelbytes = 3;
 			break;
 		case 32:
