Commit Graph

2679 Commits

Author SHA1 Message Date
Oleksandr Tymoshenko
72b5255edf Add interrupt for PL310 controller 2012-12-31 22:48:54 +00:00
Rui Paulo
a443a16906 Move the 64-bit _setjmp to lib/libstand. 2012-12-21 15:15:35 +00:00
Rui Paulo
e19caad7b1 Build a 64 bit version of the FICL library. This is need for a 64 bit
EFI bootloader (amd64 only for now).

This is not yet connected to the build.
2012-12-21 05:22:14 +00:00
Rui Paulo
d48fc6b377 amd64 only has rela sections. 2012-12-17 00:34:07 +00:00
Marius Strobl
c0c11f4c92 Restore pre-r234898 printing of boot loader and path.
MFC after:	3 days
2012-12-16 20:43:29 +00:00
Andrew Turner
d39894842b Ignore a warning in ubldr where clang doesn't understand the %D printf
specifier from libstand.
2012-12-15 21:47:05 +00:00
Oleksandr Tymoshenko
5874dee8b2 Add support for QEMU's version of Versatile Platform Board 2012-12-13 23:19:13 +00:00
Devin Teske
9d93dba489 Fix a regression caused by SVN r222417.
Prior to r222417, setting `password' in loader.conf(5) did not prevent boot
but instead only prevented changes to boot options by prompting for password
if autoboot failed or the user interrupted the countdown sequence.
After r222417 the same machine with `password' set in loader.conf(5) would no
longer boot without _always_ entering the password.

This patch restores the old (8.x and older) functionality for password in
loader.conf(5) while adding a new bootlock_password feature to replace the
edge-case should anybody desire the regressed functionality (HINT: great for
PXE servers and/or private distributions).

loader.conf(5) was updated to be more clear with-respect to password setting
(previous text was misleading).

Documentation (loader.conf(5) and check-password.4th(8)) has been updated to
include notes on the new bootlock_password setting.

Special thanks to Alex Verbod for bringing this to my attention and helping to
refine the loader.conf(5) text.

PR:		conf/170110
Submitted by:	Vitaly Zakharov <ded3axap@gmail.com>
Reviewed by:	Alexander Verbod <alexander.verbod@gmail.com>
2012-12-12 17:49:01 +00:00
Devin Teske
f785f59861 Add support for comma-separated values (whitespace-separated still supported).
PR:		conf/121064
Submitted by:	koitsu
Reviewed by:	jh
2012-12-10 15:29:56 +00:00
Devin Teske
7a50e936c0 Use ASCII characters for box/line characters in frames.4th
Committed with changes to support the following from loader.conf(5):
+ console="vidconsole comconsole" (not just console="comconsole")
+ boot_serial="anything" (not just boot_serial="YES")
+ boot_multicons="anything" (unsupported in originally-submitted patch)

PR:		conf/121064
Submitted by:	koitsu
Reviewed by:	gcooper, adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-12-09 15:25:34 +00:00
Rui Paulo
b9fab40a3d Typo in a comment. 2012-12-07 07:08:39 +00:00
Rui Paulo
695d911ee0 Make this work for 64 bit binaries. 2012-12-07 07:02:39 +00:00
Rui Paulo
6dbda21756 Remove dead code that clang refuses to compile. 2012-12-05 04:22:53 +00:00
Neel Natu
8e2c4dfdb2 Teach userboot to boot from ISO image files.
Reviewed by:	ae@, dfr@
Obtained from:	NetApp
2012-11-30 04:44:32 +00:00
Oleksandr Tymoshenko
4f6c4eb93a Add vchiq node 2012-11-30 03:16:45 +00:00
Oleksandr Tymoshenko
ee9b837148 - Implement "fdt mres" sub-command that prints reserved memory regions
- Add "fdt addr" subcommand that lets you specify preloaded blob address
- Do not pre-initialize blob for "fdt addr"
- Do not try to load dtb every time fdt subcommand is issued,
    do it only once
- Change the way DTB is passed to kernel. With introduction of "fdt addr"
    actual blob address can be not virtual but physical or reside in
    area higher then 64Mb. ubldr should create copy of it in kernel area
    and pass pointer to this newly allocated buffer which is guaranteed to work
    in kernel after switching on MMU.
- Convert memreserv FDT info to "memreserv" property of root node
    FDT uses /memreserve/ data to notify OS about reserved memory areas.
    Technically it's not real property, it's just data blob, sequence
    of <start, size> pairs where both start and size are 64-bit integers.
    It doesn't fit nicely with OF API we use in kernel, so in order to unify
    thing ubldr converts this data to "memreserve" property using the same
    format for addresses and sizes as /memory node.
2012-11-30 03:15:50 +00:00
Devin Teske
a3ed1123db Discussed at-length on -arch.
Make the following interface changes to my beastie boot menu:
+ Move boot options to a submenu
+ Add a new "Boot Single" menu item
+ Make "Boot" item and new "Boot Single" item reverse when boot_single is set
+ Add new "Load Defaults" item (in new "Boot Options" submenu) for overridding
  loader.conf(5) provided values with system defaults.

Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-11-28 18:35:46 +00:00
Tim Kientzle
2462328ee0 Print kernel args when booting the kernel. 2012-11-25 18:22:53 +00:00
Oleksandr Tymoshenko
ab11b7079a Make FDT blob compatible with Raspberry Pi firmware.
Rasperry Pi firmware has a set of hardcoded pathes it uses to fill
FDT with system-specific information like display resolution, memory
size, UART and SDHCI clocks, ethernet MAC address. Handle two of them:

- Add placeholder for ethernet MAC address
- Move display node out of "axi" node
2012-11-23 03:24:52 +00:00
Marius Strobl
c261e6bfe4 Fix build after r243245.
Submitted by:	trasz
2012-11-19 19:31:54 +00:00
Edward Tomasz Napierala
ed1f69514a Fix build on powerpc.
Reviewed by:	nwhitehorn
2012-11-19 01:15:32 +00:00
Devin Teske
b98ba21ac2 + This patch does not change user experience or functionality
+ Cleanup syntax, slim-down code, and make things more readable
+ Introduce new +c! operator and ilk to reduce heap usage/allocations
+ Add safemode_enabled? safemode_enable and safemode_disable functions
+ Add singleuser_enabled? singleuser_enable singleuser_disable functions
+ Add verbose_enabled? verbose_enable and verbose_disable functions
+ Centralize strings (also to reduce heap usage)

Reviewed by:	peterj, adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-11-16 01:24:11 +00:00
Andriy Gapon
4efe2886a5 boot: use packed attribute for edd_params* structures and their substructures
The sole purpose of this change is to make sure that sizeof produces
"canonical" sizes for these structures.  This is to avoid triggering
bugs in the BIOSes that properly handle only the canonical values of
input length provided to INT 13h AH=48h.
The canonical sizes are: 30 for v2, 66 for v3, etc.
Buggy BIOS code probably looks like:
if (input_length > 30) {   /* > v2 */
	assume that input length is 66 /* assume v3 or later */
}

This should fix boot problems at least on Supermicro X8DT6 and possibly
on P410i Smart Array Controller (as found in e.g. HP DL360 G7).

Reported by:	gnn, np, rstone
Debugged by:	rstone
Discussed with:	ae, np, rstone
MFC after:	4 days
2012-11-14 11:05:16 +00:00
Neel Natu
04f9c8ff32 Add a callback function to userboot.so to fetch a list of environment
variables and pass them to the kernel.

