Commit Graph

240 Commits

Author SHA1 Message Date
Emmanuel Vadot
90d2f7c413 release: amd64: Fix ISO/USB hybrid image
Recent mkimg changes forces to have partitions given in explicit order.
This is so we can have the first partition starting at a specific offset
and the next ones starting after without having to specify an offset.
Switch the partition in the mkisoimage.sh script so the first one created
is the isoboot one.

PR:    254490
Reported by:	Michael Dexter <editor@callfortesting.org
Tested by:	Vincent Milum Jr <freebsd@darkain.com>
MFC after:	Right now
2021-03-27 12:04:51 +01:00
Glen Barber
bdccfea1ea Bump the ISO EFI partition size from 1024 to 2048, following r366732.
Suggested by:	imp
Sponsored by:	Rubicon Communications, LLC (netgate.com)
2020-10-15 23:05:13 +00:00
Glen Barber
a0da9a6272 Increase the amd64 ISO ESP file size from 800KB to 1024KB.
At some poing over the last week, the bootx64.efi file has grown
past the 800KB threshold, resulting in being unable to copy it to
the EFI/BOOT directory.

 # stat -f %z efiboot.znWo7m
 819200
 # stat -f %z stand-test.PIEugN/EFI/BOOT/bootx64.efi
 842752

The comment in the script that creates the ISOs suggests that 800KB
is the maximum allowed for the boot code, however I was able to
boot an ISO with a 1024KB boot partition.  Additionally, I verified
against an ISO from OtherOS, where the boot EFI partition is 2.4MB.

Sponsored by:	Rubicon Communications, LLC (netgate.com)
2020-10-15 17:12:58 +00:00
Matt Macy
14113f123e Use makefs -t msdos in make_esp_file
With this last piece in place, make -C /usr/src/release release.iso is
finally able to run in a jail. This was not possible before because
msdosfs cannot be mounted inside a jail.

Submitted by:	ryan@ixsystems.com
Reviewed by:	emaste@, imp@, gjb@
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D21385
2019-09-03 18:37:55 +00:00
Rebecca Cran
db8b561345 Rework UEFI ESP generation
Currently, the installer uses pre-created 800KB FAT12 filesystems that
it dd's onto the ESP partition.
This changeset improves that by having the installer generate a FAT32
filesystem directly onto the ESP using newfs_msdos and then copying
loader.efi into /EFI/freebsd.
For live installs it then runs efibootmgr to add a FreeBSD boot entry
in the BIOS.

Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D17947
2018-12-20 19:39:37 +00:00
Yuri Pankov
709bc7e0c1 mkisoimages.sh: don't use -p flag when copying loader.efi to msdosfs.
This fixes 'cdrom' target in the case when world was built by user,
and not root.

Reviewed by:	imp
Differential revision:	https://reviews.freebsd.org/D18414
2018-12-03 22:31:57 +00:00
Ed Maste
a7d9306a40 release: set -e to exit on error in iso image scripts
Reviewed by:	gjb
Differential Revision:	https://reviews.freebsd.org/D17651
2018-10-22 19:39:20 +00:00
Marius Strobl
470f228f62 - Once we have shifted arguments up to thrice, base-bits-dir is $1 rather
than $4. Introduce $BASEBITSDIR for clarity and to avoid repeating this
  mistake in the future. Fixing this ensures that we pick up newly built
  boot bits native to the target rather for/from the host.
- Apply some of the argument quoting fixes done in r287635 but missing in
  later revisions.
2018-06-07 18:24:25 +00:00
Ed Maste
075bac9787 switch amd64 memstick installer images to MBR
A good number of BIOSes have trouble booting from GPT in non-UEFI mode.
This is commonly reported with Lenovo desktops and laptops (including
X220, X230, T430, and E31) and Dell systems.  Although UEFI is the
preferred amd64 boot method on recent hardware, older hardware does not
support UEFI, a user may wish to boot via BIOS/CSM, and some systems
that support UEFI fail to boot FreeBSD via UEFI (such as an old
AMD FX-6100 that I have).

With this change amd64 memsticks remain dual-mode (booting from either
UEFI or CSM); the partitioning type is just switched from GPT to MBR.

The "vestigial swap partition" in the GPT scheme was added in r265017 to
work around some issue with loader's GPT support, so we should not need
it when using MBR.

There is some concern that future UEFI systems may not boot from MBR,
but I am not aware of any today.  In any case the likely path forward
for our installers is to migrate to CD/USB combo images, and if it
becomes necessary introduce a separate memstick specifically for the
MBR BIOS/CSM case.

