#----------------------------------------------------------------------------
# /etc/boot.d/rc010.hddrv
#
# Creation:     2004-06-26 hs
# Last Update:  $Id: rc010.hddrv 8697 2005-05-18 15:51:51Z babel $
#----------------------------------------------------------------------------

# this script must be started in its own shell, because we dont want
# to leave variables from rc.cfg inside the rootfs left for the rest
# of the startup-sequence!
(
    kversion=`ls /lib/modules`

    # make some hd-tools executeable
    ln /bin/hd-busybox /sbin/mkswap
    ln /bin/hd-busybox /sbin/swapoff
    ln /bin/hd-busybox /sbin/swapon

    # get rc.cfg from inside rootfs.tgz
    . /etc/rc.cfg
    rm /etc/rc.cfg
    
    # load hd-modules
    do_insmod_if_exists_once kernel/fs/jbd jbd
    do_insmod_if_exists_once kernel/fs/ext3 ext3
    do_insmod_if_exists_once kernel/fs/minix minix
    do_insmod_if_exists_once kernel/drivers/scsi scsi_mod
    do_insmod_if_exists_once kernel/drivers/ide ide-core
    if [ -n "`grep "1042100" /proc/bus/pci/devices`" ]
    then
        do_insmod_if_exists_once kernel/drivers/ide/pci rz1000
    fi
    do_insmod_if_exists_once kernel/drivers/ide ide-detect

    # load all drivers
    [ "$HDDRV_N" -eq 0 ] || for idx in `seq 1 $HDDRV_N`
    do
        eval drv='$HDDRV_'$idx
        eval opt='$HDDRV_'$idx'_OPTION'
    
        case "$drv"
        in
            scsi-cd)    # load scsi-cdrom modules
                do_insmod_once cdrom
                do_insmod_once sr_mod
                do_insmod_once isofs
            ;;
            ide-cd)     # load ide-cdrom modules
                do_insmod_once cdrom
                do_insmod_once ide-cd
                do_insmod_once isofs
            ;;
            ide-hd)     # ide-disk driver
                do_insmod_once ide-disk
            ;;
            ide-floppy) # ide-floppy driver
                do_insmod_once ide-floppy
            ;;
            diskonchip) # M-sys DiskOnChip
                do_insmod_once mtdcore
                do_insmod_once mtd_blkdevs-24
                do_insmod_once reed_solomon
                do_insmod_once nand_ecc
                do_insmod_once nand_ids
                do_insmod_once nand
                do_insmod_once diskonchip
                do_insmod_once nftl
            ;;
            *)          # other SCSI-Controllers
                do_insmod_once $drv $opt
                do_insmod_once sd_mod
            ;;
        esac     
    done
)
