Commit Graph

171 Commits

Author SHA1 Message Date
John Baldwin
0f031350f3 rescue: Fix link order of SSL libraries and fetch.
ld.bfd requires libraries to be linked in order.  libssl requires
libcrypto.  libfetch requires libssl.  To fix the latter, move fetch
up above tar rather than listing the ssl libraries twice.

Reviewed by:	delphij
Fixes:		ea34aa4780 rescue: Add fetch(1) to the rescue tool.
Differential Revision:	https://reviews.freebsd.org/D38304
2023-02-02 09:23:02 -08:00
John Grafton
ea34aa4780 rescue: Add fetch(1) to the rescue tool.
After a failed upgrade, having fetch(1) on a system that is
physically unnreachable would be very useful to download files
required to get the OS back up and functional.

On my system this adds 589,824 bytes (3.8%) to the binary size.

PR:		266224
Reported by:	Dan Mahoney
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D38193
2023-01-29 15:05:15 -08:00
Ed Maste
fa4d25f5b4 retire sconfig(8) ce(4)/cp(4) configuration tool
The ce(4) and cp(4) drivers have been retired.

Differential Revision:	https://reviews.freebsd.org/D33469
2022-12-13 15:25:13 -05:00
John Baldwin
5e4854cbf8 rescue: Link libzutil after libzfs.
libzfs depends on symbols defined in libzutil.  For static linking
ld.bfd is less forgiving than lld, so rescue was failing to link when
using ld.bfd due to unresolved symbols from libzutil used by libzfs.

Reviewed by:	imp, kib, emaste
Differential Revision:	https://reviews.freebsd.org/D36811
2022-10-03 16:10:42 -07:00
Konstantin Belousov
3aaed4cb8c Fix conflict between libnvpair and libnv when building rescue binaries.
Submitted by:	hselasky
Reviewed by:	jhb
Sponsored by:	NVIDIA Networking
MFC after:	3 weeks
Differential revision:	https://reviews.freebsd.org/D32551
2022-05-24 23:59:33 +03:00
John Baldwin
13916064fc rescue: Link with -lncursesw instead of -lncursesw_real.
ld.bfd fails to link rescue with undefined symbol errors otherwise.

This reverts commit b158d4d7a1.

Reviewed by:	bapt
Differential Revision:	https://reviews.freebsd.org/D34123
2022-02-11 13:58:59 -08:00
Ed Maste
daf481f3d5 rescue: include ping iff at least one of INET & INET6 is enabled
Ping does not build (and serves no purpose) if neither is enabled
(i.e., building WITHOUT_INET and WITHOUT_INET6).

This is equvalent to a4ef9e58bc but for rescue/.

PR:		260082
Fixes:		a4ef9e58bc ("sbin: build ping if at least one of...")
Sponsored by:	The FreeBSD Foundation
2021-12-31 13:16:30 -05:00
John Baldwin
6378393308 Add an internal libiscsiutil library.
Move some of the code duplicated between ctld(8) and iscsid(8) into a
libiscsiutil library.

Sharing the low-level PDU code did require having a
'struct connection' base class with a method table to permit separate
initiator vs target behavior (e.g. in handling proxy PDUs).

Reviewed by:	mav, emaste
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D33544
2021-12-22 10:43:11 -08:00
Gleb Smirnoff
6aae3517ed Retire synchronous PPP kernel driver sppp(4).
The last two drivers that required sppp are cp(4) and ce(4).

These devices are still produced and can be purchased
at Cronyx <http://cronyx.ru/hardware/wan.html>.

Since Roman Kurakin <rik@FreeBSD.org> has quit them, they no
longer support FreeBSD officially.  Later they have dropped
support for Linux drivers to.  As of mid-2020 they don't even
have a developer to maintain their Windows driver.  However,
their support verbally told me that they could provide aid to
a FreeBSD developer with documentaion in case if there appears
a new customer for their devices.

These drivers have a feature to not use sppp(4) and create an
interface, but instead expose the device as netgraph(4) node.
Then, you can attach ng_ppp(4) with help of ports/net/mpd5 on
top of the node and get your synchronous PPP.  Alternatively
you can attach ng_frame_relay(4) or ng_cisco(4) for HDLC.
Actually, last time I used cp(4) back in 2004, using netgraph(4)
instead of sppp(4) was already the right way to do.

Thus, remove the sppp(4) related part of the drivers and enable
by default the negraph(4) part.  Further maintenance of these
drivers in the tree shouldn't be a big deal.

