Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Aug 2001 00:12:37 +0200
From:      Wilko Bulte <wkb@freebie.xs4all.nl>
To:        Mike Smith <msmith@FreeBSD.ORG>
Cc:        Andrew Gallatin <gallatin@cs.duke.edu>, freebsd-alpha@FreeBSD.ORG
Subject:   Re: AlphaServer 4100 boot/install problem
Message-ID:  <20010815001237.B41154@freebie.xs4all.nl>
In-Reply-To: <20010813192638.A36352@freebie.xs4all.nl>; from wkb@freebie.xs4all.nl on Mon, Aug 13, 2001 at 07:26:38PM %2B0200
References:  <20010813081521.A34999@freebie.xs4all.nl> <200108130623.f7D6Ns203390@mass.dis.org> <20010813192638.A36352@freebie.xs4all.nl>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Aug 13, 2001 at 07:26:38PM +0200, Wilko Bulte wrote:
> On Sun, Aug 12, 2001 at 11:23:54PM -0700, Mike Smith wrote:
> > > > Please, try using 'more' in the loader to read a large (>8k) text 
> > > > document from somewhere; one of the loader's 4th files would do it.  Make 
> > > > sure it looks right.
> > > 
> > > OK, I tried:
> > > 
> > > 'more' on src/checksum.md5 
> > > 
> > > I don't see any anomalies in the display of more.
> > 
> > Ok.  Next step, put some diagnostics in 
> > sys/boot/common/load_elf.c:elf_loadfile(), every place that it returns
> 
> Is this the correct function? I don't seem to have it. Might it be you
> mean:
> 
> /* 
>  * Attempt to load the file (file) as an ELF module.  It will be stored at
>  * (dest), and a pointer to a module structure describing the loaded object
>  * will be saved in (result).
>  */
> int
> elf_loadmodule(char *filename, vm_offset_t dest, struct loaded_module
> **result)


In the meantime I ran a number of new experiments:

- boot from floppy, using the same 'make release' as for the CD: Just
  Works

- take the 4.3R cdboot and stick that on the CD instead of the one
  which was 'make released' out of 4.4-PRERELEASE source. This does not 
  work as in:

  FreeBSD/alpha SRM CD9660 boot, Revision 0.1
  (jkh@beast.freebsd.org, Mon Mar 20 21:08:56 GMT 2000)
  Memory: 65536 k
  > echo \007\007

  > autoboot 10
  Hit [Enter] to boot immediately, or any other key for command prompt.
  Booting [kernel]...               
  can't load 'kernel'
  autoboot: no bootable kernel
  |

  Type '?' for a list of commands, 'help' for more detailed help.

  This experiment I ran because the only thing Matt MFC-ed was the
  multiple prom-open in cdboot. I was somehow expecting a cdboot dependency.
  It seems that assumption was false.

So.. it looks like we can safely assume it is the loader alright. But only
when started from CD/cdboot. I have put printf()s in elf_loadmodule like:

    /*
     * Open the image, read and validate the ELF header
     */
    if (filename == NULL)       /* can't handle nameless */
        { printf ("elf_loadmodule: filename\n");
        return(EFTYPE); }
    printf ("elf_loadmodule: filename= %s\n",filename);

    if ((fd = open(filename, O_RDONLY)) == -1)
        { printf ("elf_loadmodule: cannot open\n");
        return(errno); }
    firstpage = malloc(PAGE_SIZE);
    if (firstpage == NULL)   
        { printf ("elf_loadmodule: malloc\n");
        return(ENOMEM); }
    firstlen = read(fd, firstpage, PAGE_SIZE);
    if (firstlen <= sizeof(ehdr)) {
        printf ("elf_loadmodule: readlen\n");
        err = EFTYPE;           /* could be EIO, but may be small file */
        goto oerr;
    }
 /* Is it ELF? */
    if (!IS_ELF(*ehdr)) {
        printf ("elf_loadmodule: iself\n");
        err = EFTYPE;
        goto oerr;
    }
    if (ehdr->e_ident[EI_CLASS] != ELF_TARG_CLASS ||    /* Layout ? */
        ehdr->e_ident[EI_DATA] != ELF_TARG_DATA ||
        ehdr->e_ident[EI_VERSION] != EV_CURRENT ||      /* Version ? */
        ehdr->e_version != EV_CURRENT ||
        ehdr->e_machine != ELF_TARG_MACH) {             /* Machine ? */
        printf ("elf_loadmodule: eftype1\n");
        err = EFTYPE;
        goto oerr;
    }

 /*
     * Check to see what sort of module we are.
     */
    kmp = mod_findmodule(NULL, NULL);
    if (ehdr->e_type == ET_DYN) {
        /* Looks like a kld module */
        if (kmp == NULL) {
            printf("elf_loadmodule: can't load module before kernel\n");
            err = EPERM;
            goto oerr;
        }
        if (strcmp(elf_kerneltype, kmp->m_type)) {
            printf("elf_loadmodule: can't load module with kernel type
'%s'\n",
kmp->m_type);
            err = EPERM;
            goto oerr;
        }
        /* Looks OK, got ahead */
        kernel = 0;

        /* Page-align the load address */
        pad = (u_int)dest & PAGE_MASK;
        if (pad != 0) {
         dest += pad;
        }
    } else if (ehdr->e_type == ET_EXEC) {
        /* Looks like a kernel */
        if (kmp != NULL) {
            printf("elf_loadmodule: kernel already loaded\n");
            err = EPERM;
            goto oerr;
        }
        /*
         * Calculate destination address based on kernel entrypoint
         */
        dest = (vm_offset_t) ehdr->e_entry;
        if (dest == 0) {
            printf("elf_loadmodule: not a kernel (maybe static binary?)\n");
            err = EPERM;
            goto oerr;
        }
        kernel = 1;

    } else {

<etc>

But it does not seem to trigger a printf.

So.. where to go from here?  Suggestions welcomed.

-- 
|   / o / /  _   	Arnhem, The Netherlands    	email: wilko@FreeBSD.org
|/|/ / / /( (_) Bulte	

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010815001237.B41154>