History log of /freebsd-current/release/amd64/make-memstick.sh
Revision Date Author Comments
# d0b2dbfa 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line sh pattern

Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/


# 1a9b1c36 28-Feb-2022 Jessica Clarke <jrtc27@FreeBSD.org>

release: Add support for building on non-FreeBSD

This requires two sets of changes. Firstly, for non-FreeBSD, we do not
know where tools are in PATH (and it is likely that some are not in
system directories and have been built as bootstrap tools during the
build), so we should leave PATH alone and trust the user. Secondly,
makefs needs a master.passwd for building images from a METALOG file, so
pass the directory in the image tree to makefs's -N option in order to
pick up a valid FreeBSD master.passwd; this is unnecessary on FreeBSD
(except in the edge case of building an image that refers to users or
groups not present in the host's database, which is unlikely but
technically possible) but harmless so can be done unconditionally.

Reviewed by: brooks, emaste, gjb
Differential Revision: https://reviews.freebsd.org/D34001


# 13cb0041 28-Feb-2022 Jessica Clarke <jrtc27@FreeBSD.org>

release: Support -DNO_ROOT image building

This requires a bunch of METALOG mangling to include the files we inject
into the tree. The mkisoimages.sh and make-memstick.sh scripts are now
called with the current directory inside the tree so that the relative
paths in the METALOG match up with the current directory. The scripts do
not require this when not using a METALOG, but for simplicity we always
do so. The Makefile mangles the real METALOG created from the install,
as those files are shared across all uses of the tree, but the shell
scripts create a temporary copy of the METALOG that they mangle as their
tree modifications are specific to that image. We also need to pass -D
to makefs to turn any duplicate METALOG entry errors into warnings, as
we have many (harmless) instances of those.

Whilst dvd1.iso should work, the !NOPKG code will need more work to
support this.

All media will also lack mergemaster and etcupdate trees, since more
work is needed to add -DNO_ROOT modes to them. Users of install media
built this way will have to manually bootstrap them.

Reviewed by: brooks, gjb
Differential Revision: https://reviews.freebsd.org/D33999


# db8b5613 20-Dec-2018 Rebecca Cran <bcran@FreeBSD.org>

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


# 075bac97 29-May-2018 Ed Maste <emaste@FreeBSD.org>

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


# 8ea90e07 10-Apr-2018 Ed Maste <emaste@FreeBSD.org>

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


# 35553468 11-Sep-2017 Ed Maste <emaste@FreeBSD.org>

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


# f20be204 11-Sep-2017 Ed Maste <emaste@FreeBSD.org>

revert unintentional changes from r323436


# e9346a94 11-Sep-2017 Ed Maste <emaste@FreeBSD.org>

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


# 708c2585 04-Sep-2017 Ed Maste <emaste@FreeBSD.org>

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


# 10c40dfa 04-Jan-2016 Glen Barber <gjb@FreeBSD.org>

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


# 7fad9ac9 02-Jul-2014 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

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.


# a29123a8 25-Apr-2014 Glen Barber <gjb@FreeBSD.org>

Fix indentation for diff reduction with commits to follow.

Sponsored by: The FreeBSD Foundation


# cac71a64 25-Apr-2014 Glen Barber <gjb@FreeBSD.org>

Revert r264907 and r264908:

Restore make-memstick.sh back to its original state to
unbreak booting for machines that do not support GPT.

I have in-progress work to keep the MBR layout and add
the EFI partition, but it is not yet ready, and does
need at least one full release build to be certain it
does not break.

Sponsored by: The FreeBSD Foundation


# ad22db27 24-Apr-2014 Glen Barber <gjb@FreeBSD.org>

Style cleanup
- Indent 1 full tab where needed
- Use $() for shell exec
- Insert a space between '$(( ))' parens

MFC After: 1 week
X-MFC-With: r264907
Sponsored by: The FreeBSD Foundation


# 6dceb683 24-Apr-2014 Glen Barber <gjb@FreeBSD.org>

Refactor make-memstick.sh to avoid creating the 'dangerously
dedicated' partition scheme, reported to cause the memstick.img
to fail to boot.

Similar to how make-memstick.sh worked on stable/8, use makefs(8)
to create the actual filesystem. Then calculate the size of the
resulting image file, create the GPT partition scheme, then dd(1)
the filesystem created with makefs(8) to the freebsd-ufs GPT
partition.

This was tested on a known-working machine[1] for regression, and
a known-not-working machine[2] to ensure the boot issue has been
resolved.

Testers: myself [1], db [2]
MFC After: 1 week
Sponsored by: The FreeBSD Foundation


# 986e0c78 09-Oct-2011 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Use UFS labels and bsdlabels (like the 8.x memsticks) instead of GPT to
fix problems with some BIOSes.

MFC after: 3 days


# 86354c8d 29-Jul-2011 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Mount memsticks read-only by default to prevent them being filled by
user modifications and subsequently preventing a functioning installation.

Approved by: re (kib)


# 0877c11e 21-Mar-2011 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Use labels to find release media instead of hard-coded device paths. This
makes booting more reliable (and working at all on USB sticks). While here,
move responsibility for setting up fstab into the various platform mk-*.sh
scripts.

Suggested by: many


# 89033280 12-Mar-2011 Nathan Whitehorn <nwhitehorn@FreeBSD.org>

Add generation of memstick images to the bsdinstall release makefile for
i386 and amd64. This involved moving the memstick generation script to
the arch directories from scripts/, in analogy to mkisoimages.sh. This
script was never called from /usr/src/release/Makefile, so that hasn't
been updated.