Skip to content

Commit 15ca564

Browse files
Warn about Windows incompatibility in build and docs
Windows can't run the signing script, nor does it normally have OpenSSL installed. When trying to build an automatically signed binary, warn and don't run the python.
1 parent 30e9d9b commit 15ca564

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

Diff for: doc/ota_updates/readme.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ Signing requires the generation of an RSA-2048 key (other bit lengths are suppor
7575
openssl genrsa -out private.key 2048
7676
openssl rsa -in private.key -outform PEM -pubout -out public.key
7777
78-
Automatic Signing
79-
^^^^^^^^^^^^^^^^^
78+
Automatic Signing -- Only available on Linux and Mac
79+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
8080

81-
The simplest way of implementing signing is to use the automatic mode. This mode uses the IDE to configure the source code to enable sigining verification with a given public key, and signs binaries as part of the standard build process using a given public key.
81+
The simplest way of implementing signing is to use the automatic mode, which is only possible on Linux and Mac presently due to missing tools under Windows. This mode uses the IDE to configure the source code to enable sigining verification with a given public key, and signs binaries as part of the standard build process using a given public key.
8282

8383
To enable this mode, just include `private.key` and `public.key` in the sketch `.ino` directory. The IDE will call a helper script (`tools/signing.py`) before the build begins to create a header to enable key validation using the given public key, and after the build process to actually do the signing, generating a `sketch.bin.signed` file. When OTA is enabled (ArduinoOTA, Web, or HTTP) the binary will only accept signed updates automatically.
8484

Diff for: libraries/ESP8266httpUpdate/examples/httpUpdateSigned/httpUpdateSigned.ino

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
httpUpdateSigned.ino - Earle F. Philhower, III
33
Released into the Public Domain
44
5+
For use while building under Linux or Mac.
6+
7+
Automatic code signing is not supported on Windows, so this example
8+
DOES NOT WORK UNDER WINDOWS.
9+
510
Shows how to use a public key extracted from your private certificate to
611
only allow updates that you have signed to be applied over HTTP. Remote
712
updates will require your private key to sign them, but of course

Diff for: platform.txt

+6-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ recipe.hooks.core.prebuild.3.pattern="{runtime.tools.signing}" --mode header --p
7979

8080
## windows-compatible version without git
8181
recipe.hooks.core.prebuild.1.pattern.windows=cmd.exe /c mkdir {build.path}\core & (echo #define ARDUINO_ESP8266_GIT_VER 0x00000000 & echo #define ARDUINO_ESP8266_GIT_DESC win-{version} ) > {build.path}\core\core_version.h
82-
recipe.hooks.core.prebuild.2.pattern.windows=
82+
recipe.hooks.core.prebuild.2.pattern.windows=cmd.exe /c if exist {build.source.path}\public.key echo #error Cannot automatically build signed binaries on Windows > {build.path}\core\Updater_Signing.h
83+
recipe.hooks.core.prebuild.3.pattern.windows=
8384

8485
## Build the app.ld linker file
8586
recipe.hooks.linking.prelink.1.pattern="{compiler.path}{compiler.c.cmd}" -CC -E -P {build.vtable_flags} "{runtime.platform.path}/tools/sdk/ld/eagle.app.v6.common.ld.h" -o "{build.path}/local.eagle.app.v6.common.ld"
@@ -108,6 +109,10 @@ recipe.objcopy.eep.pattern=
108109
recipe.objcopy.hex.1.pattern="{runtime.tools.esptool.path}/{compiler.esptool.cmd}" -eo "{runtime.platform.path}/bootloaders/eboot/eboot.elf" -bo "{build.path}/{build.project_name}.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bp 4096 -ec -eo "{build.path}/{build.project_name}.elf" -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec
109110
recipe.objcopy.hex.2.pattern="{runtime.tools.signing}" --mode sign --privatekey "{build.source.path}/private.key" --bin "{build.path}/{build.project_name}.bin" --out "{build.path}/{build.project_name}.bin.signed"
110111

112+
# No signing on Windows
113+
recipe.objcopy.hex.1.pattern.windows="{runtime.tools.esptool.path}/{compiler.esptool.cmd}" -eo "{runtime.platform.path}/bootloaders/eboot/eboot.elf" -bo "{build.path}/{build.project_name}.bin" -bm {build.flash_mode} -bf {build.flash_freq} -bz {build.flash_size} -bs .text -bp 4096 -ec -eo "{build.path}/{build.project_name}.elf" -bs .irom0.text -bs .text -bs .data -bs .rodata -bc -ec
114+
recipe.objcopy.hex.2.pattern.windows=
115+
111116
## Save hex
112117
recipe.output.tmp_file={build.project_name}.bin
113118
recipe.output.save_file={build.project_name}.{build.variant}.bin

0 commit comments

Comments
 (0)