Commit Graph

350 Commits

Author SHA1 Message Date
Rafal Jaworowski
0ed948780c Initial support of loader(8) for ARM machines running U-Boot.
This uses the common U-Boot support lib (sys/boot/uboot, already used on
FreeBSD/powerpc), and assumes the underlying firmware has the modern API for
stand-alone apps enabled in the config (CONFIG_API).

Only netbooting is supported at the moment.

Obtained from:	Marvell, Semihalf
2008-10-14 10:11:14 +00:00
Marius Strobl
4028a36726 Revert r177108 and restore r60506 for sparc64 as long as libstand
isn't fixed to only open the network device once and not do a open
and close dance on every file access; the firmwares of newer sparc64
machines perform an auto-negotiation with every open which in turn
causes netbooting to take horribly long if we open and close the
device over and over again.
2008-09-10 20:53:22 +00:00
Rafal Jaworowski
387a29b78d Show info about net devices in loader's 'lsdev' command. While there fix style. 2008-09-03 17:41:44 +00:00
Colin Percival
5fe69bb518 Setting a variable to the same value twice doesn't actually make it
more likely to have the right value.  Remove superfluous assignments.

Found by:	LLVM/Clang Static Checker
2008-08-04 06:39:52 +00:00
Konstantin Belousov
7e44e88a84 Fix the incorrect calculation of a block address within a single indirect
block.

PR:	108215
Submitted by:	Yuichiro Goto, y7goto gmail com
MFC after:	2 weeks
2008-06-07 05:49:24 +00:00
Rafal Jaworowski
7572ed5a08 Eliminate artificial increasing of 'netdev_opens' counter in loader's net_open().
This was introduced as a workaround long time ago for some Alpha firmware
(which is now gone), and actually prevented net_close() to ever be
called.

Certain firmwares (U-Boot) need local shutdown operations to be performed on a
network controller upon transaction end: such platform-specific hooks are
supposed to be called via netif_close() (from within net_close()).

This change effectively reverts the following CVS commit:

    sys/boot/common/dev_net.c

    revision 1.7
    date: 2000/05/13 15:40:46;  author: dfr;  state: Exp;  lines: +2 -1
    Only probe network settings on the first open of the network device.
    The alpha firmware takes a seriously long time to open the network device
    the first time.

Also suppress excessive output while netbooting via loader, unless debugging.

While there, make sys/boot/uboot more style(9) compliant.

Reviewed by:	imp
Approved by:	cognet (mentor)
2008-03-12 16:01:34 +00:00
Marcel Moolenaar
e641a443f4 Add __elfN(relocation_offset). It holds the offset between the virtual
(link) address and the physical (load) address. Ideally, the mapping
between link and load addresses should be abstracted by the copyin(),
copyout() and readin() functions, so that we don't have to add kluges
in __elfN(loadimage)(). Then, we could also have paged virtual memory
for the kernel. This can be important under EFI, where you need to
allocate physical memory form the firmware if you want to work in all
scenarios.
2008-02-23 18:33:50 +00:00
Ruslan Ermilov
a10b45505a Document the per-arch default value of kern.maxbcache. 2007-11-08 11:59:38 +00:00
John Baldwin
fd6d060f0d Use the smaller cgbase() macro in ufsread.c if UFS_SMALL_CGBASE is
defined.  This lets each boot program choose which version of cgbase() it
wants to use rather than forcing ufsread.c to have that knowledge.

MFC after:	1 week
Discussed with:	imp
2007-10-26 21:02:31 +00:00
Warner Losh
8d7b90cdd7 The arm boot code uses this function as well. Redefining cgbase()
saves about 500 bytes in the boot code.  While the AT91RM9200 has 12k
of space for the boot loader, which is more than i386's 8k, the code
generated by gcc is a bit bigger.

