barebox/lib/bootstrap/disk.c
Uwe Kleine-König f97f4b6571 mount: support filesystem options passed via -o
Similar to mount(8) the barebox command mount now supports passing a string
to the file system driver via -o.

This is used in the next commit to let the user specify port numbers for
nfs mounts.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2014-02-10 09:02:21 +01:00

38 lines
688 B
C

/*
* Copyright (C) 2011 Sascha Hauer, Pengutronix
* Copyright (C) 2012 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
*
* Under GPLv2
*/
#include <common.h>
#include <fs.h>
#include <fcntl.h>
#include <sizes.h>
#include <errno.h>
#include <malloc.h>
#include <bootstrap.h>
void* bootstrap_read_disk(char *dev, char *fstype)
{
int ret;
void *buf;
int len;
char *path = "/";
ret = mount(dev, fstype, path, NULL);
if (ret) {
bootstrap_err("mounting %s failed with %d\n", dev, ret);
return NULL;
}
buf = read_file("/barebox.bin", &len);
if (!buf) {
bootstrap_err("could not read barebox.bin from %s\n", dev);
umount(path);
return NULL;
}
return buf;
}