While doing that, remove some cruft and enable cp(4) compilation
on amd64.  The ce(4) for some unknown reason marks its internal
DDK functions with __attribute__ fastcall, which most likely is
safe to remove, but without hardware I'm not going to do that, so
ce(4) remains i386-only.

Reviewed by:		emaste, imp, donner
Differential Revision:	https://reviews.freebsd.org/D32590
See also:		https://reviews.freebsd.org/D23928
2021-10-22 11:41:36 -07:00
Baptiste Daroussin
b158d4d7a1 rescue: fix after with to a ldscript of libncursesw.a 2021-10-10 08:53:41 +02:00
Alex Richardson
2eefc1d926 Fix building rescue/rescue when sanitizers are enabled
We have to ensure that we don't link any instrumented object files
into rescue as it is a static executable and static binaries can't
use the sanitizer runtime.

Reviewed By:	imp
Differential Revision: https://reviews.freebsd.org/D31044
2021-07-06 12:18:30 +01:00
Alan Somers
d262451715 ping: add a ping6 hard link for backwards compatibility
When invoked as "ping6", ping will now attempt to use ICMPv6 for hostnames
that resolve both IPv4 and IPv6 addresses.

Reviewed by:	bz, manu
MFC-With:	r368045
Differential Revision:	https://reviews.freebsd.org/D27384
2020-11-26 18:33:04 +00:00
Alan Somers
3cde9171d2 Merge ping6 to ping
There is now a single ping binary, which chooses to use ICMP or ICMPv4
based on the -4 and -6 options, and the format of the address.

Submitted by:	Ján Sučan <sucanjan@gmail.com>
Sponsored by:	Google LLC (Google Summer of Code 2019)
MFC after:	Never
Differential Revision:	https://reviews.freebsd.org/D21377
2020-11-26 04:29:30 +00:00
Toomas Soome
e307eb94ae loader: zfs should support bootonce an nextboot
bootonce feature is temporary, one time boot, activated by
"bectl activate -t BE", "bectl activate -T BE" will reset the bootonce flag.

By default, the bootonce setting is reset on attempt to boot and the next
boot will use previously active BE.

By setting zfs_bootonce_activate="YES" in rc.conf, the bootonce BE will
be set permanently active.

bootonce dataset name is recorded in boot pool labels, bootenv area.

in case of nextboot, the nextboot_enable boolean variable is recorded in
freebsd:nvstore nvlist, also stored in boot pool label bootenv area.
On boot, the loader will process /boot/nextboot.conf if nextboot_enable
is "YES", and will set nextboot_enable to "NO", preventing /boot/nextboot.conf
processing on next boot.

bootonce and nextboot features are usable in both UEFI and BIOS boot.

To use bootonce/nextboot features, the boot loader needs to be updated on disk;
if loader.efi is stored on ESP, then ESP needs to be updated and
for BIOS boot, stage2 (zfsboot or gptzfsboot) needs to be updated
(gpart or other tools).

At this time, only lua loader is updated.

Sponsored by:	Netflix, Klara Inc.
Differential Revision:	https://reviews.freebsd.org/D25512
2020-09-21 09:01:10 +00:00
Kyle Evans
fe815331bb build: provide a default WARNS for all in-tree builds
The current default is provided in various Makefile.inc in some top-level
directories and covers a good portion of the tree, but doesn't cover parts
of the build a little deeper (e.g. libcasper).

Provide a default in src.sys.mk and set WARNS to it in bsd.sys.mk if that
variable is defined. This lets us relatively cleanly provide a default WARNS
no matter where you're building in the src tree without breaking things
outside of the tree.

Crunchgen has been updated as a bootstrap tool to work on this change
because it needs r365605 at a minimum to succeed. The cleanup necessary to
successfully walk over this change on WITHOUT_CLEAN builds has been added.

There is a supplemental project to this to list all of the warnings that are
encountered when the environment has WARNS=6 NO_WERROR=yes:
https://warns.kevans.dev -- this project will hopefully eventually go away
in favor of CI doing a much better job than it.

Reviewed by:	emaste, brooks, ngie (all earlier version)
Reviewed by:	emaste, arichardson (depend-cleanup.sh change)
Differential Revision:	https://reviews.freebsd.org/D26455
2020-09-18 17:17:46 +00:00
John Baldwin
4d135bbd7f libifconfig now depends on libm due to usage of log10().
ld.bfd in particular requires -lm to come after libifconfig on the
command line when linking rescue.

