Index: boot/arch/arm32/Makefile.inc
===================================================================
--- boot/arch/arm32/Makefile.inc	(revision f288d85e3e9c267eea05c097de761199f08ce773)
+++ boot/arch/arm32/Makefile.inc	(revision e006ba5af0ea67bfcd13a1ce5218726c2ea37c8b)
@@ -35,5 +35,5 @@
 endif
 
-ifeq ($(MACHINE), beagleboardxm)
+ifeq ($(MACHINE), $(filter $(MACHINE),beagleboardxm beaglebone))
 	BOOT_OUTPUT = image.boot
 	POST_OUTPUT = $(ROOT_PATH)/uImage.bin
@@ -54,5 +54,5 @@
 RD_SRVS_ESSENTIAL += \
 	$(USPACE_PATH)/srv/hid/s3c24xx_ts/s3c24xx_ts \
-	$(USPACE_PATH)/srv/hw/char/s3c24xx_uart/s3c24xx_uart
+	$(USPACE_PATH)/srv/hw/char/s3c24xx_uart/s3c24ser
 endif
 
Index: boot/arch/arm32/include/arch.h
===================================================================
--- boot/arch/arm32/include/arch.h	(revision f288d85e3e9c267eea05c097de761199f08ce773)
+++ boot/arch/arm32/include/arch.h	(revision e006ba5af0ea67bfcd13a1ce5218726c2ea37c8b)
@@ -44,4 +44,6 @@
 #elif defined MACHINE_beagleboardxm
 #define BOOT_BASE	0x80000000
+#elif defined MACHINE_beaglebone
+#define BOOT_BASE       0x80000000
 #else
 #define BOOT_BASE	0x00000000
@@ -51,4 +53,6 @@
 
 #ifdef MACHINE_beagleboardxm
+	#define PA_OFFSET 0
+#elif defined MACHINE_beaglebone
 	#define PA_OFFSET 0
 #else
Index: boot/arch/arm32/include/main.h
===================================================================
--- boot/arch/arm32/include/main.h	(revision f288d85e3e9c267eea05c097de761199f08ce773)
+++ boot/arch/arm32/include/main.h	(revision e006ba5af0ea67bfcd13a1ce5218726c2ea37c8b)
@@ -51,4 +51,13 @@
 #define BBXM_THR_FULL           0x00000001
 
