All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] Loopback mounting jffs2 under UML?
@ 2007-12-18 18:45 Rob Landley
  2007-12-18 19:14 ` Stian Skjelstad
  2007-12-18 19:29 ` Jeff Dike
  0 siblings, 2 replies; 5+ messages in thread
From: Rob Landley @ 2007-12-18 18:45 UTC (permalink / raw)
  To: user-mode-linux-devel

I want to loopback mount a jffs2 filesystem, and this filesystem has 
incestuous knowledge of flash devices for wear levelling and stuff, so it 
will only mount an actual flash device and not a normal block device.

There's a way to make a loopback device look like a flash device, letting you 
loopback mount jffs2, but it involves recompiling the kerenel to add support 
for it, and of course I went "User Mode Linux"...  Except that UML disables 
the flash menu entirely.

Basically, I need to be able to enable MTD_BLOCK so I can go:

  losetup /dev/loop0 /path/to/imagefile.jffs2
  insmod blkmtd erasesz=256 device=/dev/loop0
  mount -t jffs2 /dev/mtdblock0 /mnt

This shouldn't need any actual flash hardware.  It's just layering another 
translation layer on top of loopback.

Suggestions?

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [uml-devel] Loopback mounting jffs2 under UML?
  2007-12-18 18:45 [uml-devel] Loopback mounting jffs2 under UML? Rob Landley
@ 2007-12-18 19:14 ` Stian Skjelstad
  2007-12-18 19:29 ` Jeff Dike
  1 sibling, 0 replies; 5+ messages in thread
From: Stian Skjelstad @ 2007-12-18 19:14 UTC (permalink / raw)
  To: Rob Landley; +Cc: user-mode-linux-devel

I did try UML + blkmtd and jffs statically compiled in a couple of years
ago and it then almost worked out of the box. It failed then for me due
to a very small issue: the initializers in the different drivers
initialized in the wrong order, so I got a panic due to a
null-dereference. (driver initialization does/didn't have depencies).

Just me five cents :-)

Stian

On Tue, 2007-12-18 at 12:45 -0600, Rob Landley wrote:
> I want to loopback mount a jffs2 filesystem, and this filesystem has 
> incestuous knowledge of flash devices for wear levelling and stuff, so it 
> will only mount an actual flash device and not a normal block device.
> 
> There's a way to make a loopback device look like a flash device, letting you 
> loopback mount jffs2, but it involves recompiling the kerenel to add support 
> for it, and of course I went "User Mode Linux"...  Except that UML disables 
> the flash menu entirely.
> 
> Basically, I need to be able to enable MTD_BLOCK so I can go:
> 
>   losetup /dev/loop0 /path/to/imagefile.jffs2
>   insmod blkmtd erasesz=256 device=/dev/loop0
>   mount -t jffs2 /dev/mtdblock0 /mnt
> 
> This shouldn't need any actual flash hardware.  It's just layering another 
> translation layer on top of loopback.
> 
> Suggestions?
> 
> Rob


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [uml-devel] Loopback mounting jffs2 under UML?
  2007-12-18 18:45 [uml-devel] Loopback mounting jffs2 under UML? Rob Landley
  2007-12-18 19:14 ` Stian Skjelstad
@ 2007-12-18 19:29 ` Jeff Dike
  2007-12-19  0:03   ` Rob Landley
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff Dike @ 2007-12-18 19:29 UTC (permalink / raw)
  To: Rob Landley; +Cc: user-mode-linux-devel

On Tue, Dec 18, 2007 at 12:45:23PM -0600, Rob Landley wrote:
> There's a way to make a loopback device look like a flash device, letting 
> you loopback mount jffs2, but it involves recompiling the kerenel to add 
> support for it, and of course I went "User Mode Linux"...  Except
> that UML disables  the flash menu entirely.

> Suggestions?

I see this in menuconfig:

Symbol: MTD [=n]                                                      
   Prompt: Memory Technology Device (MTD) support                     
     Defined at drivers/mtd/Kconfig:3                                  
     Depends on: BROKEN && HAS_IOMEM

You could try removing the dependencies on BROKEN and HAS_IOMEM and
see what happens...

				Jeff

-- 
Work email - jdike at linux dot intel dot com

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [uml-devel] Loopback mounting jffs2 under UML?
  2007-12-18 19:29 ` Jeff Dike