Reviewed by:	freqlabs, adrian
Differential Revision:	https://reviews.freebsd.org/D26258
2020-09-02 22:10:08 +00:00
Matt Macy
9e5787d228 Merge OpenZFS support in to HEAD.
The primary benefit is maintaining a completely shared
code base with the community allowing FreeBSD to receive
new features sooner and with less effort.

I would advise against doing 'zpool upgrade'
or creating indispensable pools using new
features until this change has had a month+
to soak.

Work on merging FreeBSD support in to what was
at the time "ZFS on Linux" began in August 2018.
I first publicly proposed transitioning FreeBSD
to (new) OpenZFS on December 18th, 2018. FreeBSD
support in OpenZFS was finally completed in December
2019. A CFT for downstreaming OpenZFS support in
to FreeBSD was first issued on July 8th. All issues
that were reported have been addressed or, for
a couple of less critical matters there are
pull requests in progress with OpenZFS. iXsystems
has tested and dogfooded extensively internally.
The TrueNAS 12 release is based on OpenZFS with
some additional features that have not yet made
it upstream.

Improvements include:
  project quotas, encrypted datasets,
  allocation classes, vectorized raidz,
  vectorized checksums, various command line
  improvements, zstd compression.

Thanks to those who have helped along the way:
Ryan Moeller, Allan Jude, Zack Welch, and many
others.

Sponsored by:	iXsystems, Inc.
Differential Revision:	https://reviews.freebsd.org/D25872
2020-08-25 02:21:27 +00:00
Ryan Moeller
94cba8034b Move ifconfig SFP status functionality into libifconfig
libifconfig_sfp.h provides an API in libifconfig for querying SFP module
properties, operational status, and vendor strings, as well as descriptions
of the various fields, string conversions, and other useful helpers for
implementing user interfaces.

SFP module status is obtained by reading registers via an I2C interface.
Descriptions of these registers and the values therein have been collected
in a Lua table which is used to generate all the boilerplace C headers and
source files for accessing these values, their names, and descriptions.
The generated code is fully commented and readable.

This is the first use of libifconfig in ifconfig itself.  For now, the
scope remains very limited.  Over time, more of ifconfig will be replaced
with libifconfig.

Some minor changes to the formatting of ifconfig output have been made:
- Module memory hex dumps are indented one extra space as a result of using
hexdump(3) instead of a bespoke hex dump function.
- Media descriptions have an added two-character short-name in parenthesis.
- QSFP modules were incorrectly displaying TX bias current as power.  Now
  TX channels display bias current, and this change has been made for both
  SFP and QSFP modules for consistency.

A Lua binding for libifconfig including this functionality is implemented
but has not been included in this commit.  The plan is for it to be
committed after dynamic module loading has been enabled in flua.

Reviewed by:	kp, melifaro
Relnotes:	yes
Differential Revision:	https://reviews.freebsd.org/D25494
2020-08-09 16:27:28 +00:00
Yoshihiro Takahashi
8f11c99715 - Cleanups related to sparc64 removal.
- Remove remains of sparc64 files.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D25831
2020-07-28 10:58:37 +00:00
Emmanuel Vadot
118eb647f9 rescue: Remove useless linking with libl 2020-03-24 07:08:02 +00:00
Warner Losh
2cfe8b8d46 Remove unused defines since r147075
When the OpenBSD dhclient was brought in 14 years ago, we stopped
supporting building a reduced sized dhclient, yet retained the options
here.  Also, the OpenBSD dhclient doesn't need lint defined, so it can
go too.
2019-07-12 04:44:50 +00:00
Ed Maste
06cf1308e4 rescue: set NO_SHARED in Makefile
The rescue binary is built statically via the Makefile generated by
crunchgen, but that does not trigger other shared/static logic in
bsd.prog.mk - in particular disabling retpolineplt with static linking.

PR:		233336
Reported by:	Charlie Li
Sponsored by:	The FreeBSD Foundation
2018-11-19 22:18:18 +00:00
Kyle Evans
830261e23d rescue: Add bectl(8)
Requested by:	kevans, Shawn Webb
MFC after:	3 days
2018-10-31 20:42:18 +00:00
Bryan Drewery
5fead429eb Avoid referencing private lib names directly.
Sponsored by:	Dell EMC Isilon
2017-11-10 07:53:02 +00:00
Bryan Drewery
ae9f7248f9 rescue ipf: Remove hacks and link in libipf directly.
Sponsored by:	Dell EMC Isilon
2017-11-10 07:52:58 +00:00
Konstantin Belousov
93b09f581a Remove badsect(8).
Failure modes of the modern (that is, produced in the last 25 years)
hard drives and SSDs made the utility outdated.  Since the kernel
interface to support it was removed in r324853, cut the userspace
remnants as well.

