Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Add "live-image" and "install-image" target support to build...



details:   https://anonhg.NetBSD.org/src/rev/66a4e21a6a4f
branches:  trunk
changeset: 772941:66a4e21a6a4f
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sun Jan 22 03:53:29 2012 +0000

description:
Add "live-image" and "install-image" target support to build.sh.

"live-image" target builds pre-installed disk images that can be used on
emulators or boot from USB memory sticks to try NetBSD without installation.
Currently amd64, i386, pmax, sparc, sparc64, sun2, sun3, and vax
(which have working emulators and don't require extra tools like preparing
 msdosfs or partitioning MD label structures) support this target.

"install-image" target builds an bootable installation disk image that can
be used as an install CD but burned into USB memory sticks etc.
Current only amd64 and i386 (which would support USB boot) have this target.

For more details (and known issue) see following posts on netbsd-bugs@:
http://mail-index.NetBSD.org/netbsd-bugs/2011/08/06/msg023639.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/09/23/msg024207.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/07/msg025166.html
http://mail-index.NetBSD.org/netbsd-bugs/2011/12/08/msg025178.html

No particular comments about implementation, and
"go ahead" comments from mrg@, riz@ and christos@.

Closes PR toolchain/45153 and PR misc/45155.

diffstat:

 BUILDING                                         |   39 ++
 Makefile                                         |   30 +-
 build.sh                                         |   27 +-
 distrib/Makefile                                 |    4 +-
 distrib/Makefile.inc                             |    4 +-
 distrib/amd64/Makefile                           |   10 +-
 distrib/amd64/installimage/Makefile              |   41 ++
 distrib/amd64/installimage/boot.cfg.in           |   12 +
 distrib/amd64/installimage/etc.rc                |   52 +++
 distrib/amd64/installimage/etc.ttys              |    7 +
 distrib/amd64/installimage/install.sh            |  115 ++++++
 distrib/amd64/installimage/spec.inst             |   18 +
 distrib/amd64/liveimage/Makefile                 |    9 +
 distrib/amd64/liveimage/Makefile.liveimage       |   13 +
 distrib/amd64/liveimage/emuimage/Makefile        |    7 +
 distrib/amd64/liveimage/usbimage/Makefile        |    9 +
 distrib/common/Makefile.bootcd                   |    8 +-
 distrib/common/bootimage/Makefile.bootimage      |  383 +++++++++++++++++++++++
 distrib/common/bootimage/Makefile.installimage   |   63 +++
 distrib/common/bootimage/Makefile.liveimage      |   43 ++
 distrib/common/bootimage/diskproto.in            |   24 +
 distrib/common/bootimage/diskproto.mbr.in        |   25 +
 distrib/common/bootimage/diskproto.noswap.in     |   23 +
 distrib/common/bootimage/diskproto.noswap.mbr.in |   24 +
 distrib/common/bootimage/fstab.in                |    5 +
 distrib/common/bootimage/fstab.install.in        |    2 +
 distrib/common/bootimage/spec.in                 |    5 +
 distrib/i386/Makefile                            |   10 +-
 distrib/i386/installimage/Makefile               |   41 ++
 distrib/i386/installimage/boot.cfg.in            |   12 +
 distrib/i386/installimage/etc.rc                 |   52 +++
 distrib/i386/installimage/etc.ttys               |    7 +
 distrib/i386/installimage/install.sh             |  115 ++++++
 distrib/i386/installimage/spec.inst              |   18 +
 distrib/i386/liveimage/Makefile                  |    9 +
 distrib/i386/liveimage/Makefile.liveimage        |   13 +
 distrib/i386/liveimage/emuimage/Makefile         |    7 +
 distrib/i386/liveimage/usbimage/Makefile         |    9 +
 distrib/pmax/Makefile                            |    7 +-
 distrib/pmax/liveimage/Makefile                  |    8 +
 distrib/pmax/liveimage/emuimage/Makefile         |   12 +
 distrib/sparc/Makefile                           |    7 +-
 distrib/sparc/liveimage/Makefile                 |    8 +
 distrib/sparc/liveimage/emuimage/Makefile        |   15 +
 distrib/sparc64/Makefile                         |    7 +-
 distrib/sparc64/liveimage/Makefile               |    8 +
 distrib/sparc64/liveimage/emuimage/Makefile      |   16 +
 distrib/sun2/Makefile                            |    7 +-
 distrib/sun2/liveimage/Makefile                  |    8 +
 distrib/sun2/liveimage/emuimage/Makefile         |   15 +
 distrib/sun3/Makefile                            |    7 +-
 distrib/sun3/liveimage/Makefile                  |    8 +
 distrib/sun3/liveimage/emuimage/Makefile         |   15 +
 distrib/vax/Makefile                             |    7 +-
 distrib/vax/liveimage/Makefile                   |    8 +
 distrib/vax/liveimage/emuimage/Makefile          |   13 +
 etc/Makefile                                     |   29 +-
 57 files changed, 1479 insertions(+), 21 deletions(-)

