Hi, Experts,
I have some questions related to optee on i.mx, please help, thanks!
Question 1. For imx6, I saw this: How to use OP-TEE with Freescale i.MX6Q SDB? | りかぶ
When it trans tee.bin to uTee, it used next:
$ mkimage -A arm -O linux -C none -a 0x4dffffe4 -e 0x4e000000 -d tee.bin uTee
I wonder how we could get "0x4e000000" here? And why "0x4dffffe4" is just 28 bytes less than "0x4e000000"? Any guide I could reference? If I switch to other imx6/7 platform, what's the value could be?
Question 2. Usually, I could use next to download optee in uboot:
tftp 0x12000000 zImage : – zImage will be loaded to 0x12000000
tftp 0x20000000 uTee :- uTee will be loaded to 0x20000000
The uTee could finally find zImage at 0x12000000 just because next? Where we specifiy 0x12000000 when build tee.bin?
$ CROSS_COMPILE=arm-linux-gnueabihf- make PLATFORM=imx-mx6qsabresd
ARCH=arm CFG_BUILT_IN_ARGS=y CFG_PAGEABLE_ADDR=0 \
CFG_NS_ENTRY_ADDR=0x12000000 CFG_DT_ADDR=0x18000000
But strangely, when I use "tftp 0x13000000 zImage", it also could boot, why?
Question 3. For imx8, I didn't see something like next, where optee now in imx8? It include in image or anything else?
tftp 0x20000000 uTee :- uTee will be loaded to 0x20000000
I'm new to optee & i.mx platform, please give me some guide, thanks.
Along with igorpadykov's comment, please find my answers as below to your questions.
Question 1. For imx6, I saw this: How to use OP-TEE with Freescale i.MX6Q SDB? | りかぶ
When it trans tee.bin to uTee, it used next:
$ mkimage -A arm -O linux -C none -a 0x4dffffe4 -e 0x4e000000 -d tee.bin uTee
I wonder how we could get "0x4e000000" here? And why "0x4dffffe4" is just 28 bytes less than "0x4e000000"? Any guide I could reference? If I switch to other imx6/7 platform, what's the value could be?
Answer: Here the entry point address will always be ${load_addr} + sizeof(struct optee_header). [Note: sizeof(struct optee_header will be 28 bytes]. So that's why the load address is just 28 bytes less than the entry point address. This will be the same for all platforms of i.MX6/7.
Question 2. Usually, I could use next to download optee in uboot:
tftp 0x12000000 zImage : – zImage will be loaded to 0x12000000
tftp 0x20000000 uTee :- uTee will be loaded to 0x20000000
The uTee could finally find zImage at 0x12000000 just because next? Where we specifiy 0x12000000 when build tee.bin?
$ CROSS_COMPILE=arm-linux-gnueabihf- make PLATFORM=imx-mx6qsabresd
ARCH=arm CFG_BUILT_IN_ARGS=y CFG_PAGEABLE_ADDR=0 \
CFG_NS_ENTRY_ADDR=0x12000000 CFG_DT_ADDR=0x18000000
But strangely, when I use "tftp 0x13000000 zImage", it also could boot, why?
Answer:
The uTee could finally find zImage at 0x12000000 just because next? Where we specifiy 0x12000000 when build tee.bin?
No, uTee finds the zImage at 0x12000000 because we are specifying this address in CFG_NS_ENTRY_ADDR config macro while we build the tee.bin binary.
But strangely, when I use "tftp 0x13000000 zImage", it also could boot, why?
No, it will not boot. I have tried practically and it is not booting with 0x13000000 address. So the reason I suspect is we are providing 0x12000000 address in CFG_NS_ENTRY_ADDR while compiling tee.bin.
Question 3. For imx8, I didn't see something like next, where optee now in imx8? It include in image or anything else?
tftp 0x20000000 uTee :- uTee will be loaded to 0x20000000
Answer: i.MX8 booting flow is different than the booting flow of i.MX6/7. In i.MX8, ROM Code will load the uTee binary that's why it is not required to load it using TFTP. The booting flow of i.MX8 is given in the i.MX_Porting_Guide.pdf shared by igorpadykov.
Hope my comment answers your questions.
Let me know in case of any concerns.
Regards,
Shivani
Hi, Shivani,
Thanks very much for your response.
Still left one question: mkimage -A arm -O linux -C none -a 0x4dffffe4 -e 0x4e000000 -d tee.bin uTee
Your answer made me know the relationship between 0x4dffffe4 and 0x4e000000, but I still don't know the relationship of 0x4dffffe4 and 0x20000000, I also see a related question here: How to set the entry point address of optee image running , but that answer really too abstract.
Could you kindly explain the relation ship between 0x4dffffe4 and 0x20000000? THanks!
Hi Cnspring
for optee usage one can look at Chapter 5 Configuring Optee
Porting Guide in Linux 5.4.3_1.0.0 Documentation
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------