Discussed with:	bde (who does not like the removal)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
2017-11-05 22:00:54 +00:00
Bryan Drewery
ea825d0274 DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-10-31 00:07:04 +00:00
Eitan Adler
8cb0af95e8 rescue: say gbye to 'boot floppies' and moderize 2017-10-29 21:21:39 +00:00
Jeremie Le Hen
e415aa2846 Remove rcmds.
If they are still needed, you can find them in the net/bsdrcmds port.

This was proposed June, 20th and approved by various committers [1].
They have been marked as deprecated on CURRENT in r320644 [2] on July, 4th.
Both stable/11 and release/11.1 contain the deprecation notice (thanks to
allanjude@).

Note that ruptime(1)/rwho(1)/rwhod(8) were initially thought to be part of
rcmds but this was a mistake and those are therefore NOT removed.

[1] https://lists.freebsd.org/pipermail/freebsd-arch/2017-June/018239.html
[2] https://svnweb.freebsd.org/base?view=revision&revision=320644

Reviewed by:	bapt, brooks
Differential Revision:	https://reviews.freebsd.org/D12573
2017-10-06 08:43:14 +00:00
Bryan Drewery
07676084ec DIRDEPS_BUILD: Update dependencies.
Sponsored by:	Dell EMC Isilon
2017-05-09 01:48:23 +00:00
Baptiste Daroussin
f831d9368a Add zstd to the rescue binary
Having zstd might be useful in rescue to be able to access to log files
compressed by zstandard

Suggested by:	ian
2017-05-06 18:35:01 +00:00
Brooks Davis
0607c830b3 More ATM and NATM removal
Submitted by:	ak
Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D10511
2017-04-27 16:05:12 +00:00
Brooks Davis
b4e2ab78df Remove NATM configuration bits and assorted NATM and ATM remnants.
Reported by:	ak
Reviewed by:	ngie (first version)
Differential Revision:	https://reviews.freebsd.org/D10497
2017-04-25 21:59:34 +00:00
Brooks Davis
a7dc31283a Remove the NATM framework including the en(4), fatm(4), hatm(4), and
patm(4) devices.

Maintaining an address family and framework has real costs when we make
infrastructure improvements.  In the case of NATM we support no devices
manufactured in the last 20 years and some will not even work in modern
motherboards (some newer devices that patm(4) could be updated to
support apparently exist, but we do not currently have support).

With this change, support remains for some netgraph modules that don't
require NATM support code. It is unclear if all these should remain,
though ng_atmllc certainly stands alone.

Note well: FreeBSD 11 supports NATM and will continue to do so until at
least September 30, 2021.  Improvements to the code in FreeBSD 11 are
certainly welcome.

