From owner-svn-src-head@FreeBSD.ORG Sun Apr 27 00:40:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id DD5C16FF; Sun, 27 Apr 2014 00:40:18 +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 B04D0164E; Sun, 27 Apr 2014 00:40:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3R0eINI036177; Sun, 27 Apr 2014 00:40:18 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3R0eIrV036176; Sun, 27 Apr 2014 00:40:18 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <201404270040.s3R0eIrV036176@svn.freebsd.org> From: Nathan Whitehorn Date: Sun, 27 Apr 2014 00:40:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264992 - head/release/amd64 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.17 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: Sun, 27 Apr 2014 00:40:18 -0000 Author: nwhitehorn Date: Sun Apr 27 00:40:18 2014 New Revision: 264992 URL: http://svnweb.freebsd.org/changeset/base/264992 Log: Make a dual-boot BIOS/UEFI memstick image. Testing required before this gets renamed make-memstick.sh. Modified: head/release/amd64/make-uefi-memstick.sh Modified: head/release/amd64/make-uefi-memstick.sh ============================================================================== --- head/release/amd64/make-uefi-memstick.sh Sat Apr 26 23:22:49 2014 (r264991) +++ head/release/amd64/make-uefi-memstick.sh Sun Apr 27 00:40:18 2014 (r264992) @@ -1,12 +1,9 @@ #!/bin/sh # -# This script generates a "memstick image" for UEFI-capable systems. -# -# Prerequisites: -# - 'make release' -# - KERNCONF *must* be VT (or vt_efifb(4) compiled into the kernel) -# -# Note: This only works for amd64, because i386 lacks the EFI boot bits. +# This script generates a "memstick image" (image that can be copied to a +# USB memory stick) from a directory tree. Note that the script does not +# clean up after itself very well for error conditions on purpose so the +# problem can be diagnosed (full filesystem most likely but ...). # # Usage: make-memstick.sh # @@ -31,43 +28,14 @@ if [ -e ${2} ]; then exit 1 fi -dirsize=$(du -shLm ${1} | awk '{print $1}') -dirsize=$(( $(( $(( ${dirsize} + 256 )) * 1024 * 1024 )) )) -truncate -s ${dirsize} ${2} - -unit=$(mdconfig -a -t vnode -f ${2}) -gpart create -s mbr /dev/${unit} -gpart add -t '!0xEF' -s 32M /dev/${unit} -gpart add -t freebsd /dev/${unit} -gpart set -a active -i 2 /dev/${unit} -gpart bootcode -b ${1}/boot/boot0 /dev/${unit} -gpart create -s bsd -n 20 /dev/${unit}s2 -gpart add -t freebsd-ufs /dev/${unit}s2 -gpart bootcode -b ${1}/boot/boot /dev/${unit}s2 -newfs_msdos /dev/${unit}s1 -newfs -L rootfs /dev/${unit}s2a -mkdir -p ${1}/mnt -mount -t msdosfs /dev/${unit}s1 ${1}/mnt -mkdir -p ${1}/mnt/efi/boot -cp -p ${1}/boot/boot1.efi ${1}/mnt/efi/boot/BOOTx64.efi - -while ! umount ${1}/mnt; do - sleep 1 -done - -mkdir -p mnt -mount /dev/${unit}s2a mnt -tar -cf - -C ${1} . | tar -xf - -C mnt -echo "/dev/ufs/rootfs / ufs ro,noatime 1 1" > mnt/etc/fstab - -while ! umount mnt; do - sleep 1 -done - -# Default boot selection to MBR so systems that do not support UEFI -# do not fail to boot without human interaction. -boot0cfg -s 2 /dev/${unit} +echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${1}/etc/fstab +makefs -B little -o label=FreeBSD_Install ${2}.part ${1} +if [ $? -ne 0 ]; then + echo "makefs failed" + exit 1 +fi +rm ${1}/etc/fstab -mdconfig -d -u ${unit} -rmdir mnt +mkimg -s gpt -b ${1}/boot/pmbr -p freebsd-boot:=${1}/boot/gptboot -p efi:=${1}/boot/boot1.efifat -p freebsd-ufs:=${2}.part -o ${2} +rm ${2}.part