Compiling Kernel Modules for Genode on iMX53 with TrustZone

Stefan Kalkowski stefan.kalkowski at ...1...
Tue Nov 7 15:15:44 CET 2017


Hello Mauricio,

On 11/07/2017 06:22 AM, Mauricio Gutierrez Barnett wrote:
> Hello Stefan, 
> 
> Thank you for clearing that up. However, I have been trying to compile
> the kernel and I am getting a lot of warnings and errors. 
> That is, I am trying to cross compile the linux kernel for the tz_vmm
> for the imx53 on my VM runninng Ubuntu 16.04.
> I made sure to read the Changes in the documentation folder and have the
> required verisons of GNU, make, perl and perl modules as specified. 
> I have also been looking around on the Mailing List and there is a link
> floating around to a guide for compiling the kernel for the tz_vmm
> scenario but when I click it it tells me the page no longer exists. 
> That being said I do need to build the kernel to get the Module.symvers
> file among others. I have tried using both the imx5_defconfig and
> imx5_android_tz_defconfig but when I try to make I keep getting an error:
> 
> "Target processor does not support smc #0"
> 
> The commands I run look like this:
> make ARCH=arm
> CROSS_COMPILE=~/Documents/Genode/gcc-linaro-arm-none-eabi-4.9-2014.09_linux/bin/arm-none-eabi-
> distclean
> 
> make ARCH=arm
> CROSS_COMPILE=~/Documents/Genode/gcc-linaro-arm-none-eabi-4.9-2014.09_linux/bin/arm-none-eabi-
> imx5_defconfig
> 
> make ARCH=arm
> CROSS_COMPILE=~/Documents/Genode/gcc-linaro-arm-none-eabi-4.9-2014.09_linux/bin/arm-none-eabi- 
> 
> Where the cross compiler is from the Genode toolchain.

It does not look like the compiler from the Genode toolchain, which
won't work to compile this ancient Linux Kernel anyway.
When looking at the output of the pre-compiled Linux Kernel, I have
compiled it with:

  (gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203)

at that time. So it is known to compile therewith. Alternatively, you
might use another more recent CodeSourcery compiler or play with the
CFLAGS (e.g., -march flag), or if nothing helps you'll have to replace
"smc 0" with the right instruction encoding.

Using the "imx5_android_tz_defconfig" is correct as long as you want to
run Linux as "Genode guest".

> 
> I recently ran into the thread "Building Genode for Linux/ARM" [1]  and
> there it says that the linux platforms do not support cross-compiling,
> but I think what they are doing is different? Otherwise, is this still
> true? If so, if I want to compile the kernel myself would I have to go
> through the process they did using qemu?

The referenced thread has nothing to do with your trouble. It is about
cross compiling Genode/Linux for ARM. You are approaching to run Genode
on top of our own kernel implementation and not on top of Linux.

> I am new to this so sorry if these questions are not the best or missing
> information.
> Any help would be appreciated.

You are welcome,
Regards
Stefan

> 
> [1] https://sourceforge.net/p/genode/mailman/message/34123311/
> <https://sourceforge.net/p/genode/mailman/message/34123311/> 
> Thank you, 
> 
> Mauricio
> 
> On Wed, Oct 25, 2017 at 6:04 AM, Stefan Kalkowski
> <stefan.kalkowski at ...1...
> <mailto:stefan.kalkowski at ...1...>> wrote:
> 
>     Hi Mauricio,
> 
>     On 10/25/2017 12:39 AM, Mauricio Gutierrez Barnett wrote:
>     > Hello, 
>     >
>     > I have a question about adding kernel modules to the Genode OS. 
>     >
>     > So I have built and boot the tz_vmm scenario for platform
>     > hw_imx53_qsb_tz on the i.MX53 development board using another thread on
>     > this mailing list as a guide. I was able to get it up and running on the
>     > board with no problems. 
>     > However, I need to install a kernel module into the normal world linux.
>     > In order to do this I need to be able to cross compile the module for
>     > the target kernel running in normal world from my desktop.
>     > However, while I have access to the target compiler I do not have a
>     > target kernel directory. 
>     > That is, only the final image of linux is provided, not the source code
>     > used to compile it.
> 
>     it is available. I referred to it several times on this mailing list.
>     The Linux kernel used within the tz_vmm.run test script was built using
>     the following Linux kernel branch, which is slightly modified to not
>     crash within the normal world based on the official sources provided by
>     Freescale:
> 
>       https://github.com/skalk/linux/tree/imx53-tz
>     <https://github.com/skalk/linux/tree/imx53-tz>
> 
>     > I know the version is provided as Linux version 2.6.35.3-01270-g9533414.
>     > However, if I try to use the 2.6.35.3-generic version as a target I get
>     > a symbol version error when I try to insmod:
>     >
>     > "disagrees about version of symbol kmalloc_caches
>     > Unknown symbol kmalloc_caches (err -22)"
>     >
>     > I believe this is because the kernel running in the normal world has
>     > been modified.
> 
>     The Freescale sources and vanilla Linux sources are quite different from
>     each other. I assume it clashes therefore.
> 
>     Regards
>     Stefan
> 
>     > I am wondering if there is another way for me to compile kernel modules
>     > for Genode. If not, would it be possible for you to release the source
>     > code of your modified kernel which you used to create the Linux Image
>     > that runs in the normal world?
>     >
>     > Thank you for your time, 
>     >
>     > Mauricio Gutierrez
>     >
>     >
>     >
>     ------------------------------------------------------------------------------
>     > Check out the vibrant tech community on one of the world's most
>     > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>     >
>     >
>     >
>     > _______________________________________________
>     > genode-main mailing list
>     > genode-main at lists.sourceforge.net
>     <mailto:genode-main at lists.sourceforge.net>
>     > https://lists.sourceforge.net/lists/listinfo/genode-main
>     <https://lists.sourceforge.net/lists/listinfo/genode-main>
>     >
> 
>     --
>     Stefan Kalkowski
>     Genode Labs
> 
>     https://github.com/skalk · http://genode.org/
> 
>     ------------------------------------------------------------------------------
>     Check out the vibrant tech community on one of the world's most
>     engaging tech sites, Slashdot.org! http://sdm.link/slashdot
>     _______________________________________________
>     genode-main mailing list
>     genode-main at lists.sourceforge.net
>     <mailto:genode-main at lists.sourceforge.net>
>     https://lists.sourceforge.net/lists/listinfo/genode-main
>     <https://lists.sourceforge.net/lists/listinfo/genode-main>
> 
> 
> 
> 
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> 
> 
> 
> _______________________________________________
> genode-main mailing list
> genode-main at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/genode-main
> 

-- 
Stefan Kalkowski
Genode Labs

https://github.com/skalk · http://genode.org/




More information about the users mailing list