aboutsummaryrefslogtreecommitdiff
path: root/sys/boot
Commit message (Collapse)AuthorAgeFilesLines
* MFi386: revision 214210Yoshihiro Takahashi2010-10-241-2/+2
| | | | | | | | Avoid using memcpy() for copying 32bit chunks. This shrinks the resulting code a little. Notes: svn path=/head/; revision=214257
* Avoid using memcpy() for copying 32bit chunks. This shrinksRoman Divacky2010-10-221-2/+2
| | | | | | | | | | the resulting code a little. Approved by: rpaulo (mentor) Reviewed by: jhb Notes: svn path=/head/; revision=214210
* Correct typos.Pawel Jakub Dawidek2010-10-201-2/+2
| | | | Notes: svn path=/head/; revision=214114
* mdoc: drop redundant .Pp and .LP callsUlrich Spörlein2010-10-081-1/+0
| | | | | | | They have no effect when coming in pairs, or before .Bl/.Bd Notes: svn path=/head/; revision=213573
* Ensure that a make from sys/boot does not pick up include files fromPeter Holm2010-10-081-0/+1
| | | | | | | | | /usr/include. Discussed with: kib Notes: svn path=/head/; revision=213568
* - Split code shared by almost any boot loader into separate files andPawel Jakub Dawidek2010-09-2418-864/+1383
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=213136
* When building world with clang, for gnu/lib/libobjc, sys/boot/i386/boot2Dimitry Andric2010-09-212-6/+2
| | | | | | | | | | | | | | | and sys/boot/pc98/boot2, do not simply assign 'gcc' to CC, since compile flags are sometimes passed via this variable, for example during the build32 stage on amd64. This caused the 32-bit libobjc build on amd64 to fail. Instead, only replace the first instance of clang (if any, including optional path) with gcc, and leave the arguments alone. Approved-by: rpaulo (mentor) Notes: svn path=/head/; revision=212979
* Add support 'device tpm' for amd64.Norikatsu Shigemura2010-09-191-0/+1
| | | | | | | | | | | Add tpm(4)'s default setting to /boot/defaults/loader.conf. Add 'device tpm' to NOTES for amd64 and i386. Discussed with: takawata Approved by: imp (mentor) Notes: svn path=/head/; revision=212861
* Before VirtualBox is fixed, mark with #ifdef what has to be done to makePawel Jakub Dawidek2010-09-172-3/+10
| | | | | | | | | | | | it possible to boot from ZFS RAIDZ for example from within VirtualBox. The problem with VirtualBox is that its BIOS reports only one disk present. If we choose to ignore this report, we can find all the disks available. We can't have this work-around to be turned on by default, because some broken BIOSes report true when it comes to number of disks, but present the same disk multiple times. Notes: svn path=/head/; revision=212805
* Remove magic value.Pawel Jakub Dawidek2010-09-171-1/+3
| | | | Notes: svn path=/head/; revision=212804
* Merge from powerpc:Marius Strobl2010-09-161-33/+27
| | | | | | | | | | - Change putc_func_t to use a char instead of an int for the character. - Make functions and variables not used outside of this source file static. - Remove unused prototypes and variables. - The OFW read and seek methods take 3 and not 4 input arguments. Notes: svn path=/head/; revision=212729
* Remove empty lines committed by accident.Pawel Jakub Dawidek2010-09-091-2/+0
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=212387
* Ignore log vdevs.Pawel Jakub Dawidek2010-09-091-0/+7
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=212384
* Allow to boot from a pool within which replacing is in progress.Pawel Jakub Dawidek2010-09-091-3/+33
| | | | | | | | | | | | | | | Before the change it wasn't possible and the following error was printed: ZFS: can only boot from disk, mirror or raidz vdevs Now if the original vdev (the one we are replacing) is still present we will read from it, but if it is not present we won't read from the new vdev, as it might not have enough valid data yet. MFC after: 2 weeks Notes: svn path=/head/; revision=212383
* Remove duplicated code.Pawel Jakub Dawidek2010-09-091-20/+9
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=212382
* If autoboot_delay is set to -1, boot immediately without checking forJohn Baldwin2010-09-081-1/+4
| | | | | | | | | | | | a keypress to match the behavior of the loader. PR: docs/108101 Submitted by: Wayne Sierke ws of au.dyndns.ws Tested by: brd MFC after: 1 week Notes: svn path=/head/; revision=212338
* Add custom kernel configuration and device tree source files forMaksim Yevmenkin2010-09-081-0/+265
| | | | | | | | | Seagate FreeAgent DockStar(tm) device. It seems to be a dumb down version of Marvell SheevaPlug. Device tree source file could use more tweaking, but at least it wll network boot and run FreeBSD/arm. Notes: svn path=/head/; revision=212332
* In the case of non-sequential mappings, ofw_mapmem() could ask OpenNathan Whitehorn2010-09-021-1/+1
| | | | | | | | | Firmware to map a memory region with negative length, causing crashes and Undefined Behavior. Add the appropriate check to make the behavior defined. Notes: svn path=/head/; revision=212165
* Modify pxe.c to use the version of nfs_getrootfh() that returnsRick Macklem2010-09-021-0/+59
| | | | | | | | | | | | | the file handle's size and was recently committed to lib/libstand/nfs.c. This allows pxeboot to use NFSv3 and work correcty for non-FreeBSD as well as FreeBSD NFS servers. If built with OLD_NFSV2 defined, the old code that predated this patch will be used. Tested by: danny at cs.huji.ac.il Notes: svn path=/head/; revision=212126
* Use a cleaner expression to retrieve the memory size in pc98's boot2.c,Dimitry Andric2010-09-011-3/+2
| | | | | | | | | | | which also avoids NULL pointer arithmetic, as suggested by jhb. The available space goes from 11 bytes to 7. Reviewed by: nyan Approved by: rpaulo (mentor) Notes: svn path=/head/; revision=212098
* For consistency, change all 'i386' and MACHINE_ARCH to x86.Xin LI2010-08-313-3/+3
| | | | | | | | Reviewed by: jhb MFC after: 1 week Notes: svn path=/head/; revision=212066
* Avoid directly manipulating a NULL pointer (which could result inDimitry Andric2010-08-311-2/+2
| | | | | | | | | | undefined behaviour) in sys/boot/pc98/boot2/boot2.c. Reviewed by: nyan Approved by: rpaulo (mentor) Notes: svn path=/head/; revision=212064
* Always compile pc98 boot2 with gcc instead of clang, just as with i386Dimitry Andric2010-08-311-0/+7
| | | | | | | | | | boot2. Unfortunately both still are too big when compiled with clang. Reviewed by: nyan Approved by: rpaulo (mentor) Notes: svn path=/head/; revision=212062
* Use a more robust way to substitute gcc for clang, when compilingDimitry Andric2010-08-311-1/+3
| | | | | | | | | | gnu/lib/libobjc and sys/boot/i386/boot2, so it also works when using absolute paths and/or options, as in CC="/absolute/path/clang -foo". Approved by: rpaulo (mentor) Notes: svn path=/head/; revision=212060
* Fix build of ppc32 loader.Nathan Whitehorn2010-08-251-1/+1
| | | | Notes: svn path=/head/; revision=211817
* Replace structure assignments with explicity memcpy calls. This allowsRui Paulo2010-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 Notes: svn path=/head/; revision=211747
* MFtbemd:Warner Losh2010-08-231-1/+1
| | | | | | | | Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want to test of all the CPUs of a given family conform. Notes: svn path=/head/; revision=211725
* MF tbemd: Minor tweaks, prefer MACHINE_CPUARCH generally to MACHINE_ARCH ↵Warner Losh2010-08-236-18/+18
| | | | | | | (which simplifies some powerpc/powerpc64 ifs) Notes: svn path=/head/; revision=211680
* MF tbemd: move to using specific architecture makefilesWarner Losh2010-08-239-20/+27
| | | | Notes: svn path=/head/; revision=211679
* MF tbemd: Minor tweaks, prefer MACHINE_CPUARCH generally to MACHINE_ARCH ↵Warner Losh2010-08-232-11/+11
| | | | | | | (which simplifies some powerpc/powerpc64 ifs) Notes: svn path=/head/; revision=211678
* MF tbemd: Minor tweaks, prefer MACHINE_CPUARCH generally to MACHINE_ARCHWarner Losh2010-08-238-10/+10
| | | | Notes: svn path=/head/; revision=211677
* It turns out that the OUTPUT_FORMAT should do the right thing for both ↵Warner Losh2010-08-232-135/+1
| | | | | | | endians... Notes: svn path=/head/; revision=211676
* MF tbemd: differentiate between arm and armebWarner Losh2010-08-232-1/+135
| | | | Notes: svn path=/head/; revision=211675
* Make sure the boot2 stage is compiled with gcc, as clang has noRui Paulo2010-08-211-0/+5
| | | | | | | | | | problems compiling it, but it just gets too big at the moment, even with -Os. This is not applicable to gptboot, though. Submitted by: Dimitry Andric <dimitry at andric.com> Notes: svn path=/head/; revision=211571
* Return EIO if vdev->v_phys_read is NULL.Martin Matuska2010-08-091-0/+3
| | | | | | | | | | | | This fixes booting from a ZFS mirror with a unavailable primary device. PR: kern/148655 Reviewed by: avg Approved by: delphij (mentor) MFC after: 3 days Notes: svn path=/head/; revision=211091
* mdoc: make sure to pass at least one argument to quotation macrosUlrich Spörlein2010-08-021-1/+1
| | | | Notes: svn path=/head/; revision=210764
* A simple test harness to help debug problems with the ZFS boot code.Doug Rabson2010-07-301-0/+120
| | | | Notes: svn path=/head/; revision=210650
* MFi386: revision 210387Yoshihiro Takahashi2010-07-251-1/+1
| | | | | | | Correctly setup LDADD with regards to libstand. Notes: svn path=/head/; revision=210459
* completely ignore zero-sized elf sections in modules of elf object type (amd64)Andriy Gapon2010-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 Notes: svn path=/head/; revision=210423
* Correctly setup LDADD with regards to libstand. The submitter pointsRui Paulo2010-07-221-1/+1
| | | | | | | | | | | | | | | out that "on amd64, libstand.a is compiled for i386, but is still installed under ${WORLDTMP}/usr/lib instead of ${WORLDTMP}/usr/lib32. Even if it would be installed there, ld on amd64 is set up incorrectly with a ${TOOLS_PREFIX}/usr/lib/i386 default path, so it wouldn't link. The reason it does link under gcc is that gcc passes -L${WORLDTMP}/usr/lib twice, even for -m32 builds, which is also incorrect, but accidentally works in this case." Submitted by: Dimitry Andric <dimitry at andric.com> Notes: svn path=/head/; revision=210387
* Provide support in loader for booting 64-bit PowerPC kernels. Like amd64,Nathan Whitehorn2010-07-1217-32/+202
| | | | | | | | 64-bit PowerPC kernels are loaded by a 32-bit loader, since nearly all powerpc64 firmwares execute in 32-bit mode. Notes: svn path=/head/; revision=209920
* Get rid of bootinfo for good in loader (U-Boot-based) and ARM.Rafal Jaworowski2010-07-111-119/+0
| | | | | | | | For FDT-enabled platforms the device tree is a modern replacement for bootinfo config data. Notes: svn path=/head/; revision=209909
* Provide a missing interrupt-parent for the CPM / QUICC node in the DTS.Rafal Jaworowski2010-07-111-0/+1
| | | | Notes: svn path=/head/; revision=209903
* Use the kernel's start address to determine what to map. This allowsMarcel Moolenaar2010-07-072-3/+6
| | | | | | | | us to link the kernel at different addresses without needing to build a corresponding loader. Notes: svn path=/head/; revision=209774
* Add some more modules to loader.conf. Remove if_awi since support for itRebecca Cran2010-06-231-1/+67
| | | | | | | | | | | was removed 2 years ago. PR: conf/147126 PR: conf/116071 Approved by: rrs (mentor) Notes: svn path=/head/; revision=209466
* Add a missing prototypeBrian Somers2010-06-201-0/+1
| | | | | | | | | PR: 145232 Submitted by: gcooper MFC after: 1 week Notes: svn path=/head/; revision=209361
* Pass the -N flag to linked via -Wl.Roman Divacky2010-06-141-1/+1
| | | | | | | Approved by: ed (mentor) Notes: svn path=/head/; revision=209162
* Fix conditional FDT support in loader(8).Rafal Jaworowski2010-06-133-2/+8
| | | | Notes: svn path=/head/; revision=209125
* Use -Wl,-N instead of the undocumented -N option for GCC.Ed Schouten2010-06-0312-12/+12
| | | | | | | | | | GCC forwards the -N flag directly to ld. This flag is not documented and not supported by (for example) Clang. Just use -Wl,-N. Submitted by: Pawel Worach Notes: svn path=/head/; revision=208789
* zfs boot: fix error handling in zfs_readdirAndriy Gapon2010-05-311-0/+2
| | | | | | | | Found by: clang static analyzer MFC after: 4 days Notes: svn path=/head/; revision=208669