Module Name: src Committed By: martin Date: Fri Apr 24 17:19:50 UTC 2020
Modified Files: src/distrib/amd64/uefi-installimage [netbsd-9]: Makefile Makefile.bootimage Makefile.installimage src/distrib/common/bootimage [netbsd-9]: Makefile.bootimage Makefile.installimage src/distrib/hpcarm [netbsd-9]: Makefile src/distrib/zaurus [netbsd-9]: Makefile Added Files: src/distrib/common/bootimage [netbsd-9]: diskproto.mbrfat.in src/distrib/hpcarm/liveimage [netbsd-9]: Makefile fstab.in spec.in src/distrib/zaurus/liveimage [netbsd-9]: Makefile fstab.in spec.in Log Message: Pull up following revision(s) (requested by tsutsui in ticket #846): distrib/hpcarm/Makefile: revision 1.7 distrib/amd64/uefi-installimage/Makefile: revision 1.7 distrib/common/bootimage/Makefile.installimage: revision 1.6 distrib/hpcarm/liveimage/spec.in: revision 1.1 distrib/common/bootimage/Makefile.bootimage: revision 1.23 distrib/common/bootimage/Makefile.bootimage: revision 1.24 distrib/zaurus/liveimage/Makefile: revision 1.1 distrib/amd64/uefi-installimage/Makefile.installimage: revision 1.3 distrib/zaurus/Makefile: revision 1.3 distrib/hpcarm/liveimage/Makefile: revision 1.1 distrib/zaurus/liveimage/spec.in: revision 1.1 distrib/common/bootimage/diskproto.mbrfat.in: revision 1.1 distrib/amd64/uefi-installimage/Makefile.bootimage: revision 1.13 distrib/hpcarm/liveimage/fstab.in: revision 1.1 distrib/zaurus/liveimage/fstab.in: revision 1.1 Merge amd64's UEFI logic back into the generic bootimage handling. Add "live-image with a FAT partition for bootstrap files" support. See PR/55075 for more details. Add "build.sh live-image" support for zaurus. Tested on SL-C3000 and SL-C700. See also PR/55075 for live-image with FAT partition support. Add "build.sh live-image" support for hpcarm. Tested on WS003SH. See also PR/55075 for live-image with FAT partition support. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.6.2.1 src/distrib/amd64/uefi-installimage/Makefile cvs rdiff -u -r1.11.2.1 -r1.11.2.2 \ src/distrib/amd64/uefi-installimage/Makefile.bootimage cvs rdiff -u -r1.2 -r1.2.18.1 \ src/distrib/amd64/uefi-installimage/Makefile.installimage cvs rdiff -u -r1.21.2.1 -r1.21.2.2 \ src/distrib/common/bootimage/Makefile.bootimage cvs rdiff -u -r1.5 -r1.5.14.1 \ src/distrib/common/bootimage/Makefile.installimage cvs rdiff -u -r0 -r1.1.4.2 src/distrib/common/bootimage/diskproto.mbrfat.in cvs rdiff -u -r1.6 -r1.6.64.1 src/distrib/hpcarm/Makefile cvs rdiff -u -r0 -r1.1.4.2 src/distrib/hpcarm/liveimage/Makefile \ src/distrib/hpcarm/liveimage/fstab.in \ src/distrib/hpcarm/liveimage/spec.in cvs rdiff -u -r1.2 -r1.2.48.1 src/distrib/zaurus/Makefile cvs rdiff -u -r0 -r1.1.4.2 src/distrib/zaurus/liveimage/Makefile \ src/distrib/zaurus/liveimage/fstab.in \ src/distrib/zaurus/liveimage/spec.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/distrib/amd64/uefi-installimage/Makefile diff -u src/distrib/amd64/uefi-installimage/Makefile:1.6 src/distrib/amd64/uefi-installimage/Makefile:1.6.2.1 --- src/distrib/amd64/uefi-installimage/Makefile:1.6 Sat Dec 15 18:03:17 2018 +++ src/distrib/amd64/uefi-installimage/Makefile Fri Apr 24 17:19:49 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.6 2018/12/15 18:03:17 gson Exp $ +# $NetBSD: Makefile,v 1.6.2.1 2020/04/24 17:19:49 martin Exp $ .include <bsd.own.mk> @@ -40,4 +40,4 @@ IMGFILE_EXTRA= \ ${SYSINSTDIR}/sysinstmsgs.pl . \ ${SYSINSTDIR}/sysinst . -.include "${.CURDIR}/Makefile.installimage" +.include "${NETBSDSRCDIR}/distrib/common/bootimage//Makefile.installimage" Index: src/distrib/amd64/uefi-installimage/Makefile.bootimage diff -u src/distrib/amd64/uefi-installimage/Makefile.bootimage:1.11.2.1 src/distrib/amd64/uefi-installimage/Makefile.bootimage:1.11.2.2 --- src/distrib/amd64/uefi-installimage/Makefile.bootimage:1.11.2.1 Sun Nov 17 07:04:37 2019 +++ src/distrib/amd64/uefi-installimage/Makefile.bootimage Fri Apr 24 17:19:49 2020 @@ -1,500 +0,0 @@ -# $NetBSD: Makefile.bootimage,v 1.11.2.1 2019/11/17 07:04:37 martin Exp $ -# -# Copyright (c) 2009, 2010, 2011 Izumi Tsutsui. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# -# Makefile to create a bootable FS image for USB flash or emulators -# - -# -# Required variables: -# RELEASEDIR -# Should be defined in nbmake-${MACHINE} -# IMGBASE -# Basename of the image -# -# Optional variables: -# USE_MBR -# set yes if target disk image requires MBR partition -# (default: no) -# USE_GPT -# set yes if target disk image requires GPT partition -# (default: no) -# MBR_BOOTCODE -# optional MBR bootcode which should be installed by fdisk(8) -# (default: empty) -# - specified MBR_BOOTCODE must exist in ${DESTDIR}/usr/mdec -# - if MBR_BOOTCODE is not specified, -# MBR_DEFAULT_BOOTCODE (default: mbr) will be used -# if the target ${MACHINE} has the one in /usr/mdec -# USE_SUNLABEL -# set yes if target disk image requires Sun's label -# (default: no) -# INSTALLBOOT_AFTER_DISKLABEL (untested) -# set yes if the target ${MACHINE} requires disklabel -# to run installboot(8), like hp300 -# (default: empty) -# IMAGEMB -# target image size in MB -# (default: 2048) -# SWAPMB -# swap size in target image in MB -# (default: 128) -# EFIMB -# EFI partition size in target image in MB -# (default: 128) -# KERN_SET -# kernel set name which should be extracted into image -# (default: kern-GENERIC) -# SETS -# binary sets that should be extracted into image -# (default: modules base etc comp games man misc rescue tests -# text xbase xcomp xetc xfont xserver) -# SETS_DIR -# directory path where binary sets are stored -# (default: ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets) -# IMGFILE_EXTRA -# list of additional files to be copied into images, -# containing one or more tuples of the form: -# FILE TARGETPATH -# for installation image etc. -# (default: empty) -# IMGDIR_EXTRA -# list of additional directories to be copied into images, -# containing one or more tuples of the form: -# DIR TARGETPATH -# for installation image etc. -# (default: empty) -# XXX: currently permissions in IMGDIR_EXTRA are not handled -# IMGDIR_EXCLUDE -# pax(1) options to exclude files which should not copied -# into TARGETPATH in IMGDIR_EXTRA -# (default: empty) -# FSTAB_IN -# template file of /etc/fstab -# (default: ${DISTRIBDIR}/common/bootimage/fstab.in) -# SPEC_IN -# default files of spec file for makefs(8) -# (default: ${DISTRIBDIR}/common/bootimage/spec.in) -# SPEC_EXTRA -# additional files of spec file for makefs(8) -# (default: empty) -# IMGMAKEFSOPTIONS -# options passed to makefs(8) to create root file system -# (default: -o bsize=16384,fsize=2048,density=8192) -# INSTALLBOOTOPTIONS -# options passed to installboot(8), e.g., -o console=com0 -# (default: empty) -# PRIMARY_BOOT -# primary boot loader that should be installed into -# the target image via installboot(8) -# (default: empty) -# SECONDARY_BOOT -# secondary bootloader that should be put into the target image -# (default: empty) -# SECONDARY_BOOT_ARG -# extra arguments that should be passed to installboot(8) -# to specify the secondary bootloader -# (default: empty) -# DISKPROTO_IN -# template file of disklabel -R -# (default: ${DISTRIBDIR}/common/bootimage/diskproto.in -# or ${DISTRIBDIR}/common/bootimage/diskproto.mbr.in) -# OMIT_SWAPIMG -# no need to put swap partition into image (for USB stick) -# (default: no) -# EFIBOOT -# EFI bootloader -# (default: empty) -# - -.include <bsd.own.mk> # -.include <bsd.endian.mk> # for TARGET_ENDIANNESS - -.include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" - -.if ${MKREPRO_TIMESTAMP:Uno} != "no" -MAKEFS_TIMESTAMP=-T "${MKREPRO_TIMESTAMP}" -GPT_TIMESTAMP=-T "${MKREPRO_TIMESTAMP}" -PAX_TIMESTAMP=--timestamp "${MKREPRO_TIMESTAMP}" -.endif - -.if empty(IMGBASE) -.BEGIN: - @echo "Error: IMGBASE is not set" - @false -.endif - -# should be defined elsewhere? -CAT?= cat -CHMOD?= chmod -DD?= dd -MKDIR?= mkdir -p -RM?= rm - -# -# common definitions for image -# -USE_MBR?= no -USE_GPT?= no -USE_SUNLABEL?= no -INSTALLBOOT_AFTER_DISKLABEL?= no - -# -# size parameters for image -# -IMAGEMB?= 2048 # 2048MB -SWAPMB?= 128 # 128MB -EFIMB?= 128 # 128MB - -# XXX: SWAPMB could be zero and expr(1) returns exit status 1 in that case -IMAGESECTORS!= expr ${IMAGEMB} \* 1024 \* 1024 / 512 -SWAPSECTORS!= expr ${SWAPMB} \* 1024 \* 1024 / 512 || true -EFISECTORS!= expr ${EFIMB} \* 1024 \* 1024 / 512 || true - -.if ${USE_MBR} == "no" && ${USE_GPT} == "no" -LABELSECTORS?= 0 -.else -#LABELSECTORS?= 63 # historical -#LABELSECTORS?= 32 # 16KB aligned -LABELSECTORS?= 2048 # 1MB aligned for modern flash devices -.endif - -FSSECTORS!= expr ${IMAGESECTORS} - ${SWAPSECTORS} - ${LABELSECTORS} -FSSIZE!= expr ${FSSECTORS} \* 512 - -# parameters for disklabel and MBR -HEADS= 64 -SECTORS= 32 -CYLINDERS!= expr ${IMAGESECTORS} / \( ${HEADS} \* ${SECTORS} \) -SECPERCYLINDERS!= expr ${HEADS} \* ${SECTORS} -MBRHEADS= 255 -MBRSECTORS= 63 -MBRCYLINDERS!= expr ${IMAGESECTORS} / \( ${MBRHEADS} \* ${MBRSECTORS} \) -MBRNETBSD= 169 - -BSDPARTSECTORS!= expr ${IMAGESECTORS} - ${LABELSECTORS} -FSOFFSET= ${LABELSECTORS} -SWAPOFFSET!= expr ${LABELSECTORS} + ${FSSECTORS} - -# parameters for sunlabel -FSCYLINDERS!= expr ${FSSECTORS} / \( ${HEADS} \* ${SECTORS} \) -SWAPCYLINDERS!= expr ${SWAPSECTORS} / \( ${HEADS} \* ${SECTORS} \) || true - -.if ${USE_GPT} != "no" -# 2048 for Secondary GPT header and entries -FSSECTORS!= expr ${IMAGESECTORS} - ${SWAPSECTORS} - ${LABELSECTORS} \ - - ${EFISECTORS} - 2048 -FSSIZE!= expr ${FSSECTORS} \* 512 - -BSDPARTSECTORS!= expr ${IMAGESECTORS} - ${LABELSECTORS} - ${EFISECTORS} - 2048 -FSOFFSET!= expr ${LABELSECTORS} + ${EFISECTORS} -SWAPOFFSET!= expr ${LABELSECTORS} + ${FSSECTORS} + ${EFISECTORS} - -BOOTDISK_UUID=`${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} show -i 2 | ${TOOL_AWK} '/^GUID/ {print $$2}'` -SWAPDISK_UUID=`${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} show -i 3 | ${TOOL_AWK} '/^GUID/ {print $$2}'` -.endif - -# -# definitions to create root fs -# -SETS_DEFAULT= modules base etc comp games man misc rescue tests text -.if ${MKX11} != "no" -SETS_DEFAULT+= xbase xcomp xetc xfont xserver -.endif - -KERN_SET?= kern-GENERIC -SETS?= ${SETS_DEFAULT} -IMG_SETS= ${KERN_SET} ${SETS} -SETS_DIR?= ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets - -FSTAB_IN?= ${DISTRIBDIR}/common/bootimage/fstab.in -SPEC_IN?= ${DISTRIBDIR}/common/bootimage/spec.in - -IMGMAKEFSOPTIONS?= -o bsize=16384,fsize=2048,density=8192 - -WORKDIR?= work -WORKSPEC?= work.spec -WORKFSTAB?= work.fstab -WORKRCCONF?= work.rc.conf -WORKFS?= work.rootfs -TARGETFS?= imgroot.fs -COMPRESS_PROGRAM=${"${USE_XZ_SETS:Uno}"!="no":?${TOOL_XZ}:${TOOL_GZIP}} -TAR_SUFF= ${"${USE_XZ_SETS:Uno}"!="no":?tar.xz:tgz} - -CLEANFILES+= ${WORKSPEC} ${WORKFSTAB} ${WORKRCCONF} ${WORKFS} -CLEANFILES+= ${TARGETFS} - -# -# create root file system for the image -# -${TARGETFS}: prepare_md_post pre-targetfs - @if [ ! -d ${RELEASEDIR}/${RELEASEMACHINEDIR} ]; then \ - echo "Missing ${RELEASEDIR}/${RELEASEMACHINEDIR}, aborting"; \ - false; \ - fi; - @${MKDIR} ${MKDIRPERM} ${WORKDIR} -.for set in ${IMG_SETS} - @if [ ! -f ${SETS_DIR}/${set}.${TAR_SUFF} ]; then \ - echo "Missing ${SETS_DIR}/${set}.${TAR_SUFF}, aborting";\ - false; \ - fi - @echo Extracting ${set}.${TAR_SUFF} ... - @(cd ${WORKDIR}; ${TOOL_PAX} ${PAX_TIMESTAMP} -rn \ - --use-compress-program=${COMPRESS_PROGRAM:Q} \ - -f ${SETS_DIR}/${set}.${TAR_SUFF} .) -.endfor -.if defined(SECONDARY_BOOT) - @echo Copying secondary boot... - ${INSTALL} ${COPY} -m 0444 ${WORKDIR}/usr/mdec/${SECONDARY_BOOT} ${WORKDIR} -.endif - @echo Preparing /etc/fstab ... -.if ${USE_GPT} != "no" -.if ${OMIT_SWAPIMG} == "no" - ${TOOL_SED} \ - -e "s/ROOT.a/NAME=${BOOTDISK_UUID}/" \ - -e "s/ROOT.b/NAME=${SWAPDISK_UUID}/" \ - < ${FSTAB_IN} > ${WORKFSTAB} -.else - ${TOOL_SED} \ - -e "s/ROOT.a/NAME=${BOOTDISK_UUID}/" \ - -e "/ROOT.b/d" \ - < ${FSTAB_IN} > ${WORKFSTAB} -.endif -.else # USE_GPT == "no" -.if ${OMIT_SWAPIMG} == "no" - ${TOOL_SED} < ${FSTAB_IN} > ${WORKFSTAB} -.else - ${TOOL_SED} \ - -e "/ROOT.b/d" \ - < ${FSTAB_IN} > ${WORKFSTAB} -.endif -.endif # USE_GPT != "no" - ${INSTALL} ${COPY} -m 0644 ${WORKFSTAB} ${WORKDIR}/etc/fstab - @echo Setting rc_configured=YES in /etc/rc.conf ... - ${TOOL_SED} "s/rc_configured=NO/rc_configured=YES/" \ - < ${WORKDIR}/etc/rc.conf > ${WORKRCCONF} - ${INSTALL} ${COPY} -m 0644 ${WORKRCCONF} ${WORKDIR}/etc/rc.conf -.if defined(IMGDIR_EXTRA) - @echo Copying extra dirs... -.for _SRCDIR _TARGET in ${IMGDIR_EXTRA} - @if [ ! -d ${_SRCDIR} ]; then \ - echo "${_SRCDIR} is not directory, aborting"; \ - false; \ - fi - ${MKDIR} ${MKDIRPERM} ${WORKDIR}/${_TARGET} - (cd ${_SRCDIR} ; \ - ${TOOL_PAX} ${PAX_TIMESTAMP} -rw -pe -v \ - ${IMGDIR_EXCLUDE} \ - . ${.OBJDIR}/${WORKDIR}/${_TARGET} ) -.endfor -.endif -.if defined(IMGFILE_EXTRA) - @echo Copying extra files... -.for _SRC _TARGET in ${IMGFILE_EXTRA} - @if [ ! -f ${_SRC} ]; then \ - echo "${_SRC} in IMGFILE_EXTRA not found, aborting"; \ - false; \ - fi - @if [ -f ${_SRC} ]; then \ - echo ${INSTALL} ${COPY} -m 0644 ${_SRC} ${WORKDIR}/${_TARGET}; \ - ${INSTALL} ${COPY} -m 0644 ${_SRC} ${WORKDIR}/${_TARGET}; \ - fi -.endfor -.endif - @echo Preparing spec files for makefs... - ${RM} -f ${WORKSPEC} - cat ${WORKDIR}/etc/mtree/* | \ - ${TOOL_SED} -e 's/ size=[0-9]*//' > ${WORKSPEC} - ${HOST_SH} ${WORKDIR}/dev/MAKEDEV -s all ipty | \ - ${TOOL_SED} -e '/^\. type=dir/d' -e 's,^\.,./dev,' >> ${WORKSPEC} - cat ${SPEC_IN} >> ${WORKSPEC} -.if defined(SECONDARY_BOOT) - echo "./${SECONDARY_BOOT} type=file uname=root gname=wheel mode=0444" \ - >> ${WORKSPEC} -.endif -.if defined(SPEC_EXTRA) - cat ${SPEC_EXTRA} >> ${WORKSPEC} -.endif - @echo Creating rootfs... - # XXX /var/spool/ftp/hidden is unreadable - ${CHMOD} +r ${WORKDIR}/var/spool/ftp/hidden - ${TOOL_MAKEFS} -M ${FSSIZE} -m ${FSSIZE} \ - -B ${TARGET_ENDIANNESS} \ - -F ${WORKSPEC} -N ${WORKDIR}/etc \ - ${MAKEFS_TIMESTAMP} \ - ${IMGMAKEFSOPTIONS} \ - ${WORKFS} ${WORKDIR} -.if !empty(PRIMARY_BOOT) && ${INSTALLBOOT_AFTER_DISKLABEL} == "no" - ${TOOL_INSTALLBOOT} -v -m ${MACHINE} ${INSTALLBOOTOPTIONS} ${WORKFS} \ - ${WORKDIR}/usr/mdec/${PRIMARY_BOOT} ${SECONDARY_BOOT_ARG} -.endif - @echo done. - mv ${WORKFS} ${.TARGET} - -# -# definitions to create image -# -.if ${USE_MBR} != "no" -DISKPROTO_IN?= ${DISTRIBDIR}/common/bootimage/diskproto.mbr.in -.else -DISKPROTO_IN?= ${DISTRIBDIR}/common/bootimage/diskproto.in -.endif - -MBR_DEFAULT_BOOTCODE?= mbr - -OMIT_SWAPIMG?= no - -WORKMBR?= work.mbr -WORKSWAP?= work.swap -WORKEFI?= work.efi -WORKGPT?= work.gpt -WORKLABEL?= work.diskproto -WORKIMG?= work.img -EFIWORKDIR?= work.efidir - -CLEANFILES+= ${WORKMBR} ${WORKSWAP} -CLEANFILES+= ${WORKEFI} ${WORKGPT} -CLEANFILES+= ${WORKLABEL}.tmp ${WORKLABEL} -CLEANFILES+= ${WORKIMG} ${IMGBASE}.img - -${WORKLABEL}: - ${TOOL_SED} \ - -e "s/@@SECTORS@@/${SECTORS}/" \ - -e "s/@@HEADS@@/${HEADS}/" \ - -e "s/@@SECPERCYLINDERS@@/${SECPERCYLINDERS}/" \ - -e "s/@@CYLINDERS@@/${CYLINDERS}/" \ - -e "s/@@IMAGESECTORS@@/${IMAGESECTORS}/" \ - -e "s/@@FSSECTORS@@/${FSSECTORS}/" \ - -e "s/@@FSOFFSET@@/${FSOFFSET}/" \ - -e "s/@@SWAPSECTORS@@/${SWAPSECTORS}/" \ - -e "s/@@SWAPOFFSET@@/${SWAPOFFSET}/" \ - -e "s/@@BSDPARTSECTORS@@/${BSDPARTSECTORS}/" \ - < ${DISKPROTO_IN} > ${WORKLABEL}.tmp - mv ${WORKLABEL}.tmp ${WORKLABEL} - -pre-targetfs: -.if ${USE_GPT} != "no" - @echo creating GPT header and partition entries... - ${RM} -f ${WORKMBR} - ${DD} if=/dev/zero of=${WORKMBR} seek=$$((${IMAGESECTORS} - 1)) count=1 - ${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} create - ${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} add -a 1m -s ${EFISECTORS} -t efi -l "EFI system" - ${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} add -a 1m -s ${FSSECTORS} -t ffs -.if ${OMIT_SWAPIMG} == "no" - ${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} add -a 1m -s ${SWAPSECTORS} -t swap -.endif - -${IMGBASE}.img: ${TARGETFS} - @echo create EFI system partition... - @${MKDIR} ${MKDIRPERM} ${EFIWORKDIR}/EFI/boot -.if !empty(EFIBOOT) -.for f in ${EFIBOOT} - ${INSTALL} ${COPY} -m 0644 ${f} ${EFIWORKDIR}/EFI/boot/`basename ${f}` -.endfor -.endif - ${RM} -f ${WORKEFI} - ${TOOL_MAKEFS} -M ${EFIMB}m -m ${EFIMB}m \ - -B ${TARGET_ENDIANNESS} \ - ${MAKEFS_TIMESTAMP} \ - -t msdos -o F=32,c=1 \ - ${WORKEFI} ${EFIWORKDIR} - @echo create GPT image... - ${DD} if=${WORKMBR} of=${WORKGPT} skip=$$((${IMAGESECTORS} - 2048)) \ - count=2048 - ${DD} if=${WORKMBR} count=${LABELSECTORS} | \ - ${CAT} - ${WORKEFI} ${TARGETFS} ${WORKGPT} > ${WORKIMG} - ${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKIMG} biosboot -i 2 \ - -c ${.OBJDIR}/${WORKDIR}/usr/mdec/gptmbr.bin - ${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKIMG} set -a bootme -i 2 -.else # USE_GPT == "no" -${IMGBASE}.img: ${TARGETFS} ${WORKLABEL} -.if ${USE_MBR} != "no" - @echo creating MBR labels... - ${DD} if=/dev/zero of=${WORKMBR} seek=$$((${IMAGESECTORS} - 1)) count=1 - ${TOOL_FDISK} -f -i -u \ - -b ${MBRCYLINDERS}/${MBRHEADS}/${MBRSECTORS} \ - -0 -a -s ${MBRNETBSD}/${FSOFFSET}/${BSDPARTSECTORS} \ - -F ${WORKMBR} -.if empty(MBR_BOOTCODE) - @if [ -f ${WORKDIR}/usr/mdec/${MBR_DEFAULT_BOOTCODE} ]; then \ - echo ${TOOL_FDISK} -f \ - -i -c ${WORKDIR}/usr/mdec/${MBR_DEFAULT_BOOTCODE} \ - -F ${WORKMBR}; \ - ${TOOL_FDISK} -f \ - -i -c ${WORKDIR}/usr/mdec/${MBR_DEFAULT_BOOTCODE} \ - -F ${WORKMBR}; \ - fi -.else - @if [ ! -f ${WORKDIR}/usr/mdec/${MBR_BOOTCODE} ]; then \ - echo "${MBR_BOOTCODE} is not found in DESTDIR/usr/mdec, aborting"; \ - false; \ - fi - ${TOOL_FDISK} -f -i -c ${WORKDIR}/usr/mdec/${MBR_BOOTCODE} \ - -F ${WORKMBR} -.endif - ${DD} if=${WORKMBR} count=${LABELSECTORS} | \ - ${CAT} - ${TARGETFS} > ${WORKIMG} -.else # USE_MBR == "no" - ${INSTALL} ${COPY} -m 0644 ${TARGETFS} ${WORKIMG} -.endif # USE_MBR != "no" -.endif # USE_GPT != "no" -.if ${OMIT_SWAPIMG} == "no" - ${DD} if=/dev/zero of=${WORKSWAP} seek=$$((${SWAPSECTORS} - 1)) count=1 - ${CAT} ${WORKSWAP} >> ${WORKIMG} -.endif -.if ${USE_SUNLABEL} != "no" - @echo Creating sun disklabel... - printf 'V ncyl %d\nV nhead %d\nV nsect %d\na %d %d/0/0\nb %d %d/0/0\nW\n' \ - ${CYLINDERS} ${HEADS} ${SECTORS} \ - ${FSOFFSET} ${FSCYLINDERS} ${FSCYLINDERS} ${SWAPCYLINDERS} | \ - ${TOOL_SUNLABEL} -nq ${WORKIMG} -.endif -.if ${USE_GPT} == "no" - ${TOOL_DISKLABEL} -R -F ${WORKIMG} ${WORKLABEL} -.if !empty(PRIMARY_BOOT) && ${INSTALLBOOT_AFTER_DISKLABEL} != "no" - ${TOOL_INSTALLBOOT} -v -m ${MACHINE} ${INSTALLBOOTOPTIONS} ${WORKIMG} \ - ${WORKDIR}/usr/mdec/${PRIMARY_BOOT} -.endif -.endif - mv ${WORKIMG} ${.TARGET} - - -CLEANFILES+= ${IMGBASE}.img.gz ${IMGBASE}.img.gz.tmp - -${IMGBASE}.img.gz: ${IMGBASE}.img - ${TOOL_GZIP_N} -9c ${IMGBASE}.img > ${.TARGET}.tmp - mv ${.TARGET}.tmp ${.TARGET} - -clean: - @if [ -d ${WORKDIR}/var/spool/ftp/hidden ]; then \ - ${CHMOD} +r ${WORKDIR}/var/spool/ftp/hidden; \ - fi # XXX - ${RM} -fr ${WORKDIR} - ${RM} -fr ${EFIWORKDIR} - -prepare_md_post: .PHONY -image_md_post: .PHONY -image_md_pre: .PHONY - -.include <bsd.prog.mk> Index: src/distrib/amd64/uefi-installimage/Makefile.installimage diff -u src/distrib/amd64/uefi-installimage/Makefile.installimage:1.2 src/distrib/amd64/uefi-installimage/Makefile.installimage:1.2.18.1 --- src/distrib/amd64/uefi-installimage/Makefile.installimage:1.2 Fri Feb 10 16:43:59 2017 +++ src/distrib/amd64/uefi-installimage/Makefile.installimage Fri Apr 24 17:19:49 2020 @@ -1,70 +0,0 @@ -# $NetBSD: Makefile.installimage,v 1.2 2017/02/10 16:43:59 christos Exp $ -# -# Common Makefile to create a bootable installation image for USB flash etc. -# - -# -# Required variables: -# INSTIMGBASE -# Basename of the liveimage -# -# Optional variables: -# INSTIMAGEMB -# target image size in MB -# (if empty default IMAGEMB in Makefile.bootimage is used) -# -# See Makefile.bootimage for other variables. -# - -.if !target(check_INSTIMGBASE) -check_INSTIMGBASE: .PHONY .NOTMAIN -.if !defined(INSTIMGBASE) - @echo "Error: INSTIMGBASE is not set" - @false -.else - @true -.endif -.endif - -.if defined(INSTIMAGEMB) -IMAGEMB= ${INSTIMAGEMB} -.endif -SWAPMB= 0 # no swap -OMIT_SWAPIMG= yes # nothing to write - -KERN_SET?= kern-GENERIC -SETS?= modules base etc - -FSTAB_IN?= ${NETBSDSRCDIR}/distrib/common/bootimage/fstab.install.in - -.if ${USE_MBR} != "no" -DISKPROTO_IN?= ${NETBSDSRCDIR}/distrib/common/bootimage/diskproto.noswap.mbr.in -.else -DISKPROTO_IN?= ${NETBSDSRCDIR}/distrib/common/bootimage/diskproto.noswap.in -.endif - -# XXX: no permission info for makefs(8) -IMGDIR_EXTRA= ${RELEASEDIR}/${RELEASEMACHINEDIR} ${RELEASEMACHINEDIR} -IMGDIR_EXCLUDE= -s ',./installation/cdrom.*,,gp' -IMGDIR_EXCLUDE+= -s ',./installation/liveimage.*,,gp' -IMGDIR_EXCLUDE+= -s ',./installation/installimage.*,,gp' - -IMGBASE= ${INSTIMGBASE} - -.include "${.CURDIR}/Makefile.bootimage" - -# INSTIMG_RELEASEDIR specifies where to install ${INSTIMGBASE}.img.gz. -# This should be passed from etc/Makefile or etc/etc.${MACHINE}/Makefile.inc -# but also set default here for manual builds. -INSTIMG_RELEASEDIR?= ${RELEASEMACHINEDIR}/installation/installimage - -# should be defined elsewhere? -MKDIR?= mkdir -p - -install_image: check_INSTIMGBASE check_RELEASEDIR ${IMGBASE}.img.gz - ${MKDIR} ${MKDIRPERM} ${INSTIMG_RELEASEDIR} - ${RELEASE_INSTALL} ${IMGBASE}.img.gz ${INSTIMG_RELEASEDIR} - # note ${MAKESUM} will be calculated in src/etc/Makefile - -release: - Index: src/distrib/common/bootimage/Makefile.bootimage diff -u src/distrib/common/bootimage/Makefile.bootimage:1.21.2.1 src/distrib/common/bootimage/Makefile.bootimage:1.21.2.2 --- src/distrib/common/bootimage/Makefile.bootimage:1.21.2.1 Sun Nov 17 07:04:34 2019 +++ src/distrib/common/bootimage/Makefile.bootimage Fri Apr 24 17:19:49 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.bootimage,v 1.21.2.1 2019/11/17 07:04:34 martin Exp $ +# $NetBSD: Makefile.bootimage,v 1.21.2.2 2020/04/24 17:19:49 martin Exp $ # # Copyright (c) 2009, 2010, 2011 Izumi Tsutsui. All rights reserved. # @@ -37,6 +37,9 @@ # USE_MBR # set yes if target disk image requires MBR partition # (default: no) +# USE_GPT +# set yes if target disk image requires GPT partition +# (default: no) # MBR_BOOTCODE # optional MBR bootcode which should be installed by fdisk(8) # (default: empty) @@ -57,6 +60,12 @@ # SWAPMB # swap size in target image in MB # (default: 128) +# EFIMB +# EFI partition size in target image in MB +# (default: 128) +# FATMB +# FAT partition size in target image in MB +# (default: 0) # KERN_SET # kernel set name which should be extracted into image # (default: kern-GENERIC) @@ -114,9 +123,18 @@ # template file of disklabel -R # (default: ${DISTRIBDIR}/common/bootimage/diskproto.in # or ${DISTRIBDIR}/common/bootimage/diskproto.mbr.in) -# OMIT_SWAPIMG -# no need to put swap partition into image (for USB stick) -# (default: no) +# EFIBOOT +# EFI bootloader +# (default: empty) +# MBRFAT +# MBR partition type value for FAT +# (default: 6 ("16-bit FAT, more than 32M")) +# FATMAKEFSOPTIONS +# options passed to makefs(8) to create a FAT partition +# (default: -o fat_type=16) +# FATFILES +# list of additional files to be copied into FAT partition +# (default: empty) # .include <bsd.own.mk> # @@ -126,6 +144,7 @@ .if ${MKREPRO_TIMESTAMP:Uno} != "no" MAKEFS_TIMESTAMP=-T "${MKREPRO_TIMESTAMP}" +GPT_TIMESTAMP=-T "${MKREPRO_TIMESTAMP}" PAX_TIMESTAMP=--timestamp "${MKREPRO_TIMESTAMP}" .endif @@ -146,6 +165,7 @@ RM?= rm # common definitions for image # USE_MBR?= no +USE_GPT?= no USE_SUNLABEL?= no INSTALLBOOT_AFTER_DISKLABEL?= no @@ -154,12 +174,22 @@ INSTALLBOOT_AFTER_DISKLABEL?= no # IMAGEMB?= 2048 # 2048MB SWAPMB?= 128 # 128MB +.if ${USE_GPT} == "no" +EFIMB?= 0 +GPTSECTORS= 0 +.else +EFIMB?= 128 # 128MB +GPTSECTORS= 2048 +.endif +FATMB?= 0 # XXX: SWAPMB could be zero and expr(1) returns exit status 1 in that case IMAGESECTORS!= expr ${IMAGEMB} \* 1024 \* 1024 / 512 SWAPSECTORS!= expr ${SWAPMB} \* 1024 \* 1024 / 512 || true +EFISECTORS!= expr ${EFIMB} \* 1024 \* 1024 / 512 || true +FATSECTORS!= expr ${FATMB} \* 1024 \* 1024 / 512 || true -.if ${USE_MBR} == "no" +.if ${USE_MBR} == "no" && ${USE_GPT} == "no" LABELSECTORS?= 0 .else #LABELSECTORS?= 63 # historical @@ -167,7 +197,8 @@ LABELSECTORS?= 0 LABELSECTORS?= 2048 # 1MB aligned for modern flash devices .endif -FSSECTORS!= expr ${IMAGESECTORS} - ${SWAPSECTORS} - ${LABELSECTORS} +FSSECTORS!= expr ${IMAGESECTORS} - ${SWAPSECTORS} - ${LABELSECTORS} \ + - ${EFISECTORS} - ${GPTSECTORS} - ${FATSECTORS} FSSIZE!= expr ${FSSECTORS} \* 512 # parameters for disklabel and MBR @@ -179,15 +210,23 @@ MBRHEADS= 255 MBRSECTORS= 63 MBRCYLINDERS!= expr ${IMAGESECTORS} / \( ${MBRHEADS} \* ${MBRSECTORS} \) MBRNETBSD= 169 +MBRFAT?= 6 # 16-bit FAT, more than 32M -BSDPARTSECTORS!= expr ${IMAGESECTORS} - ${LABELSECTORS} -FSOFFSET= ${LABELSECTORS} -SWAPOFFSET!= expr ${LABELSECTORS} + ${FSSECTORS} +BSDPARTSECTORS!= expr ${IMAGESECTORS} - ${LABELSECTORS} \ + - ${EFISECTORS} - ${GPTSECTORS} - ${FATSECTORS} +FSOFFSET!= expr ${LABELSECTORS} + ${EFISECTORS} + ${FATSECTORS} +SWAPOFFSET!= expr ${LABELSECTORS} + ${FSSECTORS} \ + + ${EFISECTORS} + ${FATSECTORS} +FATOFFSET= ${LABELSECTORS} # parameters for sunlabel FSCYLINDERS!= expr ${FSSECTORS} / \( ${HEADS} \* ${SECTORS} \) SWAPCYLINDERS!= expr ${SWAPSECTORS} / \( ${HEADS} \* ${SECTORS} \) || true +.if ${USE_GPT} != "no" +BOOTDISK_UUID=`${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} show -i 2 | ${TOOL_AWK} '/^GUID/ {print $$2}'` +SWAPDISK_UUID=`${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} show -i 3 | ${TOOL_AWK} '/^GUID/ {print $$2}'` +.endif # # definitions to create root fs @@ -206,6 +245,7 @@ FSTAB_IN?= ${DISTRIBDIR}/common/bootimag SPEC_IN?= ${DISTRIBDIR}/common/bootimage/spec.in IMGMAKEFSOPTIONS?= -o bsize=16384,fsize=2048,density=8192 +FATMAKEFSOPTIONS?= -o fat_type=16 WORKDIR?= work WORKSPEC?= work.spec @@ -220,9 +260,67 @@ CLEANFILES+= ${WORKSPEC} ${WORKFSTAB} ${ CLEANFILES+= ${TARGETFS} # +# definitions to create image +# +.if ${SWAPSECTORS} == 0 +. if ${USE_MBR} != "no" +DISKPROTO_IN?= ${DISTRIBDIR}/common/bootimage/diskproto.noswap.mbr.in +. else +DISKPROTO_IN?= ${DISTRIBDIR}/common/bootimage/diskproto.noswap.in +. endif +.else +. if ${USE_MBR} != "no" +DISKPROTO_IN?= ${DISTRIBDIR}/common/bootimage/diskproto.mbr.in +. else +DISKPROTO_IN?= ${DISTRIBDIR}/common/bootimage/diskproto.in +. endif +.endif + +MBR_DEFAULT_BOOTCODE?= mbr + +WORKMBR?= work.mbr +WORKMBRTRUNC?= work.mbr.truncated +WORKSWAP?= work.swap +WORKEFI?= work.efi +WORKGPT?= work.gpt +WORKLABEL?= work.diskproto +WORKIMG?= work.img +EFIWORKDIR?= work.efidir +WORKFAT?= work.fat +WORKFATDIR?= work.fatdir + +.if ${USE_GPT} != "no" +${WORKFSTAB}: ${WORKMBR} +.endif + +${WORKFSTAB}: + @echo Preparing /etc/fstab ... +.if ${USE_GPT} != "no" +. if ${SWAPSECTORS} != 0 + ${TOOL_SED} \ + -e "s/ROOT.a/NAME=${BOOTDISK_UUID}/" \ + -e "s/ROOT.b/NAME=${SWAPDISK_UUID}/" \ + < ${FSTAB_IN} > ${WORKFSTAB} +. else + ${TOOL_SED} \ + -e "s/ROOT.a/NAME=${BOOTDISK_UUID}/" \ + -e "/ROOT.b/d" \ + < ${FSTAB_IN} > ${WORKFSTAB} +. endif +.else +. if ${SWAPSECTORS} != 0 + ${TOOL_SED} < ${FSTAB_IN} > ${WORKFSTAB} +. else + ${TOOL_SED} \ + -e "/ROOT.b/d" \ + < ${FSTAB_IN} > ${WORKFSTAB} +. endif +.endif + +# # create root file system for the image # -${TARGETFS}: prepare_md_post +${TARGETFS}: prepare_md_post ${WORKFSTAB} @if [ ! -d ${RELEASEDIR}/${RELEASEMACHINEDIR} ]; then \ echo "Missing ${RELEASEDIR}/${RELEASEMACHINEDIR}, aborting"; \ false; \ @@ -242,8 +340,6 @@ ${TARGETFS}: prepare_md_post @echo Copying secondary boot... ${INSTALL} ${COPY} -m 0444 ${WORKDIR}/usr/mdec/${SECONDARY_BOOT} ${WORKDIR} .endif - @echo Preparing /etc/fstab ... - ${TOOL_SED} < ${FSTAB_IN} > ${WORKFSTAB} ${INSTALL} ${COPY} -m 0644 ${WORKFSTAB} ${WORKDIR}/etc/fstab @echo Setting rc_configured=YES in /etc/rc.conf ... ${TOOL_SED} "s/rc_configured=NO/rc_configured=YES/" \ @@ -306,28 +402,40 @@ ${TARGETFS}: prepare_md_post @echo done. mv ${WORKFS} ${.TARGET} -# -# definitions to create image -# -.if ${USE_MBR} != "no" -DISKPROTO_IN?= ${DISTRIBDIR}/common/bootimage/diskproto.mbr.in -.else -DISKPROTO_IN?= ${DISTRIBDIR}/common/bootimage/diskproto.in +TARGET_BLOCKS= +.if ${USE_MBR} != "no" || ${USE_GPT} != "no" +TARGET_BLOCKS+= ${WORKMBRTRUNC} +.endif +.if ${USE_GPT} != "no" +TARGET_BLOCKS+= ${WORKEFI} +.endif +.if ${FATSECTORS} != 0 +TARGET_BLOCKS+= ${WORKFAT} +.endif +TARGET_BLOCKS+= ${TARGETFS} +.if ${SWAPSECTORS} != 0 +TARGET_BLOCKS+= ${WORKSWAP} +.endif +.if ${USE_GPT} != "no" +TARGET_BLOCKS+= ${WORKGPT} .endif -MBR_DEFAULT_BOOTCODE?= mbr - -OMIT_SWAPIMG?= no - -WORKMBR?= work.mbr -WORKSWAP?= work.swap -WORKLABEL?= work.diskproto -WORKIMG?= work.img - -CLEANFILES+= ${WORKMBR} ${WORKSWAP} +CLEANFILES+= ${WORKMBR} ${WORKMBRTRUNC} ${WORKSWAP} +CLEANFILES+= ${WORKEFI} ${WORKGPT} +CLEANFILES+= ${WORKFAT} CLEANFILES+= ${WORKLABEL}.tmp ${WORKLABEL} CLEANFILES+= ${WORKIMG} ${IMGBASE}.img +${WORKSWAP}: +.if ${SWAPSECTORS} == 0 + printf "" > ${WORKSWAP} +.else + ${DD} if=/dev/zero of=${WORKSWAP} seek=$$((${SWAPSECTORS} - 1)) count=1 +.endif + +${WORKMBRTRUNC}: ${WORKMBR} + ${DD} if=${WORKMBR} count=${LABELSECTORS} of=${WORKMBRTRUNC} + ${WORKLABEL}: ${TOOL_SED} \ -e "s/@@SECTORS@@/${SECTORS}/" \ @@ -340,18 +448,77 @@ ${WORKLABEL}: -e "s/@@SWAPSECTORS@@/${SWAPSECTORS}/" \ -e "s/@@SWAPOFFSET@@/${SWAPOFFSET}/" \ -e "s/@@BSDPARTSECTORS@@/${BSDPARTSECTORS}/" \ + -e "s/@@FATSECTORS@@/${FATSECTORS}/" \ + -e "s/@@FATOFFSET@@/${FATOFFSET}/" \ < ${DISKPROTO_IN} > ${WORKLABEL}.tmp mv ${WORKLABEL}.tmp ${WORKLABEL} -${IMGBASE}.img: ${TARGETFS} ${WORKLABEL} -.if ${USE_MBR} != "no" +${WORKEFI}: ${TARGETFS} + @echo create EFI system partition... + @${MKDIR} ${MKDIRPERM} ${EFIWORKDIR}/EFI/boot +.for f in ${EFIBOOT} + ${INSTALL} ${COPY} -m 0644 ${f} ${EFIWORKDIR}/EFI/boot/`basename ${f}` +.endfor + ${RM} -f ${WORKEFI} + ${TOOL_MAKEFS} -M ${EFIMB}m -m ${EFIMB}m \ + -B ${TARGET_ENDIANNESS} \ + ${MAKEFS_TIMESTAMP} \ + -t msdos -o F=32,c=1 \ + ${WORKEFI} ${EFIWORKDIR} + +${WORKFAT}: ${TARGETFS} ${FATFILES} + @echo create FAT partition for bootstrap files... + @${MKDIR} ${MKDIRPERM} ${WORKFATDIR} +.if defined(FATFILES) + @echo Copying files for FAT partition... +.for f in ${FATFILES} + @if [ ! -f ${f} ]; then \ + echo "${f} in FATFILES not found, aborting"; \ + false; \ + fi + ${INSTALL} ${COPY} -m 0644 ${f} ${WORKFATDIR} +.endfor +.endif + ${RM} -f ${WORKFAT} + ${TOOL_MAKEFS} -M ${FATMB}m -m ${FATMB}m \ + ${MAKEFS_TIMESTAMP} \ + -t msdos \ + ${FATMAKEFSOPTIONS} \ + ${WORKFAT} ${WORKFATDIR} + +${WORKMBR}: +.if ${USE_GPT} != "no" + @echo creating GPT header and partition entries... + ${RM} -f ${WORKMBR} + ${DD} if=/dev/zero of=${WORKMBR} seek=$$((${IMAGESECTORS} - 1)) count=1 + ${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} create + ${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} add -a 1m -s ${EFISECTORS} -t efi -l "EFI system" + ${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} add -a 1m -s ${FSSECTORS} -t ffs +. if ${SWAPSECTORS} != 0 + ${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKMBR} add -a 1m -s ${SWAPSECTORS} -t swap +. endif +.elif ${USE_MBR} != "no" @echo creating MBR labels... ${DD} if=/dev/zero of=${WORKMBR} seek=$$((${IMAGESECTORS} - 1)) count=1 +. if ${FATSECTORS} != 0 + # create BSD partition + ${TOOL_FDISK} -f -i -u \ + -b ${MBRCYLINDERS}/${MBRHEADS}/${MBRSECTORS} \ + -1 -a -s ${MBRNETBSD}/${FSOFFSET}/${BSDPARTSECTORS} \ + -F ${WORKMBR} + # create FAT partition + ${TOOL_FDISK} -f -u \ + -b ${MBRCYLINDERS}/${MBRHEADS}/${MBRSECTORS} \ + -0 -s ${MBRFAT}/${FATOFFSET}/${FATSECTORS} \ + -F ${WORKMBR} +. else + # create BSD partition ${TOOL_FDISK} -f -i -u \ -b ${MBRCYLINDERS}/${MBRHEADS}/${MBRSECTORS} \ -0 -a -s ${MBRNETBSD}/${FSOFFSET}/${BSDPARTSECTORS} \ -F ${WORKMBR} -.if empty(MBR_BOOTCODE) +. endif +. if empty(MBR_BOOTCODE) @if [ -f ${WORKDIR}/usr/mdec/${MBR_DEFAULT_BOOTCODE} ]; then \ echo ${TOOL_FDISK} -f \ -i -c ${WORKDIR}/usr/mdec/${MBR_DEFAULT_BOOTCODE} \ @@ -360,23 +527,32 @@ ${IMGBASE}.img: ${TARGETFS} ${WORKLABEL} -i -c ${WORKDIR}/usr/mdec/${MBR_DEFAULT_BOOTCODE} \ -F ${WORKMBR}; \ fi -.else +. else @if [ ! -f ${WORKDIR}/usr/mdec/${MBR_BOOTCODE} ]; then \ echo "${MBR_BOOTCODE} is not found in DESTDIR/usr/mdec, aborting"; \ false; \ fi ${TOOL_FDISK} -f -i -c ${WORKDIR}/usr/mdec/${MBR_BOOTCODE} \ -F ${WORKMBR} +. endif .endif - ${DD} if=${WORKMBR} count=${LABELSECTORS} | \ - ${CAT} - ${TARGETFS} > ${WORKIMG} -.else # USE_MBR == "no" - ${INSTALL} ${COPY} -m 0644 ${TARGETFS} ${WORKIMG} -.endif # USE_MBR != "no" -.if ${OMIT_SWAPIMG} == "no" - ${DD} if=/dev/zero of=${WORKSWAP} seek=$$((${SWAPSECTORS} - 1)) count=1 - ${CAT} ${WORKSWAP} >> ${WORKIMG} + +${WORKGPT}: ${WORKMBR} + @echo create GPT image... + ${DD} if=${WORKMBR} of=${WORKGPT} skip=$$((${IMAGESECTORS} - 2048)) \ + count=2048 + +.if ${USE_GPT} == "no" +${IMGBASE}.img: ${WORKLABEL} .endif + +${IMGBASE}.img: ${TARGET_BLOCKS} + ${CAT} ${TARGET_BLOCKS} > ${WORKIMG} +.if ${USE_GPT} != "no" + ${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKIMG} biosboot -i 2 \ + -c ${.OBJDIR}/${WORKDIR}/usr/mdec/gptmbr.bin + ${TOOL_GPT} ${GPT_TIMESSTAMP} ${WORKIMG} set -a bootme -i 2 +.endif # USE_GPT != "no" .if ${USE_SUNLABEL} != "no" @echo Creating sun disklabel... printf 'V ncyl %d\nV nhead %d\nV nsect %d\na %d %d/0/0\nb %d %d/0/0\nW\n' \ @@ -384,14 +560,15 @@ ${IMGBASE}.img: ${TARGETFS} ${WORKLABEL} ${FSOFFSET} ${FSCYLINDERS} ${FSCYLINDERS} ${SWAPCYLINDERS} | \ ${TOOL_SUNLABEL} -nq ${WORKIMG} .endif +.if ${USE_GPT} == "no" ${TOOL_DISKLABEL} -R -F ${WORKIMG} ${WORKLABEL} .if !empty(PRIMARY_BOOT) && ${INSTALLBOOT_AFTER_DISKLABEL} != "no" ${TOOL_INSTALLBOOT} -v -m ${MACHINE} ${INSTALLBOOTOPTIONS} ${WORKIMG} \ ${WORKDIR}/usr/mdec/${PRIMARY_BOOT} .endif +.endif mv ${WORKIMG} ${.TARGET} - CLEANFILES+= ${IMGBASE}.img.gz ${IMGBASE}.img.gz.tmp ${IMGBASE}.img.gz: ${IMGBASE}.img @@ -403,6 +580,8 @@ clean: ${CHMOD} +r ${WORKDIR}/var/spool/ftp/hidden; \ fi # XXX ${RM} -fr ${WORKDIR} + ${RM} -fr ${EFIWORKDIR} + ${RM} -fr ${WORKFATDIR} prepare_md_post: .PHONY image_md_post: .PHONY Index: src/distrib/common/bootimage/Makefile.installimage diff -u src/distrib/common/bootimage/Makefile.installimage:1.5 src/distrib/common/bootimage/Makefile.installimage:1.5.14.1 --- src/distrib/common/bootimage/Makefile.installimage:1.5 Fri Feb 10 16:43:59 2017 +++ src/distrib/common/bootimage/Makefile.installimage Fri Apr 24 17:19:49 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.installimage,v 1.5 2017/02/10 16:43:59 christos Exp $ +# $NetBSD: Makefile.installimage,v 1.5.14.1 2020/04/24 17:19:49 martin Exp $ # # Common Makefile to create a bootable installation image for USB flash etc. # @@ -30,7 +30,6 @@ check_INSTIMGBASE: .PHONY .NOTMAIN IMAGEMB= ${INSTIMAGEMB} .endif SWAPMB= 0 # no swap -OMIT_SWAPIMG= yes # nothing to write KERN_SET?= kern-GENERIC SETS?= modules base etc Index: src/distrib/hpcarm/Makefile diff -u src/distrib/hpcarm/Makefile:1.6 src/distrib/hpcarm/Makefile:1.6.64.1 --- src/distrib/hpcarm/Makefile:1.6 Fri Sep 19 17:38:43 2008 +++ src/distrib/hpcarm/Makefile Fri Apr 24 17:19:49 2020 @@ -1,12 +1,16 @@ -# $NetBSD: Makefile,v 1.6 2008/09/19 17:38:43 tsutsui Exp $ +# $NetBSD: Makefile,v 1.6.64.1 2020/04/24 17:19:49 martin Exp $ .include <bsd.own.mk> .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" SUBDIR= instkernel stand cdroms +SUBDIR+= liveimage TARGETS+= release iso_image: ${MAKEDIRTARGET} cdroms iso_image +live_image: + ${MAKEDIRTARGET} liveimage live_image + .include <bsd.subdir.mk> Index: src/distrib/zaurus/Makefile diff -u src/distrib/zaurus/Makefile:1.2 src/distrib/zaurus/Makefile:1.2.48.1 --- src/distrib/zaurus/Makefile:1.2 Sun May 29 17:19:31 2011 +++ src/distrib/zaurus/Makefile Fri Apr 24 17:19:50 2020 @@ -1,12 +1,16 @@ -# $NetBSD: Makefile,v 1.2 2011/05/29 17:19:31 tsutsui Exp $ +# $NetBSD: Makefile,v 1.2.48.1 2020/04/24 17:19:50 martin Exp $ .include <bsd.own.mk> .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" SUBDIR= ramdisk .WAIT instkernel cdroms +SUBDIR+= liveimage TARGETS+= release iso_image: ${MAKEDIRTARGET} cdroms iso_image +live_image: + ${MAKEDIRTARGET} liveimage live_image + .include <bsd.subdir.mk> Added files: Index: src/distrib/common/bootimage/diskproto.mbrfat.in diff -u /dev/null src/distrib/common/bootimage/diskproto.mbrfat.in:1.1.4.2 --- /dev/null Fri Apr 24 17:19:50 2020 +++ src/distrib/common/bootimage/diskproto.mbrfat.in Fri Apr 24 17:19:49 2020 @@ -0,0 +1,26 @@ +# $NetBSD: diskproto.mbrfat.in,v 1.1.4.2 2020/04/24 17:19:49 martin Exp $ +type: ESDI +disk: image +label: +flags: +bytes/sector: 512 +sectors/track: @@SECTORS@@ +tracks/cylinder: @@HEADS@@ +sectors/cylinder: @@SECPERCYLINDERS@@ +cylinders: @@CYLINDERS@@ +total sectors: @@IMAGESECTORS@@ +rpm: 3600 +interleave: 1 +trackskew: 0 +cylinderskew: 0 +headswitch: 0 # microseconds +track-to-track seek: 0 # microseconds +drivedata: 0 + +8 partitions: +# size offset fstype [fsize bsize cpg/sgs] +a: @@FSSECTORS@@ @@FSOFFSET@@ 4.2BSD 1024 8192 16 +b: @@SWAPSECTORS@@ @@SWAPOFFSET@@ swap +c: @@BSDPARTSECTORS@@ @@FSOFFSET@@ unused 0 0 +d: @@IMAGESECTORS@@ 0 unused 0 0 +e: @@FATSECTORS@@ @@FATOFFSET@@ MSDOS Index: src/distrib/hpcarm/liveimage/Makefile diff -u /dev/null src/distrib/hpcarm/liveimage/Makefile:1.1.4.2 --- /dev/null Fri Apr 24 17:19:50 2020 +++ src/distrib/hpcarm/liveimage/Makefile Fri Apr 24 17:19:49 2020 @@ -0,0 +1,39 @@ +# $NetBSD: Makefile,v 1.1.4.2 2020/04/24 17:19:49 martin Exp $ + +LIVEIMGBASE= NetBSD-${DISTRIBVER}-${MACHINE}-live # gives ${IMGBASE}.img + +.include <bsd.own.mk> + +LIVEIMAGEMB?= 1920 # for 2GB SD due to Windows Mobile restriction +SWAPMB?= 64 +FATMB?= 32 + +USE_MBR= yes +MBRFAT= 6 # 16-bit FAT, more than 32M + +# Omit comp etc. due to size restriction +KERN_SET= kern-WZERO3 +#SETS= base modules etc misc rescue text xbase xetc xfont xserver + +# prepare JORNADA720 kernel as an independent name +prepare_md_post: + echo Extracting kern-JORNADA720.${TAR_SUFF} ... + ${TOOL_PAX} ${PAX_TIMESTAMP} -rn \ + --use-compress-program=${COMPRESS_PROGRAM:Q} \ + -f ${SETS_DIR}/kern-JORNADA720.${TAR_SUFF} . + mv netbsd netbsd.JORNADA720 + +CLEANFILES+= netbsd.JORNADA720 + +IMGFILE_EXTRA= \ + ${.OBJDIR}/netbsd.JORNADA720 . + +DISKPROTO_IN= ${.CURDIR}/../../common/bootimage/diskproto.mbrfat.in +FSTAB_IN= ${.CURDIR}/fstab.in +SPEC_EXTRA= ${.CURDIR}/spec.in + +FATFILES= ${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/hpcboot.exe +FATFILES+= ${WORKDIR}/netbsd +FATFILES+= ${WORKDIR}/netbsd.JORNADA720 + +.include "${.CURDIR}/../../common/bootimage/Makefile.liveimage" Index: src/distrib/hpcarm/liveimage/fstab.in diff -u /dev/null src/distrib/hpcarm/liveimage/fstab.in:1.1.4.2 --- /dev/null Fri Apr 24 17:19:50 2020 +++ src/distrib/hpcarm/liveimage/fstab.in Fri Apr 24 17:19:49 2020 @@ -0,0 +1,7 @@ +ROOT.a / ffs rw 1 1 +ROOT.b none none sw 0 0 +ROOT.e /dos msdos rw 0 0 +ptyfs /dev/pts ptyfs rw 0 0 +kernfs /kern kernfs rw,noauto 0 0 +procfs /proc procfs rw,noauto 0 0 +tmpfs /var/shm tmpfs rw,-m1777,-sram%25 0 0 Index: src/distrib/hpcarm/liveimage/spec.in diff -u /dev/null src/distrib/hpcarm/liveimage/spec.in:1.1.4.2 --- /dev/null Fri Apr 24 17:19:50 2020 +++ src/distrib/hpcarm/liveimage/spec.in Fri Apr 24 17:19:49 2020 @@ -0,0 +1,3 @@ +# $NetBSD: spec.in,v 1.1.4.2 2020/04/24 17:19:49 martin Exp $ +./netbsd.JORNADA720 type=file mode=0755 uname=root gname=wheel +./dos type=dir mode=0755 uname=root gname=wheel Index: src/distrib/zaurus/liveimage/Makefile diff -u /dev/null src/distrib/zaurus/liveimage/Makefile:1.1.4.2 --- /dev/null Fri Apr 24 17:19:50 2020 +++ src/distrib/zaurus/liveimage/Makefile Fri Apr 24 17:19:49 2020 @@ -0,0 +1,39 @@ +# $NetBSD: Makefile,v 1.1.4.2 2020/04/24 17:19:49 martin Exp $ + +LIVEIMGBASE= NetBSD-${DISTRIBVER}-zaurus-live # gives ${IMGBASE}.img + +.include <bsd.own.mk> + +LIVEIMAGEMB?= 900 # for "1GB" SD due to Zaurus Linux restriction +SWAPMB?= 64 +FATMB?= 32 + +USE_MBR= yes +MBRFAT= 6 # 16-bit FAT, more than 32M + +# Omit comp etc. due to size restriction +KERN_SET= kern-GENERIC +SETS= base modules etc misc rescue text xbase xetc xfont xserver + +# prepare SL-C700 kernel as an independent name +prepare_md_post: + echo Extracting kern-C700.${TAR_SUFF} ... + ${TOOL_PAX} ${PAX_TIMESTAMP} -rn \ + --use-compress-program=${COMPRESS_PROGRAM:Q} \ + -f ${SETS_DIR}/kern-C700.${TAR_SUFF} . + mv netbsd netbsd.c700 + +CLEANFILES+= netbsd.c700 + +IMGFILE_EXTRA= \ + ${.OBJDIR}/netbsd.c700 . + +DISKPROTO_IN= ${.CURDIR}/../../common/bootimage/diskproto.mbrfat.in +FSTAB_IN= ${.CURDIR}/fstab.in +SPEC_EXTRA= ${.CURDIR}/spec.in + +FATFILES= ${WORKDIR}/usr/mdec/zbsdmod.o ${WORKDIR}/usr/mdec/zboot +FATFILES+= ${WORKDIR}/netbsd +FATFILES+= ${WORKDIR}/netbsd.c700 + +.include "${.CURDIR}/../../common/bootimage/Makefile.liveimage" Index: src/distrib/zaurus/liveimage/fstab.in diff -u /dev/null src/distrib/zaurus/liveimage/fstab.in:1.1.4.2 --- /dev/null Fri Apr 24 17:19:50 2020 +++ src/distrib/zaurus/liveimage/fstab.in Fri Apr 24 17:19:49 2020 @@ -0,0 +1,7 @@ +ROOT.a / ffs rw 1 1 +ROOT.b none none sw 0 0 +ROOT.e /dos msdos rw 0 0 +ptyfs /dev/pts ptyfs rw 0 0 +kernfs /kern kernfs rw,noauto 0 0 +procfs /proc procfs rw,noauto 0 0 +tmpfs /var/shm tmpfs rw,-m1777,-sram%25 0 0 Index: src/distrib/zaurus/liveimage/spec.in diff -u /dev/null src/distrib/zaurus/liveimage/spec.in:1.1.4.2 --- /dev/null Fri Apr 24 17:19:50 2020 +++ src/distrib/zaurus/liveimage/spec.in Fri Apr 24 17:19:49 2020 @@ -0,0 +1,3 @@ +# $NetBSD: spec.in,v 1.1.4.2 2020/04/24 17:19:49 martin Exp $ +./netbsd.c700 type=file mode=0755 uname=root gname=wheel +./dos type=dir mode=0755 uname=root gname=wheel