On Tue, May 26, 2015 at 02:46:21PM +0200, Marc Kleine-Budde wrote: > From: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> > > When bootloader spec is used to boot devices it is often desirable > to boot the same image from different media. Since the fs images > need to contain the root= parameters to tell Linux where to boot > from the images can't be identical on different media. > > This patch changes this by introducing a 'appendroot' option for > bootloader spec. If set to true, barebox will construct a Linux > commandline option for the device the bootloader spec entry is found > on. This should have documentation in Documentation/user/booting-linux.rst. (which currently lacks information that we can do bootloaderspec via NFS aswell) > +static int blspec_append_root(struct blspec_entry *entry) > +{ > + const char *appendroot; > + const char *rootarg; > + struct device_d *fsdev; > + int ret; > + > + appendroot = blspec_entry_var_get(entry, "appendroot"); > + if (!appendroot || strcmp(appendroot, "true")) > + return 0; > + > + fsdev = get_dev_by_mountpath(entry->rootpath); > + if (!fsdev) { > + ret = -EINVAL; > + pr_err("Cannot get fs device for %s\n", entry->rootpath); > + goto err_out; > + } > + > + rootarg = dev_get_param(fsdev, "linux.bootargs"); Better linux.root? > --- a/drivers/mtd/ubi/kapi.c > +++ b/drivers/mtd/ubi/kapi.c > @@ -36,6 +36,7 @@ void ubi_do_get_device_info(struct ubi_device *ubi, struct ubi_device_info *di) > di->min_io_size = ubi->min_io_size; > di->max_write_size = ubi->max_write_size; > di->ro_mode = ubi->ro_mode; > + di->mtd = ubi->mtd; > } > EXPORT_SYMBOL_GPL(ubi_do_get_device_info); > > diff --git a/fs/fs.c b/fs/fs.c > index a056d83d3d92..b8d3d3468f01 100644 > --- a/fs/fs.c > +++ b/fs/fs.c > @@ -225,6 +225,19 @@ struct cdev *get_cdev_by_mountpath(const char *path) > return fsdev->cdev; > } > > +/* > + * get_cdev_by_mountpath - return the cdev the given path > + * is mounted on s/get_cdev_by_mountpath/get_dev_by_mountpath/ > + */ > +struct device_d *get_dev_by_mountpath(const char *path) > +{ > + struct fs_device_d *fsdev; > + > + fsdev = get_fsdevice_by_path(path); > + > + return &fsdev->dev; > +} > + > char *get_mounted_path(const char *path) > { > struct fs_device_d *fdev; > diff --git a/fs/nfs.c b/fs/nfs.c > index 2738c781d72b..ba00270a8b23 100644 > --- a/fs/nfs.c > +++ b/fs/nfs.c > @@ -1306,6 +1306,20 @@ static int nfs_stat(struct device_d *dev, const char *filename, struct stat *s) > } > } > > +static void nfs_set_rootarg(struct nfs_priv *npriv, struct device_d *dev) > +{ > + char *str; > + const char *ip; > + > + ip = ip_to_string(npriv->server); > + str = asprintf("root=/dev/nfs nfsroot=%s:%s,v3,tcp", > + ip, npriv->path); It would be nice to have the NFS options configurable. Maybe from a global.linux.rootnfsopts variable? Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox