Initial Commit
- initial default booting image
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
From fa60aaf200eb1e6d31124ac3e7631e9e5458d145 Mon Sep 17 00:00:00 2001
|
||||
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
Date: Sat, 8 Aug 2026 19:03:52 +0200
|
||||
Subject: [PATCH] src/snagrecover/utils.py: import compression modules when
|
||||
needed
|
||||
|
||||
Commit 4f98bdec5ebeb13d9f851f848c3bd0086ef31eeb ("snagflash: Support
|
||||
on-the-fly decompression of input files") has added unconditional
|
||||
imports of lzma, bz2 and gzip Python modules, even if compressed input
|
||||
files are not used.
|
||||
|
||||
Switch to dynamic imports where these modules are only imported
|
||||
on-demand. This allows to relax the need to have support for those
|
||||
modules in Python, which can be helpful in environments such as
|
||||
Buildroot where dependencies are kept to a minimum.
|
||||
|
||||
Upstream: https://github.com/bootlin/snagboot/pull/95
|
||||
[Thomas: upstream version is different as upstream master branch also
|
||||
supports zstd compression, which wasn't supported as of v2.6.1 of
|
||||
snagboot]
|
||||
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
|
||||
---
|
||||
src/snagrecover/utils.py | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/snagrecover/utils.py b/src/snagrecover/utils.py
|
||||
index 8d240f6..dfe7d23 100644
|
||||
--- a/src/snagrecover/utils.py
|
||||
+++ b/src/snagrecover/utils.py
|
||||
@@ -16,9 +16,7 @@ from snagrecover.usb import SnagbootUSBContext
|
||||
import yaml
|
||||
import importlib.resources
|
||||
|
||||
-import lzma
|
||||
-import bz2
|
||||
-import gzip
|
||||
+from math import ceil
|
||||
|
||||
USB_RETRIES = 9
|
||||
USB_INTERVAL = 1
|
||||
@@ -47,10 +45,13 @@ def open_compressed_file(path: str, mode):
|
||||
comp = get_compression_method(path)
|
||||
|
||||
if comp == "xz":
|
||||
+ import lzma
|
||||
file = lzma.open(path, mode)
|
||||
elif comp == "bz2":
|
||||
+ import bz2
|
||||
file = bz2.open(path, mode)
|
||||
elif comp == "gz":
|
||||
+ import gzip
|
||||
file = gzip.open(path, mode)
|
||||
else:
|
||||
return open(path, mode)
|
||||
--
|
||||
2.55.0
|
||||
|
||||
8
package/snagboot/Config.in.host
Normal file
8
package/snagboot/Config.in.host
Normal file
@@ -0,0 +1,8 @@
|
||||
config BR2_PACKAGE_HOST_SNAGBOOT
|
||||
bool "host snagboot"
|
||||
help
|
||||
Snagboot intends to be an open-source and generic
|
||||
replacement to the vendor-specific, sometimes proprietary,
|
||||
tools used to recover and/or reflash embedded platforms.
|
||||
|
||||
https://github.com/bootlin/snagboot/
|
||||
3
package/snagboot/snagboot.hash
Normal file
3
package/snagboot/snagboot.hash
Normal file
@@ -0,0 +1,3 @@
|
||||
# Locally calculated
|
||||
sha256 0b94184d9668c46cc2cf11002772ddb2fe06542f4f96cc6884342b5561d84b8d snagboot-2.6.1.tar.gz
|
||||
sha256 8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643 LICENSE
|
||||
29
package/snagboot/snagboot.mk
Normal file
29
package/snagboot/snagboot.mk
Normal file
@@ -0,0 +1,29 @@
|
||||
################################################################################
|
||||
#
|
||||
# snagboot
|
||||
#
|
||||
################################################################################
|
||||
|
||||
SNAGBOOT_VERSION = 2.6.1
|
||||
SNAGBOOT_SITE = $(call github,bootlin,snagboot,v$(SNAGBOOT_VERSION))
|
||||
SNAGBOOT_LICENSE = GPL-2.0
|
||||
SNAGBOOT_LICENSE_FILES = LICENSE
|
||||
SNAGBOOT_SETUP_TYPE = setuptools
|
||||
HOST_SNAGBOOT_DEPENDENCIES = \
|
||||
host-python-pyyaml \
|
||||
host-python-pyusb \
|
||||
host-python-serial \
|
||||
host-python-xmodem \
|
||||
host-python-tftpy \
|
||||
host-python-crccheck \
|
||||
host-python-pylibfdt \
|
||||
host-python-packaging \
|
||||
host-python-pyfatfs
|
||||
|
||||
# We do not install the dependencies for the snagfactory GUI
|
||||
define SNAGBOOT_REMOVE_SNAGFACTORY
|
||||
$(RM) $(HOST_DIR)/bin/snagfactory
|
||||
endef
|
||||
HOST_SNAGBOOT_POST_INSTALL_HOOKS += SNAGBOOT_REMOVE_SNAGFACTORY
|
||||
|
||||
$(eval $(host-python-package))
|
||||
Reference in New Issue
Block a user