You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Yocto Recipe中class-target与class-native的区别及语法疑问

Understanding class-native vs class-target in Yocto Recipes

Great question! This is a core concept in Yocto's cross-compilation workflow, so let's break it down clearly.

First, it helps to remember that Yocto builds two distinct types of software: tools that run on your build host (the Linux machine you're using to create the embedded image), and software that runs on your target embedded system (the board/device you're deploying to). These two classes define which context a recipe or variable applies to.

What is class-native?

  • class-native refers to software compiled to run on your build host, not the target device.
  • These are typically tools needed during the build process: cross-compilers, image utilities, bootloader tools (like grub-efi-native), or packaging helpers.
  • When you see a variable suffix like _class-native (e.g., DEPENDS_class-native), it means that variable only applies when building a native-class recipe.

What is class-target?

  • class-target is the default for most recipes, referring to software compiled to run on the target embedded system.
  • This includes everything that ends up in your final embedded image: the Linux kernel, user-space apps, libraries, and system services.
  • A suffix like _class-target (like your example DEPENDS_append_class-target = " grub-efi-native") means the variable applies only when building a target-class recipe.

Your Example Explained

The line DEPENDS_append_class-target = " grub-efi-native" tells BitBake:

When building this target-class recipe (the one that will run on your embedded device), we first need to build the grub-efi-native tool (which runs on your build host). This native tool is required during the build process of the target software—maybe to generate EFI boot files or perform some bootloader-related setup for the target.

Quick Comparison

  • class-native
    • Runs on: Build host
    • Purpose: Build-time tools for the host
    • Variable suffix: Applies only to native recipes
  • class-target
    • Runs on: Target embedded system
    • Purpose: End-user software for the device
    • Variable suffix: Applies only to target recipes

内容的提问来源于stack exchange,提问作者md.jamal

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 07:56:56