MultiMediaCard

From ArmadeusWiki
Revision as of 23:07, 2 March 2009 by JulienB (Talk | contribs) (Performances)

Jump to: navigation, search

Instructions to use the MultiMediaCard (MMC/SD) on your Armadeus board

Introduction

You can use standard MMC/SD/miniSD/microSD cards with your Armadeus board:

All needed drivers are included in the standard Armadeus Linux image.

Card insertion

You should something like that:

# imx-mmc imx-mmc.0: card inserted
mmc0: host does not support reading read-only switch. assuming write-enable.
mmc0: new SD card at address 01b0
mmcblk0: mmc0:01b0 SD512 500224KiB
 mmcblk0: p1

Mounting the MMC/SD

  • Just mount the MMC like you will do on your PC, for example (FAT32 formatted card):
# mount -t vfat /dev/mmcblk0p1 /mnt/mmc
  • Then, you can access the MMC's files from the /mnt/mmc directory

If you have problems with vfat code page click here

Booting from MMC/SD

When your rootfs is too big to be put on the APF Flash, you can always use a MMC/SD like a Hard Drive and boot from it (this is possible because standard Armadeus kernel is compiled with the MMC driver built in).

Prepare your card

  • On your APF board (to avoid to crash your Host HD), create a good partition table:
 # /sbin/fdisk /dev/mmcblk0
 Delete all existing partion with 'd'
 Create a primary partion: 'n' then 'p' then '1'
 Change bootflag to Linux: 't' then '83'
 Save partition table: 'w'
 (To quit without saving: 'm')
  • Then, on your PC, format your MMC with Ext2 filesystem (booting on FAT is bad :-) ):
[armadeus] $ sudo mkfs.ext2 /dev/sdX1   (replace X with your MMC reader drive letter, if your Laptop has an integrated
                                          MMC reader then use mmcblk0p1 instead of sdX1)
  • Mount your MMC/SD on your Host filesystem (for example in /media/mmc):
[armadeus] $ sudo mkdir -p /media/mmc
[armadeus] $ sudo mount /dev/sdX1 /media/mmc    (replace X with your MMC reader drive letter, if your Laptop has an integrated
                                                  MMC reader then use mmcblk0p1 instead of sdX1)

Put it your rootfs

  • Then put your rootfs on this MMC/SD: in Buildroot configure rootfs to be tar-ed (should be done by default).
[armadeus] $ make menuconfig
Target filesystem options  --->

Menuconfig tar rootfs.png

[armadeus] $ make
  • and then uncompress the rootfs to the SD card:
[armadeus] $ sudo tar xvf ./buildroot/binaries/apf9328/apf9328-rootfs.arm.tar -C /media/mmc
[armadeus] $ sudo umount /media/mmc

Boot

  • insert the MMC/SD/microSD on your Armadeus board and then in U-Boot use:
 BIOS> run mmcboot
  • if you want to automatically boot from SD at each startup, replace default bootcmd U-Boot macro:
 BIOS> setenv bootcmd run mmcboot
 BIOS> saveenv

(default bootcmd is run jffsboot)

Performances

Troubleshots

VFAT Code Page

If you encounter this message (or something similar):

Unable to load NLS charset cp437
FAT: codepage cp437 not found

you have to add the charset to the supported kernel ones:

make linux26-menuconfig

In File systems ---> -*- Native language support ---> you can select the right charset:

ex: NLS ISO 8859-1  (Latin 1; Western European Languages)

Installation (now obsolete because MMC driver is statically built in default Armadeus kernel)

When you build your kernel image, then modify its configuration:

[armadeus]$ make linux26-menuconfig

in Device Drivers->MMC/SD Card support->iMX Support In FileSystems, don't forget to add support for the filesystem you want to use on the MMC and if you activate FAT/VFAT, don't forget to activate Native Language Support (NLS) otherwise you'll get errors like:

Unable to load NLS charset cp437
FAT: codepage cp437 not found

Save your configuration and then rebuild your kernel image:

[armadeus]$ make linux26

now you should have following drivers in your kernel source tree:

drivers/mmc/

Copy mmc_core.ko, imxmmc.ko & mmc_block.ko to your target root filessytem in /lib/modules/ or reflash the generated rootfs.

If not already existing then create the MMC block devices:

# mknod /dev/mmcblk0 b 254 0
# mknod /dev/mmcblk0p1 b 254 1

If not already existing then create the mount point (/mnt/mmc):

# mkdir -p /mnt/mmc

The MMC driver is now included inside the Linux kernel (no more a module) but if you want to use it as a module you will have to:

# modprobe imxmmc
# modprobe mmc_block

Links

Other languages:

English Flag.svg English  •  French Flag.svg Français