PR:		227954
Reviewed by:	gjb, imp, tsoome
MFC after:	3 days
Relnotes:	Yes
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D15599
2018-05-29 15:06:13 +00:00
Benno Rice
6ea2984738 Allow etdump, makefs and mkimg to be overridden.
Recent changes to makefs and mkimg have led to situations where the
disconnect between this script and the versions installed on the host cause
failures. Provide a way to work around this that doesn't require the
installation of new versions to the host system if that's not desired.

With this change mkisoimages.sh will honour the $ETDUMP, $MAKEFS and $MKIMG
environment variables but fall back to the previous behaviour of finding them
within $PATH.

Reviewed by:	gjb
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D15181
2018-04-25 18:47:52 +00:00
Benno Rice
0279ac04ed Generate hybrid ISO images for amd64.
This keeps the existing El Torito entries for BIOS and UEFI boot code and
adds a GPT in the ISO image's System Area containing boot code for BIOS that
will load /boot/loader from the ISO filesystem and execute it. We then use
etdump to find the EFI System Partition image in the El Torito catalog and
add an entry to the GPT that allows EFI to find it.

Reviewed by:	gjb, imp
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D15051
2018-04-17 22:33:41 +00:00
Ed Maste
8ea90e075c make-memstick.sh: put partition args on separate lines
This makes it easier to identify the individual partition types and
facilitates comparisons across architectures.

Reviewed by:	gjb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2018-04-10 19:49:04 +00:00
Benno Rice
eb5c194032 Fix the position of $bootable so that -o platformid=efi applies correctly.
Sponsored by:	iXsystems, Inc.
Pointy hat to:	benno (again)
2018-04-10 02:49:53 +00:00
Benno Rice
d4bb7978c6 Fix makefs invocation after r331843.
Reported by:	gjb
Reviewed by:	gjb
Sponsored by:	iXsystems, Inc.
Pointy hat to:	benno
2018-04-10 02:43:07 +00:00
Benno Rice
8dbc390581 Allow makefs to properly tag UEFI El Torito boot images. Use them in amd64 ISOs.
UEFI booting requires an EFI System Partition (ESP). On most storage devices
this will be in a specific partition type. To allow booting from CD/ISO
filesystems, UEFI will look for an ESP in the form of a FAT filesystem image
embedded in the image. Historically FreeBSD has added one of these to its
amd64 ISO images but marked it as simply another i386 boot image. Luckily for
us most UEFI implementations are rather forgiving and work this out for us.

This change adds the ability to mark a boot image as being a UEFI image. It
also modifies our ISO generation to use this marking for the UEFI image we
embed.

Reported by:	Thomas Schmitt <scdbackup@gmx.net>
Reviewed by:	emaste, imp
MFC after:	1 week
Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D14809
2018-03-23 20:56:18 +00:00
Glen Barber
f295b9db79 Add general configuration files used by release/release.sh for
big-iron installation images.

MFC after:	3 days
MFC with:	r325948, r325949, r325950, r325951
Sponsored by:	The FreeBSD Foundation
2017-11-17 18:00:52 +00:00
Eitan Adler
a2aef24aa3 Update several more URLs
- Primarily http -> https
- Primarily FreeBSD project URLs
2017-10-29 08:17:03 +00:00
Ed Maste
355534688c make-memstick.sh: use UFSv2
There's not much practical difference as far as install media is
concerned but newfs creates UFSv2 by default and it is sensible to use
the contemporary UFS version.

I also intend to change makefs to create UFSv2 by default (to match
newfs) so we'll want make-memstick.sh to be explicit, rather than
relying on the host tool's default.

Reviewed by:	andrew, gjb, jhibbits
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12231
2017-09-11 14:41:57 +00:00
Ed Maste
f20be204d6 revert unintentional changes from r323436 2017-09-11 14:35:43 +00:00
Ed Maste
e9346a94d1 boot1: remove BOOT1_MAXSIZE default value
This Makefile relies on Makefile.fat providing the correct value for
BOOT1_MAXSIZE and BOOT1_OFFSET. Since BOOT1_OFFSET had no default value
here the build would already fail if Makefile.fat did not provide
correct values.

Sponsored by:	The FreeBSD Foundation
2017-09-11 14:33:04 +00:00
Ed Maste
708c2585e3 make-memstick.sh: use 'set -e' to abort if any step fails
Also remove the now-redundant error handling that was only for makefs.

This change applies arm64's r308171 to the other make-memstick.sh
versions.

