Commit Graph

2713 Commits

Author SHA1 Message Date
Devin Teske
f8dfdfbf4c Update copyright. 2013-08-27 06:09:28 +00:00
Devin Teske
e44da61e69 Building upon SVN r254237, disable automated activation of alternate layouts
and add support for default underride to $loader_version, acting as a way to
name a release. Release text is not displayed for the aforementioned feature
of alternate display layout (introduced in r254237); however, for all other
layouts (incl. default), the release name is displayed at lower-right.

See version.4th(8) for additional information and/or historical details.
NOTE: Also a minor edit to version.4th(8) while we're here.
2013-08-26 23:37:11 +00:00
Jung-uk Kim
ce7707b487 Set the hint for physical address of RSDP in hexadecimal as before r223262. 2013-08-23 18:52:36 +00:00
Ian Lepore
aef60d8c4a Add support for uarts other than the serial console in TI OMAP SoCs.
The TI uart hardware is ns16550-compatible, except that before it can
be used the clocks and power have to be enabled and a non-standard
mode control register has to be set to put the device in uart mode
(as opposed to irDa or other serial protocols).  This adds the extra
code in an extension to the standard ns8250 probe routine, and the
rest of the driver is just the standard ns8250 code.
2013-08-21 14:33:02 +00:00
Ian Lepore
59769a581f Make the standard sdhci(4) driver work for the TI OMAP family SoCs.
The MMCHS hardware is pretty much a standard SDHCI v2.0 controller with a
couple quirks, which are now supported by sdhci(4) as of r254507.

This should work for all TI SoCs that use the MMCHS hardware, but it has
only been tested on AM335x right now, so this enables it on those platforms
but leaves the existing ti_mmchs driver in place for other OMAP variants
until they can be tested.

This initial incarnation lacks DMA support (coming soon).  Even without it
this improves performance pretty noticibly over the ti_mmchs driver,
primarily because it now does multiblock IO.
2013-08-20 12:33:35 +00:00
Devin Teske
ea14379eaa Add optional support for default override of standard setup; but only if
corresponding functions are provided. If override function does not exist,
boot remains unmodified. This patch should not result in any changes.
2013-08-12 03:52:23 +00:00
Marcel Moolenaar
d6c0f33b57 Fix the freaddir implementation for the stand-alone interpreter.
Bug pointed out by: Jan Beich <jbeich@tormail.org>
2013-08-09 19:10:56 +00:00
Devin Teske
5b502b3b4c Update legacy static assignments in old code to support dynamic framing,
plotting, and alignment coinciding with enhancements in SVN r242667.
2013-08-08 22:34:00 +00:00
Devin Teske
5e82c321f8 Since the introduction of SVN r244048 and [follow-up] r244089, it is now
safe to build upon ``boot_serial?'' functionality to make safer UI choices.
2013-08-08 22:09:46 +00:00
Andrey V. Elsukov
4371b649aa Make the check for number of entries less strict.
Some partitioning tools can create GPT with number of entries less
than 128.

MFC after:	1 week
2013-08-08 11:24:25 +00:00
Ganbold Tsagaankhuu
696ec285aa Bring initial support for Allwinner A20 SoC (Cubieboard2).
Add support for A20 timer.
	Correct interrupt offset depending from chip.
	Add basic code for CPU configuration module.
	For now, add kernel config and dts file
	(only FDT blob related problem needs to be solved later in
	order to have one kernel for both cubieboard1 and 2).

Approved by: ray@
2013-08-07 11:07:56 +00:00
Marcel Moolenaar
e01c6f329a Change <sys/diskpc98.h> to not redefine the same symbols that are
being defined in <sys/diskmbr.h>. Instead give the symbols here a
"PC98_" prefix. This way, both <sys/diskmbr.h> and <sys/diskpc98.h>
can be included in the same C source file.

The renaming is trivial. The only gotcha is that DOSBBSECTOR is
also redefined from 0 to 1. This because DOSBBSECTOR was always
used in conjunction with an addition of 1. The PC98_BBSECTOR symbol
is defined as 1 and the expression is simplified.

Note: it is not believed that ports are seriously impacted; or at
all for that matter.

Approved by: nyan@
2013-08-07 00:00:48 +00:00
Olivier Houchard
7497e6267c Let the platform calculate the timer frequency at runtime, and use that for
the omap4, instead of relying on the (wrong) value provided in the dts.
2013-08-05 20:14:56 +00:00
Marcel Moolenaar
04ae0d7cc5 Fix the build of the testmain target. This target compiles a Forth
interpreter that can be run on the system and as such cannot be
compiled against libbstand. On the one hand this means we need to
include the usual headers for system interfaces that we use and
on the the other hand we can only use standard system interfaces.

While here, define local variables only when needed to make this
WARNS=2 clean on amd64.

PR:		172542
Obtained from:	peterj@
Pointed out by: Jan Beich <jbeich@tormail.org>
2013-08-01 18:06:58 +00:00
Rui Paulo
caa18d0c6c Add definitions for the Mailbox, Spinlock and PRU-ICSS devices. 2013-07-31 06:23:10 +00:00
Tim Kientzle
9759c7e7d2 Put in commented-out version of beastie menu commands
so that non-i386 users can easily experiment with this.
2013-07-27 18:19:28 +00:00
Tim Kientzle
183abe44fa Install Forth infrastructure along with ubldr.
Note:  loader.rc is installed as loader.rc.sample
so that by default, none of this is actually used.
2013-07-27 18:18:46 +00:00
Marcel Moolenaar
68fd965f98 Add 2 builtin words for working with directories:
isdir?		( fd -- bool )
	freaddir	( fd -- ptr len TRUE | FALSE )

The 'isdir?' word returns `true' if the file descriptor is for a
directory and `false' otherwise.

The 'freaddir' word reads the next directory entry and if successful,
returns its name and 'true'. Otherwise 'false' is returned.

These words give the loader the ability to scan directories and read
files contained in them for 'rc.d'-like flexibility in handling which
modules to load and/or which tunables to set.

Obtained from:	Juniper Networks, Inc.
2013-07-10 21:37:50 +00:00
Andriy Gapon
e4616f7bfb default loader.conf: there is no need to load zpool.cache now
kernel does not need it for importing a root pool.

MFC after:	4 weeks
2013-07-09 08:40:05 +00:00
Oleksandr Tymoshenko
4bab064ca8 - MMC1 (internal eMMC) pins should be configured as input-pullup, except
for reset pin
2013-07-08 04:30:12 +00:00
Oleksandr Tymoshenko
36b2854b79 - Add musb node to shared dtsi and proper pin configuratin for every
AM553x-based device
2013-07-07 04:23:29 +00:00
Oleksandr Tymoshenko
ef2f66be5b Add nodes for PWMSS1 and PWMSS2 2013-07-04 20:08:42 +00:00
Warren Block
9ce127ad76 Add descriptions to the FILES list, fix some mdoc complaints, move the
"neither" entry out of the table in BOOTING.

Submitted by:	joeld
Reviewed by:	joeld
MFC after:	1 week
2013-07-03 18:53:36 +00:00
Warren Block
42c916d7ee Add a new gptboot(8) man page. Factor out the redundant information
in gpart(8) and boot(8), adding references to gptboot(8) in both.

Reviewed by:	jhb, ae, pjd, Paul Schenkeveld <bsdcan@psconsult.nl>, david_a_bright@dell.com (portions), gjb
MFC after:	1 week
2013-07-01 22:38:36 +00:00
Rui Paulo
236bc8374d Split bcm2835-rpi-b.dts into bcm2835.dtsi and rpi.dts. This DTS actually works
on all R-Pi models because VideoCore binary patches it during boot.

