diff --git a/releasetools/Makefile b/releasetools/Makefile index 429caa327..b63e2c280 100644 --- a/releasetools/Makefile +++ b/releasetools/Makefile @@ -83,29 +83,25 @@ bootable: hdboot install: services .WAIT do-hdboot +TEMPDIR=${DESTDIR}/boot/minix/.temp/ + do-hdboot: - @rm -rf ${DESTDIR}/boot/minix/.temp/ - ${INSTALL_DIR} ${DESTDIR}/boot/minix/.temp -# mod_0 is used to make alphabetical order equal to the boot order - @n=0; \ - for i in ${PROGRAMS}; \ - do \ - n=`expr $$n + 1`; \ - [ "$$n" -ge 10 ] && prefix="mod" || prefix="mod0"; \ - newname="${DESTDIR}/boot/minix/.temp/$${prefix}$${n}_`basename $$i`"; \ - ${INSTALL} $$i $$newname; \ - done - @cp ${PROGROOT}/kernel/kernel ${DESTDIR}/boot/minix/.temp/ + @rm -rf ${TEMPDIR} + ${INSTALL_DIR} ${TEMPDIR} + ${HOST_SH} placeprograms.sh ${TEMPDIR} "${INSTALL}" \ + "${STRIP} -s" ${PROGRAMS} ${KERNEL} @if [ "${MKINSTALLBOOT:Uno}" != "no" ] ; then \ - ${STRIP} -s ${DESTDIR}/boot/minix/.temp/* ; \ - gzip ${DESTDIR}/boot/minix/.temp/mod* ; \ ${HOST_SH} mkboot hdboot ${DESTDIR}; \ ${HOST_SH} ../commands/update_bootcfg/update_bootcfg.sh;\ else \ ${INSTALL_DIR} ${DESTDIR}/multiboot; \ - ${INSTALL} ${DESTDIR}/boot/minix/.temp/* ${DESTDIR}/multiboot; \ + ${INSTALL} ${TEMPDIR}/* ${DESTDIR}/multiboot; \ fi +replace: + ${HOST_SH} placeprograms.sh ${DESTDIR}/boot/minix_latest/./ "${INSTALL}" \ + "${STRIP} -s" ${PROGRAMS} ${KERNEL} + # download and update NetBSD reference sources. nbsd_fetch: export CVS_RSH=ssh; \ diff --git a/releasetools/placeprograms.sh b/releasetools/placeprograms.sh new file mode 100644 index 000000000..c9f78b989 --- /dev/null +++ b/releasetools/placeprograms.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# +# Script to collect boot-time programs, install them in the given +# dir (to boot from), and +# for the modules: +# . give them filenames so that the sorted names is the boot order, +# and gzip them there +# for the kernel: +# . just copy it + +if [ $# -lt 4 ] +then echo "Usage: $0 " + exit 1 +fi + +installdir="$1" + +if [ ! -d "$installdir" ] +then echo "$0: expecting directory as first argument, $installdir" + exit 1 +fi + +shift + +installcmd="$1" +shift + +stripcmd="$1" +shift + +rm $installdir/*.gz + +echo "install cmd: $installcmd" + +n=0 + +while [ $# -gt 0 ] +do n="`expr $n + 1`" + if [ $n -ge 10 ] + then prefix=mod + else prefix=mod0 + fi + file="$1" + if [ ! -f $file ] + then echo "$0: expecting filenames, $file" + exit 1 + fi + basename="`basename $file`" + if [ $basename != kernel ] + then basename="${prefix}${n}_$basename" + fi + $installcmd $file $installdir/$basename + $stripcmd $installdir/$basename + shift +done + +gzip $installdir/mod*