# # mk-images.s390 # # Copyright (C) 2007 Red Hat, Inc. All rights reserved. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # collectModuleNames() { grep -v "^#" ${KERNELROOT}/lib/modules/${version}/modules.${1} | \ cut -d ' ' -f 1 | sort | uniq | \ sed -e 's|\.ko$||g' | \ tr '\n' ' ' } expandModuleDeps() { MODS="$*" DEPS= DEPSFILE="$(mktemp ${TMPDIR:-/tmp}/moduledeps.XXXXXX)" echo "${MODS}" | tr ' ' '\n' > "${DEPSFILE}" cd ${KERNELROOT} while [ true ]; do beforeCount="$(wc -l "${DEPSFILE}" | cut -d ' ' -f 1)" while read module ; do modulePath="$(find ${KERNELROOT}/lib/modules/${version} -name "${module}.ko")" if [ -z "${modulePath}" ]; then echo "ERROR: Missing ${module}.ko on s390" >&2 continue fi deps="$(modinfo -F depends ${modulePath})" if [ ! -z "${deps}" ]; then echo "${deps}" | tr ',' '\n' >> ${DEPSFILE} fi done < "${DEPSFILE}" sort "${DEPSFILE}" | uniq > "${DEPSFILE}.new" mv "${DEPSFILE}.new" "${DEPSFILE}" afterCount="$(wc -l "${DEPSFILE}" | cut -d ' ' -f 1)" if [ ${beforeCount} -eq ${afterCount} ]; then break fi done cat "${DEPSFILE}" | tr '\n' ' ' rm -f "${DEPSFILE}" } S390CCWMODS="$(collectModuleNames ccwmap)" S390NETMODS="$(collectModuleNames networking)" S390EXTRAMODS="dasd_diag_mod smsgiucv" S390MODS="$(expandModuleDeps $S390CCWMODS $S390NETMODS $S390EXTRAMODS)" makeBootImages() { makeinitrd --initrdto $TOPDESTPATH/images/initrd.img \ --initrdsize 20000 \ --loaderbin loader \ --modules "$INITRDMODS $S390MODS" sz=$(ls -l $TOPDESTPATH/images/initrd.img | awk '{print $5}') $GENINITRDSZ $sz $TOPDESTPATH/images/initrd.size cp -vf $KERNELROOT/boot/${KERNELNAME}-${version} $TOPDESTPATH/images/kernel.img cp -v $BOOTDISKDIR/redhat.exec $TOPDESTPATH/images/redhat.exec cp -v $BOOTDISKDIR/generic.prm $TOPDESTPATH/images/generic.prm cp -v $BOOTDISKDIR/generic.ins $TOPDESTPATH/generic.ins $MKS390CDBOOT \ -i $TOPDESTPATH/images/kernel.img \ -r $TOPDESTPATH/images/initrd.img \ -p $TOPDESTPATH/images/generic.prm \ -o $TOPDESTPATH/images/cdboot.img cat << __EOT__ >> $TOPDESTPATH/.treeinfo [images-$KERNELARCH] kernel = images/kernel.img initrd = images/initrd.img initrd.size = images/initrd.size generic.prm = images/generic.prm generic.ins = generic.ins cdboot.img = images/cdboot.img __EOT__ }