Update mixer build image to use clr-installer. (#1015)

* Update mixer build image to use clr-installer.

Closes #1006

Signed-off-by: Bun K Tan <bun.k.tan@intel.com>

* Reverts Example 7 to recent master, omitting Tutorials header, etc.
- Reason: Separate branches not sync'ed based on upstream master

Signed-off-by: Michael Vincerra <michael.vincerra@intel.com>

* Adds line in Example 4 to assure Example 2 is known prereq.

Signed-off-by: Michael Vincerra <michael.vincerra@intel.com>

* Simplify sentence.

Signed-off-by: Michael Vincerra <michael.vincerra@intel.com>

Co-authored-by: michael vincerra <37549381+mvincerx@users.noreply.github.com>
This commit is contained in:
bktan8
2020-02-05 10:59:47 -08:00
committed by GitHub
co-authored by michael vincerra
parent bef08ba148
commit 77d7631e37
+118 -80
View File
@@ -345,61 +345,101 @@ Refresh your web server to see the update content for mix version 20.
You can also look in ~/mixer/update/www/<mix version> to see the update
content in your workspace.
Example 4: Build an image
=========================
This example shows how to build a bootable image containing the
:command:`kernel-kvm`, :command:`os-core`, and the :command:`os-core-update`
bundles from Example 2. Underneath, mixer uses `ister`_ to generate the
image.
bundles from `Example 2: Create a simple mix`_. Complete that example before starting this one.
Underneath, mixer uses `clr-installer`_ to generate the image.
#. Change directory into your mix.
#. Configure image.
Edit the ister configuration file for your image to include all of the bundles you want pre-installed in the image. If this is the first time creating an image, first get a copy of the
:file:`release-image-config.json` template file:
Create a YAML configuration file to specify aspects of your image
such as image name, target media, bundles, etc. See `Installer YAML Syntax`_
for more information on clr-installer configuration YAML syntax.
For this example, we will download a sample YAML and modify it.
.. code-block:: bash
curl -O https://raw.githubusercontent.com/bryteise/ister/master/release-image-config.json
curl -O https://raw.githubusercontent.com/clearlinux/clr-installer/master/scripts/kvm.yaml
For this example, make the following revisions
:file:`release-image-config.json`:
Make the following revisions to :file:`kvm.yaml`:
* Set root partition size to "5G"
* Replace the "kernel-native" bundle with "kernel-kvm"
* Set the version to 10 (as an integer)
* Reduce overall image size and root partition size by 5GB.
* Remove these bundles from the image: ``editors``, ``network-basic``,
``openssh-server``, ``sysadmin-basic``
* Add ``version: 10`` to tell :command:`mixer` to generate an image based
on mix version 10
.. note::
When creating an image, select a subset of the bundles that are part of your mix. All the bundles that are *not* part of this subset are available for consumers of that image to install afterwards via swupd.
.. code-block:: bash
When creating an image, it is not necessary to include all of the bundles
that are in your entire mix. Once you have a working image, you can use
:command:`swupd` to add them as needed.
Your :file:`kvm.yaml` should look like below:
.. code-block:: console
:linenos:
:emphasize-lines: 5,11-12
:emphasize-lines: 11,26,29-33,44
#clear-linux-config
{
"DestinationType" : "virtual",
"PartitionLayout" : [ { "disk" : "release.img", "partition" : 1, "size" : "32M", "type" : "EFI" },
{ "disk" : "release.img", "partition" : 2, "size" : "16M", "type" : "swap" },
{ "disk" : "release.img", "partition" : 3, "size" : "5G", "type" : "linux" } ],
"FilesystemTypes" : [ { "disk" : "release.img", "partition" : 1, "type" : "vfat" },
{ "disk" : "release.img", "partition" : 2, "type" : "swap" },
{ "disk" : "release.img", "partition" : 3, "type" : "ext4" } ],
"PartitionMountPoints" : [ { "disk" : "release.img", "partition" : 1, "mount" : "/boot" },
{ "disk" : "release.img", "partition" : 3, "mount" : "/" } ],
"Version": 10,
"Bundles": ["kernel-kvm", "os-core", "os-core-update"]
}
# switch between aliases if you want to install to an actuall block device
# i.e /dev/sda
block-devices: [
{name: "bdevice", file: "kvm.img"}
]
targetMedia:
- name: ${bdevice}
size: "3.54G"
type: disk
children:
- name: ${bdevice}1
fstype: vfat
mountpoint: /boot
size: "512M"
type: part
- name: ${bdevice}2
fstype: swap
size: "32M"
type: part
- name: ${bdevice}3
fstype: ext4
mountpoint: /
size: "3G"
type: part
bundles: [
bootloader,
os-core,
os-core-update,
]
autoUpdate: false
postArchive: false
postReboot: false
telemetry: false
keyboard: us
language: en_US.UTF-8
kernel: kernel-kvm
version: 10
#. Build the image.
.. code-block:: bash
sudo mixer build image
sudo mixer build image --template $PWD/kvm.yaml
The output from this step will be :file:`release.img`, which is a live
The output from this step will be :file:`kvm.img`, which is a live
image.
Example 5: Deploy updates to target
@@ -430,11 +470,15 @@ mix version 10 to mix version 20.
.. code-block:: bash
sudo ./start_qemu.sh release.img
sudo ./start_qemu.sh kvm.img
#. Log in as root and set a password.
#. To avoid adding a flag each time, enter:
#. By default, the :command:`swupd` client is designed to communicate with an
HTTPS server. For development purposes, the swupd client can talk to
an HTTP server if you add the flag ``allow-insecure-http``.
To avoid adding a flag each time when invoking :command:`swupd`, enter:
.. code-block:: bash
@@ -444,67 +488,65 @@ mix version 10 to mix version 20.
allow_insecure_http=true
EOF
.. note:
By default, the swupd client is designed to communicate with an
*\https* server. For development purposes, the swupd client can talk to
an *\http* server if you add the flag :command:`--allow-insecure-http`.
#. Try out your mix.
Take a look at the default bundles installed in your mix:
a. Show the version and update URLs
.. code-block:: bash
.. code-block:: bash
swupd info
swupd bundle-list
swupd info
#. List available bundles on your update server.
#. List the bundles installed in your mix:
.. code-block:: bash
.. code-block:: bash
swupd bundle-list
swupd bundle-list -a
#. List available bundles on your update server.
#. Now we will add the :command:`editors` bundle that we modified.
.. code-block:: bash
.. code-block:: bash
swupd bundle-list -a
swupd bundle-add editors
#. Now we will add the :command:`editors` bundle that we modified.
#. Try to start the :command:`joe` editor.
.. code-block:: bash
.. code-block:: bash
swupd bundle-add editors
joe
#. Try to start the :command:`joe` editor.
It should not appear. We removed it from the original
:command:`editors` bundle.
.. code-block:: bash
#. Next we will update from version 10 to 20 to capture the newly
available bundles.
joe
.. code-block:: bash
It should not work because we removed it from the original
:command:`editors` bundle.
swupd check-update
swupd update
swupd bundle-list -a
#. Next we will update from version 10 to 20 to capture the
newly-available bundles.
#. Now your mix should be at version 20 and curl is available. Try using
curl. This will fail because curl is not yet installed:
.. code-block:: bash
.. code-block:: console
swupd check-update
swupd update
swupd bundle-list -a
curl: command not found
To install curl use: swupd bundle-add curl
#. Now your mix should be at version 20 and :command:`curl` is available.
Try using :command:`curl`. This will fail because it is not yet installed.
#. Add the new bundle from your update server to your VM. Retry curl.
It works!
.. code-block:: console
.. code-block:: bash
curl: command not found
To install curl use: swupd bundle-add curl
swupd bundle-add curl
curl -O https://download.clearlinux.org/image/start_qemu.sh
#. Add the new bundle from your update server to your VM. Retry :command:`curl`.
It works!
.. code-block:: bash
swupd bundle-add curl
curl -O https://download.clearlinux.org/image/start_qemu.sh
#. Shutdown your VM:
@@ -658,8 +700,7 @@ customizations during the update, such as:
* Change the content of the chroot
Use the `afb.sh reference script`_ to learn how to do a manual format bump.
The :file:`afb.sh` script shows an example of how to:
Follow the `afb.sh reference script`_ to learn how to do a manual format bump. The `afb.sh reference script`_ shows an example of how to:
* Create a mix
@@ -669,15 +710,10 @@ The :file:`afb.sh` script shows an example of how to:
* Do a format bump to remove the deprecated bundle
Read the comments above each line for an explanation of each step as you
execute commands. Use this same process on your mix if you need to remove a
bundle and its tracking.
.. Example: Create a mix with custom RPM
.. -------------------------------------
.. TODO future example to show copy into local-rpms...
..
Example: Create a mix with custom RPM
..
TODO future example to show copy into local-rpms...
References
**********
@@ -1109,5 +1145,7 @@ Related topics
.. _mixer.build man page: https://github.com/clearlinux/mixer-tools/blob/master/docs/mixer.build.1.rst
.. _releases: https://github.com/clearlinux/clr-bundles/releases
.. _afb.sh reference script: https://github.com/clearlinux/mixer-tools/blob/master/afb.sh
.. _clr-installer: https://github.com/clearlinux/clr-installer
.. _Installer YAML Syntax:
https://github.com/clearlinux/clr-installer/blob/master/scripts/InstallerYAMLSyntax.md
.. _ister: https://github.com/bryteise/ister