Reviewed by:	dfr
2012-11-12 22:38:54 +00:00
Devin Teske
d61579b8e7 Fix a stack leak in [unused] cycle_menuitem function while we're here
(required misconfiguration and/or missing environment vars to occur).

Reviewed by:	peterj, adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-11-12 18:38:54 +00:00
Yoshihiro Takahashi
5016be6c9e cosmetic changes to reduce diffs against i386. 2012-11-10 12:42:28 +00:00
Yoshihiro Takahashi
c224072d61 MFi386: r241300
i386 comconsole: don't loop forever if hardware doesn't respond

    - clear capability flags when hw timeouts
    - retire comc_started status variable and directly use c_flags to see
      if comconsole is selected for use
2012-11-10 12:38:06 +00:00
Yoshihiro Takahashi
f34d85e0ec MFi386: r241301
add detection of serial console presence to btx and boot2-like blocks
2012-11-10 12:25:27 +00:00
Yoshihiro Takahashi
9260abade3 MFi386: r241785
boot: use -march=i386 for both i386 and amd64 builds
2012-11-10 11:55:52 +00:00
Dimitry Andric
56eaeab499 Shrink boot2 by 8 bytes, by eliminating some unneeded instructions in
sio.S.  This is not particularly needed for head right now, but it is
intended to merge to stable/9, to fix boot2 build with clang there.

Reviewed by:	avg
MFC after:	3 days
2012-11-08 23:21:02 +00:00
Dimitry Andric
ff0d9e7dbf Put in a band-aid to get the pc98 bootstraps building, now clang is the
default compiler.  This has two parts:
- Make sys/boot/pc98/boot2 always build with gcc for now, until we can
  figure out a way to shrink it enough when building with clang.
- Since sys/boot/p98/cdboot uses .code16 directives, which are not yet
  supported by clang's integrated assembler, use -no-integrated-as,
  similar to sys/boot/i386/cdboot.

Reviewed by:	nyan
MFC after:	1 week
2012-11-07 19:51:53 +00:00
Devin Teske
6674efd728 Hook in new files menusets.4th and manual.
Approved by:	adrian (co-mentor) (implicit)
2012-11-07 02:14:03 +00:00
Devin Teske
58ba7ef189 Fix funny comment.
Approved by:	adrian (co-mentor) (implicit)
2012-11-06 19:51:54 +00:00
Devin Teske
479617e7ff Fix c/p error in comment.
Approved by:	adrian (co-mentor) (implicit)
2012-11-06 19:50:45 +00:00
Devin Teske
c4a25e9646 Add ontop of my existing boot loader Forth code, including support for
submenus. See menusets.4th(8) for additional details including examples.

Discussed on arch and recommended for inclusion at the devsummit.

This change does not alter the appearance or user experience, only enhances
possibilities.

Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-11-06 19:26:36 +00:00
Alexander Motin
f7203ece6d Fix loader crash when some unhalted exception happens during include
command execution.  In case of such unhandled exception, vmReset() inside
ficlExecC() flushes the VM state.  Attempt to return back to Forth after
that cause garbage dereference with unexpected results.  To avoid that
situation call vmThrow() directly instead of expecting Forth to do it.
2012-10-26 16:32:20 +00:00
Alexander Motin
572dc5cfc5 Remove new-line characters from the include() errors to make it consistent
with the rest of code.
2012-10-25 15:45:32 +00:00
Andrey V. Elsukov
f06e6159c3 When loader tries to open GPT partition, but partition table is not GPT,
then try automatically detect an appropriate partition type.

PR:		kern/172550
Tested by:	Ralf Wenk
2012-10-22 11:01:43 +00:00
Andrey V. Elsukov
9add094157 Add the flags parameter to the disk_open() function and DISK_F_NOCACHE
flag, that disables the caching of partition tables metadata.
Use this flag for floppies in the libi386/biosdisk driver.
2012-10-21 12:14:58 +00:00
Andriy Gapon
881a94fab8 boot: use -march=i386 for both i386 and amd64 builds
.. so that consistent compilation algorithms are used for both
architectures as in practice the binaries are expected to be
interchangeable (for time being).
Previously i386 used default setting which were equivalent to
-march=i486 -mtune=generic.
The only difference is using smaller but slower "leave" instructions.

Discussed with:	jhb, dim
MFC after:	29 days
2012-10-20 16:57:23 +00:00
Attilio Rao
a42ac676f5 Disconnect non-MPSAFE NTFS from the build in preparation for dropping
GIANT from VFS. This code is particulary broken and fragile and other
in-kernel implementations around, found in other operating systems,
don't really seem clean and solid enough to be imported at all.
If someone wants to reconsider in-kernel NTFS implementation for
inclusion again, a fair effort for completely fixing and cleaning it
up is expected.

In the while NTFS regular users can use FUSE interface and ntfs-3g
port to work with their NTFS partitions.

This is not targeted for MFC.
2012-10-17 11:30:00 +00:00
Attilio Rao
26c3f6d7e2 Disconnect non-MPSAFE CODAFS from the build in preparation for dropping
GIANT from VFS.

This is not targeted for MFC.
2012-10-16 10:09:21 +00:00
Attilio Rao
4b0bdbfd9b Disconnect non-MPSAFE XFS from the build in preparation for dropping
GIANT from VFS.

This is not targeted for MFC.
2012-10-16 10:04:00 +00:00
Attilio Rao
55793cdccf Disconnect non-MPSAFE PORTALFS from the build in preparation for dropping
GIANT from VFS.

This is not targeted for MFC.
2012-10-16 09:59:10 +00:00
Devin Teske
55f9ff659d Since the introduction of the new advanced boot menu (r222417), options like
"boot verbose", "single user mode", "ACPI" and more are now stateful boolean
menuitems rather than direct action-items.

A short-coming in this new menu system is that when a user sets a non-default
value in loader.conf(5), this non-default state is not reflected in the menu
-- leading to confusion as to whether the option was taking effect or not.

This patch adds dynamic menuitem constructors _and_ the necessary Forth
callbacks to initialize these stateful menuitems -- causing the aforementioned
menuitems to adhere to loader.conf(5) settings.

PR:		bin/172529
Approved by:	adrian (co-mentor)
MFC after:	21 days
2012-10-14 06:52:49 +00:00
Devin Teske
3c9898d95c Fix a typo (s/prefix/suffix/) and comment.
NOTE: This is in an unused portion of the menu framework.

Reviewed by:	eadler, adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-10-09 03:54:53 +00:00
Devin Teske
09bc77f513 Fix an oversight that cyclic menu items actually are zero-based and can
accommodate 10 different states.

Reviewed by:	eadler, adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-10-09 03:11:15 +00:00
Devin Teske
8d9cadfb22 Make the "Options:" separator-text configurable by setting $menu_optionstext.
Reviewed by:	eadler, adrian (co-mentor)
Approved by:	adrian (co-mentor)
MFC after:	3 days
2012-10-09 01:31:03 +00:00
Devin Teske
46aecc551b Add an echo to say we're "Booting..." when the overloaded "boot" Ficl word is
executed to better differentiate between loader-specific errors and kernel-
specific errors (if ever any of either).

This type of functionality hasn't been required before the introduction of the
advanced menu system (r222417). Adding this functionality will help different-
iate errors at the loader-level such as a BTX halt caused by heap exhaustion
and errors that may be involved with executing the kernel (wrong architecture
for example). A user can learn that messages before "Booting..." are related to
the loader(8) environment and it's Forth-ilk, while those after are not
related to loader(8) -- the point that loader(8) has ``left the building''.