Reviewed by:	gjb
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D12195
2017-09-05 12:57:45 +00:00
Ed Maste
93cf995aef mkisoimages.sh: remove obsolete x$var convention
Ancient shells had trouble with empty variables but this has not been
relevant for FreeBSD for a very long time (decades?).
2017-09-04 22:37:28 +00:00
Steven Hartland
88b85228a4 Increase efiboot.img size used in ISO creation
Due to recent and upcoming changes to add additional functionality to
the EFI loader its now bigger than the space allocates for efiboot.img
so increase this in line with boot1.efifat.

MFC after:	2 weeks
X-MFC-With:	r293268
Sponsored by:	Multiplay
2016-01-13 14:47:13 +00:00
Glen Barber
8834318685 Merge ^/projects/release-install-debug:
- Rework MANIFEST generation and parsing via bsdinstall(8).
- Allow selecting debugging distribution sets during install.
- Rework bsdinstall(8) to fetch remote debug distribution sets
  when they are not available on the local install medium.
- Allow selecting additional non-GENERIC kernels during install.
  At present, GENERIC is still required, and installed by default.

Tested with:	head@r293203
Sponsored by:	The FreeBSD Foundation
2016-01-05 21:05:17 +00:00
Glen Barber
10c40dfa68 Prevent memstick installation medium from attempting to mount
the root filesystem read-write.  This causes problems booting
the memstick installation medium from write-protected USB flash
drives.

Submitted by:	A.J. Kehoe IV [1], Oliver Jones [2]
PR:		187161 [1], 205886 [2]
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2016-01-05 03:20:45 +00:00
Devin Teske
27065039bc Fix argument quoting and remove unnecessary braces
MFC after:	3 weeks
X-MFC-to:	stable/10
2015-09-10 22:47:26 +00:00
Glen Barber
2d4ff62f00 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
2015-01-20 23:56:04 +00:00
Glen Barber
1e7c1f1742 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
2014-11-05 13:22:19 +00:00
Glen Barber
6943fb9ff2 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.

Sponsored by:	The FreeBSD Foundation
2014-10-29 19:44:34 +00:00
Glen Barber
573e7cca4b Initial commit providing a mechanism to create
openstack images as part of the release build.

This mimics the way Microsoft Azure images are
built, with the addition of installing the
net/cloud-init package and adding a (commented)
rc.conf(5) entry for cloudinit.

Sponsored by:	The FreeBSD Foundation
2014-10-29 17:04:09 +00:00
Glen Barber
461f70f64a Remove a few vestiges of passing an exit code to
panic().

Sponsored by:	The FreeBSD Foundation
2014-10-29 16:20:49 +00:00
Glen Barber
f27438c752 Avoid hard-coding the Azure image file format.
While here, avoid using OSRELEASE for the output
file name.

Sponsored by:	The FreeBSD Foundation
2014-10-29 16:18:29 +00:00
Glen Barber
e4cd478e9f Merge the following from ^/projects/release-vmimage:
r273076, r273077, r273079, r273095:

r273076:
  Add a separate make(1) target to release/Makefile to
  build FreeBSD virtual machine disk images for use on
  the Microsoft Azure service.

  For now, this target is not directly connected to the
  build, however can be manually invoked.

  The 'vm-azure' target invokes {amd64,i386}/mk-azure.sh,
  which does the heavy lifting to produce proper VHDs.
  mk-azure.sh uses a configuration file, defaulting to
  tools/azure.conf if otherwise unset.

r273077:
  Clear VM_RC_LIST.

r273079:
  Fix signal list to trigger umount(8).

r273095:
  Output an informational message when mkimg(1) runs, so it
  does not appear that the process has stopped while waiting
  for a 'y/n' response when waagent is deprovisioned.

Tested on:	releng/10.1@r272876
MFC after:	3 days
X-MFC-10.1:	yes
Sponsored by:	The FreeBSD Foundation
2014-10-14 15:22:46 +00:00
Glen Barber
f38d42ba63 Output an informational message when mkimg(1) runs, so it
does not appear that the process has stopped while waiting
for a 'y/n' response when waagent is deprovisioned.

Sponsored by:	The FreeBSD Foundation
2014-10-14 15:18:22 +00:00
Glen Barber
7cb62648d9 Merge the following from ^/projects/release-vmimage:
r272436, r272437, r272792:

r272436:
  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.

r272437:

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

r272792:

  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).

MFC after:	3 days
X-MFC-10.1:	yes
Sponsored by:	The FreeBSD Foundation
2014-10-14 15:03:06 +00:00
Glen Barber
60b7edb5a7 Fix signal list to trigger umount(8).
Sponsored by:	The FreeBSD Foundation
2014-10-14 12:13:43 +00:00
Glen Barber
3991f309ed Add a separate make(1) target to release/Makefile to
build FreeBSD virtual machine disk images for use on
the Microsoft Azure service.

