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, but I thought that maybe this could stand another set of eyes. Version-Release number of selected component (if applicable): grub-0.93-7 How reproducible: Always Steps to Reproduce: NA - this is an enhancement patch Additional info:
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 sequence 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 trigger the *smoke-test* and reboot from rc.local. The patch is against RH grub-0.93-7 srpm, which has 18 patches for 0.90-0.93 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 setdefault_helper, and modify savedefault to call it. IOW, savedefault is higher-level than setdefault, 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 cut-pasted into wherever it belongs. I also left some of the help-text in static struct builtin builtin_setdefault: 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.
Created attachment 95738 [details] doc-patch
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.
Created attachment 95739 [details] code patch apologies - I missed the patch-checkbox on 1st attach, redoing incase theres automation that handles this differently