3 BUILD_DIR="/tmp/initrd"
5 BIN_TOOLS="echo ln ls mv rm rmdir sh"
6 SBIN_TOOLS="mount mount_devfs mount_hammer mount_nfs mount_null mount_procfs mount_tmpfs umount iscontrol"
7 INITRD_DIRS="bin boot dev etc mnt proc sbin tmp var new_root"
8 CONTENT_DIRS="/usr/share/initrd"
10 if [ -e /etc/defaults/mkinitrd.conf ]; then
11 . /etc/defaults/mkinitrd.conf
12 echo "Loaded configuration from /etc/defaults/mkinitrd.conf"
16 if [ -e /etc/mkinitrd.conf ]; then
18 echo "Loaded configuration from /etc/mkinitrd.conf"
24 if [ ! -d $BUILD_DIR ]; then
26 echo "Created build directory $BUILD_DIR"
28 VN_DEV=`vnconfig -c -S ${INITRD_SIZE} -Z -T vn initrd.img | cut -f 2 -d ' '`
29 echo "Configured $VN_DEV"
30 newfs /dev/${VN_DEV}s0
31 echo "Formatted initrd image with UFS"
32 mount /dev/${VN_DEV}s0 $BUILD_DIR
33 echo "Mounted initrd image on ${BUILD_DIR}"
37 umount /dev/${VN_DEV}s0
38 echo "Unmounted initrd image"
40 echo "Unconfigured $VN_DEV"
44 for dir in ${INITRD_DIRS}; do
45 mkdir -p ${BUILD_DIR}/${dir}
48 echo "Created directory structure"
52 for tool in ${BIN_TOOLS}; do
53 objcopy -S /bin/${tool} ${BUILD_DIR}/bin/${tool}
56 for tool in ${SBIN_TOOLS}; do
57 objcopy -S /sbin/${tool} ${BUILD_DIR}/sbin/${tool}
60 echo "Copied essential tools"
64 for dir in ${CONTENT_DIRS}; do
65 cp -R ${dir}/* ${BUILD_DIR}/
81 mv initrd.img /boot/initrd.img