diffs (truncated from 1900 to 300 lines):

diff -r 2b9d282219ba -r 66a4e21a6a4f BUILDING
--- a/BUILDING  Sun Jan 22 03:48:51 2012 +0000
+++ b/BUILDING  Sun Jan 22 03:53:29 2012 +0000
@@ -627,6 +627,41 @@
                    ity, which is not part of NetBSD, but which can be
                    installed from pkgsrc/sysutils/cdrtools.
 
+     install-image Create a bootable NetBSD installation disk image in the
+                   RELEASEDIR/RELEASEMACHINEDIR/installation/installimage
+                   directory.  The bootable installation disk image is
+                   suitable to USB flash memory sticks etc. for machines which
+                   may support boot from such USB devices.  File system in the
+                   bootable disk image will have a layout as described in
+                   release(7).
+
+                   The installation image is bootable, and will automatically
+                   run the sysinst(8) menu-based installation program, which
+                   can be used to install or upgrade a NetBSD system.
+                   Bootable installation images also contain tools that may be
+                   useful in repairing a damaged NetBSD installation.
+
+                   Before ``make install-image'' is attempted, RELEASEDIR must
+                   be populated by ``make release'' or equivalent and
+                   RELEASEDIR binaries must be built with ``MKUNPRIVED=yes''
+                   to refer permission information from specfiles.
+
+     live-image    Create NetBSD live images in the
+                   RELEASEDIR/RELEASEMACHINEDIR/installation/liveimage
+                   directory.  The live image contains all necessary files
+                   to boot NetBSD upto multi user mode, including all files
+                   which should be extracted during installation, NetBSD
+                   disklabel, and bootloaders etc.
+
+                   The live image is suitable for misc emulators like QEMU,
+                   and also usuful to try NetBSD on real machines with USB
+                   flash memory sticks without installation.
+
+                   Before ``make live-image'' is attempted, RELEASEDIR must be
+                   populated by ``make release'' or equivalent and RELEASEDIR
+                   binaries must be built with ``MKUNPRIVED=yes'' to refer
+                   permission information from specfiles.
+
      regression-tests
                    Can only be run after building the regression tests in the
                    directory ``regress''.  Runs those compiled regression
@@ -738,6 +773,10 @@
      iso-image-source
                    Perform ``make iso-image-source''.
 
+     install-image Perform ``make install-image''.
+
+     live-image    Perform ``make live-image''.
+
      The following command line options alter the behaviour of the build.sh
      operations described above:
 
diff -r 2b9d282219ba -r 66a4e21a6a4f Makefile
--- a/Makefile  Sun Jan 22 03:48:51 2012 +0000
+++ b/Makefile  Sun Jan 22 03:53:29 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.289 2011/09/09 14:23:37 apb Exp $
+#      $NetBSD: Makefile,v 1.290 2012/01/22 03:53:32 tsutsui Exp $
 
 #
 # This is the top-level makefile for building NetBSD. For an outline of
@@ -71,6 +71,16 @@
 #      Create CD-ROM image with source in RELEASEDIR/iso.
 #      RELEASEDIR must already have been populated by
 #      `make release sourcesets' or equivalent.
+#   live-image:
+#      Create bootable live image for emulators or USB stick etc.
+#      in RELEASEDIR/liveimage.
+#      RELEASEDIR must already have been populated by `make release'
+#      or equivalent.
+#   install-image:
+#      Create bootable installation image for USB stick etc.
+#      in RELEASEDIR/installimage.
+#      RELEASEDIR must already have been populated by `make release'
+#      or equivalent.
 #
 # Targets invoked by `make build,' in order:
 #   cleandir:        cleans the tree.
