Browse Source

Merge "Ensure nouveau is blacklisted in initramfs too"

tags/2.30.0
Zuul 2 weeks ago
parent
commit
9dd161471a
4 changed files with 38 additions and 5 deletions
  1. +1
    -0
      diskimage_builder/elements/disable-nouveau/dracut.conf.d/disable-nouveau.conf
  2. +4
    -0
      diskimage_builder/elements/dracut-regenerate/README.rst
  3. +23
    -0
      diskimage_builder/elements/dracut-regenerate/extra-data.d/50-dracut-conf
  4. +10
    -5
      diskimage_builder/elements/dracut-regenerate/finalise.d/50-dracut-regenerate

+ 1
- 0
diskimage_builder/elements/disable-nouveau/dracut.conf.d/disable-nouveau.conf View File

@@ -0,0 +1 @@
omit_drivers+=" nouveau "

+ 4
- 0
diskimage_builder/elements/dracut-regenerate/README.rst View File

@@ -16,3 +16,7 @@ a yaml blob with the following format::
- <package4>

By default, this element will bring lvm and crypt modules.

Also adds the ability to copy specific files into /etc/dracut.conf.d directory
to allow any dracut settings to be configured. To achieve that the files to be
copied need to be placed inside an specific dracut.d directory of the element.

+ 23
- 0
diskimage_builder/elements/dracut-regenerate/extra-data.d/50-dracut-conf View File

@@ -0,0 +1,23 @@
#!/bin/bash

if [ ${DIB_DEBUG_TRACE:-1} -gt 1 ]; then
set -x
fi
set -eu
set -o pipefail

if [ ! -d $TMP_MOUNT_PATH/etc/dracut.conf.d ]; then
sudo mkdir -p $TMP_MOUNT_PATH/etc/dracut.conf.d
fi

eval declare -A image_elements=($(get_image_element_array))

for i in "${!image_elements[@]}"; do
element=$i
element_dir=${image_elements[$i]}

if [ -d "${element_dir}/dracut.conf.d/" ]; then
echo "Copying dracut config from ${element_dir}"
sudo cp ${element_dir}/dracut.conf.d/*.conf $TMP_MOUNT_PATH/etc/dracut.conf.d/
fi
done

+ 10
- 5
diskimage_builder/elements/dracut-regenerate/finalise.d/50-dracut-regenerate View File

@@ -14,6 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import glob
import logging
import os
import re
@@ -52,8 +53,10 @@ def main():
# second, compose the list of modules to boot
modules_to_boot.append(dracut_object.get('name', None))

# regenerate dracut with the list of installed modules
if len(modules_to_boot) > 0:
conf_overrides = glob.glob('/etc/dracut.conf.d/*.conf')

# regenerate dracut with the list of installed modules and conf overrides
if modules_to_boot or conf_overrides:
cmdline = ["select-boot-kernel-initrd"]
logging.debug("Calling: %s" % cmdline)
subp = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
@@ -67,10 +70,12 @@ def main():
kernel_search = re.match("vmlinuz-(.*)", kernel_set[0])
kernel_version = "%s" % kernel_search.groups(1)
ramdisk_path = "/boot/%s" % kernel_set[1].strip()
modules_to_boot = ' ' .join(modules_to_boot)

cmdline = ['dracut', '--force', '--add', modules_to_boot,
'-f', ramdisk_path, kernel_version]
cmdline = ['dracut', '--force']
if modules_to_boot:
modules_to_boot = ' ' .join(modules_to_boot)
cmdline += ['--add', modules_to_boot]
cmdline += ['-f', ramdisk_path, kernel_version]
logging.debug("Calling: %s" % cmdline)
subp = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
out, err = subp.communicate()

Loading…
Cancel
Save