Commit Graph

123 Commits

Author SHA1 Message Date
thorpej 696896edc9 Add evbmips support for u-boot handling. 2020-06-21 17:17:01 +00:00
thorpej 02d67d1066 Add installboot(8) support for evbarm (and, in the future, other evb*)
boards that use u-boot.  A known board database lists boards and their
respective u-boot packages.  u-boot packages are discovered at run-time
(in /usr/pkg/share/u-boot, by default).  These packages contain board
database overlays that describe u-boot installation procedure that's
specific for that board.

Support this as a native tool and as a host tool.  The native tool
will attempt to determine the running board type using OpenFirmware
calls.  Host tool and native tool alike may also specify a board type
directly using the "-o board=xxx option" or have installboot(8) determine
the board type from a device tree blob using "-o dtb=/path/to/board.dtb".
A "-o media=xxx" option is provided for boards that have different u-boot
binaries and/or installation procedures for different media types (e.g.
SDMMC, eMMC, or USB).

This is trivial to extend to other evb* platforms that use u-boot, even if
they don't use FDT for autoconfiguration.
2019-05-07 05:02:41 +00:00
thorpej e5c09b191b Use designated initializers for struct ib_mach. 2019-05-07 04:35:31 +00:00
kamil 49b4c5f864 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.
2018-06-23 14:15:57 +00:00
christos fbbb03bfac don't complain if the mbr was all 0's. 2017-07-17 18:43:45 +00:00
mlelstv bddb934a67 Compute bootloader checksum correctly also on little endian systems. 2015-06-05 05:02:48 +00:00
christos 039e20963e Use VAX_LABELOFFSET here; It needs to be the machine-specific one. Thanks
to gcc-4.8 for discovering the bug and to Atari for having a LABELOFFSET of
516 > 512 :-)
XXX: Perhaps we should put all those constants in <sys/bootblock.h> instead
of spreading them around.
2014-11-13 16:02:25 +00:00
skrll 6d3ceb1d61 Rename NetBSD/hp700 to NetBSD/hppa.
Unfortunately our VCS isn't very helpful here.
2014-02-24 07:23:38 +00:00
christos a74a5abffb XXX: gcc initialize a variable 2013-10-21 15:37:46 +00:00
christos 4013b33b0e move all the unused code inside #if 0 2013-10-19 17:08:15 +00:00
martin 23e8ed59f1 In the tool build <nbinclude/vax/disklabel.h> is enough. 2013-06-16 19:05:00 +00:00
msaitoh 0893cfd5dd Remove trailng whitespaces. 2013-06-14 03:54:43 +00:00
matt 252b82608c Make this build with the disk label change. 2013-05-03 21:32:04 +00:00
martin 67c2857b08 Provide an empty __CTASSERT() for toolbuilds 2013-04-04 16:11:12 +00:00
martin e23a017d74 Fix installboot for VAX, as discussed on port-vax. Problem pointed out
by Jonny Billquist, thanks to Marl Pizzolato for patiently explaining
the various ways of booting a vax to me.
Now VAX 780 can boot directly from VMB.EXE again.
2013-04-04 12:55:30 +00:00
gson 4caffa5d5e When printing the list of valid console names, don't treat the consoles[]
array as NULL terminated, because it's not.
2012-04-06 10:10:11 +00:00
dsl 095ac4e735 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.
2012-03-10 18:42:18 +00:00
skrll 008d551992 Make it an error for the partition to exceed the PDC limit.
Inspired by PR/45742
2012-01-09 11:44:53 +00:00
christos 7a3dc95e5c fix various gcc-4.5 warnings 2011-08-14 17:50:16 +00:00
tsutsui 14d39e456d Fix botch in previous revision. Sorry for a stupid change. 2011-02-10 23:25:11 +00:00
pooka 5f7e80a834 Add support for the Extensible MIPS ("eMIPS") platform. The
NetBSD/emips port runs on Xilinx and Beecube FPGA systems and the
Giano system simulator.

eMIPS is a platform developed at Microsoft Research for researching
reconfigurable computing.  eMIPS allows dynamic loading and scheduling
of application-specific circuits for the purpose of accelerating
computations based on the current workload.

NetBSD eMIPS support for NetBSD 4.x was written at Microsoft Research
by Alessandro Forin and Neil Pittman.  Microsoft Corporation has
donated full copyright to The NetBSD Foundation.

