2. Host VM
I chose to use a virtual machine as the host machine, so that I won't mess with my physical machines. Moreover, I can bring it around on an USB hard disk!
I chose VirtualBox as my VM, simply because it's a freely available VM I've used for a long time. My current version is 7.0.6, but it shouldn't matter much as far as I know. I installed this VirtualBox on several Windows 10 machines successfully; this is the VM host OS.
As the VM guest OS I chose Lubuntu 22.04 LTS. I know that many prefer a standard Debian, but I find Ubuntu easier to setup — I don't want to waste too much time configuring the host machine.
Lubuntu is rather lightweight and quick, with no frills, while still being an officially supported Linux distro.
The LTS was chosen because it's in the middle of its planned life, so it's mature enough to get stable results for enough time.
Furthermore, 22.04 LTS is officially supported by several tools and frameworks, including Yocto.
2.1 Required Tools
-
VirtualBox 7.0.6 or later
-
Lubuntu 22.04 LTS (Jammy Jellyfish) or another Ubuntu 22.04 LTS
2.2 VM guest OS installation
First, install VirtualBox, which should be very straightforward.
Then, create a new virtual machine.
Important VM specs:
-
Hard Disk ≥ 32 GB
- Dynamically allocated is fine
- Enable
Use Host I/O cache
to avoid hiccups
-
CD drive with the Lubuntu ISO file as a
Live CD/DVD
-
RAM ≥ 4 GB
- With less RAM, some toolchains might get stuck in swap hell
-
Processors = number of physical CPU cores
- VM host OS still usable
- good performance
- might not leverage hyperthreading
- I'm using
Enable PAE/NX
as an added bonus - suggested ≥ 4 physical cores of the host machine
-
Network via NAT
- No need for a proper network as with physical boards
Launch the VM and wait for it to load the Live OS straight from the emulated DVD drive.
When available, let's run the installer from the desktop. No particular options have to be set, so leave the defauit ones if in doubt.
When prompted for formatting options, just let the installer format the whole partition with swap on file.
When asked for names and passwords, I'd opt for covnenience:
- Machine name:
vm
- User name:
me
- Password: none
- Automatic login: enabled
After a few minutes the installer should have terminated, and the VM can be restarted to enter the installed VM guest OS.
2.3 VM guest OS configuration
Once the installed VM guest OS is run, it should install any updates from the internet.
For shell commands I typically use the default terminal application provided by the OS. In the case of Lubuntu, it's QTerminal, which can be accessed either via the start menu, or by pressing Ctrl+Alt+T.
So, let's update the system, with the canonical commands for Debian-based Linux distros:
It most probably installed some Linux kernel updates, so let's reboot to make changes effective:
This time it's best to add VirtualBox Guest Additions for the best VM experience.
From the Devices
menu, select Insert Guest Additions CD Image...
.
Ignore any automatic actions; we're going to install them from the shell:
You can usually type
cd /media
and press the Tab key repeatedly for automatic completion; the same for the run script.If you double-press Tab, the shell prints some suggestions. It's often handy to click the desired suggestion with the central mouse button to automatically append it to the command line.
After the installation has finished, it's best to reboot again.
You're now free to resize the window, or enter seamless mode. I usually select the latter, so that I can open a PDF in the host OS, and superimpose Lubuntu shell windows seamlessly.
2.4 Networking
There's no special configuration to be made to follow this tutorial. You can leave the VirtualBox emulated network interface configured as NAT, which makes life easier for our course. Just make sure that the VM guest OS can reach the internet in a stable and possibly fast way.
The conventions for this tutorial are the following:
- Network mask:
255.255.255.0
=/24
, the 24 most significant bits. - Host machine IP:
10.0.2.15
, the default one for of Ubuntu VirtualBox VM. - Target machine IP:
10.0.2.69
, an arbitrary target IP you can spot and remember easily.
2.5 Training lab data
You should retrieve the training lab data from its Bootlin page:
$ cd ~
$ wget https://bootlin.com/doc/training/embedded-linux-qemu/embedded-linux-qemu-labs.tar.xz
$ tar xfv embedded-linux-qemu-labs.tar.xz
You can give a quick look to the folder structure with the tree
command:
$ tree ~/embedded-linux-qemu-labs/
/home/me/embedded-linux-qemu-labs/
├── appdev
│ └── app.c
├── bootloader
│ └── data
│ └── u-boot
├── buildroot
│ └── data
│ ├── mpd.conf
│ └── music
│ ├── 1-sample.ogg
│ ├── 2-arpent.ogg
│ ├── 3-chronos.ogg
│ ├── 4-land-of-pirates.ogg
│ ├── 5-ukulele-song.ogg
│ ├── 6-le-baguette.ogg
│ ├── 7-fireworks.ogg
│ └── README.txt
├── debugging
│ └── data
│ └── vista-emulator.c
├── tinysystem
│ └── data
│ ├── busybox-1.35.config
│ ├── hello.c
│ └── www
│ ├── cgi-bin
│ │ ├── cpuinfo
│ │ ├── list
│ │ ├── reboot
│ │ ├── upload
│ │ ├── upload.c
│ │ ├── upload.cfg
│ │ └── uptime
│ ├── gohome.png
│ ├── index.html
│ ├── kshutdown.png
│ └── upload
│ ├── BadPage.html
│ ├── files
│ │ ├── adult-small.png
│ │ ├── brick.png
│ │ ├── linux-blackfin.jpg
│ │ ├── linux-kernel-dev-book.jpg
│ │ └── lkn-small.jpg
│ └── OkPage.html
└── toolchain
└── hello.c
15 directories, 32 files