summaryrefslogtreecommitdiffstats
path: root/sys/boot/common
Commit message (Collapse)AuthorAgeFilesLines
* Make the check for number of entries less strict.ae2013-08-081-6/+9
| | | | | | | Some partitioning tools can create GPT with number of entries less than 128. MFC after: 1 week
* Since we didn't break the loop, we should set i to -1 to start from theae2013-04-211-1/+2
| | | | | | | beginning. Submitted by: Steven Hartland MFC after: 1 week
* strncmp for boot code: fix an off by one erroravg2013-04-051-2/+2
| | | | | | | Before this change strncmp would access and _compare_ n+1 characters in the case where the first n characters match. MFC after: 5 days
* Attach the elf section headers to the loaded kernel as metadata, soian2013-03-101-0/+2
| | | | | | | | | | | 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.
* Since ubldr doesn't necessarily load a kernel at the physical address in theian2013-03-091-5/+6
| | | | | | | | | | 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.
* Fix a typo that prevented booting a kernel that had virtual addresses inian2013-02-271-1/+1
| | | | the elf headers.
* Adjust the arm kernel entry point address properly regardless of whether theian2013-02-261-6/+17
| | | | | e_entry field holds a physical or a virtual address. Add a comment block that explains the assumptions being made by the adjustment code.
* Fix the bug I introduced in r247045.kientzle2013-02-252-38/+0
| | | | | | | | | | | | | | | | 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.
* Add mem_load_raw() for loading data from another location in memory.kientzle2013-02-182-0/+39
| | | | | | 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.
* Add bootcamp support to the loader.ae2013-02-101-3/+7
| | | | | Tested by: dchagin MFC after: 1 week
* Bring in some userboot changes from the bhyve branch to reduce diffs.grehan2013-01-081-2/+9
| | | | | | | | | | | | | | | | | | | | 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
* Hook in new files menusets.4th and manual.dteske2012-11-071-0/+1
| | | | Approved by: adrian (co-mentor) (implicit)
* Fix loader crash when some unhalted exception happens during `include`mav2012-10-261-0/+6
| | | | | | | 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.
* Remove new-line characters from the include() errors to make it consistentmav2012-10-251-2/+2
| | | | with the rest of code.
* When loader tries to open GPT partition, but partition table is not GPT,ae2012-10-221-0/+7
| | | | | | | then try automatically detect an appropriate partition type. PR: kern/172550 Tested by: Ralf Wenk
* Add the flags parameter to the disk_open() function and DISK_F_NOCACHEae2012-10-212-10/+20
| | | | | flag, that disables the caching of partition tables metadata. Use this flag for floppies in the libi386/biosdisk driver.
* boot/console: handle consoles that fail to probeavg2012-10-062-10/+17
| | | | | | | | | | | | | | - 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
* Fix the style.ae2012-09-301-4/+4
|
* Remember the file format of the last loaded module and try to use it forae2012-09-301-2/+9
| | | | next files.
* Fix disk_cleanup() to work without DISK_DEBUG too.ae2012-09-301-1/+3
|
* Almost each time when loader opens a file, this leads to callingae2012-09-292-34/+179
| | | | | | | | | | | | | | | | | | 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.
* Make the loader a bit smarter, when it tries to open disk and the sliceae2012-09-281-9/+11
| | | | | | 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.
* Implement elfN(reloc) for powerpc. With this change the kernel is now able toandreast2012-09-211-0/+25
| | | | | | | resolve dependencies of modules at boot time and load additional modules when needed. MFC after: 1 week
* The MBR data is not necessarily aligned. This is a problem on ARM.kientzle2012-09-141-2/+2
|
* boot: file_loadraw should strdup name argumentavg2012-09-111-1/+1
| | | | | | ... the same way it's done for type argument. MFC after: 2 weeks
* Fix loading of kernel modules at boot time for powerpc64.andreast2012-09-081-3/+3
| | | | | Reported by: Mathias Breuninger MFC after: 1 week
* Add comment why the code has been disabled.ae2012-08-161-2/+2
| | | | Requested by: rpaulo
* Some BIOSes return incorrect number of sectors, make checks lessae2012-08-151-0/+4
| | | | | | strictly, to do not lost some partitions. Reported by: swills@
* Rework r239232 to unbreak ZFS detection on MBR slices.ae2012-08-151-10/+18
|
* As discussed on -current, remove the hardcoded default maxswzone.des2012-08-141-11/+20
| | | | MFC after: 3 weeks
* Restore the old behaviour. If requested partition is a BSD slice,ae2012-08-131-3/+11
| | | | | but d_partition isn't explicitly set, then try to open BSD label and its first partition.
* Remove colons from the debug message, device name returned by theae2012-08-131-4/+4
| | | | disk_fmtdev() already has the colons.
* Unbreak booting from the true dedicated disks.ae2012-08-132-3/+14
| | | | | | | 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@
* Add more debug messages.ae2012-08-121-1/+6
|
* As it turned out, there are some installations, where BSD labelae2012-08-071-1/+1
| | | | | | | contains partitions with type zero. And it has worked. So, allow detect these partitions. Reported by: glebius
* Fix start offset calculation for the EBR partitions.ae2012-08-061-1/+1
|
* Introduce new API to work with disks from the loader's drivers.ae2012-08-053-695/+211
| | | | | | | 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.
* Create the interface to work with various partition tables from theae2012-08-052-0/+921
| | | | | loader(8). The following partition tables are supported: BSD label, GPT, MBR, EBR and VTOC8.
* Don't return an error if a kld does not contain any modules (e.g. ajhb2012-06-202-2/+2
| | | | | | | kld that only contained a sysctl). The kernel linker allows such modules, so the boot loader should not reject them. MFC after: 2 weeks
* Use 32-bit ufs_ino_t instead of ino_t to keep boot2 small and preventgleb2012-05-251-7/+9
| | | | | | unnecessary 64-bit math on 32-bit machines. Sponsored by: Google Summer of Code 2011
* Fixes to man8 groff mandoc style, usage mistakes, or typos.wblock2012-05-241-1/+1
| | | | | | | PR: 168016 Submitted by: Nobuyuki Koganemaru Approved by: gjb MFC after: 3 days
* zfs boot: try to set vfs.root.mountfrom from currdev as a fallbackavg2012-05-121-2/+16
| | | | | | | | | | 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
* zfsboot/zfsloader: support accessing filesystems within a poolavg2012-05-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* sys/boot: add common CTASSERT definitionavg2012-05-091-0/+6
|
* Add multiple inclusion protection.marius2012-04-291-0/+5
| | | | | | PR: 165025 Submitted by: Gavin Mu MFC after: 1 week
* Read backup GPT header from the last LBA only when primary GPT header andae2012-04-121-7/+7
| | | | | | | | | 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
* Remove trailing whitespace per mdoc lint warningeadler2012-03-291-1/+1
| | | | | | | Disussed with: gavin No objection from: doc Approved by: joel MFC after: 3 days
* Remove second consts in r233288 in order to appease C++ compilers.marius2012-03-261-1/+1
| | | | | | While at it, remove some style(9) bugs in libkern.h. Submitted by: kan
* Declare the CRC lookup-tables const as they hardly should change atmarius2012-03-211-1/+1
| | | | run-time.
* Declare some variables static in order to reduce the object size andmarius2012-03-181-31/+18
| | | | | | | redo r232822 in a less hackish way. The latter now no longer breaks compiling the x86 boot2 with clang. MFC after: 1 week
OpenPOWER on IntegriCloud