summaryrefslogtreecommitdiffstats
path: root/sys/boot/common
Commit message (Collapse)AuthorAgeFilesLines
* Document comconsole_port and comconsole_pcidev loader variables.kib2012-01-071-1/+38
| | | | MFC after: 2 weeks
* Replace index() and rindex() calls with strchr() and strrchr().ed2012-01-031-1/+1
| | | | | | | | | | The index() and rindex() functions were marked LEGACY in the 2001 revision of POSIX and were subsequently removed from the 2008 revision. The strchr() and strrchr() functions are part of the C standard. This makes the source code a lot more consistent, as most of these C files also call into other str*() routines. In fact, about a dozen already perform strchr() calls.
* Clean up from the 4.x era.pluknet2011-12-271-3/+3
| | | | | | | | | | | | In an example of boot command: - rename wd(4) IDE disk drives name to ad(4) for the time being. - update the used kernel path "/kernel" to the current default. [It still worked occasionally by looking into the /boot/kernel directory, so the resulting path was "/boot//kernel/kernel", with two slashes.] Bump .Dd for this and previous changes. MFC after: 1 week
* Remove the remnants of /stand/sysinstall.pluknet2011-11-031-1/+1
| | | | | | loader.8: Sync the default init_path list with kern/init_main.c. NOTES: Replace with /rescue/init in the INIT_PATH kernel option.
* With LOADER_MBR_SUPPORT defined and LOADER_GPT_SUPPORT undefined we wouldpjd2011-10-201-2/+3
| | | | | | | never call disk_openmbr(). Submitted by: avg MFC after: 3 days
* Fix missing return when LOADER_GPT_SUPPORT is defined, but LOADER_MBR_SUPPORTpjd2011-10-191-1/+1
| | | | | | is not. MFC after: 3 days
* Fix buffer overflow in sys/boot/common/util.c's printf(), when printingdim2011-08-081-1/+1
| | | | | | | | | large (>= 10^10) numbers. In theory, 20 characaters should be enough, but bump the buffer to 32 characters, so we have some room for the future. Reviewed by: pjd Approved by: re (kib)
* Since r219452 the alignment of __dmadat has changed, revealing that fsread()marius2011-07-111-31/+35
| | | | | | | | | | bogusly casts its contents around causing alignment faults on sparc64 and most likely also on at least powerpc. Fix this by copying the contents bytewise instead as partly already done here. Solving this the right way costs some space, i.e. 148 bytes with GCC and 16 bytes with clang on x86 there are still some bytes left there though, and an acceptable hack which tricks the compiler into only using a 2-byte alignment instead of the native one when accessing the contents turned out to even take up more space that.
* Fix r223695 to compile on architectures which don't use the MBR scheme; wrapmarius2011-07-011-5/+16
| | | | | the MBR support in the common part of the loader in #ifdef's and enable it only for userboot for now.
* Add a version of the FreeBSD bootloader which can run in userland, packageddfr2011-06-305-3/+890
| | | | | as a shared library. This is intended to be used by BHyVe to load FreeBSD kernels into new virtual machines.
* Minimize backward seeks when trying to load ELF relocatable modules.kan2011-06-191-7/+30
| | | | | | Some of loader filesystems are very ill equipped to handle seeking backwards within the file. Namely, tftp requires trasfer to be restarted from the start of the file every time we go backwards.
* New boot loader menus from Devin Teske.julian2011-05-281-0/+7
| | | | | | | | Discussed on hackers and recommended for inclusion into 9.0 at the devsummit. All support email to devin dteske at vicor dot ignoreme dot com . Submitted by: dteske at vicor dot ignoreme dot com Reviewed by: me and many others
* Disconnect sun4v architecture from the three.attilio2011-05-141-1/+1
| | | | | | | | | Some files keep the SUN4V tags as a code reference, for the future, if any rewamped sun4v support wants to be added again. Reviewed by: marius Tested by: sbruno Approved by: re
* a whitespace nitavg2011-05-071-1/+1
| | | | | Reminder from: kib MFC after: 4 days
* a whitespace nitavg2011-05-071-1/+1
| | | | MFC after: 4 days
* Fix a long standing bug where file_load() passes down the global loadaddrmarcel2011-04-041-1/+1
| | | | | | | | to the l_load() method in the file_formats structure, while being passed an address as an argument (dest). With file_load() calling arch_loadaddr() now, this bug is a little bit more significant. Spotted by: nyan@ (nice catch!)
* Add 2 new archsw interfaces:marcel2011-04-034-30/+38
| | | | | | | | | | | | | | 1. arch_loadaddr - used by platform code to adjust the address at which the object gets loaded. Implement PC98 using this new interface instead of using conditional compilation. For ELF objects the ELF header is passed as the data pointer. For raw files it's the filename. Note that ELF objects are first considered as raw files. 2. arch_loadseg - used by platform code to keep track of actual segments, so that (instruction) caches can be flushed or translations can be created. Both the ELF header as well as the program header are passed to allow platform code to treat the kernel proper differently from any additional modules and to have all the relevant details of the loaded segment (e.g. protection).
* Revert rev 165325. The arch_maphint interface hasn't been in use formarcel2011-04-031-2/+0
| | | | more than 4 years.
* MFaltix:marcel2011-03-161-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Add support for Pre-Boot Virtual Memory (PBVM) to the loader. PBVM allows us to link the kernel at a fixed virtual address without having to make any assumptions about the physical memory layout. On the SGI Altix 350 for example, there's no usuable physical memory below 192GB. Also, the PBVM allows us to control better where we're going to physically load the kernel and its modules so that we can make sure we load the kernel in memory that's close to the BSP. The PBVM is managed by a simple page table. The minimum size of the page table is 4KB (EFI page size) and the maximum is currently set to 1MB. A page in the PBVM is 64KB, as that's the maximum alignment one can specify in a linker script. The bottom line is that PBVM is between 64KB and 8GB in size. The loader maps the PBVM page table at a fixed virtual address and using a single translations. The PBVM itself is also mapped using a single translation for a maximum of 32MB. While here, increase the heap in the EFI loader from 512KB to 2MB and set the stage for supporting relocatable modules.
* Some more shrinking.rdivacky2011-03-101-3/+1
| | | | | | | | | | | | | | | | | o bunch of variables are turned into uint8_t o initial setting of namep[] in lookup() is removed as it's only overwritten a few lines down o kname is explicitly initialized in main() as BSS in boot2 is not zeroed o the setting and reading of "fmt" in load() is removed o buf in printf() is made static to save space Reviewed by: jhb Tested by: me and Fabian Keil <freebsd-listen fabiankeil de>
* Rename bcpy() macro to bcopy().pjd2011-02-272-7/+7
|
* Handle memory allocation failures in include().brucec2011-02-231-0/+11
| | | | | | PR: i386/85652 Submitted by: Ben Thomas <bthomas at virtualiron.com> MFC after: 3 days
* In sys/boot/common/ufsread.c, use uint8_t instead of u_int8_t.dim2011-02-151-1/+1
| | | | Submitted by: mdf
* Apply a few small optimizations to boot2's code, to make it shrink adim2011-02-151-1/+1
| | | | | | | | | little further. This gets us further on the way to be able to build it successfully with clang. Using in-tree gcc, this shrinks boot2.bin with 60 bytes, the in-tree clang shaves off 72 bytes, and ToT clang 84 bytes. Submitted by: rdivacky Reviewed by: imp
* Make MSGBUF_SIZE kernel option a loader tunable kern.msgbufsize.pluknet2011-01-211-0/+8
| | | | | | | Submitted by: perryh pluto.rain.com (previous version) Reviewed by: jhb Approved by: kib (mentor) Tested by: universe
* Give a bit of a hint of the failure (read != expected) but don't makeemaste2010-11-251-1/+1
| | | | | | the error message needlessly more verbose. Discussed with: attilio
* Make this printfoutput more verbose.attilio2010-11-231-1/+2
| | | | | | Sponsored by: Sandvine Incorporated Submitted by: Sandvine Incorporated MFC after: 3 days
* Remove support for autoloading ACPI from the loader. Leave in the code tojhb2010-11-081-6/+0
| | | | | detect ACPI and export info such as the location of the RSDP via hints as that is still useful.
* Correct typos.pjd2010-10-201-2/+2
|
* mdoc: drop redundant .Pp and .LP callsuqs2010-10-081-1/+0
| | | | They have no effect when coming in pairs, or before .Bl/.Bd
* - Split code shared by almost any boot loader into separate files andpjd2010-09-246-0/+770
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clean up most layering violations: sys/boot/i386/common/rbx.h: RBX_* defines OPT_SET() OPT_CHECK() sys/boot/common/util.[ch]: memcpy() memset() memcmp() bcpy() bzero() bcmp() strcmp() strncmp() [new] strcpy() strcat() strchr() strlen() printf() sys/boot/i386/common/cons.[ch]: ioctrl putc() xputc() putchar() getc() xgetc() keyhit() [now takes number of seconds as an argument] getstr() sys/boot/i386/common/drv.[ch]: struct dsk drvread() drvwrite() [new] drvsize() [new] sys/boot/common/crc32.[ch] [new] sys/boot/common/gpt.[ch] [new] - Teach gptboot and gptzfsboot about new files. I haven't touched the rest, but there is still a lot of code duplication to be removed. - Implement full GPT support. Currently we just read primary header and partition table and don't care about checksums, etc. After this change we verify checksums of primary header and primary partition table and if there is a problem we fall back to backup header and backup partition table. - Clean up most messages to use prefix of boot program, so in case of an error we know where the error comes from, eg.: gptboot: unable to read primary GPT header - If we can't boot, print boot prompt only once and not every five seconds. - Honour newly added GPT attributes: bootme - this is bootable partition bootonce - try to boot from this partition only once bootfailed - we failed to boot from this partition - Change boot order of gptboot to the following: 1. Try to boot from all the partitions that have both 'bootme' and 'bootonce' attributes one by one. 2. Try to boot from all the partitions that have only 'bootme' attribute one by one. 3. If there are no partitions with 'bootme' attribute, boot from the first UFS partition. - The 'bootonce' functionality is implemented in the following way: 1. Walk through all the partitions and when 'bootonce' attribute is found without 'bootme' attribute, remove 'bootonce' attribute and set 'bootfailed' attribute. 'bootonce' attribute alone means that we tried to boot from this partition, but boot failed after leaving gptboot and machine was restarted. 2. Find partition with both 'bootme' and 'bootonce' attributes. 3. Remove 'bootme' attribute. 4. Try to execute /boot/loader or /boot/kernel/kernel from that partition. If succeeded we stop here. 5. If execution failed, remove 'bootonce' and set 'bootfailed'. 6. Go to 2. If whole boot succeeded there is new /etc/rc.d/gptboot script coming that will log all partitions that we failed to boot from (the ones with 'bootfailed' attribute) and will remove this attribute. It will also find partition with 'bootonce' attribute - this is the partition we booted from successfully. The script will log success and remove the attribute. All the GPT updates we do here goes to both primary and backup GPT if they are valid. We don't touch headers or partition tables when checksum doesn't match. Reviewed by: arch (Message-ID: <20100917234542.GE1902@garage.freebsd.pl>) Obtained from: Wheel Systems Sp. z o.o. http://www.wheelsystems.com MFC after: 2 weeks
* Fix build of ppc32 loader.nwhitehorn2010-08-251-1/+1
|
* Replace structure assignments with explicity memcpy calls. This allowsrpaulo2010-08-241-4/+9
| | | | | | | | Clang to compile this file: it was using the builtin memcpy and we want to use the memcpy defined in gptboot.c. (Clang can't compile boot2 yet). Submitted by: Dimitry Andric <dimitry at andric.com> Reviewed by: jhb
* MF tbemd: Minor tweaks, prefer MACHINE_CPUARCH generally to MACHINE_ARCH ↵imp2010-08-231-4/+4
| | | | (which simplifies some powerpc/powerpc64 ifs)
* mdoc: make sure to pass at least one argument to quotation macrosuqs2010-08-021-1/+1
|
* completely ignore zero-sized elf sections in modules of elf object type (amd64)avg2010-07-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Current code doesn't check size of elf sections and may perform needless actions of zero-sized memory allocation and similar. The bigger issue is that alignment requirement of a zero-sized section gets effectively applied to the next section if it has smaller alignment requirement. But other tools, like gdb and consequently kgdb, completely ignore zero-sized sections and thus may map symbols to addresses differently. Zero-sized sections are not typical in general. Their typical (only, even) cause in FreeBSD modules is inline assembly that creates custom sections which is found in pcpu.h and vnet.h. Mere inclusion of one of those header files produces a custom section in elf output. If there is no actual use for the section in a given module, then the section remains empty. Better solution is to avoid creating zero-sized sections altogether, which is in plans. Preloaded modules are handled in boot code (load_elf_obj.c), while dynamically loaded modules are handled by kernel (link_elf_obj.c). Based on code by: np MFC after: 3 weeks
* Provide support in loader for booting 64-bit PowerPC kernels. Like amd64,nwhitehorn2010-07-121-1/+4
| | | | | 64-bit PowerPC kernels are loaded by a 32-bit loader, since nearly all powerpc64 firmwares execute in 32-bit mode.
* Formatting nitimp2010-05-101-1/+2
|
* Remove file system support based on the simple file system protocolmarcel2010-01-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | as this only allows us to access file systems that EFI knows about. With a loader that can only use EFI-supported file systems, we're forced to put /boot on the EFI system partition. This is suboptimal in the following ways: 1. With /boot a symlink to /efi/boot, mergemaster complains about the mismatch and there's no quick solution. 2. The EFI loader can only boot a single version of FreeBSD. There's no way to install multiple versions of FreeBSD and select one at the loader prompt. 3. ZFS maintains /boot/zfs/zpool.cache and with /boot a symlink we end up with the file on a MSDOS file system. ZFS does not have proper handling of file systems that are under Giant. Implement a disk device based on the block I/O protocol instead and pull in file system code from libstand. The disk devices are really the partitions that EFI knows about. This change is backward compatible. MFC after: 1 week
* - Add code allowing a network device to only be open and closed oncemarius2010-01-091-9/+33
| | | | | | | | | | | | | | | | | | | | | | | | | by keeping it opened after the first open and closing it via the cleanup handler when NETIF_OPEN_CLOSE_ONCE is defined in order to avoid the open-close-dance on every file access which with firmware that for example performs an auto-negotiation on every open causes netbooting to take horribly long. Basically the behavior with this knob enabled resembles the one employed between r60506 and r177108 (and for sparc64 also again since r182919) with the addition that the network device now is closed eventually before entering the kernel and before rebooting. Actually I think this should be the desired MI behavior, however the U-Boot loader actually requires net_close() to be called after every transaction in order for some local shutdown operations to be performed (and which I think thus will break on concurrent opens, i.e. when netdev_opens is > 1, like the loader does at least for disks when LOADER_GZIP_SUPPORT is enabled). - Use NETIF_OPEN_CLOSE_ONCE to replace the hack, which artificially increased netdev_opens for sparc64 in order to keep the network device opened forever, as at least some firmware versions require the network device to be closed eventually before entering the kernel or otherwise will DMA received packets to stale memory. The powerpc OFW loader probably wants NETIF_OPEN_CLOSE_ONCE to be set as well for the same reasons.
* Remove clause 3 and 4 from TNF licenses (this was the only 4-clause TNFmarius2010-01-091-10/+1
| | | | | | license FreeBSD had in sys/boot). Obtained from: NetBSD
* Don't use 15M-16M area on pc98. It's reserved for some devices.nyan2009-12-311-0/+19
| | | | MFC after: 2 week
* - Consistently wrap debugging in NETIF_DEBUG. This basically mergesmarius2009-12-241-6/+22
| | | | | NetBSD rev 1.19. - Make the functions match their prototypes regarding static.
* Add support for memory disk (md). The size of the memory diskmarcel2009-12-132-0/+156
| | | | | | is determined by MD_IMAGE_SIZE. A file system can be embedded into the loader with /sys/tools/embed_mfs.sh. Note that md.c is not included when MD_IMAGE_SIZE is not set.
* Introduce a new option (BOOT_PROMPT_123) that lets enter the boot promptattilio2009-11-122-0/+22
| | | | | | | | | | | | only when typing the sequence "123" (opposite to the standard 'push any button' approach). That results useful when using serial lines sending garbage and leading to unwilling boot prompt appearence. Obtained from: Sandvine Incorporated Reviewed by: emaste, jhb Sponsored by: Sandvine Incorporated MFC: 1 week
* Close a file descriptor leak in an error case.brueffer2009-10-281-0/+1
| | | | | | PR: 138374 Submitted by: Patroklos Argyroudis <argp@census-labs.com> MFC after: 1 week
* sys/boot/common.crodrigc2009-06-011-2/+21
| | | | | | | | | | | | | | | | | | | | | ================= Extend the loader to parse the root file system mount options in /etc/fstab, and set a new loader variable vfs.root.mountfrom.options with these options. The root mount options must be a comma-delimited string, as specified in /etc/fstab. Only set the vfs.root.mountfrom.options variable if it has not been set in the environment. sys/kern/vfs_mount.c ==================== When mounting the root file system, pass the mount options specified in vfs.root.mountfrom.options, but filter out "rw" and "noro", since the initial mount of the root file system must be done as "ro". While we are here, try to add a few hints to the mountroot prompt to give users and idea what might of gone wrong during mounting of the root file system. Reviewed by: jhb (an earlier patch)
* Some of the boot loader code only works on a ufs file system, but itdfr2009-05-281-2/+3
| | | | | | | uses the generic struct dirent, which happens to look identical to UFS's struct direct. If BSD ever changes dirent then this will be a problem. Submitted by: matthew dot fleming at isilon dot com
* Add a helper function for loading geli keys from the loader.thompsa2009-02-162-1/+50
|
* remove a file which is, as far as I can tell, totally unused.luigi2009-01-131-101/+0
|
OpenPOWER on IntegriCloud