Arm Linux Kernel on docker image with qemu and tool chains - building
I am used to ask for 4 to 5 assignments in the Operating Systems course - PCS3746. Last year, it was four. My former student Tiago Shibata put the work of his team on:
https://github.com/tiagoshibata/pcs3746-sistemas-operacionais
He did not provide much documentation. I will do it.
This links points to the source code necessary to build a docker image.
A docker image is some kind of light virtual machine where you insert everything you need and nothing more. In a normal virtual machine, you would install ubuntu with X windows, Unity, and a lot of stuff that is not related to what we want: an ARM Linux kernel. Besides, a normal virtual machine, it emulates the hardware, I/O (clock, hard disk, etc.), BIOS, etc. while a docker image makes use of the Linux system calls. So, a docker image consumes much less resource than a real virtual machine.
In order to run a docker image, you can:
https://github.com/tiagoshibata/pcs3746-sistemas-operacionais
He did not provide much documentation. I will do it.
This links points to the source code necessary to build a docker image.
A docker image is some kind of light virtual machine where you insert everything you need and nothing more. In a normal virtual machine, you would install ubuntu with X windows, Unity, and a lot of stuff that is not related to what we want: an ARM Linux kernel. Besides, a normal virtual machine, it emulates the hardware, I/O (clock, hard disk, etc.), BIOS, etc. while a docker image makes use of the Linux system calls. So, a docker image consumes much less resource than a real virtual machine.
In order to run a docker image, you can:
- download the image and run it.
- download the image source, build and run it.
As I will ask to modify files in the image source, let us build it.
Building the docker image
I am using ubuntu 16.4 and recommend you do so. To my knowledge, it is possible to run docker on windows too, but I am not really familiar with it.
On your terminal, in the Downloads directory, do:
git clone --recursive https://github.com/tiagoshibata/pcs3746-sistemas-operacionais.git
This command will create the directory "pcs3746-sistemas-operacionais":
~/Downloads/pcs3746-sistemas-operacionais$ ls
1/ 2/ 3/ 4/ initramfs_base/
We have the directories:
- 1, 2, 3, 4: correspond to the 4 assignments I asked during the course; but only the directory "1" contains the docker file which is necessary to build the docker image. The others will make use of it. I recommend you do the same during our course.
- initramfs_base: contains:
- rootfs is the directory that contains the root fs (as the hard disk image). It is very important to have the first process, init, there.
- busybox is a collection of tools, commands that are really common to use in Unix (ex: shell, kill, ls, etc.). A pure kernel does not contain such tools. They run in user mode (obviously).
- src: contains the source of init.c and other stuff. Thus, you will have to edit init.c in this directory to change the first process that is running on Linux. The init.c is compiled and it must go to the rootfs filesystem image.
~/Downloads/pcs3746-sistemas-operacionais/1$ ls
docker/ initramfs/ linux/ README.md run.sh*
It contains:
- docker: it has Dockerfile that explains how the docker iamge is built.
- initramfs: a director that contains init.c.
- linux: contains the source code of Linux
- README.md
- run.sh - the command to run the docker image.
Let us open README.md as a text file. You read:
Building: `cd docker ; docker build -t tiagoshibata/pcs3746 .`
Supposing you are in ~/Downloads/pcs3746-sistemas-operacionais;
you do:
cd docker
docker build -t tiagoshibata/pcs3746 .
It will create the tiagoshibata/pcs3746 docker image.
So basically, the commands are:
cd ~/Downloads
git clone --recursive https://github.com/tiagoshibata/pcs3746-sistemas-operacionais.git
cd docker
docker build -t tiagoshibata/pcs3746 .
It will take a long time due to the download phase. Relax!
In the next post, let us see the first running of the image.
Thanks for sharing this blog. This article gives lot of information.
ResponderExcluirDocker and Kubernetes Training
Docker and Kubernetes Online Training
Docker and Kubernetes Training in Hyderabad
Kubernetes Online Training
Docker Online Training
Docker Training in Hyderabad
Kubernetes Training in Hyderabad