[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: PATCH (updated): 'lilo -R' functionality
From: |
Yoshinori K. Okuji |
Subject: |
Re: PATCH (updated): 'lilo -R' functionality |
Date: |
Wed, 11 Dec 2002 03:05:44 +0900 |
User-agent: |
Wanderlust/2.8.1 (Something) SEMI/1.14.3 (Ushinoya) FLIM/1.14.3 (UnebigoryĆmae) APEL/10.3 Emacs/21.2 (i386-debian-linux-gnu) MULE/5.0 (SAKAKI) |
[I added bug-grub into Cc:, because we don't talk about secrets.]
At Tue, 10 Dec 2002 16:58:39 +0000,
Andrew Stribblehill wrote:
> How about this...
Sorry, I don't like this, either. Perhaps I should have made it clear
why I don't like it.
The reason is that it always modifies the boot image directly. This is
dangerous, especially on a running OS, because the OS may relocate the
data of the image in a disk physically. Also, this is not desirable,
if using a flash memory, because the same sector is rewritten
frequently, so it is deteriorated very soon.
You might want to insist that savedefault does the same thing. That's
right, but I really regret that savedefault was implemented this
way. So, if you want to add one more feature into savedefault, please
consider redesigning it.
Possibly NVRAM is a good solution, if available. But NVRAM is not
standardized in PC, unfortunately, so using NVRAM is very
machine-specific.
Another way is to use a file on a disk as a substitute for
NVRAM. Although GRUB doesn't support writing files, GRUB can write
data into disks. If my understanding is correct, it is safe for GRUB
to modify the contents of a file, as long as the size of the file
doesn't change.
So I can think of this kind of scenario:
1) Create a NVRAM-like file, say, "/boot/grub/nvram.dat" on an OS. The
file must be bigger than the size of required data. 512 bytes might
be sufficient.
2) When setting a boot-once flag, you write something like this to the
file:
bootonce 1 # The entry number.
end # Prevent GRUB from reading garbage.
3) When GRUB starts up, read "/boot/grub/nvram.dat" if exists. If it
finds the line "bootonce blahblah", GRUB rewrites the file so that
it won't boot the entry in next boot time, like this:
end
And, GRUB boots the entry.
4) In next boot, GRUB doesn't find bootonce, so it boots up the
default entry.
I don't know if this idea is really nice, because this can be
error-prone (consider how many error checks would be required...).
Thanks,
Okuji