From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1brMgy-00037F-Jm for barebox@lists.infradead.org; Tue, 04 Oct 2016 10:11:23 +0000 From: Enrico Jorns Date: Tue, 4 Oct 2016 12:10:48 +0200 Message-Id: <20161004101048.12970-6-ejo@pengutronix.de> In-Reply-To: <20161004101048.12970-1-ejo@pengutronix.de> References: <20161004101048.12970-1-ejo@pengutronix.de> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH 5/5] fs: squashfs: append linux rootarg for ubi volume To: barebox@lists.infradead.org Cc: Enrico Jorns If squashfs runs from an ubi volume, append appropriate root kernel options. Note that ubiblock support is required in the kernel for that. Signed-off-by: Enrico Jorns --- fs/squashfs/squashfs.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/fs/squashfs/squashfs.c b/fs/squashfs/squashfs.c index 6d04681..c4d0bac 100644 --- a/fs/squashfs/squashfs.c +++ b/fs/squashfs/squashfs.c @@ -9,12 +9,16 @@ #include #include #include +#include +#include #include "squashfs_fs.h" #include "squashfs_fs_sb.h" #include "squashfs_fs_i.h" #include "squashfs.h" +struct ubi_volume_desc; + char *squashfs_devread(struct squashfs_sb_info *fs, int byte_offset, int byte_len) { @@ -108,6 +112,31 @@ static struct inode *squashfs_findfile(struct super_block *sb, return NULL; } +void squashfs_set_rootarg(struct squashfs_priv *priv, struct fs_device_d *fsdev) +{ + struct ubi_volume_desc *ubi_vol; + struct ubi_volume_info vi = {}; + struct ubi_device_info di = {}; + struct mtd_info *mtd; + char *str; + + ubi_vol = ubi_open_volume_cdev(fsdev->cdev, UBI_READONLY); + + if (IS_ERR(ubi_vol)) + return; + + ubi_get_volume_info(ubi_vol, &vi); + ubi_get_device_info(vi.ubi_num, &di); + mtd = di.mtd; + + str = basprintf("root=/dev/ubiblock%d_%d ubi.mtd=%s ubi.block=%d,%d rootfstype=squashfs", + vi.ubi_num, vi.vol_id, mtd->cdev.partname, vi.ubi_num, vi.vol_id); + + fsdev_set_linux_rootarg(fsdev, str); + + free(str); +} + static int squashfs_probe(struct device_d *dev) { struct fs_device_d *fsdev; @@ -130,6 +159,8 @@ static int squashfs_probe(struct device_d *dev) goto err_out; } + squashfs_set_rootarg(priv, fsdev); + return 0; err_out: -- 2.9.3 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox