blob: 854e8e909aa8720cc314498f37a65d6ef9061864 [file] [log] [blame]
From Aaditya.Kumar@ap.sony.com Fri Nov 23 03:51:22 2012
From: Aaditya Kumar <aaditya.kumar@ap.sony.com>
Date: Fri, 23 Nov 2012 17:15:41 +0530
Subject: [PATCH v2 RESEND 15/15] AXFS: mount as rootfs
To: Greg KH <gregkh@linuxfoundation.org>
Cc: "ltsi-dev@lists.linuxfoundation.org" <ltsi-dev@lists.linuxfoundation.org>, tim.bird@am.sony.com, frank.rowand@am.sony.com, takuzo.ohara@ap.sony.com, amit.agarwal@ap.sony.com, kan.iibuchi@jp.sony.com, aaditya.kumar.30@gmail.com
Message-ID: <50AF61E5.4080108@ap.sony.com>
From: Takuzo Ohara <Takuzo.Ohara@ap.sony.com>
Add support to mount AXFS as root file system first.
Signed-off-by: Takuzo Ohara <Takuzo.Ohara@ap.sony.com>
Signed-off-by: Aaditya Kumar <aaditya.kumar@ap.sony.com>
---
fs/axfs/Kconfig | 15 +++++++++++++++
fs/axfs/axfs_super.c | 6 ++++++
init/do_mounts.c | 20 ++++++++++++++++++++
3 files changed, 41 insertions(+)
--- a/fs/axfs/Kconfig
+++ b/fs/axfs/Kconfig
@@ -34,3 +34,18 @@ config AXFS_DEBUG_XIP_RECORDS_NUM
help
The number of records which /porc/axfs_xip can record. one record
takes about 64 bytes of memory.
+
+config AXFS_FIRST_MOUNT_AXFS_AS_ROOTFS
+ bool "First Mount AXFS as Rootfs"
+ depends on AXFS
+ help
+ Say Y if you have enabled axfs, and you want to mount the axfs
+ image as a root file system first when the kernel boots. This option
+ makes the kernel boottime a little faster when the command line is
+ properly set. Before having the kernel mount this axfs image
+ as a root file system, you must pass the command line parameter:
+ "root=/dev/null rootflags=physaddr=0x********" to the kernel
+ (replace 0x******** with the physical address location of the
+ axfs image to boot with).
+
+ If unsure, say N.
--- a/fs/axfs/axfs_super.c
+++ b/fs/axfs/axfs_super.c
@@ -884,6 +884,12 @@ struct dentry *axfs_get_sb(struct file_s
if (err)
goto out;
+#ifdef CONFIG_AXFS_FIRST_MOUNT_AXFS_AS_ROOTFS
+ printk(KERN_INFO "AXFS: Checking AXFS filesystem at virtaddr: 0x%08lx "
+ "(physaddr=0x%08lx).\n", sbi->virt_start_addr,
+ sbi->phys_start_addr);
+#endif
+
/* First we check if we are mounting directly to memory */
ret = axfs_get_sb_address(fs_type, flags, sbi);
if (!(IS_ERR_OR_NULL(ret)))
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -439,6 +439,19 @@ static int __init mount_nfs_root(void)
}
#endif
+#ifdef CONFIG_AXFS_FIRST_MOUNT_AXFS_AS_ROOTFS
+static int __init mount_axfs_root(void)
+{
+ create_dev("/dev/root", ROOT_DEV);
+ if (root_mount_data &&
+ do_mount_root("/dev/root", "axfs", root_mountflags,
+ root_mount_data) == 0)
+ return 1;
+ return 0;
+}
+#endif
+
+
#if defined(CONFIG_BLK_DEV_RAM) || defined(CONFIG_BLK_DEV_FD)
void __init change_floppy(char *fmt, ...)
{
@@ -471,6 +484,13 @@ void __init change_floppy(char *fmt, ...
void __init mount_root(void)
{
+#ifdef CONFIG_AXFS_FIRST_MOUNT_AXFS_AS_ROOTFS
+ if (MAJOR(ROOT_DEV) == UNNAMED_MAJOR) {
+ if (mount_axfs_root())
+ return;
+ printk(KERN_ERR "VFS: Unable to mount axfs root.\n");
+ }
+#endif
#ifdef CONFIG_ROOT_NFS
if (ROOT_DEV == Root_NFS) {
if (mount_nfs_root())