Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/i386/floppies For all filesytem image building targe...



details:   https://anonhg.NetBSD.org/src/rev/8cd347ee8714
branches:  trunk
changeset: 494474:8cd347ee8714
user:      jhawk <jhawk%NetBSD.org@localhost>
date:      Thu Jul 06 18:16:35 2000 +0000

description:
For all filesytem image building targets, build ${IMAGE}.tmp and
move it to ${IMAGE} when done, to ensure that an interrupted
build does not leave a broken non-functional target. (This can occur,
for instance, if one types 'make' as a non-root user and the vnconfig
fails, and then a subsequent 'make' will not rebuild the filesystem
image, using the all-zeroes image created by dd.)

diffstat:

 distrib/i386/floppies/bootfloppy-common/Makefile.inc |  12 +++++++-----
 distrib/i386/floppies/fdset-common/Makefile.inc      |  10 ++++++----
 distrib/i386/floppies/ramdisk-tiny/Makefile          |  11 +++++++----
 distrib/i386/floppies/ramdisk-tiny/Makefile.inc      |  13 ++++++++-----
 distrib/i386/floppies/ramdisk/Makefile               |  14 +++++++++-----
 distrib/i386/floppies/ramdisk/Makefile.inc           |  15 +++++++++------
 6 files changed, 46 insertions(+), 29 deletions(-)

diffs (258 lines):

diff -r b67d5df8f51b -r 8cd347ee8714 distrib/i386/floppies/bootfloppy-common/Makefile.inc
--- a/distrib/i386/floppies/bootfloppy-common/Makefile.inc      Thu Jul 06 18:04:56 2000 +0000
+++ b/distrib/i386/floppies/bootfloppy-common/Makefile.inc      Thu Jul 06 18:16:35 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.26 2000/05/05 21:34:32 mycroft Exp $
+#      $NetBSD: Makefile.inc,v 1.27 2000/07/06 18:16:35 jhawk Exp $
 
 # TOP is assumed to be defined by Makefile including this one.
 
@@ -24,8 +24,9 @@
        tar cvf ${FSTMP} boot netbsd
        @echo
        @echo Making disk number one
-       dd if=/dev/zero of=${IMAGE} count=${DISKSIZE}
-       vnconfig -t ${DISKTYPE} -v -c ${VND_CDEV} ${IMAGE}
+       rm -f ${IMAGE}.tmp
+       dd if=/dev/zero of=${IMAGE}.tmp count=${DISKSIZE}
+       vnconfig -t ${DISKTYPE} -v -c ${VND_CDEV} ${IMAGE}.tmp
        dd bs=8k seek=1 count=${BLOCK8K} if=${FSTMP} of=${VND_CDEV}
        disklabel -rw ${VND_CDEV} ${DISKTYPE}
        @echo "installing new bootblocks"
@@ -41,13 +42,14 @@
                        exit 1; \
                else \
                        dd seek=$$(($${size} / 512 + 15)) count=1 \
-                               if=/dev/zero of=${IMAGE}; \
+                               if=/dev/zero of=${IMAGE}.tmp; \
                fi; \
                echo; \
                 bytes=$$(($$dksize * $$disks - $$size));    \
                 echo "There are $$bytes ($$(($$bytes / 1024))K) bytes free\
                         on disk $$disks."; \
        )
+       mv -f ${IMAGE}.tmp ${IMAGE}
 
 # Let the kernel on the diskette be called "netbsd" although
 # it is compressed.  This is because the boot code will search
@@ -79,7 +81,7 @@
        done
        
 clean cleandir distclean:
-       /bin/rm -f *.core ${CLEANFILES} ${IMAGE}
+       /bin/rm -f *.core ${CLEANFILES} ${IMAGE} ${IMAGE}.tmp
 
 .include <bsd.own.mk>
 .include <bsd.obj.mk>
