History log of /freebsd-11-stable/release/scripts/mk-vmimage.sh
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 302408 07-Jul-2016 gjb

Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle.
Prune svn:mergeinfo from the new branch, as nothing has been merged
here.

Additional commits post-branch will follow.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


/freebsd-11-stable/MAINTAINERS
/freebsd-11-stable/cddl
/freebsd-11-stable/cddl/contrib/opensolaris
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print
/freebsd-11-stable/cddl/contrib/opensolaris/cmd/zfs
/freebsd-11-stable/cddl/contrib/opensolaris/lib/libzfs
/freebsd-11-stable/contrib/amd
/freebsd-11-stable/contrib/apr
/freebsd-11-stable/contrib/apr-util
/freebsd-11-stable/contrib/atf
/freebsd-11-stable/contrib/binutils
/freebsd-11-stable/contrib/bmake
/freebsd-11-stable/contrib/byacc
/freebsd-11-stable/contrib/bzip2
/freebsd-11-stable/contrib/com_err
/freebsd-11-stable/contrib/compiler-rt
/freebsd-11-stable/contrib/dialog
/freebsd-11-stable/contrib/dma
/freebsd-11-stable/contrib/dtc
/freebsd-11-stable/contrib/ee
/freebsd-11-stable/contrib/elftoolchain
/freebsd-11-stable/contrib/elftoolchain/ar
/freebsd-11-stable/contrib/elftoolchain/brandelf
/freebsd-11-stable/contrib/elftoolchain/elfdump
/freebsd-11-stable/contrib/expat
/freebsd-11-stable/contrib/file
/freebsd-11-stable/contrib/gcc
/freebsd-11-stable/contrib/gcclibs/libgomp
/freebsd-11-stable/contrib/gdb
/freebsd-11-stable/contrib/gdtoa
/freebsd-11-stable/contrib/groff
/freebsd-11-stable/contrib/ipfilter
/freebsd-11-stable/contrib/ldns
/freebsd-11-stable/contrib/ldns-host
/freebsd-11-stable/contrib/less
/freebsd-11-stable/contrib/libarchive
/freebsd-11-stable/contrib/libarchive/cpio
/freebsd-11-stable/contrib/libarchive/libarchive
/freebsd-11-stable/contrib/libarchive/libarchive_fe
/freebsd-11-stable/contrib/libarchive/tar
/freebsd-11-stable/contrib/libc++
/freebsd-11-stable/contrib/libc-vis
/freebsd-11-stable/contrib/libcxxrt
/freebsd-11-stable/contrib/libexecinfo
/freebsd-11-stable/contrib/libpcap
/freebsd-11-stable/contrib/libstdc++
/freebsd-11-stable/contrib/libucl
/freebsd-11-stable/contrib/libxo
/freebsd-11-stable/contrib/llvm
/freebsd-11-stable/contrib/llvm/projects/libunwind
/freebsd-11-stable/contrib/llvm/tools/clang
/freebsd-11-stable/contrib/llvm/tools/lldb
/freebsd-11-stable/contrib/llvm/tools/llvm-dwarfdump
/freebsd-11-stable/contrib/llvm/tools/llvm-lto
/freebsd-11-stable/contrib/mdocml
/freebsd-11-stable/contrib/mtree
/freebsd-11-stable/contrib/ncurses
/freebsd-11-stable/contrib/netcat
/freebsd-11-stable/contrib/ntp
/freebsd-11-stable/contrib/nvi
/freebsd-11-stable/contrib/one-true-awk
/freebsd-11-stable/contrib/openbsm
/freebsd-11-stable/contrib/openpam
/freebsd-11-stable/contrib/openresolv
/freebsd-11-stable/contrib/pf
/freebsd-11-stable/contrib/sendmail
/freebsd-11-stable/contrib/serf
/freebsd-11-stable/contrib/sqlite3
/freebsd-11-stable/contrib/subversion
/freebsd-11-stable/contrib/tcpdump
/freebsd-11-stable/contrib/tcsh
/freebsd-11-stable/contrib/tnftp
/freebsd-11-stable/contrib/top
/freebsd-11-stable/contrib/top/install-sh
/freebsd-11-stable/contrib/tzcode/stdtime
/freebsd-11-stable/contrib/tzcode/zic
/freebsd-11-stable/contrib/tzdata
/freebsd-11-stable/contrib/unbound
/freebsd-11-stable/contrib/vis
/freebsd-11-stable/contrib/wpa
/freebsd-11-stable/contrib/xz
/freebsd-11-stable/crypto/heimdal
/freebsd-11-stable/crypto/openssh
/freebsd-11-stable/crypto/openssl
/freebsd-11-stable/gnu/lib
/freebsd-11-stable/gnu/usr.bin/binutils
/freebsd-11-stable/gnu/usr.bin/cc/cc_tools
/freebsd-11-stable/gnu/usr.bin/gdb
/freebsd-11-stable/lib/libc/locale/ascii.c
/freebsd-11-stable/sys/cddl/contrib/opensolaris
/freebsd-11-stable/sys/contrib/dev/acpica
/freebsd-11-stable/sys/contrib/ipfilter
/freebsd-11-stable/sys/contrib/libfdt
/freebsd-11-stable/sys/contrib/octeon-sdk
/freebsd-11-stable/sys/contrib/x86emu
/freebsd-11-stable/sys/contrib/xz-embedded
/freebsd-11-stable/usr.sbin/bhyve/atkbdc.h
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.c
/freebsd-11-stable/usr.sbin/bhyve/bhyvegc.h
/freebsd-11-stable/usr.sbin/bhyve/console.c
/freebsd-11-stable/usr.sbin/bhyve/console.h
/freebsd-11-stable/usr.sbin/bhyve/pci_fbuf.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.c
/freebsd-11-stable/usr.sbin/bhyve/pci_xhci.h
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.c
/freebsd-11-stable/usr.sbin/bhyve/ps2kbd.h
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.c
/freebsd-11-stable/usr.sbin/bhyve/ps2mouse.h
/freebsd-11-stable/usr.sbin/bhyve/rfb.c
/freebsd-11-stable/usr.sbin/bhyve/rfb.h
/freebsd-11-stable/usr.sbin/bhyve/sockstream.c
/freebsd-11-stable/usr.sbin/bhyve/sockstream.h
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.c
/freebsd-11-stable/usr.sbin/bhyve/usb_emul.h
/freebsd-11-stable/usr.sbin/bhyve/usb_mouse.c
/freebsd-11-stable/usr.sbin/bhyve/vga.c
/freebsd-11-stable/usr.sbin/bhyve/vga.h
# 281876 22-Apr-2015 gjb

