diff --git a/diskimage_builder/elements/ubuntu-minimal/README.rst b/diskimage_builder/elements/ubuntu-minimal/README.rst index 44e70127..df764b87 100644 --- a/diskimage_builder/elements/ubuntu-minimal/README.rst +++ b/diskimage_builder/elements/ubuntu-minimal/README.rst @@ -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:: diff --git a/diskimage_builder/elements/ubuntu-minimal/environment.d/11-ubuntu-kernel.bash b/diskimage_builder/elements/ubuntu-minimal/environment.d/11-ubuntu-kernel.bash new file mode 100644 index 00000000..35d4a64a --- /dev/null +++ b/diskimage_builder/elements/ubuntu-minimal/environment.d/11-ubuntu-kernel.bash @@ -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"} diff --git a/diskimage_builder/elements/ubuntu-minimal/package-installs.yaml b/diskimage_builder/elements/ubuntu-minimal/package-installs.yaml index d73a1fe3..e6efe9f2 100644 --- a/diskimage_builder/elements/ubuntu-minimal/package-installs.yaml +++ b/diskimage_builder/elements/ubuntu-minimal/package-installs.yaml @@ -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 diff --git a/releasenotes/notes/Add-DIB-UBUNTU-KERNEL-5f75a809f3ce9bab.yaml b/releasenotes/notes/Add-DIB-UBUNTU-KERNEL-5f75a809f3ce9bab.yaml new file mode 100644 index 00000000..20401ab7 --- /dev/null +++ b/releasenotes/notes/Add-DIB-UBUNTU-KERNEL-5f75a809f3ce9bab.yaml @@ -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".