Kernel mounting SD card

Discussion in 'Linux Hardware' started by richthofen1113, Mar 28, 2014.

  1. richthofen1113

    richthofen1113 New Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    So SD card. Cute little thingy while gets really evil when you could not mount them correctly on you device. I was originally working on an error called "mmc0: error -110 whilst initialising SD card". Almost spent two weeks on it, separated mmc modules from the kernel, have tried all kinds of patches but no good. Yesterday, my supervisor changed one of the boot arguments and suddenly the error was gone. After hundreds of power cycling the device, we came to an conclusion that the system is now stable. The reason that the error was gone might lie in the fact that the U-Boot is initializing the SD card instead of kernel itself. So I am wondering which one will be the good practice, to let U-Boot handle the SD card which eliminates the bug, or to just toss the ball to kernel which has mmc modules to mount the card. The device is using Linux-2.6.39.2 (pretty old) and pxa 270 processor. The U-Boot is the only boot loader. The SD card is not for booting purposes (e.g booting from the SD card); it is used to store customer data. So the question is just about the best way to mount the SD card correctly for future use.

  2. ryanvade

    ryanvade Administrator Staff Member Staff Writer

    Messages:
    1,216
    Likes Received:
    407
    Trophy Points:
    83
    If it is working now......

    I think allowing U-Boot to continue setting up the card would be best.
  3. richthofen1113

    richthofen1113 New Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    You should be right...So a stupid question, do you know what is the normal procedure to mount SD card in a linux-based device?
  4. ryanvade

    ryanvade Administrator Staff Member Staff Writer

    Messages:
    1,216
    Likes Received:
    407
    Trophy Points:
    83
    Depends on how you want it to happen. For example, on my laptop the SD card is automatically mounted via KDEs auto mount. Normally SD cards are treated just like any other block device.
  5. GrumpyOldMan

    GrumpyOldMan Active Member

    Messages:
    117
    Likes Received:
    41
    Trophy Points:
    28
    You can do any of several ways. We use udev rules to mount it. You can add entries to fstab to make it mount at boot time. You could just add a section at the end of your boot scripts to mount it if it's there.
    richthofen1113 and ryanvade like this.
  6. richthofen1113

    richthofen1113 New Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    You are certainly right. The only concern for me to mount the SD card at boot time is that the card will be initialized again after kernel loads. It is not clear to me if this will have any potential drawback. Any ideas?
  7. GrumpyOldMan

    GrumpyOldMan Active Member

    Messages:
    117
    Likes Received:
    41
    Trophy Points:
    28
    What, exactly, do you mean by initializing?
  8. richthofen1113

    richthofen1113 New Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Sorry for the ambiguity. I just meant that kernel mmc modules will mount the SD card again. The error is gone because U-Boot has already taken care of it instead of mmc modules in kernel. Not sure if this method of mounting the SD card twice has any potential problems
  9. ryanvade

    ryanvade Administrator Staff Member Staff Writer

    Messages:
    1,216
    Likes Received:
    407
    Trophy Points:
    83
    I doubt that this will cause issues.
  10. GrumpyOldMan

    GrumpyOldMan Active Member

    Messages:
    117
    Likes Received:
    41
    Trophy Points:
    28
    I agree that it's probably not going to be an issue.

    Does android do the same thing when running of of SD cards? Mount the card (probably r/o) to load the kernel and any necessary components of boot, then reset and remount (r/w) once the kenel's loaded and running?

Share This Page