Skip to content

Commit

Permalink
docs/BUILD.md: describe process of building live image with LIVE_PKG
Browse files Browse the repository at this point in the history
1.  Creating a live image with an EXT4 root filesystem:

   `make ROOTFS_FORMAT=ext4 live`

2. Patch the EXT4 partition of the live image with only the necessary package,
   e.g. pkg/pillar:

   `make LIVE_PKG=pkg/pillar live`

Signed-off-by: Roman Penyaev <r.peniaev@gmail.com>
  • Loading branch information
rouming committed Apr 15, 2024
1 parent c163ae3 commit 2c605ad
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,22 @@ The current process uses the control knob `PLATFORM` in the following places in
* As the first argument to [prepare-platform.sh](../tools/prepare-platform.sh) in the Makefile targets for `live.*`, `installer.*` and `verification.*`, which, in turn, uses it to add specific files to the build and output directories prior to making the final image.
* In the final eve image `lf-edge/eve`, specifically the entrypoint [runme.sh](../pkg/eve/runme.sh), where the platform is passed as `-p` argument when calling `docker run`, and is used to modify the final layout.

### Note for a developer

`make live` typically requires a significant amount of time, approximately 3 minutes, to generate a tarball and the resulting squashfs image. This delay can be frustrating during daily development cycles of code compilation, live testing, and iteration. For developers who are less patient, optimizing the live image build process is essential. This optimization entails a few adjustments to the build procedure:

1. Creating a live image with an EXT4 root filesystem. The live command also supports the EXT4 format for the root filesystem, resulting in a larger image size. However, this format allows for a mutable root filesystem, enabling it to be remounted with read-write (RW) options. This flexibility provides greater freedom during EVE runtime as well as during the live image creation, facilitating on-the-fly modifications to the image instead of requiring a complete rebuild from scratch. First you need to create a live image with EXT4 as the following:

`make ROOTFS_FORMAT=ext4 live`

1. To streamline the generation of an up-to-date live image, especially during iterative development cycles, you can patch the EXT4 partition with only the necessary package, such as `pkg/pillar`. This approach minimizes the time required for generating the live image. Below is the command for patching the EXT4 live image generated by the previous command:

`make LIVE_PKG=pkg/pillar live`

The command generates the rootfs tarball consisting only from the `pkg/pillar` and patches the live image using the `guestfish` one-liner (check the main Makefile for details).

This approach reduces creation of the resulting live image from 3 minutes to 20 seconds (approximately).

### Generating any yml

Note that the process above can be used to generate any yml file, not just `rootfs-$(HV).yml`. As long as
Expand Down

0 comments on commit 2c605ad

Please sign in to comment.