


Yocto Getting Started Tutorial: Build Your Customized Linux System on Ubuntu
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.

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

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

In this tutorial, the morty stable branch of poky is cloned on the system.
git clone -b morty git://git.yoctoproject.org/poky.git

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.

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.

As shown in the screenshot below, uncomment the following parameters in local.conf.
DL_DIR ?= "${TOPDIR}/downloads"

SSTATE_DIR ?= "${TOPDIR}/sstate-cache"

TMPDIR ?= "${TOPDIR}/tmp"

PACKAGE_CLASSES ?= "package_rpm" SDKMACHINE ?= "i686"

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"

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

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.

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.

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

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.

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.

The screenshot below shows the completion of the task list.

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

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

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

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

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.

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.

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!

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

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.

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.

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.

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.

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

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.

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


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

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
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 English version
Recommended: Win version, supports code prompts!

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
Powerful PHP integrated development environment