From: Marco Gerards <mgerards@xs4all.nl>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: mkfs command in grub
Date: Tue, 28 Mar 2006 18:04:09 +0200 [thread overview]
Message-ID: <877j6e5zeu.fsf@xs4all.nl> (raw)
In-Reply-To: <4415797F.7000808@yahoo.com> (technologypages@yahoo.com's message of "Mon, 13 Mar 2006 15:54:07 +0200")
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
next prev parent reply other threads:[~2006-03-28 16:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-13 13:54 mkfs command in grub technologypages
2006-03-28 16:04 ` Marco Gerards [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-03-09 19:14 technologypages
2006-03-10 21:44 ` Marco Gerards
2006-03-11 9:10 ` Vesa Jääskeläinen
2006-03-11 11:08 ` Yoshinori K. Okuji
2006-03-11 14:37 ` Marco Gerards
2006-03-11 20:28 ` Yoshinori K. Okuji
2006-03-11 20:46 ` Marco Gerards
2006-03-12 0:03 ` Tomáš Ebenlendr
2006-03-12 22:28 ` Yoshinori K. Okuji
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=877j6e5zeu.fsf@xs4all.nl \
--to=mgerards@xs4all.nl \
--cc=grub-devel@gnu.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.