Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Angelo Compagnucci <angelo.compagnucci@gmail.com>
To: buildroot@buildroot.org
Cc: Chris Packham <judge.packham@gmail.com>,
	Julien Olivain <ju.o@free.fr>,
	Abilio Marques <abiliojr@gmail.com>,
	"Yann E . MORIN" <yann.morin@orange.com>
Subject: [Buildroot] [PATCH v3 1/2] package/micropython: add support for manifest.py in the configuration
Date: Sat, 21 Nov 2026 23:38:23 +0100	[thread overview]
Message-ID: <20261121223824.420727-1-angelo.compagnucci@gmail.com> (raw)
In-Reply-To: <20240212021255.246556-1-abiliojr@gmail.com>

From: Abilio Marques <abiliojr@gmail.com>

Micropython can embed packages an modules as frozen bytecode. What code
gets built this way can be defined by means of a "manifest.py" file.

This commit exposes the variable FROZEN_MANIFEST to Buildroot users
through a new variable called BR2_PACKAGE_MICROPYTHON_MANIFEST.

Please check Micropython's documentation for more information:
https://docs.micropython.org/en/latest/reference/manifest.html

The build runs in ports/unix, so the path is made absolute. Paths in
the manifest are relative to its own directory: modules next to it can
be frozen too, not only the micropython-lib ones.

Signed-off-by: Abilio Marques <abiliojr@gmail.com>
Co-authored-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Tested-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
---
Changes v2 -> v3:
  - rebase on master
  - make the manifest path absolute, as the build runs in ports/unix:
    a path relative to the Buildroot directory didn't work
  - drop the note that only micropython-lib modules can be frozen:
    with an absolute path, modules next to the manifest work too
  - say in the help text that the manifest replaces the default one,
    and how to keep the default frozen modules
  - use qstrip to test the option, and fix the help text indent,
    trailing whitespace and quotes

Supersedes v2: https://patchwork.buildroot.org/project/buildroot/patch/20240212021255.246556-1-abiliojr@gmail.com/

 package/micropython/Config.in      | 13 +++++++++++++
 package/micropython/micropython.mk |  6 ++++++
 2 files changed, 19 insertions(+)

diff --git a/package/micropython/Config.in b/package/micropython/Config.in
index 6109e95109..290802b307 100644
--- a/package/micropython/Config.in
+++ b/package/micropython/Config.in
@@ -36,6 +36,19 @@ config BR2_PACKAGE_MICROPYTHON_LIB_UNIXFFI
 
 endif # BR2_PACKAGE_MICROPYTHON_LIB
 
+config BR2_PACKAGE_MICROPYTHON_MANIFEST
+	string "Path to a manifest.py file"
+	help
+	  Path to a manifest.py file, listing the Python modules to
+	  freeze as bytecode into the micropython binary. Modules next
+	  to the manifest and micropython-lib modules can be frozen.
+
+	  It replaces the default manifest of the unix port. To keep
+	  the default frozen modules, add this line to it:
+	  include("$(PORT_DIR)/variants/standard/manifest.py")
+
+	  https://docs.micropython.org/en/latest/reference/manifest.html
+
 endif # BR2_PACKAGE_MICROPYTHON
 
 comment "micropython needs a toolchain w/ threads, dynamic library"
diff --git a/package/micropython/micropython.mk b/package/micropython/micropython.mk
index e260b9fde8..553765165a 100644
--- a/package/micropython/micropython.mk
+++ b/package/micropython/micropython.mk
@@ -44,6 +44,12 @@ else
 MICROPYTHON_MAKE_OPTS += MICROPY_PY_FFI=0
 endif
 
+# The build runs in ports/unix: pass an absolute path to the manifest
+MICROPYTHON_MANIFEST = $(call qstrip,$(BR2_PACKAGE_MICROPYTHON_MANIFEST))
+ifneq ($(MICROPYTHON_MANIFEST),)
+MICROPYTHON_MAKE_OPTS += FROZEN_MANIFEST=$(abspath $(MICROPYTHON_MANIFEST))
+endif
+
 define MICROPYTHON_BUILD_CMDS
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/mpy-cross
 	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/ports/unix \
-- 
2.53.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2026-11-21 22:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-12  2:12 [Buildroot] [PATCH v2 1/1] package/micropython: add support for manifest.py in the configuration Abilio Marques
2026-11-21 22:38 ` Angelo Compagnucci [this message]
2026-11-21 22:38   ` [Buildroot] [PATCH v3 2/2] support/testing: add micropython manifest test Angelo Compagnucci

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261121223824.420727-1-angelo.compagnucci@gmail.com \
    --to=angelo.compagnucci@gmail.com \
    --cc=abiliojr@gmail.com \
    --cc=buildroot@buildroot.org \
    --cc=ju.o@free.fr \
    --cc=judge.packham@gmail.com \
    --cc=yann.morin@orange.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox