--- /dev/null
+++ b/include/linux/crashlog.h
-@@ -0,0 +1,12 @@
+@@ -0,0 +1,17 @@
+#ifndef __CRASHLOG_H
+#define __CRASHLOG_H
+
+#ifdef CONFIG_CRASHLOG
-+void __init crashlog_init_mem(struct bootmem_data *bdata);
++void __init crashlog_init_bootmem(struct bootmem_data *bdata);
++void __init crashlog_init_memblock(phys_addr_t addr, phys_addr_t size);
+#else
-+static inline void crashlog_init_mem(struct bootmem_data *bdata)
++static inline void crashlog_init_bootmem(struct bootmem_data *bdata)
++{
++}
++
++static inline void crashlog_init_memblock(phys_addr_t addr, phys_addr_t size)
+{
+}
+#endif
+config CRASHLOG
+ bool "Crash logging"
-+ depends on !NO_BOOTMEM && !HAVE_MEMBLOCK
++ depends on !NO_BOOTMEM || HAVE_MEMBLOCK
+
config BLK_DEV_INITRD
bool "Initial RAM filesystem and RAM disk (initramfs/initrd) support"
--- /dev/null
+++ b/kernel/crashlog.c
-@@ -0,0 +1,171 @@
+@@ -0,0 +1,190 @@
+/*
+ * Crash information logger
+ * Copyright (C) 2010 Felix Fietkau <nbd@openwrt.org>
+
+#include <linux/module.h>
+#include <linux/bootmem.h>
++#include <linux/memblock.h>
+#include <linux/debugfs.h>
+#include <linux/crashlog.h>
+#include <linux/kmsg_dump.h>
+
+extern struct list_head *crashlog_modules;
+
-+void __init crashlog_init_mem(bootmem_data_t *bdata)
++#ifndef CONFIG_NO_BOOTMEM
++void __init crashlog_init_bootmem(bootmem_data_t *bdata)
+{
+ unsigned long addr;
+
+ }
+ crashlog_addr = addr;
+}
++#endif
++
++#ifdef CONFIG_HAVE_MEMBLOCK
++void __init crashlog_init_memblock(phys_addr_t addr, phys_addr_t size)
++{
++ if (crashlog_addr)
++ return;
++
++ addr += size - CRASHLOG_OFFSET;
++ if (memblock_reserve(addr, CRASHLOG_SIZE)) {
++ printk("Crashlog failed to allocate RAM at address 0x%lx\n", (unsigned long) addr);
++ return;
++ }
++
++ crashlog_addr = addr;
++}
++#endif
+
+static void __init crashlog_copy(void)
+{
if (!bdata->node_bootmem_map)
return 0;
-+ crashlog_init_mem(bdata);
++ crashlog_init_bootmem(bdata);
start = bdata->node_min_pfn;
end = bdata->node_low_pfn;
/* Block module loading/unloading? */
+--- a/mm/memblock.c
++++ b/mm/memblock.c
+@@ -19,6 +19,7 @@
+ #include <linux/debugfs.h>
+ #include <linux/seq_file.h>
+ #include <linux/memblock.h>
++#include <linux/crashlog.h>
+
+ static struct memblock_region memblock_memory_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
+ static struct memblock_region memblock_reserved_init_regions[INIT_MEMBLOCK_REGIONS] __initdata_memblock;
+@@ -305,6 +306,8 @@ static void __init_memblock memblock_ins
+ memblock_set_region_node(rgn, nid);
+ type->cnt++;
+ type->total_size += size;
++ if (type == &memblock.memory && idx == 0)
++ crashlog_init_memblock(base, size);
+ }
+
+ /**