All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Lunz <lunz@falooley.org>
To: atom ota <atomota@sleepyhammer.com>
Cc: linux-mtd@lists.infradead.org, Jeff Dike <jdike@addtoit.com>,
	David Woodhouse <dwmw2@infradead.org>,
	uml-user@lists.sourceforge.net
Subject: [PATCH] allow use of mtd and jffs2 on uml
Date: Tue, 23 Oct 2007 18:17:14 -0700	[thread overview]
Message-ID: <20071024011712.GA3762@falooley.org> (raw)
In-Reply-To: <22c797d00709272118i33d32b9dy93d5f5ec8f8edd30@mail.gmail.com>

In gmane.linux.uml.user, you wrote:
> I need to do some experiments with JFFS2 on a recent Linux kernel (2.6.22.6)
> and was hoping to use UML, with block2mtd or nandsim as my MTD, but either
> MTD configuration and consequently JFFS2 configuration isn't available in
> "make ARCH=um menuconfig", or I just can't find it.
>
> I've searched Google and the list archive and it looks like JFFS2 worked
> with UML in the past, but maybe something has changed.
>
> Is it possible to configure a UML kernel to support JFFS2?  If so, how?

The patch below makes it work. It's crude and I make no excuses for it,
but it does let jffs2-on-block2mtd work on uml without problems.

I think the addition of CONFIG_MTD_CHIPREG is an ugly hack in
particular, and improperly done at that (it stays off for !UML, I
think).

But it should get you going. Maybe this could serve as a basis for
something mergable. It applies to 2.6.23; with some wiggling it works on
earlier versions too.

Signed-off-by: Jason Lunz <lunz@falooley.org>

---
 arch/um/Kconfig             |    4 +---
 drivers/mtd/Kconfig         |   12 +++++++-----
 drivers/mtd/chips/Kconfig   |   11 ++++++++---
 drivers/mtd/devices/Kconfig |    7 +++++++
 4 files changed, 23 insertions(+), 11 deletions(-)

Index: linux-2.6.23.1-uml/arch/um/Kconfig
===================================================================
--- linux-2.6.23.1-uml.orig/arch/um/Kconfig
+++ linux-2.6.23.1-uml/arch/um/Kconfig
@@ -326,9 +326,7 @@
 
 source "drivers/md/Kconfig"
 
-if BROKEN
-	source "drivers/mtd/Kconfig"
-endif
+source "drivers/mtd/Kconfig"
 
 #This is just to shut up some Kconfig warnings, so no prompt.
 config INPUT
Index: linux-2.6.23.1-uml/drivers/mtd/devices/Kconfig
===================================================================
--- linux-2.6.23.1-uml.orig/drivers/mtd/devices/Kconfig
+++ linux-2.6.23.1-uml/drivers/mtd/devices/Kconfig
@@ -78,6 +78,7 @@
 
 config MTD_SLRAM
 	tristate "Uncached system RAM"
+ 	depends on !UML
 	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
@@ -85,6 +86,7 @@
 
 config MTD_PHRAM
 	tristate "Physical system RAM"
+ 	depends on !UML
 	help
 	  This is a re-implementation of the slram driver above.
 
@@ -151,10 +153,13 @@
 	  Testing MTD users (eg JFFS2) on large media and media that might
 	  be removed during a write (using the floppy drive).
 
+if !UML
 comment "Disk-On-Chip Device Drivers"
+endif
 
 config MTD_DOC2000
 	tristate "M-Systems Disk-On-Chip 2000 and Millennium (DEPRECATED)"
+ 	depends on !UML
 	select MTD_DOCPROBE
 	select MTD_NAND_IDS
 	---help---
@@ -177,6 +182,7 @@
 
 config MTD_DOC2001
 	tristate "M-Systems Disk-On-Chip Millennium-only alternative driver (DEPRECATED)"
+ 	depends on !UML
 	select MTD_DOCPROBE
 	select MTD_NAND_IDS
 	---help---
@@ -198,6 +204,7 @@
 
 config MTD_DOC2001PLUS
 	tristate "M-Systems Disk-On-Chip Millennium Plus"
+ 	depends on !UML
 	select MTD_DOCPROBE
 	select MTD_NAND_IDS
 	---help---
