Update driver included in discovery image

To complete this thread, below is a short summary of the steps I did to rebuild the foreman discovery image to include the needed e1000e driver:

  1. Clone Foreman discovery image repository from github

git clone GitHub - theforeman/foreman-discovery-image: Foreman discovery image live distro

  1. Create a new directory and place the kmod-rpm file inside of it

root@foreman(foreman) [~/bootdisk-build/foreman-discovery-image-master/foreman-discovery-image]# mkdir e1000e_driver

root@foreman(foreman) [~/bootdisk-build/foreman-discovery-image-master/foreman-discovery-image]# ls -l e1000e_driver/

total 148
-rw-r–r–. 1 root root 146540 Nov 23 16:22 kmod-e1000e-3.8.4-2.el7_8.elrepo.x86_64.rpm

  1. Use the createrepo utility to generate a local repository from the previous created directory

root@foreman (foreman) [~/bootdisk-build/foreman-discovery-image-master/foreman-discovery-image]# createrepo -v e1000e_driver

Spawning worker 0 with 1 pkgs
Spawning worker 1 with 0 pkgs
Spawning worker 2 with 0 pkgs
Spawning worker 3 with 0 pkgs
Worker 0: reading kmod-e1000e-3.8.4-2.el7_8.elrepo.x86_64.rpm
Workers Finished
Saving Primary metadata
Saving file lists metadata
Saving other metadata
Generating sqlite DBs
Starting other db creation: Thu Dec 3 10:22:26 2020
Ending other db creation: Thu Dec 3 10:22:26 2020
Starting filelists db creation: Thu Dec 3 10:22:26 2020
Ending filelists db creation: Thu Dec 3 10:22:26 2020
Starting primary db creation: Thu Dec 3 10:22:26 2020
Ending primary db creation: Thu Dec 3 10:22:26 2020
Sqlite DBs complete

  1. Modify the related kickstart repository file (e.g. 00-repos-centos7.ks)
    (Change the specified foreman repositories from nightly to release, to ensure a stable source. Add the recently created e1000e repository)

root@foreman (foreman) [~/bootdisk-build/foreman-discovery-image-master/foreman-discovery-image]# cat 00-repos-centos7.ks

repo --name=centos-extras --mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=extras
repo --name=centos --mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=os
repo --name=centos-updates --mirrorlist=http://mirrorlist.centos.org/?release=7&arch=$basearch&repo=updates
repo --name=epel7 --mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch
repo --name=centos-sclo-rh --mirrorlist=http://mirrorlist.centos.org/?release=7&arch=x86_64&repo=sclo-rh

#repo --name=foreman-el7 --baseurl=http://yum.theforeman.org/nightly/el7/$basearch/
#repo --name=foreman-el7 --baseurl=http://yum.theforeman.org/nightly/el7/$basearch/

repo --name=foreman-el7 --baseurl=http://yum.theforeman.org/releases/2.1/el7/$basearch/
repo --name=foreman-plugins-el7 --baseurl=http://yum.theforeman.org/plugins/2.1/el7/$basearch/

repo --name=e1000e --baseurl=file:///root/bootdisk-build/foreman-discovery-image-master/foreman-discovery-image/e1000e_driver

  1. Add kmod and the driver package (kmod-e1000e) to the appropriate kickstart file (e.g. 20-packages.ks for centos7)

%packages --excludedocs
bash
kernel
biosdevname
grub2
grub2-tools
e2fsprogs
passwd
policycoreutils
chkconfig
rootfiles
yum
vim-minimal
acpid
tftp
lldpad
isomd5sum
elfutils-libs

#e1000e driver package
kmod
kmod-e1000e

  1. Execute ./build-livecd to generate the fdi-image.ks kickstart file

  2. Comment out the following lines in ./build-livecd-root to prevent the script from converting the resulting iso to initrd. (Dont know if there is any ‘official’ way to prevent this!?)

 56 #echo "* Converting to initrd"
 57 #bash -x $srcdir/aux/livecd-iso-to-pxeboot $tmpdir/fdi.iso
 58 #
 59 #if [ $? -ne 0 ]; then
 60 #    KEEP_TMPDIR=yes
 61 #    echo "Error converting to initrd"
 62 #    exit 1
 63 #fi
 64 #
 65 #echo "* Building tarball"
 66 #mkdir fdi-image
 67 #mv tftpboot/initrd0.img tftpboot/vmlinuz0 fdi-image || KEEP_TMPDIR=yes
 68 #cd fdi-image
 69 #cat > README <<EOF
 70 #This is Foreman discovery image
 71 #
 72 #To get instructions how to use the image head over to
 73 #
 74 #https://github.com/theforeman/foreman_discovery
 75 #
 76 #Image was built from $last_tag ($last_sha)
 77 #
 78 #To verify the kernel and initrd in this tar, run
 79 #
 80 #  sha256sum -c SHA256SUM
 81 #EOF
 82 #
 83 #sha256sum initrd0.img vmlinuz0 > SHA256SUM
 84 #
 85 #cd ..
 86 #tarball=$destdir/fdi-image-${last_tag#release-}.tar
 87 #tar cf $tarball fdi-image/
 88 #ls -lh $tarball
 89 #chown --reference $srcdir/build-livecd $tarball
 90 #
 91 #echo "* Done"
 92 #echo "The image was built:"
 93 #du -h $tarball
 94 exit 0

Execute ./build-livecd-root afterwards to generate the new foreman discovery image

4 Likes