"Integrated handling for filesystem and gzipped Binaries" (Restart with fresh Fork) #8338
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
ATENTION: This is tested on Linux only! See below for open questions/prerequisites.
Currently there are some manual steps necessary to prepare the files necessary for OTA updates (especially for ESP8266HTTPUpdateServer)
The steps are:
Compile the sketch
Export the generated sketch-binary
Generate the filesystem
Export the fs-binary
Generate gzipped versions of binaries
Generate signed versions of gzipped binaries
Which of the above steps are necessary depends on the sketch (does it use a fs?) and the kind of OTA chosen (signed binaries necessary?) or preferred usage (use of gzipped binaries for faster upload?).
There are some problems/inconveniences:
2. The signed sketch-binary is not exported when using "Export compiled Binary".
(This point will be solved with my Pull-Request #8255)
3. & 4. AFAIK, the only “integrated” way to generate the fs is using one of the tools:
“arduino-esp8266littlefs-plugin” or “arduino-esp8266fs-plugin”.
Both tools are designed to create & upload the fs, but not export them.
So if preparing the files for an OTA when no board is connected, you have to:
ignore errors shown because upload is not possible
find & navigate to the “build.path” and copy the fs-binary manually
& 6. AFAIK, there is no “integrated” way to perform these steps.
This Pull-Request will integrate all of the above steps into the “compile and/or upload” action of Arduino.
This is done by adding 3 new entries (“Upload”, "Filesystem" and "Export") to the tools-menu.
These entries are presented just like any other options for esp8266 (“Upload speed” ... “Non-32-Bit Access”) and placed right after the last.
Below is the text that is already integrated into "doc/filesystem.rst"
--- schnipp ---
Menu-Entry “Upload” lets You choose between:
This Menu controls which parts are uploaded when "Sketch->Upload" (Ctrl-U)
is selected from the Arduino Menu.
Menu-Entry “Filesystem” lets You choose between:
This Menu controls which Fs will be created when "Sketch->Compile" (Ctrl-R)
is selected from the Arduino Menu. The Fs will always be created inside the
"export" dir (see below).
Menu-Entry “Export” lets You choose between:
This Menu controls export & generation of (extra) Sketch-Binaries.
The "export" dir
................
After a (successful) compile, the files will be exported to a subdir
“bin/{variant}” of Your sketch directory
(“{variant}” replaced with the name of the board as shown behind
“Tools -> Board:”).
Signed variants of all Binaries are generated similar to the
“automatic signing” done for normal sketch binary.
As valid for the "old" tools mentioned below, it is nessesary to place
files you want to be inside the generated file system into a directory
named
data
inside Your sketch directory.--- schnapp ---
Open questions/prerequisites:
As stated above I had tested this on Linux only.
Hopefully some cant test it under windows..
tkinter should be available.
if it is not, and creating of fs is requested AND the data dir is empty, I didn't know how to ask the user: “Are you sure you want to create an empty ... image?”.
So in this case a message is given and the fs will not be created.
(So its not a real problem if tkinter isn't installed)
An additional question for developers:
As mentioned inside function main of “postbuild.py”, there is a strange behavior of the arg "{build.path}" supplied via “platform.txt”. If someone can explain me why this “string” behave as described in the comments, I would be happy ;-)