a0e51f0cab
Now use the kernel built-in tpmdd instead of tpmdd out-of-tree, so the rpm package is no longer provided. Change-Id: I0f322c81d1a9aa20b2ad43a8f5b7b17abfd5782a Story: 2007308 Task: 39756 Depends-On: https://review.opendev.org/#/c/726999/ Signed-off-by: Dongqi Chen <chen.dq@neusoft.com>
130 lines
5.9 KiB
Bash
Executable File
130 lines
5.9 KiB
Bash
Executable File
#!/bin/bash -e
|
|
## this script is to update pxeboot images (vmlinuz, initrd.img and squashfs.img).
|
|
## based on RPMs generated by "build-pkgs" and "build-iso"
|
|
## created by Yong Hu (yong.hu@intel.com), 05/24/2018
|
|
|
|
find_and_copy_rpm () {
|
|
local name="${1}"
|
|
local pattern="${2}"
|
|
local build_type="${3}"
|
|
local dest_dir="${4}"
|
|
|
|
echo " --> find ${name} rpm"
|
|
found=$(find $MY_BUILD_DIR/${build_type}/rpmbuild/RPMS -type f -name "${pattern}" | head -n 1)
|
|
if [ ! -n "${found}" ];then
|
|
if [ "${build_type}" != "rt" ]; then
|
|
found=$(find $MY_REPO/cgcs-centos-repo/Binary -type l -name "${pattern}" | head -n 1)
|
|
else
|
|
found=$(find $MY_REPO/cgcs-centos-repo/${build_type}/Binary -type l -name "${pattern}" | head -n 1)
|
|
fi
|
|
fi
|
|
|
|
if [ -n "${found}" ] && [ -f "${found}" ];then
|
|
\cp -f "${found}" "${dest_dir}/"
|
|
else
|
|
echo "ERROR: failed to find ${name} RPM!"
|
|
exit -1
|
|
fi
|
|
}
|
|
|
|
|
|
echo "Start to update pxe-network-installer images .... "
|
|
timestamp=$(date +%F_%H%M)
|
|
cur_dir=$PWD
|
|
|
|
pxe_network_installer_dir=$MY_BUILD_DIR/pxe-network-installer
|
|
if [ ! -d $pxe_network_installer_dir ];then
|
|
mkdir -p $pxe_network_installer_dir
|
|
fi
|
|
|
|
cd $pxe_network_installer_dir
|
|
|
|
echo "step 1: copy original images: vmlinuz, initrd.img, squashfs.img"
|
|
CENTOS_REPO="cgcs-centos-repo"
|
|
orig_img_dir="orig"
|
|
if [ ! -d $orig_img_dir ];then
|
|
mkdir -p $orig_img_dir
|
|
fi
|
|
|
|
orig_initrd_img="$MY_REPO/$CENTOS_REPO/Binary/images/pxeboot/initrd.img"
|
|
if [ -f $orig_initrd_img ]; then
|
|
cp -f $orig_initrd_img $pxe_network_installer_dir/$orig_img_dir/.
|
|
else
|
|
echo "$orig_initrd_img does not exit"
|
|
exit -1
|
|
fi
|
|
|
|
orig_squashfs_img="$MY_REPO/$CENTOS_REPO/Binary/LiveOS/squashfs.img"
|
|
if [ -f $orig_squashfs_img ]; then
|
|
cp -f $orig_squashfs_img $pxe_network_installer_dir/$orig_img_dir/.
|
|
else
|
|
echo "$orig_squashfs_img does not exit"
|
|
exit -1
|
|
fi
|
|
|
|
echo ""
|
|
echo "step 2: prepare necessary kernel RPMs"
|
|
echo ""
|
|
kernel_rpms_std="$pxe_network_installer_dir/kernel-rpms/std"
|
|
kernel_rpms_rt="$pxe_network_installer_dir/kernel-rpms/rt"
|
|
|
|
echo "--> get $kernel_rpms_std ready"
|
|
echo "--> get $kernel_rpms_rt ready"
|
|
|
|
if [ -d $kernel_rpms_std ];then
|
|
mv $kernel_rpms_std $kernel_rpms_std-bak-$timestamp
|
|
fi
|
|
mkdir -p $kernel_rpms_std
|
|
|
|
if [ -d $kernel_rpms_rt ];then
|
|
mv $kernel_rpms_rt $kernel_rpms_rt-bak-$timestamp
|
|
fi
|
|
mkdir -p $kernel_rpms_rt
|
|
|
|
echo " -------- start to search standard kernel rpm and related kernel modules --------"
|
|
find_and_copy_rpm 'standard kernel' 'kernel-[0-9]*.x86_64.rpm' std "$kernel_rpms_std"
|
|
find_and_copy_rpm 'standard kernel core' 'kernel-core-[0-9]*.x86_64.rpm' std "$kernel_rpms_std"
|
|
find_and_copy_rpm 'standard kernel modules' 'kernel-modules-[0-9]*.x86_64.rpm' std "$kernel_rpms_std"
|
|
find_and_copy_rpm 'standard kernel modules extra' 'kernel-modules-extra-[0-9]*.x86_64.rpm' std "$kernel_rpms_std"
|
|
find_and_copy_rpm 'standard kernel modules internal' 'kernel-modules-internal-[0-9]*.x86_64.rpm' std "$kernel_rpms_std"
|
|
find_and_copy_rpm 'e1000e kernel module' 'kmod-e1000e-[0-9]*.x86_64.rpm' std "$kernel_rpms_std"
|
|
find_and_copy_rpm 'i40e kernel module' 'kmod-i40e-[0-9]*.x86_64.rpm' std "$kernel_rpms_std"
|
|
find_and_copy_rpm 'ixgbe kernel module' 'kmod-ixgbe-[0-9]*.x86_64.rpm' std "$kernel_rpms_std"
|
|
find_and_copy_rpm 'mlnx-ofa kernel module' 'mlnx-ofa_kernel-modules-[0-9]*.x86_64.rpm' std "$kernel_rpms_std"
|
|
echo " -------- successfully found standard kernel rpm and related kernel modules --------"
|
|
echo ""
|
|
|
|
rootfs_rpms="$pxe_network_installer_dir/rootfs-rpms"
|
|
if [ -d $rootfs_rpms ];then
|
|
mv $rootfs_rpms $rootfs_rpms-bak-$timestamp
|
|
fi
|
|
mkdir -p $rootfs_rpms
|
|
|
|
echo " step 3: start to search rpms for rootfs"
|
|
find_and_copy_rpm 'anaconda' 'anaconda-[0-9]*.x86_64.rpm' installer "$rootfs_rpms/."
|
|
find_and_copy_rpm 'anaconda-core' 'anaconda-core-[0-9]*.x86_64.rpm' installer "$rootfs_rpms/."
|
|
find_and_copy_rpm 'anaconda-tui' 'anaconda-tui-[0-9]*.x86_64.rpm' installer "$rootfs_rpms/."
|
|
find_and_copy_rpm 'anaconda-widgets' 'anaconda-widgets-[0-9]*.x86_64.rpm' installer "$rootfs_rpms/."
|
|
find_and_copy_rpm 'rpm' 'rpm-[0-9]*.x86_64.rpm' installer "$rootfs_rpms/."
|
|
find_and_copy_rpm 'rpm-build' 'rpm-build-[0-9]*.x86_64.rpm' installer "$rootfs_rpms/."
|
|
find_and_copy_rpm 'rpm-build-libs' 'rpm-build-libs-[0-9]*.x86_64.rpm' installer "$rootfs_rpms/."
|
|
find_and_copy_rpm 'rpm-libs' 'rpm-libs-[0-9]*.x86_64.rpm' installer "$rootfs_rpms/."
|
|
find_and_copy_rpm 'rpm-plugin-systemd-inhibit' 'rpm-plugin-systemd-inhibit-[0-9]*.x86_64.rpm' installer "$rootfs_rpms/."
|
|
find_and_copy_rpm 'rpm-python' 'rpm-python-[0-9]*.x86_64.rpm' installer "$rootfs_rpms/."
|
|
|
|
find_and_copy_rpm 'systemd' 'systemd-[0-9]*.x86_64.rpm' std "$rootfs_rpms/."
|
|
find_and_copy_rpm 'systemd-libs' 'systemd-libs-[0-9]*.x86_64.rpm' std "$rootfs_rpms/."
|
|
find_and_copy_rpm 'systemd-sysv' 'systemd-sysv-[0-9]*.x86_64.rpm' std "$rootfs_rpms/."
|
|
find_and_copy_rpm 'lz4' 'lz4-[0-9]*.x86_64.rpm' std "$rootfs_rpms/."
|
|
find_and_copy_rpm 'bind-utils' 'bind-utils-[0-9]*.x86_64.rpm' std "$rootfs_rpms/."
|
|
find_and_copy_rpm 'ima-evm-utils' 'ima-evm-utils-[0-9]*.x86_64.rpm' std "$rootfs_rpms/."
|
|
echo " ---------------- successfully found rpms for rootfs --------------------------------"
|
|
|
|
echo "step 4: make installer images in this work dir"
|
|
same_folder="$(dirname ${BASH_SOURCE[0]})"
|
|
mk_images_tool="$same_folder/make-installer-images.sh"
|
|
sudo $mk_images_tool $pxe_network_installer_dir
|
|
|
|
cd $cur_dir
|
|
echo "updating pxe-network-installer images -- done!"
|