DEV Community

hang-up
hang-up

Posted on

Building a Linux OS with Yocto

What is Yocto?
It is a project that provides software tools—such as build systems, cross-development environments, and emulators—for the Linux OS.
In the past, building a Linux OS was a manual process. You had to gather the necessary software packages one by one, build them, resolve dependencies, and install them yourself.
Yocto is designed to solve this hassle. As long as you have an internet connection, it allows you to build a Linux OS automatically.

Environment
• OS: Ubuntu 22.04
• Version: Ubuntu 22.04.5 LTS (Jammy Jellyfish)
• Note: I attempted to use Ubuntu 24.04, but the setup failed because the modules for Bitbake are not supported yet.
• Troubleshooting: I encountered an issue where the terminal wouldn't launch on 22.04, but I resolved it using the following guide: "Solved: Ubuntu 22.04 Terminal Won't Start! How to fix in VirtualBox."
• Virtual Machine: VirtualBox 7.0.22
• Source: Download_Old_Builds_7_0 – Oracle VirtualBox
• System Requirements for Yocto:
• Storage: Allocated 60GB or more to ensure sufficient disk space during the build process.
• Memory (RAM): Allocated 16GB, as 8GB was not enough.

Source.

# Install Modules (Dependencies)
sudo apt update
sudo apt install -y chrpath diffstat gawk
sudo apt install python3.10-distutils

# Clone Repository
cd /home/user
mkdir poky
cd poky
git clone -b dunfell git://git.yoctoproject.org/poky.git

# Build
cd /home/user/poky/poky
source oe-init-build-env
bitbake core-image-base # The initial build may take 2-4 hours.

# Run QEMU (Emulator)
runqemu qemux86         # For 32-bit
runqemu qemux86-64      # For 64-bit

# Use the command below if you are on 64-bit and encounter the 
# "Request Major code 130 (MIT-SHM)" error:
runqemu qemux86-64 nographic

### Initial Login Credentials
# User: root
# Password: none (leave blank)

Enter fullscreen mode Exit fullscreen mode

Result

Thoughts
It was harder than I expected, but I managed to complete the build by asking an AI for help.
The video I referred to was very easy to understand. (It was in English, so I watched it using auto-translation.)

https://m.youtube.com/watch?v=G4ufLyCFovo

Top comments (0)