Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/distrib/amd64 make amd64 EFI install image
details: https://anonhg.NetBSD.org/src/rev/14079d2886f4
branches: trunk
changeset: 350839:14079d2886f4
user: nonaka <nonaka%NetBSD.org@localhost>
date: Tue Jan 24 11:16:50 2017 +0000
description:
make amd64 EFI install image
XXX merge to installimage?
diffstat:
distrib/amd64/Makefile | 4 +-
distrib/amd64/uefi-installimage/Makefile | 44 +
distrib/amd64/uefi-installimage/Makefile.bootimage | 499 ++++++++++++++++++
distrib/amd64/uefi-installimage/Makefile.installimage | 70 ++
distrib/amd64/uefi-installimage/boot.cfg.in | 12 +
distrib/amd64/uefi-installimage/etc.rc | 52 +
distrib/amd64/uefi-installimage/etc.ttys | 7 +
distrib/amd64/uefi-installimage/install.sh | 115 ++++
distrib/amd64/uefi-installimage/spec.inst | 15 +
9 files changed, 817 insertions(+), 1 deletions(-)
diffs (truncated from 870 to 300 lines):
diff -r 29fa4466fda7 -r 14079d2886f4 distrib/amd64/Makefile
--- a/distrib/amd64/Makefile Tue Jan 24 11:09:14 2017 +0000
+++ b/distrib/amd64/Makefile Tue Jan 24 11:16:50 2017 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.11 2016/06/30 12:56:27 pgoyette Exp $
+# $NetBSD: Makefile,v 1.12 2017/01/24 11:16:50 nonaka Exp $
.include <bsd.own.mk>
@@ -16,6 +16,7 @@
SUBDIR+= cdroms
SUBDIR+= liveimage
SUBDIR+= installimage
+SUBDIR+= uefi-installimage
TARGETS+= release
iso_image:
@@ -26,5 +27,6 @@
install_image:
${MAKEDIRTARGET} installimage install_image
+ ${MAKEDIRTARGET} uefi-installimage install_image
.include <bsd.subdir.mk>
diff -r 29fa4466fda7 -r 14079d2886f4 distrib/amd64/uefi-installimage/Makefile
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/amd64/uefi-installimage/Makefile Tue Jan 24 11:16:50 2017 +0000
@@ -0,0 +1,44 @@
+# $NetBSD: Makefile,v 1.1 2017/01/24 11:16:50 nonaka Exp $
+
+.include <bsd.own.mk>
+
+INSTIMGBASE= NetBSD-${DISTRIBVER}-amd64-uefi-install # gives ${IMGBASE}.img
+
+BOOTDISK= dk1 # unused (use GUID)
+INSTIMAGEMB?= 1280 # for all installation binaries
+
+PRIMARY_BOOT= bootxx_ffsv1
+SECONDARY_BOOT= boot
+SECONDARY_BOOT_ARG= # unnecessary
+EFIBOOT= ${WORKDIR}/usr/mdec/bootx64.efi
+EFIBOOT+= ${WORKDIR}/usr/mdec/bootia32.efi
+#EFIBOOT= ${.OBJDIR}/../../../sys/arch/i386/stand/efiboot/bootx64/bootx64.efi
+#EFIBOOT+= ${.OBJDIR}/../../../sys/arch/i386/stand/efiboot/bootia32/bootia32.efi
+
+USE_MBR= yes
+USE_GPT= yes
+
+CLEANFILES+= boot.cfg
+
+prepare_md_post:
+ ${TOOL_SED} \
+ -e "s/@@MACHINE@@/${MACHINE}/" \
+ -e "s/@@VERSION@@/${DISTRIBVER}/" \
+ < ${.CURDIR}/boot.cfg.in > boot.cfg
+
+DISTRIBDIR!= cd ${.CURDIR}/../.. ; pwd
+SYSINSTDIR!= cd ${.CURDIR}/../../../usr.sbin/sysinst/arch/${MACHINE} && ${PRINTOBJDIR}
+
+SPEC_EXTRA= ${.CURDIR}/spec.inst
+IMGFILE_EXTRA= \
+ ${.CURDIR}/etc.ttys etc/ttys \
+ ${.CURDIR}/etc.rc etc/rc \
+ ${.CURDIR}/install.sh . \
+ ${.OBJDIR}/boot.cfg . \
+ ${SYSINSTDIR}/sysinstmsgs.de . \
+ ${SYSINSTDIR}/sysinstmsgs.es . \
+ ${SYSINSTDIR}/sysinstmsgs.fr . \
+ ${SYSINSTDIR}/sysinstmsgs.pl . \
+ ${SYSINSTDIR}/sysinst .
+
+.include "${.CURDIR}/Makefile.installimage"
diff -r 29fa4466fda7 -r 14079d2886f4 distrib/amd64/uefi-installimage/Makefile.bootimage
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/amd64/uefi-installimage/Makefile.bootimage Tue Jan 24 11:16:50 2017 +0000
@@ -0,0 +1,499 @@
+# $NetBSD: Makefile.bootimage,v 1.1 2017/01/24 11:16:50 nonaka 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:
+# BOOTDISK
+# device name of target bootable disk specified in /etc/fstab
+# (default: sd0)
+# 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 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:Uno} == "yes"
+TIMESTAMP=-T ${NETBSDSRCDIR}/sys/sys/param.h
+.endif
+
+.if empty(IMGBASE)
+.BEGIN:
+ @echo "Error: IMGBASE is not set"
+ @false
+.endif
+
+# should be defined elsewhere?
+CAT?= cat
+CHMOD?= chmod
+CP?= cp
+DD?= dd
+MKDIR?= mkdir -p
+RM?= rm
+
+#
+# common definitions for image
+#
+BOOTDISK?= sd0
+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} ${WORKMBR} show -i 2 | awk '/^GUID/ {print $$2}'`
+SWAPDISK_UUID=`${TOOL_GPT} ${WORKMBR} show -i 3 | awk '/^GUID/ {print $$2}'`
+.endif
+
+#
+# definitions to create root fs
+#
+SETS_DEFAULT= modules base etc comp games man misc tests text
Home |
Main Index |
Thread Index |
Old Index