This patch also includes a man-page update to color.4th(8) as the color logic
moves to a lower-level (from being included by beastie.4th to being included
by loader.4th).

After noticing a delay between execution of the overloaded "boot" FICL word and
the display of text on-screen, gcooper confirmed that the introduction of a
builtin memory test (disabled by adding hw.memtest.tests="0" to loader.conf(5))
was the cause of the delay.

This patch adds an echo to produce "Booting..." when the overloaded "boot" word
is executed (this includes from the interactive command-prompt on all arches,
from the menu system on arches that run the beastie menu, and even those arches
that run the menu but disable it by setting beastie_disable="YES" in
loader.conf(5)). When loader_color="YES" in loader.conf(5), the same message is
produced but in white text on a blue background (only the letters produced have
this background -- opposed to perhaps the entire line).
2012-10-08 23:02:35 +00:00
Devin Teske
999916a0d4 Comment and Copyright fixes/updates.
Reviewed by:	adrian (co-mentor)
Approved by:	adrian (co-mentor)
2012-10-07 15:37:30 +00:00
Andriy Gapon
38ba6e6ae5 add detection of serial console presence to btx and boot2-like blocks
Note that this commit slightly increases size of boot blocks.

Reviewed by:	jhb
Tested by:	Olivier Cochard-Labbe <olivier@cochard.me>
MFC after:	26 days
2012-10-06 20:08:29 +00:00
Andriy Gapon
fdb3d7b169 i386 comconsole: don't loop forever if hardware doesn't respond
- clear capability flags when hw timeouts
- retire comc_started status variable and directly use c_flags to see
  if comconsole is selected for use

Reviewed by:	jhb
Tested by:	Uffe Jakobsen <uffe@uffe.org>,
		Olivier Cochard-Labbe <olivier@cochard.me>
MFC after:	26 days
2012-10-06 20:04:51 +00:00
Andriy Gapon
4ecbcb6f49 boot/console: handle consoles that fail to probe
- clarify meaning of console flags
- perform i/o via a console only if both of the following conditions are met:
   o console is active (selected by user or config)
   o console flags that it can perform the operation
- warn if a chosen console can not work (the warning may go nowhere without
  working and active console, though)

Reviewed by:	jhb
Tested by:	Uffe Jakobsen <uffe@uffe.org>,
		Olivier Cochard-Labbe' <olivier@cochard.me>
MFC after:	26 days
2012-10-06 20:01:17 +00:00
Andriy Gapon
9d200697d7 zfsboot: simplify probe_drive() a little bit
The first discovered pool, whether it covers the whole boot disk or not,
is going to be first in zfs_pools list.  So there is no need at all
for spapp parameter.

This commit also fixes a bug where NULL would be assigned to NULL
pointer when probe_drive was called  with the spapp parameter of NULL.

MFC after:	21 days
2012-10-06 19:48:15 +00:00
Andriy Gapon
aae0c9de03 zfs boot: export boot/primary pool and vdev guid all the way to kenv
This is work in progress to for znextboot and it also provides
some convenient infrastructure.

MFC after:	20 days
2012-10-06 19:47:24 +00:00
Andriy Gapon
d39075208e zfs loader: treat plain pool name as a name of its root dataset
... as opposed to the previous behavior of treating it as boot
dataset (specified by bootfs or default)

MFC after:	19 days
2012-10-06 19:42:50 +00:00
Andriy Gapon
edfd4fce8f zfs boot spa_status: print bootfs for each reported pool
MFC after:	9 days
2012-10-06 19:42:05 +00:00
Andriy Gapon
164efe4010 boot/zfs: a small whitespace cleanup
MFC after:	5 days
2012-10-06 19:41:11 +00:00
Andriy Gapon
62c725a9db boot/zfs: call zfs_spa_init for all found pools
... and drop those for which it fails.
Also, add more sanity checking to the function.

MFC after:	16 days
2012-10-06 19:40:12 +00:00
Andriy Gapon
f152e0b5be zfsboot: use the same zfs dataset naming format as loader
Also, pool name alone now names a root dataset of the pool regardless
of bootfs property value.

MFC after:	15 days
2012-10-06 19:38:33 +00:00
Andriy Gapon
296e021066 zfs boot: add lszfs command to i386 loader
... to list child datasets of a specified dataset.
Dataset name should be provided in poolname/dsname format.

MFC after:	17 days
2012-10-06 19:27:54 +00:00
Andriy Gapon
74b3e265c7 zfs boot: add code for listing child datasets of a given dataset
- only filesystem datasets are supported
- children names are printed to stdout

To do: allow to iterate over the list and fetch names programatically

MFC after:	17 days
2012-10-06 19:27:04 +00:00
Andriy Gapon
84b339ac4c zfs boot: chose a "first" pool if none is explicitly requested
MFC after:	8 days
2012-10-06 19:25:40 +00:00
Andrey V. Elsukov
45ac30d5f8 Replace all references to loader_callbacks_v1 with loader_callbacks.
Suggested by:	grehan@
2012-10-03 17:20:34 +00:00
Andrey V. Elsukov
04773e8b75 Fix the style. 2012-09-30 13:17:33 +00:00
Andrey V. Elsukov
b3651aad67 Remember the file format of the last loaded module and try to use it for
next files.
2012-09-30 13:14:37 +00:00
Andrey V. Elsukov
95b2c05cf0 Reduce the number of attempts to detect proper kld format for the amd64
loader.
2012-09-30 12:24:15 +00:00
Andrey V. Elsukov
089afddef4 Fix disk_cleanup() to work without DISK_DEBUG too. 2012-09-30 07:52:40 +00:00
Andrey V. Elsukov
f9cd8b07a4 Almost each time when loader opens a file, this leads to calling
disk_open(). Very often this is called several times for one file.
This leads to reading partition table metadata for each call. To
reduce the number of disk I/O we have a simple block cache, but it
is very dumb and more than half of I/O operations related to reading
metadata, misses this cache.

Introduce new cache layer to resolve this problem. It is independent
and doesn't need initialization like bcache, and will work by default
for all loaders which use the new DISK API. A successful disk_open()
call to each new disk or partition produces new entry in the cache.
Even more, when disk was already open, now opening of any nested
partitions does not require reading top level partition table.
So, if without this cache, partition table metadata was read around
20-50 times during boot, now it reads only once. This affects the booting
from GPT and MBR from the UFS.
2012-09-29 16:47:56 +00:00
Andrey V. Elsukov
ab945379ed Disable splitfs support, since we aren't support floppies for a long
time. This slightly reduces an overhead, when loader tries to open
file that doesn't exist.
2012-09-29 15:08:55 +00:00
Andrey V. Elsukov
88a0dd24bf Make the loader a bit smarter, when it tries to open disk and the slice
number is not exactly specified. When the disk has MBR, also try to read
BSD label after ptable_getpart() call. When the disk has GPT, also set
d_partition to 255.  Mostly, this is how it worked before.
2012-09-28 10:49:41 +00:00
Yoshihiro Takahashi
a112b2d0e4 MFi386: revision 240637
loader/i386: replace ugly inb/outb re-implementations with cpufunc.h
2012-09-23 08:50:54 +00:00
Yoshihiro Takahashi
4794983d3e Cosmetic changes. 2012-09-23 08:46:44 +00:00
Andreas Tobler
777813c555 Implement elfN(reloc) for powerpc. With this change the kernel is now able to
resolve dependencies of modules at boot time and load additional modules when
needed.

