search
HomeSystem TutorialLINUXYocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

Feb 10, 2024 pm 10:12 PM
linuxlinux tutoriallinux systemlinux commandshell scriptembeddedlinuxGetting started with linuxlinux learning

If you are an embedded developer, you may encounter this question: How to create a suitable Linux system for your hardware platform? How to customize the functionality and appearance of a Linux system? How to ensure the security and stability of Linux system? These problems can be solved by using the Yocto project. The Yocto Project is an open source collaborative project that helps you create custom Linux systems regardless of your hardware architecture. The Yocto project provides a flexible set of tools and resources that allow you to build your own Linux distribution from scratch, or modify and optimize based on existing Linux distributions. This article will introduce you to how to use Yocto to create a minimal Linux distribution on Ubuntu, as well as the basic concepts and workflow of Yocto.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

Basic conditions for development machine

Minimum 4-6 GB RAM

The latest version of Ubuntu system (this article uses 16.04 LTS)

The remaining disk space is at least 60-80 GB

Install the following packages before creating a Linux distribution

Download the latest Yocto (Poky is its minimum development environment) stable branch

apt-get update
apt-get install wget git-core unzip make gcc g++ build-

essential subversion sed autoconf automake texi2html texinfo coreutils diffstat python-

pysqlite2 docbook-utils libsdl1.2-dev libxml-parser-perl libgl1-mesa-dev libglu1-mesa-

dev xsltproc desktop-file-utils chrpath groff libtool xterm gawk fop
Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

As shown below, the software package to be installed in the development environment is nearly 1GB in size.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

In this tutorial, the morty stable branch of poky is cloned on the system.

git clone -b morty git://git.yoctoproject.org/poky.git
Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

Enter the poky directory, and then run the following command to set (set/export) some environment variables for the Yocto development environment.

source oe-init-build-env

As shown below, after running the open embedded (oe) build environment script, the path in the terminal will automatically switch to the build directory for subsequent configuration and construction of the release version.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

The screenshot above shows the file local.conf created in the conf directory. This is the configuration file used by Yocto to set the target machine details and target architecture of the SDK.

As shown below, the target machine set here is qemux86-64.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

As shown in the screenshot below, uncomment the following parameters in local.conf.

DL_DIR ?= "${TOPDIR}/downloads"
Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu
SSTATE_DIR ?= "${TOPDIR}/sstate-cache"
Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu
TMPDIR ?= "${TOPDIR}/tmp"
Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu
PACKAGE_CLASSES ?= "package_rpm"
SDKMACHINE ?= "i686"
Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

As shown below, set an empty password and some subsequent parameters in local.conf for Yocto-based Linux. Otherwise, users will not be able to log in to the new release.

EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

We are not planning to use any graphical tools to create Linux OS, such as toaster (hob is no longer supported).

Yocto compilation and build process

Now run the following bitbake tool command to start downloading and compiling the software package for the selected target machine.

bitbake core-image-minimal
Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

It is very important to run the above command under a normal Linux user and not using the root user. As shown in the screenshot below, when you run the bitbake command under the root user, the error shown below will occur.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

Run the script that exports environment variables (oe-init-build-env) again, and re-execute the same command to start the download and compilation process.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

As shown below, the first step in building a script component is to parse the configuration (recipe).

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

The screenshot below shows the parsing process of the build script. It also shows the details of the build system used to build your new yocto-based distribution.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

After downloading the SDK and necessary libraries, the next step is to download and compile the software package. The screenshot below shows the tasks performed to build a new distribution. This step will take 2-3 hours as the required packages must first be downloaded and then compiled for the new Linux distribution.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

The screenshot below shows the completion of the task list.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

The new image compiled for the target machine type qemux86-64 is located in build/tmp/deploy/images/qemux86-64:

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

As shown below, the above command will generate an error if run on Putty.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

Run the above command again on the Ubuntu platform via rdp.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

Open a new screen for qemu running the new Yocto-based Linux distribution.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

The following shows the login interface of the new release, and also displays the version number of the yocto project used. The default username is root and the password is blank.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

Finally use the root username and empty password to log in to the new release. As shown in the screenshot below, basic commands (data, ifconfig, and uname) are run on this minimal version of Linux.

Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu

The goal of this article is to understand the process of creating a new Linux distribution using Yocto.

Through this article, you have learned how to use Yocto to create a minimal Linux distribution on Ubuntu, as well as the basic concepts and workflow of Yocto. You can use Yocto to customize a suitable Linux system for your embedded devices or other scenarios to meet your needs and preferences. Of course, this is only part of the many features and options provided by the Yocto project. If you want to learn more about the Yocto project and embedded Linux development, you still need to continue to explore and practice. I hope this article can be helpful to your study and work. You are also welcome to share other practical Yocto skills you use or discover.

The above is the detailed content of Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:良许Linux教程网. If there is any infringement, please contact admin@php.cn delete
Is it hard to learn Linux?Is it hard to learn Linux?Apr 18, 2025 am 12:23 AM

Learning Linux is not difficult. 1.Linux is an open source operating system based on Unix and is widely used in servers, embedded systems and personal computers. 2. Understanding file system and permission management is the key. The file system is hierarchical, and permissions include reading, writing and execution. 3. Package management systems such as apt and dnf make software management convenient. 4. Process management is implemented through ps and top commands. 5. Start learning from basic commands such as mkdir, cd, touch and nano, and then try advanced usage such as shell scripts and text processing. 6. Common errors such as permission problems can be solved through sudo and chmod. 7. Performance optimization suggestions include using htop to monitor resources, cleaning unnecessary files, and using sy

What is the salary of Linux administrator?What is the salary of Linux administrator?Apr 17, 2025 am 12:24 AM

The average annual salary of Linux administrators is $75,000 to $95,000 in the United States and €40,000 to €60,000 in Europe. To increase salary, you can: 1. Continuously learn new technologies, such as cloud computing and container technology; 2. Accumulate project experience and establish Portfolio; 3. Establish a professional network and expand your network.

What is the main purpose of Linux?What is the main purpose of Linux?Apr 16, 2025 am 12:19 AM

The main uses of Linux include: 1. Server operating system, 2. Embedded system, 3. Desktop operating system, 4. Development and testing environment. Linux excels in these areas, providing stability, security and efficient development tools.

Does the internet run on Linux?Does the internet run on Linux?Apr 14, 2025 am 12:03 AM

The Internet does not rely on a single operating system, but Linux plays an important role in it. Linux is widely used in servers and network devices and is popular for its stability, security and scalability.

What are Linux operations?What are Linux operations?Apr 13, 2025 am 12:20 AM

The core of the Linux operating system is its command line interface, which can perform various operations through the command line. 1. File and directory operations use ls, cd, mkdir, rm and other commands to manage files and directories. 2. User and permission management ensures system security and resource allocation through useradd, passwd, chmod and other commands. 3. Process management uses ps, kill and other commands to monitor and control system processes. 4. Network operations include ping, ifconfig, ssh and other commands to configure and manage network connections. 5. System monitoring and maintenance use commands such as top, df, du to understand the system's operating status and resource usage.

Boost Productivity with Custom Command Shortcuts Using Linux AliasesBoost Productivity with Custom Command Shortcuts Using Linux AliasesApr 12, 2025 am 11:43 AM

Introduction Linux is a powerful operating system favored by developers, system administrators, and power users due to its flexibility and efficiency. However, frequently using long and complex commands can be tedious and er

What is Linux actually good for?What is Linux actually good for?Apr 12, 2025 am 12:20 AM

Linux is suitable for servers, development environments, and embedded systems. 1. As a server operating system, Linux is stable and efficient, and is often used to deploy high-concurrency applications. 2. As a development environment, Linux provides efficient command line tools and package management systems to improve development efficiency. 3. In embedded systems, Linux is lightweight and customizable, suitable for environments with limited resources.

Essential Tools and Frameworks for Mastering Ethical Hacking on LinuxEssential Tools and Frameworks for Mastering Ethical Hacking on LinuxApr 11, 2025 am 09:11 AM

Introduction: Securing the Digital Frontier with Linux-Based Ethical Hacking In our increasingly interconnected world, cybersecurity is paramount. Ethical hacking and penetration testing are vital for proactively identifying and mitigating vulnerabi

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months agoBy尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment