How to compile source code
A minor title could be "Coding for EasyOS PART2", as this page is a continuation of an introductory page here:
https://easyos.org/dev/coding-for-easyos.html
This "PART2" brings application compiling up-to-date for EasyOS
7.0+, in particular how to use the "devx" container. From now on,
Barry has written in the first-person:
Over the years, some users have expressed the desire to, and implemented, multiple desktops in containers. They had to do some hacking, so I thought, why not have them ready-made?
Another thing is, if you want to do some source code compiling, or use git or whatever, it is required to load the "devx" sfs file. Which we usually do onto the main desktop.
However, that is messy. It would be much tidier if can have a desktop in container, with devx sfs loaded, and minimal security so as not to impede development requirements. Then can go-to-town compiling packages and not mess up the main desktop. So why not have that also pre-built?
So, from version 7.0, bootup and there are lots more container icons:

...note that sda1 and sdb2 are mounted, as can be seen by the
little "close-box" top-right of the partition icon.
Zooming in on the container icons:
Those "x2" and "x3" are clones of "excalibur". The "devx"
container is also a desktop and requires the devx sfs, and this
will be downloaded, if not already, but as it is big, the user is
asked. After clicking on the "devx" icon:

Containers "excalibur", "x2", "x3" and "devx" are full EasyOS desktops. The first three are just normal desktops; devx is special, as it has the devx .sfs loaded. Container devx also has less security; as this is a compiling and project development container, it needs maximum power, despite being in a container.
A requirement is that the devx container be able to access partitions outside the container. For example, you may have your software compiling projects somewhere, in another partition. I took a sledge-hammer approach to this; there is a new variable in the 'configuration' file of each container. In /mnt/wkg/containers/devx/configuration, there is this entry:
EC_ACCESS_MOUNTED='true'
When set to "true", when the devx container is started, all partitions mounted in the main desktop, will be bind-mounted into the container. With the exception of the current working-partition, which is sdc2 -- this is done to retain some modicum of security. Yeah, sledge-hammer approach; maybe it could be fine-tuned in the future, be able to select particular partitions to bind-mount. Click on "devx" icon, and a couple of seconds later it is up and running:

...see the two partition icons. Click on them and ROX window opens. The devx .sfs is loaded, so all the development tools are there, including git.
This is a full desktop, and most of the tools are available,
including PKGget for package installation; click on the "pkg"
desktop on to run PKGget. Note that other package managers SFSget,
Flappi (flatpak manager) and Appi (appimage manager) are not
available, as these are not appropriate inside a container.
Not to forget, /files folder is still shared with the main
desktop and other containers. I used TAS to take desktop shots in
each container, they got saved to /files/media/images, and there
they all were back on the main desktop.
Flipping back to the main desktop, and back into the devx
desktop, is just the blink of an eye. Optionally, the clipboard
may be copied when flip.
Updating EasyOS and the devx.sfs
Updating EasyOS to the latest version is extrmely easy, described in this page:
https://easyos.org/user/how-to-update-easyos.html
This mechanism will also update the devx.sfs.
The desktop "update" icon will download the latest EasyOS and update to the latest 'vmlinuz', 'initrd' and 'easy.sfs' file. It will download a .delta difference-file, which is a small download, instead of having to download the entire .img drive-image file ...which is now over 1GB.
What has been left out of the picture is the devx .sfs file. If you have, for example, run the "devx" container, it will have downloaded the devx_<version>_amd64.sfs file, and loaded that as a layer in the devx container. That is about 500MB download, also rather big.
So, now the devx sfs is included in the update mechanism, and there are .delta files online.
The main update script is /ust/local/easy_version/easy-update, and there is now also 'easy-update-devx', that the former calls. It will only do so if detects that you already have a downloaded devx sfs, otherwise won't bother you, as many users are not interested in a devx sfs.
Compiling the kernel and modules
If you want to compile a module for the kernel, you will need the kernel source. This is available as a SFS file, kernel_<version>_src.sfs, and you can load this as a layer in the "devx" container. That's one of the great things about EasyOS containers; they are built with multiple layers. So, devx can have the layers kernel.sfs, devx.sfs and easy.sfs on the bottom.
If you want to compile the kernel itself, also do this in the
devx container. But, there are scripts in woofQ2 that make this
particularly easy.
There is a blog post that has more details:
https://bkhome.org/news/202601/do-all-compiling-in-the-devx-container.html
A final note: you could, if required, create multiple devx containers, or convert an existing one, such as "x3" to behave like the devx container. Study /mnt/wkg/containers/devx/configuration
Tags: dev