Create the arm64/aarch64 VM disk image as MBR instead of
GPT scheme. UEFI needs to know the unique partition GUID
with GPT, which changes each time. Specifically, the QEMU
EFI BIOS file has this hard-coded.[1]

Since the GPT labels are now unavailable, unconditionally
label the root filesystem as 'rootfs' with newfs(8), since
it does not hurt anything anywhere else. For the arm64 case,
'/' is mounted from /dev/ufs/rootfs; for all other VM images,
'/' is mounted from /dev/gpt/rootfs.

Unfortunately, since the /dev/gpt/swapfs label is also lost,
set NOSWAP=1 for the arm64/aarch64 images. This is temporary,
until I figure out a scalable solution to this. But, a certain
piece of softare was written "very fast", and ended up living
for 15 years. We can deal with this for a week or so.

Information from: andrew, emaste [1]
Sponsored by: The FreeBSD Foundation


# 280299 20-Mar-2015 cperciva

When creating VM images, copy the contents of the created filesystem into
a new filesystem before packaging it into a disk image. This prevents
"remnants" of deleted files from showing up in the VM images, and reduces
their compressed size (by about 10% for the cloudware images) as a result.

Looks good to: gjb


# 278505 10-Feb-2015 gjb

Bump copyright, forgotten in r278502.

MFC after: 1 week
X-MFC-with: r277458, r277536, r277606, r277609,
r277836, r278118, r278119, r278206,
r278502
Sponsored by: The FreeBSD Foundation


# 278502 10-Feb-2015 gjb

In scripts/mk-vmimage.sh, prevent incorrect usage() by
defaulting VMCONFIG to /dev/null, and additionally
ensuring VMCONFIG is not a character device before it
is sourced.

While here, be sure to exit if usage() is called.

This should effectively be no-op, but the usage() output
was discovered while investigating a larger issue.

MFC after: 1 week
X-MFC-with: r277458, r277536, r277606, r277609,
r277836, r278118, r278119, r278206
Sponsored by: The FreeBSD Foundation


# 277458 20-Jan-2015 gjb