Index: linux-2.6.23.1-uml/drivers/mtd/Kconfig
===================================================================
--- linux-2.6.23.1-uml.orig/drivers/mtd/Kconfig
+++ linux-2.6.23.1-uml/drivers/mtd/Kconfig
@@ -2,7 +2,6 @@
 
 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
@@ -280,13 +279,16 @@
 
 source "drivers/mtd/chips/Kconfig"
 
-source "drivers/mtd/maps/Kconfig"
+if !UML
+	source "drivers/mtd/maps/Kconfig"
+endif
 
 source "drivers/mtd/devices/Kconfig"
 
-source "drivers/mtd/nand/Kconfig"
-
-source "drivers/mtd/onenand/Kconfig"
+if !UML
+	source "drivers/mtd/nand/Kconfig"
+	source "drivers/mtd/onenand/Kconfig"
+endif
 
 source "drivers/mtd/ubi/Kconfig"
 
Index: linux-2.6.23.1-uml/drivers/mtd/chips/Kconfig
===================================================================
--- linux-2.6.23.1-uml.orig/drivers/mtd/chips/Kconfig
+++ linux-2.6.23.1-uml/drivers/mtd/chips/Kconfig
@@ -3,8 +3,13 @@
 menu "RAM/ROM/Flash chip drivers"
 	depends on MTD!=n
 
+config MTD_CHIPREG
+	bool
+ 	depends on !UML
+
 config MTD_CFI
 	tristate "Detect flash chips by Common Flash Interface (CFI) probe"
+ 	depends on !UML
 	select MTD_GEN_PROBE
 	help
 	  The Common Flash Interface specification was developed by Intel,
@@ -16,6 +21,7 @@
 
 config MTD_JEDECPROBE
 	tristate "Detect non-CFI AMD/JEDEC-compatible flash chips"
+ 	depends on !UML
 	select MTD_GEN_PROBE
 	help
 	  This option enables JEDEC-style probing of flash chips which are not
@@ -178,7 +184,7 @@
 
 config MTD_CFI_INTELEXT
 	tristate "Support for Intel/Sharp flash chips"
-	depends on MTD_GEN_PROBE
+	depends on MTD_GEN_PROBE && !UML
 	select MTD_CFI_UTIL
 	help
 	  The Common Flash Interface defines a number of different command
@@ -188,7 +194,7 @@
 
 config MTD_CFI_AMDSTD
 	tristate "Support for AMD/Fujitsu flash chips"
-	depends on MTD_GEN_PROBE
+	depends on MTD_GEN_PROBE && !UML
 	select MTD_CFI_UTIL
 	help
 	  The Common Flash Interface defines a number of different command
@@ -198,7 +204,7 @@
 
 config MTD_CFI_STAA
 	tristate "Support for ST (Advanced Architecture) flash chips"
-	depends on MTD_GEN_PROBE
+	depends on MTD_GEN_PROBE && !UML
 	select MTD_CFI_UTIL
 	help
 	  The Common Flash Interface defines a number of different command
@@ -210,18 +216,21 @@
 
 config MTD_RAM
 	tristate "Support for RAM chips in bus mapping"
+ 	depends on !UML
 	help
 	  This option enables basic support for RAM chips accessed through
 	  a bus mapping driver.
 
 config MTD_ROM
 	tristate "Support for ROM chips in bus mapping"
+ 	depends on !UML
 	help
 	  This option enables basic support for ROM chips accessed through
 	  a bus mapping driver.
 
 config MTD_ABSENT
 	tristate "Support for absent chips in bus mapping"
+ 	depends on !UML
 	help
 	  This option enables support for a dummy probing driver used to
 	  allocated placeholder MTD devices on systems that have socketed
Index: linux-2.6.23.1-uml/drivers/mtd/chips/Makefile
===================================================================
--- linux-2.6.23.1-uml.orig/drivers/mtd/chips/Makefile
+++ linux-2.6.23.1-uml/drivers/mtd/chips/Makefile
@@ -2,7 +2,7 @@
 # linux/drivers/chips/Makefile
 #
 
