Commit graph

288563 commits

Author SHA1 Message Date
Alexander Ziaee
5f375fdbdf em.4: add interfaces to name section
Improving first-glance comprehension that this manual page applies to
igb/lem interfaces provided by the em(4) driver.

While here, tag SPDX, link the framework, and shuffle a sentence to fix
linter warning.

Co-authored-by: mhorne
Reviewed by:	mhorne
MFC after:	1 week
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1134

(cherry picked from commit 501f7e7bf8)
2024-04-18 15:16:56 -03:00
Mitchell Horne
9319a8a11a simple_mfd: don't attach children twice
Trying to probe+attach the child device at the point it is added comes
before the syscon handle is set up (if relevant). It will therefore be
unavailable to the attach method which is expecting it, and the first
attempt to attach the device will fail.

Just rely on the call to bus_generic_attach() at the end of the function
to perform probe+attach of dev's children.

Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44268

(cherry picked from commit accda78153)
2024-04-18 15:11:31 -03:00
Mitchell Horne
29701960b3 clk_fixed: call clkdom_dump() for verbose boot
This is standard practice for clock drivers that register clocks
dynamically. Nothing else uses the CLK_DEBUG macro.

The result is that the name and frequency of the fixed clock is printed
for a verbose boot, which may aid in debugging.

Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44265

(cherry picked from commit 6e66bb9fc3)
2024-04-18 15:11:31 -03:00
Mitchell Horne
5eb27a0d68 clk_fixed: quiet by default
We may attach several of these devices, but there is no meaningful
information added to dmesg. For example:

  ofwbus0: <Open Firmware Device Tree>
  clk_fixed0: <Fixed clock> on ofwbus0
  clk_fixed1: <Fixed clock> on ofwbus0
  clk_fixed2: <Fixed clock> on ofwbus0
  clk_fixed3: <Fixed clock> on ofwbus0
  clk_fixed4: <Fixed clock> on ofwbus0
  clk_fixed5: <Fixed clock> on ofwbus0
  clk_fixed6: <Fixed clock> on ofwbus0
  clk_fixed7: <Fixed clock> on ofwbus0
  clk_fixed8: <Fixed clock> on ofwbus0
  clk_fixed9: <Fixed clock> on ofwbus0
  clk_fixed10: <Fixed clock> on ofwbus0
  clk_fixed11: <Fixed clock> on ofwbus0

To reduce this noise, quiet the devices for by default. For verbose
boot, the message will be emitted.

Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44266

(cherry picked from commit 1cb9f6f641)
2024-04-18 15:11:31 -03:00
Mitchell Horne
327987597b clkdom_dump(): improve output text
If the call to clknode_get_freq() returns an error (unlikely), report
this, rather than printing the error code as the clock frequency.

If the clock has no parent (e.g. a fixed reference clock), print "none"
rather than "(NULL)(-1)". This is a more human-legible presentation of the
same information.

Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44267

(cherry picked from commit 08635c51d1)
2024-04-18 15:11:31 -03:00
Graham Perrin
9050a43e8e intro.9: minor changes
A correction: 'and' -> 'an'. Plus, several tweaks for brevity or
clarity.

Reviewed by:	mhorne
MFC after:	3 days
Pull Request:	https://github.com/freebsd/freebsd-src/pull/813

(cherry picked from commit 712fd5ac91)
2024-04-18 15:11:30 -03:00
Mitchell Horne
0a40193a6e busdma: fix page miscount for small segment sizes
For small segments (< PAGE_SIZE) there is a mismatch between how
required bounce pages are counted in _bus_dmamap_count_pages() and
bounce_bus_dmamap_load_buffer().

This problem has been observed on the RISC-V VisionFive v2 SoC (and
earlier revisions of the hardware) which has memory physically addressed
above 4GB. This requires some bouncing for the dwmmc driver, which has
has a maximum segment size of 2048 bytes. When attempting to load a
page-aligned 4-page buffer that requires bouncing, we can end up
counting 4 bounce pages for an 8-segment transfer. These pages will be
incorrectly configured to cover only the first half of the transfer (4 x
2048 bytes).

