This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM62A7: How to generate bl31.bin.unsigned from bl31.bin

Part Number: AM62A7


Hi,


I'm using AM62AX Linux SDK 8.06. In the SDK, I can see bl31.bin and bl31.bin.unsigned (Both are different in size) in linux SDK prebuilts folder. I am trying to build the bl31.bin from source code from the SDK Documentation. After buliding when I used along with MCU+SDK to make the linux.appimage and boot, I see crash after the bl31.bin start. attching the crash:

NOTICE:  BL31: v2.9(release):v2.9.0-230-ge09b8aa5a
NOTICE:  BL31: Built : 13:01:11, Jun 26 2023
Unhandled Exception in EL3.
x30            = 0x000000009e785f38
x0             = 0x0000000000000001
x1             = 0x000000009e78a010
x2             = 0x000000009e78a000
x3             = 0x000000009e78a050
x4             = 0x0000000032401000
x5             = 0x0000000000000040
x6             = 0x000000009e79c05e
x7             = 0x0000000000000000
x8             = 0x000000009e79ffff
x9             = 0x000000009e791c18
x10            = 0x0000000032c80000
x11            = 0x0000000000000000
x12            = 0xc106d9cab44b476f
x13            = 0x41908e190655e149
x14            = 0xf74169d10011621f
x15            = 0xa6666e059bc9bb3d
x16            = 0x7bb3c0be386bbe4c
x17            = 0x000000009e780674
x18            = 0x0000000000000004
x19            = 0x000000009e789236
x20            = 0x000000009e78b3b0
x21            = 0x000000009e79c000
x22            = 0xb763c4785d91132b
x23            = 0xf0a298c8151068c1
x24            = 0x084089003f271cf4
x25            = 0x10e691f4354f1ef7
x26            = 0x40008040fed22810
x27            = 0x946aef0a83315b63
x28            = 0xcf37f8e419e22bc9
x29            = 0x000000009e78b330
scr_el3        = 0x0000000000000238
sctlr_el3      = 0x0000000030cd183f
cptr_el3       = 0x0000000000000000
tcr_el3        = 0x0000000080803520
daif           = 0x00000000000003c0
mair_el3       = 0x00000000004404ff
spsr_el3       = 0x00000000600002cc
elr_el3        = 0x000000009e782e0c
ttbr0_el3      = 0x000000009e791d40
esr_el3        = 0x0000000096000010        
far_el3        = 0x0000000032401000        
spsr_el1       = 0x0000000002312304        
elr_el1        = 0x4f1746233cb8ebbd        
spsr_abt       = 0x000000000a104d10
spsr_und       = 0x0000000036101301
spsr_irq       = 0x0000000006152001
spsr_fiq       = 0x0000000006000308
sctlr_el1      = 0x0000000000c50838
actlr_el1      = 0x0000000000000000
cpacr_el1      = 0x0000000000000000
csselr_el1     = 0x0000000000000000
sp_el1         = 0x200c0cbf31caa9e2
esr_el1        = 0x00000000d9821980
ttbr0_el1      = 0x0904484802cc0060
ttbr1_el1      = 0x8841004022930040
mair_el1       = 0x44e048e000098aa4
amair_el1      = 0x0000000000000000
tcr_el1        = 0x0000000000000000
tpidr_el1      = 0x4240a00000045282
tpidr_el0      = 0x0108108100004026
tpidrro_el0    = 0x400030008114411c
par_el1        = 0x0000002010281008
mpidr_el1      = 0x0000000080000000
afsr0_el1      = 0x0000000000000000
afsr1_el1      = 0x0000000000000000
contextidr_el1 = 0x0000000000000000
vbar_el1       = 0x0000000000000000
cntp_ctl_el0   = 0x0000000000000002
cntp_cval_el0  = 0x86410004d105103f
cntv_ctl_el0   = 0x0000000000000000
cntv_cval_el0  = 0x5f6dada8b9cc4590
cntkctl_el1    = 0x0000000000000000
sp_el0         = 0x000000009e78b330
isr_el1        = 0x0000000000000000
dacr32_el2     = 0x0000000040114069
ifsr32_el2     = 0x0000000000000227
cpuectlr_el1   = 0x0000000000000040
cpumerrsr_el1  = 0x0000000018000280
l2merrsr_el1   = 0x0000000010101760
cpuactlr_el1   = 0x00001000090ca000

The path for the bl31.bin source code git as per the wiki page : software-dl.ti.com/.../Foundational_Components_ATF.html

MCU+SDK uses bl31.bin.unsigned from the linux prebuilts folder to make linux.apimage. When  bl31.bin from the source, I see the size of bl31.bin generated match the linux prebuilts bl31.bin, but not the bl31.bin.unsigned 

1) How can I generate bl31.bin.unsigned from bl31.bin, there seems to be size difference of 148 bytes ?

2) What is the difference between bl31.bin and bl31.bin.unsigned?

  • Hello ,

    Let's start from the ATF source code.

    • The build of the ATF source code generates the unsigned ATF binary (bl31.bin) only. The signing of the binary for HS boards is done after the build. So, the bl31.bin binary generated from ATF source code build is indeed an unsigned binary which can be directly used with MCU+ SDK to generate Linux Appimage.
    • For the PSDK prebuilt images folder, you can say the unsigned ATF binary (bl31.bin) from the ATF source code build is copied & renamed to bl31.bin.unsigned for GP boards. For HS boards, the same unsigned ATF binary (bl31.bin) is signed and named bl31.bin only.

    I understand the naming of the binaries may be creating a confusion here. So, the following table captures the above in a more understandable way.

    Signed Binary Name Unsigned Binary Name
    ATF Source Code Build The build alone does not generate the signed binary. bl31.bin
    PSDK Prebuilt Images bl31.bin bl31.bin.unsigned

    Now coming to the issue, you do not need to do any extra steps besides the ATF source code build and directly using the generated ATF unsigned binary (bl31.bin) to generate Linux Appimage. And if we see the logs, the ATF binary is indeed booting as the logs you shared actually contains logs from the ATF. So, I think the problem is not with the ATF binary.

    To find the cause, could you please share the binaries you have used to generate the Linux Appimage.

    Thanks!


  • Hi,
    2308.bl31.zip

    I have attached the bl31.bin that i built. Can you please share yours.

    regards,
    Rohith Thanaraj.

  • Hi Rohit,

    Thank you for sharing the binary!

    Actually I can recreate the issue on my end and on checking internally, it seems this was a documentation error. The command that should be used to build ATF source code is:

    $ make CROSS_COMPILE=aarch64-none-linux-gnu- PLAT=k3 TARGET_BOARD=lite SPD=opteed

    The command in documentation was instead using TARGET_BOARD=generic.

    Could you please retry the steps with the above command. After the successful build, you can directly use the genrated ATF binary (bl31.bin) to generate Linux Appimage.

    Let me know if it works!

    Regards,

    Prashant

  • Hi Prashant,

    Thank you for the solution. It is working fine now.

    Regards,
    Rohith Thanaraj.