Date: Thu, 18 Oct 2001 14:04:39 -0700 From: Mark Peek <mark@peek.org> To: <freebsd-ppc@FreeBSD.ORG> Subject: PowerPC cross compiler/simulator Message-ID: <p05101000b7f4dd3217dd@[207.76.207.129]>
next in thread | raw e-mail | index | archive | help
I've had a PowerPC cross compiler port sitting around for a few months that failed to boot up a kernel on real hardware. Now that I have the simulator running, I pulled out the bits and figured out the problem (changes were needed to stdarg). Below are the instructions for cross compiling the PowerPC kernel on a FreeBSD system and running the kernel under PSIM. The PowerPC kernel still needs work so don't expect too much to happen except printing out the first few messages and then crashing. Note: these instructions are a little rough so feedback is good. If there is enough interest (hint: I get confirmation that it actually works for someone else), I can check the cross compiler ports into the ports tree. Mark ----------- Instructions for cross building and running the FreeBSD kernel: 1. Install the PSIM port from /usr/ports/emulators/psim-freebsd 2. Install the PowerPC cross-compiler. 2a. Download the "ports from here: <http://people.freebsd.org/~mp/psim/ppc-cross.tar.bz2> 2b. Unpack and build # mkdir /usr/ports/cross # cd /usr/ports/cross # tar xjf /path/to/ppc-cross.tar.bz2 # (cd powerpc-binutils; make; make install) # (cd powerpc-gcc295; make make install) Note: I used a new directory /usr/ports/cross but the ports can go into another ports directory (such as /usr/ports/devel) just as easily. 3. On a FreeBSD system, check out a new source tree and run: # cd src/sys/powerpc/conf # config -g GENERIC # cd ../compile/GENERIC # make MACHINE_ARCH=powerpc CC=powerpc-gcc LD=powerpc-ld NM=powerpc-nm \ SIZE=powerpc-size OBJCOPY=powerpc-objcopy 4. On the FreeBSD system, grab /usr/src/release/write_mfs_in_kernel.c and run it using <http://people.freebsd.org/~mp/psim/ppcdisk.bz2> to add the md image: # ./write_mfs_in_kernel kernel.debug ppcdisk 5. Run the simulator. The following .gdbinit is available as /usr/local/share/examples/psim-freebsd/dot.gdbinit: display/i $pc define pglobal print *(struct globaldata *)$sprg0 end target sim -e chirp -r 33554432 set architecture powerpc:604 load # psim-freebsd kernel.debug GNU gdb 20011012 (MI_OUT) Copyright 2001 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "--host=i386--freebsd5.0 --target=powerpc-unknown-elf"... Connected to the simulator. The target architecture is assumed to be powerpc:604 chirp: note descriptor missing load-base (gdb) b cpu_switch Breakpoint 1 at 0x1d8d58 (gdb) run Starting program: /usr/vsrc/sys/powerpc/compile/GENERIC/kernel.debug Copyright (c) 1992-2001 The FreeBSD Project. Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994 The Regents of the University of California. All rights reserved. FreeBSD 5.0-CURRENT #0: Fri Oct 12 12:47:40 PDT 2001 root@netppc:/mnt/vsrc/sys/powerpc/compile/GENERIC CPU: PowerPC Version 0 (Revision 0) real memory = 33554432 (32768K bytes) avail memory = 29794304 (29096K bytes) Timecounter "powerpc" frequency 16666666 Hz rn_init: radix functions require max_keylen be set Mounting root from ufs:/dev/md0c Breakpoint 1, 0x001d8d58 in cpu_switch () 1: x/i $pc 0x1d8d58 <cpu_switch+24>: mfsprg r3,0 (gdb) where #0 0x001d8d58 in cpu_switch () #1 0x0014baa4 in mi_switch () at ../../../kern/kern_synch.c:765 #2 0x0014af0c in msleep (ident=0x308cf8, mtx=0x0, priority=68, wmesg=0x1e27f8 "sched", timo=1000) at ../../../kern/kern_synch.c:484 #3 0x001c0e58 in scheduler (dummy=0xcda) at ../../../vm/vm_glue.c:439 #4 0x0011d720 in mi_startup () at ../../../kern/init_main.c:209 #5 0x00114880 in kernel_text () (gdb) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ppc" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p05101000b7f4dd3217dd>