Commit Graph

338 Commits

Author SHA1 Message Date
Fabio Utzig 5271b79151 Fix macro in comment
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-26 19:00:58 -06:00
Fabio Utzig 32d68f0c61 Fix names of Mynewt config options
Also documents config option to use PKCS#1 v1.5 as images generated by
newt.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-26 18:58:44 -06:00
Fabio Utzig 83e59291e2 Fix Slack's URL info
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-26 18:57:44 -06:00
Fabio Utzig 2e86e138a4 Add travis results to #builds channel in Slack
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-26 18:49:19 -06:00
David Brown 0d1b0b952e zephyr: Enable MPU flash writing
Recent Zephyr trees require this config option to be set in order to be
able to write to the flash device.  Without it, targets with an MPU
enabled will abort during startup, usually before even printing a
message to the UART.

Signed-off-by: David Brown <david.brown@linaro.org>
2017-07-26 18:42:29 -06:00
David Brown 84a67af32c zephyr: sample: Add flash for full.bin
Previous commits added the full.bin target.  Add a flash_full target to
be able to flash this full image for testing.

Signed-off-by: David Brown <david.brown@linaro.org>
2017-07-26 18:42:29 -06:00
Fabio Utzig 358c93553b Fix warning building with overwrite only
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-26 00:33:46 -06:00
Fabio Utzig e5e1cc964d Fix another formatting issue
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-21 17:29:51 -03:00
Fabio Utzig d066f0b782 Fix bulleted list formatting
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-21 17:29:51 -03:00
Fabio Utzig e37a68644e Add crypto library required by signing algo
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-21 17:29:51 -03:00
Fabio Utzig 991343db51 Add release notes
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-21 17:29:51 -03:00
Fabio Utzig d3ab5218f9 Add Mynewt README
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-21 15:58:44 -03:00
Fabio Utzig ba1fbe607b Fix running newtmgr when building for mcuboot
This enables mynewt to use mcuboot as a remote repository, which is only
required when using newtmgr to manage images. Since mcuboot has slightly
changed the trailer format, newtmgr built against the bundled mynewt
bootloader writes the magic and flags to the wrong location.

To build a mynewt app the wants to run with mcuboot as the bootloader
and requires newtmgr one needs to change the app's pkg.yml dependencies
as follows:

-    - boot/bootutil
+    - "@mcuboot/boot/bootutil"

Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-21 15:58:44 -03:00
Fabio Utzig d0116731a9 Remove incubator references from mynewt dev email
Also use a single email for all packages.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-21 12:06:44 -06:00
David Brown 9600ec84f2 sim: Update doc to explain submodules
Now that we depend on a submodule for mbed TLS code, update the docs to
explain how to fetch this.  Otherwise, the error is somewhat misleading,
just showing a missing sha256.c file.

Signed-off-by: David Brown <david.brown@linaro.org>
2017-07-21 11:50:48 -06:00
David Brown 2cf522c3d8 scripts: assemble: Fix problem with missing output
Adding an os.unlink() call to remove the outfile results in an exception
being thrown if the file does not exist.  Fix this by trapping, and
checking for the specific error we get on a missing file.

Signed-off-by: David Brown <david.brown@linaro.org>
2017-07-20 14:55:50 -06:00
David Brown dbc5727902 samples: Add a 'full.bin' target to Zephyr sample
This full.bin target demonstrates how to assemble all of the images into
a single file which can be flashed to the device.  As it is, it will
then boot into the first "primary" image.  The second image will be
present, but will not ever be run.

Signed-off-by: David Brown <david.brown@linaro.org>
2017-07-20 14:55:50 -06:00
David Brown 51513afc07 samples: Add .gitignore to ignore output files
Signed-off-by: David Brown <david.brown@linaro.org>
2017-07-20 14:55:50 -06:00
Fabio Utzig 253bf0f5e2 Merge pull request #87 from utzig/update-docs
Update docs
2017-07-20 17:53:30 -03:00
Fabio Utzig 095757c3ff Rename file
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-20 15:35:15 -03:00
Fabio Utzig f9d442829b Add 'Any' states for copy-done
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-20 15:05:13 -03:00
Fabio Utzig 227a97af52 Merge pull request #86 from kYc0o/riot_readme
Add README-RIOT.rst
2017-07-20 15:02:34 -03:00
kYc0o c5f4acf5b7 add README-RIOT.rst
Signed-off-by: kYc0o <fco.ja.ac@gmail.com>
2017-07-20 19:57:35 +02:00
Marti Bolivar 9203b1b9ed zephyr: nucleo_f401re: use flash defines from DTS
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-07-20 11:31:50 -06:00
Marti Bolivar 99b5b2cb56 zephyr: nrf52840_pca10056: use flash defines from DTS
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-07-20 11:31:50 -06:00
Marti Bolivar 63fa9cfd88 zephyr: 96b_nitrogen: use flash defines from DTS
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-07-20 11:31:50 -06:00
Marti Bolivar c868990ec6 zephyr: 96b_carbon: use flash defines from DTS
Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
2017-07-20 11:31:50 -06:00
Fabio Utzig 04cc4d7d3e Merge pull request #81 from utzig/fix-mcub59
Rework some of the handling of swap errors
2017-07-20 13:55:51 -03:00
Fabio Utzig dead387ab8 Add slack channel
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-20 13:47:05 -03:00
Fabio Utzig 756ca86f49 Fix sentence wording per review
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-20 13:38:22 -03:00
Fabio Utzig ac83496a53 Change references of Mynewt to mcuboot
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-20 13:20:48 -03:00
Fabio Utzig 2c305aab6b Fix trailer's status flags ordering
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-20 13:14:25 -03:00
Fabio Utzig 695d564797 Add handling for failure setting slot flags
This adds a check for failure writing flags after a swap. For now a
failure just panics the bootloader.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-20 12:31:48 -03:00
Fabio Utzig 740237405f Add IRC channel information
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-20 09:24:58 -03:00
Fabio Utzig 485f837dfc Move release notes to a more common format
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-20 09:20:18 -03:00
Fabio Utzig 097f76b3db Apply a few updates to README
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-20 08:59:51 -03:00
Fabio Utzig 5bd4e5848a Update design document to match implementation
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-20 08:55:38 -03:00
Fabio Utzig 1e56fcc447 Adds checking of image_ok before writing
When image is slot 1 had bad signature, the swap would fail and
try to write image_ok in slot 0 which if that was already a
permanent image would cause a overwrite in flash.

Fix warning/error when slot 0 validation is not enabled.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-17 15:39:14 -03:00
Fabio Utzig 645e514b79 Add test checking upgrade to image with bad signature
This test was added to exercise a bug which happens when a failure
verifying the image in slot 1 would cause a write to image_ok when
the image in slot 0 already was a permanent image.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-17 15:36:13 -03:00
Fabio Utzig 65935d7111 Fix flash to not ignore write to non-erased area
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-17 15:34:36 -03:00
Fabio Utzig db5bd3c186 Refactor finalize swap handling
After a swap operation is finished trailer control flags are written
according to the type of swap that was performed. The function names
that execute those operations were renamed to explicity reflect what
they do, and all "less deterministic" behaviors, of the type
"if flash is not set, set it", were removed.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-13 22:20:22 -03:00
Fabio Utzig d7d20756aa Fix improper revert on imgtool generated FW
This adds handling of the copy_done bit while evaluation a swap state.
Since copy_done is only ever written when a swap finishes, it can be
safely assumed that if copy_done is not set no swap was ever performed
and the image was written directly to flash, and thus no revert is run.

Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-13 21:24:03 -03:00
Fabio Utzig b5b2f551cd Simplify status management
This reworks much of the code, as well as tables, handling swap
state to make them simpler. Only states that require an actual
swap to be performed, perm/test/revert are checked for and acted
upon. Other possible states try to default to no operation
performed.

One extra state, BOOT_SWAP_TYPE_PANIC, was added to differentiate
between "soft" errors and unrecoverable ones (as flash read/write
errors).

Non well defined state changes after swap failures, as described
in MCUB-59 were also clean up.

This should also fix situations as described in MCUB-63, where
images generated using imgtool (magic + image_ok set) are written
to slot 0 and cause an incorrect "revert".

Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-13 21:24:03 -03:00
Fabio Utzig 7b47ef7b70 Test imgtool generated FW written to slot0
Signed-off-by: Fabio Utzig <utzig@apache.org>
2017-07-13 21:24:03 -03:00
David Brown 52eee56746 Reload headers before verifying signature
After performing any kind of swap, reload the headers from the image(s)
before verifying the new image.
2017-07-13 17:52:20 -06:00
David Brown 554c52e64c Always validate slot 0 when requested
The MCUBOOT_VALIDATE_SLOT0 feature only verifies the signature when
there is no swapping happening.  The assumption was that if there is a
swap being done, the code will verify the signature of slot 1 before
doing the slot.

However, either due to bugs, or intentional trickery, it may be possible
to confuse the code into continuing a swap operation.  If the data is
modified before this, the bootloader can be tricked into booting the
resulting image in slot 0 without having verified the signature.

Fix this by always verifying slot 0's signature before booting it.

JIRA: MCUB-64
Signed-off-by: David Brown <david.brown@linaro.org>
2017-07-13 17:52:20 -06:00
David Brown 046a0a6224 sim: Upgrade docopt dependency
The docopt package has moved from rustc-serialize to serde.  Move to
this version, upgrading the custom deserialize we use for the alignment
argument.

Signed-off-by: David Brown <david.brown@linaro.org>
2017-07-12 19:04:18 -06:00
David Brown ccb2a1dd5e sim: Update most dependencies
Move most dependencies to the latest version at the time of this commit.
docopt is left at the current version as there is an api change in the
newer version.

Signed-off-by: David Brown <david.brown@linaro.org>
2017-07-12 19:04:18 -06:00
David Brown 0b693c0c74 sim: Enable -Werror
Enable -Werror in the build of the C code (also remove an unneeded TODO
comment).

Signed-off-by: David Brown <david.brown@linaro.org>
2017-07-12 15:00:57 -06:00
David Brown 704ac6f570 sim: Conditionalize rsa signature checking
Allow a build with sig-rsa set or not set.  Only add the signature to
the TLV if we are building with the signature checking.
2017-07-12 15:00:57 -06:00