dracut: fix mkinitrd verbose issue
- refactor initrd generation logic - validate instmods calls in dracut - add support to provide multiple conf file & dirs to dracut kernels: refactor the initrmafs helper data generation logic - create <modules-dir>/dracut.conf.d/<name>.conf and feed this directory as configdir during mkinitrd Change-Id: I44ab7cfb65ae44fd2a27dde76fa50dbbbf611c2e Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com> Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/19877 Reviewed-by: Alexey Makhalov <amakhalov@vmware.com> Tested-by: gerrit-photon <photon-checkins@vmware.com>
This commit is contained in:
parent
df9c05aa43
commit
b4d48c6729
|
@ -0,0 +1,451 @@
|
|||
From 6e3f9daa67007723ead446098801d0e6710a806e Mon Sep 17 00:00:00 2001
|
||||
From: Shreenidhi Shedi <sshedi@vmware.com>
|
||||
Date: Wed, 1 Mar 2023 01:23:55 +0530
|
||||
Subject: [PATCH 1/4] mkinitrd: verbose fix
|
||||
|
||||
Add a sanity check to verify initrd post creation.
|
||||
If something is wrong with initrd, show an error on tty.
|
||||
|
||||
If running in non tty, show all logs.
|
||||
|
||||
mkinitrd logs will be captured at: `/var/log/mkinitrd-<kernel>.log`
|
||||
|
||||
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
|
||||
---
|
||||
mkinitrd-dracut.sh | 383 ++++++++++++++++++++++++++++-----------------
|
||||
1 file changed, 236 insertions(+), 147 deletions(-)
|
||||
|
||||
diff --git a/mkinitrd-dracut.sh b/mkinitrd-dracut.sh
|
||||
index 0ef65bd..8732bb5 100755
|
||||
--- a/mkinitrd-dracut.sh
|
||||
+++ b/mkinitrd-dracut.sh
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash --norc
|
||||
-kver=$(uname -r)
|
||||
-kernel_ver_dir='/var/lib/initramfs/kernel'
|
||||
+
|
||||
+kver="$(uname -r)"
|
||||
|
||||
boot_dir="/boot"
|
||||
quiet=0
|
||||
@@ -9,144 +9,164 @@ force=0
|
||||
set_hostonly=0
|
||||
no_hostonly=0
|
||||
|
||||
-error() { echo "$@" >&2; }
|
||||
+DRACUT_DBG=0
|
||||
|
||||
-usage () {
|
||||
- [[ $1 = '-n' ]] && cmd=echo || cmd=error
|
||||
+error() {
|
||||
+ echo "$@" >&2
|
||||
+}
|
||||
|
||||
- $cmd "usage: ${0##*/} [--version] [--help] [-v] [-f] [--preload <module>]"
|
||||
- $cmd " [--image-version] [--with=<module>]"
|
||||
- $cmd " [--nocompress]"
|
||||
- $cmd " [--set-hostonly] - Generates host specific initrd.img"
|
||||
- $cmd " [--no-hostonly] - Generates generic initrd.img"
|
||||
- $cmd " <initrd-image> <kernel-version>"
|
||||
- $cmd ""
|
||||
- $cmd " (ex: ${0##*/} /boot/initramfs-$kver.img $kver)"
|
||||
+usage() {
|
||||
+ local cmd=""
|
||||
|
||||
- [[ $1 = '-n' ]] && exit 0
|
||||
- exit 1
|
||||
+ [[ $1 = '-n' ]] && cmd=echo || cmd=error
|
||||
+
|
||||
+ $cmd "usage: ${0##*/} [--version] [--help] [-v] [-f] [--preload <module>]"
|
||||
+ $cmd " [--image-version] [--with=<module>]"
|
||||
+ $cmd " [--nocompress]"
|
||||
+ $cmd " [--set-hostonly] - Generates host specific initrd.img"
|
||||
+ $cmd " [--no-hostonly] - Generates generic initrd.img"
|
||||
+ $cmd " <initrd-image> <kernel-version>"
|
||||
+ $cmd ""
|
||||
+ $cmd " (ex: ${0##*/} /boot/initramfs-$kver.img $kver)"
|
||||
+
|
||||
+ [[ $1 = '-n' ]] && exit 0
|
||||
+ exit 1
|
||||
}
|
||||
|
||||
# Little helper function for reading args from the commandline.
|
||||
# it automatically handles -a b and -a=b variants, and returns 1 if
|
||||
# we need to shift $3.
|
||||
read_arg() {
|
||||
- # $1 = arg name
|
||||
- # $2 = arg value
|
||||
- # $3 = arg parameter
|
||||
- param="$1"
|
||||
- local rematch='^[^=]*=(.*)$' result
|
||||
- if [[ $2 =~ $rematch ]]; then
|
||||
- read "$param" <<< "${BASH_REMATCH[1]}"
|
||||
- else
|
||||
- for ((i=3; $i <= $#; i++)); do
|
||||
- # Only read next arg if it not an arg itself.
|
||||
- if [[ ${*:$i:1} = -* ]];then
|
||||
- break
|
||||
- fi
|
||||
- result="$result ${@:$i:1}"
|
||||
- # There is no way to shift our callers args, so
|
||||
- # return "no of args" to indicate they should do it instead.
|
||||
- done
|
||||
- read "$1" <<< "$result"
|
||||
- return $(($i - 3))
|
||||
- fi
|
||||
+ # $1 = arg name
|
||||
+ # $2 = arg value
|
||||
+ # $3 = arg parameter
|
||||
+ local param="$1"
|
||||
+ local rematch='^[^=]*=(.*)$' result
|
||||
+ if [[ $2 =~ $rematch ]]; then
|
||||
+ read "$param" <<<"${BASH_REMATCH[1]}"
|
||||
+ else
|
||||
+ for ((i = 3; $i <= $#; i++)); do
|
||||
+ # Only read next arg if it not an arg itself.
|
||||
+ if [[ ${*:$i:1} = -* ]]; then
|
||||
+ break
|
||||
+ fi
|
||||
+ result="$result ${@:$i:1}"
|
||||
+ # There is no way to shift our callers args, so
|
||||
+ # return "no of args" to indicate they should do it instead.
|
||||
+ done
|
||||
+ read "$1" <<<"$result"
|
||||
+ return $(($i - 3))
|
||||
+ fi
|
||||
}
|
||||
|
||||
# For PhotonOS
|
||||
default_kernel_images() {
|
||||
- local kernel_version=
|
||||
+ local kernel_version=""
|
||||
|
||||
- for kernel_version in $(ls $kernel_ver_dir); do
|
||||
- # Take this directory as the source of truth
|
||||
- kernels="$kernels $kernel_version"
|
||||
- targets="$targets $boot_dir/initrd.img-$kernel_version"
|
||||
- done
|
||||
+ for kernel_version in $(find /lib/modules -mindepth 1 -maxdepth 1 -type d); do
|
||||
+ kernel_version="$(basename ${kernel_version})"
|
||||
+ # Take this directory as the source of truth
|
||||
+ kernels="$kernels $kernel_version"
|
||||
+ targets="$targets $boot_dir/initrd.img-$kernel_version"
|
||||
+ done
|
||||
}
|
||||
|
||||
while (($# > 0)); do
|
||||
- case ${1%%=*} in
|
||||
- --with-usb) read_arg usbmodule "$@" || shift $?
|
||||
- basicmodules="$basicmodules ${usbmodule:-usb-storage}"
|
||||
- unset usbmodule;;
|
||||
- --with-avail) read_arg modname "$@" || shift $?
|
||||
- basicmodules="$basicmodules $modname";;
|
||||
- --with) read_arg modname "$@" || shift $?
|
||||
- basicmodules="$basicmodules $modname";;
|
||||
- --version)
|
||||
- echo "mkinitrd: dracut compatibility wrapper"
|
||||
- exit 0;;
|
||||
- -v|--verbose) dracut_args="${dracut_args} -v";;
|
||||
- -f|--force) force=1;;
|
||||
- --preload) read_arg modname "$@" || shift $?
|
||||
- basicmodules="$basicmodules $modname";;
|
||||
- --image-version) img_vers=yes;;
|
||||
- --rootfs|-d) read_arg rootfs "$@" || shift $?
|
||||
- dracut_args="${dracut_args} --filesystems $rootfs";;
|
||||
- --nocompress) dracut_args="$dracut_args --no-compress";;
|
||||
- --set-hostonly) set_hostonly=1;;
|
||||
- --no-hostonly) no_hostonly=1;;
|
||||
- --help) usage -n;;
|
||||
- --builtin) ;;
|
||||
- --without*) ;;
|
||||
- --without-usb) ;;
|
||||
- --fstab*) ;;
|
||||
- --ifneeded) ;;
|
||||
- --omit-scsi-modules) ;;
|
||||
- --omit-ide-modules) ;;
|
||||
- --omit-raid-modules) ;;
|
||||
- --omit-lvm-modules) ;;
|
||||
- --omit-dmraid) ;;
|
||||
- --allow-missing) ;;
|
||||
- --net-dev*) ;;
|
||||
- --noresume) ;;
|
||||
- --rootdev*) ;;
|
||||
- --thawdev*) ;;
|
||||
- --rootopts*) ;;
|
||||
- --root*) ;;
|
||||
- --loopdev*) ;;
|
||||
- --loopfs*) ;;
|
||||
- --loopopts*) ;;
|
||||
- --looppath*) ;;
|
||||
- --dsdt*) ;;
|
||||
- -s) ;;
|
||||
- --quiet|-q) quiet=1;;
|
||||
- -b) read_arg boot_dir "$@" || shift $?
|
||||
- if [ ! -d $boot_dir ];then
|
||||
- error "Boot directory $boot_dir does not exist"
|
||||
- exit 1
|
||||
- fi
|
||||
- ;;
|
||||
- -k) # Would be nice to get a list of images here
|
||||
- read_arg kernel_images "$@" || shift $?
|
||||
- for kernel_image in $kernel_images;do
|
||||
- kernels="$kernels ${kernel_image#*-}"
|
||||
- done
|
||||
- host_only=1
|
||||
- force=1
|
||||
- ;;
|
||||
- -i) read_arg initrd_images "$@" || shift $?
|
||||
- for initrd_image in $initrd_images;do
|
||||
- targets="$targets $boot_dir/$initrd_image"
|
||||
- done
|
||||
- ;;
|
||||
- *) if [[ ! $targets ]]; then
|
||||
- targets=$1
|
||||
- elif [[ ! $kernels ]]; then
|
||||
- kernels=$1
|
||||
- else
|
||||
- usage
|
||||
- fi;;
|
||||
- esac
|
||||
- shift
|
||||
+ case ${1%%=*} in
|
||||
+ --with-usb)
|
||||
+ read_arg usbmodule "$@" || shift $?
|
||||
+ basicmodules="$basicmodules ${usbmodule:-usb-storage}"
|
||||
+ unset usbmodule
|
||||
+ ;;
|
||||
+ --with-avail)
|
||||
+ read_arg modname "$@" || shift $?
|
||||
+ basicmodules="$basicmodules $modname"
|
||||
+ ;;
|
||||
+ --with)
|
||||
+ read_arg modname "$@" || shift $?
|
||||
+ basicmodules="$basicmodules $modname"
|
||||
+ ;;
|
||||
+ --version)
|
||||
+ echo "mkinitrd: dracut compatibility wrapper"
|
||||
+ exit 0
|
||||
+ ;;
|
||||
+ -v | --verbose) dracut_args="${dracut_args} -v" ;;
|
||||
+ -f | --force) force=1 ;;
|
||||
+ --preload)
|
||||
+ read_arg modname "$@" || shift $?
|
||||
+ basicmodules="$basicmodules $modname"
|
||||
+ ;;
|
||||
+ --image-version) img_vers=yes ;;
|
||||
+ --rootfs | -d)
|
||||
+ read_arg rootfs "$@" || shift $?
|
||||
+ dracut_args="${dracut_args} --filesystems $rootfs"
|
||||
+ ;;
|
||||
+ --nocompress) dracut_args="$dracut_args --no-compress" ;;
|
||||
+ --set-hostonly) set_hostonly=1 ;;
|
||||
+ --no-hostonly) no_hostonly=1 ;;
|
||||
+ --help) usage -n ;;
|
||||
+ --builtin) ;;
|
||||
+ --without*) ;;
|
||||
+ --without-usb) ;;
|
||||
+ --fstab*) ;;
|
||||
+ --ifneeded) ;;
|
||||
+ --omit-scsi-modules) ;;
|
||||
+ --omit-ide-modules) ;;
|
||||
+ --omit-raid-modules) ;;
|
||||
+ --omit-lvm-modules) ;;
|
||||
+ --omit-dmraid) ;;
|
||||
+ --allow-missing) ;;
|
||||
+ --net-dev*) ;;
|
||||
+ --noresume) ;;
|
||||
+ --rootdev*) ;;
|
||||
+ --thawdev*) ;;
|
||||
+ --rootopts*) ;;
|
||||
+ --root*) ;;
|
||||
+ --loopdev*) ;;
|
||||
+ --loopfs*) ;;
|
||||
+ --loopopts*) ;;
|
||||
+ --looppath*) ;;
|
||||
+ --dsdt*) ;;
|
||||
+ -s) ;;
|
||||
+ --quiet | -q) quiet=1 ;;
|
||||
+ -b)
|
||||
+ read_arg boot_dir "$@" || shift $?
|
||||
+ if [ ! -d $boot_dir ]; then
|
||||
+ error "Boot directory $boot_dir does not exist"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ ;;
|
||||
+ -k) # Would be nice to get a list of images here
|
||||
+ read_arg kernel_images "$@" || shift $?
|
||||
+ for kernel_image in $kernel_images; do
|
||||
+ kernels="$kernels ${kernel_image#*-}"
|
||||
+ done
|
||||
+ host_only=1
|
||||
+ force=1
|
||||
+ ;;
|
||||
+ -i)
|
||||
+ read_arg initrd_images "$@" || shift $?
|
||||
+ for initrd_image in $initrd_images; do
|
||||
+ targets="$targets $boot_dir/$initrd_image"
|
||||
+ done
|
||||
+ ;;
|
||||
+ *) if [[ ! $targets ]]; then
|
||||
+ targets=$1
|
||||
+ elif [[ ! $kernels ]]; then
|
||||
+ kernels=$1
|
||||
+ else
|
||||
+ usage
|
||||
+ fi ;;
|
||||
+ esac
|
||||
+ shift
|
||||
done
|
||||
|
||||
[[ $targets && $kernels ]] || default_kernel_images
|
||||
-[[ $targets && $kernels ]] || (error "No Kernel Registered")
|
||||
+[[ $targets && $kernels ]] || error "No Kernel Registered"
|
||||
|
||||
# We can have several targets/kernels, transform the list to an array
|
||||
-targets=( $targets )
|
||||
-[[ $kernels ]] && kernels=( $kernels )
|
||||
+targets=($targets)
|
||||
+[[ $kernels ]] && kernels=($kernels)
|
||||
|
||||
# don't set hostonly flag if running in docker env
|
||||
# if set initrd will be incomplete
|
||||
@@ -174,38 +194,107 @@ if [ ${no_hostonly} -eq 1 ]; then
|
||||
fi
|
||||
|
||||
[[ $host_only == 1 ]] && dracut_args="${dracut_args} -H"
|
||||
-[[ $force == 1 ]] && dracut_args="${dracut_args} -f"
|
||||
+[[ $force == 1 ]] && dracut_args="${dracut_args} -f"
|
||||
|
||||
-for ((i=0 ; $i<${#targets[@]} ; i++)); do
|
||||
+initrd_sanity_check() {
|
||||
+ local ret=0
|
||||
+ local status="$1"
|
||||
+ local log_fn="$2"
|
||||
+ local target="$3"
|
||||
+ local errmsg=""
|
||||
|
||||
- if [[ $img_vers ]];then
|
||||
- target="${targets[$i]}-${kernels[$i]}"
|
||||
- else
|
||||
- target="${targets[$i]}"
|
||||
- fi
|
||||
- kernel="${kernels[$i]}"
|
||||
+ # initrd issues can be fatal, so if anything goes wrong during initrd creation
|
||||
+ # print errors to console
|
||||
+ if [ ${status} -ne 0 ]; then
|
||||
+ errmsg=$(cat << EOF
|
||||
+\n\n------------------------ ERROR NOTICE ------------------------------
|
||||
+ DRACUT RETURNED NON-ZERO EXIT STATUS(${status})
|
||||
|
||||
- if [[ -s "$kernel_ver_dir/$kernel" ]]; then
|
||||
- readarray -t kernel_cfg < <(xargs -n1 -a $kernel_ver_dir/$kernel)
|
||||
- else
|
||||
- kernel_cfg=()
|
||||
- fi
|
||||
+PROBABLY ${target} IS FAULTY
|
||||
+SYSTEM MAY BECOME UNUSABLE POST REBOOT
|
||||
+---------------------- PROCEED WITH CAUTION ------------------------
|
||||
+EOF
|
||||
+)
|
||||
+ echo -e "${errmsg}" 1>&2 |& tee -a "${log_fn}"
|
||||
+ ret=1
|
||||
+ fi
|
||||
+
|
||||
+ if ! lsinitrd ${target} 1>/dev/null; then
|
||||
+ errmsg=$(cat << EOF
|
||||
+\n\n------------------------ ERROR NOTICE ------------------------------
|
||||
+ lsinitrd ${target} FAILED
|
||||
+
|
||||
+PROBABLY ${target} IS FAULTY
|
||||
+SYSTEM MAY BECOME UNUSABLE POST REBOOT
|
||||
+---------------------- PROCEED WITH CAUTION -----------------------\n\n
|
||||
+EOF
|
||||
+)
|
||||
+ echo -e "${errmsg}" 1>&2 |& tee -a "${log_fn}"
|
||||
+ ret=1
|
||||
+ fi
|
||||
+
|
||||
+ return ${ret}
|
||||
+}
|
||||
|
||||
- # Duplicate code: No way found how to redirect output based on $quiet
|
||||
- if [[ $quiet == 1 ]];then
|
||||
- echo "Creating $target"
|
||||
- if [[ $basicmodules ]]; then
|
||||
- dracut $dracut_args --add-drivers "$basicmodules" "${kernel_cfg[@]}" "$target" \
|
||||
- "$kernel" &>/dev/null
|
||||
- else
|
||||
- dracut $dracut_args "${kernel_cfg[@]}" "$target" "$kernel" &>/dev/null
|
||||
- fi
|
||||
- else
|
||||
- if [[ $basicmodules ]]; then
|
||||
- dracut $dracut_args --add-drivers "$basicmodules" "${kernel_cfg[@]}" "$target" \
|
||||
- "$kernel"
|
||||
- else
|
||||
- dracut $dracut_args "${kernel_cfg[@]}" "$target" "$kernel"
|
||||
- fi
|
||||
+# If running in non tty, enable verbose
|
||||
+# It's probably happening in some kind of build env, we need verbose.
|
||||
+if ! test -t 1; then
|
||||
+ quiet=0
|
||||
+fi
|
||||
+
|
||||
+final_ret=0
|
||||
+
|
||||
+for ((i = 0; $i < ${#targets[@]}; i++)); do
|
||||
+ ret=0
|
||||
+ if [[ $img_vers ]];then
|
||||
+ target="${targets[$i]}-${kernels[$i]}"
|
||||
+ else
|
||||
+ target="${targets[$i]}"
|
||||
+ fi
|
||||
+ kernel="${kernels[$i]}"
|
||||
+
|
||||
+ log_fn="/var/log/mkinitrd-${kernel}.log"
|
||||
+
|
||||
+ echo "Creating $target"
|
||||
+
|
||||
+ if [ $DRACUT_DBG -ne 0 ]; then
|
||||
+ export DRACUT_INSTALL="/usr/lib/dracut/dracut-install --verbose"
|
||||
+ dracut_cmd="dracut -L 6 $dracut_args"
|
||||
+ else
|
||||
+ dracut_cmd="dracut $dracut_args"
|
||||
+ fi
|
||||
+
|
||||
+ # this check is for combination of newer and older kernels
|
||||
+ if [ -d "/lib/modules/${kernel}/dracut.conf.d" ]; then
|
||||
+ dracut_cmd+=" --confdir /lib/modules/${kernel}/dracut.conf.d"
|
||||
+ elif [ -d "/var/lib/initramfs/kernel" ]; then
|
||||
+ kernel_ver_dir="/var/lib/initramfs/kernel"
|
||||
+ if [ -s "$kernel_ver_dir/$kernel" ]; then
|
||||
+ dracut_cmd+=" $(cat $kernel_ver_dir/$kernel)"
|
||||
fi
|
||||
+ unset kernel_ver_dir
|
||||
+ else
|
||||
+ error "ERROR: /lib/modules/${kernel}/dracut.conf.d and /var/lib/initramfs/kernel present"
|
||||
+ exit 1
|
||||
+ fi
|
||||
+
|
||||
+ if [[ $basicmodules ]]; then
|
||||
+ dracut_cmd+=" --add-drivers \"$basicmodules\""
|
||||
+ fi
|
||||
+ dracut_cmd+=" \"$target\" \"$kernel\""
|
||||
+
|
||||
+ if [ ${quiet} -eq 1 ]; then
|
||||
+ eval "${dracut_cmd}" &> "${log_fn}"
|
||||
+ else
|
||||
+ eval "${dracut_cmd}" |& tee "${log_fn}"
|
||||
+ fi
|
||||
+
|
||||
+ ret=${PIPESTATUS[0]}
|
||||
+ if ! initrd_sanity_check "${ret}" "${log_fn}" "${target}"; then
|
||||
+ final_ret=1
|
||||
+ fi
|
||||
done
|
||||
+
|
||||
+[ $final_ret -ne 0 ] && error "--- ERROR: mkinitrd FAILED, SOMETHING WENT WRONG ---"
|
||||
+
|
||||
+exit ${final_ret}
|
||||
--
|
||||
2.39.2
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
From 0e5ca3234d449e068a9f6951590689ea1a3a66fb Mon Sep 17 00:00:00 2001
|
||||
From: Shreenidhi Shedi <sshedi@vmware.com>
|
||||
Date: Wed, 1 Mar 2023 01:29:02 +0530
|
||||
Subject: [PATCH 2/4] dracut.sh: validate instmods calls
|
||||
|
||||
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
|
||||
---
|
||||
dracut.sh | 15 ++++++++++++---
|
||||
modules.d/01fips/module-setup.sh | 8 +++++---
|
||||
2 files changed, 17 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/dracut.sh b/dracut.sh
|
||||
index bbb3469..76998a6 100755
|
||||
--- a/dracut.sh
|
||||
+++ b/dracut.sh
|
||||
@@ -2104,11 +2104,17 @@ if [[ $no_kernel != yes ]]; then
|
||||
|
||||
if [[ -n ${add_drivers// /} ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
- hostonly='' instmods -c $add_drivers
|
||||
+ if ! hostonly='' instmods -c $add_drivers; then
|
||||
+ dfatal "instmods failed for add_drivers: $add_drivers"
|
||||
+ exit 1
|
||||
+ fi
|
||||
fi
|
||||
if [[ $force_drivers ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
- hostonly='' instmods -c $force_drivers
|
||||
+ if ! hostonly='' instmods -c $force_drivers; then
|
||||
+ dfatal "instmods failed for force_drivers: $force_drivers"
|
||||
+ exit 1
|
||||
+ fi
|
||||
rm -f "$initdir"/etc/cmdline.d/20-force_driver.conf
|
||||
for mod in $force_drivers; do
|
||||
echo "rd.driver.pre=$mod" >> "$initdir"/etc/cmdline.d/20-force_drivers.conf
|
||||
@@ -2116,7 +2122,10 @@ if [[ $no_kernel != yes ]]; then
|
||||
fi
|
||||
if [[ $filesystems ]]; then
|
||||
# shellcheck disable=SC2086
|
||||
- hostonly='' instmods -c $filesystems
|
||||
+ if ! hostonly='' instmods -c $filesystems; then
|
||||
+ dfatal "instmods failed for filesystems: $filesystems"
|
||||
+ exit 1
|
||||
+ fi
|
||||
fi
|
||||
|
||||
dinfo "*** Installing kernel module dependencies ***"
|
||||
diff --git a/modules.d/01fips/module-setup.sh b/modules.d/01fips/module-setup.sh
|
||||
index a3e5602..0b759f9 100755
|
||||
--- a/modules.d/01fips/module-setup.sh
|
||||
+++ b/modules.d/01fips/module-setup.sh
|
||||
@@ -43,10 +43,12 @@ installkernel() {
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
for _mod in $_fipsmodules; do
|
||||
- if hostonly='' instmods -c -s "$_mod"; then
|
||||
- echo "$_mod" >> "${initdir}/etc/fipsmodules"
|
||||
- echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
+ if ! hostonly='' instmods -c -s "$_mod"; then
|
||||
+ dfatal "ERROR: instmods -c -s $_mod failed"
|
||||
+ return 1
|
||||
fi
|
||||
+ echo "$_mod" >> "${initdir}/etc/fipsmodules"
|
||||
+ echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
done
|
||||
|
||||
# with hostonly_default_device fs module for /boot is not installed by default
|
||||
--
|
||||
2.39.2
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
From fd7e3bff9f6a2a0031ccf2480967a8219e5240cd Mon Sep 17 00:00:00 2001
|
||||
From: Shreenidhi Shedi <sshedi@vmware.com>
|
||||
Date: Sat, 18 Feb 2023 18:11:51 +0530
|
||||
Subject: [PATCH 3/4] feat(dracut.sh): support multiple config dirs
|
||||
|
||||
Configuration can come from many places, users should not be restricted
|
||||
to keep all configuration files in one directory.
|
||||
|
||||
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
|
||||
---
|
||||
dracut.sh | 30 +++++++++++++++++++-----------
|
||||
man/dracut.8.asc | 4 ++--
|
||||
2 files changed, 21 insertions(+), 13 deletions(-)
|
||||
|
||||
diff --git a/dracut.sh b/dracut.sh
|
||||
index 76998a6..0088ad1 100755
|
||||
--- a/dracut.sh
|
||||
+++ b/dracut.sh
|
||||
@@ -154,8 +154,9 @@ Creates initial ramdisk images for preloading modules
|
||||
-q, --quiet Decrease verbosity level.
|
||||
-c, --conf [FILE] Specify configuration file to use.
|
||||
Default: /etc/dracut.conf
|
||||
- --confdir [DIR] Specify configuration directory to use *.conf files
|
||||
- from. Default: /etc/dracut.conf.d
|
||||
+ --confdir [LIST] Specify a space separated list of configuration
|
||||
+ directories to use *.conf files from.
|
||||
+ Default: /etc/dracut.conf.d
|
||||
--tmpdir [DIR] Temporary directory to be used instead of default
|
||||
${TMPDIR:-/var/tmp}.
|
||||
-r, --sysroot [DIR] Specify sysroot directory to collect files from.
|
||||
@@ -668,7 +669,7 @@ while :; do
|
||||
shift
|
||||
;;
|
||||
--confdir)
|
||||
- confdir="$2"
|
||||
+ confdirs_l=("$2")
|
||||
PARMS_TO_STORE+=" '$2'"
|
||||
shift
|
||||
;;
|
||||
@@ -911,15 +912,21 @@ elif [[ ! -e $conffile ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
-if [[ -z $confdir ]]; then
|
||||
+if [ ${#confdirs_l[@]} -eq 0 ]; then
|
||||
if [[ $allowlocal ]]; then
|
||||
- confdir="$dracutbasedir/dracut.conf.d"
|
||||
+ confdirs="$dracutbasedir/dracut.conf.d"
|
||||
else
|
||||
- confdir="$dracutsysrootdir/etc/dracut.conf.d"
|
||||
+ confdirs="$dracutsysrootdir/etc/dracut.conf.d"
|
||||
fi
|
||||
-elif [[ ! -d $confdir ]]; then
|
||||
- printf "%s\n" "dracut: Configuration directory '$confdir' not found." >&2
|
||||
- exit 1
|
||||
+else
|
||||
+ # shellcheck disable=SC2068
|
||||
+ for d in ${confdirs_l[@]}; do
|
||||
+ if [[ ! -d $d ]]; then
|
||||
+ printf "%s\n" "dracut: Configuration directory '$d' not found." >&2
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ confdirs+=" $d"
|
||||
+ done
|
||||
fi
|
||||
|
||||
# source our config file
|
||||
@@ -929,8 +936,9 @@ if [[ -f $conffile ]]; then
|
||||
. "$conffile"
|
||||
fi
|
||||
|
||||
-# source our config dir
|
||||
-for f in $(dropindirs_sort ".conf" "$confdir" "$dracutbasedir/dracut.conf.d"); do
|
||||
+# source config files from all config dirs
|
||||
+# shellcheck disable=SC2086
|
||||
+for f in $(dropindirs_sort ".conf" $confdirs "$dracutbasedir/dracut.conf.d"); do
|
||||
check_conf_file "$f"
|
||||
# shellcheck disable=SC1090
|
||||
[[ -e $f ]] && . "$f"
|
||||
diff --git a/man/dracut.8.asc b/man/dracut.8.asc
|
||||
index 5c2b147..3eddb5a 100644
|
||||
--- a/man/dracut.8.asc
|
||||
+++ b/man/dracut.8.asc
|
||||
@@ -305,8 +305,8 @@ example:
|
||||
Default:
|
||||
_/etc/dracut.conf_
|
||||
|
||||
-**--confdir** _<configuration directory>_::
|
||||
- Specify configuration directory to use.
|
||||
+**--confdir** _<list of dracut configuration directories>_::
|
||||
+ Specify a space-separated list of dracut configuration directories to use.
|
||||
+
|
||||
Default:
|
||||
_/etc/dracut.conf.d_
|
||||
--
|
||||
2.39.2
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
From 986e00a2f12b914222687cf1052ebc7e80f09160 Mon Sep 17 00:00:00 2001
|
||||
From: Shreenidhi Shedi <sshedi@vmware.com>
|
||||
Date: Sat, 18 Feb 2023 18:30:46 +0530
|
||||
Subject: [PATCH 4/4] feat(dracut.sh): support mutliple config files
|
||||
|
||||
Add provision to specify multiple config files.
|
||||
|
||||
Signed-off-by: Shreenidhi Shedi <sshedi@vmware.com>
|
||||
---
|
||||
dracut.sh | 38 +++++++++++++++++++++++---------------
|
||||
man/dracut.8.asc | 4 ++--
|
||||
2 files changed, 25 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/dracut.sh b/dracut.sh
|
||||
index 0088ad1..6c0c71e 100755
|
||||
--- a/dracut.sh
|
||||
+++ b/dracut.sh
|
||||
@@ -152,8 +152,8 @@ Creates initial ramdisk images for preloading modules
|
||||
6 - trace info (and even more)
|
||||
-v, --verbose Increase verbosity level.
|
||||
-q, --quiet Decrease verbosity level.
|
||||
- -c, --conf [FILE] Specify configuration file to use.
|
||||
- Default: /etc/dracut.conf
|
||||
+ -c, --conf [LIST] Specify a space separated list of configuration files
|
||||
+ to use. Default: /etc/dracut.conf
|
||||
--confdir [LIST] Specify a space separated list of configuration
|
||||
directories to use *.conf files from.
|
||||
Default: /etc/dracut.conf.d
|
||||
@@ -664,7 +664,7 @@ while :; do
|
||||
shift
|
||||
;;
|
||||
-c | --conf)
|
||||
- conffile="$2"
|
||||
+ conffiles_l="$2"
|
||||
PARMS_TO_STORE+=" '$2'"
|
||||
shift
|
||||
;;
|
||||
@@ -901,15 +901,21 @@ export DRACUT_LOG_LEVEL=warning
|
||||
[[ $dracutbasedir ]] || dracutbasedir="$dracutsysrootdir"/usr/lib/dracut
|
||||
|
||||
# if we were not passed a config file, try the default one
|
||||
-if [[ -z $conffile ]]; then
|
||||
+if [ ${#conffiles_l[@]} -eq 0 ]; then
|
||||
if [[ $allowlocal ]]; then
|
||||
- conffile="$dracutbasedir/dracut.conf"
|
||||
+ conffiles="$dracutbasedir/dracut.conf"
|
||||
else
|
||||
- conffile="$dracutsysrootdir/etc/dracut.conf"
|
||||
+ conffiles="$dracutsysrootdir/etc/dracut.conf"
|
||||
fi
|
||||
-elif [[ ! -e $conffile ]]; then
|
||||
- printf "%s\n" "dracut: Configuration file '$conffile' not found." >&2
|
||||
- exit 1
|
||||
+else
|
||||
+ # shellcheck disable=SC2068
|
||||
+ for f in ${conffiles_l[@]}; do
|
||||
+ if [[ ! -e $f ]]; then
|
||||
+ printf "%s\n" "dracut: Configuration file '$f' not found." >&2
|
||||
+ exit 1
|
||||
+ fi
|
||||
+ conffiles+=" $f"
|
||||
+ done
|
||||
fi
|
||||
|
||||
if [ ${#confdirs_l[@]} -eq 0 ]; then
|
||||
@@ -929,12 +935,14 @@ else
|
||||
done
|
||||
fi
|
||||
|
||||
-# source our config file
|
||||
-if [[ -f $conffile ]]; then
|
||||
- check_conf_file "$conffile"
|
||||
- # shellcheck disable=SC1090
|
||||
- . "$conffile"
|
||||
-fi
|
||||
+# source all config files
|
||||
+for f in $conffiles; do
|
||||
+ if [[ -f $f ]]; then
|
||||
+ check_conf_file "$f"
|
||||
+ # shellcheck disable=SC1090
|
||||
+ . "$f"
|
||||
+ fi
|
||||
+done
|
||||
|
||||
# source config files from all config dirs
|
||||
# shellcheck disable=SC2086
|
||||
diff --git a/man/dracut.8.asc b/man/dracut.8.asc
|
||||
index 3eddb5a..0d9fe48 100644
|
||||
--- a/man/dracut.8.asc
|
||||
+++ b/man/dracut.8.asc
|
||||
@@ -299,8 +299,8 @@ example:
|
||||
**-q, --quiet**::
|
||||
Decrease verbosity level (default is info(4)).
|
||||
|
||||
-**-c, --conf** _<dracut configuration file>_::
|
||||
- Specify configuration file to use.
|
||||
+**-c, --conf** _<list of dracut configuration files>_::
|
||||
+ Specify a space-separated list of configuration files to use.
|
||||
+
|
||||
Default:
|
||||
_/etc/dracut.conf_
|
||||
--
|
||||
2.39.2
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
Summary: dracut to create initramfs
|
||||
Name: dracut
|
||||
Version: 059
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Group: System Environment/Base
|
||||
# The entire source code is GPLv2+; except install/* which is LGPLv2+
|
||||
License: GPLv2+ and LGPLv2+
|
||||
|
@ -15,10 +15,14 @@ Distribution: Photon
|
|||
Source0: https://github.com/dracutdevs/dracut/archive/refs/tags/%{name}-%{version}.tar.gz
|
||||
%define sha512 %{name}=196bc8bf18703c72bffb51a7e0493719c58173ad2da7d121eb42f9a8de47e953af36d109214dc4a10b2dc2d3bd19e844f7f51c2bdec087e064ea11f75124032d
|
||||
|
||||
Patch0: Add-mkinitrd-support-to-dracut.patch
|
||||
Patch1: disable-xattr.patch
|
||||
Patch2: fix-initrd-naming-for-photon.patch
|
||||
Patch4: fix-hostonly.patch
|
||||
Patch0: Add-mkinitrd-support-to-dracut.patch
|
||||
Patch1: disable-xattr.patch
|
||||
Patch2: fix-initrd-naming-for-photon.patch
|
||||
Patch4: fix-hostonly.patch
|
||||
Patch5: 0001-mkinitrd-verbose-fix.patch
|
||||
Patch6: 0002-dracut.sh-validate-instmods-calls.patch
|
||||
Patch7: 0003-feat-dracut.sh-support-multiple-config-dirs.patch
|
||||
Patch8: 0004-feat-dracut.sh-support-mutliple-config-files.patch
|
||||
|
||||
BuildRequires: bash
|
||||
BuildRequires: pkg-config
|
||||
|
@ -153,6 +157,8 @@ rm -rf -- %{buildroot}
|
|||
%dir %{_sharedstatedir}/%{name}/overlay
|
||||
|
||||
%changelog
|
||||
* Wed Mar 01 2023 Shreenidhi Shedi <sshedi@vmware.com> 059-3
|
||||
- Fix mkinitrd verbose & add a sanity check
|
||||
* Wed Jan 25 2023 Shreenidhi Shedi <sshedi@vmware.com> 059-2
|
||||
- Fix requires
|
||||
* Mon Jan 02 2023 Shreenidhi Shedi <sshedi@vmware.com> 059-1
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
Summary: initramfs
|
||||
Name: initramfs
|
||||
Version: 2.0
|
||||
Release: 7%{?dist}
|
||||
Source0: fscks.conf
|
||||
License: Apache License
|
||||
Group: System Environment/Base
|
||||
Vendor: VMware, Inc.
|
||||
Distribution: Photon
|
||||
Summary: initramfs
|
||||
Name: initramfs
|
||||
Version: 2.0
|
||||
Release: 8%{?dist}
|
||||
License: Apache License
|
||||
Group: System Environment/Base
|
||||
Vendor: VMware, Inc.
|
||||
Distribution: Photon
|
||||
|
||||
Provides: initramfs
|
||||
Source0: fscks.conf
|
||||
|
||||
Requires: dracut
|
||||
Provides: initramfs
|
||||
|
||||
Requires: dracut >= 059-3
|
||||
|
||||
%description
|
||||
This package provides the configuration files for initrd generation.
|
||||
|
@ -18,12 +19,11 @@ This package provides the configuration files for initrd generation.
|
|||
%install
|
||||
mkdir -p %{buildroot}%{_sysconfdir}/dracut.conf.d
|
||||
install -D -m644 %{SOURCE0} %{buildroot}%{_sysconfdir}/dracut.conf.d/
|
||||
install -d -m755 %{buildroot}%{_localstatedir}/lib/initramfs/kernel
|
||||
|
||||
%define watched_path %{_sbindir} %{_libdir}/udev/rules.d %{_libdir}/systemd/system /lib/modules %{_sysconfdir}/dracut.conf.d
|
||||
%define watched_pkgs e2fsprogs, systemd, kpartx, device-mapper-multipath
|
||||
|
||||
%define removal_action() rm -rf %{_localstatedir}/lib/rpm-state/initramfs
|
||||
%define removal_action() rm -rf %{_sharedstatedir}/rpm-state/initramfs
|
||||
|
||||
# How it works:
|
||||
#
|
||||
|
@ -63,84 +63,85 @@ install -d -m755 %{buildroot}%{_localstatedir}/lib/initramfs/kernel
|
|||
# the triggerun in linux.rpm will remove the corresponding initrd.
|
||||
|
||||
%define pkgs_trigger_action() \
|
||||
[ -f %{_localstatedir}/lib/rpm-state/initramfs/regenerate ] && exit 0 \
|
||||
mkdir -p %{_localstatedir}/lib/rpm-state/initramfs \
|
||||
touch %{_localstatedir}/lib/rpm-state/initramfs/regenerate \
|
||||
[ -f %{_sharedstatedir}/rpm-state/initramfs/regenerate ] && exit 0 \
|
||||
mkdir -p %{_sharedstatedir}/rpm-state/initramfs \
|
||||
touch %{_sharedstatedir}/rpm-state/initramfs/regenerate \
|
||||
echo "initramfs (re)generation" %* >&2
|
||||
|
||||
%define file_trigger_action() \
|
||||
cat > /dev/null \
|
||||
if [ -f %{_localstatedir}/lib/rpm-state/initramfs/regenerate ]; then \
|
||||
echo "(re)generate initramfs for all kernels," %* >&2 \
|
||||
mkinitrd -q \
|
||||
elif [ -d %{_localstatedir}/lib/rpm-state/initramfs/pending ]; then \
|
||||
for k in `ls %{_localstatedir}/lib/rpm-state/initramfs/pending/`; do \
|
||||
echo "(re)generate initramfs for $k," %* >&2 \
|
||||
mkinitrd -q /boot/initrd.img-$k $k \
|
||||
done; \
|
||||
if [ -f %{_sharedstatedir}/rpm-state/initramfs/regenerate ]; then \
|
||||
echo "(re)generate initramfs for all kernels," %* >&2 \
|
||||
mkinitrd -q \
|
||||
elif [ -d %{_sharedstatedir}/rpm-state/initramfs/pending ]; then \
|
||||
for k in $(ls %{_sharedstatedir}/rpm-state/initramfs/pending/); do \
|
||||
echo "(re)generate initramfs for $k," %* >&2 \
|
||||
mkinitrd -q /boot/initrd.img-$k $k \
|
||||
done; \
|
||||
fi \
|
||||
%removal_action
|
||||
%{removal_action}
|
||||
|
||||
%posttrans
|
||||
echo "initramfs" %{version}-%{release} "posttrans" >&2
|
||||
%removal_action
|
||||
%{removal_action}
|
||||
mkinitrd -q
|
||||
|
||||
%postun
|
||||
echo "initramfs" %{version}-%{release} "postun" >&2
|
||||
#cleanup the states
|
||||
%removal_action
|
||||
%{removal_action}
|
||||
|
||||
%triggerin -- %{watched_pkgs}
|
||||
[ $1 -gt 1 ] && exit 0
|
||||
#Upgrading, let the posttrans of new initramfs handles it
|
||||
%pkgs_trigger_action triggerin $* %{version}-%{release}
|
||||
%{pkgs_trigger_action} triggerin $* %{version}-%{release}
|
||||
|
||||
%triggerun -- %{watched_pkgs}
|
||||
[ $1 -eq 0 ] && exit 0
|
||||
#Uninstalling, let the linux.rpm removes initrd for themselves
|
||||
%pkgs_trigger_action triggerun $* %{version}-%{release}
|
||||
%{pkgs_trigger_action} triggerun $* %{version}-%{release}
|
||||
|
||||
%transfiletriggerin -- %{watched_path}
|
||||
%file_trigger_action transfilertriggerin %{version}-%{release}
|
||||
%{file_trigger_action} transfilertriggerin %{version}-%{release}
|
||||
|
||||
%transfiletriggerpostun -- %{watched_path}
|
||||
%file_trigger_action transfiletriggerpostun %{version}-%{release}
|
||||
%{file_trigger_action} transfiletriggerpostun %{version}-%{release}
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,-)
|
||||
%{_sysconfdir}/dracut.conf.d/fscks.conf
|
||||
%dir %{_localstatedir}/lib/initramfs/kernel
|
||||
|
||||
%changelog
|
||||
* Mon Jul 12 2021 Shreenidhi Shedi <sshedi@vmware.com> 2.0-7
|
||||
- Bump version as a part of dracut upgrade
|
||||
* Tue Nov 03 2020 Srinidhi Rao <srinidhir@vmware.com> 2.0-6
|
||||
- Remove the trigger for fipsify
|
||||
* Tue Mar 17 2020 Vikash Bansal <bvikas@vmware.com> 2.0-5
|
||||
- Added trigger for fipsify
|
||||
* Mon Aug 27 2018 Dheeraj Shetty <dheerajs@vmware.com> 2.0-4
|
||||
- Remove watching ostree
|
||||
* Thu Jul 27 2017 Bo Gan <ganb@vmware.com> 2.0-3
|
||||
- Move all states to one directory
|
||||
* Fri May 26 2017 Bo Gan <ganb@vmware.com> 2.0-2
|
||||
- Discard stdin before dracut
|
||||
* Wed Apr 12 2017 Bo Gan <ganb@vmware.com> 2.0-1
|
||||
- Made initrd generation dynamic, triggers for systemd, e2fs-progs
|
||||
* Wed Nov 30 2016 Alexey Makhalov <amakhalov@vmware.com> 1.0-7
|
||||
- Expand uname -r to have release number
|
||||
* Wed Nov 23 2016 Anish Swaminathan <anishs@vmware.com> 1.0-6
|
||||
- Dracut module change to include systemd initrd target
|
||||
* Tue Sep 20 2016 Alexey Makhalov <amakhalov@vmware.com> 1.0-5
|
||||
- Added fsck tools
|
||||
- Use kernel version and release number in initrd file name
|
||||
* Mon Aug 1 2016 Divya Thaluru <dthaluru@vmware.com> 1.0-4
|
||||
- Added kernel macros
|
||||
* Thu Jun 30 2016 Xiaolin Li <xiaolinl@vmware.com> 1.0-4
|
||||
- Exapand setup macro and remove the source file.
|
||||
* Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.0-3
|
||||
- GA - Bump release of all rpms
|
||||
* Thu Apr 28 2016 Alexey Makhalov <amakhalov@vmware.com> 1.0-2
|
||||
- Update to linux-4.4.8
|
||||
* Thu Mar 24 2016 Xiaolin Li <xiaolinl@vmware.com> 1.0-1
|
||||
- Initial version.
|
||||
* Wed Mar 01 2023 Shreenidhi Shedi <sshedi@vmware.com> 2.0-8
|
||||
- Fix dracut dependency
|
||||
* Mon Jul 12 2021 Shreenidhi Shedi <sshedi@vmware.com> 2.0-7
|
||||
- Bump version as a part of dracut upgrade
|
||||
* Tue Nov 03 2020 Srinidhi Rao <srinidhir@vmware.com> 2.0-6
|
||||
- Remove the trigger for fipsify
|
||||
* Tue Mar 17 2020 Vikash Bansal <bvikas@vmware.com> 2.0-5
|
||||
- Added trigger for fipsify
|
||||
* Mon Aug 27 2018 Dheeraj Shetty <dheerajs@vmware.com> 2.0-4
|
||||
- Remove watching ostree
|
||||
* Thu Jul 27 2017 Bo Gan <ganb@vmware.com> 2.0-3
|
||||
- Move all states to one directory
|
||||
* Fri May 26 2017 Bo Gan <ganb@vmware.com> 2.0-2
|
||||
- Discard stdin before dracut
|
||||
* Wed Apr 12 2017 Bo Gan <ganb@vmware.com> 2.0-1
|
||||
- Made initrd generation dynamic, triggers for systemd, e2fs-progs
|
||||
* Wed Nov 30 2016 Alexey Makhalov <amakhalov@vmware.com> 1.0-7
|
||||
- Expand uname -r to have release number
|
||||
* Wed Nov 23 2016 Anish Swaminathan <anishs@vmware.com> 1.0-6
|
||||
- Dracut module change to include systemd initrd target
|
||||
* Tue Sep 20 2016 Alexey Makhalov <amakhalov@vmware.com> 1.0-5
|
||||
- Added fsck tools
|
||||
- Use kernel version and release number in initrd file name
|
||||
* Mon Aug 1 2016 Divya Thaluru <dthaluru@vmware.com> 1.0-4
|
||||
- Added kernel macros
|
||||
* Thu Jun 30 2016 Xiaolin Li <xiaolinl@vmware.com> 1.0-4
|
||||
- Exapand setup macro and remove the source file.
|
||||
* Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 1.0-3
|
||||
- GA - Bump release of all rpms
|
||||
* Thu Apr 28 2016 Alexey Makhalov <amakhalov@vmware.com> 1.0-2
|
||||
- Update to linux-4.4.8
|
||||
* Thu Mar 24 2016 Xiaolin Li <xiaolinl@vmware.com> 1.0-1
|
||||
- Initial version.
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
%triggerin -- initramfs
|
||||
mkdir -p %{_localstatedir}/lib/rpm-state/initramfs/pending
|
||||
touch %{_localstatedir}/lib/rpm-state/initramfs/pending/%{uname_r}
|
||||
mkdir -p %{_sharedstatedir}/rpm-state/initramfs/pending
|
||||
touch %{_sharedstatedir}/rpm-state/initramfs/pending/%{uname_r}
|
||||
echo "initrd generation of kernel %{uname_r} will be triggered later" >&2
|
||||
|
||||
%triggerun -- initramfs
|
||||
rm -rf %{_localstatedir}/lib/rpm-state/initramfs/pending/%{uname_r}
|
||||
rm -rf /boot/initrd.img-%{uname_r}
|
||||
rm -f %{_sharedstatedir}/rpm-state/initramfs/pending/%{uname_r} \
|
||||
/boot/initrd.img-%{uname_r}
|
||||
|
||||
echo "initrd of kernel %{uname_r} removed" >&2
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
add_drivers+=" xen-scsifront xen-blkfront xen-acpi-processor xen-evtchn xen-gntalloc xen-gntdev xen-privcmd xen-pciback xenfs hv_utils hv_vmbus hv_storvsc hv_netvsc hv_sock hv_balloon cn dm-mod megaraid_sas "
|
|
@ -0,0 +1 @@
|
|||
add_drivers+=" dm-mod "
|
|
@ -23,7 +23,7 @@
|
|||
Summary: Kernel
|
||||
Name: linux-esx
|
||||
Version: 6.1.10
|
||||
Release: 2%{?kat_build:.kat}%{?dist}
|
||||
Release: 3%{?kat_build:.kat}%{?dist}
|
||||
License: GPLv2
|
||||
URL: http://www.kernel.org
|
||||
Group: System Environment/Kernel
|
||||
|
@ -68,6 +68,8 @@ Source18: speedup-algos-registration-in-non-fips-mode.patch
|
|||
|
||||
Source19: spec_install_post.inc
|
||||
|
||||
Source20: %{name}-dracut.conf
|
||||
|
||||
# common [0..49]
|
||||
Patch0: confdata-format-change-for-split-script.patch
|
||||
Patch1: net-Double-tcp_mem-limits.patch
|
||||
|
@ -145,6 +147,7 @@ Patch100: 6.0-0003-apparmor-fix-use-after-free-in-sk_peer_label.patch
|
|||
Patch101: KVM-Don-t-accept-obviously-wrong-gsi-values-via-KVM_.patch
|
||||
|
||||
# aarch64 [200..219]
|
||||
%ifarch aarch64
|
||||
Patch200: 6.0-0001-x86-hyper-generalize-hypervisor-type-detection.patch
|
||||
Patch201: 6.0-0002-arm64-Generic-hypervisor-type-detection-for-arm64.patch
|
||||
Patch202: 6.0-0003-arm64-VMware-hypervisor-detection.patch
|
||||
|
@ -153,6 +156,7 @@ Patch204: 6.0-0005-scsi-vmw_pvscsi-add-arm64-support.patch
|
|||
Patch205: 6.0-0006-vmxnet3-build-only-for-x86-and-arm64.patch
|
||||
Patch206: 6.0-0005-vmw_balloon-add-arm64-support.patch
|
||||
Patch207: 6.0-0001-vmw_vmci-arm64-support-memory-ordering.patch
|
||||
%endif
|
||||
|
||||
# Crypto: [500..529]
|
||||
# Patch to add drbg_pr_ctr_aes256 test vectors to testmgr
|
||||
|
@ -221,6 +225,8 @@ BuildRequires: gdb
|
|||
|
||||
Requires: kmod
|
||||
Requires: filesystem
|
||||
Requires: dracut >= 059-3
|
||||
Requires: initramfs >= 2.0-8
|
||||
Requires(pre): (coreutils or coreutils-selinux)
|
||||
Requires(preun): (coreutils or coreutils-selinux)
|
||||
Requires(post): (coreutils or coreutils-selinux)
|
||||
|
@ -415,12 +421,6 @@ photon_linux=vmlinuz-%{uname_r}
|
|||
photon_initrd=initrd.img-%{uname_r}
|
||||
EOF
|
||||
|
||||
# Register myself to initramfs
|
||||
mkdir -p %{buildroot}%{_localstatedir}/lib/initramfs/kernel
|
||||
cat > %{buildroot}%{_localstatedir}/lib/initramfs/kernel/%{uname_r} << "EOF"
|
||||
--add-drivers "dm-mod"
|
||||
EOF
|
||||
|
||||
# cleanup dangling symlinks
|
||||
rm -f %{buildroot}%{_modulesdir}/source \
|
||||
%{buildroot}%{_modulesdir}/build
|
||||
|
@ -442,6 +442,9 @@ cp .config %{buildroot}%{_usrsrc}/linux-headers-%{uname_r}
|
|||
ln -sf "%{_usrsrc}/linux-headers-%{uname_r}" "%{buildroot}%{_modulesdir}/build"
|
||||
find %{buildroot}/lib/modules -name '*.ko' -print0 | xargs -0 chmod u+x
|
||||
|
||||
mkdir -p %{buildroot}%{_modulesdir}/dracut.conf.d/
|
||||
cp -p %{SOURCE20} %{buildroot}%{_modulesdir}/dracut.conf.d/%{name}.conf
|
||||
|
||||
%include %{SOURCE2}
|
||||
%include %{SOURCE3}
|
||||
%include %{SOURCE19}
|
||||
|
@ -456,7 +459,6 @@ ln -sf linux-%{uname_r}.cfg /boot/photon.cfg
|
|||
/boot/config-%{uname_r}
|
||||
/boot/vmlinuz-%{uname_r}
|
||||
%config(noreplace) /boot/linux-%{uname_r}.cfg
|
||||
%config %{_localstatedir}/lib/initramfs/kernel/%{uname_r}
|
||||
/lib/modules/*
|
||||
%exclude %{_modulesdir}/build
|
||||
%ifarch x86_64
|
||||
|
@ -470,6 +472,8 @@ ln -sf linux-%{uname_r}.cfg /boot/photon.cfg
|
|||
%exclude /lib/firmware/updates/intel/ice
|
||||
%endif
|
||||
|
||||
%config(noreplace) %{_modulesdir}/dracut.conf.d/%{name}.conf
|
||||
|
||||
%files docs
|
||||
%defattr(-,root,root)
|
||||
%{_defaultdocdir}/linux-%{uname_r}/*
|
||||
|
@ -483,6 +487,9 @@ ln -sf linux-%{uname_r}.cfg /boot/photon.cfg
|
|||
%{_usrsrc}/linux-headers-%{uname_r}
|
||||
|
||||
%changelog
|
||||
* Thu Mar 02 2023 Shreenidhi Shedi <sshedi@vmware.com> 6.1.10-3
|
||||
- Fix initrd generation logic
|
||||
- Add dracut, initramfs to requires
|
||||
* Fri Feb 24 2023 Ankit Jain <ankitja@vmware.com> 6.1.10-2
|
||||
- Exclude iavf.conf
|
||||
* Wed Feb 22 2023 Bo Gan <ganb@vmware.com> 6.1.10-1
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
add_drivers+=" cn dm-mod megaraid_sas "
|
|
@ -17,7 +17,7 @@
|
|||
Summary: Kernel
|
||||
Name: linux-rt
|
||||
Version: 6.1.10
|
||||
Release: 2%{?kat_build:.kat}%{?dist}
|
||||
Release: 3%{?kat_build:.kat}%{?dist}
|
||||
License: GPLv2
|
||||
URL: http://www.kernel.org
|
||||
Group: System Environment/Kernel
|
||||
|
@ -61,6 +61,8 @@ Source17: fips_canister-kallsyms
|
|||
Source18: modify_kernel_configs.inc
|
||||
Source19: spec_install_post.inc
|
||||
|
||||
Source20: %{name}-dracut.conf
|
||||
|
||||
# common
|
||||
Patch0: net-Double-tcp_mem-limits.patch
|
||||
Patch1: SUNRPC-xs_bind-uses-ip_local_reserved_ports.patch
|
||||
|
@ -238,6 +240,8 @@ BuildRequires: gdb
|
|||
|
||||
Requires: kmod
|
||||
Requires: filesystem
|
||||
Requires: dracut >= 059-3
|
||||
Requires: initramfs >= 2.0-8
|
||||
Requires(pre): (coreutils or coreutils-selinux)
|
||||
Requires(preun): (coreutils or coreutils-selinux)
|
||||
Requires(post): (coreutils or coreutils-selinux)
|
||||
|
@ -436,12 +440,6 @@ photon_linux=vmlinuz-%{uname_r}
|
|||
photon_initrd=initrd.img-%{uname_r}
|
||||
EOF
|
||||
|
||||
# Register myself to initramfs
|
||||
mkdir -p %{buildroot}%{_localstatedir}/lib/initramfs/kernel
|
||||
cat > %{buildroot}%{_localstatedir}/lib/initramfs/kernel/%{uname_r} << "EOF"
|
||||
--add-drivers "cn dm-mod megaraid_sas"
|
||||
EOF
|
||||
|
||||
# Cleanup dangling symlinks
|
||||
rm -rf %{buildroot}%{_modulesdir}/source \
|
||||
%{buildroot}%{_modulesdir}/build
|
||||
|
@ -460,6 +458,9 @@ cp .config %{buildroot}%{_usrsrc}/linux-headers-%{uname_r} # copy .config manual
|
|||
ln -sf "%{_usrsrc}/linux-headers-%{uname_r}" "%{buildroot}%{_modulesdir}/build"
|
||||
find %{buildroot}/lib/modules -name '*.ko' -print0 | xargs -0 chmod u+x
|
||||
|
||||
mkdir -p %{buildroot}%{_modulesdir}/dracut.conf.d/
|
||||
cp -p %{SOURCE20} %{buildroot}%{_modulesdir}/dracut.conf.d/%{name}.conf
|
||||
|
||||
%include %{SOURCE2}
|
||||
%include %{SOURCE4}
|
||||
%include %{SOURCE19}
|
||||
|
@ -474,7 +475,6 @@ ln -sf linux-%{uname_r}.cfg /boot/photon.cfg
|
|||
/boot/config-%{uname_r}
|
||||
/boot/vmlinuz-%{uname_r}
|
||||
%config(noreplace) /boot/linux-%{uname_r}.cfg
|
||||
%config %{_localstatedir}/lib/initramfs/kernel/%{uname_r}
|
||||
%defattr(0644,root,root)
|
||||
%{_modulesdir}/*
|
||||
%exclude %{_modulesdir}/build
|
||||
|
@ -487,6 +487,8 @@ ln -sf linux-%{uname_r}.cfg /boot/photon.cfg
|
|||
# ICE driver firmware files are packaged in linux-firmware
|
||||
%exclude /lib/firmware/updates/intel/ice
|
||||
|
||||
%config(noreplace) %{_modulesdir}/dracut.conf.d/%{name}.conf
|
||||
|
||||
%files docs
|
||||
%defattr(-,root,root)
|
||||
%{_defaultdocdir}/linux-%{uname_r}/*
|
||||
|
@ -498,6 +500,9 @@ ln -sf linux-%{uname_r}.cfg /boot/photon.cfg
|
|||
%{_usrsrc}/linux-headers-%{uname_r}
|
||||
|
||||
%changelog
|
||||
* Thu Mar 02 2023 Shreenidhi Shedi <sshedi@vmware.com> 6.1.10-3
|
||||
- Fix initrd generation logic
|
||||
- Add dracut, initramfs to requires
|
||||
* Fri Feb 24 2023 Ankit Jain <ankitja@vmware.com> 6.1.10-2
|
||||
- Exclude iavf.conf
|
||||
* Thu Feb 16 2023 Srivatsa S. Bhat (VMware) <srivatsa@csail.mit.edu> 6.1.10-1
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
add_drivers+=" hv_utils hv_vmbus hv_storvsc hv_netvsc hv_sock hv_balloon cn dm-mod "
|
|
@ -16,7 +16,7 @@
|
|||
Summary: Kernel
|
||||
Name: linux-secure
|
||||
Version: 6.1.10
|
||||
Release: 3%{?kat_build:.kat}%{?dist}
|
||||
Release: 4%{?kat_build:.kat}%{?dist}
|
||||
License: GPLv2
|
||||
URL: http://www.kernel.org
|
||||
Group: System Environment/Kernel
|
||||
|
@ -55,6 +55,7 @@ Source24: gen_canister_relocs.c
|
|||
%endif
|
||||
|
||||
Source25: spec_install_post.inc
|
||||
Source26: %{name}-dracut.conf
|
||||
|
||||
# common
|
||||
Patch0: net-Double-tcp_mem-limits.patch
|
||||
|
@ -146,6 +147,8 @@ BuildRequires: gdb
|
|||
|
||||
Requires: kmod
|
||||
Requires: filesystem
|
||||
Requires: dracut >= 059-3
|
||||
Requires: initramfs >= 2.0-8
|
||||
Requires(pre): (coreutils or coreutils-selinux)
|
||||
Requires(preun): (coreutils or coreutils-selinux)
|
||||
Requires(post): (coreutils or coreutils-selinux)
|
||||
|
@ -306,12 +309,6 @@ photon_linux=vmlinuz-%{uname_r}
|
|||
photon_initrd=initrd.img-%{uname_r}
|
||||
EOF
|
||||
|
||||
# Register myself to initramfs
|
||||
mkdir -p %{buildroot}%{_localstatedir}/lib/initramfs/kernel
|
||||
cat > %{buildroot}%{_localstatedir}/lib/initramfs/kernel/%{uname_r} << "EOF"
|
||||
--add-drivers "xen-scsifront xen-blkfront xen-acpi-processor xen-evtchn xen-gntalloc xen-gntdev xen-privcmd xen-pciback xenfs hv_utils hv_vmbus hv_storvsc hv_netvsc hv_sock hv_balloon cn dm-mod"
|
||||
EOF
|
||||
|
||||
# cleanup dangling symlinks
|
||||
rm -f %{buildroot}%{_modulesdir}/source \
|
||||
%{buildroot}%{_modulesdir}/build
|
||||
|
@ -332,6 +329,9 @@ cp .config %{buildroot}%{_usrsrc}/linux-headers-%{uname_r}
|
|||
# symling to the build folder
|
||||
ln -sf %{_usrsrc}/linux-headers-%{uname_r} %{buildroot}%{_modulesdir}/build
|
||||
|
||||
mkdir -p %{buildroot}%{_modulesdir}/dracut.conf.d/
|
||||
cp -p %{SOURCE26} %{buildroot}%{_modulesdir}/dracut.conf.d/%{name}.conf
|
||||
|
||||
%include %{SOURCE2}
|
||||
%include %{SOURCE3}
|
||||
%include %{SOURCE25}
|
||||
|
@ -346,11 +346,12 @@ ln -sf linux-%{uname_r}.cfg /boot/photon.cfg
|
|||
/boot/config-%{uname_r}
|
||||
/boot/vmlinuz-%{uname_r}
|
||||
%config(noreplace) /boot/linux-%{uname_r}.cfg
|
||||
%config %{_localstatedir}/lib/initramfs/kernel/%{uname_r}
|
||||
/lib/modules/*
|
||||
%exclude %{_modulesdir}/build
|
||||
%exclude %{_usrsrc}
|
||||
|
||||
%config(noreplace) %{_modulesdir}/dracut.conf.d/%{name}.conf
|
||||
|
||||
%files docs
|
||||
%defattr(-,root,root)
|
||||
%{_defaultdocdir}/linux-%{uname_r}/*
|
||||
|
@ -367,6 +368,9 @@ ln -sf linux-%{uname_r}.cfg /boot/photon.cfg
|
|||
%endif
|
||||
|
||||
%changelog
|
||||
* Thu Mar 02 2023 Shreenidhi Shedi <sshedi@vmware.com> 6.1.10-4
|
||||
- Fix initrd generation logic
|
||||
- Add dracut, initramfs to requires
|
||||
* Thu Feb 23 2023 Keerthana K <keerthanak@vmware.com> 6.1.10-3
|
||||
- Add stackleak_track_stack() in fips_canister_wrapper
|
||||
* Fri Feb 17 2023 Keerthana K <keerthanak@vmware.com> 6.1.10-2
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
Summary: Kernel
|
||||
Name: linux
|
||||
Version: 6.1.10
|
||||
Release: 2%{?kat_build:.kat}%{?dist}
|
||||
Release: 3%{?kat_build:.kat}%{?dist}
|
||||
License: GPLv2
|
||||
URL: http://www.kernel.org/
|
||||
Group: System Environment/Kernel
|
||||
|
@ -73,6 +73,7 @@ Source17: fips_canister-kallsyms
|
|||
%endif
|
||||
|
||||
Source18: spec_install_post.inc
|
||||
Source19: %{name}-dracut.conf
|
||||
|
||||
# common [0..49]
|
||||
Patch0: confdata-format-change-for-split-script.patch
|
||||
|
@ -128,6 +129,7 @@ Patch202: 0002-of-configfs-Use-of_overlay_fdt_apply-API-call.patch
|
|||
Patch203: 0003-of-overlay-Correct-symbol-path-fixups.patch
|
||||
# Rpi fan driver
|
||||
# arm64 hypervisor detection and kmsg dumper
|
||||
%ifarch aarch64
|
||||
Patch205: 6.0-0001-x86-hyper-generalize-hypervisor-type-detection.patch
|
||||
Patch206: 6.0-0002-arm64-Generic-hypervisor-type-detection-for-arm64.patch
|
||||
Patch207: 6.0-0003-arm64-VMware-hypervisor-detection.patch
|
||||
|
@ -136,6 +138,7 @@ Patch209: 6.0-0005-scsi-vmw_pvscsi-add-arm64-support.patch
|
|||
Patch210: 6.0-0006-vmxnet3-build-only-for-x86-and-arm64.patch
|
||||
Patch211: 6.0-0005-vmw_balloon-add-arm64-support.patch
|
||||
Patch212: 6.0-0001-vmw_vmci-arm64-support-memory-ordering.patch
|
||||
%endif
|
||||
|
||||
# TODO: rebase to 6.0:
|
||||
Patch220: 0001-Add-rpi-poe-fan-driver.patch
|
||||
|
@ -246,6 +249,8 @@ BuildRequires: gdb
|
|||
|
||||
Requires: kmod
|
||||
Requires: filesystem
|
||||
Requires: dracut >= 059-3
|
||||
Requires: initramfs >= 2.0-8
|
||||
Requires(pre): (coreutils or coreutils-selinux)
|
||||
Requires(preun): (coreutils or coreutils-selinux)
|
||||
Requires(post): (coreutils or coreutils-selinux)
|
||||
|
@ -548,18 +553,6 @@ EOF
|
|||
# Register myself to initramfs
|
||||
mkdir -p %{buildroot}%{_localstatedir}/lib/initramfs/kernel
|
||||
|
||||
add_drivers_list="xen-scsifront xen-blkfront xen-acpi-processor xen-evtchn xen-gntalloc xen-gntdev xen-privcmd xen-pciback xenfs hv_utils hv_vmbus hv_storvsc hv_netvsc hv_sock hv_balloon cn dm-mod megaraid_sas"
|
||||
|
||||
cat > %{buildroot}%{_localstatedir}/lib/initramfs/kernel/%{uname_r} << EOF
|
||||
%ifarch x86_64
|
||||
--add-drivers "${add_drivers_list}"
|
||||
%endif
|
||||
|
||||
%ifarch aarch64
|
||||
--add-drivers "${add_drivers_list} nvme nvme-core"
|
||||
%endif
|
||||
EOF
|
||||
|
||||
# Cleanup dangling symlinks
|
||||
rm -rf %{buildroot}%{_modulesdir}/source \
|
||||
%{buildroot}%{_modulesdir}/build
|
||||
|
@ -595,6 +588,14 @@ make %{?_smp_mflags} -C tools ARCH=%{arch} DESTDIR=%{buildroot} \
|
|||
|
||||
make install %{?_smp_mflags} -C tools/bpf/bpftool prefix=%{_prefix} DESTDIR=%{buildroot}
|
||||
|
||||
mkdir -p %{buildroot}%{_modulesdir}/dracut.conf.d/
|
||||
cp -p %{SOURCE19} %{buildroot}%{_modulesdir}/dracut.conf.d/%{name}.conf
|
||||
|
||||
%ifarch aarch64
|
||||
echo "add_drivers+=\" nvme nvme-core \"" >> \
|
||||
%{buildroot}%{_modulesdir}/dracut.conf.d/%{name}.conf
|
||||
%endif
|
||||
|
||||
%include %{SOURCE2}
|
||||
%include %{SOURCE6}
|
||||
%include %{SOURCE18}
|
||||
|
@ -615,7 +616,6 @@ ln -sf linux-%{uname_r}.cfg /boot/photon.cfg
|
|||
/boot/config-%{uname_r}
|
||||
/boot/vmlinuz-%{uname_r}
|
||||
%config(noreplace) /boot/linux-%{uname_r}.cfg
|
||||
%config %{_localstatedir}/lib/initramfs/kernel/%{uname_r}
|
||||
%defattr(0644,root,root)
|
||||
%{_modulesdir}/*
|
||||
%exclude %{_modulesdir}/build
|
||||
|
@ -635,6 +635,8 @@ ln -sf linux-%{uname_r}.cfg /boot/photon.cfg
|
|||
%exclude /lib/firmware/updates/intel/ice
|
||||
%endif
|
||||
|
||||
%config(noreplace) %{_modulesdir}/dracut.conf.d/%{name}.conf
|
||||
|
||||
%files docs
|
||||
%defattr(-,root,root)
|
||||
%{_docdir}/linux-%{uname_r}/*
|
||||
|
@ -696,6 +698,9 @@ ln -sf linux-%{uname_r}.cfg /boot/photon.cfg
|
|||
%{_datadir}/bash-completion/completions/bpftool
|
||||
|
||||
%changelog
|
||||
* Thu Mar 02 2023 Shreenidhi Shedi <sshedi@vmware.com> 6.1.10-3
|
||||
- Fix initrd generation logic
|
||||
- Add dracut, initramfs to requires
|
||||
* Fri Feb 24 2023 Ankit Jain <ankitja@vmware.com> 6.1.10-2
|
||||
- Exclude iavf.conf
|
||||
* Wed Feb 22 2023 Bo Gan <ganb@vmware.com> 6.1.10-1
|
||||
|
|
Loading…
Reference in New Issue