@ 2007-12-19  0:03   ` Rob Landley
  2007-12-19  8:10     ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: Rob Landley @ 2007-12-19  0:03 UTC (permalink / raw)
  To: Jeff Dike; +Cc: user-mode-linux-devel

On Tuesday 18 December 2007 13:29:11 Jeff Dike wrote:
> On Tue, Dec 18, 2007 at 12:45:23PM -0600, Rob Landley wrote:
> > There's a way to make a loopback device look like a flash device, letting
> > you loopback mount jffs2, but it involves recompiling the kerenel to add
> > support for it, and of course I went "User Mode Linux"...  Except
> > that UML disables  the flash menu entirely.
> >
> > Suggestions?
>
> I see this in menuconfig:
>
> Symbol: MTD [=n]
>    Prompt: Memory Technology Device (MTD) support
>      Defined at drivers/mtd/Kconfig:3
>      Depends on: BROKEN && HAS_IOMEM
>
> You could try removing the dependencies on BROKEN and HAS_IOMEM and
> see what happens...


Actually, in -rc4 (what I have lying around), the depends is just on HAS_IOMEM, and the include in arch/um/Kconfig is guarded by "if BROKEN".

Building it, I hit the same darn error I've been patching my way around for months:

>   CC      arch/um/kernel/smp.o
> In file included from include/asm/arch/tlb.h:9,
>                  from include/asm/tlb.h:4,
>                  from arch/um/kernel/smp.c:8:
> include/asm-generic/tlb.h: In function ‘tlb_flush_mmu’:
> include/asm-generic/tlb.h:76: error: implicit declaration of function
> ‘release_pages’ include/asm-generic/tlb.h: In function ‘tlb_remove_page’:
> include/asm-generic/tlb.h:105: error: implicit declaration of function
> ‘page_cache_release’ make[1]: *** [arch/um/kernel/smp.o] Error 1
> make: *** [arch/um/kernel] Error 2

Patch that, and then it breaks with:

>   CC      drivers/mtd/chips/chipreg.o
> In file included from drivers/mtd/chips/chipreg.c:13:
> include/linux/mtd/map.h: In function ‘inline_map_read’:
> include/linux/mtd/map.h:378: error: implicit declaration of function
> ‘__raw_readb’ include/linux/mtd/map.h:380: error: implicit declaration of
> function ‘__raw_readw’ include/linux/mtd/map.h:382: error: implicit
> declaration of function ‘__raw_readl’ include/linux/mtd/map.h:385: error:
> implicit declaration of function ‘__raw_readq’ include/linux/mtd/map.h:388:
> error: implicit declaration of function ‘memcpy_fromio’
> include/linux/mtd/map.h: In function ‘inline_map_write’:
> include/linux/mtd/map.h:406: error: implicit declaration of function
> ‘memcpy_toio’ make[3]: *** [drivers/mtd/chips/chipreg.o] Error 1
> make[2]: *** [drivers/mtd/chips] Error 2
> make[1]: *** [drivers/mtd] Error 2

All I enabled was CONFIG_MTD_BLOCK.

To reproduce what I did, yank these lines:

diff -ru linux-2.6.24-rc4/arch/um/Kconfig linux-temp/arch/um/Kconfig
--- linux-2.6.24-rc4/arch/um/Kconfig	2007-12-03 22:26:10.000000000 -0600
+++ linux-temp/arch/um/Kconfig	2007-12-18 15:28:49.000000000 -0600
@@ -280,9 +280,7 @@
 
 source "drivers/md/Kconfig"
 
-if BROKEN
 	source "drivers/mtd/Kconfig"
-endif
 
 #This is just to shut up some Kconfig warnings, so no prompt.
 config INPUT
diff -ru linux-2.6.24-rc4/arch/um/kernel/smp.c linux-temp/arch/um/kernel/smp.c
--- linux-2.6.24-rc4/arch/um/kernel/smp.c	2007-12-03 22:26:10.000000000 -0600
+++ linux-temp/arch/um/kernel/smp.c	2007-12-18 15:30:49.000000000 -0600
@@ -5,6 +5,7 @@
 
 #include "linux/percpu.h"
 #include "asm/pgalloc.h"
+#include "linux/pagemap.h"
 #include "asm/tlb.h"
 
 /* For some reason, mmu_gathers are referenced when CONFIG_SMP is off. */
diff -ru linux-2.6.24-rc4/drivers/mtd/Kconfig linux-temp/drivers/mtd/Kconfig
--- linux-2.6.24-rc4/drivers/mtd/Kconfig	2007-12-03 22:26:10.000000000 -0600
+++ linux-temp/drivers/mtd/Kconfig	2007-12-18 15:24:41.000000000 -0600
@@ -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


And then configure and build like so:

cat > mini.conf << EOF
CONFIG_BINFMT_ELF=y
CONFIG_HOSTFS=y
CONFIG_BLK_DEV=y
CONFIG_BLK_DEV_LOOP=y
CONFIG_STDERR_CONSOLE=y
CONFIG_UNIX98_PTYS=y
CONFIG_EXT2_FS=y
CONFIG_MTD=y
CONFIG_MTD_BLOCK=y
EOF
make ARCH=um allnoconfig KCONFIG_ALLCONFIG=mini.conf
make ARCH=um

Rob
-- 
"One of my most productive days was throwing away 1000 lines of code."
  - Ken Thompson.

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [uml-devel] Loopback mounting jffs2 under UML?
  2007-12-19  0:03   ` Rob Landley