For now, this target is not directly connected to the
build, however can be manually invoked.

The 'vm-azure' target invokes {amd64,i386}/mk-azure.sh,
which does the heavy lifting to produce proper VHDs.
mk-azure.sh uses a configuration file, defaulting to
tools/azure.conf if otherwise unset.

Sponsored by:	The FreeBSD Foundation
2014-10-14 11:48:28 +00:00
Glen Barber
41a29c1ab2 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
2014-10-14 11:20:08 +00:00
Glen Barber
648326ad2d Reference vm_prebuild_setup(), vm_setup(), and
vm_postbuild_setup() functions.

Sponsored by:	The FreeBSD Foundation
2014-10-09 04:10:58 +00:00
Glen Barber
4ac2ee7f8c Allow mk-vmimage.sh to accept a configuration file as
an argument to '-c'.

Sponsored by:	The FreeBSD Foundation
2014-10-09 03:50:38 +00:00
Glen Barber
ed79fb4ea9 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
2014-10-09 03:29:52 +00:00
Glen Barber
655f2eb770 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
2014-10-09 03:20:28 +00:00
Glen Barber
47480336de If the vm-base target fails, prevent the vm-image target
from being run since it cannot possibly succeed.

Sponsored by:	The FreeBSD Foundation
2014-10-02 18:23:53 +00:00
Glen Barber
d04dbaf828 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
2014-10-02 18:20:01 +00:00
Glen Barber
ee12fa01c6 Merge the following revisions from ^/projects/release-vmimage:
r272234, r272236, r272262, r272264, r272269, r272271, r272272,
r272277, r272279, r272376, r272380, r272381, r272392, r272234,
r272412:

r272234:
  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.

r272236:
  Use VMBASE in place of a hard-coded filename in the CLEANFILES
  list.

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

r272264:
  release/Makefile:
    Connect the virtual machine image build to the release
    target if WITH_VMIMAGES is set to a non-empty value.

  release/release.sh:
    Add WITH_VMIMAGES to RELEASE_RMAKEFLAGS.

  release/release.conf.sample:
    Add commented entries for tuning the release build if the
    WITH_VMIMAGES make(1) environment variable is set to
    a non-empty value.

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

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

r272271:
  Fix UFS label for the root filesystem.

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

r272277:
  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.

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

r272376:
  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.

r272380:
  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.

r272381:
  After evaluating WITH_VMIMAGES is non-empty, ensure
  the mk-vmimage.sh script exists before running it.

r272392:
  Add WITH_COMPRESSED_VMIMAGES variable, which when set enables
  xz(1) compression of the virtual machine images.

  This is intentionally separate to allow more fine-grained
  tuning over which images are compressed, especially in cases
  where compressing 20GB sparse images can take hours.

r272412:
  Document the new 'vm-image' target, and associated release.conf
  variables.

r272413:
  Remove two stray comments added during the initial iterations
  of testing, no longer needed.

MFC after:	5 days
X-MFC-10.1:	yes
Tested on:	r272269, r272272, r272279, r272380, r272392
Sponsored by:	The FreeBSD Foundation
2014-10-02 16:13:12 +00:00
Glen Barber
0bc9be5e74 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
2014-10-01 19:13:42 +00:00
Glen Barber
fadf2a24fe 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
2014-10-01 17:05:40 +00:00
Nathan Whitehorn
7fad9ac96c Now that GENERIC can boot on UEFI systems (r268158), switch the build to use
UEFI-compatible images. These will boot as before on BIOS systems, but will
boot using the UEFI loader on UEFI-aware systems.
2014-07-02 15:23:13 +00:00
Nathan Whitehorn
faecd0da18 loader's GPT support on BIOS does not seem to like the root filesystem
being the last filesystem on the disk for some reason when made by this
script. Add a vestigial swap partition to allow this to boot with QEMU
BIOS.
2014-04-27 16:34:59 +00:00
Nathan Whitehorn
457b8af283 Add script to setup bootable CD ISOs for both BIOS and EFI systems. Tested
and working on QEMU. Actually using this script as the regular image
generator, like with the memstick one, will require that the kernel support
EFI too. In particular, the following two things are required:
1. vt(9) be the default console driver
2. vt_efifb and vt_vga be able to coexist usefully in the same kernel

One other note here is that this requires newfs_msdos and mdconfig, which is
really ugly. NetBSD's makefs at least seems to support FAT now. If that
actually works, it should be imported and we can get rid of the mdconfig mess.
2014-04-27 01:06:02 +00:00