On 12/03/2019 15:21, berrie.schuurhuis@gmail.com wrote:
As a newbee in this space I got qemu-system-sparc[64] running on a linux machine.
Trying to find out how qemu and openbios work together I'm currently looking into building openbios-sparc64.
This goes with mixed success as https://www.openfirmware.info/OpenBIOS has nice description on how to build openbios, but there's a missing link as to how to harvest the openbios-sparc64 from this.
My build of openbios is done on an Ultra60(Sparc) machine that runs: Linux ultra60 4.19.0-2-sparc64 #1 Debian 4.19.16-1 (2019-01-17) sparc64 GNU/Linux
with gcc --version gcc (Debian 8.3.0-2) 8.3.0
It seems like the file openbios/obj-sparc64/openbios-builtin.elf may be the candidate to become openbios-sparc64??
When giving this a try, and moving openbios-builtin.elf to my x86 qemu machine, it crashes spectacularly with:
qemu: fatal: Trap 0x0064 while trap level (5) >= MAXTL (5), Error state pc: 0000000000004c80 npc: 0000000000004c84 %g0-3: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %g4-7: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %o0-3: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %o4-7: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %l0-3: 00000000fff001e0 000001ff00000000 000001fff0080000 0000000000000000 %l4-7: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %i0-3: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %i4-7: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %f00: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %f08: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %f16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %f24: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %f32: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %f40: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %f48: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 %f56: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 pstate: 00000414 ccr: 44 (icc: -Z-- xcc: -Z--) asi: 00 tl: 5 pil: 0 gl: 2 tbr: 0000000000000000 hpstate: 0000000000000000 htba: 0000000000000000 cansave: 6 canrestore: 0 otherwin: 0 wstate: 0 cleanwin: 6 cwp: 7 fsr: 0000000000000000 y: 0000000000000000 fprs: 0000000000000000
On x86: Booting qemu with the provided openbios-sparc64 rom works flawless.
On the Ultra60: Running ./openbios-unix openbios-sparc64.dict seems to behave as expected: Output device screen not found. Input device keyboard not found. Output device screen not found. Type 'help' for detailed information [unix] Booting default not supported. Trying disk... No valid state has been set by load or init-program 0 > help
To get openbios build, I had to make a small change in Makefile.target: #CFLAGS+= -Werror CFLAGS+= -Wno-error
To "fix": Building OpenBIOS for sparc64 Building... /usr/bin/xsltproc error: CC target/arch/unix/unix.o CC target/arch/unix/boot.o /sources/openbios/arch/unix/boot.c:101:6: error: redundant redeclaration of 'forth_fw_cfg_read_file' [-Werror=redundant-decls] void forth_fw_cfg_read_file(void); ^~~~~~~~~~~~~~~~~~~~~~ In file included from ./target/include/asm/io.h:8, from /sources/openbios/include/kernel/kernel.h:22, from /sources/openbios/include/libopenbios/bindings.h:21, from /sources/openbios/arch/unix/boot.c:6: /sources/openbios/include/arch/common/fw_cfg.h:104:6: note: previous declaration of 'forth_fw_cfg_read_file' was here void forth_fw_cfg_read_file(void); ^~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors
Any pointers or suggestions to continue this journey are appreciated.
Hi there,
Welcome to the project! When I build the release binaries for QEMU I cross-compile them on x86 using a custom-built gcc:
$ sparc64-elf-gcc -v Using built-in specs. COLLECT_GCC=sparc64-elf-gcc COLLECT_LTO_WRAPPER=/home/build/sparc-cross/libexec/gcc/sparc64-elf/7.3.0/lto-wrapper Target: sparc64-elf Configured with: ../gcc-7.3.0/configure --prefix=/home/build/sparc-cross --target=sparc64-elf --disable-libssp --disable-threads --enable-languages=c --enable-targets=all Thread model: single gcc version 7.3.0 (GCC)
and I build the sparc64 binary like this:
./config/scripts/switch-arch sparc64; make
I haven't upgraded my toolchain to gcc 8.0 yet, so there is the possibility that a bug has been introduced somewhere - are you able to test with gcc 7 at all?
The above warning is probably an issue with the include files, however it shouldn't produce an invalid executable. Does changing -Os to -O2 in Makefile.target help at all?
ATB,
Mark.