Skip to content

Commit ac3e3c8

Browse files
Lawrence NahumJamie C. Driver
authored andcommitted
build: use zopfli compression to reduce fw size by over 550 bytes
Update scripts to make smaller firmware/delta OTA images (~5%) Update docker image/debian
1 parent 741c5d6 commit ac3e3c8

19 files changed

+86
-10
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ stages:
77
- test
88
- deploy
99

10-
image: blockstream/verde@sha256:acd212ebeed9563cc0fdf7f94d03159adfb201342b03f5c0dbf3cc68f986e5a1
10+
image: blockstream/verde@sha256:391a4337c174f2eb47dc9f31d7e25d19a5f101bbc07fa8a296866c1ee52b8473
1111

1212
test_bip85_rsa_key_gen:
1313
tags:
@@ -57,6 +57,7 @@ test_configs:
5757
script:
5858
- . $HOME/esp/esp-idf/export.sh
5959
- idf.py all size-components size
60+
- source /venv/bin/activate
6061
- ./tools/fwprep.py build/jade.bin build
6162
- ./tools/mkindex.py build $(basename $(ls build/*_fw.bin) | cut -d'_' -f1)
6263
- cp sdkconfig build/

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
FROM debian:bookworm@sha256:b877a1a3fdf02469440f1768cf69c9771338a875b7add5e80c45b756c92ac20a AS base
2-
RUN dpkg --add-architecture i386 && apt-get update -qq && apt-get upgrade --no-install-recommends --no-install-suggests -yqq && apt-get install --no-install-recommends --no-install-suggests -yqq git wget libncurses-dev flex bison gperf libffi-dev libssl-dev dfu-util cmake ninja-build build-essential ca-certificates ccache curl make pkg-config python3 python3-dev python3-pip python3-setuptools python3-serial python3-click python3-cryptography python3-future python3-pyparsing python3-pyelftools python3-pkg-resources python3-wheel python3-venv python3-sphinx unzip bluez-tools bluez libusb-1.0-0 clang lld clang-format libglib2.0-dev libpixman-1-dev libgcrypt20-dev virtualenv libslirp-dev gcc-multilib libc6-dev-i386 libsdl2-dev:i386 && apt-get -yqq autoremove && apt-get -yqq clean && rm -rf /var/lib/apt/lists/* /var/cache/* /tmp/*
1+
FROM debian:bookworm@sha256:321341744acb788e251ebd374aecc1a42d60ce65da7bd4ee9207ff6be6686a62 AS base
2+
RUN dpkg --add-architecture i386 && apt-get update -qq && apt-get upgrade --no-install-recommends --no-install-suggests -yqq && apt-get install --no-install-recommends --no-install-suggests -yqq git wget libncurses-dev flex bison gperf libffi-dev libssl-dev dfu-util cmake ninja-build build-essential ca-certificates ccache curl make pkg-config python3 python3-dev python3-pip python3-setuptools python3-serial python3-click python3-cryptography python3-future python3-pyparsing python3-pyelftools python3-pkg-resources python3-wheel python3-venv python3-sphinx unzip bluez-tools bluez libusb-1.0-0 clang lld clang-format libglib2.0-dev libpixman-1-dev libgcrypt20-dev virtualenv libslirp-dev gcc-multilib libc6-dev-i386 libsdl2-dev:i386 libcurl4-openssl-dev:i386 && apt-get -yqq autoremove && apt-get -yqq clean && rm -rf /var/lib/apt/lists/* /var/cache/* /tmp/*
33
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 10
44
RUN python3 -m pip install --break-system-packages --user pycodestyle
55

Dockerfile.dev

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM blockstream/verde@sha256:acd212ebeed9563cc0fdf7f94d03159adfb201342b03f5c0dbf3cc68f986e5a1
1+
FROM blockstream/verde@sha256:391a4337c174f2eb47dc9f31d7e25d19a5f101bbc07fa8a296866c1ee52b8473
22

33
RUN echo "source /root/esp/esp-idf/export.sh" >> /etc/bash.bashrc
44

Dockerfile.qemu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM blockstream/verde@sha256:acd212ebeed9563cc0fdf7f94d03159adfb201342b03f5c0dbf3cc68f986e5a1 as builder
1+
FROM blockstream/verde@sha256:391a4337c174f2eb47dc9f31d7e25d19a5f101bbc07fa8a296866c1ee52b8473 as builder
22

33
ARG SDK_CONFIG=configs/sdkconfig_qemu_psram.defaults
44

@@ -12,7 +12,7 @@ RUN ./tools/fwprep.py build/jade.bin build
1212
ENV PATH=$PATH:/jade/main/qemu
1313
RUN make-flash-img.sh
1414

15-
FROM debian:bookworm@sha256:b877a1a3fdf02469440f1768cf69c9771338a875b7add5e80c45b756c92ac20a
15+
FROM debian:bookworm@sha256:321341744acb788e251ebd374aecc1a42d60ce65da7bd4ee9207ff6be6686a62
1616

1717
RUN apt-get update -yqq && apt-get install -yqq libpixman-1-dev libglib2.0-dev libslirp-dev libncurses-dev
1818

logo/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Files in this directory are compressed using python
22

33
```
4-
python -c "import zlib; import sys; open(sys.argv[2], 'wb').write(zlib.compress(open(sys.argv[1], 'rb').read(), 9))" uncompressed_file.bin compressed_file.bin.gz
4+
python -c "from zopfli import zlib; import sys; open(sys.argv[2], 'wb').write(zlib.compress(open(sys.argv[1], 'rb').read()))" uncompressed_file.bin compressed_file.bin.gz
55
```
66

77
# The input file used is the output of GIMP RGB C-Source image dump (file.c) which contains a stucture Picture.

logo/bmp_to_compressed_bgr565_byteswapped.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import zlib
1+
from zopfli import zlib
2+
23
import struct
34
from PIL import Image
45

@@ -28,7 +29,7 @@ def compress_to_bgr565(bmp_file):
2829

2930
data_len = data_len.to_bytes(2, 'little')
3031
compressed_data = bytes([width]) + data_len + swapped_data
31-
compressed_data = zlib.compress(compressed_data, level=9)
32+
compressed_data = zlib.compress(compressed_data)
3233
compressed_file = bmp_file.replace('.bmp', '.bin.gz')
3334
with open(compressed_file, "wb") as file:
3435
file.write(compressed_data)

logo/ce.bin.gz

-56 Bytes
Binary file not shown.

logo/fcc.bin.gz

-81 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)