Commit Graph

2319 Commits

Author SHA1 Message Date
Sergey Kandaurov
6791e4f442 Get rid of a spurious warning on the console when booting the kernel
from the interactive loader(8) prompt and beastie_disable="YES" is set
in loader.conf(5). In this case menu.rc is not evaluated and consequently
menu-unset does not have a body yet. This results in the ficl warning
"menu-unset not found" when try-menu-unset invokes menu-unset.

Check for beastie_disable="YES" explicitly, so that the try-menu-unset
word will not attempt to invoke menu-unset because the menu will have
never been configured. [1]
Use the sfind primitive as a last resort as an additional safer approach
conjuring a foreign word safely. [2]

PR:		kern/163938
Submitted by:	Devin Teske [1]
Reviewed by:	Devin Teske [2]
Reported and tested by:	dim
MFC after:	1 week
X-MFC with:	r228985
2012-01-09 20:25:14 +00:00
Konstantin Belousov
a7e92fc91c Document comconsole_port and comconsole_pcidev loader variables.
MFC after:	2 weeks
2012-01-07 11:16:23 +00:00
Yoshihiro Takahashi
a57b8b9e02 MFi386: revision 229435
Add special loader environment variables 'comconsole_port' and
  'comconsole_pcidev'.

MFC after:	2 weeks
2012-01-04 03:54:30 +00:00
Yoshihiro Takahashi
da5f7df3a6 Fix 230MB MO support.
Submitted by:	Kaho Toshikazu
MFC after:	1 week
2012-01-04 03:49:41 +00:00
Konstantin Belousov
5a1e37174f Add special loader environment variables 'comconsole_port' and
'comconsole_pcidev'. The former allows to set the base address of the
serial console i/o port. The later takes the string of the format
'bus:device:function:[bar]' as a value and uses the serial port attached
as PCI device at the specified location for console.

Both variants pass 'hw.uart.console' variable to the uart driver to
properly hand-over the kernel console.

Change allows to use ISA serial ports other than COM1 for the
loader/kernel console without loader recompilation. Also, you can use
PCI-attached port as the console, e.g. Intel AMT serial pseudo-port on
some motherboards based on Q67 chipset.

Reviewed by:	jhb
MFC after:	2 weeks
2012-01-03 22:36:12 +00:00
Ed Schouten
b3608ae18f Replace index() and rindex() calls with strchr() and strrchr().
The index() and rindex() functions were marked LEGACY in the 2001
revision of POSIX and were subsequently removed from the 2008 revision.
The strchr() and strrchr() functions are part of the C standard.

This makes the source code a lot more consistent, as most of these C
files also call into other str*() routines. In fact, about a dozen
already perform strchr() calls.
2012-01-03 18:51:58 +00:00
Ed Schouten
46632c18bd Merge index() and strchr() together.
As I looked through the C library, I noticed the FreeBSD MIPS port has a
hand-written version of index(). This is nice, if it weren't for the
fact that most applications call strchr() instead.

Also, on the other architectures index() and strchr() are identical,
meaning we have two identical pieces of code in the C library and
statically linked applications.

Solve this by naming the actual file strchr.[cS] and let it use
__strong_reference()/STRONG_ALIAS() to provide the index() routine. Do
the same for rindex()/strrchr().

This seems to make the C libraries and static binaries slightly smaller,
but this reduction in size seems negligible.
2012-01-03 07:14:01 +00:00
Sergey Kandaurov
744aebe369 Unset the environment variables associated with individual menu items
before invoking the kernel.

Quoting submitter:

The issue is with the new boot loader menu. It adds many loader variables
including ones that contain ANSI color escapes.

