This week I worked on completing the build and sorting all complications imposed by it. As I talked in the last post, I was facing some issues regarding setting up smp for this port. I solved this issue by adding an assembly file which declared smp_processor_id and then defined it by setting the right registers. I had to do some background reading on arm64 details. This provided me with the information I needed.
Next up, was another hitch. During the build, ‘mmu_enable()’ and ‘arch_secondary_cpu_init()’ function calls are happening for all stages but the definitions for these functions are getting compiled only for ramstage. So this gave recurrent errors since the compiler couldn’t find these definitions. While attempting to sort this, I stumbled across something on the chromium tree. There was a patch which dealt with some of the issues, similar to mine. I had to cherry pick and apply this change.
After debugging and sorting through some more errors, I was finally able to get it to build successfully.
coreboot.rom: 4096 kB, bootblocksize 37008, romsize 4194304, offset 0x90c0 alignment: 64 bytes, architecture: arm64Name Offset Type Sizefallback/romstage 0x90c0 stage 12108fallback/ramstage 0xc080 stage 17768config 0x10640 raw 2034revision 0x10e80 raw 577(empty) 0x11100 null 4124312HOSTCC cbfstool/rmodtool.oHOSTCC cbfstool/rmodule.oHOSTCC cbfstool/rmodtool (link)
$qemu-system-aarch64 -machine type=virt -nographic -bios ~/coreboot/build/coreboot.rom