problems compiling kernel

problems compiling kernel

Post by Martinn Hermosill » Fri, 03 Jul 1998 04:00:00



hello i'm trying to compile kernel 2.0.25
i have an ATX PC Pentium MMX-233 Mhz with 128 Mb SDRam (168 pins)
well intel 430 TX chipset (ASUS TX97-XE MAinboard) ok
when i'm in make zImage stage the compiler said :

{Standard input}: Assembler messages:
{Standard input}:768: Error: no such 386 instruction: 'rdmsr'
{standard input}:770: Error: no such 386 instruction: 'wrmsr'
make[1]: *** [time.o] Error 1
make[1]1: Leaving directory '/usr/src/linux/arch/i386/kernel'
make: *** [linuxsubdirs] Error 2

all that in file time.c attached
caan some one explain to me what is happenning,
i'm running linux 1.2.13 now in my pc. and i've installed the sources of
linux 2.0.25 and tryed to compile it...
please answers to mart...@entelchile.net really urgent....

Martin Hermosilla
e-Mail: mart...@entelchile.net
Santiago Chile

[ time.c 14K ]
/*
 *  linux/arch/i386/kernel/time.c
 *
 *  Copyright (C) 1991, 1992, 1995  Linus Torvalds
 *
 * This file contains the PC-specific time handling details:
 * reading the RTC at bootup, etc..
 * 1994-07-02    Alan Modra
 *      fixed set_rtc_mmss, fixed time.year for >= 2000, new mktime
 * 1995-03-26    Markus Kuhn
 *      fixed 500 ms bug at call to set_rtc_mmss, fixed DS12887
 *      precision CMOS clock update
 * 1996-05-03    Ingo Molnar
 *      fixed time warps in do_[slow|fast]_gettimeoffset()
 */
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/param.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/time.h>
#include <linux/delay.h>

#include <asm/segment.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/delay.h>

#include <linux/mc146818rtc.h>
#include <linux/timex.h>
#include <linux/config.h>

extern int setup_x86_irq(int, struct irqaction *);

#ifndef CONFIG_APM      /* cycle counter may be unreliable */
/* Cycle counter value at the previous timer interrupt.. */
static struct {
        unsigned long low;
        unsigned long high;

} init_timer_cc, last_timer_cc;

/*
 * This is more assembly than C, but it's also rather
 * timing-critical and we have to use assembler to get
 * reasonable 64-bit arithmetic
 */
static unsigned long do_fast_gettimeoffset(void)
{
        register unsigned long eax asm("ax");
        register unsigned long edx asm("dx");
        unsigned long tmp, quotient, low_timer, missing_time;

        /* Last jiffy when do_fast_gettimeoffset() was called.. */
        static unsigned long last_jiffies=0;

        /* Cached "clocks per usec" value.. */
        static unsigned long cached_quotient=0;

        /* The "clocks per usec" value is calculated once each jiffy */
        tmp = jiffies;
        quotient = cached_quotient;
        low_timer = last_timer_cc.low;
        missing_time = 0;
        if (last_jiffies != tmp) {
                last_jiffies = tmp;
                /*
                 * test for hanging bottom handler (this means xtime is not
                 * updated yet)
                 */
                if (test_bit(TIMER_BH, &bh_active) )
                {
                        missing_time = 1000020/HZ;
                }

                /* Get last timer tick in absolute kernel time */
                eax = low_timer;
                edx = last_timer_cc.high;
                __asm__("subl "SYMBOL_NAME_STR(init_timer_cc)",%0\n\t"
                        "sbbl "SYMBOL_NAME_STR(init_timer_cc)"+4,%1"
                        :"=a" (eax), "=d" (edx)
                        :"0" (eax), "1" (edx));

                /*
                 * Divide the 64-bit time with the 32-bit jiffy counter,
                 * getting the quotient in clocks.
                 *
                 * Giving quotient = "average internal clocks per usec"
                 */
                __asm__("divl %2"
                        :"=a" (eax), "=d" (edx)
                        :"r" (tmp),
                         "0" (eax), "1" (edx));

                edx = 1000020/HZ;
                tmp = eax;
                eax = 0;

                __asm__("divl %2"
                        :"=a" (eax), "=d" (edx)
                        :"r" (tmp),
                         "0" (eax), "1" (edx));
                cached_quotient = eax;
                quotient = eax;
        }

        /* Read the time counter */
        __asm__(".byte 0x0f,0x31"
                :"=a" (eax), "=d" (edx));

        /* .. relative to previous jiffy (32 bits is enough) */
        edx = 0;
        eax -= low_timer;

        /*
         * Time offset = (1000020/HZ * time_low) / quotient.
         */

        __asm__("mull %2"
                :"=a" (eax), "=d" (edx)
                :"r" (quotient),
                 "0" (eax), "1" (edx));

        /*
         * Due to rounding errors (and jiffies inconsistencies),
         * we need to check the result so that we'll get a timer
         * that is monotonic.
         */
        if (edx >= 1000020/HZ)
                edx = 1000020/HZ-1;

        eax = edx + missing_time;
        return eax;

}

#endif

/* This function must be called with interrupts disabled
 * It was inspired by Steve McCanne's microtime-i386 for BSD.  -- jrs
 *
 * However, the pc-audio speaker driver changes the divisor so that
 * it gets interrupted rather more often - it loads 64 into the
 * counter rather than 11932! This has an adverse impact on
 * do_gettimeoffset() -- it stops working! What is also not
 * good is that the interval that our timer function gets called
 * is no longer 10.0002 ms, but 9.9767 ms. To get around this
 * would require using a different timing source. Maybe someone
 * could use the RTC - I know that this can interrupt at frequencies
 * ranging from 8192Hz to 2Hz. If I had the energy, I'd somehow fix
 * it so that at startup, the timer code in sched.c would select
 * using either the RTC or the 8253 timer. The decision would be
 * based on whether there was any other device around that needed
 * to trample on the 8253. I'd set up the RTC to interrupt at 1024 Hz,
 * and then do some jiggery to have a version of do_timer that
 * advanced the clock by 1/1024 s. Every time that reached over 1/100
 * of a second, then do all the old code. If the time was kept correct
 * then do_gettimeoffset could just return 0 - there is no low order
 * divider that can be accessed.
 *
 * Ideally, you would be able to use the RTC for the speaker driver,
 * but it appears that the speaker driver really needs interrupt more
 * often than every 120 us or so.
 *
 * Anyway, this needs more thought....          pjsg (1993-08-28)
 *
 * If you are really that interested, you should be reading
 * comp.protocols.time.ntp!
 */

#define TICK_SIZE tick

static unsigned long do_slow_gettimeoffset(void)
{
        int count;
        static int count_p = 0;
        unsigned long offset = 0;
        static unsigned long jiffies_p = 0;

        /*
         * cache volatile jiffies temporarily; we have IRQs turned off.
         */
        unsigned long jiffies_t;

        /* timer count may underflow right here */
        outb_p(0x00, 0x43);     /* latch the count ASAP */
        count = inb_p(0x40);    /* read the latched count */
        count |= inb(0x40) << 8;

        jiffies_t = jiffies;

        /*
         * avoiding timer inconsistencies (they are rare, but they happen)...
         * there are three kinds of problems that must be avoided here:
         *  1. the timer counter underflows
         *  2. hardware problem with the timer, not giving us continuous time,
         *     the counter does small "jumps" upwards on some Pentium systems,
         *     thus causes time warps
         *  3. we are after the timer interrupt, but the bottom half handler
         *     hasn't executed yet.
         */
        if( count > count_p ) {
                if( jiffies_t == jiffies_p ) {
                        if( count > LATCH-LATCH/100 )
                                offset = TICK_SIZE;
                        else
                                /*
                                 * argh, the timer is bugging we cant do nothing
                                 * but to give the previous clock value.
                                 */
                                count = count_p;
                } else {
                        if( test_bit(TIMER_BH, &bh_active) ) {
                                /*
                                 * we have detected a counter underflow.
                                 */
                                offset = TICK_SIZE;
                                count_p = count;                
                        } else {
                                count_p = count;
                                jiffies_p = jiffies_t;
                        }
                }
        } else {
                count_p = count;
                jiffies_p = jiffies_t;
        }

        count = ((LATCH-1) - count) * TICK_SIZE;
        count = (count + LATCH/2) / LATCH;

        return offset + count;

}

static unsigned long (*do_gettimeoffset)(void) = do_slow_gettimeoffset;

/*
 * This version of gettimeofday has near microsecond resolution.
 */
void do_gettimeofday(struct timeval *tv)
{
        unsigned long flags;

        save_flags(flags);
        cli();
        *tv = xtime;
        tv->tv_usec += do_gettimeoffset();
        if (tv->tv_usec >= 1000000) {
                tv->tv_usec -= 1000000;
                tv->tv_sec++;
        }
        restore_flags(flags);

}

void do_settimeofday(struct timeval *tv)
{
        cli();
        /* This is revolting. We need to set the xtime.tv_usec
         * correctly. However, the value in this location is
         * is value at the last tick.
         * Discover what correction gettimeofday
         * would have done, and then undo it!
         */
        tv->tv_usec -= do_gettimeoffset();

        if (tv->tv_usec < 0) {
                tv->tv_usec += 1000000;
                tv->tv_sec--;
        }

        xtime = *tv;
        time_state = TIME_BAD;
        time_maxerror = MAXPHASE;
        time_esterror = MAXPHASE;
        sti();

}

/*
 * In order to set the CMOS clock precisely, set_rtc_mmss has to be
 * called 500 ms after the second nowtime has started, because when
 * nowtime is written into the registers of the CMOS clock, it will
 * jump to the next second precisely 500 ms later. Check the Motorola
 * MC146818A or Dallas DS12887 data sheet for details.
 */
static int set_rtc_mmss(unsigned long nowtime)
{
        int retval = 0;
        int real_seconds, real_minutes, cmos_minutes;
        unsigned char save_control, save_freq_select;

        save_control = CMOS_READ(RTC_CONTROL); /* tell the clock it's being set */
        CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);

        save_freq_select = CMOS_READ(RTC_FREQ_SELECT); /* stop and reset prescaler */
        CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);

        cmos_minutes = CMOS_READ(RTC_MINUTES);
        if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD)
                BCD_TO_BIN(cmos_minutes);

        /*
         * since we're only adjusting minutes and seconds,
         * don't interfere with hour overflow. This avoids
         * messing with unknown time zones but requires your
         * RTC not to be off by more than 15 minutes
         */
        real_seconds = nowtime % 60;
        real_minutes = nowtime / 60;
        if (((abs(real_minutes - cmos_minutes) + 15)/30) & 1)
                real_minutes += 30;             /* correct for half hour time zone */
        real_minutes %= 60;

        if (abs(real_minutes - cmos_minutes) < 30) {
                if (!(save_control & RTC_DM_BINARY) || RTC_ALWAYS_BCD) {
                        BIN_TO_BCD(real_seconds);
                        BIN_TO_BCD(real_minutes);
                }
                CMOS_WRITE(real_seconds,RTC_SECONDS);
                CMOS_WRITE(real_minutes,RTC_MINUTES);
        } else
                retval = -1;

        /* The following flags have to be released exactly in this order,
         * otherwise the DS12887 (popular MC146818A clone with integrated
         * battery and quartz) will not reset the oscillator and will not
         * update precisely 500 ms later. You won't find this mentioned in
         * the Dallas Semiconductor data sheets, but who believes data
         * sheets anyway ...                           -- Markus Kuhn
         */
        CMOS_WRITE(save_control, RTC_CONTROL);
        CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);

        return retval;

}