-obj-$(CONFIG_MTD)		+= chipreg.o
+obj-$(CONFIG_MTD_CHIPREG)	+= chipreg.o
 obj-$(CONFIG_MTD_CFI)		+= cfi_probe.o
 obj-$(CONFIG_MTD_CFI_UTIL)	+= cfi_util.o
 obj-$(CONFIG_MTD_CFI_STAA)	+= cfi_cmdset_0020.o

       reply	other threads:[~2007-10-24  1:20 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <22c797d00709272118i33d32b9dy93d5f5ec8f8edd30@mail.gmail.com>
2007-10-24  1:17 ` Jason Lunz [this message]
2007-10-24  6:51   ` [PATCH] allow use of mtd and jffs2 on uml David Woodhouse
2007-10-24 15:54     ` Jason Lunz
2007-10-24 15:54       ` Jason Lunz
2007-10-24 16:24       ` atom ota
2007-10-24 16:24         ` atom ota
2007-12-27 18:15     ` Jason Lunz
2007-12-27 18:15       ` Jason Lunz
2007-12-27 18:15       ` [uml-devel] " Jason Lunz
2007-12-28 17:48       ` Sam Ravnborg
2007-12-28 17:48         ` Sam Ravnborg
2007-12-28 17:48         ` [uml-devel] " Sam Ravnborg
2010-12-07  7:29         ` [PATCH] mtd: allow mtd and jffs2 when ARCH=um Jason Lunz
2010-12-07  7:29           ` Jason Lunz
2010-12-07  9:39           ` richard -rw- weinberger
2010-12-07  9:39             ` richard -rw- weinberger
2010-12-07  9:39             ` richard -rw- weinberger
2010-12-07 18:20             ` Jason Lunz
2010-12-07 18:20               ` Jason Lunz
2010-12-07 18:20               ` Jason Lunz
2010-12-14 16:24               ` Artem Bityutskiy
2010-12-14 16:24                 ` Artem Bityutskiy
2010-12-14 19:51                 ` Jason Lunz
2010-12-14 19:51                   ` Jason Lunz
2010-12-14 20:01                   ` Artem Bityutskiy
2010-12-14 20:01                     ` Artem Bityutskiy
2010-12-14 21:12                     ` Geert Uytterhoeven
2010-12-14 21:12                       ` Geert Uytterhoeven
2010-12-14 21:23                     ` Jason Lunz
2010-12-14 21:23                       ` Jason Lunz
2010-12-15  0:40                       ` Rob Landley
2010-12-15  0:40                         ` Rob Landley
2010-12-15  0:49                     ` Rob Landley
2010-12-15  0:49                       ` Rob Landley
2010-12-15  1:19                       ` Jason Lunz
2010-12-15  1:19                         ` Jason Lunz
2010-12-15  6:31                         ` Rob Landley
2010-12-15  6:31                           ` Rob Landley
2010-12-16 15:18                           ` Artem Bityutskiy
2010-12-16 15:18                             ` Artem Bityutskiy
2010-12-18  4:08                             ` Rob Landley
2010-12-18  4:08                               ` Rob Landley
2010-12-19 17:08                               ` Artem Bityutskiy
2010-12-19 17:08                                 ` Artem Bityutskiy
2010-12-15  8:18                         ` Geert Uytterhoeven
2010-12-15  8:18                           ` Geert Uytterhoeven
2010-12-16 15:25                   ` Artem Bityutskiy
2010-12-16 15:25                     ` Artem Bityutskiy
2010-12-16 22:01                   ` Anatolij Gustschin
2010-12-16 22:01                     ` Anatolij Gustschin
2010-12-17  4:27                     ` mtd: fix CONFIG_MTD_COMPLEX_MAPPINGS=n compile Jason Lunz
2010-12-19 16:47                       ` Artem Bityutskiy
2010-12-19 16:47                         ` Artem Bityutskiy
2010-12-19 19:07                         ` Jason Lunz
2010-12-19 19:07                           ` Jason Lunz
2010-12-20 11:23                           ` Artem Bityutskiy
2010-12-20 11:23                             ` Artem Bityutskiy
2010-12-20 14:04                             ` [PATCH] mtd: allow mtd and jffs2 when ARCH=um Jason Lunz
2010-12-20 14:04                               ` Jason Lunz
2010-12-22 14:40                               ` Artem Bityutskiy
2010-12-22 14:40                                 ` Artem Bityutskiy
2011-01-06 15:45                   ` David Woodhouse
2011-01-06 15:45                     ` David Woodhouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071024011712.GA3762@falooley.org \
    --to=lunz@falooley.org \
    --cc=atomota@sleepyhammer.com \
    --cc=dwmw2@infradead.org \
    --cc=jdike@addtoit.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=uml-user@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.