LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 10-16-2009, 04:30 PM   #1
Lord Estraven
Member
 
Registered: Aug 2004
Distribution: Pardus
Posts: 53

Rep: Reputation: 15
initrd modification: alternatives to nash?


Okay, this is a kind of strange question, but here goes...

As of Red Hat 5.3 and 5.4 (and all derived distros, such as Scientific and CentOS) there is a bug in nash that adds significantly to boot time (the "waiting for driver initialization" bug). There is a patch for this bug but it hasn't made it into the repos, so for now, users are stuck with long boot times.

What I'm wondering is, are there any linuxrc interpreters out there that can substitute for nash? If so, how would I change the routine for generating the initrd so that the substitute program would be used?

(Yes, I realize I could patch nash myself. Unfortunately that would be quite a pain in the neck to actually do... Which is why I'm looking for alternatives.)
 
Old 10-17-2009, 09:59 AM   #2
Forrest Coredump
Member
 
Registered: Oct 2009
Location: Southwestern United States
Distribution: Redhat Enterprise Linux 4-5 (Current RHCE), Fedora Core 11 (FC11), Arch Linux, BT3 (Current GCIH)
Posts: 42

Rep: Reputation: 19
Six of one half dozen of the other - Substituting interpreters would be a wash as far as maintenance, etc... when compared to applying this patch. The patch is available below, and it's a piece of cake to apply.



Index: mkinitrd-5.1.2/nash/nash.c
===================================================================
--- mkinitrd-5.1.2/nash/nash.c.orig 2006-07-29 22:58:05.000000000 -0300
+++ mkinitrd-5.1.2/nash/nash.c 2006-07-29 23:29:47.000000000 -0300
@@ -1616,9 +1616,9 @@ stabilizedMtime(char *path, int iteratio
eprintf("stabilized: stat %s: %m\n", path);
return -1;
}
- eprintf("last: %ld.%ld sb: %ld.%ld now: %ld.%ld\n", last.tv_sec, last.tv_nsec, sb.st_mtime, sb.st_atim.tv_nsec, now.tv_sec, now.tv_usec * 1000);
- if (sb.st_mtime == last.tv_sec
- && sb.st_atim.tv_nsec == last.tv_nsec) {
+ eprintf("last: %ld.%ld sb: %ld.%ld now: %ld.%ld\n", last.tv_sec, last.tv_nsec, sb.st_mtim.tv_sec, sb.st_mtim.tv_nsec, now.tv_sec, now.tv_usec * 1000);
+ if (sb.st_mtim.tv_sec == last.tv_sec
+ && sb.st_mtim.tv_nsec == last.tv_nsec) {
if (++count == goal)
return changed;
} else {
@@ -1627,8 +1627,8 @@ stabilizedMtime(char *path, int iteratio
}

udelayspec(interval);
- last.tv_sec = sb.st_atim.tv_sec;
- last.tv_nsec = sb.st_atim.tv_nsec;
+ last.tv_sec = sb.st_mtim.tv_sec;
+ last.tv_nsec = sb.st_mtim.tv_nsec;
if (iterations != -1)
iterations--;
} while (iterations == -1 || iterations > 0);
@@ -1729,12 +1729,8 @@ usage:
if (!file)
goto usage;

- interval_ts.tv_sec = 0;
- while (interval > 999) {
- interval_ts.tv_sec += 1;
- interval -= 999;
- }
- interval_ts.tv_nsec = interval * 1000000;
+ interval_ts.tv_sec = interval / 1000;
+ interval_ts.tv_nsec = (interval % 1000) * 1000000;

if (do_poll)
rc = stabilizedPoll(file, iterations, interval_ts, 10);
Index: mkinitrd-5.1.2/nash/util.h
===================================================================
--- mkinitrd-5.1.2/nash/util.h.orig 2006-07-11 17:17:42.000000000 -0300
+++ mkinitrd-5.1.2/nash/util.h 2006-07-29 22:53:10.000000000 -0300
@@ -116,32 +116,23 @@ extern int getDevNumFromProc(char * file

extern int stringsort(const void *v0, const void *v1);

-static void __attribute__((used))
+static inline void
+udelayspec(struct timespec rem)
+{
+ while (nanosleep (&rem, &rem) == -1 && errno == EINTR)
+ continue;
+}
+
+static inline void
udelay(long long usecs)
{
- struct timespec rem = {0,0}, req = {0,0};
- struct timespec *reqp = &req, *remp = &rem, *tmp;
+ struct timespec rem = {0,0};

- while (usecs > 999999) {
- rem.tv_sec++;
- usecs -= 999999;
- }
- rem.tv_nsec = usecs * 1000;
-
- do {
- tmp = reqp;
- reqp = remp;
- remp = tmp;
- errno = 0;
- } while (nanosleep(reqp, remp) == -1 && errno == EINTR);
+ rem.tv_sec = usecs / 1000000;
+ rem.tv_nsec = (usecs % 1000000) * 1000;
+ udelayspec (rem);
}

-#define udelayspec(ts) ({ \
- long long __delay = (ts.tv_nsec - (ts.tv_nsec % 1000)) \
- + (ts.tv_sec * 1000000); \
- udelay(__delay); \
- })
-
extern char *readlink_malloc(const char *filename);

#define readlinka(_filename

Last edited by Forrest Coredump; 10-17-2009 at 10:06 AM. Reason: It's early!
 
Old 10-21-2009, 11:43 AM   #3
Lord Estraven
Member
 
Registered: Aug 2004
Distribution: Pardus
Posts: 53

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Forrest Coredump View Post
Six of one half dozen of the other - Substituting interpreters would be a wash as far as maintenance, etc... when compared to applying this patch. The patch is available below, and it's a piece of cake to apply.

<snip>
In my situation (using CentOS on my own laptop) I tend to think that maintenance wouldn't be such a big deal. Installing all the stuff I need to compile nash, on the other hand, and recompiling it after each update... I'd much rather just reconfigure the initrd generation to produce something that didn't use nash. If that's actually possible.
 
Old 10-25-2009, 09:18 AM   #4
fpmurphy
Member
 
Registered: Jan 2009
Location: /dev/ph
Distribution: Fedora, Ubuntu, Redhat, Centos
Posts: 299

Rep: Reputation: 62
Well, if you want to be cutting edge, look at the Dracut project. It is being released as part of Fedora 12. Basically it is a nash/mkinitrd replacement.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LPIC 1 Certification Bible by Angie Nash and Jason Nash RomanMoz Linux - Certification 3 12-30-2006 12:39 PM
Sound config on red hat nash PipeDreams Red Hat 0 06-03-2006 08:22 PM
nash 4.1.18.1 Problem rosenblitt Linux - Software 0 12-07-2005 08:43 AM
Initrd modification bschmidt MEPIS 1 10-31-2005 08:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 10:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration