Add DIB_UBUNTU_KERNEL to ubuntu-minimal

This patch adds a new environment variable to the ubuntu-minimal
element called DIB_UBUNTU_KERNEL that allows you to specify the kernel
meta package that will be using to install the kernel inside the image.
It supports "linux-image-generic" (The default), "linux-image-kvm", and
"linux-image-virtual".
This allows building images that are smaller in size (~200MB smaller
qcow2) that have only the kernel modules necessary for virtual
machines.

Change-Id: I8ce65e1d357d15e8ed8995ad1dcaea02bbd1986f
This commit is contained in:
Michael Johnson 2019-06-18 10:02:36 -07:00
parent 4afcba1fea
commit e433aebf7d
4 changed files with 42 additions and 0 deletions

View File

@ -14,4 +14,17 @@ be created, the variable ``DIB_RELEASE`` can be set appropriately.
Note that this element installs ``systemd-sysv`` as the init system for
18.04+.
Environment Variables
---------------------
DIB_UBUNTU_KERNEL:
:Required: No
:Default: ``linux-image-generic``
:Description: Specifies the kernel meta package to install in the image.
:Example: ``DIB_UBUNTU_KERNEL=linux-image-kvm``
:Options: ``linux-image-generic``, ``linux-image-kvm``,
``linux-image-virtual``
:Notes: The element must know about the package, otherwise it will select
the default.
.. element_deps::

View File

@ -0,0 +1,15 @@
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
#
# See the License for the specific language governing permissions and
# limitations under the License.
export DIB_UBUNTU_KERNEL=${DIB_UBUNTU_KERNEL:-"linux-image-generic"}

View File

@ -1,5 +1,12 @@
linux-image-generic:
not-arch: arm64
when: DIB_UBUNTU_KERNEL = linux-image-generic
linux-image-kvm:
not-arch: arm64
when: DIB_UBUNTU_KERNEL = linux-image-kvm
linux-image-virtual:
not-arch: arm64
when: DIB_UBUNTU_KERNEL = linux-image-virtual
# TODO(ianw): this is Xenial specific, for now. This kernel works
# much better, however, including better support for cdrom's for
# config-drive. We'll need to filter this further for future

View File

@ -0,0 +1,7 @@
---
features:
- |
Added an environment variable, DIB_UBUNTU_KERNEL, that allows you to
specify the kernel meta package to install in the image.
It currently supports "linux-image-generic" (The default),
"linux-image-kvm", and "linux-image-virtual".