[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: mkfs command in grub
From: |
Marco Gerards |
Subject: |
Re: mkfs command in grub |
Date: |
Tue, 28 Mar 2006 18:04:09 +0200 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
address@hidden 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
- mkfs command in grub, technologypages, 2006/03/09
- Re: mkfs command in grub, Marco Gerards, 2006/03/10
- Re: mkfs command in grub, Vesa Jääskeläinen, 2006/03/11
- Re: mkfs command in grub, Yoshinori K. Okuji, 2006/03/11
- Re: mkfs command in grub, Marco Gerards, 2006/03/11
- Re: mkfs command in grub, Yoshinori K. Okuji, 2006/03/11
- Re: mkfs command in grub, Marco Gerards, 2006/03/11
- Re: mkfs command in grub, Tomáš Ebenlendr, 2006/03/11
- Re: mkfs command in grub, Yoshinori K. Okuji, 2006/03/12