From owner-svn-src-head@FreeBSD.ORG Mon Apr 20 19:54:55 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4F985371; Mon, 20 Apr 2015 19:54:55 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 30EAA9C3; Mon, 20 Apr 2015 19:54:55 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t3KJstPq089407; Mon, 20 Apr 2015 19:54:55 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t3KJstFp089406; Mon, 20 Apr 2015 19:54:55 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201504201954.t3KJstFp089406@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 20 Apr 2015 19:54:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r281783 - head/release/tools X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2015 19:54:55 -0000 Author: gjb Date: Mon Apr 20 19:54:54 2015 New Revision: 281783 URL: https://svnweb.freebsd.org/changeset/base/281783 Log: When building VM disk images, vm_copy_base() uses tar(1) to copy the userland from one md(4)-mounted filesystem to a clean filesystem to prevent remnants of files that were added and removed from resulting in an unclean filesystem. When newfs(8) creates the first filesystem with journaled soft-updates enabled, the /.sujournal file in the new filesystem cannot be overwritten by the /.sujournal in the original filesystem. To avoid this particular error case, do not enable journaled soft-updates when creating the md(4)-backed filesystems, and instead use tunefs(8) to enable journaled soft-updates after the new filesystem is populated in vm_copy_base(). While here, fix a long standing bug where the build environment /boot files were used by mkimg(1) when creating the VM disk images by using the files in .OBJDIR. MFC after: 3 days Sponsored by: The FreeBSD Foundation Modified: head/release/tools/vmimage.subr Modified: head/release/tools/vmimage.subr ============================================================================== --- head/release/tools/vmimage.subr Mon Apr 20 19:11:27 2015 (r281782) +++ head/release/tools/vmimage.subr Mon Apr 20 19:54:54 2015 (r281783) @@ -14,17 +14,24 @@ write_partition_layout() { SWAPOPT="-p freebsd-swap/swapfs::1G" fi + _OBJDIR="$(make -C ${WORLDDIR} -V .OBJDIR)" + if [ -d "${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}" ]; then + BOOTFILES="${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}/usr/src/sys/boot" + else + BOOTFILES="${_OBJDIR}/usr/src/sys/boot" + fi + case "${TARGET}:${TARGET_ARCH}" in amd64:amd64 | i386:i386) - mkimg -s gpt -b /boot/pmbr \ - -p freebsd-boot/bootfs:=/boot/gptboot \ + mkimg -s gpt -b ${BOOTFILES}/i386/pmbr/pmbr \ + -p freebsd-boot/bootfs:=${BOOTFILES}/i386/gptboot/gptboot \ ${SWAPOPT} \ -p freebsd-ufs/rootfs:=${VMBASE} \ -o ${VMIMAGE} ;; powerpc:powerpc*) mkimg -s apm \ - -p apple-boot/bootfs:=/boot/boot1.hfs \ + -p apple-boot/bootfs:=${BOOTFILES}/powerpc/boot1.chrp/boot1.hfs \ ${SWAPOPT} \ -p freebsd-ufs/rootfs:=${VMBASE} \ -o ${VMIMAGE} @@ -63,7 +70,7 @@ vm_create_base() { mkdir -p ${DESTDIR} truncate -s ${VMSIZE} ${VMBASE} mddev=$(mdconfig -f ${VMBASE}) - newfs -j /dev/${mddev} + newfs /dev/${mddev} mount /dev/${mddev} ${DESTDIR} return 0 @@ -83,10 +90,10 @@ vm_copy_base() { truncate -s ${VMSIZE} ${VMBASE}.tmp mkdir -p ${DESTDIR}/new mdnew=$(mdconfig -f ${VMBASE}.tmp) - newfs -j /dev/${mdnew} + newfs /dev/${mdnew} mount /dev/${mdnew} ${DESTDIR}/new - tar -cf- -C ${DESTDIR}/old . | tar -xf- -C ${DESTDIR}/new + tar -cf- -C ${DESTDIR}/old . | tar -xUf- -C ${DESTDIR}/new umount_loop /dev/${mdold} rmdir ${DESTDIR}/old @@ -94,6 +101,7 @@ vm_copy_base() { umount_loop /dev/${mdnew} rmdir ${DESTDIR}/new + tunefs -j enable /dev/${mdnew} mdconfig -d -u ${mdnew} mv ${VMBASE}.tmp ${VMBASE} }