MFC after:	1 week
2012-09-21 18:21:31 +00:00
Alexander Motin
1123f298f3 Fix panics on attempt to dereference uninitizlized pointer, returned via
'path' argument of ofw_parsedev() if devspec refers raw device with no path.

For example, `ls /pci@1f,0/ide@d/disk@0,0:a/` works fine, while
`ls /pci@1f,0/ide@d/disk@0,0:a` panicked before this change.
2012-09-18 15:38:42 +00:00
Andriy Gapon
a80a10b13b loader/i386: replace ugly inb/outb re-implementations with cpufunc.h
Use of __builtin_constant_p in a function that is only called via
a pointer is a good example of how out-of-date it was.

Suggested by:	bde
MFC after:	1 week
2012-09-18 08:53:11 +00:00
Andrew Turner
a7dc3573ca Add the Tegra2 DTS files. Now our dtc supports including other files use
this support to pull out the SoC specific parts of the dts file.
2012-09-17 07:14:07 +00:00
Grzegorz Bernacki
aa0ea9d07a Add support for MSI in interrupt controlller.
MSI are implemented via software interrupt. PCIe cards will write
into software interrupt register which will cause inbound shared
interrupt which will be interpreted as a MSI.

Obtained from:	Marvell, Semihalf
2012-09-14 10:05:01 +00:00
Grzegorz Bernacki
d65cdf4b9d Add support for Armada XP A0.
- Add functions to calculate clocks instead using hardcoded values
- Update reset and timers functions
- Update number of interrupts
- Change name of platform from db88f78100 to db78460
- Correct DRAM size and PCI IRQ routing in dts file.

Obtained from:	Semihalf
2012-09-14 09:55:19 +00:00
Tim Kientzle
181abccb96 The MBR data is not necessarily aligned. This is a problem on ARM. 2012-09-14 05:24:06 +00:00
Alexander Motin
a5174f1fb6 Make pxe device in lsdev really include device name, looking like this:
pxe0:    192.168.3.1:/storage/nfsroot/amd64
, instead of confusing and less useful:
      192.168.3.1:pxeboot
2012-09-12 21:00:37 +00:00
Andriy Gapon
7ae0dc79b7 zfs boot: add a size check for a value in fzap_lookup
MFC after:	25 days
2012-09-11 07:15:11 +00:00
Andriy Gapon
4b7fc6b08e zfs boot: print only an attribute name in fzap_list
... this matches mzap_list behavior

MFC after:	12 days
2012-09-11 07:13:58 +00:00
Andriy Gapon
e644b976b0 zfs boot: fix/replace fzap_rlookup implementation
The previous one was totally bogus as it used hash value of
_output_ variable as an index for searching...
The only reliable way to do a reverse lookup here is to iterate
over all entries.

MFC after:	15 days
2012-09-11 07:12:48 +00:00
Andriy Gapon
b6910e777e zfs boot: bring zap_leaf_chunk field names in sync with kernel code
This change is cosmetic.

MFC after:	10 days
2012-09-11 07:11:32 +00:00
Andriy Gapon
c0e2226ce5 boot: file_loadraw should strdup name argument
... the same way it's done for type argument.

MFC after:	2 weeks
2012-09-11 06:18:36 +00:00
Andriy Gapon
9d1889cd04 a bit of trailing whitespace cleanup
MFC after:	1 week
2012-09-11 06:15:55 +00:00
Andrey V. Elsukov
915e341bac Slightly reduce an overhead for the open() call in the zfsloader.
libstand(3) tries to detect file system in the predefined order,
but zfsloader usually is used for the booting from ZFS, and there is
no need to try detect several file system types for each open() call.
2012-09-11 04:54:44 +00:00
Andrey V. Elsukov
da1d05228c Handle LOADER_NO_DISK_SUPPORT knob in the arm and powerpc ubldr. 2012-09-09 11:40:37 +00:00
Andrey V. Elsukov
60dff4f9f8 Update according to the change of struct uboot_devdesc. 2012-09-09 11:37:17 +00:00
Andrey V. Elsukov
9efbc4f52e Build disk.c only when DISK_SUPPORT is enabled. 2012-09-09 11:34:27 +00:00
Andrey V. Elsukov
d958ec0ca3 Update uboot's disk driver to use new DISK API. 2012-09-09 11:33:06 +00:00
Andrey V. Elsukov
8be6260966 Use disk_fmtdev() and disk_parsedev() functions from the new DISK API. 2012-09-09 11:32:06 +00:00
Andrey V. Elsukov
6c96358f5f Make struct uboot_devdesc compatible with struct disk_devdesc. 2012-09-09 11:30:45 +00:00
Andreas Tobler
85fdca2d85 Fix loading of kernel modules at boot time for powerpc64.
Reported by:	Mathias Breuninger
MFC after:	1 week
2012-09-08 20:00:31 +00:00
Oleksandr Tymoshenko
1b1a53cf46 Add barebone Raspberry Pi port. Supported parts:
- Interrupts controller
  - Watchdog
  - System timer
  - Framebuffer (hardcoded resolution/bpp)
2012-08-30 20:59:37 +00:00
Jayachandran C.
8099aeffc3 Add correct range parameter in XLP DTS
r239274 added support for ranges. Update XLP DTS to provide the correct
range parameter for the XLP SoC bus.  Also fix bus_space_map method
for XLP bus space.

Submitted by:	Sreekanth M. <sreekanth.molagavalli@broadcom.com>
2012-08-21 09:37:23 +00:00
Marcel Moolenaar
45f83785e1 Build zfs on ia64 as well. We don't build a loader with zfs support
just yet, but building it makes sure we catch (build) regressions.
2012-08-18 23:23:14 +00:00
Marcel Moolenaar
ed57c9d3d3 Don't build the ski loader anymore. The code is not deleted just yet,
as it explains the distinction between the common and the platform-
specific code.
2012-08-18 23:17:42 +00:00
Andrey V. Elsukov
a05f1f2028 Add comment why the code has been disabled.
Requested by:	rpaulo
2012-08-16 06:45:58 +00:00
Andrey V. Elsukov
4b81189aff Some BIOSes return incorrect number of sectors, make checks less
strictly, to do not lost some partitions.

Reported by:	swills@
2012-08-15 12:01:13 +00:00
Andrey V. Elsukov
deafa47873 Rework r239232 to unbreak ZFS detection on MBR slices. 2012-08-15 10:11:29 +00:00
Andrey V. Elsukov
a188e43ef3 Explicitly terminate the string after strncpy(3). 2012-08-15 09:18:49 +00:00
Oleksandr Tymoshenko
e53470fee3 Merging of projects/armv6, part 10
- Support for Texas Instruments SoCs:
	- AM335x
	- OMAP4

- Kernel configs, DTS for Beaglebone and Pandaboard

Submitted by:	Ben Gray, Damjan Marion
2012-08-15 06:31:32 +00:00
Oleksandr Tymoshenko
9dfe4a1fa4 Merging of projects/armv6, part 9
Very basic support for Nvidia Tegra2: timer, interrupts, UART.

Submitted by:	Damjan Marion <dmarion@freebsd.org>
2012-08-15 06:06:43 +00:00
Oleksandr Tymoshenko
8dee0fd04c Merging of projects/armv6, part 8
r235162:

  Initial LPC32x0 support. Includes DTS file for Embedded Artists EA3250
  board.

  Peripherals currently supported:
  - Serial ports
  - Interrupt controller
  - Timers
  - Ethernet
  - USB host
  - Framebuffer (in conjunction with SSD1289 LCD controller)
  - RTC
  - SPI
  - GPIO