diff -r b67d5df8f51b -r 8cd347ee8714 distrib/i386/floppies/fdset-common/Makefile.inc
--- a/distrib/i386/floppies/fdset-common/Makefile.inc   Thu Jul 06 18:04:56 2000 +0000
+++ b/distrib/i386/floppies/fdset-common/Makefile.inc   Thu Jul 06 18:16:35 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.18 2000/07/06 17:17:54 thorpej Exp $
+#      $NetBSD: Makefile.inc,v 1.19 2000/07/06 18:16:35 jhawk Exp $
 
 # TOP is assumed to be defined by Makefile including this one.
 
@@ -25,8 +25,9 @@
        tar cvf ${FSTMP} boot netbsd
        @echo
        @echo Making disk number one
-       dd if=/dev/zero of=${IMAGE1} count=${DISKSIZE}
-       vnconfig -t ${DISKTYPE} -v -c ${VND_CDEV} ${IMAGE1}
+       mv -f ${IMAGE1} ${IMAGE1}.tmp
+       dd if=/dev/zero of=${IMAGE1}.tmp count=${DISKSIZE}
+       vnconfig -t ${DISKTYPE} -v -c ${VND_CDEV} ${IMAGE1}.tmp
        dd bs=8k seek=1 count=${BLOCK8K} if=${FSTMP} of=${VND_CDEV}
        disklabel -rw ${VND_CDEV} ${DISKTYPE}
        @echo "installing new bootblocks"
@@ -60,6 +61,7 @@
                 echo "There are $$bytes ($$(($$bytes / 1024))K) bytes free\
                         on disk $$disks."; \
        )
+       mv -f ${IMAGE1}.tmp ${IMAGE1}
 
 # Let the kernel on the diskette be called "netbsd" although
 # it is compressed.  This is because the boot code will search
@@ -91,7 +93,7 @@
        done
        
 clean cleandir distclean:
-       /bin/rm -f *.core ${CLEANFILES} ${BASENAME}?.fs
+       /bin/rm -f *.core ${CLEANFILES} ${BASENAME}?.fs ${IMAGE1}.tmp
 
 .include <bsd.own.mk>
 .include <bsd.obj.mk>
diff -r b67d5df8f51b -r 8cd347ee8714 distrib/i386/floppies/ramdisk-tiny/Makefile
--- a/distrib/i386/floppies/ramdisk-tiny/Makefile       Thu Jul 06 18:04:56 2000 +0000
+++ b/distrib/i386/floppies/ramdisk-tiny/Makefile       Thu Jul 06 18:16:35 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.1 2000/06/12 18:51:17 he Exp $
+#      $NetBSD: Makefile,v 1.2 2000/07/06 18:16:35 jhawk Exp $
 
 TOP=           ${.CURDIR}/..
 WARNS=1
@@ -43,8 +43,10 @@
 realall: ${IMAGE}
 
 ${IMAGE}: ${AUXTARGETS} ${CBIN} ${AUXDEPENDS} ${MTREE} ${LISTS}
-       dd if=/dev/zero of=${IMAGE} count=${RAMDISKSIZE}
-       vnconfig -v -c ${VND_CDEV} ${IMAGE} 512/${RAMDISKSPC}/1/${RAMDISKCYLS}
+       rm -f ${IMAGE}.tmp
+       dd if=/dev/zero of=${IMAGE}.tmp count=${RAMDISKSIZE}
+       vnconfig -v -c ${VND_CDEV} ${IMAGE}.tmp \
+           512/${RAMDISKSPC}/1/${RAMDISKCYLS}
        -disklabel ${VND_CDEV} >tmplabel
        disklabel -r -R ${VND_CDEV} tmplabel
        newfs -B le -m 0 -o space -i 3950 -c 80 ${VND_RDEV} 
@@ -57,11 +59,12 @@
        @echo ""
        umount ${MOUNT_POINT}
        vnconfig -u ${VND_CDEV}
+       mv -f ${IMAGE}.tmp ${IMAGE}
 
 unconfig:
        -umount -f ${MOUNT_POINT}
        -vnconfig -u ${VND_DEV}
-       -/bin/rm -f ${IMAGE}
+       -/bin/rm -f ${IMAGE} ${IMAGE}.tmp
 
 ${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CRUNCHCONF}
        crunchgen -D ${TOP}/../../.. -L ${DESTDIR}/usr/lib ${.ALLSRC}
