Skip to content

Instantly share code, notes, and snippets.

@mkresin
Created November 28, 2015 13:43
Show Gist options
  • Save mkresin/d944c98352e5eaf92946 to your computer and use it in GitHub Desktop.
Save mkresin/d944c98352e5eaf92946 to your computer and use it in GitHub Desktop.
Lantiq vrx200 bootrom dumper
diff --git a/arch/mips/lantiq/Makefile b/arch/lantiq/lantiq/Makefile
--- a/arch/mips/lantiq/Makefile
+++ b/arch/mips/lantiq/Makefile
@@ -8,5 +8,7 @@
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
+obj-$(CONFIG_DEBUG_FS) += bootrom.o
+
obj-$(CONFIG_SOC_TYPE_XWAY) += xway/
obj-$(CONFIG_SOC_FALCON) += falcon
diff --git a/arch/mips/lantiq/bootrom.c b/arch/mips/lantiq/bootrom.c
new file mode 100644
index 0000000..5403468
--- /dev/null
+++ b/arch/mips/lantiq/bootrom.c
@@ -0,0 +1,30 @@
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * Copyright (C) 2015 Mathias Kresin <[email protected]>
+ */
+
+#include <linux/debugfs.h>
+
+#define BOOTROM_OFFSET 0x1FC00000
+#define BOOTROM_SIZE 0x8000
+
+static struct debugfs_blob_wrapper bootrom;
+
+static int bootrom_setup(void)
+{
+ bootrom.data = (void __iomem *) KSEG1ADDR(BOOTROM_OFFSET);
+ bootrom.size = BOOTROM_SIZE;
+
+ if (!debugfs_create_blob("bootrom", 0444, NULL, &bootrom)) {
+ pr_err("Failed to create bootrom debugfs file\n");
+
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+postcore_initcall(bootrom_setup);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment