<commit_before>Building and using mcuboot with Zephyr
######################################

*mcuboot* began its life as the bootloader for Mynewt.  It has since
aquired the ability to be used as a bootloader for Zephyr as well.
There are some pretty significant differences in how apps are built
for Zephyr, and these are documented here.

Please see ``boot/bootutil/design.txt`` for documentation on the
design and operation of the bootloader itself.  This functionality
should be the same between Mynewt and Zephyr

Building the bootloader itself
==============================

The bootloader is an ordinary Zephyr application, at least from
Zephyr's point of view.  There is a bit of configuration that needs to
be made before building it.  Most of this is done in the top-level
``Makefile`` in the source tree.  There are comments there for
guidance.  It is important to select a signature algorithm, and decide
if slot0 should be validated on every boot.

There is a ``build_boot.sh`` script at the top level that can make
building a bit easier.  It assumes that the mcuboot tree is next to,
at the same level, as the zephyr source tree.  It takes a single
argument, which is the target to build.  This must match one of the
targets in ``boot/zephyr/targets`` to be a supported board.

Once this is finished building, the bootloader should reside in
``outdir/targname/zephyr.bin``.  Use the flashing tools you have to
install this image at the beginning of the flash.

Building Applications for the bootloader
========================================

In order build an application to be used within the bootloader, there
are a few configuration changes that need to be made to it (typically<commit_msg>zephyr: doc: Mention the DT flash description<commit_after>Building and using mcuboot with Zephyr
######################################

*mcuboot* began its life as the bootloader for Mynewt.  It has since
aquired the ability to be used as a bootloader for Zephyr as well.
There are some pretty significant differences in how apps are built
for Zephyr, and these are documented here.

Please see ``boot/bootutil/design.txt`` for documentation on the
design and operation of the bootloader itself.  This functionality
should be the same between Mynewt and Zephyr

Building the bootloader itself
==============================

The bootloader is an ordinary Zephyr application, at least from
Zephyr's point of view.  There is a bit of configuration that needs to
be made before building it.  Most of this is done in the top-level
``Makefile`` in the source tree.  There are comments there for
guidance.  It is important to select a signature algorithm, and decide
if slot0 should be validated on every boot.

There is a ``build_boot.sh`` script at the top level that can make
building a bit easier.  It assumes that the mcuboot tree is next to,
at the same level, as the zephyr source tree.  It takes a single
argument, which is the target to build.  This must match one of the
targets in ``boot/zephyr/targets`` to be a supported board. Additionally,
the Zephyr Device Tree board definition in ``dts/<arch>/<board>.dts``  must
contain the flash partitions description.

Once this is finished building, the bootloader should reside in
``outdir/targname/zephyr.[bin|hex]``.  Use the flashing tools you have to
install this image at the beginning of the flash.

Building Applications for the bootloader
========================================

In order build an application to be used within the bootloader, there
are a few configuration changes that need to be made to it (typically
{'fraction_non_alphanumeric': 0.09855233853006681, 'fraction_numerical': 0.0005567928730512249, 'mean_word_length': 4.676145339652448, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4846423', 'n_tokens_mistral': 927, 'n_tokens_neox': 893, 'n_words': 536}