Re: Mounting the squashfs/read-only Linux file system on MTD partition

Miquel Raynal
2019-05-07T07:06:09Z

Hi Vesta,

Vesta <laguna-mc@mail.com> wrote on Wed, 1 May 2019 16:10:28 +0200:

> Hi,
>
> Device have embedded Linux version 2.6.26.5, at boot time the system creates 11 MTD partitions on NAND flash.

First, 2.6.26 is horribly old and not maintained at all. First step for
you would be to use a recent kernel, the MTD subsystem has changed quite
a lot since then.

> I'm in limited Busybox shell.
> BusyBox v1.10.2 (2017-08-02 14:07:25 CST) built-in shell (ash)
> Enter 'help' for a list of built-in commands.
>
> /bin/sh: can't access tty; job control turned off
> # mount -t proc proc /proc
> # mount -t sysfs sysfs /sys
> # mount -t tmpfs tmpfs /tmp
> # mount -t tmpfs none /dev
> # mkdir /dev/pts
> # mount -t devpts devpts /dev/pts
> # mdev -s
> # cat /proc/mtd
> dev: size erasesize name
> mtd0: 00060000 00004000 "u-boot"
> mtd1: 00020000 00004000 "u-bootenv"
> mtd2: 013e0000 00004000 "ROMIMAGE"
> mtd3: 00700000 00004000 "HALFIMAGE"
> mtd4: 01260000 00004000 "LINUX_ROOTFS"
> mtd5: 00200000 00004000 "HS_FW"
> mtd6: 00100000 00004000 "FPAR"
> mtd7: 00080000 00004000 "CISCO"
> mtd8: 00020000 00004000 "EEPROM"
> mtd9: 00080000 00004000 "NVRAM"
> mtd10: 00080000 00004000 "CA_DATA"
> # mount
> rootfs on / type rootfs (rw)
> /dev/root on / type squashfs (ro)
> proc on /proc type proc (rw)
> sysfs on /sys type sysfs (rw)
> tmpfs on /tmp type tmpfs (rw)
> none on /dev type tmpfs (rw)
> devpts on /dev/pts type devpts (rw,mode=600)
>
> # df -h
> Filesystem Size Used Available Use% Mounted on
> rootfs 8.0M 8.0M 0 100% /
> /dev/root 8.0M 8.0M 0 100% /
> tmpfs 13.9M 0 13.9M 0% /tmp
> none 13.9M 0 13.9M 0% /dev
>
> # ls -al
> drwxr-xr-x 19 1005 1005 219 Aug 2 2017 .
> drwxr-xr-x 19 1005 1005 219 Aug 2 2017 ..
> drwxrwxr-x 6 1005 1005 86 Aug 2 2017 .svn
> drwxrwxr-x 2 1005 1005 432 Aug 2 2017 bin
> -rwxr-xr-x 1 1005 1005 715844 Aug 2 2017 cordless_nodect.coma
> drwxrwxrwt 5 0 0 2720 Jan 1 00:04 dev
> drwxr-xr-x 2 1005 1005 3 Aug 2 2017 eeprom
> drwxr-xr-x 4 1005 1005 386 Aug 2 2017 etc
> drwxr-xr-x 2 1005 1005 3 Aug 2 2017 fpar
> drwxr-xr-x 4 0 0 48 Aug 2 2017 home
> drwxr-xr-x 2 1005 1005 3 Aug 2 2017 hsfw
> drwxr-xr-x 3 1005 1005 287 Aug 2 2017 lib
> drwxrwxr-x 2 1005 1005 3 Aug 2 2017 mnt
> drwxr-xr-x 2 1005 1005 3 Aug 2 2017 nvram
> dr-xr-xr-x 27 0 0 0 Jan 1 00:00 proc
> lrwxrwxrwx 1 1005 1005 8 Aug 2 2017 root -> tmp/root
> drwxr-xr-x 2 1005 1005 642 Aug 2 2017 sbin
> drwxr-xr-x 10 0 0 0 Jan 1 00:00 sys
> drwxrwxrwt 2 0 0 40 Jan 1 00:00 tmp
> drwxr-xr-x 7 1005 1005 73 Aug 2 2017 usr
> lrwxrwxrwx 1 1005 1005 7 Aug 2 2017 var -> tmp/var
> drwxr-xr-x 6 1005 1005 4051 Aug 2 2017 www
>
> How to mount the Linux root file system on mtd4 (LINUX_ROOTFS)? It's squashfs/read-only filesystem. What is correct steps?

The Internet is full of resources. If you have a specific problem you
don't know how to solve, this is the right place to ask though.

> Does all the rest MTD partitions have JFFS2 file system?

Not necessarily. Today we discourage the use of JFFS2; use UBI/UBIFS
instead for RW partitions.

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list