Knowledge Base

Preserving for the future: Shell scripts, AoC, and more

Make driver disk for CentOS

Goals

If you want to make a generic USB driver disk for RHEL/CentOS, you can follow these instructions. The drivers are in rpm format, and you need those drivers during installation of a new system, primarily storage drivers.

Instructions

On an existing CentOS system, install the dependencies.

yum -y install createrepo squashfs-tools

Change directory to where your rpms and make a new directory tree.

cd path/to/rpms
export SQUASH_ROOT=./squashfs-root
mkdir -p "${SQUASH_ROOT}/rpms/x86_64"

Make a specific file with any contents you wish.

echo "My custom driver disk" > "${SQUASH_ROOT}/rhdd3"

Make a yum repository

cp -p *rpm "${SQUASH_ROOT}/rpms/x86_64/"
createrepo --basedir "${SQUASH_ROOT}/rpms/x86_64/" .

Make the driver disk-only components.

touch "${SQUASH_ROOT}/.rundepmod"
( cd "${SQUASH_ROOT}" ;
   for thisrpm in "${SQUASH_ROOT}/rpms/x86_64"/*rpm ;
   do
      rpm2cpio "${thisrpm}" | cpio -imVd ./lib/*
   done
)

And make the image file from the custom directory.

mksquashfs "${SQUASH_ROOT}" ./my-driver-disk.img

Clean up the custom directory if you're done with it! The image is now complete and we will use it for the last step.

rm -rf "${SQUASH_ROOT}"

Deploy the image onto your preferred disk drive. Be sure you know which drive is the flash drive you want!

sudo dd if=/path/to/my-driver-disk.img of=/dev/sdz

The image file should be really small, so there is no need to control block size (bs=2048). Also, this disk will not be directly readable to a regular system, so do not let that alarm you.

References

Weblinks

  1. Red Hat Enterprise Linux and CentOS 7 Driver Disk
  2. Install CentOS 7 on HP ProLiant DL360 G5 with P400i SAS Controller | Knowledge Base

Comments