@@ -402,6 +412,24 @@
        @printf "make ${.TARGET} finished at: " && date
 
 #
+# Create bootable live images.
+#
+
+live-image: .PHONY
+       ${MAKEDIRTARGET} etc live-image
+       @echo   "make ${.TARGET} started at:  ${START_TIME}"
+       @printf "make ${.TARGET} finished at: " && date
+
+#
+# Create bootable installation images.
+#
+
+install-image: .PHONY
+       ${MAKEDIRTARGET} etc install-image
+       @echo   "make ${.TARGET} started at:  ${START_TIME}"
+       @printf "make ${.TARGET} finished at: " && date
+
+#
 # Special components of the "make build" process.
 #
 
diff -r 2b9d282219ba -r 66a4e21a6a4f build.sh
--- a/build.sh  Sun Jan 22 03:48:51 2012 +0000
+++ b/build.sh  Sun Jan 22 03:53:29 2012 +0000
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#      $NetBSD: build.sh,v 1.252 2011/12/05 23:04:39 jym Exp $
+#      $NetBSD: build.sh,v 1.253 2012/01/22 03:53:32 tsutsui Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -864,6 +864,10 @@
                         RELEASEDIR/RELEASEMACHINEDIR/binary/syspkgs.
     iso-image           Create CD-ROM image in RELEASEDIR/iso.
     iso-image-source    Create CD-ROM image with source in RELEASEDIR/iso.
+    live-image          Create bootable live image in
+                        RELEASEDIR/RELEASEMACHINEDIR/installation/liveimage.
+    install-image       Create bootable installation image in
+                        RELEASEDIR/RELEASEMACHINEDIR/installation/installimage.
     params              Display various make(1) parameters.
 
  Options:
@@ -1135,6 +1139,14 @@
                        op=iso_image_source   # used as part of a variable name
                        ;;
 
