History log of /src/usr.sbin/installboot/arch/i386.c |
Revision | | Date | Author | Comments |
1.44 |
| 11-Jul-2025 |
andvar | Fix various typos, mainly in comments and log/error messages.
|
1.43 |
| 05-Dec-2021 |
msaitoh | s/filesytem/filesystem/ in comment.
|
1.42 |
| 07-May-2019 |
thorpej | Use designated initializers for struct ib_mach.
|
1.41 |
| 23-Jun-2018 |
kamil | branches: 1.41.2; Fix integer overflow in installboot(8)
Add a sanity check of the disk_buf first three bytes. The original code on a disk with nul bytes was causing integer overflow and thus calling the memcmp(3) functin in is_zero() with enormous length.
Verity that the 0th byte is JMP, 1th a signed byte >=9 to prevent overflow and 2th byte NOP.
Add a comment explaining the check.
Detected with MKSANITIZER and ASan.
|
1.40 |
| 14-Jun-2013 |
msaitoh | branches: 1.40.20; 1.40.26; Remove trailng whitespaces.
|
1.39 |
| 06-Apr-2012 |
gson | branches: 1.39.2; When printing the list of valid console names, don't treat the consoles[] array as NULL terminated, because it's not.
|
1.38 |
| 10-Mar-2012 |
dsl | Some FAT16 filesystems don't have 'hidden sectors' correctly set to the offset of the filesystem on the disk. Let '-b s1blk' be used to fix the value.
|
1.37 |
| 14-Aug-2011 |
christos | branches: 1.37.2; fix various gcc-4.5 warnings
|
1.36 |
| 17-Jan-2010 |
drochner | Invert the flag bits to control module loading: rename LOADMODULES->NOMODULES and READBOOTCONF->NOBOOTCONF. This way, the default value (0) wired into old bootxx_* and installed to file systems remains valid and we avoid problems on partial updates.
|
1.35 |
| 14-Jan-2010 |
drochner | On i386/amd64, define two flag bits in the boot parameters which control whether modules are loaded and whether boot.cfg is evaluated, and set both to "off" per default in the PXE bootloader. Extend "installboot" to toggle the bits. This way, pxeboot works with existing dhcp server setups (and as described in the manpage) out of the box. Also, boot.cfg reading involves a stat() call which is horribly inefficient with the TFTP pseudo file system.
|
1.34 |
| 23-Dec-2009 |
mbalmer | Fix typo in comments, no code change.
|
1.33 |
| 07-May-2009 |
lukem | refer to FFSv1 instead of UFSv1
|
1.32 |
| 05-Apr-2009 |
lukem | fix sign-compare issues
|
1.31 |
| 18-Feb-2009 |
christos | CID 4393: plug memory leak.
|
1.30 |
| 28-Apr-2008 |
martin | branches: 1.30.8; Remove clause 3 and 4 from TNF licenses
|
1.29 |
| 06-Mar-2008 |
dsl | branches: 1.29.2; Add a large warning about the possible side effect of using '-f'.
|
1.28 |
| 23-Jun-2007 |
christos | branches: 1.28.4; 1.28.8; Don't use __arraycount because this is a 700L, and toolz have messed up includes.
|
1.27 |
| 23-Jun-2007 |
dogcow | unb0rk tools/ builds on systems that don't have __arraycount() defined.
|
1.26 |
| 23-Jun-2007 |
christos | PR/36527: Greg A. Woods: installboot(8) doesn't allow for the valid consdev=auto setting
|
1.25 |
| 15-Feb-2007 |
dsl | Add a -f (force) parameter to installboot(8). If specified then checks on the disks BPB are not done, and any existing BPB is deleted. This is needed soince newfs(8) doesn't overwrite the BPB - which is basically the FAT superblock. Update documentation and add an example of using bootxx_fat16.
|
1.24 |
| 07-Jan-2007 |
dogcow | %d -> %ld, so that building on alpha doesn't fail. (also print more useful errors - x bytes written, should be y.)
|
1.23 |
| 06-Jan-2007 |
dsl | Support for non-512 byte media. Automatically enable writes to the 'labelsector' if necessary. Detect and recover from problems with the write-protected 'labelsector' stopping writes to nearby sectors when the non-raw disk device is used. Support the installation of 512-byte pbr boot code (eg fatboot). Verify that there is enough reserved space in the bpb (if not all zeros) to avoid overwriting the start of FAT filesystems.
|
1.22 |
| 18-Feb-2006 |
dsl | Move the MD definitions into the MD files, leaving machines.c with just a list of the supported machines.
|
1.21 |
| 30-Jan-2006 |
dsl | Fix the detection of the bootstrap magic number when run on big-endian systems. Correct another typo.
|
1.20 |
| 24-Jan-2006 |
dsl | Fix spelling mistake in message
|
1.19 |
| 11-Nov-2005 |
dsl | Add a -e (edit) option to allow the bootstrap options of an installed bootstrap or a file containing such a bootstrap to be changed/displayed. In particular this will (soon) let you modify the parameters for pxeboot.
|
1.18 |
| 16-Aug-2004 |
yamt | revert a part of the previous. (uint -> u_int) to make tools/installboot compile again.
|
1.17 |
| 15-Aug-2004 |
dsl | Add an option to set bp_consaddr (serial console IO port address) Only complain about small patch area if we would write something non-zero there.
|
1.16 |
| 20-Jun-2004 |
jmc | Completely rework how tools/compat is done. Purge all uses/references to _NETBSD_SOURCE as this makes cross building from older/newer versions of NetBSD harder, not easier (and also makes the resulting tools 'different')
Wrap all required code with the inclusion of nbtool_config.h, attempt to only use POSIX code in all places (or when reasonable test w. configure and provide definitions: ala u_int, etc).
Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86 NetBSD current (x86 and amd64) and Solaris 9.
Fixes PR's: PR#17762 PR#25944
|
1.15 |
| 14-Mar-2004 |
lukem | branches: 1.15.2; fix a typo in a comment, and expand the description of x86_boot_params.
|
1.14 |
| 13-Mar-2004 |
dsl | Add a -o keymap=zyz option that will set the boot keymap. If a character in the map is typed, it gets replaced by the one following.
|
1.13 |
| 27-Oct-2003 |
lukem | fix typo in comment
|
1.12 |
| 27-Oct-2003 |
lukem | Overhaul how `build.sh tools' are used:
* Rename "config.h" to "nbtool_config.h" and HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H. This makes in more obvious in the source when we're using tools/compat/config.h versus "standard autoconf" config.h
* Consistently move the inclusion of nbtool_config.h to before <sys/cdefs.h> so that the former can provide __RCSID() (et al), and there's no need to protect those macros any more.
These changes should make it easier to "tool-ify" a program by adding: #if HAVE_NBTOOL_CONFIG_H #include "nbtool_config.h" #endif to the top of the source files (for the general case).
|
1.11 |
| 14-Oct-2003 |
lukem | Instead of requiring that the BPB is always the FAT32 one, check the first three bytes to determine how much of the BPB to preserve. Supported values: eb 3c 90 FAT16 BPB eb 58 90 FAT32 BPB (anything else) don't preserve any BPB
This is because the BPB is generally only the FAT16 one except in the bootxx_msdos case, where it's the larger FAT32 one.
|
1.10 |
| 10-Oct-2003 |
lukem | Fix compile error on powerpc. Noted by Juergen Hannken-Illjes in private mail.
|
1.9 |
| 08-Oct-2003 |
lukem | Overhaul MBR handling (part 1):
<sys/bootblock.h>: * Added definitions for the Master Boot Record (MBR) used by a variety of systems (primarily i386), including the format of the BIOS Parameter Block (BPB). This information was cribbed from a variety of sources including <sys/disklabel_mbr.h> which this is a superset of.
As part of this, some data structure elements and #defines were renamed to be more "namespace friendly" and consistent with other bootblocks and MBR documentation. Update all uses of the old names to the new names.
<sys/disklabel_mbr.h>: * Deprecated in favor of <sys/bootblock.h> (the latter is more "host tool" friendly).
amd64 & i386: * Renamed /usr/mdec/bootxx_dosfs to /usr/mdec/bootxx_msdos, to be consistent with the naming convention of the msdosfs tools.
* Removed /usr/mdec/bootxx_ufs, as it's equivalent to bootxx_ffsv1 and it's confusing to have two functionally equivalent bootblocks, especially given that "ufs" has multiple meanings (it could be a synonym for "ffs", or the group of ffs/lfs/ext2fs file systems).
* Rework pbr.S (the first sector of bootxx_*): + Ensure that BPB (bytes 11..89) and the partition table (bytes 446..509) do not contain code. + Add support for booting from FAT partitions if BOOT_FROM_FAT is defined. (Only set for bootxx_msdos). + Remove "dummy" partition 3; if people want to installboot(8) these to the start of the disk they can use fdisk(8) to create a real MBR partition table... + Compile with TERSE_ERROR so it fits because of the above. Whilst this is less user friendly, I feel it's important to have a valid partition table and BPB in the MBR/PBR.
* Renamed /usr/mdec/biosboot to /usr/mdec/boot, to be consistent with other platforms.
* Enable SUPPORT_DOSFS in /usr/mdec/boot (stage2), so that we can boot off FAT partitions.
* Crank version of /usr/mdec/boot to 3.1, and fix some of the other entries in the version file.
installboot(8) (i386): * Read the existing MBR of the filesystem and retain the BIOS Parameter Block (BPB) in bytes 11..89 and the MBR partition table in bytes 446..509. (Previously installboot(8) would trash those two sections of the MBR.)
mbrlabel(8): * Use sys/lib/libkern/xlat_mbr_fstype.c instead of homegrown code to map the MBR partition type to the NetBSD disklabel type.
Test built "make release" for i386, and new bootblocks verified to work (even off FAT!).
|
1.8 |
| 06-Oct-2003 |
lukem | Replace BP_* with I386_BP_FLAGS_*, for consistency with other stuff in <sys/bootblock.h> (CONSDEV_ should be converted as well, but that's more intrusive...)
|
1.7 |
| 04-Jul-2003 |
dsl | Add some htole32() for host endianness independance
|
1.6 |
| 08-May-2003 |
petrov | Format fixes.
|
1.5 |
| 18-Apr-2003 |
bjh21 | Use <md5.h> rather than <sys/md5.h>. This is what the man page tells us to do, and is required for cross-compiling since libnbcompat doesn't provide <sys/md5.h>.
|
1.4 |
| 16-Apr-2003 |
briggs | Protect use of __RCSID() with a check to ensure that it's defined. Suggested by Ian Lance Taylor on tech-userlevel@ to help cross-compilation on Red Hat 7.3.
|
1.3 |
| 15-Apr-2003 |
dsl | Use htole32 so host endianness independant
|
1.2 |
| 15-Apr-2003 |
dsl | Change the way -o options are parsed, now done in MI code with a check after all the options have been processed that they are supported my the specific system. Add i386 MD options (console, password, speed and timeout) (Approved by christos and lukem)
|
1.1 |
| 09-Apr-2003 |
dsl | Add support for 'new' format i386 bootxx code
|
1.15.2.1 |
| 22-Jun-2004 |
tron | Pull up revision 1.16 (requested by jmc in ticket #527): Completely rework how tools/compat is done. Purge all uses/references to _NETBSD_SOURCE as this makes cross building from older/newer versions of NetBSD harder, not easier (and also makes the resulting tools 'different') Wrap all required code with the inclusion of nbtool_config.h, attempt to only use POSIX code in all places (or when reasonable test w. configure and provide definitions: ala u_int, etc). Reviewed by lukem. Tested on FreeBSD 4.9, Redhat Linux ES3, NetBSD 1.6.2 x86 NetBSD current (x86 and amd64) and Solaris 9. Fixes PR's: PR#17762 PR#25944
|
1.28.8.1 |
| 24-Mar-2008 |
keiichi | sync with head.
|
1.28.4.1 |
| 23-Mar-2008 |
matt | sync with HEAD
|
1.29.2.1 |
| 18-May-2008 |
yamt | sync with head.
|
1.30.8.1 |
| 13-May-2009 |
jym | Sync with HEAD.
Third (and last) commit. See http://mail-index.netbsd.org/source-changes/2009/05/13/msg221222.html
|
1.37.2.2 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
1.37.2.1 |
| 17-Apr-2012 |
yamt | sync with head
|
1.39.2.1 |
| 23-Jun-2013 |
tls | resync from head
|
1.40.26.1 |
| 25-Jun-2018 |
pgoyette | Sync with HEAD
|
1.40.20.1 |
| 24-Jun-2018 |
martin | Pull up following revision(s) (requested by kamil in ticket #898):
usr.sbin/installboot/arch/i386.c: revision 1.41
Fix integer overflow in installboot(8) Add a sanity check of the disk_buf first three bytes. The original code on a disk with nul bytes was causing integer overflow and thus calling the memcmp(3) functin in is_zero() with enormous length. Verity that the 0th byte is JMP, 1th a signed byte >= 9 to prevent overflow and 2th byte NOP.
Add a comment explaining the check.
Detected with MKSANITIZER and ASan.
|
1.41.2.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|