From patchwork Wed Oct 6 21:02:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Karl Beldan X-Patchwork-Id: 66987 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from canuck.infradead.org (canuck.infradead.org [134.117.69.58]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 12F4CB6EED for ; Thu, 7 Oct 2010 10:47:23 +1100 (EST) Received: from localhost ([127.0.0.1] helo=localhost.localdomain) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1P3d5l-000617-Ha; Wed, 06 Oct 2010 23:08:09 +0000 Received: from mail-wy0-f177.google.com ([74.125.82.177]) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1P3b95-0002Vt-4v for linux-mtd@lists.infradead.org; Wed, 06 Oct 2010 21:03:27 +0000 Received: by wyb38 with SMTP id 38so9089963wyb.36 for ; Wed, 06 Oct 2010 14:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer; bh=2h80SmjLlrg4ICQr4v1egMG3TwQQwGkZqGkTsXDW4ks=; b=StwfkXYERO/lGUDL9XnCR9gUtx2QPVMIYzT/8GZ/G/E3a+pHgxCpgAXgDZ50nsTqqj Z0JmBXxnMrcKv9HErV/id9TzSO/LUqB0K4zQ0I4ipwbXpcyCcKUpcZjwLTR1IAJKNSM/ AqD9lDFfMUZ+ILCuLq3/olQGNCoAjHEXBxxlg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; b=sNyA65qtNngux5lCdT1zH1gEJHJ30OIai1wnJ/mOWudK6Ec5eDacs3VBXE2rBKQtL5 ChQ/TT3zwuJbQIHdaLXIsNFzDLPxY51H9dd6rgibxfWBt7iI560JLn2I8yN4kRAwboNt nmBJAGLmt5Zac2gsqLR64aQJjStDGB3u15cGM= Received: by 10.216.71.206 with SMTP id r56mr1383500wed.29.1286399004902; Wed, 06 Oct 2010 14:03:24 -0700 (PDT) Received: from gobelin.homenetwork (cla92-5-82-245-139-37.fbx.proxad.net [82.245.139.37]) by mx.google.com with ESMTPS id r18sm935215weo.0.2010.10.06.14.03.21 (version=SSLv3 cipher=RC4-MD5); Wed, 06 Oct 2010 14:03:24 -0700 (PDT) From: Karl Beldan To: linux-mtd@lists.infradead.org Subject: [RFC] do_mounts: Allow mtd names for non-flash block filesystems Date: Wed, 6 Oct 2010 23:02:54 +0200 Message-Id: <1286398974-12114-1-git-send-email-karl.beldan@gmail.com> X-Mailer: git-send-email 1.7.1.422.g049e9 X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20101006_170327_379326_01569AC0 X-CRM114-Status: GOOD ( 16.70 ) X-Spam-Score: -0.1 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is freemail (karl.beldan[at]gmail.com) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, low trust [74.125.82.177 listed in list.dnswl.org] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.0 T_TO_NO_BRKTS_FREEMAIL T_TO_NO_BRKTS_FREEMAIL Cc: Karl Beldan , David Woodhouse , Artem Bityutskiy X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Hi, I have been using this tweak for some time now, and I am getting tired of having to resort to it so often. It allows to pass such cmdline root as: "root=mtdb:ubivolx rootfstype=squashfs" I am pretty sure many people use squashfs/cramfs filesystems on top of nand, for example, and I thought that this might initiate discussion. diff --git a/init/do_mounts.c b/init/do_mounts.c index 02e3ca4..20d9380 100644 --- a/init/do_mounts.c +++ b/init/do_mounts.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "do_mounts.h" @@ -386,8 +387,18 @@ void __init prepare_namespace(void) if (saved_root_name[0]) { root_device_name = saved_root_name; - if (!strncmp(root_device_name, "mtd", 3) || - !strncmp(root_device_name, "ubi", 3)) { + if (!strncmp(root_device_name, "mtdb:", 4)) { + struct mtd_info *mtd = get_mtd_device_nm(root_device_name + 4); + if (!IS_ERR(mtd)) + sprintf(root_device_name, "/dev/mtdblock%d", mtd->index); + else { + printk(KERN_ERR "VFS: Unable to find mtd \"%s\"\n", root_device_name + 4); + printk("List of all partitions:\n"); + printk_all_partitions(); + panic("VFS: Unable to mount root fs"); + } + } else if (!strncmp(root_device_name, "mtd", 3) || + !strncmp(root_device_name, "ubi", 3)) { mount_block_root(root_device_name, root_mountflags); goto out; }