OK, here is a little HOWTO on how to set up MTD with a file system.

This is a m810lmr, booting out of DoC. I am going to reserve the first 2M
for kernel. So the layout will be the first 2M for linuxbios and kernel,
and 6M for a file system. Kernel is 2.4.17, with linux-2.4.17-sis.patch
from linuxbios source tree, and config-2.4.17-sis from the linuxbios
source tree. Mainboard is the pcchips m810lmr.

So I:

modprobe doc2001
modprobe docprobe
dmesg

which shows:

DiskOnChip Millennium found at address 0xFFFC8000
Flash chip found: Manufacturer ID: 98, Chip ID: E6 (Toshiba TC58V64AFT/DC)
1 flash chips found. Total DiskOnChip size: 8 MiB
mtd: Giving out device 0 to DiskOnChip Millennium
Ignoring DiskOnChip Millennium at 0xFFFCA000 - already configured
Ignoring DiskOnChip Millennium at 0xFFFCC000 - already configured
Ignoring DiskOnChip Millennium at 0xFFFCE000 - already configured
Ignoring DiskOnChip Millennium at 0xFFFD0000 - already configured
Ignoring DiskOnChip Millennium at 0xFFFD2000 - already configured
Ignoring DiskOnChip Millennium at 0xFFFD4000 - already configured
Ignoring DiskOnChip Millennium at 0xFFFD6000 - already configured
Ignoring DiskOnChip Millennium at 0xFFFD8000 - already configured
Ignoring DiskOnChip Millennium at 0xFFFDA000 - already configured
Ignoring DiskOnChip Millennium at 0xFFFDC000 - already configured
Ignoring DiskOnChip Millennium at 0xFFFDE000 - already configured
Ignoring DiskOnChip Millennium at 0xFFFE0000 - already configured
Ignoring DiskOnChip Millennium at 0xFFFE2000 - already configured
Ignoring DiskOnChip Millennium at 0xFFFE4000 - already configured

(etc..)

Now I need MTD utilities.

So I:
cvs -d :pserver:[EMAIL PROTECTED]:/home/cvs login
CVS password:

(password is anoncvs)

Then:

cvs -d :pserver:[EMAIL PROTECTED]:/home/cvs co mtd

Forget the drivers and such, you don't need them. What you need is the
tools.

cd mtd/tools

make

Go ahead and copy the executables somewhere handy, you'll need them.

Now we need to make the last 6M into a "disk". We need to format it. The
tool is nftl_format, so:

[root@carly util]# ./nftl_format
$Id: nftl_format.c,v 1.17 2001/08/29 14:28:48 dwmw2 Exp $
Usage: ./nftl_format <mtddevice> [<start offset> [<size>]]
[root@carly util]# expr 2048 \* 1024
2097152
[root@carly util]# expr 6 \* 1024 \* 1024
6291456
[root@carly util]# ./nftl_format /dev/mtd0 2097152 6291456
$Id: nftl_format.c,v 1.17 2001/08/29 14:28:48 dwmw2 Exp $
Phase 1. Checking and erasing Erase Zones from 0x00200000 to 0x00800000
        Checking Zone #992 @ 0x7c0000
Phase 2.a Writing NFTL Media Header and Bad Unit Table
Phase 2.b Writing Spare NFTL Media Header and Spare Bad Unit Table
Phase 3. Writing Unit Control Information to each Erase Unit

we now have a formatted disk in there. We can now partition it.

[root@carly util]# modprobe nftl
dmesg shows LOTS of errors, since this was never partitioned ...

Also, if you don't have /dev/nftla,
[root@carly util]# mknod /dev/nftla b 93 0

Don't use the script just yet, it makes /dev/nftla as b 93 16, which is
the wrong unit #.

now fdisk /dev/nftla

[root@carly util]# fdisk /dev/nftlA
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1, default 1):
Using default value 1

Command (m for help): p

Disk /dev/nftlA: 1 heads, 12224 sectors, 1 cylinders
Units = cylinders of 12224 * 512 bytes

     Device Boot    Start       End    Blocks   Id  System
/dev/nftlA1             1         1      6111+  83  Linux
Partition 1 has different physical/logical endings:
     phys=(768, 0, 0) logical=(0, 0, 12224)
Partition 1 does not end on cylinder boundary:
     phys=(768, 0, 0) should be (768, 0, 12224)

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
[root@carly util]# mknod /dev/nftlA1 b 93 1
[root@carly util]# mke2fs /dev/nftlA1
mke2fs 1.23, 15-Aug-2001 for EXT2 FS 0.5b, 95/08/09
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
1528 inodes, 6111 blocks
305 blocks (4.99%) reserved for the super user
First data block=1
1 block group
8192 blocks per group, 8192 fragments per group
1528 inodes per group

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 37 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

[root@carly util]# mount /dev/nftlA1 /mnt
[root@carly util]# cd /mnt
[root@carly mnt]# df .
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/nftlA1               5915        13      5597   1% /mnt
[root@carly mnt]#


and so you now have an ext2 file system on the DoC.

ron


Reply via email to