/* last time the cmos clock got updated */
static long last_rtc_update = 0;

/*
 * timer_interrupt() needs to keep up the real-time clock,
 * as well as call the "do_timer()" routine every clocktick
 */
static inline void timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
{
        do_timer(regs);

        /*
         * If we have an externally synchronized Linux clock, then update
         * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
         * called as close as possible to 500 ms before the new
...

read more »

 
 
 

problems compiling kernel

Post by Robert Krawit » Fri, 03 Jul 1998 04:00:00



> hello i'm trying to compile kernel 2.0.25
> i have an ATX PC Pentium MMX-233 Mhz with 128 Mb SDRam (168 pins)
> well intel 430 TX chipset (ASUS TX97-XE MAinboard) ok
> when i'm in make zImage stage the compiler said :

> {Standard input}: Assembler messages:
> {Standard input}:768: Error: no such 386 instruction: 'rdmsr'
> {standard input}:770: Error: no such 386 instruction: 'wrmsr'
> make[1]: *** [time.o] Error 1
> make[1]1: Leaving directory '/usr/src/linux/arch/i386/kernel'
> make: *** [linuxsubdirs] Error 2

> all that in file time.c attached
> caan some one explain to me what is happenning,
> i'm running linux 1.2.13 now in my pc. and i've installed the sources of
> linux 2.0.25 and tryed to compile it...


You have an old version of gcc.  You need to upgrade to gcc 2.7.2.3 or
later.  This (along with the libraries you need) may be found at
ftp://sunsite.unc.edu/pub/Linux/GCC.  You want the following, I
believe:

release.libc-5.4.44 (instructions)
libc-5.4.44.bin.tar.gz

release.binutils-2.9.1.0.4 (instructions)
binutils-2.9.1.0.4-libc5.x886.tar.gz

ld.so-1.9.9.tar.gz

bzip2-libc5.gz

release.egcs-1.0.3 (instructions)
egcs-1.0.3-libc5.x86.tar.bz2

NOTE: egcs is a somewhat experimental compiler, although the C part is
fairly stable now.  If you want 2.7.2.3 (which is very stable,
although older), you'll have to find it somewhere.

--

Tall Clubs International  --  http://www.tall.org/ or 1-888-IM-TALL-2


 
 
 

1. Problems compiling Kernel

Can anybody help with this problem :

I installed Linux on a UmsDos partition on my EIDE drive. All was
well. Later, I got hold of a SCSI disk and a NCR 815 PCI controller
and reinstalled Linux on this. The Kernel recognises the controller,
disk etc etc and almost everything works fine...

The problem is, when I try and compile a Kernel on my SCSI disk
filesystem, I get "Fatal Error 11" from GCC. If I run the same
complile when I've booted onto the file system (the same as far as I
can tell) on my EIDE disk (I've still got Linux on both disks) it
works fine...

I've heard that this error message is associated with memory problems,
however that doesn't explain how it works on one drive and not the
other.I've tried diasbling my external cache on my motherboard to no
avail. I then tried disabling every option I could find in my BIOS
(host to PCI burst, etc etc) but still no joy...

Has anybody got any ideas how I can start to find out whats causing
this ?

TIA

Andy Campbell

2. Redhat 7.3 problem

3. problems compiling kernel 2.4.5 on Duron

4. Sound Problems.

5. Problems compiling Kernel with Cross-gcc for IBM 405

6. Buying a (Xi Graphics) Oxygen GVX1 X server worth it???

7. Problem compiling kernel 2.0 ...

8. Postgresql+php+mod_perl+apache

9. Problem compiling kernel 2.2.17

10. problems compiling kernel

11. Problem Compile Kernel 2.4.18 in Debian 3.0

12. Problems compiling kernel

13. problems compiling kernel