Merge the following revisions from ^/projects/release-vmimage:
r273823-r273826, r273833, r273836, r273944, r274069-r274071,
r274134, r274211, r274280-r274285, r274287-r274288, r274292,
r274296-r274297, r274356, r274533, r274725, r274726, r274729,
r274734, r274771, r274945-r274946, r277180, r277183-r277184,
r277186-r277187, r277250-r277253, r277263-r277264, r277383-r277384,
r277393-r277395, r277438-r277439, r277447, r277455:

r273823:
Move virtual machine / cloud provider targets and
options from release/Makefile to their own Makefile.

r273824:
Add glue to allow enabling building cloud provider VM images
by default.

When WITH_CLOUDWARE is not empty, add CLOUDTARGETS to the
release/Makefile 'release' target.

r273825:
Avoid hard-coding the Azure image file format. While here,
avoid using OSRELEASE for the output file name.

r273826:
Remove a few vestiges of passing an exit code to panic().

r273833:
Initial commit providing a mechanism to create openstack images
as part of the release build.

r273836:
Fix output file name for openstack images. No further conversion
is necessary for this VM file target, so there is no need to append
the '.raw' suffix here.

r273944:
Uncomment the cloudinit rc.conf(5) line.

r274069:
Add line continuation so OPENSTACKCONF is actually included in the env(1).

r274070:
Add a 'vm-cloudware' target, used to drive all targets in CLOUDTARGETS.

r274071:
Add examples for WITH_CLOUDWARE to release.conf.sample.
Add WITH_CLOUDWARE evaluation to RELEASE_RMAKEFLAGS.

r274134:
Initial rewrite to consolidate VM image build scripts into one.

r274211:
Add write_partition_layout() used to populate the final image.

Fix duplicated mkimg(1) call in vm_create_disk().

Add primitive (untested) PowerPC/PowerPC64 VM image support.

Note: As it is currently written, the /boot/pmbr and
/boot/{gptboot,boot1.hfs} use the build host and not the target
build. Fixing this is likely going to be a hack in itself.

r274280:
Return if vm_create_disk() is unsuccessful.

r274281:
Add CLEANFILES entry for VM targets

r274282:
Add vm_extra_pre_umount() prototype to vmimage.subr.

r274283:
Fix DESTDIR for installworld, and make sure it is created before use.

r274284:
Move usage() from vmimage.subr to mk-vmimage.sh, in case vmimage.subr
has not been sourced.

r274285:
Spell 'OPTARG' correctly. Actually call vm_create_base().

r274287:
Fix line continuation in write_partition_layout().
Remove variable test that is no longer needed.

r274288:
Fix scheme flag to mkimg(1).

r274292:
mount(8) and umount(8) devfs(5) as needed.

r274296:
Change path for mk-vmimage.sh from ${TARGET}/ to scripts/ now that
it is consolidated into one file.

Fix paths for the base image and output disk image files.

r274297:
Call cleanup() after everything is done.

r274356:
Remove a stray directory from CLEANFILES.

r274533:
Set the boot partition type to 'apple-boot' for powerpc.

r274725:
In vm_install_base(), copy the host resolv.conf into
the build chroot before attempting to do anything that
requires working DNS (i.e., pkg bootstrap).

In vm_extra_pre_umount(), remove the resolv.conf before
the disk image is unmounted from the backing md(4).

r274726 (cperciva):
Silence errors when umounting the chroot's /dev, since it
probably doesn't exist when we're running this.

Unmount filesystems before attempting to destroy the md which
holds them.

r274729 (cperciva):
Unmount filesystem and destroy md before we read the vnode from
disk and package it into a disk image. Otherwise we end up
packaging an unclean filesystem.

r274734 (cperciva):
Merge duplicative vm-CLOUDTYPE targets before additional duplication
gets added by the impending arrival of ec2 and gcloud.

r274771 (cperciva):
Add NOSWAP option which can be set by a vmimage.conf file to specify
that no swap space should be created in the image. This will be used
by EC2 builds, since FreeBSD/EC2 allocates swap space on "ephemeral"
disks which are physically attached to the Xen host node.

r274945:
In vm_extra_install_packages(), only bootstrap pkg(8) if
VM_EXTRA_PACKAGES is empty.

In vm_extra_pre_umount(), cleanup downloaded packages if pkg(8) was
bootstrapped earlier.

r274946:
Fix indentation nit.

r277180:
In vm_extra_install_base(), do not install waagent in the openstack
image, because it is not used. This appears to be a copy mistake.

