[armedslack] Help deciding which bits of mtd-utils to include in the installer

Thierry MERLE thierry.merle at free.fr
Tue Sep 8 19:47:01 UTC 2009


On Mon, 7 Sep 2009 12:16:43 +0100 (BST)
Stuart Winter <m-lists at biscuit.org.uk> wrote:

> 
> > > ARM won't yet support installation to flash/NAND, I know there are some
> > > people who'd want to do it.
> > >
> > What type of devices you plan to address?
> 
> How many are there?
Well I saw already 2 categories:
- the ones which have partitioned flash description written by redboot or configured in kernel (in arch/arm/mach-xx/yy-setup.c).
- the ones for which you have to either build a bootstrap image and flash it via jtag, or guess the flash partitions because this is still an unknown device for linux.
The sheevaplug is in the first case, I see that you can read the mtd partitions.
They have been configured in kernel in the file: arch/arm/mach-kirkwood/sheevaplug-setup.c
A good guy did a good job :)

> I thought that the mtd-utils are able to work with the NAND flash devices,
> so I thought as a minimum I'd include:
> usr/sbin/nandwrite
> usr/sbin/flash_eraseall
> 
Yes, mtd-utils are made for that, and you are right, you should include them.
> On The Sheevaplug these mtd devices show as:
> root at stokely:~# mtdinfo
> Count of MTD devices:           3
> Present MTD devices:            mtd0, mtd1, mtd2
> Sysfs interface supported:      yes
> root at stokely:~#
> 
> root at stokely:~# cat /proc/mtd
> dev:    size   erasesize  name
> mtd0: 00100000 00020000 "u-boot"
> mtd1: 00400000 00020000 "uImage"
> mtd2: 1fb00000 00020000 "root"
> root at stokely:~#
> 
> And I can mount them as block devices:
> root at stokely:~# mount /dev/mtdblock2 /mnt/floppy/ -t jffs2
> root at stokely:~# ls /mnt/floppy/
> bin/  boot/  dev/  etc/  home/  lib/  media/  mnt/  opt/  proc/  root/
> sbin/  selinux/  srv/  sys/  tmp/  usr/  var/
> root at stokely:~#
> 
Wow, more than 500Mb for root fs, I did not realize the flash was so
huge. Good reason to put a whole root fs in it.

> > Concerning the NSLU2, I only access the mtd block devices, detected
> > directly by the kernel by the MTD drivers (attached my config for NSLU2,
> > kernel 2.6.7.4). To flash the kernel and the initrd, I grabbed a script
> > from debian. There is some magic FIS decoding to calculate some offsets
> > but this is particular to the NSLU2. He is a modified debian script,
> > works only for flashing my custom kernel, only for NSLU2 (I did not
> > update it for other devices). I commented out the annoying things (dpkg
> > calls), and hardcoded values, it works...
> 
> Ah that's interesting.
> 
Well, on second thought, I am not sure this script is a good starting point.
Using nandwrite and flash_erase may be generic and better for all
devices (see http://www.linux-mtd.infradead.org/faq/nand.html#L_nand_copyimg)
I should write my own flash script to work with nandwrite.
Sorry for the wrong direction.

> I'm only going to support the hardware that ARMedslack provides kernels
> for, which would be the SheevaPlug at the moment (I won't get into the ARM
> versatile board).  The point of this excercise was to provide useful tools
> to work with the onboard NAND for people who are installing onto the
> SheevaPlug, but who wanted to put the Kernel or to install onto the NAND
> rather than a USB device.
> 
OK. in fact you want a complete operating system in flash. Creating and
formatting a jffs2 partition in /dev/mtdblock2. The user would be able
to choose at TARGET step to put the root on a detected USB disk or an
mtdblock device...

> I would like to provide the ability to flash the kernel & initrd to
> NAND on the Sheevaplug so that we can avoid u-boot's flaky USB support;
> but the challenge would be that the user would have to update offsets
> in the u-boot boot parameters manually.
> 
uboot is able to boot from network. By providing a uboot image put on a NFS server should be possible.
Sorry I am missing some practical background on the sheevaplug, I will see on mine.
> I think I'll put this idea on the back burner for a while :-)
> 
It is a great idea! I will look at it... as soon as I receive my sheevaplug :_(

Thierry




More information about the ARMedslack mailing list