Pengutronix - automount

BaHko
What are our options for automount???

I found a patch for pengutronix:

http://lists.infradead.org/pipermail/barebox/2012-March/006414.html

Is this the proper move or should I look for something different?




P.S.
I have tried to apply the patch with the following command:

OSELAS.BSP-Pengutronix-Mini2440-2012.06.0$      
patch -p1 < path_to_patch_name.patch

But it stops asking me which file to patch.

Juergen Beisert
Barebox != Linux Kernel != OSELAS.BSP-Pengutronix-Mini2440-2012.06.0

What kind of feature do you want?

BaHko
I want to be able to auto mount any SD Card / USB and not to bother
mounting manually. Actually I will not have access to mount manually once I
finish the development. It has to recognize any new devices and mount them
to /mnt

Right now I found some link from you about udev!

Which way should I go... udev or with the patch to the barebox. I'm kind of
confused... :^)

I went thru the whole menuconfig but I didn't find anything for automount
like on the original os that came with the mini2440.

BaHko
Update...

Thru udev:

I added 

mount -t vfat /dev/mmcblk0p1  /mnt/sdcard
 
to end of 
OSELAS.BSP-Pengutronix-Mini2440-2012.06.0/configs/platform-friendlyarm-mini2440/
barebox-(64/128)m-env/config

and after restart if the sdcard is inserted it is mounted to /mnt/sdcard

Now the question is how to auto mount it while the mini2440 is working?

Juergen Beisert
You can't automount anything in a running Linux with a Barebox patch
(Barebox is the bootloader). The bootloader and the operating system are
different worlds... and udev cooperates with Linux, not barebox.

So, you have still to tell us, what you really want. Yes, you want to mount
your SD card if it is plugged in into your Mini2440. But when? When the
bootloader runs? Or when the Linux kernel runs? What do you intend to do
with the mounted SD card?

BaHko
When the kernel runs. 
I was a bit little too late when I saw that the patch is for the barebox.

I want to read and write files to the sd card or any usb device that is
connected.

udev mounts them in the startup but after that it will not recognize them
no matter if they are unmounted or mounted

Juergen Beisert
> not recognize them no matter if they are unmounted or mounted

???

There are various solutions around to auto-mount filesystem on devices that
get attached to a system. You should google for it. If they run under a
regular Linux, you can make them also work on your Mini2440

BaHko
Juergen, Thanks but no Thanks.

Probably all what you had to do is pointed me to use udev for automount



For those who are looking for a way to automount.
We will use udev only and I don't imply that this is the right method to do
it. Probably just an option. 

Make sure that you have installed udev ( ptxdist menufoncig (Shell &
Console Tools -> <*> udev ))

1. Create /home/mmc_mount file with the following text:

#!bin/sh
mkdir /mnt/sdcard
mount -t vfat /dev/mmcblk0p1 /mnt/sdcard

2. chmod +x /home/mmc-mount
3. Create /lib/udev/rules.d/99-custom.rules with text:

#CUSTOM udev RULES
ACTION=="add", KERNEL=="mmcblk0[a-z][0-9]", RUN+="/home/mmc_mount"


This will mount any new SD CARD presented to your mini2440