From: Enrico Jorns <ejo@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Enrico Jorns <ejo@pengutronix.de>
Subject: [PATCH 5/5] fs: squashfs: append linux rootarg for ubi volume
Date: Tue, 4 Oct 2016 12:10:48 +0200 [thread overview]
Message-ID: <20161004101048.12970-6-ejo@pengutronix.de> (raw)
In-Reply-To: <20161004101048.12970-1-ejo@pengutronix.de>
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 <ejo@pengutronix.de>
---
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 <linux/fs.h>
#include <linux/stat.h>
#include <linux/pagemap.h>
+#include <linux/mtd/ubi.h>
+#include <linux/mtd/mtd.h>
#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
prev parent reply other threads:[~2016-10-04 10:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-04 10:10 [PATCH 0/5] Extend squashfs support Enrico Jorns
2016-10-04 10:10 ` [PATCH 1/5] fs: squashfs: port lzo compression support from kernel Enrico Jorns
2016-10-04 19:34 ` Sascha Hauer
2016-10-12 6:26 ` Yegor Yefremov
2016-10-04 10:10 ` [PATCH 2/5] fs: squashfs: port lz4 " Enrico Jorns
2016-10-04 10:10 ` [PATCH 3/5] fs: squashfs: port zlib " Enrico Jorns
2016-10-04 19:40 ` Sascha Hauer
2016-10-21 6:04 ` Yegor Yefremov
2016-10-21 6:53 ` Sascha Hauer
2016-10-04 10:10 ` [PATCH 4/5] Add filetype and detection for squashfs images Enrico Jorns
2016-10-06 13:55 ` Yegor Yefremov
2016-10-06 14:10 ` Enrico Joerns
2016-10-07 12:08 ` Yegor Yefremov
2016-10-04 10:10 ` Enrico Jorns [this message]
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=20161004101048.12970-6-ejo@pengutronix.de \
--to=ejo@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.