Reviewed by:	gonzo
2013-07-01 05:01:01 +00:00
Aleksandr Rybalko
83bee1a9ba Add FDT for Arndale board and Samsung Exynos5250 SoC.
Submitted by:	Ruslan Bukin <br@bsdpad.com>
2013-06-29 12:24:11 +00:00
Marius Strobl
2fbad3a135 - The method introduced as part of r234898 for not altering the boot path
when booting from ZFS turned out to also cause the boot path not being
  adjusted if booting from CD-ROM with firmware versions that do not employ
  the "cdrom" alias in that case. So shuffle the code around instead in order
  to achieve the original intent. Ideally, we shouldn't fiddle with the boot
  path when booting from UFS on a disk either; unfortunately, there doesn't
  seem to be an universal way of telling disks and CD-ROMs apart, though. [1]
- Use NULL instead of 0 for pointers.

PR:		179289
MFC after:	1 week
2013-06-09 23:50:30 +00:00
Tijl Coosemans
53089271a1 Convert old make variable modifiers :U and :L to bmake :tu and :tl.
Reviewed by:	sjg
2013-06-02 11:44:23 +00:00
Yoshihiro Takahashi
9a068b2e34 MFi386: revision 245848
Always update the hw.uart.console hint.
2013-06-01 12:27:48 +00:00
Oleksandr Tymoshenko
b0dcf6c59c Add DTS for AM335x EVM with properly muxed PWM and LCD pins, and
LCD panel description
2013-05-27 00:26:29 +00:00
Oleksandr Tymoshenko
2389b66f69 Add PWM and LCDC nodes to base DTS for AM335x-based devices 2013-05-27 00:23:59 +00:00
Tim Kientzle
3f15ba3d2c Correct the spelling of "okay".
Add pinmux setting for the Reset GPIO pin for MMC1.
2013-05-18 12:54:37 +00:00
Tim Kientzle
2628555d5f Move 'compatible' line out of the common am335x.dtsi and into
the beaglebone-specific .dts file.

