Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Getting access to a ro MTD


    I've got several embedded linux devices out at customer locations in the field. They can be accessed two ways:
    1. A USB to Serial connection
    2. SSH


    Accessing it via USB to Serial gets you access to U-Boot (embedded equivalent of GRUB, so to speak.) However, most of the devices are out in the field somewhere with just an ethernet connection.


    Their U-Boot bootargs are such that MTD0 is booted as read-only:

    Code:
    set bootargs console=ttyS0,115200 ubi.mtd=1 root=ubi0:rootfs rw rootfstype=ubifs mtdparts=atmel_nand:16M(kernel)ro,240M(rootfs)
    I'm releasing an update for these devices, and would really like to the customers to be able to install it without having to have physical access to the devices - some of them are in very remote or cumbersome to go and collect locations. However, as I pointed out, they can only access the u-boot command line args with a serial connection, thus they would have to go collect them all up and bring them back to go that route.

    Another option would be to flashing a new u-boot image, which could be done over SSH, but the U-boot image resides on that read-only MTD partition, so that could only be done if I could get rw access to MTD0.

    I could potentially use kexec to boot to a new kernel with a new command line, but kexec isn't enabled in the current kernel, so I would have to find a way to mangle it into a kernel module, and my initial attempts at that have been extremely fruitless.

    How in the world can I salvage this mess of a situation? Is there some way I can poke something to get rw on MTD0? mount / -o remount,rw doesn't work unfortunately, as it's the underlying MTD rather than the filesystem that's read only. I've does some digging around and found that there is a 'ro' file under:

    /sys/devices/virtual/mtd/mtd0/mtdblock0/ro

    That I can write 0 to, but it doesn't stick. Is there any way that I can use this, or something else, to get access to mtd0?

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    13,363
    I don't suppose you could configure them to do a pxe boot across the network? Then you could update the pxe boot kernel on the customers' servers and just reboot the danged things!
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Can that be done via SSH, with read-only access to MTD0 (where the kernel image and U-Boot are stored?) Everything I've tried that messes with boot configuration requires me to get read-write access to MTD0 to either alter the kernel or U-Boot... (I'll google around and look into it, just didn't know if you might know off the top of your head.)

  4. $spacer_open
    $spacer_close
  5. #4
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    13,363
    Since I don't know what the process to burn mtd0 (I assume it is in PROM/EPROM/FLASH memory) may be for this particular device, I cannot really tell you more at this point. Some embedded devices require that you use the JTAG interface to access such for installation/updates. Time to contact the board vendor I think.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •