jbech-linaro / docker_optee

Simple Dockerfile that makes it easy to try OP-TEE using Docker
19 stars 21 forks source link

How to setup java environment in docker_optee #1

Closed Tigerly closed 2 years ago

Tigerly commented 6 years ago

Hello, I've already downloaded the docker_optee and setup it correctly. Now, I'm trying to setup java environment, and run java code in the normal world. Would it be possible to give me some advice about how to setup java environment to the host side in normal world? Thanks in advance!

vchong commented 6 years ago

I think you can add whatever package you need to https://github.com/jbech-linaro/docker_optee/blob/master/Dockerfile#L8 and rebuild. E.g. default-jre, default-jdk, openjdk-7-jre, etc. Or login to the container and install it manually as you normally would.

Tigerly commented 6 years ago

@vchong Thanks for replying! I've installed the jdk in container by using "apt-get". But when I "make all run", and simulates the normal world and the secure world, I cannot find java commands (like java, javac ...) in the normal world.

vchong commented 6 years ago

Oh sorry. I misunderstood you. make all run creates a qemu environment. I'm not sure if java is supported in qemu.

jbech-linaro commented 6 years ago

Hi @Tigerly , I don't think you can run Java in this setup, it is a very stripped down setup based on just busybox as a root fs. At least I think it would be hard to bring in all dependencies needed. If you would need to do something like that, then I would instead try to get a proper root fs from a Linux distro and use that instead of the busybox based root fs. If you do that, then you can apt-get stuff as in a normal Linux environment. Basically what I'm saying is what can be read for RPi3 here: https://github.com/OP-TEE/build/blob/master/docs/rpi3.md#57-other-root-filesystems-than-initramfs-based. For RPi3 I've been doing that successfully (it requires some tweaks to put the OP-TEE files at the correct place, basically this).

I haven't tried the same in QEMU which is what my Docker file will setup. But I think it should be easy to just replace it. Works fine for RPi3 and the loading mechanism is the same.

And a clarification to what's happening in this Docker setup: Your Linux machine -> Docker virtual machine (Ubuntu) -> QEMU -> [ Normal World, Secure World]. So you are actually running a virtual machine (QEMU) inside another virtual machine (Docker/Ubuntu).