Add a new .dts for the BeagleBone Black with more memory,
slightly different pinmux initialization, and with mmchs1
configured (though the latter doesn't quite work yet).
2013-05-10 05:34:08 +00:00
John Baldwin
6c14193bd0 Don't pad disk partition sizes with leading zeros. This was already
fixed in a different way by the new disk code used for other
platforms.

MFC after:	1 week
2013-05-07 18:08:49 +00:00
Grzegorz Bernacki
99eef68204 Move initialization of CESA decoding windows from common section
to driver specific files.

- window initialization is done during device attach
- CESA TDMA decoding windows values are set based on DTS,
 not copied from CPU registers
- remove unnecessary virtual mapping
- update dts file

Obtained from: Semihalf
2013-05-06 13:34:36 +00:00
Wojciech A. Koszek
a9caca6a75 Add Xilinx Zynq ARM/FPGA SoC support to FreeBSD/arm port.
Submitted by:	Thomas Skibo <ThomasSkibo (at) sbcglobal.net>
Reviewed by:	wkoszek, freebsd-arm@ (no objections raised)
2013-04-27 22:38:29 +00:00
Oleksandr Tymoshenko
145f6092b9 Move pinmux configuration to board-specific config. It will vary
from board to board.
2013-04-26 17:27:53 +00:00
Dimitry Andric
dbfc29017c When rebooting (exiting) from the BTX loader, make sure to restore the
GDT from the correct segment, otherwise a triple fault would be caused.
In some virtual environments (VMware, VirtualBox, etc) this could lead
to a unhandled error or hang in the guest emulation software.

Thanks to avg and jhb for a few hints in the right direction.

Noticed by:	Jeremy Chadwick <jdc@koitsu.org> (and many others)
MFC after:	1 week
2013-04-24 17:20:45 +00:00
Oleksandr Tymoshenko
833addedf8 Split BeagleBone DTS to generic AM335x part and Beagle-bone specific 2013-04-22 18:53:36 +00:00
Andrey V. Elsukov
584a9cf8bf Since we didn't break the loop, we should set i to -1 to start from the
beginning.

Submitted by:	Steven Hartland
MFC after:	1 week
2013-04-21 09:10:35 +00:00
Tim Kientzle
a58e544f50 The CELL fields can be various integer types depending on the platform
(ARM uses 'int' and 'unsigned'; i386 uses 'long' and 'unsigned long'),
so we need explicit casts to long and unsigned long here to ensure
that the result matches the printf %ld and %lx specifiers.
2013-04-07 05:53:42 +00:00
Tim Kientzle
6f3d2cdd00 Fix two broken macros. 2013-04-07 05:40:49 +00:00
Andriy Gapon
a77cf1025c strncmp for boot code: fix an off by one error
Before this change strncmp would access and _compare_ n+1 characters
in the case where the first n characters match.

MFC after:	5 days
2013-04-05 09:14:30 +00:00
Ian Lepore
6fb87f7371 When running on armv6, set alignment checking to modulo-4 mode rather
than modulo-8, because clang emits ldrd and strd instructions for
addresses that are only 4-byte aligned
2013-03-31 22:43:16 +00:00
Tim Kientzle
2f37ec8b30 Initialize sym_count to 0.
This fixes a compiler warning introduced in r248121.
2013-03-30 16:33:16 +00:00
Aleksandr Rybalko
a2c472e741 Integrate Efika MX project back to home.
Sponsored by:	The FreeBSD Foundation
2013-03-20 15:39:27 +00:00
Ian Lepore
7554e820bb Attach the elf section headers to the loaded kernel as metadata, so
they can easily be used by later post-processing.  When searching for
a compiled-in fdt blob, use the section headers to get the size and
location of the .dynsym section to do a symbol search.

This fixes a problem where the search could overshoot the symbol
table and wander into the string table.  Sometimes that was harmless
and sometimes it lead to spurious panic messages about an offset
bigger than the module size.
2013-03-10 00:43:01 +00:00
Ian Lepore
dd9b8b36dd Since ubldr doesn't necessarily load a kernel at the physical address in the
elf headers, mask out the high nibble of that address.  This effectly makes
the entry point the offset from the load address, and it gets adjusted for
the actual load address before jumping to it.

Masking the high nibble makes assumptions about memory layout that are true
for all the arm platforms we support right now, but it makes me uneasy.
This needs to be revisited.
2013-03-09 23:05:19 +00:00
Ganbold Tsagaankhuu
341d7df3da Enable uart driver for A10.
Approved by: gonzo@
2013-03-01 01:47:11 +00:00
Ian Lepore
62e939ea17 Fix a typo that prevented booting a kernel that had virtual addresses in
the elf headers.
2013-02-27 19:59:41 +00:00
Ian Lepore
c6f9cfb723 Adjust the arm kernel entry point address properly regardless of whether the
e_entry field holds a physical or a virtual address.  Add a comment block
that explains the assumptions being made by the adjustment code.
2013-02-26 03:24:45 +00:00
Tim Kientzle
6d4a620eba Fix the bug I introduced in r247045.
After digging through more carefully, it looks like there's
no real need to have the DTB in the module directory.
So we can simplify a lot:  Just copy DTB into local heap
for "fdt addr" and U-Boot integration, drop all the extra
COPYIN() calls.

I've left one final COPYIN() to update the in-kernel DTB
for consistency with how this code used to work, but I'm
no longer convinced it's appropriate here.

I've also remove the mem_load_raw() utility that I added
to boot/common/module.c with r247045 since it's no longer
necessary.
2013-02-25 01:50:04 +00:00
Oleksandr Tymoshenko
c84251eb7e - Move dma, sdhci and mbox nodes down in dts in order to get them
initialized after FPIO controller since they might rely on GPIO
    functionality

- Update interrupts property of dma node to contain all allocated
    interrupts
2013-02-23 23:22:48 +00:00
Tim Kientzle
3bb97cef07 "fdt addr" gets run from loader.rc before the kernel is loaded.
This was broken by r247045 which tried to copy the FDT into the
module directory immediately.
Instead, store the address and arrange for the FDT to get
copied into the module directory later when the usual
FDT initialization runs.
2013-02-23 20:34:47 +00:00
Tim Kientzle
7beaf3ae9b Print kernel args as late as possible before jumping into kernel. 2013-02-23 20:27:03 +00:00
Konstantin Belousov
31a53cd036 Convert machine/elf.h, machine/frame.h, machine/sigframe.h,
machine/signal.h and machine/ucontext.h into common x86 includes,
copying from amd64 and merging with i386.

Kernel-only compat definitions are kept in the i386/include/sigframe.h
and i386/include/signal.h, to reduce amd64 kernel namespace pollution.
The amd64 compat uses its own definitions so far.

The _MACHINE_ELF_WANT_32BIT definition is to allow the
sys/boot/userboot/userboot/elf32_freebsd.c to use i386 ELF definitions
on the amd64 compile host.  The same hack could be usefully abused by
other code too.
2013-02-20 17:39:52 +00:00
Tim Kientzle
f87223581e Fix "fdt addr" to accept literal addresses rather than va offsets.
When initializing the fdt, query U-Boot as well.

With this change, it is now feasible to have U-Boot load
the FDT, ubldr will pull it from U-Boot and hand it to the
kernel.
2013-02-20 16:32:38 +00:00
Tim Kientzle
3e256ed764 Add mem_load_raw() for loading data from another location in memory.
This will be used by some upcoming changes to loader(8) FDT
handling to allow it to use an FDT provided by an earlier
boot stage the same as an FDT loaded from disk.
2013-02-18 23:13:13 +00:00
Tim Kientzle
3772ab21ab Clarify an error message. The addresses here are
really offsets within the primary mapped memory block
(which may not start at address zero).
2013-02-18 20:11:20 +00:00
Oleksandr Tymoshenko
aaa54dd138 Enable USB1 (which is EHCI0) for Allwinner A10
Tested by: ganbold@
2013-02-15 21:29:03 +00:00
Oleksandr Tymoshenko
3748deb755 Add watchdog driver for Allwinner A10 2013-02-11 11:31:23 +00:00
Tim Kientzle
53d21f0bbe Provide verbose help for fdt commands on platforms that use it. 2013-02-11 02:15:26 +00:00
Andrey V. Elsukov
c6e31e81e0 Add bootcamp support to the loader.
Tested by:	dchagin
MFC after:	1 week
2013-02-10 19:27:17 +00:00
Hans Petter Selasky
6950c75f40 - Move scratch data from the USB bus structure to the USB device structure
so that simultaneous access cannot happen. Protect scratch area using
the enumeration lock. Also reduce stack usage in usbd_transfer_setup()
by moving some big stack members to the scratch area. This saves around
200 bytes of stack.
- Fix a whitespace.

MFC after:	1 week
2013-02-10 10:56:13 +00:00
Hans Petter Selasky
c3400997c4 Correctly list the usbloader dependencies. 2013-02-08 23:13:46 +00:00
Andrew Turner
f892543501 * Add the integer div & mod functions and ARM EABI support functions to
libstand.
* Stop linking the ARM U-Boot loader against libgcc now libstand has the
  required symbols.
2013-02-05 20:03:58 +00:00
Hans Petter Selasky
9b3a48ee6f Add defines to more easily allow a single threaded version of the FreeBSD
USB stack. This is useful for non-kernel purposes, like the loader.
2013-02-05 14:44:25 +00:00
Hans Petter Selasky
4b037d67aa Fix depend target. 2013-02-05 12:37:50 +00:00
Ganbold Tsagaankhuu
d9a1428cab Add gpio driver and update dts and kernel config accordingly.
Approved by: gonzo@
2013-02-05 02:25:13 +00:00
Hans Petter Selasky
77a9c69878 Initial version of libusbboot, a fully stand-alone, single threaded and
functional compilation of the FreeBSD USB stack for use with boot loaders
and such.

Discussed with:		Hiroki Sato, hrs @ EuroBSDCon
2013-01-31 11:00:57 +00:00
Ian Lepore
33f9e1bd94 Do metadata relocation fixup on all loaded modules, not just the kernel.
Approved by:	cognet (mentor)
2013-01-30 23:49:36 +00:00
Ganbold Tsagaankhuu
458690fe41 Add simple clock driver and ehci glue code for a10
Update dts and kernel config

Approved by: gonzo@
2013-01-29 07:21:50 +00:00
Damjan Marion
d6f0d96723 Configure all GPIO pins as described in Beaglebone SRM.
Submitted by:   Emmanuel Vadot <elbarto@megadrive.org>
2013-01-28 09:47:00 +00:00
Ian Lepore
ecfc48a031 Add support for the GlobalScale Technologies DreamPlug computer.
This adds support for version 10, revision 01, but it should also work
without changes for the 0901 model, at least until we get drivers for the
two different wifi chips involved.

Many users contributed to and tested the various patchsets floating around
for the past year that have eventually evolved into this checkin, most notably
Richard Neese who provided the bulk of the kernel config file.

Approved by:	cognet (mentor)
2013-01-27 01:17:37 +00:00
Ganbold Tsagaankhuu
c0c4446155 Fix method of naming compatible string to follow
"<manufacturer>,<model>" as described in
http://www.devicetree.org/Device_Tree_Usage

Reviewed by: andrew@
Approved by: gonzo@
2013-01-25 07:21:22 +00:00
John Baldwin
44e54f208a Always update the hw.uart.console hint anytime a change is made to the
comconsole setup.  Previously the hint would be set when if you set a
custom port, but it would not be updated if you later set a custom speed.

Also, leave the hw.uart.console hint mutable so it can be overridden or
unset by the user if needed.

Reviewed by:	kib (earlier version)
MFC after:	1 week
2013-01-23 18:34:21 +00:00
Benno Rice
5660634004 Fix linking of loader.efi.
gcc handles -symbolic by passing -Bsymbolic through to ld. clang ignores
-symbolic and thus invokes ld without -Bsymbolic which leads to some symbols
not being properly linked in loader.efi. Fix this by using -Wl,-Bsymbolic which
passes -Bsymbolic to ld in both the gcc and clang cases.

Approved by:	rpaulo
2013-01-22 04:14:27 +00:00
Tim Kientzle
6f91e2520b Use correct size for AM335x CPSW memory window. 2013-01-21 01:02:49 +00:00
Andriy Gapon
4afa5361cc zfs/sparc64 boot: fix booting after r242230
arch_zfs_probe method is supposed to only probe for ZFS vdevs, but it can
not expect that ZFS data is in a ready state yet.
So, move some code from sparc64_zfs_probe to main to meet the constraints.

Reported by:	Chris Ross <cross+freebsd@distal.com>
Tested by:	Chris Ross <cross+freebsd@distal.com>
MFC after:	4 days
2013-01-20 19:55:49 +00:00
Andrew Turner
6c71f24345 Link against compiler-rt to pull in the required __aeabi_* functions 2013-01-19 22:12:57 +00:00
Tim Kientzle
3f67e83a60 Use correct GPIO interrupt lines. 2013-01-19 17:22:12 +00:00
Ganbold Tsagaankhuu
ebc93265c7 Initial support for Allwinner A10 SoC (Cubieboard)
Add simple console driver
	Add interrupt handling and timer codes
	Add kernel config file
	Add dts file
Approved by: gonzo
2013-01-15 08:26:16 +00:00
Sean Bruno
b9fd59b70c Quiesce some clang warnings while we're here doing stuff.
Submitted by:	Hiren Panchasara <hiren.panchasara@gmail.com>
Obtained from:	Yahoo! Inc
2013-01-14 15:05:22 +00:00
Peter Grehan
fc1ae0bc42 Bring in some userboot changes from the bhyve branch to reduce diffs.
r238966
  Bump up the heap size to 1MB. With a few kernel modules, libstand
  zalloc and userboot seem to want to use ~600KB of heap space, which
  results in a segfault when malloc fails in bhyveload.

r241180
  Clarify comment about default number of FICL dictionary cells.

r241153
  Allow the number of FICL dictionary cells to be overridden.
  Loading a 7.3 ISO with userboot/amd64 takes up 10035 cells,
  overflowing the long-standing default of 10000.

  Bump userboot's value up to 15000 cells.

Reviewed by:	dteske (r238966,241180)
Obtained from:	NetApp
2013-01-08 03:27:37 +00:00
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