I've had this in p4 for about two years now.
2007-10-26 15:00:34 +00:00
John Baldwin
f352a0d45f First cut at support for booting a GPT labeled disk via the BIOS bootstrap
on i386 and amd64 machines.  The overall process is that /boot/pmbr lives
in the PMBR (similar to /boot/mbr for MBR disks) and is responsible for
locating and loading /boot/gptboot.  /boot/gptboot is similar to /boot/boot
except that it groks GPT rather than MBR + bsdlabel.  Unlike /boot/boot,
/boot/gptboot lives in its own dedicated GPT partition with a new
"FreeBSD boot" type.  This partition does not have a fixed size in that
/boot/pmbr will load the entire partition into the lower 640k.  However,
it is limited in that it can only be 545k.  That's still a lot better than
the current 7.5k limit for boot2 on MBR.  gptboot mostly acts just like
boot2 in that it reads /boot.config and loads up /boot/loader.  Some more
details:
- Include uuid_equal() and uuid_is_nil() in libstand.
- Add a new 'boot' command to gpt(8) which makes a GPT disk bootable using
  /boot/pmbr and /boot/gptboot.  Note that the disk must have some free
  space for the boot partition.
  - This required exposing the backend of the 'add' function as a
    gpt_add_part() function to the rest of gpt(8).  'boot' uses this to
    create a boot partition if needed.
- Don't cripple cgbase() in the UFS boot code for /boot/gptboot so that
  it can handle a filesystem > 1.5 TB.
- /boot/gptboot has a simple loader (gptldr) that doesn't do any I/O
  unlike boot1 since /boot/pmbr loads all of gptboot up front.  The
  C portion of gptboot (gptboot.c) has been repocopied from boot2.c.
  The primary changes are to parse the GPT to find a root filesystem
  and to use 64-bit disk addresses.  Currently gptboot assumes that the
  first UFS partition on the disk is the / filesystem, but this algorithm
  will likely be improved in the future.
- Teach the biosdisk driver in /boot/loader to understand GPT tables.
  GPT partitions are identified as 'disk0pX:' (e.g. disk0p2:) which is
  similar to the /dev names the kernel uses (e.g. /dev/ad0p2).
- Add a new "freebsd-boot" alias to g_part() for the new boot UUID.

MFC after:	1 month
Discussed with:	marcel (some things might still change, but am committing
			what I have so far)
2007-10-24 21:33:00 +00:00
David E. O'Brien
fb6e00667c Also boot *.debug if everything else fails.
Approved by:	re(gnn)
2007-10-04 18:29:52 +00:00
Stephane E. Potvin
c085f6bbf6 Add documentation for the vm.kmem_size_min and vm.kmem_size_max tunables.
Approved by: njl (mentor, blanket)
2007-05-09 02:37:58 +00:00
John-Mark Gurney
7f2f71862f fixup talk of kern.maxswzone... It's been 32MB for almost 5 years now...
and only supports just over 7GB of swap...

Sound a bit more professional..

Inspired by:	Marc G. Fournier
MFC After:	3 days
2007-05-05 17:36:42 +00:00
Warner Losh
6ae9968c9a Document the init_chroot and init_script variables.
# I didn't check the markup too closely, so doc people, please check

Submitted by: Oliver Fromme
2007-02-04 06:35:10 +00:00
Marius Strobl
dc73f9b150 Garbage collect the code for auto-loading modules based on ISAPNP IDs,
which is #if'ed out since nearly eight years, along with its outdated
database.

Agreed by:	ru (some months ago)
2007-01-07 22:25:45 +00:00
Kip Macy
2d74924b65 add an interface for passing the entire kernel size up front to the
loader so that it can memory can be allocated aligned at the beginning of
the desired large page
2006-12-18 07:35:14 +00:00
Yaroslav Tykhiy
8eb4aedee6 Note that not all architectures use sendfile(2) buffers;
refer to the respective manpage for details.

MFC after: 3 days
2006-11-29 05:53:25 +00:00
Ruslan Ermilov
000a0f2a71 Unbreak compile with ELF_VERBOSE defined, and fix format warnings. 2006-11-02 17:52:43 +00:00
Ruslan Ermilov
593bbd2195 Revert the last change. Masking only 2 MSBs of the virtual address
to get the physical address doesn't work for all values of KVA_PAGES,
while masking 8 MSBs works for all values of KVA_PAGES that are
multiple of 4 for non-PAE and 8 for PAE.  (This leaves us limited
with 12MB for non-PAE kernels and 14MB for PAE kernels.)

To get things right, we'd need to subtract the KERNBASE from the
virtual address (but KERNBASE is not easy to figure out from here),
or have physical addresses set properly in the ELF headers.