diff -r b67d5df8f51b -r 8cd347ee8714 distrib/i386/floppies/ramdisk-tiny/Makefile.inc
--- a/distrib/i386/floppies/ramdisk-tiny/Makefile.inc   Thu Jul 06 18:04:56 2000 +0000
+++ b/distrib/i386/floppies/ramdisk-tiny/Makefile.inc   Thu Jul 06 18:16:35 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.1 2000/06/12 18:51:17 he Exp $
+#      $NetBSD: Makefile.inc,v 1.2 2000/07/06 18:16:35 jhawk Exp $
 
 # TOP is assumed to be defined by Makefile including this one.
 
@@ -21,8 +21,9 @@
 DISKTYPE=      floppy3
 
 realall: ${AUXTARGETS} ${CBIN} 
-       dd if=/dev/zero of=${IMAGE} count=3072
-       vnconfig -t ${DISKTYPE} -v -c ${VND_CDEV} ${IMAGE}
+       rm -f ${IMAGE}.tmp
+       dd if=/dev/zero of=${IMAGE}.tmp count=3072
+       vnconfig -t ${DISKTYPE} -v -c ${VND_CDEV} ${IMAGE}.tmp
        disklabel -rw ${VND_CDEV} ${DISKTYPE}
        newfs -B le -m 0 -o space -i 5120 -c 80 ${VND_RDEV} ${DISKTYPE}
        mount ${VND_DEV} ${MOUNT_POINT}
@@ -34,11 +35,12 @@
        @echo ""
        umount ${MOUNT_POINT}
        vnconfig -u ${VND_CDEV}
+       mv -f ${IMAGE}.tmp ${IMAGE}
 
 unconfig:
        -umount -f ${MOUNT_POINT}
        -vnconfig -u ${VND_DEV}
-       -/bin/rm -f ${IMAGE}
+       -/bin/rm -f ${IMAGE} ${IMAGE}.tmp
 
 ${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CRUNCHCONF}
        crunchgen -D ${TOP}/../../.. -L ${DESTDIR}/usr/lib ${CRUNCHCONF}
@@ -47,7 +49,8 @@
        make -f ${CBIN}.mk all
 
 clean cleandir distclean:
-       /bin/rm -f ${AUXCLEAN} *.core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache *.o *.cro *.c
+       /bin/rm -f ${AUXCLEAN} *.core ${IMAGE} ${IMAGE}.tmp ${CBIN} \
+           ${CBIN}.mk ${CBIN}.cache *.o *.cro *.c
 
 .include <bsd.obj.mk>
 .include <bsd.subdir.mk>
diff -r b67d5df8f51b -r 8cd347ee8714 distrib/i386/floppies/ramdisk/Makefile
--- a/distrib/i386/floppies/ramdisk/Makefile    Thu Jul 06 18:04:56 2000 +0000
+++ b/distrib/i386/floppies/ramdisk/Makefile    Thu Jul 06 18:16:35 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.29 2000/06/18 23:57:32 cyber Exp $
+#      $NetBSD: Makefile,v 1.30 2000/07/06 18:16:35 jhawk Exp $
 
 TOP=           ${.CURDIR}/..
 WARNS=1
@@ -43,8 +43,10 @@
 realall: ${IMAGE}
 
 ${IMAGE}: ${AUXTARGETS} ${CBIN} ${AUXDEPENDS} ${MTREE} ${LISTS}
-       dd if=/dev/zero of=${IMAGE} count=${RAMDISKSIZE}
-       vnconfig -v -c ${VND_CDEV} ${IMAGE} 512/${RAMDISKSPC}/1/${RAMDISKCYLS}
+       rm -f ${IMAGE}.tmp
+       dd if=/dev/zero of=${IMAGE}.tmp count=${RAMDISKSIZE}
+       vnconfig -v -c ${VND_CDEV} ${IMAGE}.tmp \
+           512/${RAMDISKSPC}/1/${RAMDISKCYLS}
        -disklabel ${VND_CDEV} >tmplabel
        disklabel -r -R ${VND_CDEV} tmplabel
        newfs -B le -m 0 -o space -i 3950 -c 80 ${VND_RDEV} 
