Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1FOGfV-0003k3-3U for mharc-grub-devel@gnu.org; Tue, 28 Mar 2006 11:03:41 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FOGfT-0003jP-8G for grub-devel@gnu.org; Tue, 28 Mar 2006 11:03:39 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FOGfP-0003ig-Lw for grub-devel@gnu.org; Tue, 28 Mar 2006 11:03:37 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FOGfP-0003ic-Ff for grub-devel@gnu.org; Tue, 28 Mar 2006 11:03:35 -0500 Received: from [194.109.24.32] (helo=smtp-vbr12.xs4all.nl) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FOGhA-0000OB-28 for grub-devel@gnu.org; Tue, 28 Mar 2006 11:05:24 -0500 Received: from localhost.localdomain (249-174.surfsnel.dsl.internl.net [145.99.174.249]) by smtp-vbr12.xs4all.nl (8.13.6/8.13.6) with ESMTP id k2SG3XUf035297 for ; Tue, 28 Mar 2006 18:03:34 +0200 (CEST) (envelope-from mgerards@xs4all.nl) Mail-Copies-To: mgerards@xs4all.nl To: The development of GRUB 2 References: <4415797F.7000808@yahoo.com> From: Marco Gerards Date: Tue, 28 Mar 2006 18:04:09 +0200 In-Reply-To: <4415797F.7000808@yahoo.com> (technologypages@yahoo.com's message of "Mon, 13 Mar 2006 15:54:07 +0200") Message-ID: <877j6e5zeu.fsf@xs4all.nl> User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by XS4ALL Virus Scanner Subject: Re: mkfs command in grub X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Mar 2006 16:03:39 -0000 technologypages@yahoo.com writes: > Could someone who knows the code please envisage what should be done > in order to implement the mkfs module? First of all, I would not call the command mkfs. Better just restrict the functionality to swap, that can give you some assertions to begin with. First just have a look at the hello command and how it is implemented. Have a look at hello.c, for example. After that, study some of the more fancy commands and how to read from and write to disk. I think you can make a simple command like: mkswap --linux-swap --fat And an argument for the disk, so you can have: mkswap --linux-swap (hd0,2) or: mkswap --fat (hd0,2) I think creating the swap filesystem is rather trivial. For linux swap it might be just a single block you have to write. For fat it is just a few and this might be less trivial. By assuming it is just used for swap, you can make sure mkswap can not erase the wrong partition. It happens that some BIOSes swap disk numbers, you certainly do not want to erase data from the wrong disk. So I think you can better check if it is a swap partition you are erasing. So either one of these two checks have to be true: - The partition is linux swap. - The partition is fat and has a certain label ("swap", for example). I have no idea if this will work. For example, you might have to change the partition type too. Besides all this, this is not a guarantee that if you implement such feature, it will make it into GRUB. But I am certainly willing to answer your questions. -- Marco