Discussed with:	jhb
2006-11-02 17:28:38 +00:00
Marcel Moolenaar
932d8c46a2 Extend struct devdesc with a unit field, called d_unit. Promote the
device (kind) specific unit field to the common field. This change
allows a future version of libefi to work without requiring anything
more than what is defined in struct devdesc and as such makes it
possible to compile said version of libefi for different platforms
without requiring that those platforms have identical derivatives
of struct devdesc.
2006-11-02 01:23:18 +00:00
Marcel Moolenaar
5cae408f81 Don't unconditionally compile-in the bcache code. It's only used on
i386/amd64 and pc98. Remove useless calls to bcache_init() from the
ia64 and sparc64 loaders, as well as from the OFW common code.
2006-11-02 00:26:45 +00:00
Marcel Moolenaar
ac2bbfc8cf o Make sure to clear f->f_devdata if d_dev->dv_open() fails. It
would otherwise cause devclose() to free() the memory again.
o  Refactor devopen() so that it's more readable.
2006-11-02 00:02:22 +00:00
Ruslan Ermilov
da6d4298b7 Because the BTX mini-kernel now uses flat memory mode and clients
are no longer limited to a virtual address space of 16 megabytes,
only mask high two bits of a virtual address.  This allows to load
larger kernels (up to 1 gigabyte).  Not masking addresses at all
was a bad idea on machines with less than >3G of memory -- kernels
are linked at 0xc0xxxxxx, and that would attempt to load a kernel
at above 3G.  By masking only two highest bits we stay within the
safe limits while still allowing to boot larger kernels.

(This is a safer reimplmentation of sys/boot/i386/boot2/boot.2.c
rev. 1.71.)

Prodded by:	jhb
Tested by:	nyan (pc98)
2006-10-29 14:50:58 +00:00
Ruslan Ermilov
675e8ac08c Replace a rarely used "depuration" with "debugging".
PR:		docs/85127
Submitted by:	Gary W. Swearingen (partially)
MFC after:	3 days
2006-10-13 20:48:17 +00:00
Ruslan Ermilov
cab4aede58 Fix WARNS=2 warnings. 2006-09-29 20:57:38 +00:00
John Baldwin
64786948cc Ignore a sub-topic match if it is inside the command description.
Otherwise, merge-help can get confused by a command description that
includes a word that starts with a capital S.

MFC after:	1 week
2006-09-28 19:06:20 +00:00
Ruslan Ermilov
23471380b5 Make the default "init_path" value breakable, so it fits on the
screen's width, thus eliminating a groff(1) warning.

Suggested by:	marck
2006-08-20 09:31:17 +00:00
Dmitry Morozovsky
6bf0d59557 kern.ipc.nmbclusters is sysctl, not compile-time option. Change Dv to Va.
Touch .Dd.

Pointed out by:	ru
MFC after:	1 week
2006-08-18 10:15:01 +00:00
Dmitry Morozovsky
86ddfd1205 Remove references to NMBCLUSTERS which is obsoleted.
PR:		100427
Approved by:	maxim
MFC after:	1 week
2006-08-18 08:03:06 +00:00
John Baldwin
be5d6589e0 Remove more Alpha bits from the boot code including fixing several
stale comments.
2006-05-12 04:09:53 +00:00
Marius Strobl
e4846391da In moduledir_readhints() cast the value returned by sizeof() to ssize_t
when checking whether it's greater than a struct stat st_size in order
to also catch the case when st_size is -1. Previously this check didn't
trigger on sparc64 when st_size is -1 (as it's the case for a file on
a bzipfs, TFTP server etc.), causing the content of the linker hints
file to be copied to memory referenced by a null-pointer.

PR:		91231
MFC after:	1 week
2006-01-12 13:18:49 +00:00
Marcel Moolenaar
757686b115 Make our ELF64 type definitions match standards. In particular this
means:
o  Remove Elf64_Quarter,
o  Redefine Elf64_Half to be 16-bit,
o  Redefine Elf64_Word to be 32-bit,
o  Add Elf64_Xword and Elf64_Sxword for 64-bit entities,
o  Use Elf_Size in MI code to abstract the difference between
   Elf32_Word and Elf64_Word.
o  Add Elf_Ssize as the signed counterpart of Elf_Size.

