Commit Graph

19 Commits

Author SHA1 Message Date
Jessica Clarke
1a9b1c367f 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
2022-02-28 22:37:37 +00:00
Jessica Clarke
13cb004130 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
2022-02-28 22:37:03 +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
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
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
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
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
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
Glen Barber
a29123a849 Fix indentation for diff reduction with commits to follow.
Sponsored by:	The FreeBSD Foundation
2014-04-25 19:43:18 +00:00
Glen Barber
cac71a6495 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
2014-04-25 18:46:54 +00:00
Glen Barber
ad22db2755 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
2014-04-25 01:55:14 +00:00
Glen Barber
6dceb683a7 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
2014-04-25 01:38:57 +00:00
Nathan Whitehorn
986e0c7801 Use UFS labels and bsdlabels (like the 8.x memsticks) instead of GPT to
fix problems with some BIOSes.

MFC after:	3 days
2011-10-09 16:23:04 +00:00
Nathan Whitehorn
86354c8d38 Mount memsticks read-only by default to prevent them being filled by
user modifications and subsequently preventing a functioning installation.

Approved by:	re (kib)
2011-07-30 00:51:36 +00:00
Nathan Whitehorn
0877c11eda 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
2011-03-22 01:14:53 +00:00
Nathan Whitehorn
89033280b7 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.
2011-03-13 01:38:24 +00:00