[meta-xilinx] SPL->ATF->Linux

Jean-Francois Dagenais jeff.dagenais at gmail.com
Thu Jun 20 03:38:29 PDT 2019


Hi Michal, all.

(My previous mail contained screenshots which did not make it to the list for all. Michal got it and responded however...)

> On Jun 20, 2019, at 04:17, Michal Simek <michal.simek at xilinx.com> wrote:
> 
> can you send your bif file?
> 

Sure, here:

the_ROM_image:
{
	 [bootloader,  destination_cpu=a53-0] /builds/yocto/mymachine/tmp/deploy/images/mymachine/fsbl-mymachine.elf
	 [destination_cpu=pmu] /builds/yocto/mymachine/tmp/deploy/images/mymachine/pmu-firmware-mymachine.elf
	 [destination_cpu=a53-0, exception_level=el-3, trustzone] /builds/yocto/mymachine/tmp/deploy/images/mymachine/arm-trusted-firmware.elf
	 [destination_cpu=a53-0, exception_level=el-2] /builds/yocto/mymachine/tmp/deploy/images/mymachine/linux-boot-simple.elf
	 [load=0xff2000] /builds/yocto/mymachine/tmp/deploy/images/mymachine/mymachine.dtb
	 [load=0x80000] /builds/yocto/mymachine/tmp/deploy/images/mymachine/Image
}

It is generated from xilinx-bootbin.bb, linux-boot-simple is the trampoline code you provided. 

       .section        .text
       .global         _start
_start:
       ldr      x17, kernel_start
       ldr      x0, kernel_dts
       mov      x1, xzr
       mov      x2, xzr
       mov      x3, xzr
       blr      x17
       .balign 8
kernel_start:
       .dword   __BOOT_LOAD_KERNEL_ADDRESS__
kernel_dts:
       .dword   __BOOT_LOAD_DTB_ADDRESS__

I have this in my layer as recipes-bsp/linux-boot-simple/files/linux-boot-simple.S, the two symbols at the end are replaced by the recipe I made (recipes-bsp/linux-boot-simple/linux-boot-simple.bb)
SUMMARY = "Simple Boot Loader for linux ARM Image file"
LICENSE = "GPLv2"

SRC_URI += "file://linux-boot-simple.s"

B = "${WORKDIR}/build"

PACKAGE_ARCH = "${MACHINE_ARCH}"

inherit xsct-tc

do_configure() {
        sed "s/__BOOT_LOAD_KERNEL_ADDRESS__/${BOOT_LOAD_KERNEL_ADDRESS}/" ${WORKDIR}/${PN}.s > ${B}/${PN}.s
        sed -i "s/__BOOT_LOAD_DTB_ADDRESS__/${BOOT_LOAD_DTB_ADDRESS}/" ${B}/${PN}.s
}

do_compile() {
        aarch64-none-elf-gcc -nostartfiles -nodefaultlibs -Wl,--build-id=none,-Ttext=${BOOT_LOAD_LINUX_BOOT_SIMPLE} ${PN}.s -o ${PN}.elf
}

do_install[noexec] = "1"

inherit deploy

do_deploy() {
        cp ${B}/linux-boot-simple.elf ${DEPLOYDIR}
}
addtask deploy before do_build after do_compile


And in my mymachine.conf:

...
BOOT_LOAD_DTB_ADDRESS = "0xff2000"
BOOT_LOAD_KERNEL_ADDRESS = "0x80000"
BOOT_LOAD_LINUX_BOOT_SIMPLE = "0x5F000"

# override the auto addition of fpga, and add dtb, kernel image and an ATF to linux trampoline to boot.bin:
BIF_PARTITION_ATTR_mymachine = "fsbl pmu atf linux-trampoline dtb kernel"

BIF_PARTITION_ATTR[linux-trampoline] = "destination_cpu=a53-0,exception_level=el-2"
BIF_PARTITION_IMAGE[linux-trampoline] = "${DEPLOY_DIR_IMAGE}/linux-boot-simple.elf"
BIF_PARTITION_DEPENDS[linux-trampoline] = "linux-boot-simple:do_deploy"

BIF_PARTITION_ATTR[dtb] := "load=${BOOT_LOAD_DTB_ADDRESS}"
BIF_PARTITION_IMAGE[dtb] = "${DEPLOY_DIR_IMAGE}/${MACHINE}.dtb"
BIF_PARTITION_DEPENDS[dtb] = "virtual/kernel:do_deploy"

BIF_PARTITION_ATTR[kernel] := "load=${BOOT_LOAD_KERNEL_ADDRESS}"
BIF_PARTITION_IMAGE[kernel] = "${DEPLOY_DIR_IMAGE}/Image"
BIF_PARTITION_DEPENDS[kernel] = "virtual/kernel:do_deploy"
...

The missing BIF_PARTITION entries come from meta-xilinx-tools/recipes-bsp/bootbin/machine-xilinx-zynqmp.inc


> On 19. 06. 19 22:27, Jean-Francois Dagenais wrote:
>> Hi Michal, guys,
>> 
>> Any ideas Michal? I have been debugging this for 4 days and it doesn't
>> look like I'm moving ahead much. You made it sound so simple but it is
>> not so simple apparently...
>> 
>> Since my last post below, I have hacked head.S to include
>> _inval_dcache_area so as to make the branch call nearer and it works.
>> (Which is weird in itself... but all I do now is stretching my
>> knowledge, so I'm having fun here!)
>> 
>> I am able to reach start_kernel from main.c. Then things start getting
>> weird...
>> 
>> Here's my debug boot log:
>> https://pastebin.com/QxA0AQfh
>> 
>> This is where things stop making sense...
>> 
>> I placed a few breakpoints in start_kernel after this line and I end up
>> stuck here:
>> 

So here were the screenshots of xsdk, anyone cares?

>> 
>> 
>> Please help guys!! Or should I direct to linaro or linux-arm mailing lists?
>> 
>> Here, "HELP" could just be a debugging technique I might use, a
>> configuration, a debug flag somewhere, etc.
>> 
>> Thanks all!

Thanks for your help Michal!



More information about the meta-xilinx mailing list