Remove vm_extra_install_base() from the openstack.conf entirely,
since it does not need to be overridden.

r277183:
Enable the textmode console by default for VM images, since there is
no way to tell if the environment will be able to use the
graphics-mode console.

r277184:
Enable password-less sudo for openstack images.

r277186:
Update the VM_EXTRA_PACKAGES list for the openstack images.

The documentation suggests doing a "just fetch this and run it"-style
bootstrap, from which the list of dependencies was obtained (in
github, at: pellaeon/bsd-cloudinit-installer)

There is one Python dependency unmet, oslo.config, which is not in
the Ports Collection.

r277187:
Add a comment to note that setting hw.vga.textmode=1 is temporary.

r277250:
Remove vm_extra_install_base() for the Azure image, now that the
waagent exists in the ports tree.

Add sysutils/azure-agent to the VM_EXTRA_PACKAGES list.

In vm_extra_pre_umount(), remove the explicit pkg(8) install
list, as dependencies are resolved by sysutils/azure-agent.

r277251:
Add a 'list-cloudware' target to print the list of supported CLOUDWARE
values and a description.

Add the AZURE_DESC and OPENSTACK_DESC descriptions.

r277252:
Update release(7)

r277253:
Add 'list-vmtargets' target, which produces a list of all supported
VM and cloud provider images.

Add VHD_DESC, VMDK_DESC, QCOW2_DESC, RAW_DESC image descriptions.

Format the output to make a bit more readable.

Update release(7) to document the list-vmtargets target.

r277263:
Add initial support for the GCE (Google Compute Engine) cloud hosting
provider image.

r277264:
Style and line length cleanup.

r277383:
Remove the console setting from rc.conf(5), which is not used there.
While here, set console to include vidconsole in the loader.conf(5).

r277384:
Fix an indentation nit.
No functional changes.

r277393:
Remove the pkg-clean(8) call from vm_extra_pre_umount() since the
function is often overridden.

Add vm_extra_pkg_rmcache() to call pkg-clean(8) to avoid duplicated
code.

r277394:
Move resolv.conf(5) removal back to vm_extra_pre_umount() where it
belongs.

The GCE image needs resolv.conf(5) to exist (created as part of the
image setup), so it cannot be removed.

r277395:
Comment the line that configures ttys(5) to 'off', which makes it
impossible to test that the image boots.

Add a note explaining why the line is commented, and not (yet) removed
entirely.

r277438:
Move the 'install' bits that are specific to virtual machine images
from the Makefile to Makefile.vm.

Rename the 'install' target to 'release-install', and add a new
'vm-install' target.

Add a new 'install' target that invokes the new targets.

r277439:
Add WITH_CLOUDWARE to the list of make(1) variables for the release
build.

r277447:
Remove hw.vga.textmode=1 from the VM image loader.conf, which was
included during test builds and not intended to be included when
merging this project branch back to head.

r277455:
Remove mk-azure.sh, which is no longer needed.

MFC after: 1 month
X-MFC-To: stable/10 (requires mkimg(1))
Help from: cperciva, swills
Relnotes: yes
Sponsored by: The FreeBSD Foundation


# 274134 05-Nov-2014 gjb

Initial rewrite to consolidate VM image build scripts into one.
There may be some very sharp edges here while refactoring.

- Move amd64/mk-vmimage.sh -> scripts/mk-vmimage.sh.
- Remove vm-base target from Makefile.vm.
- In vm-image target, use getopts flags for argument passing.
- Create tools/vmimage.subr, containing default and prototype
for the following functions that are used to drive the build,
run in this order:

vm_install_base()
vm_extra_install_base()
vm_extra_install_packages()
vm_extra_install_ports()
vm_extra_enable_services()
vm_extra_pre_umount()
vm_create_disk()
vm_extra_create_disk()

- In tools/azure.conf, override:

vm_extra_install_base()
vm_extra_pre_umount()
vm_extra_create_disk()

- In tools/openstack.conf, override:

vm_extra_install_base()
vm_extra_pre_umount()

Sponsored by: The FreeBSD Foundation


# 273074 14-Oct-2014 gjb

Revert r272793, r272794, r272795:

Remove implementation of vm_prebuild_setup(),
vm_setup(), and vm_postbuild_setup().

It does not scale well, and I am not happy with
their implementation.

Sponsored by: The FreeBSD Foundation


# 272795 09-Oct-2014 gjb

Reference vm_prebuild_setup(), vm_setup(), and
vm_postbuild_setup() functions.