Fix the immediate issue by adding the maxsegsz check to
_bus_dmamap_count_pages(); this is what _bus_dmamap_count_phys() does
already. The result is that we will inefficiently allocate a separate
bounce page for each segment (8 pages for the example above), but the
transfer will proceed in its entirety.

The more complete fix is to address the shortcomings in how small
segments are assigned to bounce pages, so that we opportunistically
batch multiple segments to a page whenever they fit (e.g. two 2048 bytes
segments per 4096 page). This will be addressed more holistically in the
future. For now this change will prevent the (silent) incomplete
transfers that have been observed.

PR:		273694
Reported by:	Jari Sihvola <jsihv@gmx.com>
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34118

(cherry picked from commit b134c10d65)
2024-04-18 15:09:02 -03:00
Himanshu Chauhan
4e997a32db riscv: Introduce support for APLIC interrupt controller
This patch introduces support for the RISC-V APLIC interrupt controller
[1]. Currently, it is only supports direct mode, i.e. without an IMSIC
and functionally replacing the legacy RISC-V PLIC. Work on IMSIC support
is in progress.

[1] https://github.com/riscv/riscv-aia/releases/tag/1.0

Reviewed by:	mhorne
Discussed with:	jrtc27
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D43293

(cherry picked from commit ee91dae43d)
2024-04-18 15:09:02 -03:00
Ed Maste
c0e5d8f9bd mergemaster: postpone removal to FreeBSD 15
Mergemaster has been deprecated for quite some time, but was not
removed prior to FreeBSD 14.0.  Update the deprecation notice in the man
page to reflect this.

PR:		274967
Reported by:	naddy
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 73cce7d888)
2024-04-18 10:05:01 -04:00
Ed Maste
ea3b15d005 bsdlabel: emit deprecation notice when run
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Reision: https://reviews.freebsd.org/D43586

