Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Dec 2001 19:01:51 -0800
From:      Jamey Wood <Jamey.Wood@Sun.COM>
To:        freebsd-sparc@freebsd.org
Subject:   compiling a sparc64 kernel?
Message-ID:  <1483c13c42.13c421483c@smi.sun.com>

next in thread | raw e-mail | index | archive | help
I've been trying for a few days to build the sparc64 kernel,
but kept running into compiler errors (detailed notes below).
I put in some hacks to get everything to compile, but the resulting 
kernel doesn't look to get as far into a boot as the binary version I 
downloaded per tmm's sparc64 README.  Note that I've got an Ultra 1
(so I understand the boot won't get very far because of no sbus
support, which is where I'm hoping I might be able to help the port).

For me, tmm's kernel results in:

  /kernel data=0x202fb8+0xdfdc0 syms=[0x8+0x36210+0x8+0x2887c]
  Hit [Enter] to boot immediately, or any other key for command prompt.
  Booting [/kernel]...
  calling autoload
  nothing to autoload yet.
  post autoload
  jumping to kernel entry at 0xc0030000.
  sparc64_init: mdp=0xc0344000 kmdp=0xc0344000 boothowto=0
    envp=0xc0342000 end=0x0
  panic: trap_dmmu_miss: vmspace NULL
  Debugger("panic")
  Stopped at      0xc018479c:     ta              %xcc, 1

And my custom-compiled version (with the potentially bogus hacks
I explain in detail below) gets:

  /kernel data=0x134ab8+0x4d2b8 syms=[0x8+0x255c0+0x8+0x1b653]
  Hit [Enter] to boot immediately, or any other key for command prompt.
  Booting [/kernel]...
  calling autoload
  nothing to autoload yet.
  post autoload
  jumping to kernel entry at 0xc0028000.

  RED State Exception

  TL=0000.0000.0000.0005 TT=0000.0000.0000.0080
  TPC=0000.0000.c002.4200 TnPC=0000.0000.c002.4204   
  TSTATE=0000.0099.5800.1506
  TL=0000.0000.0000.0004 TT=0000.0000.0000.0010
  TPC=0000.0000.c002.4d50 TnPC=0000.0000.c002.4d54 
  TSTATE=0000.0099.5804.1406
  TL=0000.0000.0000.0003 TT=0000.0000.0000.0068
  TPC=0000.0000.c002.82a8 TnPC=0000.0000.c002.82ac 
  TSTATE=0000.0099.5800.1506
  TL=0000.0000.0000.0002 TT=0000.0000.0000.0034
  TPC=0000.0000.c00e.3dac TnPC=0000.0000.c00e.3db0 
  TSTATE=0000.0099.5800.1605
  TL=0000.0000.0000.0001 TT=0000.0000.0000.004e
  TPC=000

  <note that this one never gets to the sparc64_init: printf>

I'm trying to compile from a 5.0-current system (updated buildworld 
from yesterday), using tmm's toolchain.

I'm just looking for an understanding of how to cleanly compile a 
kernel that'll get as far into the boot as the tmm version.  Thanks in 
advance for any help.

--Jamey


*** Detailed info on compiler errors and my hacks to get around them

  /usr/local/bin/sparc64-elf-gcc -D__sparc64__ -D__FreeBSD__=5 -c -O 
  -pipe  -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes
  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -ansi -g
  -nostdinc -I-  -I. -I../../.. -I../../../dev 
  -I../../../contrib/dev/acpica -I../../../contrib/ipfilter
  -I ../../../../include  -D_KERNEL -ffreestanding
  -include opt_global.h    ../../../sparc64/sparc64/machdep.c
  ../../../sparc64/sparc64/machdep.c: In function `sparc64_init':
  ../../../sparc64/sparc64/machdep.c:223: `MODINFOMD_HOWTO' undeclared
  (first use in this function)
  ../../../sparc64/sparc64/machdep.c:223: (Each undeclared identifier 
  is reported only once
  ../../../sparc64/sparc64/machdep.c:223: for each function it appears 
  in.)
  ../../../sparc64/sparc64/machdep.c:224: `MODINFOMD_ENVP' undeclared
  (first use in this function)
  ../../../sparc64/sparc64/machdep.c:225: `MODINFOMD_KERNEND' 
  undeclared (first use in this function)
  ../../../sparc64/sparc64/machdep.c: In function `Debugger':
  ../../../sparc64/sparc64/machdep.c:642: void value not ignored as
  it ought to be ../../../sparc64/sparc64/machdep.c:644: too many 
  arguments to function `critical_exit'
  *** Error code 1

  Stop in /usr/src/sys/sparc64/compile/sparc64.

I've tried hacking whatever seems obvious (defining the MODINFOMD_*
constants, and changing the critical_exit calls in machdep.c and
tick.c to have no arguments).  That gets me a little further, but
it then dies on:

  /usr/local/bin/sparc64-elf-gcc -D__sparc64__ -D__FreeBSD__=5 -c -O
  -pipe  -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes
  -Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -ansi -g
  -nostdinc -I-  -I. -I../../.. -I../../../dev 
  -I../../../contrib/dev/acpica -I../../../contrib/ipfilter
  -I../../../../include  -D_KERNEL -ffreestanding -include
  opt_global.h    vers.c
  linking kernel.debug
  db_disasm.o: In function `db_disasm':
  db_disasm.o(.text+0x464): undefined reference to `abs'
  db_disasm.o(.text+0x668): undefined reference to `abs'

So I've tried hacking that one by defining my own abs() function in
db_disasm.  That does get everything to finally compile and link:

  linking kernel.debug
  text    data     bss     dec     hex filename
  985789  247584  316080 1549453  17a48d kernel.debug
  /usr/local/bin/sparc64-elf-objcopy --strip-debug kernel.debug kernel

But, as I noted earlier, this kernel doesn't get very far into a boot 
at all, and I'm worried about the hacks I used to get this far.  Is the
-current tree just temporarily in a state that doesn't compile cleanly?
Or am I doing something fundamentally wrong?


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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1483c13c42.13c421483c>