Sponsored by: The FreeBSD Foundation


# 272794 09-Oct-2014 gjb

Allow mk-vmimage.sh to accept a configuration file as
an argument to '-c'.

Sponsored by: The FreeBSD Foundation


# 272793 09-Oct-2014 gjb

Add prototypes for build-specific tuning:

- vm_prebuild_setup():
Steps to run prior to creating the file-backed
disk image.

- vm_setup():
Steps to run while the file-backed disk image
is mounted.

- vm_postbuild_setup():
Steps to run after the file-backed disk image
is dismounted.

The intention is to override as necessary via build
configuration files, as needed.

Sponsored by: The FreeBSD Foundation


# 272792 09-Oct-2014 gjb

Add /usr/local/bin and /usr/local/sbin to PATH, needed
if third-party software needs to use utilities outside
of the base system during post-install stages (indexinfo
is one culprit).

Sponsored by: The FreeBSD Foundation


# 272437 02-Oct-2014 gjb

If the vm-base target fails, prevent the vm-image target
from being run since it cannot possibly succeed.

Sponsored by: The FreeBSD Foundation


# 272436 02-Oct-2014 gjb

Remove the first argument to panic(), which was initially
intended to be the exit code, however when a non-zero exit
code was returned to release/Makefile, this would prevent
any remaining (and possibly successful) stages from being
attempted.

Sponsored by: The FreeBSD Foundation


# 272380 01-Oct-2014 gjb

Avoid using env(1) to set values passed to mk-vmimage.sh,
and instead pass the values as arguments to the script,
making it easier to run this by hand, without 'make release'.

Add usage_vm_base() and usage_vm_image() usage helpers.

Sponsored by: The FreeBSD Foundation


# 272376 01-Oct-2014 gjb

Separate release/scripts/mk-vmimage.sh to machine-specific
scripts, making it possible to mimic the functionality for
non-x86 targets.

Move echo output if MAKEFLAGS is empty outside of usage().

Remove TARGET/TARGET_ARCH evaluation.

Sponsored by: The FreeBSD Foundation


# 272279 28-Sep-2014 gjb

Comment cleanup in panic() message when mkimg(1) does not support
the requested disk image format.

Sponsored by: The FreeBSD Foundation


# 272277 28-Sep-2014 gjb

Remove the UFS label from the root filesystem since it is added
by mkimg(1) as a gpt label, consistent with the fstab(5) entry.

Sponsored by: The FreeBSD Foundation


# 272272 28-Sep-2014 gjb

Remove comments left in accidentally while testing, so the
VM /etc/fstab is actually created.

Sponsored by: The FreeBSD Foundation


# 272271 28-Sep-2014 gjb

Fix UFS label for the root filesystem.

Sponsored by: The FreeBSD Foundation


# 272269 28-Sep-2014 gjb

release/Makefile:
Include .OBJDIR in DESTDIR in the vm-base target.

release/release.sh:
Provide the full path to mddev.

Sponsored by: The FreeBSD Foundation


# 272262 28-Sep-2014 gjb

Remove a 'set -x' that snuck in during testing.

Sponsored by: The FreeBSD Foundation


# 272234 27-Sep-2014 gjb

Initial commit to include virtual machine images as part
of the FreeBSD release builds.

This adds a make(1) environment variable requirement,
WITH_VMIMAGES, which triggers the virtual machine image
targets when not defined to an empty value.

Relevant user-driven variables include:

o VMFORMATS: The virtual machine image formats to create.
Valid formats are provided by running 'mkimg --formats'

o VMSIZE: The size of the resulting virtual machine
image. Typical compression is roughly 140Mb, regardless
of the target size (10GB, 15GB, 20GB, 40GB sizes have been
tested with the same result).

o VMBASE: The prefix of the virtual machine disk images.
The VMBASE make(1) environment variable is suffixed with
each format in VMFORMATS for each individual disk image, as
well as '.img' for the source UFS filesystem passed to
mkimg(1).

This also includes a new script, mk-vmimage.sh, based on how
the VM images for 10.0-RELEASE, 9.3-RELEASE, and 10.1-RELEASE
were created (mk-vmimage.sh in ^/user/gjb/thermite/).

With the order in which the stages need to occur, as well as
sanity-checking error cases, it makes much more sense to
execute a shell script called from make(1), using env(1) to
set specific parameters for the target image than it does to
do this in make(1) directly.

Sponsored by: The FreeBSD Foundation