#!/bin/bash # new header not using prereqs if [ "$1" = "prereqs" ]; then echo "" exit 0 fi # Hooks for loading necesary modules for the tcos system into the initramfs # . /usr/share/initramfs-tools/hook-functions . $CONFDIR/initramfs.conf # read from env vars TCOS_BOOT TCOS_BOOT=$(env| awk -F "=" '/^TCOS_BOOT=/ {print $2}') if [ "${TCOS_BOOT}" != "" ]; then BOOT=$TCOS_BOOT fi if [ "${BOOT}" = "tcos" ]; then . $CONFDIR/tcos.conf . $TCOS_DIR/tcos-modules.conf . $TCOS_DIR/tcos-generation-functions.sh for tpl in $(tcos_get_templates); do _verbose "(tcosmods) loading template $(basename $tpl)" . $tpl done # load forced settings for derivatives if [ -d $CONFDIR/conf.d/ ]; then for file in $CONFDIR/conf.d/tcos*conf; do [ -e $file ] && . $file done fi TCOS_USB=$(read_env_var "TCOS_USB" "$TCOS_USB") TCOS_XORG=$(read_env_var "TCOS_XORG" "$TCOS_XORG") TCOS_SOUND=$(read_env_var "TCOS_SOUND" "$TCOS_SOUND") TCOS_DISABLE_USB=$(read_env_var "TCOS_DISABLE_USB" "$TCOS_DISABLE_USB") TCOS_DISABLE_IDE=$(read_env_var "TCOS_DISABLE_IDE" "$TCOS_DISABLE_IDE") if [ "$TCOS_USB" != "1" ] ;then _echo " * Not USB support" USB_MODULES="" TCOS_DISABLE_USB=1 fi if [ "$TCOS_XORG" != "1" ]; then _echo " * Not Xorg support" XORG_MODULES="" fi if [ "$TCOS_SOUND" != "1" ]; then _echo " * Not Sound support" SOUND_MODULES="" fi if [ "$TCOS_SOUND_ISA" != "1" ]; then _echo " * Not Sound ISA modules" SOUNDISA_MODULES="" else #ISADIR=$(find /lib/modules/${TCOS_KERNEL}/ -type d -name isa) #SOUNDISA_MODULES=$(find ${ISADIR} -type f -exec basename '{}' \; | sed s/".ko"//g) SOUNDISA_MODULES="snd-gusmax snd-gusclassic snd-gusextreme snd-gus-synth snd-gus-lib snd-interwave-stb snd-interwave snd-opl3sa2 snd-als100 snd-miro snd-opti93x snd-opti92x-ad1848 snd-opti92x-cs4231 snd-adlib snd-es18xx snd-dt019x snd-sb8 snd-sb16 snd-es968 snd-sb16-csp snd-sb8-dsp snd-sbawe snd-sb16-dsp snd-sb-common snd-emu8000-synth snd-sgalaxy snd-cs4236-lib snd-cs4231 snd-cs4231-lib snd-cs4236 snd-cs4232 snd-es1688 snd-es1688-lib snd-sscape snd-ad1848-lib snd-ad1848 snd-cmi8330 snd-azt2320 snd-ad1816a snd-wavefront" fi MODULES="${CORE_MODULES} ${USB_MODULES} ${LIVE_MODULES} ${NETWORK_MODULES}" MODULES="${MODULES} ${XORG_MODULES} ${SOUND_MODULES} ${SOUNDISA_MODULES} ${MYTCOS_MODULES} " for x in ${MODULES} ; do _verbose "(tcosmods) Adding module ${x}" #manual_add_modules ${x} tcos_manual_add_modules ${x} #force_add_module ${x} done BLACKLIST_MODULES="${BLACKLIST_MODULES}" for x in ${BLACKLIST_MODULES} ; do _verbose "(tcosmods) blacklist module ${x}" echo "blacklist ${x}" >> ${DESTDIR}/etc/modprobe.d/blacklist-tcos.conf done # put floppy outside /lib/modules mkdir -p $DESTDIR/lib/extramodules FLOPPY_MOD=$(modprobe --set-version="${TCOS_KERNEL}" --list "floppy" 2>/dev/null) FLOPPY_IDE_MOD=$(modprobe --set-version="${TCOS_KERNEL}" --list "ide-floppy") # new modprobe versions return relative PATH if [ ! -e "${FLOPPY_MOD}" ] && [ "${FLOPPY_MOD}" != "" ] && [ -e "/lib/modules/${TCOS_KERNEL}/${FLOPPY_MOD}" ]; then FLOPPY_MOD="/lib/modules/${TCOS_KERNEL}/${FLOPPY_MOD}" fi if [ ! -e "${FLOPPY_IDE_MOD}" ] && [ "${FLOPPY_IDE_MOD}" != "" ] && [ -e "/lib/modules/${TCOS_KERNEL}/${FLOPPY_IDE_MOD}" ]; then FLOPPY_IDE_MOD="/lib/modules/${TCOS_KERNEL}/${FLOPPY_IDE_MOD}" fi if [ "${FLOPPY_MOD}" != "" ]; then # don't use cpifexists cp -a "${FLOPPY_MOD}" $DESTDIR/lib/extramodules # delete floppy kernel rm -f ${DESTDIR}/${FLOPPY_MOD} fi if [ "${FLOPPY_IDE_MOD}" != "" ]; then # don't use cpifexists cp -a "${FLOPPY_IDE_MOD}" $DESTDIR/lib/extramodules # delete floppy kernel rm -f ${DESTDIR}/${FLOPPY_IDE_MOD} fi if [ "$TCOS_EXTRA_MODULES" != "" ]; then TCOS_EXTRA_MODULES=$(echo ${TCOS_EXTRA_MODULES} | sed s/","/" "/g) for module in ${TCOS_EXTRA_MODULES}; do _echo " TCOS extra module: adding ${module}" tcos_manual_add_modules ${module} done fi if [ "$TCOS_BLACKLIST_MODULES" != "" ]; then TCOS_BLACKLIST_MODULES=$(echo ${TCOS_BLACKLIST_MODULES} | sed s/","/" "/g) for module in ${TCOS_BLACKLIST_MODULES}; do _echo " TCOS blacklist module: adding ${module}" echo "blacklist ${module}" >> ${DESTDIR}/etc/modprobe.d/blacklist-tcos.conf done fi if [ "$TCOS_DISABLE_USB" = "1" ] ;then # delete some SCSI and USB stuff because we boot from network _echo " * DISABLE USB : deleting some SCSI and USB kernel modules..." rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/usb/ rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/scsi/ rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/ieee1394/ rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/md/ rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/cdrom/ rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/block/ # restore deleted loop module tcos_manual_add_modules loop fi if [ "$TCOS_DISABLE_IDE" = "1" ] ;then # delete some IDE and filesystem modules _echo " * DISABLE IDE : deleting some IDE and FS kernel modules..." rm -rf ${DESTDIR}/lib/modules/${version}/kernel/fs/reiserfs/ rm -rf ${DESTDIR}/lib/modules/${version}/kernel/fs/xfs/ rm -rf ${DESTDIR}/lib/modules/${version}/kernel/fs/ext3/ rm -rf ${DESTDIR}/lib/modules/${version}/kernel/fs/isofs/ rm -rf ${DESTDIR}/lib/modules/${version}/kernel/fs/isofs/ rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/ide/ rm -rf ${DESTDIR}/lib/modules/${version}/kernel/drivers/ata/ rm -f ${DESTDIR}/sbin/vgchange rm -f ${DESTDIR}/lib/libdevmapper* fi if [ "$TCOS_CPUFREQ" = "1" ]; then # modprobe -l| grep cpufreq_| awk -F"/" '{print $NF}'| sed -e 's/.ko//g' CPUFREQ_MODS=$(modprobe --set-version="${TCOS_KERNEL}" --list 2>/dev/null| awk -F"/" '/cpufreq_/ {print $NF}'| sed -e s/".ko"//g) CPUFREQ_CPU_MODS=$(modprobe --set-version="${TCOS_KERNEL}" --list 2>/dev/null| awk -F"/" '/cpu\/cpufreq/ {print $NF}' | sed -e s/".ko"//g) _echo " TCOS adding CPUFREQ modules" for _mod in $CPUFREQ_MODS; do tcos_manual_add_modules $_mod done for _mod in $CPUFREQ_CPU_MODS; do tcos_manual_add_modules $_mod done fi fi