@ 2007-12-19  8:10     ` Geert Uytterhoeven
  0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2007-12-19  8:10 UTC (permalink / raw)
  To: Rob Landley; +Cc: Jeff Dike, user-mode-linux-devel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 2009 bytes --]

On Tue, 18 Dec 2007, Rob Landley wrote:
> On Tuesday 18 December 2007 13:29:11 Jeff Dike wrote:
> > On Tue, Dec 18, 2007 at 12:45:23PM -0600, Rob Landley wrote:
> > > There's a way to make a loopback device look like a flash device, letting
> > > you loopback mount jffs2, but it involves recompiling the kerenel to add
> > > support for it, and of course I went "User Mode Linux"...  Except
> > > that UML disables  the flash menu entirely.
> > >
> > > Suggestions?
> >
> > I see this in menuconfig:
> >
> > Symbol: MTD [=n]

> Actually, in -rc4 (what I have lying around), the depends is just on HAS_IOMEM, and the include in arch/um/Kconfig is guarded by "if BROKEN".

> >   CC      drivers/mtd/chips/chipreg.o
> > In file included from drivers/mtd/chips/chipreg.c:13:
> > include/linux/mtd/map.h: In function ‘inline_map_read’:
> > include/linux/mtd/map.h:378: error: implicit declaration of function
> > ‘__raw_readb’ include/linux/mtd/map.h:380: error: implicit declaration of
> > function ‘__raw_readw’ include/linux/mtd/map.h:382: error: implicit
> > declaration of function ‘__raw_readl’ include/linux/mtd/map.h:385: error:
> > implicit declaration of function ‘__raw_readq’ include/linux/mtd/map.h:388:
> > error: implicit declaration of function ‘memcpy_fromio’
> > include/linux/mtd/map.h: In function ‘inline_map_write’:
> > include/linux/mtd/map.h:406: error: implicit declaration of function
> > ‘memcpy_toio’ make[3]: *** [drivers/mtd/chips/chipreg.o] Error 1
> > make[2]: *** [drivers/mtd/chips] Error 2
> > make[1]: *** [drivers/mtd] Error 2

Protect all static inline routines in <linux/mtd/map.h> that use readb()
and friends by #ifdef CONFIG_HAS_IOMEM?

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

[-- Attachment #2: Type: text/plain, Size: 308 bytes --]

-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace

[-- Attachment #3: Type: text/plain, Size: 194 bytes --]

_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-12-19  8:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-18 18:45 [uml-devel] Loopback mounting jffs2 under UML? Rob Landley
2007-12-18 19:14 ` Stian Skjelstad
2007-12-18 19:29 ` Jeff Dike
2007-12-19  0:03   ` Rob Landley
2007-12-19  8:10     ` Geert Uytterhoeven

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.