The SDK in form of a VirtualBox image is the most reliable and portable way to produce new containers. It still has a few disadvantages:
The overall performance within a virtual machine (VM) is never that high than the one on the host machine.
Exchanging files between the VM and the host system is not always that easy, it's quite slow and takes a huge amount of CPU power.
Working within a VM most of the times is quite uncomfortable. There never are the right tools like editors. In case of the SDK there is not even an X server installed.
The same mechanism used within the M3 platform devices can be used on every modern Linux machine. Let the SDK run in an LXC container. Share all files in your users home directory of the host with the LXC container. That way you can edit the source files with your hosts editors and tools and use the SDK from within the LXC container to compile them.
Using the SDK as an LXC container will result in a huge performance improvement when compiling. The pain with the file exchange will go away and starting up the SDK will happen almost instantly.
Preconditions:
Read more on the LXC website
Download the archive with the SDK
Become root and extract the archive. It's assumed that the all LXC containers are installed in /var/lib/lxc
user@host ~ # su root
Password:
root@host ~ # tar xf PATH_OF_THE_DOWNLOADES_SDK_ARCHIVE -C /var/lib/lxc
Find out the normal users UID and GID. It's assumed that they are 1001 and 1005:
root@host ~ # id YOUR_USER_NAME -u
1001
root@host ~ # id YOUR_USER_NAME -g
1005
Modify the UID and GID of the user "user" of the LXC container:
root@host ~ # nano /var/lib/lxc/m3sdk/rootfs/etc/passwd/
...
user❌1001:1005::/home/user:/bin/bash
...
Mount the normal users home directory of the host into the LXC container. After starting the LXC container all files of the normal user on the host are the same in the container. To do that modify the configuration file of the LXC container:
root@host ~ # nano /var/lib/lxc/m3sdk/config
lxc.mount.entry = /home/YOUR_USER_NAME home/user defaults rw,bind 0 0
Starting and stopping a container may require root permissions on the host system.
user@host ~ # su root
Password:
root@host ~ # lxc-start -P /var/lib/lxc -n m3sdk
Open a console to the LXC container:
root@host ~ # lxc-console -P /var/lib/lxc -n m3sdk
Login as "user" with the password "user". The password for the user "root" is "root". The prompt changes to "user@m3sdk ~ $". Stopping a container must be done from another terminal:
user@host ~ # su root
Password:
root@host ~ # lxc-stop -P /var/lib/lxc -n m3sdk -k