Submitted by:	Jakub Wojciech Klama <jceel@freebsd.org>
2012-08-15 05:37:10 +00:00
Oleksandr Tymoshenko
16694521fe Merging of projects/armv6, part 7
Add Marvell ARMADA XP support

Obtained from:	Marvell, Semihalf
2012-08-15 05:15:49 +00:00
Dag-Erling Smørgrav
e2082935f0 As discussed on -current, remove the hardcoded default maxswzone.
MFC after:	3 weeks
2012-08-14 17:01:21 +00:00
Dimitry Andric
6cad98e283 After r239066, reinitialize v86.ctl and v86.addr for int 13 EDD probing
in sys/boot/i386/libi386/biosdisk.c.  Otherwise, when DISK_DEBUG is
enabled, the DEBUG() macros will clobber those fields, and cause the
probing to always fail mysteriously when debugging is enabled.
2012-08-13 21:04:01 +00:00
Andrey V. Elsukov
9131425146 Restore the old behaviour. If requested partition is a BSD slice,
but d_partition isn't explicitly set, then try to open BSD label and its
first partition.
2012-08-13 13:33:21 +00:00
Andrey V. Elsukov
baf3d8bfeb Remove colons from the debug message, device name returned by the
disk_fmtdev() already has the colons.
2012-08-13 13:10:50 +00:00
Andrey V. Elsukov
42b577fe76 Unbreak booting from the true dedicated disks.
When we open the disk, check the type of partition table, that has
been detected. If this is BSD label, then we assume this is DD mode.

Reported by:	dim@
2012-08-13 13:08:30 +00:00
Andrey V. Elsukov
777085904e Add another debug message. 2012-08-12 14:32:30 +00:00
Andrey V. Elsukov
e6232c0dea Add more debug messages. 2012-08-12 14:16:21 +00:00
Andrey V. Elsukov
06f2b92916 As it turned out, there are some installations, where BSD label
contains partitions with type zero. And it has worked.
So, allow detect these partitions.

Reported by:	glebius
2012-08-07 09:22:46 +00:00
Andrey V. Elsukov
a2bdef2a84 Fix start offset calculation for the EBR partitions. 2012-08-06 08:54:06 +00:00
Andrey V. Elsukov
3db1bfd80d Bump USERBOOT_VERSION.
Requested by:	dfr
2012-08-05 17:04:58 +00:00
Yoshihiro Takahashi
7361df284b Reduce diffs against i386. 2012-08-05 14:48:55 +00:00
Andrey V. Elsukov
4c89da6c18 Teach the ZFS use new partitions API when probing.
Note: now ZFS does probe only for partitions with type "freebsd-zfs"
and "freebsd".
2012-08-05 14:48:28 +00:00
Andrey V. Elsukov
6f6aad97b6 Remove unneeded flag. 2012-08-05 14:38:53 +00:00
Andrey V. Elsukov
a86f714d15 Add offset field to the i386_devdesc structure to be compatible with
disk_devdesc structure. Update biosdisk driver to the new disk API.
2012-08-05 14:37:48 +00:00
Yoshihiro Takahashi
d68fc999de Reduce diffs against i386. 2012-08-05 14:11:07 +00:00
Yoshihiro Takahashi
72b179343b MFi386: the part of r219452 and r236405.
- bunch of variables are turned into uint8_t.
  - Remove unnecessary initializations.
2012-08-05 14:05:11 +00:00
Andrey V. Elsukov
95caf34849 When GPT signature is invalid in the primary GPT header, then try to
read backup GPT header.

Submitted by:	hrs (previous version)
2012-08-05 12:57:38 +00:00
Andrey V. Elsukov
2c6f04dc0a Introduce new API to work with disks from the loader's drivers.
It uses new API from the part.c to work with partition tables.

Update userboot's disk driver to use new API. Note that struct
loader_callbacks_v1 has changed.
2012-08-05 12:15:15 +00:00
Andrey V. Elsukov
9cef000008 Remove unused variables. 2012-08-05 11:59:46 +00:00
Andrey V. Elsukov
a0ff532148 Create the interface to work with various partition tables from the
loader(8). The following partition tables are supported: BSD label, GPT,
MBR, EBR and VTOC8.
2012-08-05 11:29:44 +00:00
Marius Strobl
614e309803 Pull the tier-2 card and change the sparc64 ZFS loader to no longer probe
all diskN aliases for providers (which more or less corresponds to how the
x86 version behaves) but instead probe only those listed in the boot-device
OFW environment variable. This has the following advantages:
- avoids otherwise unavoidable OFW warnings about failures to open disks
  for which aliases exist but no actual hardware is connected
- avoids issues due to different diskN naming schemes
- aligns us with Solaris

MFC after:	3 days
2012-07-27 18:23:11 +00:00
Andrey A. Chernov
283e000db4 Try to avoid all files dependence on the modification time of the large and
often modified directory created symbolic links points to - it cause
unnecessary full rebuilds each time make runs when directory is changed.
So do it only if symbolic link does not exists, which usually means that
objdir is clean anyway.

MFC after:      1 week
2012-07-26 10:10:54 +00:00
Warner Losh
15fda8888a Use the pin number rather than the hybrid pin number + name. 2012-07-15 05:35:14 +00:00
Devin Teske
d35c4b1d44 Fix domain.
Approved by:	emaste
2012-07-14 01:45:35 +00:00
Warner Losh
51763c6303 Generalize this for loading the loader into the SPI. Plus trim about
100 bytes from the binary with silly tricks.  Hope to get this small
enough to run on the models that have 4k SRAM.  We are close compiled
for the at91rm9200, but still need to trim for the target.
2012-07-07 04:55:42 +00:00
Warner Losh
1d4fae3825 Allow other SOCs to be compiled in, first step. 2012-07-07 04:51:59 +00:00
Warner Losh
c4a9bff135 Strip out the useless junk. All we really care about is the text,
data and bss sections.  All the rest is needed for normal binaries,
but boot loaders aren't normal.
2012-07-07 04:49:53 +00:00
Xin LI
a2953f767d MFV: Update zlib to 1.2.7.
(x86 assembler optimization disabled for now because it
requires the new .cfi_* directives that is not supported
by base system binutils).

MFC after:	1 week
2012-06-21 21:47:08 +00:00
John Baldwin
32abc7ddc1 Don't return an error if a kld does not contain any modules (e.g. a
kld that only contained a sysctl).  The kernel linker allows such
modules, so the boot loader should not reject them.

MFC after:	2 weeks
2012-06-20 21:06:51 +00:00
Martin Matuska
253a9c296c Fix ZFS boot with pre-features pools (version <= 28) broken in r236884
Reported by:	mav
MFC after:	1 month
2012-06-13 08:00:32 +00:00
Martin Matuska
2d9cf57e18 Introduce "feature flags" for ZFS pools (bump SPA version to 5000).
Add first feature "com.delphix:async_destroy" (asynchronous destroy
of ZFS datasets).
Implement features support in ZFS boot code.

Illumos revisions merged:
13700:2889e2596bd6
13701:1949b688d5fb
2619 asynchronous destruction of ZFS file systems
2747 SPA versioning with zfs feature flags

References:
https://www.illumos.org/issues/2619
https://www.illumos.org/issues/2747

