[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] savedefault
From: |
Carlo Contavalli |
Subject: |
[PATCH] savedefault |
Date: |
Wed, 2 Apr 2003 19:02:23 +0200 |
Hi!
In the attachment, you'll find a small and dumb patch for
grub that:
- allows usage of savedefault both from the
os command line and the boot time one
- allows to specify which default to save
- adds the command showdefault
The purpose of the changes is to allow smoother
home-compiled kernel updates on remotely located
servers.
For example, using the provided patch and
``default saved'' in menu.lst, after installing
a new kernel, I could:
1) add a new entry 0 in menu.lst without removing the
old ones, inserting a ``savedefault 1'' and
giving ``panic=10'' as a parameter to
the linux kernel
3) run grub from the command line (either at
boot time or from the grub shell) and give the
command ``savedefault 0''
4) reboot the system
During the first boot, the default entry 0 is chosen
since it was saved as the default one.
Once the entry is loaded, the default is set to 1 thanks
to ``savedefault 1''.
If the kernel panics, the parameter panic=10 will make
the system reboot in 10 seconds. During the following
boot up, grub will run entry 1 as default instead of
entry 0.
When the system boots up, an init script could
easily detect if the new kernel or the old one had
been loaded and do something smart about that. In
case of success, it could, for example, run
``savedefault 0'' to set again the new kernel as
default and remove ``savedefault 1'' from the menu.lst
and finally remove the old kernel.
Ok, the patch was made against grub 0.93 + cvs
20030224 as provided in the corresponding debian
package + the patch for the el torito hd boot
images. I wrote it since I needed to update the
kernel on some machines without being there.
It's just a one morning effort, so don't blame
me too much. I just thought it could be useful to
others. It should apply cleanly on the vanilla
version of grub, beside maybe a reject in
stage2/builtins.c due to patch not being able
to figure out where to add &builtin_showdefault
in builtin_table[].
A couple defines avoid conflicts with the el
torito patch due to missing ERR_CANT_SEEK and
COMPAT_VERSION being a char instead of a short.
They really should be removed, and a good sed
should make it.
Please consider that I'm not subscribed
to the mailing list and that I don't follow
closely the development of grub, so please
carbon copy any comment to my private email
address and forgive me if the issue had already
been discussed in the mailing list..
Bye,
Carlo
--
GPG Fingerprint: 2383 7B14 4D08 53A4 2C1A CA29 9E98 5431 1A68 6975
-------------
Perl itself is usually pretty good about telling you what you shouldn't
do. :-)
-- Larry Wall in <address@hidden>
grub.patch.diff
Description: Text document
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] savedefault,
Carlo Contavalli <=