From: Abilio Marques <abiliojr@gmail.com>
To: buildroot@buildroot.org
Cc: Chris Packham <judge.packham@gmail.com>,
"Yann E . MORIN" <yann.morin.1998@free.fr>,
Abilio Marques <abiliojr@gmail.com>
Subject: [Buildroot] [PATCH v2 1/1] package/micropython: add support for manifest.py in the configuration
Date: Sun, 11 Feb 2024 18:12:53 -0800 [thread overview]
Message-ID: <20240212021255.246556-1-abiliojr@gmail.com> (raw)
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
We only support freezing of modules from micropython-lib. Freezing
arbitrary modules would require some handling of absoulte paths, and
a guarantee that the files be available before micropython is built,
which is considered a bit too complex; an interested party can
provide such support in the future.
Signed-off-by: Abilio Marques <abiliojr@gmail.com>
---
package/micropython/Config.in | 17 +++++++++++++++++
package/micropython/micropython.mk | 5 +++++
2 files changed, 22 insertions(+)
diff --git a/package/micropython/Config.in b/package/micropython/Config.in
index 26a00baab0..6b99cfd2ff 100644
--- a/package/micropython/Config.in
+++ b/package/micropython/Config.in
@@ -17,6 +17,23 @@ config BR2_PACKAGE_MICROPYTHON_LIB
help
Core Python libraries ported to MicroPython.
+config BR2_PACKAGE_MICROPYTHON_MANIFEST
+ string "Path to a manifest.py file"
+ help
+ MicroPython allows Python code to be “frozen” as bytecode
+ into its binary, as an alternative to loading code from
+ the filesystem.
+
+ A list of "frozen" modules can be provided using a "manifest.py"
+ file. You can set the path to such file using this variable.
+
+ See MicroPython's documentation for more information on how to
+ use the file.
+
+ Note: in Buildroot, only modules provided with micropython-lib
+ can be frozen with a manifest; freezing arbitrary files is
+ currently not supported.
+
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 125a0edcfb..5a2c136547 100644
--- a/package/micropython/micropython.mk
+++ b/package/micropython/micropython.mk
@@ -43,6 +43,11 @@ else
MICROPYTHON_MAKE_OPTS += MICROPY_PY_FFI=0
endif
+ifneq ($(BR2_PACKAGE_MICROPYTHON_MANIFEST),"")
+MICROPYTHON_MAKE_OPTS += \
+ FROZEN_MANIFEST=$(BR2_PACKAGE_MICROPYTHON_MANIFEST)
+endif
+
define MICROPYTHON_BUILD_CMDS
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/mpy-cross
$(TARGET_MAKE_ENV) $(MAKE) -C $(@D)/ports/unix \
--
2.43.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next reply other threads:[~2024-02-12 2:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-12 2:12 Abilio Marques [this message]
2026-11-21 22:38 ` [Buildroot] [PATCH v3 1/2] package/micropython: add support for manifest.py in the configuration Angelo Compagnucci
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=20240212021255.246556-1-abiliojr@gmail.com \
--to=abiliojr@gmail.com \
--cc=buildroot@buildroot.org \
--cc=judge.packham@gmail.com \
--cc=yann.morin.1998@free.fr \
/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