base.bbclass: Add COMPATIBLE_OS, useful for non-Linux target recipes
PATCH v2 1/1 base.bbclass: Add COMPATIBLE_OS, useful for non-Linux target recipes
Add the ability to generate non-Linux based components, such as baremetal, FreeRTOS, Zypher, etc, exist. There is a need for a way to take components as specific to a given OS.
This is especially important in a multiconfig build where you may be targeting different OSes which different sets of recipes in a common set of layers.
Setting a default of (matching bitbake.conf's default TARGET_OS):
COMPATIBLE_OS ?= "linux${LIBCEXTENSION}${ABIEXTENSION}"will allow all existing recipes to be tagged as Linux specific, so only non-Linux recipes would need to be tagged with specific compatibility.
For a baremetal recipes, the following was used to test this code:
COMPATIBLE_OS = "elf"
COMPATIBLE_OS_arm = "eabi"
---
V2:
Only difference to V1 is typograhic fixes to the commit message.
meta/classes/base.bbclass | 7 +++++++ meta/conf/documentation.conf | 1 + 2 files changed, 8 insertions(+)
meta/classes/base.bbclass +7 -0
@@ -509,6 +509,13 @@ python () { d.setVarFlag('do_devshell', 'fakeroot', '1') d.appendVarFlag('do_devshell', 'depends', ' virtual/fakeroot-native:do_populate_sysroot') + need_os = d.getVar('COMPATIBLE_OS') + if need_os and not d.getVar('PARSE_ALL_RECIPES', False): + import re + this_os = d.getVar('TARGET_OS') + if not re.match(need_os, this_os): + raise bb.parse.SkipRecipe("incompatible with os %s (not in COMPATIBLE_OS)" % this_os) + need_machine = d.getVar('COMPATIBLE_MACHINE') if need_machine and not d.getVar('PARSE_ALL_RECIPES', False): import re
meta/conf/documentation.conf +1 -0
@@ -111,6 +111,7 @@ COMBINED_FEATURES[doc] = "A set of features common between MACHINE_FEATURES and COMMON_LICENSE_DIR[doc] = "Points to meta/files/common-licenses in the Source Directory, which is where generic license files reside." COMPATIBLE_HOST[doc] = "A regular expression that resolves to one or more hosts (when the recipe is native) or one or more targets (when the recipe is non-native) with which a recipe is compatible." COMPATIBLE_MACHINE[doc] = "A regular expression that resolves to one or more target machines with which a recipe is compatible." +COMPATIBLE_OS[doc] = "A regular expression that resolves to one or more target oses which a recipe is compatible." COMPLEMENTARY_GLOB[doc] = "Defines wildcards to match when installing a list of complementary packages for all the packages installed in an image." CONFFILES[doc] = "Identifies editable or configurable files that are part of a package." CONFIG_SITE[doc] = "A list of files that contains autoconf test results relevant to the current build. This variable is used by the Autotools utilities when running configure."
Signature · 1 line
2.17.1
Quoted 56 lines · Mark Hatle
Add the ability to generate non-Linux based components, such as baremetal, FreeRTOS, Zypher, etc, exist. There is a need for a way to take components as specific to a given OS.
This is especially important in a multiconfig build where you may be targeting different OSes which different sets of recipes in a common set of layers.
Setting a default of (matching bitbake.conf's default
TARGET_OS):COMPATIBLE_OS ?= "linux${LIBCEXTENSION}${ABIEXTENSION}"will allow all existing recipes to be tagged as Linux specific, so only non-Linux recipes would need to be tagged with specific compatibility.
For a baremetal recipes, the following was used to test this code:
COMPATIBLE_OS= "elf"
COMPATIBLE_OS_arm= "eabi"Signed-off-by Mark Hatle <[email protected]>---
V2:
Only difference to V1 is typograhic fixes to the commit message.meta/classes/base.bbclass | 7 +++++++ meta/conf/documentation.conf | 1 + 2 files changed, 8 insertions(+)meta/classes/base.bbclass +7
-0@@ -509,6 +509,13 @@ python () { d.setVarFlag('do_devshell', 'fakeroot', '1') d.appendVarFlag('do_devshell', 'depends', ' virtual/fakeroot-native:do_populate_sysroot') + need_os = d.getVar('COMPATIBLE_OS') + if need_os and not d.getVar('PARSE_ALL_RECIPES', False): + import re + this_os = d.getVar('TARGET_OS') + if not re.match(need_os, this_os): + raise bb.parse.SkipRecipe("incompatible with os %s (not in COMPATIBLE_OS)" % this_os) + need_machine = d.getVar('COMPATIBLE_MACHINE')if
need_machineand notd.getVar('PARSE_ALL_RECIPES', False):
import remeta/conf/documentation.conf +0
-0@@ -111,6 +111,7 @@ COMBINED_FEATURES[doc] = "A set of features
Quoted 6 lines
common between
MACHINE_FEATURESand
COMMON_LICENSE_DIR[doc] = "Points to meta/files/common-licenses in
the Source Directory, which is where generic license files reside."
COMPATIBLE_HOST[doc] = "A regular expression that resolves to one or
more hosts (when the recipe is native) or one or more targets (when the recipe is non-native) with which a recipe is compatible."
How does COMPATIBLE_OS compare to COMPATIBLE_HOST (documented above)?
Cheers
Richard
Quoted 57 lines · Mark Hatle
Quoted 56 lines
Add the ability to generate non-Linux based components, such as baremetal, FreeRTOS, Zypher, etc, exist. There is a need for a way to take components as specific to a given OS.
This is especially important in a multiconfig build where you may be targeting different OSes which different sets of recipes in a common set of layers.
Setting a default of (matching bitbake.conf's default
TARGET_OS):COMPATIBLE_OS ?= "linux${LIBCEXTENSION}${ABIEXTENSION}"will allow all existing recipes to be tagged as Linux specific, so only non-Linux recipes would need to be tagged with specific compatibility.
For a baremetal recipes, the following was used to test this code:
COMPATIBLE_OS= "elf"
COMPATIBLE_OS_arm= "eabi"Signed-off-by Mark Hatle <[email protected]>---
V2:
Only difference to V1 is typograhic fixes to the commit message.meta/classes/base.bbclass | 7 +++++++ meta/conf/documentation.conf | 1 + 2 files changed, 8 insertions(+)meta/classes/base.bbclass +7
-0@@ -509,6 +509,13 @@ python () { d.setVarFlag('do_devshell', 'fakeroot', '1') d.appendVarFlag('do_devshell', 'depends', ' virtual/fakeroot-native:do_populate_sysroot') + need_os = d.getVar('COMPATIBLE_OS') + if need_os and not d.getVar('PARSE_ALL_RECIPES', False): + import re + this_os = d.getVar('TARGET_OS') + if not re.match(need_os, this_os): + raise bb.parse.SkipRecipe("incompatible with os %s (not in COMPATIBLE_OS)" % this_os) + need_machine = d.getVar('COMPATIBLE_MACHINE')if
need_machineand notd.getVar('PARSE_ALL_RECIPES', False):
import remeta/conf/documentation.conf +0
-0@@ -111,6 +111,7 @@ COMBINED_FEATURES[doc] = "A set of features
Quoted 8 lines
Quoted 6 lines
common between
MACHINE_FEATURESand
COMMON_LICENSE_DIR[doc] = "Points to meta/files/common-licenses in
the Source Directory, which is where generic license files reside."
COMPATIBLE_HOST[doc] = "A regular expression that resolves to one or
more hosts (when the recipe is native) or one or more targets (when the recipe is non-native) with which a recipe is compatible."How does
COMPATIBLE_OScompare toCOMPATIBLE_HOST(documented above)?
HOST_SYS="aarch64-oe-linux"
So the equivalent to the COMPATIBLE_OS would be:
COMPATIBLE_HOST ?= ".*-linux.*"
So it COULD be used in most cases.
When I tried this before though, I could get it to work in a multiconfig setting.
Specifically what I tried was setting, in my local.conf:
COMPATIBLE_HOST ?= ".*-linux${LIBCEXTENSION}${ABIEXTENSION}"
And then in the recipes:
COMPATIBLE_HOST = ".*-elf"COMPATIBLE_HOST_arm = ".*-eabi"
But then the second one matches the linux ABIEXTENSION and broke..
So really the issue is that I -only- ever want to match on the OS part of the "SYS" string. And done to the multiple natures of the '-', it's difficult to get right.
I didn't try something complex like: [^-]-[^-]-eabi
--Mark
Quoted 4 lines
Cheers
Richard
Quoted 100 lines · Mark Hatle
Quoted 70 lines · Mark Hatle
Quoted 69 lines
Add the ability to generate non-Linux based components, such as baremetal, FreeRTOS, Zypher, etc, exist. There is a need for a way
to take components as specific to a given OS.This is especially important in a multiconfig build where you may be
targeting different OSes which different sets of recipes in a common
set of layers.Setting a default of (matching bitbake.conf's default
TARGET_OS):COMPATIBLE_OS ?= "linux${LIBCEXTENSION}${ABIEXTENSION}"will allow all existing recipes to be tagged as Linux specific, so
only non-Linux recipes would need to be tagged with specific compatibility.For a baremetal recipes, the following was used to test this code:
COMPATIBLE_OS= "elf"
COMPATIBLE_OS_arm= "eabi"Signed-off-by Mark Hatle <[email protected]>---
V2:
Only difference to V1 is typograhic fixes to the commit message.meta/classes/base.bbclass | 7 +++++++ meta/conf/documentation.conf | 1 + 2 files changed, 8 insertions(+)meta/classes/base.bbclass +6
-0@@ -509,6 +509,13 @@ python () { d.setVarFlag('do_devshell', 'fakeroot', '1') d.appendVarFlag('do_devshell', 'depends', ' virtual/fakeroot-native:do_populate_sysroot') + need_os = d.getVar('COMPATIBLE_OS') + if need_os and not d.getVar('PARSE_ALL_RECIPES', False): + import re + this_os = d.getVar('TARGET_OS') + if not re.match(need_os, this_os): + raise bb.parse.SkipRecipe("incompatible with os %s(not
inCOMPATIBLE_OS)" %this_os)
+
need_machine=d.getVar('COMPATIBLE_MACHINE')ifneed_machineand not d.getVar('PARSE_ALL_RECIPES',
False):
import remeta/conf/documentation.conf +0
-0@@ -111,6 +111,7 @@ COMBINED_FEATURES[doc] = "A set of featurescommon between
MACHINE_FEATURESand
COMMON_LICENSE_DIR[doc] = "Points to meta/files/common-licenses
in
the Source Directory, which is where generic license files reside."Quoted 8 lines
Quoted 5 lines
COMPATIBLE_HOST[doc] = "A regular expression that resolves to
one or
more hosts (when the recipe is native) or one or more targets (when
the recipe is non-native) with which a recipe is compatible."How does
COMPATIBLE_OScompare toCOMPATIBLE_HOST(documented above)?HOST_SYS="aarch64-oe-linux"
So the equivalent to the
COMPATIBLE_OSwould be:
COMPATIBLE_HOST?= ".*-linux.*"So it COULD be used in most cases.
When I tried this before though, I could get it to work in a multiconfig
setting.Specifically what I tried was setting, in my local.conf:
COMPATIBLE_HOST?= ".*-linux${LIBCEXTENSION}${ABIEXTENSION}"And then in the recipes:
COMPATIBLE_HOST= ".*-elf"COMPATIBLE_HOST_arm= ".*-eabi"
Quoted 8 lines
But then the second one matches the linux ABIEXTENSION and broke..
So really the issue is that I -only- ever want to match on the OS part of
the "SYS" string. And done to the multiple natures of the '-', it's difficult to get right.I didn't try something complex like: [^-]-[^-]-eabi
From what I remember, COMPATIBLE_HOST has full re support so something should be possible...
Cheers,
Richard
I talked with RP off the list and got this working.
Below is what I ended up doing to prevent the default packages from working with baremetal, unless they were configured to.
In my baremetal distro.conf:
COMPATOS = ""
COMPATOS_class-target = ".*-linux${LIBCEXTENSION}${ABIEXTENSION}" COMPATIBLE_HOST ?= "${COMPATOS}"
Then in each of the baremetal -only- recipes:
COMPATIBLE_HOST = ".*-elf"COMPATIBLE_HOST_arm = "[^-]*-[^-]*-eabi"
In the recipes for BOTH baremetal and Linux:
COMPATIBLE_HOST = "${HOST_SYS}"
(Setting to "" should work as well..)
--Mark
Quoted 104 lines · Mark Hatle
Quoted 57 lines · Mark Hatle
Quoted 56 lines
Add the ability to generate non-Linux based components, such as baremetal, FreeRTOS, Zypher, etc, exist. There is a need for a way to take components as specific to a given OS.
This is especially important in a multiconfig build where you may be targeting different OSes which different sets of recipes in a common set of layers.
Setting a default of (matching bitbake.conf's default
TARGET_OS):COMPATIBLE_OS ?= "linux${LIBCEXTENSION}${ABIEXTENSION}"will allow all existing recipes to be tagged as Linux specific, so only non-Linux recipes would need to be tagged with specific compatibility.
For a baremetal recipes, the following was used to test this code:
COMPATIBLE_OS= "elf"
COMPATIBLE_OS_arm= "eabi"Signed-off-by Mark Hatle <[email protected]>---
V2:
Only difference to V1 is typograhic fixes to the commit message.meta/classes/base.bbclass | 7 +++++++ meta/conf/documentation.conf | 1 + 2 files changed, 8 insertions(+)meta/classes/base.bbclass +7
-0@@ -509,6 +509,13 @@ python () { d.setVarFlag('do_devshell', 'fakeroot', '1') d.appendVarFlag('do_devshell', 'depends', ' virtual/fakeroot-native:do_populate_sysroot') + need_os = d.getVar('COMPATIBLE_OS') + if need_os and not d.getVar('PARSE_ALL_RECIPES', False): + import re + this_os = d.getVar('TARGET_OS') + if not re.match(need_os, this_os): + raise bb.parse.SkipRecipe("incompatible with os %s (not in COMPATIBLE_OS)" % this_os) + need_machine = d.getVar('COMPATIBLE_MACHINE')if
need_machineand notd.getVar('PARSE_ALL_RECIPES', False):
import remeta/conf/documentation.conf +0
-0@@ -111,6 +111,7 @@ COMBINED_FEATURES[doc] = "A set of featuresQuoted 8 lines
Quoted 6 lines
common between
MACHINE_FEATURESand
COMMON_LICENSE_DIR[doc] = "Points to meta/files/common-licenses in
the Source Directory, which is where generic license files reside."
COMPATIBLE_HOST[doc] = "A regular expression that resolves to one or
more hosts (when the recipe is native) or one or more targets (when the recipe is non-native) with which a recipe is compatible."How does
COMPATIBLE_OScompare toCOMPATIBLE_HOST(documented above)?HOST_SYS="aarch64-oe-linux"
So the equivalent to the
COMPATIBLE_OSwould be:
COMPATIBLE_HOST?= ".*-linux.*"So it COULD be used in most cases.
When I tried this before though, I could get it to work in a multiconfig setting.
Specifically what I tried was setting, in my local.conf:
COMPATIBLE_HOST?= ".*-linux${LIBCEXTENSION}${ABIEXTENSION}"And then in the recipes:
COMPATIBLE_HOST= ".*-elf"COMPATIBLE_HOST_arm= ".*-eabi"But then the second one matches the linux ABIEXTENSION and broke..
So really the issue is that I -only- ever want to match on the OS part of the "SYS" string. And done to the multiple natures of the '-', it's difficult to get right.
I didn't try something complex like: [^-]-[^-]-eabi
--Mark
Quoted 4 lines
Cheers
Richard