+/** Beaglebone UART register addresses
+ *
+ * This is UART0 of AM335x CPU
+ */
+#define BBONE_SCONS_THR         0x44E09000
+#define BBONE_SCONS_SSR         0x44E09044
+
+/** Check this bit before writing (tx fifo full) */
+#define BBONE_TXFIFO_FULL       0x00000001
 
 /** GTA02 serial console UART register addresses.
Index: boot/arch/arm32/include/mm.h
===================================================================
--- boot/arch/arm32/include/mm.h	(revision f288d85e3e9c267eea05c097de761199f08ce773)
+++ boot/arch/arm32/include/mm.h	(revision e006ba5af0ea67bfcd13a1ce5218726c2ea37c8b)
@@ -63,4 +63,9 @@
 #define BBXM_RAM_END   0xc0000000
 
+/** Start of ram memory on AM335x */
+#define AM335x_RAM_START   0x80000000
+/** End of ram memory on AM335x */
+#define AM335x_RAM_END     0xC0000000
+
 
 /* Page table level 0 entry - "section" format is used
@@ -76,5 +81,6 @@
 	unsigned int access_permission_0 : 2;
 	unsigned int tex : 3;
-	unsigned int access_permission_1 : 2;
+	unsigned int access_permission_1 : 1;
+	unsigned int shareable : 1;
 	unsigned int non_global : 1;
 	unsigned int should_be_zero_2 : 1;
Index: boot/arch/arm32/src/mm.c
===================================================================
--- boot/arch/arm32/src/mm.c	(revision f288d85e3e9c267eea05c097de761199f08ce773)
+++ boot/arch/arm32/src/mm.c	(revision e006ba5af0ea67bfcd13a1ce5218726c2ea37c8b)
@@ -38,4 +38,15 @@
 #include <arch/mm.h>
 
+/** Disable the MMU */
+static void disable_paging(void)
+{
+	asm volatile (
+		"mrc p15, 0, r0, c1, c0, 0\n"
+		"bic r0, r0, #1\n"
+		"mcr p15, 0, r0, c1, c0, 0\n"
+		::: "r0"
+	);
+}
+
 /** Check if caching can be enabled for a given memory section.
  *
@@ -59,4 +70,8 @@
 	const unsigned long address = section << PTE_SECTION_SHIFT;
 	if (address >= BBXM_RAM_START && address < BBXM_RAM_END)
+		return 1;
+#elif defined MACHINE_beaglebone
+	const unsigned long address = section << PTE_SECTION_SHIFT;
+	if (address >= AM335x_RAM_START && address < AM335x_RAM_END)
 		return 1;
 #endif
@@ -88,4 +103,5 @@
 	pte->tex = 0;
 	pte->access_permission_1 = 0;
+	pte->shareable = 0;
 	pte->non_global = 0;
 	pte->should_be_zero_2 = 0;
@@ -102,18 +118,4 @@
 	for (page = 0; page < split_page; page++)
 		init_ptl0_section(&boot_pt[page], page);
-	
-	/*
-	 * Create 1:1 virtual-physical mapping in kernel space
-	 * (upper 2 GB), physical addresses start from 0.
-	 */
-	/* BeagleBoard-xM (DM37x) memory starts at 2GB border,
-	 * thus mapping only lower 2GB is not not enough.
-	 * Map entire AS 1:1 instead and hope it works. */
-	for (page = split_page; page < PTL0_ENTRIES; page++)
-#ifndef MACHINE_beagleboardxm
-		init_ptl0_section(&boot_pt[page], page - split_page);
-#else
-		init_ptl0_section(&boot_pt[page], page);
-#endif
 	
 	asm volatile (
@@ -132,5 +134,5 @@
 		"ldr r0, =0x55555555\n"
 		"mcr p15, 0, r0, c3, c0, 0\n"
-		
+
 		/* Current settings */
 		"mrc p15, 0, r0, c1, c0, 0\n"
@@ -143,6 +145,11 @@
 		
 		"orr r0, r0, r1\n"
+
+		/* Invalidate the TLB content before turning on the MMU.
+		 * ARMv7-A Reference manual, B3.10.3
+		 */
+		"mcr p15, 0, r0, c8, c7, 0\n"
 		
-		/* Store settings */
+		/* Store settings, enable the MMU */
 		"mcr p15, 0, r0, c1, c0, 0\n"
 		::: "r0", "r1"
@@ -152,4 +159,5 @@
 /** Start the MMU - initialize page table and enable paging. */
 void mmu_start() {
+	disable_paging();
 	init_boot_pt();
 	enable_paging();
Index: boot/arch/arm32/src/putchar.c
===================================================================
--- boot/arch/arm32/src/putchar.c	(revision f288d85e3e9c267eea05c097de761199f08ce773)
+++ boot/arch/arm32/src/putchar.c	(revision e006ba5af0ea67bfcd13a1ce5218726c2ea37c8b)
@@ -40,4 +40,26 @@
 #include <putchar.h>
 #include <str.h>
+
+#ifdef MACHINE_beaglebone
+
+/** Send a byte to the am335x serial console.
+ *
+ * @param byte		Byte to send.
+ */
+static void scons_sendb_bbone(uint8_t byte)
+{
+	volatile uint32_t *thr =
+		(volatile uint32_t *) BBONE_SCONS_THR;
+	volatile uint32_t *ssr =
+		(volatile uint32_t *) BBONE_SCONS_SSR;
+
+	/* Wait until transmitter is empty */
+	while (*ssr & BBONE_TXFIFO_FULL);
+
+	/* Transmit byte */
+	*thr = (uint32_t) byte;
+}
+
+#endif
 
 #ifdef MACHINE_beagleboardxm
@@ -106,4 +128,7 @@
 static void scons_sendb(uint8_t byte)
 {
+#ifdef MACHINE_beaglebone
+	scons_sendb_bbone(byte);
+#endif
 #ifdef MACHINE_beagleboardxm
 	scons_sendb_bbxm(byte);
Index: boot/arch/mips32/Makefile.inc
===================================================================
--- boot/arch/mips32/Makefile.inc	(revision f288d85e3e9c267eea05c097de761199f08ce773)
+++ boot/arch/mips32/Makefile.inc	(revision e006ba5af0ea67bfcd13a1ce5218726c2ea37c8b)
@@ -29,24 +29,25 @@
 BFD_ARCH = mips
 BITS = 32
-EXTRA_CFLAGS = -msoft-float -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mips3 -mabi=32
+EXTRA_CFLAGS = -msoft-float -mno-abicalls -G 0 -fno-zero-initialized-in-bss -mabi=32
 
-RD_SRVS_NON_ESSENTIAL += \
-	$(USPACE_PATH)/srv/bd/gxe_bd/gxe_bd
-
-ifeq ($(MACHINE),lgxemul)
-	BFD_NAME = elf32-tradlittlemips
-	BFD_OUTPUT = ecoff-littlemips
-	ENDIANESS = LE
-endif
-ifeq ($(MACHINE),bgxemul)
-	BFD_NAME = elf32-tradbigmips
-	BFD_OUTPUT = ecoff-bigmips
-	ENDIANESS = BE
-endif
 ifeq ($(MACHINE),msim)
 	BFD_NAME = elf32-tradlittlemips
 	BFD_OUTPUT = binary
 	ENDIANESS = LE
+	EXTRA_CFLAGS += -march=r4000
 endif
+ifeq ($(MACHINE),lmalta)
+	BFD_NAME = elf32-tradlittlemips
+	BFD_OUTPUT = elf32-tradlittlemips 
+	ENDIANESS = LE
+	EXTRA_CFLAGS += -march=4kc
+endif
+ifeq ($(MACHINE),bmalta)
+	BFD_NAME = elf32-tradbigmips
+	BFD_OUTPUT = elf32-tradbigmips 
+	ENDIANESS = BE
+	EXTRA_CFLAGS += -march=4kc
+endif
+
 
 SOURCES = \
Index: boot/arch/mips32/_link.ld.in
===================================================================
--- boot/arch/mips32/_link.ld.in	(revision f288d85e3e9c267eea05c097de761199f08ce773)
+++ boot/arch/mips32/_link.ld.in	(revision e006ba5af0ea67bfcd13a1ce5218726c2ea37c8b)
@@ -2,5 +2,9 @@
 
 SECTIONS {
+#if defined(MACHINE_msim)
 	. = 0xbfc00000;
+#elif defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
+	. = 0x80103000;
+#endif
 	.text : {
 		*(BOOTSTRAP);
Index: boot/arch/mips32/include/arch.h
===================================================================
--- boot/arch/mips32/include/arch.h	(revision f288d85e3e9c267eea05c097de761199f08ce773)
+++ boot/arch/mips32/include/arch.h	(revision e006ba5af0ea67bfcd13a1ce5218726c2ea37c8b)
@@ -33,4 +33,5 @@
 #define PAGE_SIZE   (1 << PAGE_WIDTH)
 
+#if defined(MACHINE_msim)
 #define CPUMAP_OFFSET    0x00001000
 #define STACK_OFFSET     0x00002000
@@ -41,7 +42,21 @@
 #define MSIM_VIDEORAM_ADDRESS  0xb0000000
 #define MSIM_DORDER_ADDRESS    0xb0000100
+#endif
+
+#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
+#define CPUMAP_OFFSET    0x00100000
+#define STACK_OFFSET     0x00101000
+#define BOOTINFO_OFFSET  0x00102000
+#define BOOT_OFFSET      0x00200000
+#define LOADER_OFFSET    0x00103000
+
+#define YAMON_SUBR_BASE		PA2KA(0x1fc00500)
+#define YAMON_SUBR_PRINT_COUNT	(YAMON_SUBR_BASE + 0x4)
+#endif
 
 #ifndef __ASM__
 	#define PA2KA(addr)    (((uintptr_t) (addr)) + 0x80000000)
+	#define PA2KSEG(addr)  (((uintptr_t) (addr)) + 0xa0000000)
+	#define KA2PA(addr)    (((uintptr_t) (addr)) - 0x80000000)
 	#define KSEG2PA(addr)  (((uintptr_t) (addr)) - 0xa0000000)
 #else
Index: boot/arch/mips32/include/types.h
===================================================================
--- boot/arch/mips32/include/types.h	(revision f288d85e3e9c267eea05c097de761199f08ce773)
+++ boot/arch/mips32/include/types.h	(revision e006ba5af0ea67bfcd13a1ce5218726c2ea37c8b)
@@ -47,4 +47,7 @@
 
 typedef struct {
+#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
+	uint32_t sdram_size;
+#endif
 	uint32_t cpumap;
 	size_t cnt;
Index: boot/arch/mips32/src/asm.S
===================================================================
--- boot/arch/mips32/src/asm.S	(revision f288d85e3e9c267eea05c097de761199f08ce773)
+++ boot/arch/mips32/src/asm.S	(revision e006ba5af0ea67bfcd13a1ce5218726c2ea37c8b)
@@ -51,4 +51,12 @@
 	and $a0, $a1, $a0
 	mtc0 $a0, $status
+
+#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
+	/*
+	 * Remember the size of the SDRAM in bootinfo.
+	 */
+	la $a0, PA2KA(BOOTINFO_OFFSET)
+	sw $a3, 0($a0)
+#endif
 	
 	/*
Index: boot/arch/mips32/src/main.c
===================================================================
--- boot/arch/mips32/src/main.c	(revision f288d85e3e9c267eea05c097de761199f08ce773)
+++ boot/arch/mips32/src/main.c	(revision e006ba5af0ea67bfcd13a1ce5218726c2ea37c8b)
@@ -65,6 +65,9 @@
 	for (i = 0; i < COMPONENTS; i++)
 		printf(" %p|%p: %s image (%zu/%zu bytes)\n", components[i].start,
-		    (void *) KSEG2PA(components[i].start), components[i].name,
-		    components[i].inflated, components[i].size);
+		    (uintptr_t) components[i].start >= PA2KSEG(0) ?
+		    (void *) KSEG2PA(components[i].start) :
+		    (void *) KA2PA(components[i].start),
+		    components[i].name, components[i].inflated,
+		    components[i].size);
 	
 	void *dest[COMPONENTS];
@@ -93,4 +96,5 @@
 	
 	for (i = cnt; i > 0; i--) {
+#ifdef MACHINE_msim
 		void *tail = dest[i - 1] + components[i].inflated;
 		if (tail >= ((void *) PA2KA(LOADER_OFFSET))) {
@@ -99,4 +103,5 @@
 			halt();
 		}
+#endif
 		
 		printf("%s ", components[i - 1].name);
Index: boot/arch/mips32/src/putchar.c
===================================================================
--- boot/arch/mips32/src/putchar.c	(revision f288d85e3e9c267eea05c097de761199f08ce773)
+++ boot/arch/mips32/src/putchar.c	(revision e006ba5af0ea67bfcd13a1ce5218726c2ea37c8b)
@@ -32,9 +32,36 @@
 #include <str.h>
 
+#ifdef PUTCHAR_ADDRESS
+#undef PUTCHAR_ADDRESS
+#endif
+
+#if defined(MACHINE_msim)
+#define _putchar(ch)	msim_putchar((ch))
+static void msim_putchar(const wchar_t ch)
+{
+	*((char *) MSIM_VIDEORAM_ADDRESS) = ch;
+}
+#endif
+
+#if defined(MACHINE_lmalta) || defined(MACHINE_bmalta)
+#define _putchar(ch)	yamon_putchar((ch))
+typedef void (**yamon_print_count_ptr_t)(uint32_t, const char *, uint32_t);
+yamon_print_count_ptr_t yamon_print_count =
+    (yamon_print_count_ptr_t) YAMON_SUBR_PRINT_COUNT;
+
+static void yamon_putchar(const wchar_t wch)
+{
+	const char ch = (char) wch;
+
+	(*yamon_print_count)(0, &ch, 1);
+}
+#endif
+
 void putchar(const wchar_t ch)
 {
 	if (ascii_check(ch))
-		*((char *) MSIM_VIDEORAM_ADDRESS) = ch;
+		_putchar(ch);
 	else
-		*((char *) MSIM_VIDEORAM_ADDRESS) = U_SPECIAL;
+		_putchar(U_SPECIAL);
 }
+
