diff --git a/release/amd64/make-memstick.sh b/release/amd64/make-memstick.sh index 835dc126d61d..57902e559d10 100755 --- a/release/amd64/make-memstick.sh +++ b/release/amd64/make-memstick.sh @@ -1,72 +1,74 @@ #!/bin/sh # # 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 # # $FreeBSD$ # set -e scriptdir=$(dirname $(realpath $0)) . ${scriptdir}/../../tools/boot/install-boot.sh -PATH=/bin:/usr/bin:/sbin:/usr/sbin -export PATH +if [ "$(uname -s)" = "FreeBSD" ]; then + PATH=/bin:/usr/bin:/sbin:/usr/sbin + export PATH +fi if [ $# -ne 2 ]; then echo "make-memstick.sh /path/to/directory/or/manifest /path/to/image/file" exit 1 fi MAKEFSARG=${1} if [ -f ${MAKEFSARG} ]; then BASEBITSDIR=`dirname ${MAKEFSARG}` METALOG=${MAKEFSARG} elif [ -d ${MAKEFSARG} ]; then BASEBITSDIR=${MAKEFSARG} METALOG= else echo "${MAKEFSARG} must exist" exit 1 fi if [ -e ${2} ]; then echo "won't overwrite ${2}" exit 1 fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${BASEBITSDIR}/etc/fstab echo 'root_rw_mount="NO"' > ${BASEBITSDIR}/etc/rc.conf.local if [ -n "${METALOG}" ]; then metalogfilename=$(mktemp /tmp/metalog.XXXXXX) cat ${METALOG} > ${metalogfilename} echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} echo "./etc/rc.conf.local type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} MAKEFSARG=${metalogfilename} fi -makefs -D -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG} +makefs -D -N ${BASEBITSDIR}/etc -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG} rm ${BASEBITSDIR}/etc/fstab rm ${BASEBITSDIR}/etc/rc.conf.local if [ -n "${METALOG}" ]; then rm ${metalogfilename} fi # Make an ESP in a file. espfilename=$(mktemp /tmp/efiboot.XXXXXX) make_esp_file ${espfilename} ${fat32min} ${BASEBITSDIR}/boot/loader.efi mkimg -s mbr \ -b ${BASEBITSDIR}/boot/mbr \ -p efi:=${espfilename} \ -p freebsd:-"mkimg -s bsd -b ${BASEBITSDIR}/boot/boot -p freebsd-ufs:=${2}.part" \ -a 2 \ -o ${2} rm ${espfilename} rm ${2}.part diff --git a/release/amd64/mkisoimages.sh b/release/amd64/mkisoimages.sh index 90e6aed5e7ec..a90578c02ebd 100644 --- a/release/amd64/mkisoimages.sh +++ b/release/amd64/mkisoimages.sh @@ -1,126 +1,126 @@ #!/bin/sh # # Module: mkisoimages.sh # Author: Jordan K Hubbard # Date: 22 June 2001 # # $FreeBSD$ # # This script is used by release/Makefile to build the (optional) ISO images # for a FreeBSD release. It is considered architecture dependent since each # platform has a slightly unique way of making bootable CDs. This script # is also allowed to generate any number of images since that is more of # publishing decision than anything else. # # Usage: # # mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir] # # Where -b is passed if the ISO image should be made "bootable" by # whatever standards this architecture supports (may be unsupported), # image-label is the ISO image label, image-name is the filename of the # resulting ISO image, base-bits-dir contains the image contents and # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. set -e scriptdir=$(dirname $(realpath $0)) . ${scriptdir}/../../tools/boot/install-boot.sh if [ -z $ETDUMP ]; then ETDUMP=etdump fi if [ -z $MAKEFS ]; then MAKEFS=makefs fi if [ -z $MKIMG ]; then MKIMG=mkimg fi if [ "$1" = "-b" ]; then MAKEFSARG="$4" else MAKEFSARG="$3" fi if [ -f ${MAKEFSARG} ]; then BASEBITSDIR=`dirname ${MAKEFSARG}` METALOG=${MAKEFSARG} elif [ -d ${MAKEFSARG} ]; then BASEBITSDIR=${MAKEFSARG} METALOG= else echo "${MAKEFSARG} must exist" exit 1 fi if [ "$1" = "-b" ]; then # This is highly x86-centric and will be used directly below. bootable="-o bootimage=i386;$BASEBITSDIR/boot/cdboot -o no-emul-boot" # Make EFI system partition. espfilename=$(mktemp /tmp/efiboot.XXXXXX) # ESP file size in KB. espsize="2048" make_esp_file ${espfilename} ${espsize} ${BASEBITSDIR}/boot/loader.efi bootable="$bootable -o bootimage=i386;${espfilename} -o no-emul-boot -o platformid=efi" shift else bootable="" fi if [ $# -lt 3 ]; then echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" exit 1 fi LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift NAME="$1"; shift # MAKEFSARG extracted already shift publisher="The FreeBSD Project. https://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab" if [ -n "${METALOG}" ]; then metalogfilename=$(mktemp /tmp/metalog.XXXXXX) cat ${METALOG} > ${metalogfilename} echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} MAKEFSARG=${metalogfilename} fi -$MAKEFS -D -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@" +$MAKEFS -D -N ${BASEBITSDIR}/etc -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@" rm -f "$BASEBITSDIR/etc/fstab" rm -f ${espfilename} if [ -n "${METALOG}" ]; then rm ${metalogfilename} fi if [ "$bootable" != "" ]; then # Look for the EFI System Partition image we dropped in the ISO image. for entry in `$ETDUMP --format shell $NAME`; do eval $entry if [ "$et_platform" = "efi" ]; then espstart=`expr $et_lba \* 2048` espsize=`expr $et_sectors \* 512` espparam="-p efi::$espsize:$espstart" break fi done # Create a GPT image containing the partitions we need for hybrid boot. hybridfilename=$(mktemp /tmp/hybrid.img.XXXXXX) imgsize=`stat -f %z "$NAME"` $MKIMG -s gpt \ --capacity $imgsize \ -b "$BASEBITSDIR/boot/pmbr" \ -p freebsd-boot:="$BASEBITSDIR/boot/isoboot" \ $espparam \ -o $hybridfilename # Drop the PMBR, GPT, and boot code into the System Area of the ISO. dd if=$hybridfilename of="$NAME" bs=32k count=1 conv=notrunc rm -f $hybridfilename fi diff --git a/release/arm64/make-memstick.sh b/release/arm64/make-memstick.sh index 0dd6dcfaf4dd..9fcc001fc6fd 100755 --- a/release/arm64/make-memstick.sh +++ b/release/arm64/make-memstick.sh @@ -1,70 +1,72 @@ #!/bin/sh # # 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 # # $FreeBSD$ # set -e -PATH=/bin:/usr/bin:/sbin:/usr/sbin -export PATH +if [ "$(uname -s)" = "FreeBSD" ]; then + PATH=/bin:/usr/bin:/sbin:/usr/sbin + export PATH +fi scriptdir=$(dirname $(realpath $0)) . ${scriptdir}/../../tools/boot/install-boot.sh if [ $# -ne 2 ]; then echo "make-memstick.sh /path/to/directory/or/manifest /path/to/image/file" exit 1 fi MAKEFSARG=${1} if [ -f ${MAKEFSARG} ]; then BASEBITSDIR=`dirname ${MAKEFSARG}` METALOG=${MAKEFSARG} elif [ -d ${MAKEFSARG} ]; then BASEBITSDIR=${MAKEFSARG} METALOG= else echo "${MAKEFSARG} must exist" exit 1 fi if [ -e ${2} ]; then echo "won't overwrite ${2}" exit 1 fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${BASEBITSDIR}/etc/fstab echo 'root_rw_mount="NO"' > ${BASEBITSDIR}/etc/rc.conf.local if [ -n "${METALOG}" ]; then metalogfilename=$(mktemp /tmp/metalog.XXXXXX) cat ${METALOG} > ${metalogfilename} echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} echo "./etc/rc.conf.local type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} MAKEFSARG=${metalogfilename} fi -makefs -D -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG} +makefs -D -N ${BASEBITSDIR}/etc -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG} rm ${BASEBITSDIR}/etc/fstab rm ${BASEBITSDIR}/etc/rc.conf.local if [ -n "${METALOG}" ]; then rm ${metalogfilename} fi # Make an ESP in a file. espfilename=$(mktemp /tmp/efiboot.XXXXXX) make_esp_file ${espfilename} ${fat32min} ${BASEBITSDIR}/boot/loader.efi mkimg -s gpt \ -p efi:=${espfilename} \ -p freebsd-ufs:=${2}.part \ -o ${2} rm ${espfilename} rm ${2}.part diff --git a/release/arm64/mkisoimages.sh b/release/arm64/mkisoimages.sh index b90100286d4a..e7e56eef1cb6 100644 --- a/release/arm64/mkisoimages.sh +++ b/release/arm64/mkisoimages.sh @@ -1,119 +1,119 @@ #!/bin/sh # # $FreeBSD$ # # This script is used by release/Makefile to build the (optional) ISO images # for a FreeBSD release. It is considered architecture dependent since each # platform has a slightly unique way of making bootable CDs. This script is # also allowed to generate any number of images since that is more of # publishing decision than anything else. # # Usage: # # mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir] # # Where -b is passed if the ISO image should be made "bootable" by # whatever standards this architecture supports (may be unsupported), # image-label is the ISO image label, image-name is the filename of the # resulting ISO image, base-bits-dir contains the image contents and # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. set -e scriptdir=$(dirname $(realpath $0)) . ${scriptdir}/../../tools/boot/install-boot.sh if [ -z $ETDUMP ]; then ETDUMP=etdump fi if [ -z $MAKEFS ]; then MAKEFS=makefs fi if [ -z $MKIMG ]; then MKIMG=mkimg fi if [ "$1" = "-b" ]; then MAKEFSARG="$4" else MAKEFSARG="$3" fi if [ -f ${MAKEFSARG} ]; then BASEBITSDIR=`dirname ${MAKEFSARG}` METALOG=${MAKEFSARG} elif [ -d ${MAKEFSARG} ]; then BASEBITSDIR=${MAKEFSARG} METALOG= else echo "${MAKEFSARG} must exist" exit 1 fi if [ "$1" = "-b" ]; then # Make an EFI system partition. espfilename=$(mktemp /tmp/efiboot.XXXXXX) # ESP file size in KB. espsize="2048" make_esp_file ${espfilename} ${espsize} ${BASEBITSDIR}/boot/loader.efi bootable="-o bootimage=efi;${espfilename} -o no-emul-boot -o platformid=efi" shift else bootable="" fi if [ $# -lt 3 ]; then echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" exit 1 fi LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift NAME="$1"; shift # MAKEFSARG extracted already shift publisher="The FreeBSD Project. https://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab" if [ -n "${METALOG}" ]; then metalogfilename=$(mktemp /tmp/metalog.XXXXXX) cat ${METALOG} > ${metalogfilename} echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} MAKEFSARG=${metalogfilename} fi -$MAKEFS -D -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@" +$MAKEFS -D -N ${BASEBITSDIR}/etc -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@" rm -f "$BASEBITSDIR/etc/fstab" rm -f ${espfilename} if [ -n "${METALOG}" ]; then rm ${metalogfilename} fi if [ "$bootable" != "" ]; then # Look for the EFI System Partition image we dropped in the ISO image. for entry in `$ETDUMP --format shell $NAME`; do eval $entry # XXX: etdump(8) returns "default" for the initial entry if [ "$et_platform" = "default" ]; then espstart=`expr $et_lba \* 2048` espsize=`expr $et_sectors \* 512` espparam="-p efi::$espsize:$espstart" break fi done # Create a GPT image containing the EFI partition. efifilename=$(mktemp /tmp/efi.img.XXXXXX) imgsize=`stat -f %z "$NAME"` $MKIMG -s gpt \ --capacity $imgsize \ $espparam \ -o $efifilename # Drop the GPT into the System Area of the ISO. dd if=$efifilename of="$NAME" bs=32k count=1 conv=notrunc rm -f $efifilename fi diff --git a/release/i386/make-memstick.sh b/release/i386/make-memstick.sh index 715e4582a4ef..99f419fc0036 100755 --- a/release/i386/make-memstick.sh +++ b/release/i386/make-memstick.sh @@ -1,62 +1,64 @@ #!/bin/sh # # 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 # # $FreeBSD$ # set -e -PATH=/bin:/usr/bin:/sbin:/usr/sbin -export PATH +if [ "$(uname -s)" = "FreeBSD" ]; then + PATH=/bin:/usr/bin:/sbin:/usr/sbin + export PATH +fi if [ $# -ne 2 ]; then echo "make-memstick.sh /path/to/directory/or/manifest /path/to/image/file" exit 1 fi MAKEFSARG=${1} if [ -f ${MAKEFSARG} ]; then BASEBITSDIR=`dirname ${MAKEFSARG}` METALOG=${MAKEFSARG} elif [ -d ${MAKEFSARG} ]; then BASEBITSDIR=${MAKEFSARG} METALOG= else echo "${MAKEFSARG} must exist" exit 1 fi if [ -e ${2} ]; then echo "won't overwrite ${2}" exit 1 fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${BASEBITSDIR}/etc/fstab echo 'root_rw_mount="NO"' > ${BASEBITSDIR}/etc/rc.conf.local if [ -n "${METALOG}" ]; then metalogfilename=$(mktemp /tmp/metalog.XXXXXX) cat ${METALOG} > ${metalogfilename} echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} echo "./etc/rc.conf.local type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} MAKEFSARG=${metalogfilename} fi -makefs -D -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG} +makefs -D -N ${BASEBITSDIR}/etc -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG} rm ${BASEBITSDIR}/etc/fstab rm ${BASEBITSDIR}/etc/rc.conf.local if [ -n "${METALOG}" ]; then rm ${metalogfilename} fi mkimg -s mbr \ -b ${BASEBITSDIR}/boot/mbr \ -p freebsd:-"mkimg -s bsd -b ${BASEBITSDIR}/boot/boot -p freebsd-ufs:=${2}.part" \ -o ${2} rm ${2}.part diff --git a/release/i386/mkisoimages.sh b/release/i386/mkisoimages.sh index a408fa7cddb2..6ee7f72212c9 100644 --- a/release/i386/mkisoimages.sh +++ b/release/i386/mkisoimages.sh @@ -1,75 +1,75 @@ #!/bin/sh # # Module: mkisoimages.sh # Author: Jordan K Hubbard # Date: 22 June 2001 # # $FreeBSD$ # # This script is used by release/Makefile to build the (optional) ISO images # for a FreeBSD release. It is considered architecture dependent since each # platform has a slightly unique way of making bootable CDs. This script # is also allowed to generate any number of images since that is more of # publishing decision than anything else. # # Usage: # # mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir] # # Where -b is passed if the ISO image should be made "bootable" by # whatever standards this architecture supports (may be unsupported), # image-label is the ISO image label, image-name is the filename of the # resulting ISO image, base-bits-dir contains the image contents and # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. set -e if [ "$1" = "-b" ]; then MAKEFSARG="$4" else MAKEFSARG="$3" fi if [ -f ${MAKEFSARG} ]; then BASEBITSDIR=`dirname ${MAKEFSARG}` METALOG=${MAKEFSARG} elif [ -d ${MAKEFSARG} ]; then BASEBITSDIR=${MAKEFSARG} METALOG= else echo "${MAKEFSARG} must exist" exit 1 fi if [ "$1" = "-b" ]; then # This is highly x86-centric and will be used directly below. bootable="-o bootimage=i386;$BASEBITSDIR/boot/cdboot -o no-emul-boot" shift else bootable="" fi if [ $# -lt 3 ]; then echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" exit 1 fi LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift NAME="$1"; shift # MAKEFSARG extracted already shift publisher="The FreeBSD Project. https://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab" if [ -n "${METALOG}" ]; then metalogfilename=$(mktemp /tmp/metalog.XXXXXX) cat ${METALOG} > ${metalogfilename} echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} MAKEFSARG=${metalogfilename} fi -makefs -D -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@" +makefs -D -N ${BASEBITSDIR}/etc -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@" rm -f "$BASEBITSDIR/etc/fstab" if [ -n "${METALOG}" ]; then rm ${metalogfilename} fi diff --git a/release/powerpc/mkisoimages.sh b/release/powerpc/mkisoimages.sh index 362604170fd1..0f13464567f1 100644 --- a/release/powerpc/mkisoimages.sh +++ b/release/powerpc/mkisoimages.sh @@ -1,116 +1,116 @@ #!/bin/sh # # Module: mkisoimages.sh # Author: Jordan K Hubbard # Date: 22 June 2001 # # $FreeBSD$ # # This script is used by release/Makefile to build the (optional) ISO images # for a FreeBSD release. It is considered architecture dependent since each # platform has a slightly unique way of making bootable CDs. This script # is also allowed to generate any number of images since that is more of # publishing decision than anything else. # # Usage: # # mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir] # # Where -b is passed if the ISO image should be made "bootable" by # whatever standards this architecture supports (may be unsupported), # image-label is the ISO image label, image-name is the filename of the # resulting ISO image, base-bits-dir contains the image contents and # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. set -e if [ "$1" = "-b" ]; then MAKEFSARG="$4" else MAKEFSARG="$3" fi if [ -f ${MAKEFSARG} ]; then BASEBITSDIR=`dirname ${MAKEFSARG}` METALOG=${MAKEFSARG} elif [ -d ${MAKEFSARG} ]; then BASEBITSDIR=${MAKEFSARG} METALOG= else echo "${MAKEFSARG} must exist" exit 1 fi if [ "$1" = "-b" ]; then bootable=1 shift else bootable="" fi if [ $# -lt 3 ]; then echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" exit 1 fi LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift NAME="$1"; shift # MAKEFSARG extracted already shift if [ -n "${METALOG}" ]; then metalogfilename=$(mktemp /tmp/metalog.XXXXXX) cat ${METALOG} > ${metalogfilename} MAKEFSARG=${metalogfilename} fi if [ -n "$bootable" ]; then echo "Building bootable disc" # Apple boot code uudecode -o /tmp/hfs-boot-block.bz2 "`dirname "$0"`/hfs-boot.bz2.uu" bzip2 -d /tmp/hfs-boot-block.bz2 OFFSET=$(hd /tmp/hfs-boot-block | grep 'Loader START' | cut -f 1 -d ' ') OFFSET=0x$(echo 0x$OFFSET | awk '{printf("%x\n",$1/512);}') dd if="$BASEBITSDIR/boot/loader" of=/tmp/hfs-boot-block seek=$OFFSET conv=notrunc bootable="-o bootimage=macppc;/tmp/hfs-boot-block -o no-emul-boot" # pSeries/PAPR boot code mkdir -p "$BASEBITSDIR/ppc/chrp" cp "$BASEBITSDIR/boot/loader" "$BASEBITSDIR/ppc/chrp" cat > "$BASEBITSDIR/ppc/bootinfo.txt" << EOF FreeBSD Install FreeBSD boot &device;:,\ppc\chrp\loader EOF bootable="$bootable -o chrp-boot" if [ -n "${METALOG}" ]; then echo "./ppc type=dir uname=root gname=wheel mode=0755" >> ${metalogfilename} echo "./ppc/chrp type=dir uname=root gname=wheel mode=0755" >> ${metalogfilename} echo "./ppc/chrp/loader type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} echo "./ppc/bootinfo.txt type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} fi # Petitboot config for PS3/PowerNV echo FreeBSD Install=\'/boot/kernel/kernel vfs.root.mountfrom=cd9660:/dev/iso9660/$LABEL\' > "$BASEBITSDIR/etc/kboot.conf" if [ -n "${METALOG}" ]; then echo "./etc/kboot.conf type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} fi fi publisher="The FreeBSD Project. https://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab" if [ -n "${METALOG}" ]; then echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} fi -makefs -D -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@" +makefs -D -N ${BASEBITSDIR}/etc -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@" rm -f "$BASEBITSDIR/etc/fstab" rm -f /tmp/hfs-boot-block rm -rf "$BASEBITSDIR/ppc" if [ -n "${METALOG}" ]; then rm ${metalogfilename} fi diff --git a/release/riscv/make-memstick.sh b/release/riscv/make-memstick.sh index 0dd6dcfaf4dd..9fcc001fc6fd 100755 --- a/release/riscv/make-memstick.sh +++ b/release/riscv/make-memstick.sh @@ -1,70 +1,72 @@ #!/bin/sh # # 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 # # $FreeBSD$ # set -e -PATH=/bin:/usr/bin:/sbin:/usr/sbin -export PATH +if [ "$(uname -s)" = "FreeBSD" ]; then + PATH=/bin:/usr/bin:/sbin:/usr/sbin + export PATH +fi scriptdir=$(dirname $(realpath $0)) . ${scriptdir}/../../tools/boot/install-boot.sh if [ $# -ne 2 ]; then echo "make-memstick.sh /path/to/directory/or/manifest /path/to/image/file" exit 1 fi MAKEFSARG=${1} if [ -f ${MAKEFSARG} ]; then BASEBITSDIR=`dirname ${MAKEFSARG}` METALOG=${MAKEFSARG} elif [ -d ${MAKEFSARG} ]; then BASEBITSDIR=${MAKEFSARG} METALOG= else echo "${MAKEFSARG} must exist" exit 1 fi if [ -e ${2} ]; then echo "won't overwrite ${2}" exit 1 fi echo '/dev/ufs/FreeBSD_Install / ufs ro,noatime 1 1' > ${BASEBITSDIR}/etc/fstab echo 'root_rw_mount="NO"' > ${BASEBITSDIR}/etc/rc.conf.local if [ -n "${METALOG}" ]; then metalogfilename=$(mktemp /tmp/metalog.XXXXXX) cat ${METALOG} > ${metalogfilename} echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} echo "./etc/rc.conf.local type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} MAKEFSARG=${metalogfilename} fi -makefs -D -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG} +makefs -D -N ${BASEBITSDIR}/etc -B little -o label=FreeBSD_Install -o version=2 ${2}.part ${MAKEFSARG} rm ${BASEBITSDIR}/etc/fstab rm ${BASEBITSDIR}/etc/rc.conf.local if [ -n "${METALOG}" ]; then rm ${metalogfilename} fi # Make an ESP in a file. espfilename=$(mktemp /tmp/efiboot.XXXXXX) make_esp_file ${espfilename} ${fat32min} ${BASEBITSDIR}/boot/loader.efi mkimg -s gpt \ -p efi:=${espfilename} \ -p freebsd-ufs:=${2}.part \ -o ${2} rm ${espfilename} rm ${2}.part diff --git a/release/riscv/mkisoimages.sh b/release/riscv/mkisoimages.sh index b90100286d4a..e7e56eef1cb6 100644 --- a/release/riscv/mkisoimages.sh +++ b/release/riscv/mkisoimages.sh @@ -1,119 +1,119 @@ #!/bin/sh # # $FreeBSD$ # # This script is used by release/Makefile to build the (optional) ISO images # for a FreeBSD release. It is considered architecture dependent since each # platform has a slightly unique way of making bootable CDs. This script is # also allowed to generate any number of images since that is more of # publishing decision than anything else. # # Usage: # # mkisoimages.sh [-b] image-label image-name base-bits-dir [extra-bits-dir] # # Where -b is passed if the ISO image should be made "bootable" by # whatever standards this architecture supports (may be unsupported), # image-label is the ISO image label, image-name is the filename of the # resulting ISO image, base-bits-dir contains the image contents and # extra-bits-dir, if provided, contains additional files to be merged # into base-bits-dir as part of making the image. set -e scriptdir=$(dirname $(realpath $0)) . ${scriptdir}/../../tools/boot/install-boot.sh if [ -z $ETDUMP ]; then ETDUMP=etdump fi if [ -z $MAKEFS ]; then MAKEFS=makefs fi if [ -z $MKIMG ]; then MKIMG=mkimg fi if [ "$1" = "-b" ]; then MAKEFSARG="$4" else MAKEFSARG="$3" fi if [ -f ${MAKEFSARG} ]; then BASEBITSDIR=`dirname ${MAKEFSARG}` METALOG=${MAKEFSARG} elif [ -d ${MAKEFSARG} ]; then BASEBITSDIR=${MAKEFSARG} METALOG= else echo "${MAKEFSARG} must exist" exit 1 fi if [ "$1" = "-b" ]; then # Make an EFI system partition. espfilename=$(mktemp /tmp/efiboot.XXXXXX) # ESP file size in KB. espsize="2048" make_esp_file ${espfilename} ${espsize} ${BASEBITSDIR}/boot/loader.efi bootable="-o bootimage=efi;${espfilename} -o no-emul-boot -o platformid=efi" shift else bootable="" fi if [ $# -lt 3 ]; then echo "Usage: $0 [-b] image-label image-name base-bits-dir [extra-bits-dir]" exit 1 fi LABEL=`echo "$1" | tr '[:lower:]' '[:upper:]'`; shift NAME="$1"; shift # MAKEFSARG extracted already shift publisher="The FreeBSD Project. https://www.FreeBSD.org/" echo "/dev/iso9660/$LABEL / cd9660 ro 0 0" > "$BASEBITSDIR/etc/fstab" if [ -n "${METALOG}" ]; then metalogfilename=$(mktemp /tmp/metalog.XXXXXX) cat ${METALOG} > ${metalogfilename} echo "./etc/fstab type=file uname=root gname=wheel mode=0644" >> ${metalogfilename} MAKEFSARG=${metalogfilename} fi -$MAKEFS -D -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@" +$MAKEFS -D -N ${BASEBITSDIR}/etc -t cd9660 $bootable -o rockridge -o label="$LABEL" -o publisher="$publisher" "$NAME" "$MAKEFSARG" "$@" rm -f "$BASEBITSDIR/etc/fstab" rm -f ${espfilename} if [ -n "${METALOG}" ]; then rm ${metalogfilename} fi if [ "$bootable" != "" ]; then # Look for the EFI System Partition image we dropped in the ISO image. for entry in `$ETDUMP --format shell $NAME`; do eval $entry # XXX: etdump(8) returns "default" for the initial entry if [ "$et_platform" = "default" ]; then espstart=`expr $et_lba \* 2048` espsize=`expr $et_sectors \* 512` espparam="-p efi::$espsize:$espstart" break fi done # Create a GPT image containing the EFI partition. efifilename=$(mktemp /tmp/efi.img.XXXXXX) imgsize=`stat -f %z "$NAME"` $MKIMG -s gpt \ --capacity $imgsize \ $espparam \ -o $efifilename # Drop the GPT into the System Area of the ISO. dd if=$efifilename of="$NAME" bs=32k count=1 conv=notrunc rm -f $efifilename fi