Reading this forum:
https://forum.kernelnewbies.org/read.php?18,118113,118113#msg-118113
And to requote the problem here:
Hi everyone!
I got lucky and got an embedded linux internship
I’m trying to port linux to an existing board that is currently using vxWorks.
The board uses an mpc8572e processor which contains two e500v2 cores. Basically, the entry point in vmlinux
is arch/powerpc/kernel/head_fsl_booke.SWe are using the simpleboot bootwrapper which works just fine (simpleboot passes the device tree address and jump right into the gunziped vmlinux which is located at 0x0 physical).
head_fsl_booke.S include arch/powerpc/kernel/fsl_booke_entry_mapping.S and we just crash at line 223 (rfi instruction)
of fsl_booke_entry_mapping.S215 lis r7,MSR_KERNEL@h
216 ori r7,r7,MSR_KERNEL@l
217 bl 1f /* Find our address */
218 1: mflr r9
219 rlwimi r6,r9,0,20,31
220 addi r6,r6,(2f – 1b)
221 mtspr SPRN_SRR0,r6
222 mtspr SPRN_SRR1,r7
223 rfi /* start execution out of TLB1[0] entry */rfi at line 223 causes us to jump to 0xc000_0264 while we want to jump to 0x000_0264.
This is not caused by our mmu, we are basically loading 0xc000_0264 in srr0It’s related to the following config fields in our defconfig:
CONFIG_PAGE_OFFSET=0xc0000000 <—-
CONFIG_PHYSICAL_START=0x00000000
CONFIG_PHYSICAL_ALIGN=0x04000000
CONFIG_TASK_SIZE=0xc0000000
CONFIG_KERNEL_START=0xc00000000 <—–I tried to set CONFIG_KERNEL_START and CONFIG_PAGE_OFFSET to 0x0 but this would not compile:
arch/powerpc/include/asm/processor.h:100:2: error: #error User TASK_SIZE overlaps with KERNEL_START addressBy the way CONFIG_TASK_SIZE=0xc0000000
Also, my debugger cannot map anything because all the symbols in vmlinux are at 0xcxxx_xxxx but we are at 0x0xxx_xxxx
Pretty much all the ports that uses the simpleboot bootwrapper are gunzipping vmlinux at 0x0 but I can easily change that
and I tried to send vmlinux at 0xc000_0000 and it solved this particular issue but then the mmu mapping just does not work
because simpleboot extract our device tree at about 0x0011_0000 and we need vmlinux and the device tree to be inside a 64Mb page (also tried to hack fsl_booke_entry_mapping.S to create a 4GB tlb entry based at 0x0 and this was causing other issues…)Got any idea?
The details I cannot help. But my suggested steps of action are as follows:
First is to get the cross-compiler for e500v2 (ppc):
https://www.nxp.com/docs/en/supporting-information/WBNR_FTF10_NET_F0676.pdf
http://zeromq.org/build:powerpc
https://community.nxp.com/thread/310153
Next is to compile uboot for the board:
https://github.com/theopolis/u-boot-sboot
which is support board itself (mpc8572e). Next is the emulator, but not sure if it works? (though it indicated support for mpc8572e)