Obtained from:	illumos (issue #2619, #2747)
MFC after:	1 month
2012-06-11 11:35:22 +00:00
Marius Strobl
10ee2f9a87 The loaddev environment variable is not modifiable once set, so it is not
update for ZFS. It seems that this does not really affect anything except
the help command. Nevertheless, rearrange things so loaddev is set only
once in all cases in order to get it right.
Pointed out by: avg

MFC after:	r235364
2012-06-04 20:56:40 +00:00
Marius Strobl
f6dd28dc27 The workaround added in r151650 for handling firmwares that don't allow
a single device to be opened multiple times concurrently unfortunately
isn't sufficient with ZFS. This is due to the fact, that ZFS may open
different partitions of a single device simultaneously. So the best we
can do in this case is to cache the lastly used device path and close
and open devices in ofwd_strategy() as needed.

PR:		165025
Submitted by:	Gavin Mu
MFC after:	1 week
2012-06-04 20:45:33 +00:00
John Baldwin
370b70dc03 Remove unnecessary initializations. The BSS of boot2 is in fact
zero'd when boot2 begins execution by the _start() routine in btxcsu.S.

MFC after:	1 week
2012-06-01 15:48:24 +00:00
Kevin Lo
544c5e5b53 Make sure that each va_start has one and only one matching va_end,
especially in error cases.
2012-05-29 01:48:06 +00:00
Tim Kientzle
81174e7872 Allow the load address used by ARM ubldr to be set via Make argument.
In particular, this simplifies scripts that build system
images.
2012-05-27 16:27:04 +00:00
Rafal Jaworowski
3eef23db5e Import DTS files for the upcoming DPAA QorIQ (PowerPC) support.
- P2041RDB
  - P3041DS
  - P5020DS

Obtained from:	Freescale
2012-05-25 20:43:38 +00:00
Gleb Kurtsou
491a40587d Use 32-bit ufs_ino_t instead of ino_t to keep boot2 small and prevent
unnecessary 64-bit math on 32-bit machines.

Sponsored by:	Google Summer of Code 2011
2012-05-25 09:36:39 +00:00
Warren Block
344c81a166 Fixes to man8 groff mandoc style, usage mistakes, or typos.
PR:		168016
Submitted by:	Nobuyuki Koganemaru
Approved by:	gjb
MFC after:	3 days
2012-05-24 02:24:03 +00:00
Grzegorz Bernacki
9c12d78912 Divide nand flash for DB6281 into two partitions. One for u-boot
and second one for general use.

Obtained from: Semihalf
Supported by:  FreeBSD Foundation, Juniper Networks
2012-05-22 09:27:57 +00:00
Grzegorz Bernacki
4ffd4dfe17 Add a new geom class which allows to divide NAND Flash chip
into partitions.

Partitions are created based on data in dts file which are
extracted and interpreted by slicer.

Obtained from: Semihalf
Supported by:  FreeBSD Foundation, Juniper Networks
2012-05-22 08:33:14 +00:00
Tim Kientzle
5f5ec09bfb Determine kernel load address dynamically from u-boot memory map.
The generic ELF loading code maps the kernel into low memory
by subtracting KERN_BASE.  So the copyin/copyout/readin functions
are always called with low addresses.  This code finds the largest
DRAM block from the U-Boot memory map and adds that base to
the addresses.

In particular, this fixes ubldr on AM3358, which has DRAM
mapped to 0x80000000 at power-on.
2012-05-20 18:07:35 +00:00
Grzegorz Bernacki
b91fab4255 Add architecture dependent code to support NAND Framework on Marvell SoCs.
Obtained from: Semihalf
Supported by:  FreeBSD Foundation, Juniper Networks
2012-05-18 14:41:14 +00:00
Devin Teske
4c4947ad9d Update contact info.
PR:		N/A (mentor approved)
Submitted by:	dteske
Reviewed by:	dteske (mentor approved)
Approved by:	emaste (mentor)
MFC after:	1 week
2012-05-17 20:00:34 +00:00
Grzegorz Bernacki
7f725bcd5c Import work done under project/nand (@235533) into head.
The NAND Flash environment consists of several distinct components:
  - NAND framework (drivers harness for NAND controllers and NAND chips)
  - NAND simulator (NANDsim)
  - NAND file system (NAND FS)
  - Companion tools and utilities
  - Documentation (manual pages)

This work is still experimental. Please use with caution.

Obtained from: Semihalf
Supported by:  FreeBSD Foundation, Juniper Networks
2012-05-17 10:11:18 +00:00
Tim Kientzle
c3a9b90973 Access the device tree blob via copyin/copyout.
The code previously assumed that copyin/copyout did no
address translation and that the device tree blob could
be manipulated in-place (with only a few adjustments for
the ELF loader offset).  This isn't possible on all platforms,
so the revised code uses copyout() to copy the device tree
blob into a heap-allocated buffer and then updates the
device tree with copyout().  This isn't ideal, since it
bloats the loader memory usage, but seems the only feasible
approach (short of rewriting all of the fdt manipulation
routines).
2012-05-17 04:04:48 +00:00
Andriy Gapon
76438db6a7 libpc98: unbreak after zfs-related changes in libi386 code
Pointyhat to:	avg
MFC after:	1 month
2012-05-13 11:34:05 +00:00
Andriy Gapon
0a56cdf866 zfs boot: cleanup remnants of temporary compat code
MFC after:	1 month
2012-05-13 10:54:43 +00:00
Andriy Gapon
dfc351d8e9 zfs boot code: mark spa_t arguments as const where they are used as such
MFC after:	1 month
2012-05-13 09:22:18 +00:00
Andriy Gapon
32df866434 sparc64/zfs boot: take advantage of new libzfsboot capabilities
Also drop the now unneeded compatibility shims.

Tested by:	marius
MFC after:	1 month
2012-05-12 20:27:33 +00:00
Andriy Gapon
f7f7b759f6 zfs boot code: use %j and uintmax_t instead %ll and uint64_t in printfs
This is to silence warnings that result from different definitions of
uint64_t on different architectures, specifically i386 and sparc64.

MFC after:	1 month
2012-05-12 20:23:30 +00:00
Andriy Gapon
0da23ac99d zfs boot: try to set vfs.root.mountfrom from currdev as a fallback
This way with the new zfsloader there is no need to explicitly set zfs
root filesystem either via vfs.root.mountfrom or fstab.
It should be automatically picked up from currdev which is by default
is set from bootfs.

Tested by:	Florian Wagner <florian@wagner-flo.net> (x86)
MFC after:	1 month
2012-05-12 09:07:41 +00:00
Andriy Gapon
1702e62f67 zfsboot/zfsloader: support accessing filesystems within a pool
In zfs loader zfs device name format now is "zfs:pool/fs",
fully qualified file path is "zfs:pool/fs:/path/to/file"
loader allows accessing files from various pools and filesystems as well
as changing currdev to a different pool/filesystem.

zfsboot accepts kernel/loader name in a format pool:fs:path/to/file or,
as before, pool:path/to/file; in the latter case a default filesystem
is used (pool root or bootfs).  zfsboot passes guids of the selected
pool and dataset to zfsloader to be used as its defaults.

zfs support should be architecture independent and is provided
in a separate library, but architectures wishing to use this zfs support
still have to provide some glue code and their devdesc should be
compatible with zfs_devdesc.
arch_zfs_probe method is used to discover all disk devices that may
be part of ZFS pool(s).

libi386 unconditionally includes zfs support, but some zfs-specific
functions are stubbed out as weak symbols.  The strong definitions
are provided in libzfsboot.
This change mean that the size of i386_devspec becomes larger
to match zfs_devspec.

Backward-compatibility shims are provided for recently added sparc64
zfs boot support.  Currently that architecture still works the old
way and does not support the new features.

TODO:
- clear up pool root filesystem vs pool bootfs filesystem distinction
- update sparc64 support
- set vfs.root.mountfrom based on currdev (for zfs)

Mid-future TODO:
- loader sub-menu for selecting alternative boot environment

Distant future TODO:
- support accessing snapshots, using a snapshot as readonly root

Reviewed by:	marius (sparc64),
		Gavin Mu <gavin.mu@gmail.com> (sparc64)
Tested by:	Florian Wagner <florian@wagner-flo.net> (x86),
		marius (sparc64)
No objections:	fs@, hackers@
MFC after:	1 month
2012-05-12 09:03:30 +00:00
Dimitry Andric
d681f8bf6c Fix sys/boot/i386/cdboot/cdboot.S compilation with clang after r235219.
This file uses .code16 directives, which are not yet supported by
clang's integrated assembler.

MFC after:	1 month
2012-05-11 18:07:23 +00:00
Warner Losh
498131c705 Add support for passing in the board ID.
# This doesn't implement the full Linux boot ABI for arm yet.
# since there's no ATAGs list passed in for r2, and r0 has
# boot options rather than 0 as specified in the standard.
# Commited code to the tree won't touch any of this anyway, but
# future code may be able to use this.
2012-05-11 14:45:29 +00:00
Warner Losh
9434786e88 Hack to unbreak boot2 for at91rm9200 boot loader. When the at91sam
code came in, it moved things around which wound up breaking the
build.  We have to do this bit of a hack to avoid duplication of a lot
of #defines.
2012-05-11 14:40:25 +00:00
Andriy Gapon
006d25ce15 MFi386: improve argument passing via btxldr
use related definitions in i386 bootargs.h

Reviewed by:	nyan, jhb
MFC after:	1 month
2012-05-11 09:46:17 +00:00
Tim Kientzle
9b1cb34ced Don't hang if there is no /cpus node in the device tree. 2012-05-11 04:18:39 +00:00
Andriy Gapon
3b135bc51c cdboot, pxeldr: make use of bootargs.h instead of redefining flag constants
Reviewed by:	jhb
MFC after:	1 month
2012-05-10 09:47:04 +00:00
Marius Strobl
e4b3eb5fe3 Use a non-tricky approach for building and installing zfsboot sharing
the Makefile with boot1.

Submitted by:	ru
2012-05-09 19:08:54 +00:00
Andriy Gapon
76df382c3a r235154 followup: add stddef.h for offsetof
MFC after:	1 month
2012-05-09 08:23:24 +00:00
Andriy Gapon
356c95812d i386 zfsloader: rename LIBZFS to LIBZFSBOOT
... to avoid name clash with the other libzfs

MFC after:	1 month
2012-05-09 08:07:08 +00:00
Andriy Gapon
a45337f99f i386 boot: consolidate MAXBDDEV definition
MFC after:	1 month
2012-05-09 08:05:50 +00:00
Andriy Gapon
29c8c4b0f5 btxldr: future-proof argument passing from boot1/2-ish to loader
Place the arguments at a fixed offset of 0x800 withing the argument area
(of size 0x1000).  Allow variable size extended arguments first of which
should be a size of the extended arguments (including the size
parameter).

Consolidate all related definitions in a new i386/common/bootargs.h header.

Many thanks to jhb and bde for their guidance and reviews.

Reviewed by:	jhb, bde
Approved by:	jhb
MFC after:	1 month
2012-05-09 08:04:29 +00:00
Andriy Gapon
5ef10e566c sys/boot: add common CTASSERT definition 2012-05-09 07:55:42 +00:00
Tim Kientzle
50ddc3c4f7 Ooops. Back out changes to main.c from r235094.
This change is specific to BeagleBone; I need to figure out how to
generalize this before committing.
2012-05-06 16:32:28 +00:00
Tim Kientzle
5bf877dace Don't call strcmp with a NULL pointer.
In particular, on the AM335x, which comes up with no memory
mapped to low addresses, dereferencing the NULL causes a crash.
2012-05-06 16:01:58 +00:00
Tim Kientzle
e56440a696 Remove some redundant register loads.
Discussed on:		arm@
2012-05-02 05:49:58 +00:00
Marius Strobl
2d75b8321f Add initial support for booting from ZFS on sparc64. At least on Sun Fire
V100, the firmware is known to be broken and not allowing to simultaneously
open disk devices, causing attempts to boot from a mirror or RAIDZ to cause
a crash. This will be worked around later. The firmwares of newer sun4u models
don't seem to exhibit this problem though.

Steps for ZFS booting:

1. create VTOC8 label
# gpart create -s vtoc8 da0

2. add partitions, f.e.:
# gpart add -t freebsd-zfs -s 60g da0
# gpart add -t freebsd-swap da0
resulting in something like:
# gpart show
=>        0  143331930  da0  VTOC8  (68G)
          0  125821080    1  freebsd-zfs  (60G)
  125821080   17510850    2  freebsd-swap  (8.4G)

3. create zpool
# zpool create bunker da0a
or for mirror/RAIDZ (after preparing additional disks as in steps 1. + 2.):
# zpool create bunker mirror da0a da1a
# zpool create bunker raidz da0a da1a da2a ...

4. set bootfs
# zpool set bootfs=bunker bunker

5. install zfsboot
# zpool export bunker
# gpart bootcode -p /boot/zfsboot da0

6. write zfsloader to the ZFS Boot Block (so far, there's no dedicated tool
for this, so dd(1) has to be used for this purpose)
When using mirror/RAIDZ, step 4. and the dd(1) invocation should be repeated
for the additional disks in order to be able to boot from another disk in
case of failure.
# sysctl kern.geom.debugflags=0x10
# dd if=/boot/zfsloader of=/dev/da0a bs=512 oseek=1024 conv=notrunc
# zpool import bunker

7. install system on ZFS filesystem
Don't forget to set 'zfs_load="YES"' and vfs.root.mountfrom="zfs:bunker" in
loader.conf as well as 'zfs_enable="YES"'in rc.conf.

8. copy zpool.cache to the ZFS filesystem
cp -p /boot/zfs/zpool.cache /bunker/boot/zfs/zpool.cache

9. set mountpoint
# zfs set mountpoint=/ bunker

10. Now, given that aliases for all disks in the zpool exists (check with
the `devalias` command on the boot monitor prompt) and disk0 corresponds
to da0 (likewise for additional disks), the system can be booted from the
ZFS with:
{1} ok boot disk0

PR:             165025
Submitted by:   Gavin Mu
2012-05-01 17:16:01 +00:00
Marius Strobl
e2a35695f8 Add a command for showing the heap usage.
PR:		165025
Submitted by:	Gavin Mu
MFC after:	1 week
2012-05-01 16:38:33 +00:00
Tim Kientzle
803a5133e8 Teach ubldr(8) about simple MBR partitioning. 2012-05-01 05:04:49 +00:00
Marius Strobl
1a7f270047 Add multiple inclusion protection.
PR:		165025
Submitted by:	Gavin Mu
MFC after:	1 week
2012-04-29 15:54:40 +00:00
Marcel Moolenaar
e7babf043f Build a 32-bit EFI loader on amd64. This to match the rest of the
code that is used to construct a loader (e.g. libstand, ficl, etc).

There is such a thing as a 64-bit EFI application, but it's not
as standard as 32-bit is. Let's make the 32-bit functional (as in
we can load and actualy boot a kernel) before solving the 64-bit
loader problem.
2012-04-20 15:01:23 +00:00
Andriy Gapon
85d5a233bd zfsboot: honor -q if it's present in boot.config
Before r228267 the option was honored but the original content of
boot.config was not preserved.  I tried to fix that but missed the idea.
Now the proper way of doing things is taken from i386/boo2.
Also, a comment is added to explain this a little bit unobvious
behavior.