Platform support for eMIPS is the first part of Microsoft's
contribution.  The second part includes the hardware accelerator
framework and will be proposed on tech-kern soon.
2011-01-26 01:18:43 +00:00
drochner 23174fa441 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.
2010-01-17 14:54:43 +00:00
drochner 79f027bbd6 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.
2010-01-14 17:49:31 +00:00
tsutsui e5f39b5e90 Remove if defined(__RCSID) around __RCSID() macro.
#include "nbtool_config.h" is enough for tools.
2010-01-14 16:27:49 +00:00
tsutsui 17ad8ece63 Add a sectorsize parameter member in struct ib_params and use it
where sector size (disk block size) is required, instead of
DEV_BSIZE constant which means device I/O block size.

"Looks reasonable" from dholland@, and fixes tools installboot(8)
on Cygwin where DEV_BSIZE != 512 as mentioned in PR toolchain/42555.
2010-01-07 13:26:00 +00:00
mbalmer a72f71643d Fix typo in comments, no code change. 2009-12-23 09:17:40 +00:00
tsutsui 359ac4c562 A checksum value in alpha boot block is stored in little endian,
so use le64toh() to print it on the host tool.
While here, use consistent (unsignd long long) casts on printing it.
2009-10-26 14:26:25 +00:00
lukem 7c56c3165d refer to FFSv1 instead of UFSv1 2009-05-07 07:03:39 +00:00
lukem 2b2f4703f2 fix sign-compare issues 2009-04-05 11:48:02 +00:00
christos b86f9ffb61 CID 4393: plug memory leak. 2009-02-18 20:06:27 +00:00
mrg c2b95373bf remove clause #3 from my license where there are no other
copyright holders involved.
2008-05-29 14:51:25 +00:00
tsutsui ff1b9852ce Try DIOCWLABEL ioctl only if write op fails with EROFS
because the ioctl is required and valid only for raw devices.
2008-05-24 19:15:21 +00:00
tsutsui a9e4cec8d9 Use DIOCWLABEL ioctl before writing block 0 which might be
protected by (now MI) bounds_check_with_label(9).
Fixes a problem on sysinst mentioned in PR port-macppc/38016.
2008-05-09 10:14:35 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
dsl f8907c6f49 Add a large warning about the possible side effect of using '-f'. 2008-03-06 21:27:41 +00:00
itohy 9ef5327a26 Try to warn possibly unbootable conditions:
- no disklabel
 - no partition "a"
 - partition "a" exceeds 2GB boundary
2008-02-02 16:46:15 +00:00
itohy d87794fe47 Change be32toh to htobe32 where applicable. 2008-02-02 13:37:13 +00:00
itohy 347910d40e d_npartitions field of struct disklabel is 16bit, not 32bit. 2008-02-02 13:09:47 +00:00
christos 115d8ccfd7 Don't use __arraycount because this is a 700L, and toolz have messed up
includes.
2007-06-23 23:18:29 +00:00
dogcow a7e26eabfd unb0rk tools/ builds on systems that don't have __arraycount() defined. 2007-06-23 23:07:44 +00:00
christos 1d3b6feacb PR/36527: Greg A. Woods: installboot(8) doesn't allow for the valid
consdev=auto setting
2007-06-23 14:46:00 +00:00
dsl 486d411937 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.
2007-02-15 22:23:11 +00:00
dogcow bee2705c99 %d -> %ld, so that building on alpha doesn't fail. (also print more useful
errors - x bytes written, should be y.)
2007-01-07 04:16:57 +00:00
dsl eacd963375 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.
2007-01-06 10:21:24 +00:00
christos 34fd379e33 Coverity CID 4160: Remove dead code. 2006-09-27 21:22:52 +00:00
uwe 973bc97b66 NetBSD/landisk support. 2006-09-01 21:47:21 +00:00
dsl 1ec8e10fce Coverty 7449: Change 'return (0)' to 'goto done' so we free(bootstrapbuf)
before exiting with error.
2006-03-18 11:08:19 +00:00
dsl cce659e230 Move the MD definitions into the MD files, leaving machines.c with just
a list of the supported machines.
2006-02-18 10:08:07 +00:00
dsl 16ca1f6da7 Fix the detection of the bootstrap magic number when run on big-endian systems.
Correct another typo.
2006-01-30 21:15:37 +00:00
dsl 6c51ef9cb5 Fix spelling mistake in message 2006-01-24 18:35:18 +00:00