Patchwork mtd: allow mtd and jffs2 when ARCH=um

login
register
mail settings
Submitter Geert Uytterhoeven
Date Dec. 15, 2010, 8:18 a.m.
Message ID <AANLkTinaXvc=3r9gRNkSnttay-2yD9BDtXo0mOmMff0H@mail.gmail.com>
Download mbox | patch
Permalink /patch/75630/
State New
Headers show

Comments

Geert Uytterhoeven - Dec. 15, 2010, 8:18 a.m.
On Wed, Dec 15, 2010 at 02:19, Jason Lunz <lunz@acm.org> wrote:
> On Tue, Dec 14, 2010 at 06:49:02PM -0600, Rob Landley wrote:
>> The problem is that jffs2 is a filesystem, and thus something people would
>> really like to be able to loopback mount, but it's hardwired to assume it's
>> only ever stored on a certain type of hardware, and thus requies incestuous
>> knowledge of the erase granularity of the flash layer in order to function.
>
> I assume you can turn your jffs2 image file into a block dev using
> losetup, then turn the corresponding loop device into an mtd device
> using block2mtd, at which point you ought to be able to mount it with
> jffs2. I've never tried it.

And block2mtd is part of mtd, so you have to get mtd compiled first.

BTW, the patch I used in the past was less intrusive than yours.
I attached it, as I can't send it inline from here.
Note that it was against 2.6.31-rc4.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

Patch

commit 57fce0f17f497583266a26328690f40f33af08c5
Author: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>
Date:   Mon Dec 15 15:21:15 2008 +0100

    UML: Enable MTD, by moving the dependency on HAS_IOMEM

    Signed-off-by: Geert Uytterhoeven <Geert.Uytterhoeven@sonycom.com>

diff --git a/arch/um/Kconfig.rest b/arch/um/Kconfig.rest
index 0ccad0f..e34f399 100644
--- a/arch/um/Kconfig.rest
+++ b/arch/um/Kconfig.rest
@@ -28,9 +28,7 @@  source "drivers/scsi/Kconfig"
 
 source "drivers/md/Kconfig"
 
-if BROKEN
-	source "drivers/mtd/Kconfig"
-endif
+source "drivers/mtd/Kconfig"
 
 source "drivers/leds/Kconfig"
 
diff --git a/drivers/mtd/Kconfig b/drivers/mtd/Kconfig
index b8e35a0..052b00c 100644
--- a/drivers/mtd/Kconfig
+++ b/drivers/mtd/Kconfig
@@ -1,6 +1,5 @@ 
 menuconfig MTD
 	tristate "Memory Technology Device (MTD) support"
-	depends on HAS_IOMEM
 	help
 	  Memory Technology Devices are flash, RAM and similar chips, often
 	  used for solid state file systems on embedded devices. This option
@@ -315,15 +314,17 @@  config MTD_OOPS
 	  To use, add console=ttyMTDx to the kernel command line,
 	  where x is the MTD device number to use.
 
-source "drivers/mtd/chips/Kconfig"
-
-source "drivers/mtd/maps/Kconfig"
+if HAS_IOMEM
+	source "drivers/mtd/chips/Kconfig"
+	source "drivers/mtd/maps/Kconfig"
+endif
 
 source "drivers/mtd/devices/Kconfig"
 
-source "drivers/mtd/nand/Kconfig"
-
-source "drivers/mtd/onenand/Kconfig"
+if HAS_IOMEM
+	source "drivers/mtd/nand/Kconfig"
+	source "drivers/mtd/onenand/Kconfig"
+endif
 
 source "drivers/mtd/lpddr/Kconfig"
 
diff --git a/drivers/mtd/Makefile b/drivers/mtd/Makefile
index 82d1e4d..09fb548 100644
--- a/drivers/mtd/Makefile
+++ b/drivers/mtd/Makefile
@@ -29,6 +29,7 @@  obj-$(CONFIG_MTD_OOPS)		+= mtdoops.o
 nftl-objs		:= nftlcore.o nftlmount.o
 inftl-objs		:= inftlcore.o inftlmount.o
 
-obj-y		+= chips/ lpddr/ maps/ devices/ nand/ onenand/ tests/
+obj-y				+= devices/ tests/
 
+obj-$(CONFIG_HAS_IOMEM)		+= chips/ lpddr/ maps/ nand/ onenand/
 obj-$(CONFIG_MTD_UBI)		+= ubi/
diff --git a/drivers/mtd/devices/Kconfig b/drivers/mtd/devices/Kconfig
index 325fab9..88937d6 100644
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -106,6 +106,7 @@  config M25PXX_USE_FAST_READ
 
 config MTD_SLRAM
 	tristate "Uncached system RAM"
+	depends on HAS_IOMEM
 	help
 	  If your CPU cannot cache all of the physical memory in your machine,
 	  you can still use it for storage or swap by using this driver to
@@ -113,6 +114,7 @@  config MTD_SLRAM
 
 config MTD_PHRAM
 	tristate "Physical system RAM"
+	depends on HAS_IOMEM
 	help
 	  This is a re-implementation of the slram driver above.
 
@@ -179,6 +181,7 @@  config MTD_BLOCK2MTD
 	  Testing MTD users (eg JFFS2) on large media and media that might
 	  be removed during a write (using the floppy drive).
 
+if HAS_IOMEM
 comment "Disk-On-Chip Device Drivers"
 
 config MTD_DOC2000
@@ -297,5 +300,6 @@  config MTD_DOCPROBE_55AA
 	  LinuxBIOS or if you need to recover a DiskOnChip Millennium on which
 	  you have managed to wipe the first block.
 
+endif
 endmenu