Index: boot/Makefile.uboot
===================================================================
--- boot/Makefile.uboot	(revision be1dcc2699d4c96f7d72aa17f9743e49dfc9ec30)
+++ boot/Makefile.uboot	(revision fde2dab993d34305caa16140d803bd72e420ddf6)
@@ -40,5 +40,5 @@
 
 $(POST_OUTPUT): $(BIN_OUTPUT)
-	$(MKUIMAGE) -name "$(IMAGE_NAME)" -laddr 0x30008000 -saddr 0x30008000 $< $@
+	$(MKUIMAGE) -name "$(IMAGE_NAME)" -laddr $(LADDR) -saddr $(SADDR) -ostype $(UIMAGE_OS) $< $@
 
 clean:
Index: boot/arch/arm32/Makefile.inc
===================================================================
--- boot/arch/arm32/Makefile.inc	(revision be1dcc2699d4c96f7d72aa17f9743e49dfc9ec30)
+++ boot/arch/arm32/Makefile.inc	(revision fde2dab993d34305caa16140d803bd72e420ddf6)
@@ -30,4 +30,14 @@
 	BOOT_OUTPUT = image.boot
 	POST_OUTPUT = $(ROOT_PATH)/uImage.bin
+	LADDR = 0x30008000
+	SADDR = 0x30008000
+	POSTBUILD = Makefile.uboot
+endif
+
+ifeq ($(MACHINE), beagleboardxm)
+	BOOT_OUTPUT = image.boot
+	POST_OUTPUT = $(ROOT_PATH)/uImage.bin
+	LADDR = 0x80000000
+	SADDR = 0x80000000
 	POSTBUILD = Makefile.uboot
 endif
@@ -39,12 +49,26 @@
 BITS = 32
 ENDIANESS = LE
-EXTRA_CFLAGS = -march=armv4
+EXTRA_CFLAGS = -march=$(subst _,-,$(PROCESSOR)) -mno-unaligned-access
 
+ifeq ($(MACHINE), gta02)
 RD_SRVS_ESSENTIAL += \
 	$(USPACE_PATH)/srv/hid/s3c24xx_ts/s3c24xx_ts \
 	$(USPACE_PATH)/srv/hw/char/s3c24xx_uart/s3c24xx_uart
+endif
 
+ifeq ($(MACHINE), gxemul)
 RD_SRVS_NON_ESSENTIAL += \
 	$(USPACE_PATH)/srv/bd/gxe_bd/gxe_bd
+endif
+
+RD_DRVS += \
+	infrastructure/rootamdm37x \
+	bus/usb/ehci \
+	bus/usb/ohci \
+	bus/usb/usbflbk \
+	bus/usb/usbhub \
+	bus/usb/usbhid \
+	bus/usb/usbmast \
+	bus/usb/usbmid
 
 SOURCES = \
Index: boot/arch/arm32/include/arch.h
===================================================================
--- boot/arch/arm32/include/arch.h	(revision be1dcc2699d4c96f7d72aa17f9743e49dfc9ec30)
+++ boot/arch/arm32/include/arch.h	(revision fde2dab993d34305caa16140d803bd72e420ddf6)
@@ -42,4 +42,6 @@
 #ifdef MACHINE_gta02
 #define BOOT_BASE	0x30008000
+#elif defined MACHINE_beagleboardxm
+#define BOOT_BASE	0x80000000
 #else
 #define BOOT_BASE	0x00000000
@@ -48,9 +50,16 @@
 #define BOOT_OFFSET	(BOOT_BASE + 0xa00000)
 
+#ifdef MACHINE_beagleboardxm
+	#define PA_OFFSET 0
+#else
+	#define PA_OFFSET 0x80000000
+#endif
+
 #ifndef __ASM__
-	#define PA2KA(addr)  (((uintptr_t) (addr)) + 0x80000000)
+	#define PA2KA(addr)  (((uintptr_t) (addr)) + PA_OFFSET)
 #else
-	#define PA2KA(addr)  ((addr) + 0x80000000)
+	#define PA2KA(addr)  ((addr) + PA_OFFSET)
 #endif
+
 
 #endif
Index: boot/arch/arm32/include/main.h
===================================================================
--- boot/arch/arm32/include/main.h	(revision be1dcc2699d4c96f7d72aa17f9743e49dfc9ec30)
+++ boot/arch/arm32/include/main.h	(revision fde2dab993d34305caa16140d803bd72e420ddf6)
@@ -40,4 +40,16 @@
 /** Address where characters to be printed are expected. */
 
+
+/** BeagleBoard-xM UART register address
+ *
+ * This is UART3 of AM/DM37x CPU
+ */
+#define BBXM_SCONS_THR          0x49020000
+#define BBXM_SCONS_SSR          0x49020044
+
+/* Check this bit before writing (tx fifo full) */
+#define BBXM_THR_FULL           0x00000001
+
+
 /** GTA02 serial console UART register addresses.
  *
Index: boot/arch/arm32/include/mm.h
===================================================================
--- boot/arch/arm32/include/mm.h	(revision be1dcc2699d4c96f7d72aa17f9743e49dfc9ec30)
+++ boot/arch/arm32/include/mm.h	(revision fde2dab993d34305caa16140d803bd72e420ddf6)
@@ -58,9 +58,13 @@
 	unsigned int bufferable : 1;
 	unsigned int cacheable : 1;
-	unsigned int impl_specific : 1;
+	unsigned int xn : 1;
 	unsigned int domain : 4;
 	unsigned int should_be_zero_1 : 1;
-	unsigned int access_permission : 2;
-	unsigned int should_be_zero_2 : 8;
+	unsigned int access_permission_0 : 2;
+	unsigned int tex : 3;
+	unsigned int access_permission_1 : 2;
+	unsigned int non_global : 1;
+	unsigned int should_be_zero_2 : 1;
+	unsigned int non_secure : 1;
 	unsigned int section_base_addr : 12;
 } __attribute__((packed)) pte_level0_section_t;
Index: boot/arch/arm32/src/mm.c
===================================================================
--- boot/arch/arm32/src/mm.c	(revision be1dcc2699d4c96f7d72aa17f9743e49dfc9ec30)
+++ boot/arch/arm32/src/mm.c	(revision fde2dab993d34305caa16140d803bd72e420ddf6)
@@ -54,11 +54,15 @@
 {
 	pte->descriptor_type = PTE_DESCRIPTOR_SECTION;
-	pte->bufferable = 0;
+	pte->bufferable = 1;
 	pte->cacheable = 0;
-	pte->impl_specific = 0;
+	pte->xn = 0;
 	pte->domain = 0;
 	pte->should_be_zero_1 = 0;
-	pte->access_permission = PTE_AP_USER_NO_KERNEL_RW;
+	pte->access_permission_0 = PTE_AP_USER_NO_KERNEL_RW;
+	pte->tex = 0;
+	pte->access_permission_1 = 0;
+	pte->non_global = 0;
 	pte->should_be_zero_2 = 0;
+	pte->non_secure = 0;
 	pte->section_base_addr = frame;
 }
@@ -67,6 +71,5 @@
 static void init_boot_pt(void)
 {
-	pfn_t split_page = 0x800;
-	
+	const pfn_t split_page = PTL0_ENTRIES;
 	/* Create 1:1 virtual-physical mapping (in lower 2 GB). */
 	pfn_t page;
@@ -78,6 +81,13 @@
 	 * (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 (
@@ -95,11 +105,25 @@
 		/* Behave as a client of domains */
 		"ldr r0, =0x55555555\n"
-		"mcr p15, 0, r0, c3, c0, 0\n" 
+		"mcr p15, 0, r0, c3, c0, 0\n"
 		
+#ifdef PROCESSOR_armv7_a
+		/* Read Auxiliary control register */
+		"mrc p15, 0, r0, c1, c0, 1\n"
+		/* Mask to enable L2 cache */
+		"ldr r1, =0x00000002\n"
+		"orr r0, r0, r1\n"
+		/* Store Auxiliary control register */
+		"mrc p15, 0, r0, c1, c0, 1\n"
+#endif
 		/* Current settings */
 		"mrc p15, 0, r0, c1, c0, 0\n"
 		
+#ifdef PROCESSOR_armv7_a
+		/* Mask to enable paging, caching */
+		"ldr r1, =0x00000005\n"
+#else
 		/* Mask to enable paging */
 		"ldr r1, =0x00000001\n"
+#endif
 		"orr r0, r0, r1\n"
 		
Index: boot/arch/arm32/src/putchar.c
===================================================================
--- boot/arch/arm32/src/putchar.c	(revision be1dcc2699d4c96f7d72aa17f9743e49dfc9ec30)
+++ boot/arch/arm32/src/putchar.c	(revision fde2dab993d34305caa16140d803bd72e420ddf6)
@@ -40,4 +40,26 @@
 #include <putchar.h>
 #include <str.h>
+
+#ifdef MACHINE_beagleboardxm
+
+/** Send a byte to the amdm37x serial console.
+ *
+ * @param byte		Byte to send.
+ */
+static void scons_sendb_bbxm(uint8_t byte)
+{
+	volatile uint32_t *thr =
+	    (volatile uint32_t *)BBXM_SCONS_THR;
+	volatile uint32_t *ssr =
+	    (volatile uint32_t *)BBXM_SCONS_SSR;
+
+	/* Wait until transmitter is empty. */
+	while ((*ssr & BBXM_THR_FULL) == 1) ;
+
+	/* Transmit byte. */
+	*thr = (uint32_t) byte;
+}
+
+#endif
 
 #ifdef MACHINE_gta02
@@ -97,4 +119,7 @@
 static void scons_sendb(uint8_t byte)
 {
+#ifdef MACHINE_beagleboardxm
+	scons_sendb_bbxm(byte);
+#endif
 #ifdef MACHINE_gta02
 	scons_sendb_gta02(byte);
