[coreboot] Porting romstage to 64 bit

Nico Heijningen tha_tux at hotmail.com
Fri Nov 11 13:20:22 CET 2016


Hi, all

Based on work of Scott Duplichan [1] and the patches of Stefan Reinauer [2] I try to get the romstage of Coreboot compiled and working as 64 bit. I tried doing so by:

Setting select ARCH_ROMSTAGE_X86_64 in the Kconfig of my CPU. 

Then the x86_64-elf-gcc compiler tells me  "error: CPU you selected does not support x86-64 instruction set" So I change the .xcompile file from GCC_CFLAGS_x86_64 += -march=i686 to GCC_CFLAGS_x86_64 += -march=x86_64.

After doing that I run into the "error: cast to pointer from integer of different size" which I fix by using (uintptr_t) casts. Together with adding .code32 to src/arch/x86/walkcbfs.S and changing the condition of the LD_ramstage flag in src/arch/x86/Makefile.inc from CONFIG_ARCH_ROMSTAGE_X86_32 to CONFIG_ARCH_RAMSTAGE_X86_32 (is this a bug or intentional; altering the ramstage linker flags based on the compilation architecture of the romstage?)



However, then I run into the following error: "E: ELF is unsupported arch: 62" originating from util/cbfstool/rmodule.c. Apparently the cbfstool doesn't support relocation for 64 bit ELF files? Should I try to add this or am I making another obvious mistake? Can I disable relocation, I have more than enough room on my flashchip?


Finally, I cannot find the man pages of the elf gcc compiler for selecting the correct --architecture --march and --oformat, where should I look?



Regards, 
Thatux

[1] https://www.coreboot.org/pipermail/coreboot/2015-January/079135.html
[2] https://www.coreboot.org/pipermail/coreboot-gerrit/2015-June/027849.html


More information about the coreboot mailing list