Reviewed by:	philip
Approved by:	harti
2017-04-24 21:21:49 +00:00
Enji Cooper
f3e05661e1 Fix linking /rescue/rescue to multiple programs in usr.bin after r315113
I meant for the line that conditionally added in /usr/bin/nc support to
be `+=', not `=`. This restores hardlinks for all programs in usr.bin
specified before nc(1), e.g., bunzip2 and tar.

Reported by:	Andrzej Tobola <ato@iem.pw.edu.pl>
Submitted by:	Scott Allendorf <scott-allendorf@uiowa.edu>
Pointyhat to:	ngie
MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-03-20 22:33:22 +00:00
Warner Losh
23583802cf Make rescue use SRCTOP
Transition to SRCTOP. Also, standardize of {} instead of () variable
deliminators while I'm here.

Differential Revision:	https://reviews.freebsd.org/D9932
Sponsored by:		Netflix
Silence	On:		arch@ (twice)
2017-03-12 18:59:09 +00:00
Enji Cooper
4ab40004f0 Conditionally compile [additional] programs into rescue(8) if requested
Trivial oversight missed in r314240 cleanup because I enable these knobs on
my test machines.

MK_INET6_SUPPORT - rtsol
MK_NETCAT - nc

MFC after:	3 days
Sponsored by:	Dell EMC Isilon
2017-03-12 04:24:29 +00:00
Enji Cooper
5673173e11 Conditionally compile certain programs into rescue(8) if requested
MK_CCD - ccdconfig
MK_ROUTED - routed, rtquery

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-02-25 03:23:11 +00:00
Enji Cooper
6a6050accf Add shutdown/poweroff support to rescue(8)
shutdown is a safer way to power off than reboot (in general), because of
the added shutdown process that it executes via /etc/rc.shutdown . It was
odd that it was missing from rescue(8) since reboot and friends were
added in past commits.

While here, alias poweroff to shutdown for parity with sbin/shutdown/Makefile

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2017-02-25 03:11:08 +00:00
Yoshihiro Takahashi
2b375b4edd Remove pc98 support completely.
I thank all developers and contributors for pc98.

Relnotes:	yes
2017-01-28 02:22:15 +00:00
Bryan Drewery
490a8aa9a1 DIRDEPS_BUILD: Update dependencies.
MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2016-11-13 00:11:30 +00:00
Bryan Drewery
b3cf0fa874 DIRDEPS_BUILD: Build crunchide for the host.
MFC after:	2 weeks
Sponsored by:	EMC / Isilon Storage Division
2016-09-01 23:52:25 +00:00
Bryan Drewery
38f6966b70 DIRDEPS_BUILD: Fix and hookup rescue/rescue to the build.
Sponsored by:	EMC / Isilon Storage Division
2016-05-26 23:20:40 +00:00
Glen Barber
ca832df486 Split /rescue into its own package.
Sponsored by:	The FreeBSD Foundation
2016-02-08 14:27:45 +00:00
Enji Cooper
a2a45f908a Fix the build after ifconfig was converted over to lib80211 in r291470
Reported by: jenkins, O. Hartmann <ohartman@zedat.fu-berlin.de>
Pointyhat to: adrian
2015-11-30 16:34:13 +00:00
John Baldwin
7f911abe54 Add support to libkvm for reading vmcores from other architectures.
- Add a kvaddr_type to represent kernel virtual addresses instead of
  unsigned long.
- Add a struct kvm_nlist which is a stripped down version of struct nlist
  that uses kvaddr_t for n_value.
- Add a kvm_native() routine that returns true if an open kvm descriptor
  is for a native kernel and memory image.
- Add a kvm_open2() function similar to kvm_openfiles().  It drops the
  unused 'swapfile' argument and adds a new function pointer argument for
  a symbol resolving function.  Native kernels still use _fdnlist() from
  libc to resolve symbols if a resolver function is not supplied, but cross
  kernels require a resolver.
- Add a kvm_nlist2() function similar to kvm_nlist() except that it uses
  struct kvm_nlist instead of struct nlist.
- Add a kvm_read2() function similar to kvm_read() except that it uses
  kvaddr_t instead of unsigned long for the kernel virtual address.
- Add a new kvm_arch switch of routines needed by a vmcore backend.
  Each backend is responsible for implementing kvm_read2() for a given
  vmcore format.
- Use libelf to read headers from ELF kernels and cores (except for
  powerpc cores).
- Add internal helper routines for the common page offset hash table used
  by the minidump backends.
- Port all of the existing kvm backends to implement a kvm_arch switch and
  to be cross-friendly by using private constants instead of ones that
  vary by platform (e.g. PAGE_SIZE).  Static assertions are present when
  a given backend is compiled natively to ensure the private constants
  match the real ones.
- Enable all of the existing vmcore backends on all platforms.  This means
  that libkvm on any platform should be able to perform KVA translation
  and read data from a vmcore of any platform.

Tested on:	amd64, i386, sparc64 (marius)
Differential Revision:	https://reviews.freebsd.org/D3341
2015-11-27 18:58:26 +00:00
Enji Cooper
46839d1247 Make iscsictl and iscsid build if MK_ISCSI == yes
MFC after: 1 month
X-MFC with: r289452
2015-10-17 21:11:42 +00:00
Edward Tomasz Napierala
defd502f1f Add iscsictl(8) and iscsid(8) to rescue(8). The point is to make it
easier to build md_root images from rescue(8), to use with iSCSI boot.

The change increases the size of rescue by 62kB, from 8728kB to 8790kB.

Reviewed by:	bapt@
MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D3865
2015-10-17 13:00:34 +00:00
Bryan Drewery
ec766071e3 META_MODE: Remove DEP_MACHINE from Makefile.depend files.
This has not been needed since r246865 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:44:01 +00:00
Bryan Drewery
54c7d75a06 META_MODE: Remove DEP_RELDIR from Makefile.depend files.
This has not been needed since r284171 in projects/bmake.

Sponsored by:	EMC / Isilon Storage Division
2015-09-25 19:26:08 +00:00