Inspired by:	jhb
MFC after:	5 days
2012-04-16 10:43:06 +00:00
Andrey V. Elsukov
9dd5659756 Read backup GPT header from the last LBA only when primary GPT header and
table aren't valid. If they are ok, use hdr_lba_alt value to read backup
header. This will make gptboot happy when GPT used atop of some GEOM
provider, e.g. GEOM_MIRROR.

Reviewed by:	pjd
MFC after:	2 weeks
2012-04-12 12:37:53 +00:00
Andriy Gapon
bec9e056eb retrofit Safe Mode loader menu item actions
The menu item is now made completely independent with the ACPI item - most
modern systems seem to require ACPI and become even more "unsafe"
without it.
Safe Mode no longer disables APIC for the same reason.
kbdmux is not disabled as this feature has proven itself stable.

New actions:
- SMP is disabled in the Safe Mode now
- eventtimers are forced to periodic mode (some real and virtual systems
  seem to have problems otherwise)
- geom extra vigorous integrity checking is disabled, this is to
  facilitate migration from previous versions

Possible short term to do:
- make SMP switch a separate menu item
- restore APIC switch as a separate menu item

Longer term to do:
- turn various tweaks into separate menu items in a Safe Mode sub-menu

Please consider adding a safety tweak to Safe Mode when introducing
new major features or changes that may cause instabilities.