MFC after: 2 weeks
2005-12-18 04:52:37 +00:00
Ruslan Ermilov
4750e08f7b Add loader(8) variables for RB_DFLTROOT, RB_MUTE, and RB_PAUSE:
"boot_dfltroot", "boot_mute", and "boot_pause" respectively.
2005-09-22 15:06:58 +00:00
Ian Dowse
4832a19173 Add a "comconsole_speed" loader variable that can be used to change
the serial console speed (i386 and amd64 only). If the previous
stage boot loader requested a serial console (RB_SERIAL or RB_MULTIPLE)
then the default speed is determined from the current serial port
speed. Otherwise it is set to 9600 or the value of BOOT_COMCONSOLE_SPEED
at compile time.

This makes it possible to set the serial port speed once in
/boot.config and the setting will propagate to boot2, loader and
the kernel serial console.
2005-08-18 01:39:43 +00:00
Brian Somers
1b3b403e9b Fix a comparison that broke ``set console=vidconsole'' and even the
loader.conf line ``console="vidconsole"''.

Sponsored by:	ActiveState/Sophos
MFC after:	1 week
2005-07-29 12:47:42 +00:00
John-Mark Gurney
2fd290094e remove a pointless comment with a more helpful one...
Submitted by:	Tobias Roth
MFC after:	5 days
2005-07-25 17:18:25 +00:00
Ruslan Ermilov
6c059e67a9 Improved markup, fixes some spelling and grammar.
Approved by:	re (blanket)
2005-06-14 08:49:14 +00:00
Ruslan Ermilov
2e79aad4c7 Markup nits. 2005-05-30 12:33:04 +00:00
John Baldwin
8b7c03a7a4 - Add support to the loader for multiple consoles.
- Teach the i386 and pc98 loaders to honor multiple console requests from
  their respective boot2 binaries so that the same console(s) are used in
  both boot2 and the loader.
- Since the kernel doesn't support multiple consoles, whichever console is
  listed first is treated as the "primary" console and is passed to the
  kernel in the boot_howto flags.

PR:		kern/66425
Submitted by:	Gavin Atkinson gavin at ury dot york dot ac dot uk
MFC after:	1 week
2005-05-27 19:31:00 +00:00
Maxim Sobolev
4d87b291ad Extend `autoboot_delay' handling - is this variable is set to -1 don't allow
user to interrupt autoboot process at all. Currently, even when
`autoboot_delay' is set to 0, loader(8) still allows autoboot process to be
interrupted by pressing any key on the console when the loader reads kernel
and modules from the disk. In some cases (i.e. untrusted environment) such
behaviour is highly indesirable and user should not be allowed to interfere
with the autoboot process at all.

Sponsored by:	PBXpress Inc.
MFC after:	3 days
2005-05-19 23:03:02 +00:00
Maxim Sobolev
faf0d4eb71 Whitespace only: kill trailing spaces. 2005-05-19 05:15:08 +00:00
Dag-Erling Smørgrav
b32a1f4405 Document the new default init_path.
Reminded by:	ru
MFC after:	2 weeks
2005-02-17 11:14:45 +00:00
Robert Watson
98d13cb3ff Insert an explicit McAfee license, as we use a stock two-clause BSD
license rather than the slightly custom licence in ufsread.c.
2005-01-30 14:58:00 +00:00
Scott Long
05d0bf79ed Remove the last vestiges of the userconfig option. None of this actually
did anything, so this commit should be considered a NO-OP.
2004-12-01 04:59:33 +00:00
Ruslan Ermilov
fccc3fcfc2 There's no reason for "read" and "echo" commands to not
appear in the online command list.
2004-11-13 17:04:55 +00:00
Ruslan Ermilov
e631c74b1d Pass the "?" command output through the pager.
(This doesn't quite work as this command is overridden by Forth,
and some Forth commands are appended to the output.)
2004-11-12 13:27:49 +00:00
Ruslan Ermilov
39ebd90532 Collapse several adjacent .if's into .if/.elif. 2004-10-24 12:32:41 +00:00
Yoshihiro Takahashi
222be03974 ELF64 support is not needed on pc98. 2004-10-24 12:18:11 +00:00
Warner Losh
99e085d9a8 document host_start_mem.
# feel free to wordsmith.

Suggested by: ru@
2004-10-15 06:59:07 +00:00