+               live-image)
+                       op=live_image   # used as part of a variable name
+                       ;;
+
+               install-image)
+                       op=install_image # used as part of a variable name
+                       ;;
+
                kernel=*|releasekernel=*)
                        arg=${op#*=}
                        op=${op%%=*}
@@ -1632,7 +1644,7 @@
        eval cat <<EOF ${makewrapout}
 #! ${HOST_SH}
 # Set proper variables to allow easy "make" building of a NetBSD subtree.
-# Generated from:  \$NetBSD: build.sh,v 1.252 2011/12/05 23:04:39 jym Exp $
+# Generated from:  \$NetBSD: build.sh,v 1.253 2012/01/22 03:53:32 tsutsui Exp $
 # with these arguments: ${_args}
 #
 
@@ -1960,6 +1972,17 @@
                        statusmsg "Successful make ${op}"
                        ;;
 
+               live-image)
+                       ${runcmd} "${makewrapper}" ${parallel} ${op} ||
+                           bomb "Failed to make ${op}"
+                       statusmsg "Successful make ${op}"
+                       ;;
+
+               install-image)
+                       ${runcmd} "${makewrapper}" ${parallel} ${op} ||
+                           bomb "Failed to make ${op}"
+                       statusmsg "Successful make ${op}"
+                       ;;
                kernel=*)
                        arg=${op#*=}
                        buildkernel "${arg}"
diff -r 2b9d282219ba -r 66a4e21a6a4f distrib/Makefile
--- a/distrib/Makefile  Sun Jan 22 03:48:51 2012 +0000
+++ b/distrib/Makefile  Sun Jan 22 03:53:29 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.17 2012/01/04 03:43:34 riz Exp $
+#      $NetBSD: Makefile,v 1.18 2012/01/22 03:53:32 tsutsui Exp $
 
 .include <bsd.own.mk>
 
@@ -18,5 +18,7 @@
 
 TARGETS+=release
 TARGETS+=iso_image
+TARGETS+=live_image
+TARGETS+=install_image
 
 .include <bsd.subdir.mk>
diff -r 2b9d282219ba -r 66a4e21a6a4f distrib/Makefile.inc
--- a/distrib/Makefile.inc      Sun Jan 22 03:48:51 2012 +0000
+++ b/distrib/Makefile.inc      Sun Jan 22 03:53:29 2012 +0000
@@ -1,5 +1,7 @@
-#      $NetBSD: Makefile.inc,v 1.9 2007/03/06 21:56:47 bouyer Exp $
+#      $NetBSD: Makefile.inc,v 1.10 2012/01/22 03:53:32 tsutsui Exp $
 
 .include "../Makefile.inc"
 
 iso_image: .PHONY
+live_image: .PHONY
+install_image: .PHONY
diff -r 2b9d282219ba -r 66a4e21a6a4f distrib/amd64/Makefile
--- a/distrib/amd64/Makefile    Sun Jan 22 03:48:51 2012 +0000
+++ b/distrib/amd64/Makefile    Sun Jan 22 03:53:29 2012 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.5 2011/01/18 00:22:56 jym Exp $
+#      $NetBSD: Makefile,v 1.6 2012/01/22 03:53:32 tsutsui Exp $
 
 SUBDIR=
 SUBDIR+=       ramdisks
@@ -8,9 +8,17 @@
 SUBDIR+=       .WAIT
 SUBDIR+=       cdroms
 SUBDIR+=       floppies
+SUBDIR+=       liveimage
+SUBDIR+=       installimage
 TARGETS+=      release 
 
 iso_image:
        ${MAKEDIRTARGET} cdroms iso_image
 
+live_image:
+       ${MAKEDIRTARGET} liveimage live_image
+
+install_image:
+       ${MAKEDIRTARGET} installimage install_image
+
 .include <bsd.subdir.mk>
diff -r 2b9d282219ba -r 66a4e21a6a4f distrib/amd64/installimage/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/amd64/installimage/Makefile       Sun Jan 22 03:53:29 2012 +0000
@@ -0,0 +1,41 @@
+#      $NetBSD: Makefile,v 1.1 2012/01/22 03:53:29 tsutsui Exp $
+
+.include <bsd.own.mk>
+
+INSTIMGBASE=   amd64inst               # gives ${IMGBASE}.img
+
+BOOTDISK=      sd0                     # for USB flash etc.
+IMAGEMB=       550                     # for all installation binaries
+
+PRIMARY_BOOT=          bootxx_ffsv1
+SECONDARY_BOOT=                boot
+SECONDARY_BOOT_ARG=    # unnecessary
+
+USE_MBR=               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 ${DISTRIBDIR}/utils/sysinst/arch/${MACHINE} && ${PRINTOBJDIR}
+
+SPEC_EXTRA=            ${.CURDIR}/spec.inst
+IMGFILE_EXTRA=                                                         \
+       ${DISTRIBDIR}/common/10-resolv.conf     libexec/dhcpcd-hooks    \
+       ${DISTRIBDIR}/common/99-print-sysinst   libexec/dhcpcd-hooks    \
+       ${.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 "${DISTRIBDIR}/common/bootimage/Makefile.installimage"
diff -r 2b9d282219ba -r 66a4e21a6a4f distrib/amd64/installimage/boot.cfg.in
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/amd64/installimage/boot.cfg.in    Sun Jan 22 03:53:29 2012 +0000
@@ -0,0 +1,12 @@
+banner=Welcome to the NetBSD/@@MACHINE@@ @@VERSION@@ installation image
+banner================================================================================
+banner=
+banner=ACPI (Advanced Configuration and Power Interface) should work on all modern
+banner=and legacy hardware.  However if you do encounter a problem while booting,
+banner=try disabling it and report a bug at http://www.NetBSD.org/.
+menu=Install NetBSD:boot netbsd
+menu=Install NetBSD (no ACPI):boot netbsd -2
+menu=Install NetBSD (no ACPI, no SMP):boot netbsd -12
+menu=Drop to boot prompt:prompt
+timeout=30
+clear=1
diff -r 2b9d282219ba -r 66a4e21a6a4f distrib/amd64/installimage/etc.rc
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/distrib/amd64/installimage/etc.rc Sun Jan 22 03:53:29 2012 +0000
@@ -0,0 +1,52 @@
+# $NetBSD: etc.rc,v 1.1 2012/01/22 03:53:29 tsutsui Exp $
+#
+# Copyright (c) 1997 Perry E. Metzger
+# Copyright (c) 1994 Christopher G. Demetriou
+# All rights reserved.
+# 
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:



Home | Main Index | Thread Index | Old Index