summaryrefslogtreecommitdiffstats
path: root/sys/boot/common/module.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r293835:smh2016-01-281-9/+22
| | | | | | Improve non-interactive forth cmd error reporting Sponsored by: Multiplay
* MFC r286234 (by trasz):smh2016-01-281-0/+8
| | | | | | Fix a problem which made loader(8) load non-kld files twice. Sponsored by: Multiplay
* MFC r281169, r293724, r293796, r294029, r294041, r294058smh2016-01-281-8/+7
| | | | | | | | | | | | | | | | | | | | | | MFC r281169 (by andrew): Make global variabled only used in this file static MFC r294058: Make common boot file_loadraw name parameter const MFC r294041: Remove unused reg param from fdt_fixup_memory MFC r293724: Enable warnings in EFI boot code MFC r293796: Fix typo in libefi.c MFC r294029: Only build EFI components on supported compilers Sponsored by: Multiplay
* MFC r277215, r277291, r277418, r280953 and r280954:royger2016-01-201-5/+6
| | | | | | | | | loader: implement multiboot support for Xen Dom0 Note that only the subset of the multiboot specification needed in order to boot a Xen Dom0 is implemented. Sponsored by: Citrix Systems R&D
* MFC r271054:ian2014-10-261-0/+5
| | | | When built with FDT support, add /boot/dtb to the list of search directories.
* MFC r262340, r262345, r262347, find and load an appropriate dtb file.ian2014-04-291-10/+9
| | | | | | | | | | | | The search order for a usable dtb in fdt_setup_fdtp() is now - A dtb loaded with an explicit "load -t dtb" command. - A dtb already loaded into memory somehow[*] and pointed to by fdt_to_load. - A dtb in the memory pointed to by the u-boot env vars fdtaddr or fdt_addr. - A file named by the u-boot env vars fdtfile or fdt_file. - A static dtb compiled into the kernel. * Presumably by some arch-specific command or code.
* 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
* Fix the bug I introduced in r247045.kientzle2013-02-251-36/+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-181-0/+37
| | | | | | 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.
* 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.
* 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 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-031-19/+6
| | | | | | | | | | | | | | 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).
* Formatting nitimp2010-05-101-1/+2
|
* Don't use 15M-16M area on pc98. It's reserved for some devices.nyan2009-12-311-0/+19
| | | | MFC after: 2 week
* Add a helper function for loading geli keys from the loader.thompsa2009-02-161-0/+38
|
* Also boot *.debug if everything else fails.obrien2007-10-041-0/+1
| | | | Approved by: re(gnn)
* In moduledir_readhints() cast the value returned by sizeof() to ssize_tmarius2006-01-121-1/+2
| | | | | | | | | | | 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
* Use __FBSDID().obrien2003-08-251-2/+3
| | | | Also some minor style cleanups.
* FreeBSD 5.0 has stopped shipping /modules 2.5 years ago. Catchru2003-03-031-1/+1
| | | | | up with this further by excluding /modules from the (default) kern.module_path.
* Bandaid for a buffer overrun in the module searching code. When breakingpeter2002-04-111-0/+2
| | | | | | | | up the module_path string, we would walk one past the end of the buffer. This hurting ia64 originally, but it was probably also happening on i386 occasionally as well. The effects were usually harmless, it would add bogus "binary" search directories to the places it actually looked for files.
* Fix a number of misspellings of "dependency" and "dependencies" iniedowse2001-11-161-3/+3
| | | | | | | comments and function names. PR: kern/8589 Submitted by: Rajesh Vaidheeswarran <rv@fore.com>
* Implement the long-awaited module->file cache database. A userlandpeter2001-09-111-84/+399
| | | | | | | tool (kldxref(8)) keeps a cache of what modules and versions are inside what .ko files. I have tested this on both Alpha and i386. Submitted by: bp
* Fix a minor style bug in the last commit.jesper2001-06-101-1/+1
| | | | | Submitted by: Adrian Steinmann <ast@marabu.ch> MFC after: 2 days
* In sys/boot/common/module.c, near line 105 a request for a rawjesper2001-05-271-1/+1
| | | | | | | | | | | | | | | | | file is processed by passing its name in argv[1]: return(mod_loadobj(typestr, argv[1])); however, it is not tested to see if argv[1] actually is defined. At best, mod_loadobj() near line 244 returns an error like "can't find 'garbage'" but if the "filename" entered is sufficiently long, some buffer gets overrun. Of course, "load -t filename" is actually a typo because we meant to type "load -t mfs_root filename"; nevertheless, a hung machine seems like too harsh a punishment for such a small typo... PR: i386/27693 Submitted by: Adrian Steinmann <ast@marabu.ch> MFC after: 1 week
* The default search path for kernel and modules was bogus. It makes nodcs2000-09-161-1/+1
| | | | sense for /boot/kernel to come last.
* Fix autoboot. Now autoboot *always* show the correct kernel name. Itdcs2000-09-081-0/+1
| | | | | | | | | | | | | | | | | | gets the name from the environment variable kernelname, which is set when a kernel is loaded. For this reason, autoboot will _first_ try to load a kernel, and only proceed with the wait prompt after that succeeds. If it fails, it will abort immediately. While I understand some may think this behavior undesirable, I think it is, overall, the best thing to do, even if we do not consider the aesthetic issue. Notice that anyone using the default loader.rc already has the kernel loaded before autoboot. On unload, unset kernelname. Separate the code that tries to load a kernel from the list of options to the function loadakernel(). It is used by both boot() and autoboot().
* The kernel is now known as `kernel.ko' and it and its matching modulesobrien2000-09-051-1/+1
| | | | live in ``/boot/kernel/''.
* Cleanup warnings. Most of these are signed/unsigned warnings, as well asjhb2000-08-031-2/+2
| | | | some added const's.
* Update loader logic to distinguish modules vs. files.bp2000-05-011-202/+261
| | | | | | | Add support for module metadata. The old way of dependancy handling will be supported for a while. Reviewed by: peter
* Fix the loader to handle module dependencies properly. More fixesbp2000-02-251-70/+74
| | | | | | | will be provided after modmetadata appears in the kernel. Reviewed by: msmith Approved by: jkh
* Close a file descriptor leak in the code which loads file objects.msmith2000-02-171-0/+2
| | | | | Submitted by: Paul Saab <paul@mu.org> Approved by: jkh
* Add fairings. Do not depend on user actually supplying the argumentsdcs1999-12-011-0/+4
| | | | he is supposed to supply.
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* Fix a number of memory leaks and other memory-related disorders.dcs1999-03-081-4/+6
| | | | | | | | | | | | | | | Also, unbreak the breakage introduced at the last revision of module.c. This changes the semantics of mod_searchfile() (and mod_searchmodule()) to make the caller's responsibility freeing the buffer returned. This is different from other functions in loader's code, and was done as a fix for kern/9631. If someone wants to revert this to the original behavior, don't forget to fix kern/9631 in another way. This should also fix bin/10462, which was introduced as a result of the first try at kern/9631 (module.c last revision). PR: bin/10462 Submitted by: Takanori Saneto <sanewo@ba2.so-net.ne.jp>
* Fix assorted memory leak/buffer reuse problems.dcs1999-02-221-4/+8
| | | | | | | Not restricted to, but including: PR: kern/9631 Submitted by: Bill Fenner <fenner@parc.xerox.com>
* No builtin command resets getopt before using it, causingmsmith1999-01-111-1/+3
| | | | | | | | problems in case a wrong option was given previously, and no option is given to the next command. PR: kern/9371 Submitted by: "Daniel C. Sobral" <dcs@newsguy.com>
* Use a consistant module search path (same as kernel will be).peter1998-10-091-26/+17
| | | | Use new dependency mechanism.
* * Add old UFS compatibility code to alpha/boot1.dfr1998-09-261-7/+7
| | | | | | * Fix a raft of warnings, printf and otherwise. * Allocate the correct amount in mod_searchmodule to prevent an overflow. * Fix the makefiles so they work outside my home directory (oops).
* Resynch with working sources before BTX integration.msmith1998-09-141-30/+84
| | | | | | | | | | | - Use format-independant module allocator. - Conditionalise ISA PnP support. - Simplify PnP enumerator interface. - Improve module/object searching. - Add missing depend/install targets in BTX makefiles. - Pass the kernel environment and module data in extended bootinfo fields. - Add a pointer to the end of the kernel + modules in bootinfo. - Fix parsing of old-style kernel arguments.
* Bootstrap updates.msmith1998-09-031-38/+376
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Move some startup code from MD to MI sections - Add a 'copyout' and some copyout-related functions. These will be obsoleted when BTX is available for the 386 and the kernel load area becomes directly addressable. - Add the ability load an arbitrary file as a module, associating and arbitrary type string with it. This can be used eg. for loading splash-screen images etc. - Add KLD module dependancy infrastructure. We know how to look for dependancies inside KLD modules, how to resolve these dependancies and what to do if things go wrong. Only works for a.out at the moment, due to lack of an MI ELF loader. Attach KLD module information to loaded modules as metadata, but don't pass it to the kernel (it can find it itself). - Load a.out KLD modules on a page boundary. Only pad the a.out BSS for the kernel, as it may want to throw symbols away. (We might want to do this for KLD modules too.) - Allow commands to be hidden from the '?' display, to avoid cluttering it with things like 'echo'. Add 'echo'. - Bring the 'prompt' command into line with the parser syntax. - Fix the verbose 'ls'; it was using an uninitialised stack variable. - Add a '-v' flag to 'lsmod' to have it display module metadata as well (not terribly useful for the average user) - Support a 'module searchpath' for required modules. - The bootstrap file on i386 is now called 'loader' to permit the /boot directory to use that name. - Discard the old i386 pread() function, as it's replaced by arch_readin()
* Bootloader update.msmith1998-08-311-3/+56
| | | | | | | | | | | | - Implement a new copyin/readin interface for loading modules. This allows the module loaders to become MI, reducing code duplication. - Simplify the search for an image activator for the loaded kernel. - Use the common module management code for all module metadata. - Add an 'unload' command that throws everything away. - Move the a.out module loader to MI code, add support for a.out kld modules. Submitted by: Alpha changes fixed by Doug Rabson <dfr@freebsd.org>
* This is the new unified bootstrap, sometimes known previously as themsmith1998-08-211-0/+129
'three-stage' bootstrap. There are a number of caveats with the code in its current state: - The i386 bootstrap only supports booting from a floppy. - The kernel and kld do not yet know how to deal with the extended information and module summary passed in. - PnP-based autodetection and demand loading of modules is not implemented. - i386 ELF kernel loading is not ready yet. - The i386 bootstrap is loaded via an ugly blockmap. On the alpha, both net- and disk-booting (SRM console machines only) is supported. No blockmaps are used by this code. Obtained from: Parts from the NetBSD/i386 standalone bootstrap.
OpenPOWER on IntegriCloud