(cherry picked from commit 3661658c76)
2024-04-18 10:05:01 -04:00
Ed Maste
7e3c7de28d tzsetup: be explicit about *timezone* abbreviation
During the install process tzsetup asks a question like

    Does the abbreviation `EDT' look reasonable?

The installer asks lots of questions, some that relate to the previous
screen or topic and some that do not.  A new user installed FreeBSD for
the first time and was confused by this question, not realizing that it
was asking whether the abbreviation is correct for the selected
timezone.

Reviewed by:	bapt, brooks, imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D44500

(cherry picked from commit 40b57cb616)
2024-04-18 10:05:01 -04:00
Kristof Provost
dc16f5fe14 tcpdump: cope with incorrect packet lengths
It's possible for the capture buffer to be smaller than indicated by the
header length. However, pfsync_print() only took the header length into
account. As a result we could read outside of the buffer.

Check that we have at least the expected amount of data before we start
parsing.

PR:		278034
MFC after:	2 weeks
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D44580

(cherry picked from commit 4848eb3af2)
2024-04-18 15:35:52 +02:00
Christos Margiolis
5abbbb7c64 sound: Remove leftover references to snd_clone
The snd_clone framework does not exist as of
e8c0d15a64 ("sound: Get rid of snd_clone
and use DEVFS_CDEVPRIV(9)"), so remove leftover references to it from
unit.c.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 months
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44758

(cherry picked from commit 068c675ca7)
2024-04-18 14:39:41 +02:00
Christos Margiolis
51abcd0c47 sound: Update some LICENSE headers
The following commits introduced substantial changes to pcm/dsp.c,
pcm/sndstat.c and pcm/sound.c.

9da3b645db ("sound: Move
sndstat_prepare_pcm() to pcm/sndstat.c and remove
sndstat_entry->handler")
e8c0d15a64 ("sound: Get rid of snd_clone
and use DEVFS_CDEVPRIV(9)")

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44757

(cherry picked from commit 4f854658c5)
2024-04-18 14:39:36 +02:00
Christos Margiolis
d692c314d2 sound: Implement asynchronous device detach
Hot-unplugging a sound device, such as a USB sound card, whilst being
consumed by an application, results in an infinite loop until either the
application closes the device's file descriptor, or the channel
automatically times out after hw.snd.timeout seconds. In the case of a
detach however, the timeout approach is still not ideal, since we want
all resources to be released immediatelly, without waiting for N seconds
until we can use the bus again.

The timeout mechanism works by calling chn_sleep() in chn_read() and
chn_write() (see pcm/channel.c) in order to send the thread to sleep,
using cv_timedwait_sig(). Since chn_sleep() sets the CHN_F_SLEEPING flag
while waiting for cv_timedwait_sig() to return, we can test this flag in
pcm_unregister() (called during detach) and wakeup the sleeping
thread(s) to immediately kill the channel(s) being consumed.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 months
PR:		194727
Reviewed by:	dev_submerge.ch, bapt, markj
Differential Revision:	https://reviews.freebsd.org/D43545

(cherry picked from commit 44e128fe9d)
2024-04-18 14:39:31 +02:00
Christos Margiolis
e6c51f6db8 sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9)
Currently the snd_clone framework creates device nodes on-demand for
every channel, through the dsp_clone() callback, and is responsible for
routing audio to the appropriate channel(s). This patch gets rid of the
whole snd_clone framework (including any related sysctls) and instead
uses DEVFS_CDEVPRIV(9) to handle device opening, channel allocation and
audio routing. This results in a significant reduction in code size as
well as complexity.

Behavior that is preserved:

- hw.snd.basename_clone.
- Exclusive access of an audio device (i.e VCHANs disabled).
- Multiple processes can read from/write to the device.
- A device can only be opened as many times as the maximum allowed
  channel number (see SND_MAXHWCHAN in pcm/sound.h).
- OSSv4 compatibility aliases are preserved.

Behavior changes:

Only one /dev/dspX device node is created (on attach) for each audio
device, as opposed to the current /dev/dspX.Y devices created by
snd_clone. According to the sound(4) man page, devices are not meant to
be opened through /dev/dspX.Y anyway, so it is best if we do not create
device nodes for them in the first place. As a result of this, modify
dsp_oss_audioinfo() to print /dev/dspX in the "ai->devnode", instead of
/dev/dspX.Y.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 months
Reviewed by:	dev_submerge.ch, bapt, markj
Differential Revision:	https://reviews.freebsd.org/D44411

(cherry picked from commit e8c0d15a64)
2024-04-18 14:39:26 +02:00
Gordon Bergling
cfa4bd59df atrtc(4): Fix a typo in a sysctl description
- s/emtpy/empty/

(cherry picked from commit 38cc6c3d95)
2024-04-18 06:34:26 +02:00
Zaphrod Beeblebrox
40631b79b5 nfscl: Purge name cache when readdir_plus is done
The author reported that this patch was needed to avoid
crashes on a fairly busy RISC-V system.  The author did not
provide details w.r.t. the crashes.  Although I
have not seen any such crash, the patch looks reasonable
and I have not found any regressions when testing it.

Since "rdirplus" is not a default option, the patch is
only needed if you are doing NFS mounts with the "rdirplus"
mount option and seeing crashes related to the name cache.

(cherry picked from commit d00c64bb23)
2024-04-17 17:49:10 -07:00
Mark Johnston
ca8e2e4c91 tcp: Make tcp_var.h more self-contained
struct tcpcb embeds a struct osd and a struct callout.  Rather than
forcing all consumers to pull in the same headers, include the headers
directly.

No functional change intended.

Reviewed by:	glebius
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44685

(cherry picked from commit 1d14e88e53)
2024-04-17 10:33:27 -04:00
Minsoo Choo
1f85f06276 vm_reserv_reclaim_contig: Return NULL not false
Reviewed by:	dougm, zlei
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D44667

(cherry picked from commit 989a2cf19d)
2024-04-17 10:33:26 -04:00
Michael Tuexen
994f9c9e3c tcp rack: fix sending
In rack_output(), idle is used as a boolean variable. So don't use it
as an int and don't clear it afterwards.
This avoids setting idle to false, when it is not intended.

Reported by:		olivier
Reviewed by:		rrs, rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44610

(cherry picked from commit 7df0ef5f48)
2024-04-17 16:19:20 +02:00
Michael Tuexen
1348844366 Revert "tcp rack: fix sending"
This reverts commit b5ee7411bf.
2024-04-17 16:17:03 +02:00
Michael Tuexen
b5ee7411bf tcp rack: fix sending
In rack_output(), idle is used as a boolean variable. So don't use it
as an int and don't clear it afterwards.
This avoids setting idle to false, when it is not intended.

Reported by:		olivier
Reviewed by:		rrs, rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44610

(cherry picked from commit 7df0ef5f48)
2024-04-17 16:15:03 +02:00
Michael Tuexen
14d7784332 tcp bbr: improve code consistency
Improve code consistency with the RACK stack.
Reviewed by:		gallatin, rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44800

(cherry picked from commit 605a00660e)
2024-04-17 16:02:33 +02:00
Michael Tuexen
5344772af9 tcp: add some debug output
Also log, when dropping text or FIN after having received a FIN.
This is the intended behavior described in RFC 9293.
A follow-up patch will enforce this behavior for the base stack
and the RACK stack.
Reviewed by:		rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44669

(cherry picked from commit e8c149ab85)
2024-04-17 16:01:12 +02:00
Michael Tuexen
90cde57af8 tcp: improve consistency
No functional change intended.

Reported by:		Coverity Scan
CID:			1523781
Reviewed by:		rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44645

(cherry picked from commit 3e1c8a35f7)
2024-04-17 16:00:09 +02:00
Michael Tuexen
c6770e8c99 tcp rack: fix memory corruption
When in rack_output() jumping to the label out, don't write errno into
the log buffer, since the pointer is not initialized.

Reported by:		Coverity Scan
CID:			1523773
Reviewed by:		rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44647

(cherry picked from commit d902c8f55b)
2024-04-17 15:59:05 +02:00
Michael Tuexen
7a019565ff uipc_socket: handle socket buffer locks in sopeeloff
PR:			278171
Reviewed by:		markj
Fixes:			a4fc41423f ("sockets: enable protocol specific socket buffers")
Differential Revision:	https://reviews.freebsd.org/D44640

(cherry picked from commit 681711b77c)
2024-04-17 15:58:22 +02:00
Michael Tuexen
6572d12cfc tcp bblog: cleanup
Remove redundant checks and improve error checking.

Reported by:		Coverity Scan
CID:			1523780
Reviewed by:		rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44616

(cherry picked from commit 60bc195745)
2024-04-17 15:55:27 +02:00
Michael Tuexen
60898a7cef tcp hpts: initialize variable
Ensure that  tv.tv_sec is zero in all code paths.

Reported by:		Coverity Scan
CID:			1527724
Reviewed by:		rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44584

(cherry picked from commit aaaa01c0c8)
2024-04-17 15:54:52 +02:00
Michael Tuexen
f3e2beb306 tcp: address a warning
t_state is an unsigned variable, so no need for testing that it is
non-negative.

Reported by:		Coverity Scan
CID:			1390885
Reviewed by:		glebius
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44619

(cherry picked from commit 6b454da6bb)
2024-04-17 15:54:13 +02:00
Michael Tuexen
7ebfafa813 tcp: fix conversion of rttvar
A wrong variable and wrong scaling factors were used.

Reported by:		Coverity Scan
CID:			1508689
Reviewed by:		rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44612

(cherry picked from commit e0bd180130)
2024-04-17 15:53:15 +02:00
Michael Tuexen
be30b22fbb tcp: fix comment
Make the comment consistent with the code.

Reviewed by:		rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44611

(cherry picked from commit 5a268d8688)
2024-04-17 15:52:18 +02:00
Michael Tuexen
8375db082c tcp hpts: improve consistency
The target_slot argument of max_slots_available() can be NULL.
Therefore, check for this in all places.
Right now, all callers provide non-NULL pointer.

Reported by:		Coverity Scan
CID:			1527732
Reviewed by:		rrs
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44527

(cherry picked from commit b600644fdd)
2024-04-17 15:51:43 +02:00
Michael Tuexen
fbc8dfd0ed tcp bblog: use correct length
The length of tldl_reason is TCP_LOG_REASON_LEN, not TCP_LOG_ID_LEN.
No functional change intended.
Reported by:		Coverity Scan
CID:			1418074
CID:			1418276
Reviewed by:		glebius, rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44510

(cherry picked from commit ed505f893a)
2024-04-17 15:51:00 +02:00
Michael Tuexen
fd2a580db2 tcp: no data on SYN segments unless doing TFO
Ensure that there is no data on SYN segments unless doing TFO.
This check is already in RACK and BBR.

Reported by:		glebius
Reviewed by:		rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D44384

(cherry picked from commit af700f430f)
2024-04-17 15:50:02 +02:00
Michael Tuexen
d69099e433 TCP LRO: add dtrace probe points
Add the IP, UDP, and TCP receive static probes to the code path,
which avoids if_input.

Reviewed by:		rrs, markj
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D43727

(cherry picked from commit 96ad640178)
2024-04-17 15:48:45 +02:00
Michael Tuexen
8244b35ff8 TCP LRO: disable mbuf queuing when packet filter hooks are in place
When doing mbuf queueing, the packet filter hooks in ether_demux(),
ip_input(), and ip6_input() are by-passed. This means that the packet
filters don't process incoming packets, which might result in
connection failures. For example bypassing the TCP sequence number
validation will result in dropping valid packets.
Please note that this patch is only disabling mbuf queueing, not LRO.

Reported by:		Herbert J. Skuhra
Reviewed by:		glebius, rrs, rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D43769

(cherry picked from commit d1ce01214a)
2024-04-17 15:48:01 +02:00
Michael Tuexen
be7586fe46 sctp: improve sending of packets containing an INIT ACK chunk
If the peer announced support of zero checksums, do so when sending
packets containing an INIT ACK chunk.

(cherry picked from commit 644cffe67f)
2024-04-17 15:47:17 +02:00
Michael Tuexen
49557689bf sctp: improve consistency
(cherry picked from commit 533faf21c1)
2024-04-17 15:46:32 +02:00
Michael Tuexen
c5e78e553c dtrace: allow NULL interface pointer for ifinfo_t translator
This is similar to other translators and will be used in static
probes where the interface is not known.

Reviewed by:		markj
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D43728

(cherry picked from commit e00fd24262)
2024-04-17 15:45:40 +02:00
Michael Tuexen
8b2c694d38 RACK, BBR: handle EACCES like EPERM for IP output handling
The FreeBSD TCP base stack handles them also the same way.
In case of packet filters dropping packets in the output path,
this avoids retranmitting the dropped packet every 10ms or so.

Reviewed by:		rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D43773

(cherry picked from commit 2f4e46dfdd)
2024-04-17 15:44:15 +02:00
Michael Tuexen
307daa4f17 vnic: fix compilation of an IPv6 only kernel
Sponsored by:	Netflix, Inc.

(cherry picked from commit 1d3d30c8d2)
2024-04-17 15:43:08 +02:00
Michael Tuexen
2da45e304d TCP LRO: convert TCP header fields to host byte order earlier
This is a preparation for adding dtrace hooks in a follow-up commit,
which are missing in the code path, where packets are directly queued
to the tcpcb. The dtrace hooks expect the fields to be in host byte
order. This only applies when TCP HPTS is used.
No functional change intended.

Reviewed by:		rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D43594

(cherry picked from commit f30c7d5654)
2024-04-17 15:42:13 +02:00
Alexander Motin
e48f7ff6a1 ahc/ahd: Fix target mode operation
After 5e63cdb457 the drivers didn't clear CAM_DIS_DISCONNECT in
ah*_handle_target_cmd() when needed, only set it.

Reported/tested by:	HP van Braam <hp@tmm.cx>
MFC after:	1 week

(cherry picked from commit f1e4c09577)
2024-04-17 09:39:37 -04:00
Michael Osipov
69dbc448cf freebsd-update: Don't provide copiable commands in output
Previously, freebsd-update provided ready-to-go commands for copying and
pasting into the terminal. This causes problems as soon as options are
used and not supplied again by the user, e.g., '-b' or '-d'.
Stop making them copiable and force the user to construct a valid command
line by himself to avoid failures.

PR:		276102
Approved by:	jrm (mentor), emaste
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D43700
2024-04-17 08:50:07 +02:00
Mathieu
a871d0f13c daemon: fix -R to enable supervision mode
If we're doing restarts, then we must supervise -- the 'R' case simply
got missed.

PR:	278342
Fixes:	f907027b49 ("daemon: set supervise_enabled during [..]")
(cherry picked from commit bbc6e6c5ec)
2024-04-17 00:48:26 -05:00
Colin Percival
f1c7e9bc72 release: Build dvd image before staging pkgs
This missing dependency is only visible with -jN (which was otherwise
broken until recently) and only when building DVD images (which aren't
included in weekly snapshots and thereby slipped past testing).

MFC after:	3 days

(cherry picked from commit 567cbd8ff1)
2024-04-16 22:43:27 -07:00
Colin Percival
d576c1dd97 Makefile.vm: Set CLEANDIRS correctly for vm-image
With multiple filesystems and disk image formats, we now use different
staging directories; we need to include them all in CLEANDIRS.

Fixes:	97bd53ef4d "Makefile.vm: Fix duplicate rc.conf files"
MFC after:	3 days

(cherry picked from commit 7ffa1f14e3)
2024-04-16 22:43:27 -07:00
John Baldwin
70dcf0608c release: Use the ABI of the target release to fetch packages
- Point --rootdir at the installed destdir in the dvd tree.  This
  causes pkg to determine the ABI from the installed destdir instead
  of the host's binaries.  Previously the result was that packages
  for the host's ABI were always downloaded breaking cross-releases
  (e.g. arm64 releases built on an amd64 host included amd64
  packages on the DVD ISO image rather than arm64 packages).  This
  also handles version mismatches, and I tested this by cross-building
  a 15.x arm64 release on a 14.x amd64 host.

- As a result, pkg now does a chdir(3) to the rootdir before running,
  so the -o argument to fetch needs to be updated to be relative to
  rootdir instead of the CWD as make runs.

- Add a new ROOTDIR variable to limit references to "dvd" to one
  place.  Ideally ROOTDIR would be an argument to this script so
  that it didn't really know about the dvd layout at all.

- While here, simplify creation of symlinks by just using a longer
  path to the link name instead of using 'cd' in the shell before
  invoking ln(1).  Also use ln -sf to create the pkg.pkg symlink
  rather than rm + ln.

PR:		278273
Reported by:	gatekeeper <tiago.gasiba@gmail.com>
Reviewed by:	imp, delphij
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D44749

(cherry picked from commit ea2663040d)
2024-04-16 22:43:27 -07:00