Obviously, these ANSI codes don't play well with serial consoles when
kenv(1) is executed without arguments (reports vary as to what happens,
but it's never pretty).

The net-effect is that kenv(1) no longer reports menu-related variables.

In essence, kenv(1) output should now appear the same as on RELENG_8
(which lacks the new boot loader and didn't use any such variables).
Thus, restoring serial console glory.

Submitted by:	Devin Teske <devin dott teske fisglobal.com>
MFC after:	2 weeks
2011-12-30 06:24:59 +00:00
Sergey Kandaurov
8f3f6f16e4 Clean up from the 4.x era.
In an example of boot command:
- rename wd(4) IDE disk drives name to ad(4) for the time being.
- update the used kernel path "/kernel" to the current default.
[It still worked occasionally by looking into the /boot/kernel directory,
so the resulting path was "/boot//kernel/kernel", with two slashes.]

Bump .Dd for this and previous changes.

MFC after:	1 week
2011-12-27 15:59:51 +00:00
Ed Schouten
39154992db Make the RTC checking for QEMU even more aggressive.
At work, where we use use KVM+QEMU, we notice that pxeboot is pratically
impossible because of network timeouts. This is due to the fact that the
RTC code makes aggressive jumps.

Two RTC reads does not seem to be sufficient. Change the code to check
for 8 identical RTC values.

Sponsored by:	Kumina bv
2011-12-21 16:47:01 +00:00
John Baldwin
f9a0145857 Allow boot0cfg to force a PXE boot via boot0 on the next boot.
- Fix boot0 to check for PXE when using the pre-set setting for the
  preferred slice.
- Update boot0cfg to use slice 6 to select PXE.  Accept a 'pxe' argument
  instead of a number for the 's' option as a way to select PXE as well.

Submitted by:	Andrew Boyer  aboyer averesystems
MFC after:	2 weeks
2011-12-20 15:19:29 +00:00
Gleb Smirnoff
663222f1d2 - Rename if_carp.ko to carp.ko.
- carp.ko depends on sha1.c
2011-12-16 14:28:34 +00:00
Ed Schouten
75da3c1a9b Replace inline static' by static inline'.
If I interpret the C standard correctly, the storage specifier should be
placed before the inline keyword. While at it, replace __inline by
inline in the files affected.
2011-12-13 14:06:01 +00:00
Andriy Gapon
a3295a8b09 zfsboot: print boot.config contents before parsing it
as parsing can be a destructive operation

MFC after:	2 weeks
2011-12-04 21:32:18 +00:00
Andriy Gapon
05b096ff61 zfs boot: allow file vdevs to be used in testing (e.g. with zfsboottest)
MFC after:	1 week
2011-12-04 21:29:56 +00:00
Andreas Tobler
6bac4c3e6a Rename the linker emulation name for powerpc and powerc64. This is needed that
we can also use the upstream binutils linker where we have to have a unique
name for the FreeBSD emulation.
2011-11-19 19:25:57 +00:00
Rafal Jaworowski
8817e1bffe Initial version of cesa(4) driver for Marvell crypto engine and security
accelerator.

The following algorithms and schemes are supported:
 - 3DES, AES, DES
 - MD5, SHA1

Obtained from:	Semihalf
Written by:	Piotr Ziecik
2011-11-19 16:30:06 +00:00
Martin Wilke
c807217cf2 - Add new loader_logo orbbw to default.conf
PR:		162608
Submitted by:	manolis
Approved by:	rwatson (mentor)
MFC after:	3 Days
2011-11-19 14:44:29 +00:00
Martin Wilke
ed706bb19c - Whitespaces fixed only
Approved by:	rwatson (mentor)
2011-11-19 14:42:06 +00:00
Marcel Moolenaar
1e6ca2a464 Wire the kernel text RWX, rather than RX. We're not quite ready
for having kernel text non-writable, because we still need to
apply relocations. On top of that, the PBVM page table has all
pages marked as RWX, so it's an inconsistency to begin with.
2011-11-17 15:51:03 +00:00
Rafal Jaworowski
a93c40bb62 Add DTS for the Freescale P2020DS.
Obtained from: Freescale
2011-11-17 12:08:12 +00:00
Marcel Moolenaar
48c7eb294f Add DTS for the Freescale P1020RDB. 2011-11-14 19:06:28 +00:00
Marcel Moolenaar
579905d87c Add DTS for the Freescale P3041DS. 2011-11-14 18:51:39 +00:00
John Baldwin
f43fc3fc9d Revert some debugging printfs that crept into 223695. 2011-11-09 14:37:47 +00:00
Sergey Kandaurov
0fc9f11d00 Remove the remnants of /stand/sysinstall.
loader.8:	Sync the default init_path list with kern/init_main.c.

NOTES:		Replace with /rescue/init in the INIT_PATH kernel option.
2011-11-03 12:03:03 +00:00
Sergey Kandaurov
3bedc94069 Remove the long reprecated ``/stand/sysinstall'' from the init_path.
It can be put back using the INIT_PATH config option or init_path
loader variable, if still needed (which I doubt).

MFC after:	1 week
2011-10-27 10:25:11 +00:00
John Baldwin
5b9e248af5 - Add a new header for the x86 boot code that defines various structures
and constants related to the BIOS Enhanced Disk Drive Specification.
- Use this header instead of magic numbers and various duplicate structure
  definitions for doing I/O.
- Use an actual structure for the request to fetch drive parameters in
  drvsize() rather than a gross hack of a char array with some magic
  size.  While here, change drvsize() to only pass the 1.1 version of
  the structure and not request device path information.  If we want
  device path information you have to set the length of the device
  path information as an input (along with probably checking the actual
  EDD version to see which size one should use as the device path
  information is variable-length).  This fixes data smashing problems
  from passing an EDD 3 structure to BIOSes supporting EDD 4.

Reviewed by:	avg
Tested by:	Dennis Koegel  dk neveragain.de
MFC after:	1 week
2011-10-25 19:54:06 +00:00
John Baldwin
4f88092408 Consolidate duplicate definitions of V86_CY() and V86_ZR() which check for
the carry and zero flags being set, respectively, in <btxv86.h> and use
them throughout the x86 boot code.
2011-10-25 19:45:12 +00:00
Pawel Jakub Dawidek
b65ede43fb With LOADER_MBR_SUPPORT defined and LOADER_GPT_SUPPORT undefined we would
never call disk_openmbr().

Submitted by:	avg
MFC after:	3 days
2011-10-20 15:46:54 +00:00
Pawel Jakub Dawidek
9838b8b0ee - Correctly read gang header from raidz.
- Decompress assembled gang block data if compressed.
- Verify checksum of a gang header.
- Verify checksum of assembled gang block data.
- Verify checksum of uber block.

Submitted by:	avg
MFC after:	3 days
2011-10-20 15:42:38 +00:00
Pawel Jakub Dawidek
5cb5be7a93 Fix missing return when LOADER_GPT_SUPPORT is defined, but LOADER_MBR_SUPPORT
is not.

MFC after:	3 days
2011-10-19 23:48:15 +00:00
Pawel Jakub Dawidek
81fdf04870 Always pass data size for checksum verification function, as using
physical block size declared in bp may not always be what we want.
For example in case of gang block header physical block size declared
in bp is much larger than SPA_GANGBLOCKSIZE (512 bytes) and checksum
calculation failed. This bug could lead to accessing unallocated
memory and resets/failures during boot.

MFC after:	3 days
2011-10-19 23:44:38 +00:00
Pawel Jakub Dawidek
8565a6f600 Never pass NULL block pointer when reading. This is neither expected nor
handled by lower layers like vdev_raidz, which uses bp for checksum
verification. This bug could lead to NULL pointer reference and resets
during boot.

MFC after:	3 days
2011-10-19 23:40:37 +00:00
Pawel Jakub Dawidek
f8d5a41b64 Don't mark vdev as healthy too soon, so we won't try to use invalid vdevs.
MFC after:	3 days
2011-10-19 23:37:30 +00:00
Dag-Erling Smørgrav
0f8284dd89 Look for /boot/config in addition to /boot.config, with the former taking
precedence over the latter if it exists.

MFC after:	3 weeks
2011-10-18 09:46:52 +00:00
Jayachandran C.
8291dd8a41 Support for booting XLP using FDT.
- update xlp_machdep.c to read arguments from FDT if FDT support is
  compiled in.
- define rmi_uart_bus_space, and use it as fdtbus_bs_tag
- update conf files for FDT support
- add default dts file xlp-basic.dts
2011-10-18 08:10:23 +00:00
Eitan Adler
36daf0495a - change "is is" to "is" or "it is"
- change "the the" to "the"

Approved by:	lstewart
Approved by:	sahil (mentor)
MFC after:	3 days
2011-10-16 14:30:28 +00:00
Andrew Thompson
1ed7864a7d Allow ixp425 boot2 to compile after r219452 2011-10-04 00:15:40 +00:00
Andriy Gapon
d560f3523c zfstest: rename to zfsboottest and move to tools
Approved by:	re (kib)
MFC after:	1 week
2011-09-16 08:22:48 +00:00
Andriy Gapon
918314631b gpt/zfs boot blocks: reduce optimizing CFLAGS to -O1
gpt and zfs boot blocks are not nearly as size-constrained as boot2
from which they inherited their current optimization and anti-optimization
options.  As such the current options do not provide any benefit, but
make debugging of the code much harder.
Also, it has been demonstrated that combination of -mrtd and
-fno-unit-at-a-time may result in mis-compilation of the boot code
with the current base gcc.

Additionally, intermediate assembly file filtering is removed for
zfsboot.

The new boot blocks are all compile- and boot- tested using qemu.
gptzfsboot is tested with real hardware.

Reported by:	Peter Jeremy <peterjeremy@acm.org> [miscompilation]
Discussed with:	bde, jhb
Tested by:	Sebastian Chmielewski <chmielsster@gmail.com> [gptzfsboot]
Approved by:	re (kib)
MFC after:	3 weeks
2011-09-13 14:03:55 +00:00
Andriy Gapon
b13391ced2 zfstest: cleanup the code, improve functionality and diagnostics
The utility is not connected to the build, so it should be safe
to update it.
To do: move the utility to tools/.
Some code is provided by Peter Jeremy <peterjeremy@acm.org>

Tested by:	Sebastian Chmielewski <chmielsster@gmail.com>,
		Peter Jeremy <peterjeremy@acm.org> (earlier versions)
Approved by:	re (kib)
MFC after:	4 days
2011-09-13 14:01:35 +00:00
Jaakko Heinonen
871ffe942d Restore behavior of the autoboot_delay="-1" boot menu setting to the
pre-r222417 state. The behavior was essentially reversed in r222417
which can cause confusion.

PR:		159775
Submitted by:	Devin Teske
Approved by:	re (kib)
2011-09-02 19:29:37 +00:00
Dmitry Morozovsky
796fc1b22f Add kern.cam.boot_delay description (with reasonable default) to
default/loader.conf

This should help people installing ${OS} to USB devices, where there are
frequently cases where kernel tries to mount root before actual umass sensing
is finished.

Reviewed by:	mav
Approved by:	re (kib)
MFC after:	1 week
2011-08-23 20:25:11 +00:00
Nathan Whitehorn
9f2c359f16 Add support for the Blu-Ray drive found in the Sony Playstation 3 and fix
some realted minor bugs in PS3 internal storage support.

Submitted by:	glevand <geoffrey.levand@mail.ru>
Approved by:	re (bz)
2011-08-14 00:20:37 +00:00
Dimitry Andric
f989887b32 Fix buffer overflow in sys/boot/common/util.c's printf(), when printing
large (>= 10^10) numbers.  In theory, 20 characaters should be enough,
but bump the buffer to 32 characters, so we have some room for the
future.

Reviewed by:	pjd
Approved by:	re (kib)
2011-08-08 20:53:04 +00:00
Craig Rodrigues
ded85b3037 Document the tftp.blksize variable added in src/lib/libstand/tftp.c.
Approved by: re	(kib)
Requested by: maxim
2011-07-25 21:52:17 +00:00
John Baldwin
7b4f570ca1 Note that the "kernel" variable in loader.conf is the name of a directory
containing a kernel under /boot and that it's default value is "kernel"
not "/boot/kernel/kernel".

PR:		docs/158992
Reported by:	Wayne Mitchell  wayne.mitchell.iz at gmail
Approved by:	re (kib)
MFC after:	1 week
2011-07-20 15:18:24 +00:00
Dimitry Andric
ce3fb79719 When building some of the boot loaders with clang, and DEBUG_FLAGS or
CFLAGS having '-g' in it, clang outputs several assembly directives that
are too new for our version of binutils.

Therefore, assemble the resulting .s files with clang instead.  A more
general solution can be implemented when a GNU as-compatible driver for
clang's integrated assembler appears.

Reported by:	dougb
2011-07-17 13:50:21 +00:00
Nathan Whitehorn
f683b68e5a Add support for booting PS3s from disk. This is still a little hackish until
we can find a way to get the information from petitboot or to guess it, so
the current algorithm is:

1. See if ps3disk3p1 (first GPT slice on OtherOS partition) exists, and if
   so try to boot it.
2. Otherwise, netboot.

Submitted by:	glevand <geoffrey.levand at mail dot ru >
2011-07-16 19:01:09 +00:00
Marius Strobl
fd70297a1d Since r219452 the alignment of __dmadat has changed, revealing that fsread()
bogusly casts its contents around causing alignment faults on sparc64 and
most likely also on at least powerpc. Fix this by copying the contents
bytewise instead as partly already done here. Solving this the right way
costs some space, i.e. 148 bytes with GCC and 16 bytes with clang on x86
there are still some bytes left there though, and an acceptable hack which
tricks the compiler into only using a 2-byte alignment instead of the native
one when accessing the contents turned out to even take up more space that.
2011-07-11 20:43:59 +00:00