Discussed with:	jhb, scottl, Devin Teske
MFC after:	3 weeks (stable/9 only)
2012-04-06 09:36:22 +00:00
Nathan Whitehorn
7893b7f6dd Fix build after changes to trap headers. 2012-03-29 16:04:42 +00:00
Eitan Adler
50d675f7a9 Remove trailing whitespace per mdoc lint warning
Disussed with:	gavin
No objection from:	doc
Approved by:	joel
MFC after:	3 days
2012-03-29 05:02:12 +00:00
Marius Strobl
f7b9ae0882 Remove second consts in r233288 in order to appease C++ compilers.
While at it, remove some style(9) bugs in libkern.h.

Submitted by:	kan
2012-03-26 18:22:04 +00:00
Rafal Jaworowski
4350d77706 Improve FDT handling in loader(8) and make it more robust.
o Fix buffer overflows when using a long property body in node paths.
o Fix loop end condition when iterating through the symbol table.
o Better error handling during node modification, better problem reporting.
o Eliminate build time warnings.

Submitted by:	Lukasz Wojcik
Obtained from:	Semihalf
MFC after:	1 week
2012-03-22 20:34:26 +00:00
Marius Strobl
cc0c154ffb Declare the CRC lookup-tables const as they hardly should change at
run-time.
2012-03-21 20:55:21 +00:00
Marius Strobl
3e18d022e4 Use the common/shared CRC-32 implementation instead of duplicating it.
MFC after:	1 week
2012-03-21 20:53:47 +00:00
Rafal Jaworowski
04296b6f18 Improve device tree blob (DTB) handling in loader(8).
Enable using the statically embedded blob from the kernel, if present. The KLD
loaded DTB takes precedence, but they are both recognized and handled in the
same way.

Submitted by:	Lukasz Wojcik
Obtained from:	Semihalf
MFC after:	1 week
2012-03-20 13:08:57 +00:00
Marius Strobl
6c2b936bbb Declare some variables static in order to reduce the object size and
redo r232822 in a less hackish way. The latter now no longer breaks
compiling the x86 boot2 with clang.

MFC after:	1 week
2012-03-18 02:19:30 +00:00
Marius Strobl
fe245df2da Fix a bug introduced in r223938; on big-endian machines coping a 32-bit
quantum bytewise to the address of a 64-bit variable results in writing
to the "wrong" 32-bit half so adjust the address accordingly. This fix
is implemented in a hackish way for two reasons:
o in order to be able to get it into 8.3 with zero impact on the little-
  endian architectures where this bug has no effect and
o to avoid blowing the x86 boot2 out of the water again when compiling
  it with clang, which all sane versions of this fix tested do.
This change fixes booting from UFS1 file systems on big-endian machines.

MFC after:	3 days
2012-03-11 13:39:19 +00:00
Yoshihiro Takahashi
08cdfdf1de MFi386: revisions 232570 and 232754
Fix boot2 to handle boot config files that only contain a custom path to
  a loader or kernel.
2012-03-10 15:08:37 +00:00
Jung-uk Kim
de9dec16dd Make boot2 build with Clang again.
Submitted by:	dim (bsd.sys.mk)
Reviewed by:	dim, jhb
2012-03-09 23:30:30 +00:00
John Baldwin
8bf6dd98a7 Add a note to clarify why we create a relocated copy of boot1 in lower
memory.
2012-03-06 20:45:13 +00:00
Bjoern A. Zeeb
0566170f70 Provide wbwd(4), a driver for the watchdog timer found on various
Winbond Super I/O chips.

With minor efforts it should be possible the extend the driver to support
further chips/revisions available from Winbond.  In the simplest case
only new IDs need to be added, while different chipsets might require
their own function to enter extended function mode, etc.

Sponsored by:	Sandvine Incorporated ULC (in 2011)
Reviewed by:	emaste, brueffer
MFC after:	2 weeks
2012-03-06 18:44:52 +00:00
John Baldwin
ea6ed0ba9f Fix boot2 to handle boot config files that only contain a custom path to
a loader or kernel.  Specifically, kname cannot be pointed at cmd[] since
it's value is change to be an empty string after the initial call to
parse, and cmd[]'s value can be changed (thus losing a prior setting for
kname) due to user input at the boot prompt.  While here, ensure that that
initial boot config file text is nul-terminated, that ops is initialized
to zero, and that kname is always initialized to a valid string.

Tested by:	Domagoj Smolcic  rank1seeker of gmail
MFC after:	1 week
2012-03-05 19:53:17 +00:00
Rafal Jaworowski
aa15e881bb Respect phy-handle property in Ethernet nodes of the device tree.
This lets specify whereabouts of the parent PHY for a given MAC node
(and get rid of ugly kludges in mge(4) and tsec(4)).

Obtained from:	Semihalf
MFC after:	1 week
2012-03-04 19:22:52 +00:00
Jung-uk Kim
c2d486714d Fix a long standing bug. The caller expects a non-zero value for success.
Luckily keyboard probing was turned off by default from the first revision.

Submitted by:	Alexander Sack (asack at niksun dot com)
MFC after:	3 days
2012-02-29 18:11:33 +00:00
Dimitry Andric
07b202a847 Define several extra macros in bsd.sys.mk and sys/conf/kern.pre.mk, to
get rid of testing explicitly for clang (using ${CC:T:Mclang}) in
individual Makefiles.

Instead, use the following extra macros, for use with clang:
- NO_WERROR.clang       (disables -Werror)
- NO_WCAST_ALIGN.clang  (disables -Wcast-align)
- NO_WFORMAT.clang	(disables -Wformat and friends)
- CLANG_NO_IAS		(disables integrated assembler)
- CLANG_OPT_SMALL	(adds flags for extra small size optimizations)

As a side effect, this enables setting CC/CXX/CPP in src.conf instead of
make.conf!  For clang, use the following:

CC=clang
CXX=clang++
CPP=clang-cpp

MFC after:	2 weeks
2012-02-28 18:30:18 +00:00