Bug 109227 - patch - enhancement - setdefault N - new command
patch - enhancement - setdefault N - new command
Product: Red Hat Linux
Classification: Retired
Component: grub (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Jeremy Katz
Mike McLean
: FutureFeature
Depends On:
  Show dependency treegraph
Reported: 2003-11-05 14:29 EST by Need Real Name
Modified: 2007-03-27 00:11 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-11-05 14:40:59 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
patch to code (4.88 KB, text/plain)
2003-11-05 14:34 EST, Need Real Name
no flags Details
doc-patch (2.15 KB, patch)
2003-11-05 14:35 EST, Need Real Name
no flags Details | Diff
code patch (4.88 KB, patch)
2003-11-05 14:42 EST, Need Real Name
no flags Details | Diff

  None (edit)
Description Need Real Name 2003-11-05 14:29:11 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

Description of problem:
Ive done a slightly rough patch on grub-0.93.7 to add 'setdefault N'
command to grub-shell & stage2.  setdefault is very closely based upon
savedefault, the ONLY difference is that it takes an argument,
allowing its use to define a sequence of different boot-entries.

This is intended to support the use of one box to run multiple OSs,
where each OS is setup (via rc.local or similar) to run a battery of
build,tests under each OS.  I intend to use it to run 'smoketests' on
Perl 5.6.2, 5.8.2, 5.9.0, etc, but it should also be usable for the
Linux Kernel Test Project.

I sent this yesterday to grub-bugs@gnu.org, but I thought that maybe
this could stand another set of eyes.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
NA - this is an enhancement patch

Additional info:
Comment 1 Need Real Name 2003-11-05 14:34:22 EST
Created attachment 95737 [details]
patch to code

This patch adds a new command to grub - setdefault.

Its a close derivative of savedefault, the only difference is that it expects a

numeric argument, where original uses an implicit argument.

Its purpose is to support multi-kernel testing; a grub.conf can specify a
of different kernels to run, which *presumably* would execute some substantial
set of tests, then reboot to the next kernel, which would repeat until the last

setdefault (ie: 0 in example below) returned the box to normal operation.

Heres a sequence of 4 kernels on my machine:

# Here are the sequential boot tests

title Test RH 7.2 (2.4.20-20.7)
   setdefault 5
   root (hd0,1)
   kernel /vmlinuz-2.4.20-20.7 ro root=LABEL=/
   initrd /initrd-2.4.20-20.7.img

title Test RH 7.2 (2.4.20-18.7)
   setdefault 6
   root (hd0,1)
   kernel /vmlinuz-2.4.20-18.7 ro root=LABEL=/
   initrd /initrd-2.4.20-18.7.img

title Test RedHat 9 (2.4.20-20.9)
   setdefault 7
   root (hd0,0)
   kernel /boot/vmlinuz-2.4.20-20.9 ro root=LABEL=/1
   initrd /boot/initrd-2.4.20-20.9.img

title Test RedHat 9 (2.4.20-8)
   setdefault 0
   root (hd0,0)
   kernel /boot/vmlinuz-2.4.20-8 ro root=LABEL=/1
   initrd /boot/initrd-2.4.20-8.img

I expect to combine this with a runlevel=4 or similar to make it easy to
the *smoke-test* and reboot from rc.local.

The patch is against  RH   grub-0.93-7 srpm,  which has 18 patches for 

Its also somewhat unfinished;

1.  I copy-pasted verbatim from savedefault_helper to setdefault_helper

   The 'right' thing to do would be to rename savedefault_helper as
   and modify savedefault to call it.  IOW, savedefault is higher-level than
   and should be implemented on top.  Doing this however felt a bit too brazen.

2.   No (proper patch to the source of ) docs.

   I couldnt quite make out from docs/Makefile.am which texi/info/etc file to
edit into.
   I added stuff into grub.texi.config.new, with hope that it could be easily
   into wherever it belongs.

   I also left some of the help-text in     static struct builtin

   I am unsure whether any of the options should be allowed; I think --once
would not make
   any sense though.  I did not strip the code for those options, so I thought
it best to leave
   an inappropriate marker.
Comment 2 Need Real Name 2003-11-05 14:35:35 EST
Created attachment 95738 [details]
Comment 3 Jeremy Katz 2003-11-05 14:40:59 EST
I'm avoiding adding new features into grub that aren't accepted
upstream at this point to avoid the long-term pain.  I see you've sent
it there and I'll watch the progress upstream.
Comment 4 Need Real Name 2003-11-05 14:42:18 EST
Created attachment 95739 [details]
code patch

apologies - I missed the patch-checkbox on 1st attach, redoing incase theres
automation that handles this differently

Note You need to log in before you can comment on or make changes to this bug.