#!/bin/sh

source ${CONF_DIR}/config
source ${CONF_DIR}/helpers/functions

MOD_FILE="/etc/initrd_modules";

if [ "X${CONFIG_BOARD_TYPE_NAME}" == "X" ]
then
	ERR=7
else
	load_module board_${CONFIG_BOARD_TYPE_NAME}
	ERR=$?;
fi

if [ $((ERR)) -ne 0 ]
then
	echo "ERROR: Failed to load board driver: board_${CONFIG_BOARD_TYPE_NAME}"
	exit 1
fi

if [ -e ${MOD_FILE} ]
then
	cat ${MOD_FILE} | \
	while read module
	do
		load_module ${module}
		if [ "X$?" != "X0" ]
		then 
			ERR=1
		fi
	done
fi