@@ -57,11 +59,12 @@
        @echo ""
        umount ${MOUNT_POINT}
        vnconfig -u ${VND_CDEV}
+       mv -f ${IMAGE}.tmp ${IMAGE}
 
 unconfig:
        -umount -f ${MOUNT_POINT}
        -vnconfig -u ${VND_DEV}
-       -/bin/rm -f ${IMAGE}
+       -/bin/rm -f ${IMAGE} ${IMAGE}.tmp
 
 ${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CRUNCHCONF}
        crunchgen -D ${TOP}/../../.. -L ${DESTDIR}/usr/lib ${.ALLSRC}
@@ -82,7 +85,8 @@
 release:
 
 clean cleandir distclean:
-       /bin/rm -f ${AUXCLEAN} *.core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache *.o *.cro *.c tmplabel
+       /bin/rm -f ${AUXCLEAN} *.core ${IMAGE} ${IMAGE}.tmp ${CBIN} \
+           ${CBIN}.mk ${CBIN}.cache *.o *.cro *.c tmplabel
 
 .include <bsd.own.mk>
 .include <bsd.obj.mk>
diff -r b67d5df8f51b -r 8cd347ee8714 distrib/i386/floppies/ramdisk/Makefile.inc
--- a/distrib/i386/floppies/ramdisk/Makefile.inc        Thu Jul 06 18:04:56 2000 +0000
+++ b/distrib/i386/floppies/ramdisk/Makefile.inc        Thu Jul 06 18:16:35 2000 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.inc,v 1.12 2000/05/05 20:13:32 mycroft Exp $
+#      $NetBSD: Makefile.inc,v 1.13 2000/07/06 18:16:35 jhawk Exp $
 
 # TOP is assumed to be defined by Makefile including this one.
 
@@ -20,9 +20,10 @@
 
 DISKTYPE=      floppy3
 
-realall: ${AUXTARGETS} ${CBIN} 
-       dd if=/dev/zero of=${IMAGE} count=3072
-       vnconfig -t ${DISKTYPE} -v -c ${VND_CDEV} ${IMAGE}
+realall: ${AUXTARGETS} ${CBIN}
+       rm -f ${IMAGE}.tmp
+       dd if=/dev/zero of=${IMAGE}.tmp count=3072
+       vnconfig -t ${DISKTYPE} -v -c ${VND_CDEV} ${IMAGE}.tmp
        disklabel -rw ${VND_CDEV} ${DISKTYPE}
        newfs -B le -m 0 -o space -i 5120 -c 80 ${VND_RDEV} ${DISKTYPE}
        mount ${VND_DEV} ${MOUNT_POINT}
@@ -34,11 +35,12 @@
        @echo ""
        umount ${MOUNT_POINT}
        vnconfig -u ${VND_CDEV}
+       mv -f ${IMAGE}.tmp ${IMAGE}
 
 unconfig:
        -umount -f ${MOUNT_POINT}
        -vnconfig -u ${VND_DEV}
-       -/bin/rm -f ${IMAGE}
+       -/bin/rm -f ${IMAGE} ${IMAGE}.tmp
 
 ${CBIN}.mk ${CBIN}.cache ${CBIN}.c: ${CRUNCHCONF}
        crunchgen -D ${TOP}/../../.. -L ${DESTDIR}/usr/lib ${CRUNCHCONF}
@@ -47,7 +49,8 @@
        make -f ${CBIN}.mk all
 
 clean cleandir distclean:
-       /bin/rm -f ${AUXCLEAN} *.core ${IMAGE} ${CBIN} ${CBIN}.mk ${CBIN}.cache *.o *.cro *.c
+       /bin/rm -f ${AUXCLEAN} *.core ${IMAGE} ${IMAGE}.tmp ${CBIN} \
+           ${CBIN}.mk ${CBIN}.cache *.o *.cro *.c
 
 .include <bsd.obj.mk>
 .include <bsd.subdir.mk>



Home | Main Index | Thread Index | Old Index