目的
arm環境でros2を動作させる
※ちなみにOperating System とありますが、OSではなくてただのミドルウェアです
環境
- fedora 42
- QEMU 9.2.3
手順
ダウンロード
git clone -b kirkstone --depth=1 git://git.yoctoproject.org/poky
cd poky
git clone -b kirkstone --depth=1 https://github.com/ros/meta-ros.git
git clone -b kirkstone --depth=1 https://github.com/openembedded/meta-openembedded.git
つまりこんな感じ
[working directory]
└─ poky
├─ meta
├─ meta-poky
├─ meta-ros
├─ meta-openembedded
├─ ...
...
パッチを当てる
fedora42はgcc15が入っているので殆ど15対応
ubuntuやredhatなどだともっと少なくてすむと思う
差分
diff --git a/meta/recipes-core/gettext/gettext_0.21.bb b/meta/recipes-core/gettext/gettext_0.21.bb
index 364e6a5..30da759 100644
--- a/meta/recipes-core/gettext/gettext_0.21.bb
+++ b/meta/recipes-core/gettext/gettext_0.21.bb
@@ -48,6 +48,7 @@ EXTRA_OECONF += "--without-lispdir \
--without-cvs \
--without-git \
--cache-file=${B}/config.cache \
+ CFLAGS=-std=gnu11 \
"
EXTRA_OECONF:append:class-target = " \
--with-bisonlocaledir=${datadir}/locale \
diff --git a/meta/recipes-core/ncurses/files/0005-cpp.patch b/meta/recipes-core/ncurses/files/0005-cpp.patch
new file mode 100644
index 0000000..e84888d
--- /dev/null
+++ b/meta/recipes-core/ncurses/files/0005-cpp.patch
@@ -0,0 +1,17 @@
+diff --git a/include/curses.h.in b/include/curses.h.in
+index 6acf2d03..ec7e2da5 100644
+--- a/include/curses.h.in
++++ b/include/curses.h.in
+@@ -284,9 +284,12 @@ typedef @cf_cv_type_of_bool@ NCURSES_BOOL;
+ #define NCURSES_BOOL bool
+ #else
+ /* there is no predefined bool - use our own */
++#ifdef __cplusplus
++#else
+ #undef bool
+ #define bool NCURSES_BOOL
+ #endif
++#endif
+
+ #endif /* !__cplusplus, etc. */
+
diff --git a/meta/recipes-core/ncurses/ncurses_6.3+20220423.bb b/meta/recipes-core/ncurses/ncurses_6.3+20220423.bb
index 68a845f..ac14ef0 100644
--- a/meta/recipes-core/ncurses/ncurses_6.3+20220423.bb
+++ b/meta/recipes-core/ncurses/ncurses_6.3+20220423.bb
@@ -7,6 +7,7 @@ SRC_URI += "file://0001-tic-hang.patch \
file://CVE-2023-50495.patch \
file://CVE-2023-45918.patch \
file://CVE-2025-6141.patch \
+ file://0005-cpp.patch \
"
# commit id corresponds to the revision in package version
SRCREV = "a0bc708bc6954b5d3c0a38d92b683c3ec3135260"
diff --git a/meta/recipes-core/readline/readline.inc b/meta/recipes-core/readline/readline.inc
index 7f2f1a0..f3958b1 100644
--- a/meta/recipes-core/readline/readline.inc
+++ b/meta/recipes-core/readline/readline.inc
@@ -18,7 +18,7 @@ SRC_URI += "file://inputrc"
inherit autotools texinfo
EXTRA_AUTORECONF += "--exclude=autoheader"
-EXTRA_OECONF += "bash_cv_termcap_lib=ncurses"
+EXTRA_OECONF += "bash_cv_termcap_lib=ncurses CFLAGS=-std=gnu11"
LEAD_SONAME = "libreadline.so"
diff --git a/meta/recipes-devtools/createrepo-c/createrepo-c_0.19.0.bb b/meta/recipes-devtools/createrepo-c/createrepo-c_0.19.0.bb
index 8235125..87f1368 100644
--- a/meta/recipes-devtools/createrepo-c/createrepo-c_0.19.0.bb
+++ b/meta/recipes-devtools/createrepo-c/createrepo-c_0.19.0.bb
@@ -21,6 +21,8 @@ EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIR
BBCLASSEXTEND = "native nativesdk"
+CFLAGS:append = " -Wno-error=incompatible-pointer-types "
+
# Direct createrepo to read rpm configuration from our sysroot, not the one it was compiled in
do_install:append:class-native() {
create_wrapper ${D}/${bindir}/createrepo_c \
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb
index 68c620c..e7690d9 100644
--- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.46.5.bb
@@ -17,7 +17,8 @@ UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+\.\d+(\.\d+)*)$"
EXTRA_OECONF += "--libdir=${base_libdir} --sbindir=${base_sbindir} \
--enable-elf-shlibs --disable-libuuid --disable-uuidd \
--disable-libblkid --enable-verbose-makecmds \
- --with-crond-dir=no"
+ --with-crond-dir=no \
+ CFLAGS=-std=gnu11 "
EXTRA_OECONF:darwin = "--libdir=${base_libdir} --sbindir=${base_sbindir} --enable-bsd-shlibs"
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.186.bb b/meta/recipes-devtools/elfutils/elfutils_0.186.bb
index b945766..a945374 100644
--- a/meta/recipes-devtools/elfutils/elfutils_0.186.bb
+++ b/meta/recipes-devtools/elfutils/elfutils_0.186.bb
@@ -25,6 +25,7 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \
file://0001-debuginfod-debuginfod-client.c-use-long-for-cache-ti.patch \
file://CVE-2025-1352.patch \
file://CVE-2025-1372.patch \
+ file://0010-arraysize.patch \
"
SRC_URI:append:libc-musl = " \
file://0003-musl-utils.patch \
diff --git a/meta/recipes-devtools/elfutils/files/0010-arraysize.patch b/meta/recipes-devtools/elfutils/files/0010-arraysize.patch
new file mode 100644
index 0000000..6d67a68
--- /dev/null
+++ b/meta/recipes-devtools/elfutils/files/0010-arraysize.patch
@@ -0,0 +1,26 @@
+diff --git a/backends/i386_regs.c b/backends/i386_regs.c
+index 7ec93bb..4bca1b1 100644
+--- a/backends/i386_regs.c
++++ b/backends/i386_regs.c
+@@ -83,7 +83,7 @@ i386_register_info (Ebl *ebl __attribute__ ((unused)),
+
+ switch (regno)
+ {
+- static const char baseregs[][2] =
++ static const char baseregs[][3] =
+ {
+ "ax", "cx", "dx", "bx", "sp", "bp", "si", "di", "ip"
+ };
+diff --git a/backends/x86_64_regs.c b/backends/x86_64_regs.c
+index ef987da..b68bcf7 100644
+--- a/backends/x86_64_regs.c
++++ b/backends/x86_64_regs.c
+@@ -80,7 +80,7 @@ x86_64_register_info (Ebl *ebl __attribute__ ((unused)),
+
+ switch (regno)
+ {
+- static const char baseregs[][2] =
++ static const char baseregs[][4] =
+ {
+ "ax", "dx", "cx", "bx", "si", "di", "bp", "sp"
+ };
diff --git a/meta/recipes-devtools/libcomps/libcomps_0.1.18.bb b/meta/recipes-devtools/libcomps/libcomps_0.1.18.bb
index dd0a1f8..ce644af 100644
--- a/meta/recipes-devtools/libcomps/libcomps_0.1.18.bb
+++ b/meta/recipes-devtools/libcomps/libcomps_0.1.18.bb
@@ -19,5 +19,7 @@ DEPENDS += "libxml2 expat libcheck"
EXTRA_OECMAKE = " -DPYTHON_INSTALL_DIR=${PYTHON_SITEPACKAGES_DIR} -DPYTHON_DESIRED=3"
OECMAKE_SOURCEPATH = "${S}/libcomps"
+CFLAGS:append = " -Wno-error=incompatible-pointer-types "
+
BBCLASSEXTEND = "native nativesdk"
diff --git a/meta/recipes-devtools/m4/m4-1.4.19.inc b/meta/recipes-devtools/m4/m4-1.4.19.inc
index 2adf4de..f6d6166 100644
--- a/meta/recipes-devtools/m4/m4-1.4.19.inc
+++ b/meta/recipes-devtools/m4/m4-1.4.19.inc
@@ -9,6 +9,7 @@ inherit autotools texinfo ptest gettext
SRC_URI = "${GNU_MIRROR}/m4/m4-${PV}.tar.gz \
file://ac_config_links.patch \
file://0001-sigsegv-Fix-build-on-ppc-musl.patch \
+ file://c11.patch \
"
SRC_URI:append:class-target = " file://run-ptest \
file://serial-tests-config.patch \
@@ -25,7 +26,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=1ebbd3e34237af26da5dc08a4e440464\
# Fix "Argument list too long" error when len(TMPDIR) = 410
acpaths = "-I ./m4"
-EXTRA_OECONF += "--without-libsigsegv-prefix"
+EXTRA_OECONF += "--without-libsigsegv-prefix "
EXTRA_OEMAKE += "'infodir=${infodir}'"
diff --git a/meta/recipes-devtools/m4/m4/c11.patch b/meta/recipes-devtools/m4/m4/c11.patch
new file mode 100644
index 0000000..4bc58aa
--- /dev/null
+++ b/meta/recipes-devtools/m4/m4/c11.patch
@@ -0,0 +1,33 @@
+diff --git a/configure b/configure
+index f5a428f..5c86afd 100755
+--- a/configure
++++ b/configure
+@@ -6111,18 +6111,23 @@ fi
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+ printf "%s\n" "$ac_cv_prog_cc_g" >&6; }
+ if test $ac_test_CFLAGS; then
+- CFLAGS=$ac_save_CFLAGS
++ CFLAGS="${ac_save_CFLAGS} -std=gnu11"
++ echo "##### passed ${LINENO}"
+ elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+- CFLAGS="-g -O2"
++ CFLAGS="-g -O2 -std=gnu11"
++ echo "##### passed ${LINENO}"
+ else
+- CFLAGS="-g"
++ CFLAGS="-g -std=gnu11"
++ echo "##### passed ${LINENO}"
+ fi
+ else
+ if test "$GCC" = yes; then
+- CFLAGS="-O2"
++ CFLAGS="-O2 -std=gnu11"
++ echo "##### passed ${LINENO}"
+ else
+- CFLAGS=
++ CFLAGS="-std=gnu11"
++ echo "##### passed ${LINENO}"
+ fi
+ fi
+ ac_prog_cc_stdc=no
diff --git a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
index 7e5860c..98fb2cd 100644
--- a/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
+++ b/meta/recipes-devtools/pkgconfig/pkgconfig_git.bb
@@ -27,6 +27,7 @@ inherit autotools
# so just continue that behaviour.
#
EXTRA_OECONF += "--disable-indirect-deps"
+CFLAGS:append += "-std=gnu11 -Wno-error=unused-result"
PACKAGECONFIG ??= "glib"
PACKAGECONFIG:class-native = ""
diff --git a/meta/recipes-devtools/rust/rust-llvm.inc b/meta/recipes-devtools/rust/rust-llvm.inc
index 416a07c..05b7238 100644
--- a/meta/recipes-devtools/rust/rust-llvm.inc
+++ b/meta/recipes-devtools/rust/rust-llvm.inc
@@ -5,6 +5,7 @@ HOMEPAGE = "http://www.rust-lang.org"
SRC_URI += "file://0002-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \
file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \
file://0003-Support-Add-missing-cstdint-header-to-Signals.h.patch;striplevel=2 \
+ file://0010-cstdint.patch;striplevel=2 \
"
S = "${RUSTSRC}/src/llvm-project/llvm"
diff --git a/meta/recipes-devtools/rust/rust-llvm/0010-cstdint.patch b/meta/recipes-devtools/rust/rust-llvm/0010-cstdint.patch
new file mode 100644
index 0000000..ecc9878
--- /dev/null
+++ b/meta/recipes-devtools/rust/rust-llvm/0010-cstdint.patch
@@ -0,0 +1,24 @@
+diff --git a/llvm/include/llvm/ADT/SmallVector.h b/llvm/include/llvm/ADT/SmallVector.h
+index b8a11030f..18419a19d 100644
+--- a/llvm/include/llvm/ADT/SmallVector.h
++++ b/llvm/include/llvm/ADT/SmallVector.h
+@@ -28,6 +28,7 @@
+ #include <iterator>
+ #include <limits>
+ #include <memory>
++#include <cstdint>
+ #include <new>
+ #include <type_traits>
+ #include <utility>
+diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h b/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h
+index 35604cd3e..238a6ea55 100644
+--- a/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h
++++ b/llvm/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h
+@@ -15,6 +15,7 @@
+
+ #include <memory>
+ #include <string>
++#include <cstdint>
+
+ namespace llvm {
+ class formatted_raw_ostream;
diff --git a/meta/recipes-devtools/unifdef/unifdef_2.12.bb b/meta/recipes-devtools/unifdef/unifdef_2.12.bb
index b42051b..ec51a90 100644
--- a/meta/recipes-devtools/unifdef/unifdef_2.12.bb
+++ b/meta/recipes-devtools/unifdef/unifdef_2.12.bb
@@ -12,6 +12,8 @@ SRC_URI = "http://dotat.at/prog/${BPN}/${BP}.tar.xz"
SRC_URI[md5sum] = "ae8c0b3b4c43c1f6bc5f32412a820818"
SRC_URI[sha256sum] = "43ce0f02ecdcdc723b2475575563ddb192e988c886d368260bc0a63aee3ac400"
+CFLAGS:append = " -std=gnu11 "
+
UPSTREAM_CHECK_REGEX = "unifdef-(?P<pver>((\d+\.*)+)(?![a-f0-9]{6,})).tar"
do_install() {
diff --git a/meta/recipes-extended/bash/bash.inc b/meta/recipes-extended/bash/bash.inc
index 18874a0..6769b9c 100644
--- a/meta/recipes-extended/bash/bash.inc
+++ b/meta/recipes-extended/bash/bash.inc
@@ -8,7 +8,8 @@ DEPENDS = "ncurses bison-native virtual/libiconv"
inherit autotools gettext texinfo update-alternatives ptest
EXTRA_AUTORECONF += "--exclude=autoheader"
-EXTRA_OECONF = "--enable-job-control --without-bash-malloc bash_cv_wexitstatus_offset=8"
+EXTRA_OECONF = "--enable-job-control --without-bash-malloc bash_cv_wexitstatus_offset=8 CFLAGS=-std=gnu17"
+EXTRA_OEMAKE = " CFLAGS=-std=gnu17 CFLAGS_FOR_BUILD=-std=gnu17 "
# If NON_INTERACTIVE_LOGIN_SHELLS is defined, all login shells read the
# startup files, even if they are not interactive.
@@ -20,7 +21,7 @@ CFLAGS += "-DHEREDOC_PIPESIZE=65536"
# Disable bracketed paste mode by default (enabled by default in bash 5.1). It
# causes a lot of garbage in non-interactive shells
-CFLAGS += "-DBRACKETED_PASTE_DEFAULT=0"
+CFLAGS += "-DBRACKETED_PASTE_DEFAULT=0 -std=gnu17"
ALTERNATIVE:${PN} = "bash sh"
ALTERNATIVE_LINK_NAME[bash] = "${base_bindir}/bash"
diff --git a/meta/recipes-extended/bash/bash/0010-signal_names.patch b/meta/recipes-extended/bash/bash/0010-signal_names.patch
new file mode 100644
index 0000000..c9ce948
--- /dev/null
+++ b/meta/recipes-extended/bash/bash/0010-signal_names.patch
@@ -0,0 +1,16 @@
+diff --git a/support/signames.c b/support/signames.c
+index aba4842..40f5efc 100644
+--- a/support/signames.c
++++ b/support/signames.c
+@@ -44,7 +44,11 @@
+ */
+ #define LASTSIG NSIG+2
+
++#ifdef BUILDTOOL
+ char *signal_names[2 * (LASTSIG)];
++#else
++extern char *signal_names[2 * (LASTSIG)];
++#endif
+
+ #define signal_names_size (sizeof(signal_names)/sizeof(signal_names[0]))
+
diff --git a/meta/recipes-extended/bash/bash_5.1.16.bb b/meta/recipes-extended/bash/bash_5.1.16.bb
index ab1ecff..5535e30 100644
--- a/meta/recipes-extended/bash/bash_5.1.16.bb
+++ b/meta/recipes-extended/bash/bash_5.1.16.bb
@@ -17,8 +17,11 @@ SRC_URI = "${GNU_MIRROR}/bash/${BP}.tar.gz;name=tarball \
file://makerace2.patch \
file://CVE-2022-3715.patch \
file://0001-changes-to-SIGINT-handler-while-waiting-for-a-child-.patch \
+ file://0010-signal_names.patch \
"
+EXTRA_OEMAKE:append = " CFLAGS=-std=gnu17 "
+
SRC_URI[tarball.sha256sum] = "5bac17218d3911834520dad13cd1f85ab944e1c09ae1aba55906be1f8192f558"
DEBUG_OPTIMIZATION:append:armv4 = " ${@bb.utils.contains('TUNE_CCARGS', '-mthumb', '-fomit-frame-pointer', '', d)}"
diff --git a/meta/recipes-extended/libtirpc/libtirpc_1.3.2.bb b/meta/recipes-extended/libtirpc/libtirpc_1.3.2.bb
index 6980135..82392d9 100644
--- a/meta/recipes-extended/libtirpc/libtirpc_1.3.2.bb
+++ b/meta/recipes-extended/libtirpc/libtirpc_1.3.2.bb
@@ -20,6 +20,10 @@ inherit autotools pkgconfig
EXTRA_OECONF = "--disable-gssapi"
+do_configure:prepend() {
+ export CFLAGS="${CFLAGS} -std=gnu11 "
+}
+
do_install:append() {
test -e ${D}${sysconfdir}/netconfig && chown root:root ${D}${sysconfdir}/netconfig
}
diff --git a/meta/recipes-extended/unzip/unzip/c11.patch b/meta/recipes-extended/unzip/unzip/c11.patch
new file mode 100644
index 0000000..7f657f3
--- /dev/null
+++ b/meta/recipes-extended/unzip/unzip/c11.patch
@@ -0,0 +1,13 @@
+diff --git a/unix/Makefile b/unix/Makefile
+index f09647e..dce97c3 100644
+--- a/unix/Makefile
++++ b/unix/Makefile
+@@ -47,7 +47,7 @@ LD = $(CC)# must match, else "unresolved symbol: ___main" is possible)
+ AS = as
+ LOC = $(D_USE_BZ2) $(LOCAL_UNZIP)
+ AF = $(LOC)
+-CFLAGS =
++CFLAGS = -std=gnu11
+ CF_NOOPT = -I. -I$(IZ_BZIP2) -DUNIX $(LOC)
+ CF = $(CFLAGS) $(CF_NOOPT)
+ LFLAGS1 =
diff --git a/meta/recipes-extended/unzip/unzip_6.0.bb b/meta/recipes-extended/unzip/unzip_6.0.bb
index 0f73cfa..9c25059 100644
--- a/meta/recipes-extended/unzip/unzip_6.0.bb
+++ b/meta/recipes-extended/unzip/unzip_6.0.bb
@@ -33,6 +33,7 @@ SRC_URI = "${SOURCEFORGE_MIRROR}/infozip/UnZip%206.x%20%28latest%29/UnZip%206.0/
file://CVE-2022-0530.patch \
file://0001-unix-configure-fix-detection-for-cross-compilation.patch \
file://0001-configure-Add-correct-system-headers-and-prototypes-.patch \
+ file://c11.patch \
"
UPSTREAM_VERSION_UNKNOWN = "1"
@@ -52,7 +53,7 @@ S = "${WORKDIR}/unzip60"
# configure to be -O3.
#
EXTRA_OEMAKE = "-e MAKEFLAGS= STRIP=true LF2='' \
- 'CF_NOOPT=-I. -Ibzip2 -DUNIX ${CFLAGS}'"
+ 'CF_NOOPT=-I. -Ibzip2 -std=gnu11 -DUNIX ${CFLAGS} -std=gnu11'"
export LD = "${CC}"
LD:class-native = "${CC}"
diff --git a/meta/recipes-support/gdbm/gdbm_1.23.bb b/meta/recipes-support/gdbm/gdbm_1.23.bb
index a080797..efeab55 100644
--- a/meta/recipes-support/gdbm/gdbm_1.23.bb
+++ b/meta/recipes-support/gdbm/gdbm_1.23.bb
@@ -19,6 +19,7 @@ inherit autotools gettext texinfo lib_package ptest
# Needed for dbm python module
EXTRA_OECONF = "--enable-libgdbm-compat --without-readline"
+CFLAGS:append += "-std=gnu11"
# Stop presence of dbm/nbdm on the host contaminating builds
CACHED_CONFIGUREVARS += "ac_cv_lib_ndbm_main=no ac_cv_lib_dbm_main=no"
diff --git a/meta/recipes-support/gmp/gmp/c11.patch b/meta/recipes-support/gmp/gmp/c11.patch
new file mode 100644
index 0000000..290b6fc
--- /dev/null
+++ b/meta/recipes-support/gmp/gmp/c11.patch
@@ -0,0 +1,15 @@
+diff --git a/configure.ac b/configure.ac
+index 5f5f594..93cd658 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -461,8 +461,8 @@ abilist="standard"
+ #
+ cclist="gcc cc"
+
+-gcc_cflags="-O2 -pedantic"
+-gcc_64_cflags="-O2 -pedantic"
++gcc_cflags="-O2 -pedantic -std=gnu17"
++gcc_64_cflags="-O2 -pedantic -std=gnu17"
+ cc_cflags="-O"
+ cc_64_cflags="-O"
+
diff --git a/meta/recipes-support/gmp/gmp_6.2.1.bb b/meta/recipes-support/gmp/gmp_6.2.1.bb
index 2905549..ab2e22e 100644
--- a/meta/recipes-support/gmp/gmp_6.2.1.bb
+++ b/meta/recipes-support/gmp/gmp_6.2.1.bb
@@ -15,6 +15,7 @@ SRC_URI = "https://gmplib.org/download/${BPN}/${BP}${REVISION}.tar.bz2 \
file://0001-Append-the-user-provided-flags-to-the-auto-detected-.patch \
file://0001-confiure.ac-Believe-the-cflags-from-environment.patch \
file://cve-2021-43618.patch \
+ file://c11.patch \
"
SRC_URI[md5sum] = "28971fc21cf028042d4897f02fd355ea"
SRC_URI[sha256sum] = "eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c"
diff --git a/meta/recipes-support/gnutls/gnutls_3.7.4.bb b/meta/recipes-support/gnutls/gnutls_3.7.4.bb
index 8c8e088..566af3b 100644
--- a/meta/recipes-support/gnutls/gnutls_3.7.4.bb
+++ b/meta/recipes-support/gnutls/gnutls_3.7.4.bb
@@ -68,6 +68,7 @@ EXTRA_OECONF = " \
# Otherwise the tools try and use HOSTTOOLS_DIR/bash as a shell.
export POSIX_SHELL="${base_bindir}/sh"
+EXTRA_OEMAKE = "CFLAGS=-std=gnu17"
LDFLAGS:append:libc-musl = " -largp"
do_configure:prepend() {
diff --git a/meta/recipes-support/libgpg-error/libgpg-error_1.44.bb b/meta/recipes-support/libgpg-error/libgpg-error_1.44.bb
index 41adad0..3841f51 100644
--- a/meta/recipes-support/libgpg-error/libgpg-error_1.44.bb
+++ b/meta/recipes-support/libgpg-error/libgpg-error_1.44.bb
@@ -27,6 +27,7 @@ inherit autotools binconfig-disabled pkgconfig gettext multilib_header multilib_
MULTILIB_SCRIPTS = "${PN}-dev:${bindir}/gpgrt-config"
+EXTRA_OEMAKE = "CFLAGS=-std=gnu17"
CPPFLAGS += "-P"
do_install:append() {
ビルド
おまじない
. oe-init-build-env
# 自動でbuildディレクトリに移動する
conf/bblayers.confの修正
ros関連の追加
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
BBLAYERS ?= " \
${TOPDIR}/../meta \
${TOPDIR}/../meta-poky \
${TOPDIR}/../meta-yocto-bsp \
${TOPDIR}/../meta-openembedded/meta-oe \
${TOPDIR}/../meta-openembedded/meta-python \
${TOPDIR}/../meta-ros/meta-ros-common \
${TOPDIR}/../meta-ros/meta-ros2 \
${TOPDIR}/../meta-ros/meta-ros2-humble \
"
conf/local.conf の修正
コメント除外すると以下
MACHINE 指定と ros関連の追加
MACHINE ?= "qemuarm64"
DISTRO ?= "poky"
PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES ?= "debug-tweaks"
USER_CLASSES ?= "buildstats"
PATCHRESOLVE = "noop"
BB_DISKMON_DIRS ??= "\
STOPTASKS,${TMPDIR},1G,100K \
STOPTASKS,${DL_DIR},1G,100K \
STOPTASKS,${SSTATE_DIR},1G,100K \
STOPTASKS,/tmp,100M,100K \
HALT,${TMPDIR},100M,1K \
HALT,${DL_DIR},100M,1K \
HALT,${SSTATE_DIR},100M,1K \
HALT,/tmp,10M,1K"
PACKAGECONFIG:append:pn-qemu-system-native = " sdl"
CONF_VERSION = "2"
BB_NUMBER_THREADS ?= "8"
PARALLEL_MAKE ?= "-j8"
IMAGE_INSTALL:append = " ros-core"
ROS_DISTRO = "humble"
ビルド実行
bitbake ros-image-core
実行
runqemu qemuarm64 ros-image-core-humble ext4
こんな出力
runqemu - INFO - Running MACHINE=qemuarm64 bitbake -e ...
runqemu - INFO - Continuing with the following parameters:
KERNEL: [/home/tyano/workspace/yocto/poky/build/tmp/deploy/images/qemuarm64/Image]
MACHINE: [qemuarm64]
FSTYPE: [ext4]
ROOTFS: [/home/tyano/workspace/yocto/poky/build/tmp/deploy/images/qemuarm64/ros-image-core-humble-qemuarm64.ext4]
CONFFILE: [/home/tyano/workspace/yocto/poky/build/tmp/deploy/images/qemuarm64/ros-image-core-humble-qemuarm64.qemuboot.conf]
runqemu - INFO - Setting up tap interface under sudo
runqemu - INFO - Network configuration: ip=192.168.7.2::192.168.7.1:255.255.255.0::eth0:off:8.8.8.8
runqemu - INFO - Running /home/tyano/workspace/yocto/poky/build/tmp/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin/qemu-system-aarch64 -device virtio-net-pci,netdev=net0,mac=52:54:00:12:34:02 -netdev tap,id=net0,ifname=tap0,script=no,downscript=no -object rng-random,filename=/dev/urandom,id=rng0 -device virtio-rng-pci,rng=rng0 -drive id=disk0,file=/home/tyano/workspace/yocto/poky/build/tmp/deploy/images/qemuarm64/ros-image-core-humble-qemuarm64.ext4,if=none,format=raw -device virtio-blk-pci,drive=disk0 -device qemu-xhci -device usb-tablet -device usb-kbd -machine virt -cpu cortex-a57 -smp 4 -m 256 -serial mon:vc -serial null -display sdl,show-cursor=on -device virtio-gpu-pci -kernel /home/tyano/workspace/yocto/poky/build/tmp/deploy/images/qemuarm64/Image -append 'root=/dev/vda rw mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0::eth0:off:8.8.8.8 '
runqemu - INFO - Host uptime: 563693.25
もの自体はあるので設定は追々
追記 しました
ros2の設定
追加インストール
作業しやすいように以下を追加する
- sshd
- bash
conf/local.conf の IMAGE_INSTALL:append を修正する
IMAGE_INSTALL:append = " ros-core openssh bash "
もう一回ビルドして実行
bitbake ros-image-core
runqemu qemuarm64 ros-image-core-humble ext4
サンプル作成
qemuが起動したら 一般ユーザを adduser で作成する
ホストから sshで接続する
ssh 192.168.7.2
送信側の作成
publisher.py
#!/usr/bin/env python3
import rclpy
from std_msgs.msg import String
rclpy.init()
node = rclpy.create_node('minimal_publisher')
pub = node.create_publisher(String, 'chatter', 10)
i = 0
while rclpy.ok():
msg = String()
msg.data = f'Hello {i}'
pub.publish(msg)
node.get_logger().info(msg.data)
i += 1
rclpy.spin_once(node, timeout_sec=1.0)
受信側の作成
subscriber.py
#!/usr/bin/env python3
import rclpy
from std_msgs.msg import String
rclpy.init()
node = rclpy.create_node('minimal_subscriber')
def callback(msg):
node.get_logger().info(f'I heard: {msg.data}')
sub = node.create_subscription(String, 'chatter', callback, 10)
while rclpy.ok():
rclpy.spin_once(node, timeout_sec=1.0)
サンプル実行
qemu上を一つ使うかsshを2本つなげるなどしてターミナルを2つ用意する
# 作成したユーザに切り替え
su tyano
# yoctoのデフォルトはbusyboxなのでbash に切り替える
bash
# 環境設定
. /opt/ros/humble/setup.bash
# 送信側はこれを実行
python3 publisher.py
# 受信側はこれを実行
python3 subscriber.py
こんな感じで表示されます
qemuarm64:~$ python3 subscriber.py
[INFO] [1762743437.520687936] [minimal_subscriber]: I heard: Hello 5
[INFO] [1762743437.906498448] [minimal_subscriber]: I heard: Hello 6
[INFO] [1762743439.044557648] [minimal_subscriber]: I heard: Hello 7
[INFO] [1762743440.164722192] [minimal_subscriber]: I heard: Hello 8
[INFO] [1762743441.330913200] [minimal_subscriber]: I heard: Hello 9
[INFO] [1762743442.422331264] [minimal_subscriber]: I heard: Hello 10
[INFO] [1762743443.636326432] [minimal_subscriber]: I heard: Hello 11
[INFO] [1762743444.733855168] [minimal_subscriber]: I heard: Hello 12
[INFO] [1762743445.874569632] [minimal_subscriber]: I heard: Hello 13
[INFO] [1762743447.020346928] [minimal_subscriber]: I heard: Hello 14
[INFO] [1762743448.206775920] [minimal_subscriber]: I heard: Hello 15
その他
ビルドに必要な最低容量は50Gくらいです

