patch for loader.c (was Re: rescue mode on serial console)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Earlier, I wrote:

>....
> This happens on vanilla RH 7.1, too.
>
> I tried booting off of vanilla RH 7.1, but at the
> boot line, on the VGA console, I specified:
>
> linux rescue console=ttyS0,38400n8
>
> As I expected, my terminal located on ttyS0 started
> booting.  It got to the language selection screen,
> I picked English, I tabbed to OK, pressed enter, and
> was taken back to the language selection screen.
>
> I don't see this when I boot into rescue mode over
> the network; only when I boot from CD-ROM.  I'm in
> the middle of inserting pdb.set_trace's in anaconda
> in text.py in the LanguageWindow class, to see what
> it's doing.  Before I burn too many CD-ROMs as part
> of trying to debug this, does anyone have any ideas
> about what might be going on?
>....

The problem was NOT in text.py.

Rather, the problem was in the loader program which (I
think) runs prior to anaconda starting.  The program
lives in initrd.img in boot.img on the installation CD
(CD-ROM 1 of RH 7.1.)

Near line 2830, here's what loader.c does:

    if (FL_RESCUE(flags)) {
        startNewt(flags);

        if (!lang) {
            int rc;

            do {
                chooseLanguage(&lang, flags);
                defaultLang = 0;
                rc = chooseKeyboard (&keymap,
&kbdtype, flags);
            } while (rc);
        }


On systems with serial consoles, in rescue mode,
chooseKeyboard returns LOADER_NOOP, which is #define'd
to 2.  So, if lang is undefined, this loops forever,
continually asking the user for their choice of
language.

I first tried re-specifying the lang parameter in
syslinux.cfg, and on syslinux's "boot:" line.
This didn't work; loader still looped.

So, I patched loader.c.  Here's the patch:

--- loader/loader.c.old Wed Aug 29 13:32:59 2001
+++ loader/loader.c     Wed Aug 29 13:00:47 2001
@@ -2834,9 +2834,12 @@
            int rc;

            do {
-               chooseLanguage(&lang, flags);
-               defaultLang = 0;
-               rc = chooseKeyboard (&keymap,
&kbdtype, flags);
+                       chooseLanguage(&lang, flags);
+                       defaultLang = 0;
+                       rc = chooseKeyboard (&keymap,
&kbdtype, flags);
+                       if (rc == LOADER_NOOP){
+                               break;
+                       }
            } while (rc);
        }
        *argptr++ = "--rescue";

----end of patch----

(I suspect that this mailer is wrapping lines.  So
I also included the patch in an attachment.)

Getting the patch built, and into initrd, was a little
tricky.

Erik Troan (ewt@xxxxxxxxxx) told us that the
scripts/buildinstall script (in the anaconda source
directory) will re-build a boot CD.  buildinstall
calls
mk-images, which in turn dot-includes other mk-images*
files, which are also in the scripts directory.

>From what I can understand from buildinstall and
mk-images*, the anaconda.spec file builds several
versions of the loader.  buildinstall chooses one of
the versions from the anaconda-runtime rpm, and
includes it in the initrd.  Which loader?  It depends
on whether the initrd is for a Japanese language
version, PCMCIA, network, and/or local.  I think
"local" means CD-ROM.

I _think_ that loader-local is the one used for CD-ROM
install.  That's where I'm seeing the problem.

I put the above patch into a file,
/usr/src/redhat/SOURCES/anaconda-7.1-loader.c.patch
I patched the anaconda.spec file so that it looked
for an the anaconda-7.1-loader.c.patch file.  I
then ran rpm -ba anaconda.spec, and rebuilt the
anaconda, anaconda-runtime, and anaconda source
rpm's.

Since I still don't fully understand buildinstall,
I did the usual trick of mounting boot.img, ungzipping
initrd.img from boot.img, mounting initrd.  This
sequence has been posted to this list, previously,
so I won't repeat it here.  I used rpm2cpio to
extract the loader-local from the anaconda-runtime
rpm.  I copied it to the initrd.  I then re-packed
the initrd.img, boot.img, and re-burned a CD-ROM.

I have only tested the above patch with CD-ROM boots.
I have no idea if it works in any of the other
environments.  I also make no gaurantees whether
this will work for you.  The usual caveats apply.

I still have some questions:

1.  Why don't I see this when I do a network install
in
    rescue mode?

2.  Is there a way to fool the loader into thinking
    that the lang variable is defined?

Thanks,

--Seth


__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

Attachment: loader.c.patch
Description: loader.c.patch


[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux