From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH] automount support
Date: Sun, 18 Mar 2012 15:26:36 +0100 [thread overview]
Message-ID: <1332080804-13132-1-git-send-email-s.hauer@pengutronix.de> (raw)
The following series adds automount support to barebox. With the
automount command it's possible to access arbitrary files just
by using them without having to care about whether devices have
to be brought up or mounted first. It has the potential of making
the environment simpler and more flexible at the same time. Also
this series contains some patches which either fix some bugs I came
along while implementing it or make using automount more convenient.
The idea of automount is quite simple. The automount command is called
with a path and a script file argument. When the path is first accessed
the script is executed with the destination path as argument. It's the
resposibility of the script to make this directory available. A simple
example could be:
/env/bin/automount_tftp:
|#!/bin/sh
|
|where="$1"
|dhcp
|mount $eth0.serverip tftp $where
and on the commandline:
barebox:/ automount /mnt/tftp /env/bin/automount_tftp
barebox:/ automount -l
/mnt/tftp /env/bin/automount_tftp
barebox:/ cp mnt/tftp/barebox.bin /
phy0: Link is up - 100/Full
T T DHCP client bound to address 192.168.24.146
barebox:/ automount -l
barebox:/ ls -l barebox.bin
-rwxrwxrwx 158388 barebox.bin
barebox:/
It does not only work with filesystems mounted to directories but
also with flat devices:
/env/bin/automount_usbdisk:
|#!/bin/sh
|
|usb
barebox:/ automount /dev/usbdisk0.0 /env/bin/automount_usbdisk
barebox:/ bootm /dev/usbdisk0.0
USB: scanning bus for devices...
Bus 001 Device 002: ID 090c:1000 USB DISK
Using index 0 for the new disk
Bus 001 Device 001: ID 0000:0000 EHCI Host Controller
2 USB Device(s) found
commandline: ip=dhcp root=mtd:nand0.root rootfstype=jffs2 mtdparts=mxc_nand:512k(nand0.barebox)ro,128k(nand0.bareboxenv),2M(nand0.kernel),-(nand0.root);physmap-flash.0:512k(nor0.barebox)ro,128k(nor0.bareboxenv),2M(nor0.kernel),-(nor0.root) console=ttymxc0,115200
arch_number: 1551
Uncompressing Linux... done, booting the kernel.
...
Comments welcome.
Thanks,
Sascha
----------------------------------------------------------------
Sascha Hauer (8):
fs: change get_fs_device_by_path prototype
fs: drop struct mtab_entry
Add automount support
fs open: pass error from stat
hush source: expand $PATH
FAT: Fix error path
usb command: by default scan only once for USB devices
partition command: optionally do not automatically prepend the device name
commands/Kconfig | 10 ++
commands/Makefile | 1 +
commands/automount.c | 66 ++++++++++++
commands/mount.c | 10 +-
commands/partition.c | 33 +++++--
commands/usb.c | 26 ++++-
common/hush.c | 17 +++-
fs/Kconfig | 3 +
fs/fat/fat.c | 18 +++-
fs/fat/ff.c | 4 +-
fs/fs.c | 282 +++++++++++++++++++++++++++++++++++---------------
include/fs.h | 19 ++--
12 files changed, 371 insertions(+), 118 deletions(-)
create mode 100644 commands/automount.c
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2012-03-18 14:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-18 14:26 Sascha Hauer [this message]
2012-03-18 14:26 ` [PATCH 1/8] fs: change get_fs_device_by_path prototype Sascha Hauer
2012-03-18 14:26 ` [PATCH 2/8] fs: drop struct mtab_entry Sascha Hauer
2012-03-18 14:26 ` [PATCH 3/8] Add automount support Sascha Hauer
2012-03-18 14:26 ` [PATCH 4/8] fs open: pass error from stat Sascha Hauer
2012-03-18 14:26 ` [PATCH 5/8] hush source: expand $PATH Sascha Hauer
2012-03-18 14:26 ` [PATCH 6/8] FAT: Fix error path Sascha Hauer
2012-03-18 14:26 ` [PATCH 7/8] usb command: by default scan only once for USB devices Sascha Hauer
2012-03-18 14:26 ` [PATCH 8/8] partition command: optionally do not automatically prepend the device name Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1332080804-13132-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox