From: mike@forestsidingsupply.com (Mike Mattice)
To: linux-mtd@lists.infradead.org
Subject: root jffs2 filesystem on blkmtd emulated device
Date: Tue, 9 Apr 2002 11:42:06 -0500 [thread overview]
Message-ID: <20020409114205.A21994@ns2.forestsidingsupply.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4175 bytes --]
I've got a flash based ide module which is too small for my needs w/o
compression. So, I'm trying to get this to use jffs2 as it's root
filesystem type. I've run into a bit of a problem.
After applying the following patch, using the attached config, and passing
'blkmtd=/dev/hdc2' to the kernel and setting the root device to
'/dev/mtdblock/0' via lilo, I get this on the console. (hand typed, but
should be very close)
Universal TUN/TAP device driver 1.4 (C)1999-2001 Maxim Krasnyansky
blkmtd: device = `/dev/hdc2' erase size = 128K readonly = no queue size = 512
blkmtd: found a block device major = 22, minor = 2
blkmtd: devname = ide1(22,2)
blkmtd: size = 15171584
blkmtd: init: found 3 erase regions
mtd: Giving out device 0 to blkmtd: /dev/hdc2
blkmtd loaded: version = 1.7 using /dev/hdc2 erase_size = 128K
blkmtd writetask: starting (pid = 10)
Net4: Linux TCP/IP 1.0 for NET4.0
<blah, blah>
NET4: Unix domain sockets 1.0/SMP for Linux Net4.0.
mtdblock_open
ok
mtdblock_open
mtdblock_release
invalidating device
ok
writing cached data
ok
mtdblock_open
mtdblock_release
invalidating device
At this point it just hangs. Does anybody have any idea why it wouldn't be
able to invalidate the device in mtdblock_release?
diff -rNubBw linux-2.4.18.orig/drivers/mtd/devices/blkmtd.c linux-2.4.18.mtddevel/drivers/mtd/devices/blkmtd.c
--- linux-2.4.18.orig/drivers/mtd/devices/blkmtd.c Tue Apr 9 11:08:22 2002
+++ linux-2.4.18.mtddevel/drivers/mtd/devices/blkmtd.c Tue Apr 9 09:50:15 2002
@@ -53,6 +53,7 @@
#include <linux/pagemap.h>
#include <linux/mtd/compatmac.h>
#include <linux/mtd/mtd.h>
+#include <linux/ctype.h>
#ifdef CONFIG_MTD_DEBUG
#ifdef CONFIG_PROC_FS
@@ -130,6 +131,8 @@
int bs; /* optionally force the block size (avoid using) */
int count; /* optionally force the block count (avoid using) */
int wqs; /* optionally set the write queue size */
+char bootdevice[64];
+int bootdevset = 0;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
@@ -1073,9 +1076,13 @@
/* Check args */
if(device == 0) {
+ if (bootdevset) {
+ device = &bootdevice;
+ } else {
printk("blkmtd: error, missing `device' name\n");
return -EINVAL;
}
+ }
if(ro)
readonly = 1;
@@ -1312,6 +1319,26 @@
__free_pages(erase_page, 0);
return err;
}
+
+static int __init blkmtd_setup(char *line)
+{
+ int i;
+ char ch;
+
+ bootdevset = 1;
+ memset (bootdevice, 0, sizeof bootdevice);
+ for (i = 0; i < sizeof bootdevice - 1; ++i)
+ {
+ ch = line[i];
+ if ( isspace (ch) || (ch == ',') || (ch == '\0') ) break;
+ // don't have to worry about setting the last char to \0,
+ // because the memset has taken care of that for us.
+ bootdevice[i] = ch;
+ }
+ return 1;
+}
+
+__setup("blkmtd=", blkmtd_setup);
module_init(init_blkmtd);
module_exit(cleanup_blkmtd);
diff -rNubBw linux-2.4.18.orig/drivers/mtd/mtdblock.c linux-2.4.18.mtddevel/drivers/mtd/mtdblock.c
--- linux-2.4.18.orig/drivers/mtd/mtdblock.c Thu Oct 25 15:58:35 2001
+++ linux-2.4.18.mtddevel/drivers/mtd/mtdblock.c Tue Apr 9 10:57:05 2002
@@ -371,17 +371,24 @@
if (inode == NULL)
release_return(-ENODEV);
+ DEBUG(MTD_DEBUG_LEVEL1, "invalidating device\n");
+
invalidate_device(inode->i_rdev, 1);
+ DEBUG(MTD_DEBUG_LEVEL1, "ok\n");
+
dev = MINOR(inode->i_rdev);
mtdblk = mtdblks[dev];
+ DEBUG(MTD_DEBUG_LEVEL1, "writing cached data\n");
+
down(&mtdblk->cache_sem);
write_cached_data(mtdblk);
up(&mtdblk->cache_sem);
spin_lock(&mtdblks_lock);
if (!--mtdblk->count) {
+ DEBUG(MTD_DEBUG_LEVEL1, "freeing device\n");
/* It was the last usage. Free the device */
mtdblks[dev] = NULL;
spin_unlock(&mtdblks_lock);
diff -rNubBw linux-2.4.18.orig/fs/jffs2/scan.c linux-2.4.18.mtddevel/fs/jffs2/scan.c
--- linux-2.4.18.orig/fs/jffs2/scan.c Thu Oct 4 17:13:18 2001
+++ linux-2.4.18.mtddevel/fs/jffs2/scan.c Tue Apr 9 10:41:30 2002
@@ -171,7 +171,7 @@
return 1; /* special return code */
}
- noise = 10;
+ noise = 0; // mdm - 10
while(ofs < jeb->offset + c->sector_size) {
ssize_t retlen;
[-- Attachment #2: clean-config.gz --]
[-- Type: application/octet-stream, Size: 596 bytes --]
[-- Attachment #3: mtddevel.patch.gz --]
[-- Type: application/octet-stream, Size: 1274 bytes --]
next reply other threads:[~2002-04-09 16:42 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-09 16:42 Mike Mattice [this message]
2002-04-09 19:42 ` root jffs2 filesystem on blkmtd emulated device Russ Dill
2002-04-09 21:40 ` Mike Mattice
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=20020409114205.A21994@ns2.forestsidingsupply.com \
--to=mike@forestsidingsupply.com \
--cc=linux-mtd@lists.infradead.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox