Commit Graph

76 Commits

Author SHA1 Message Date
lukem 1c33b4e6a4 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!).
2003-10-08 04:25:43 +00:00
he b372f2beaa Adapt to const-ification of first arg of open function in fs_ops. 2003-08-22 08:06:19 +00:00
aymeric f0696ba4ba strategy() should really have an ANSI prototype. Otherwise its daddr_t
argument gets passed wrongly.
This should fix a bug reported by Martin J. Laubach on port-macppc, and
was fixed two weeks ago in NetBSD/ofppc.
2003-07-11 23:38:08 +00:00
thorpej ecd9fdcc76 Oops, didn't mean to commit this. 2003-04-02 03:16:39 +00:00
thorpej d470cda51b Use PAGE_SIZE rather than NBPG. 2003-04-02 02:56:40 +00:00
drochner a15dcfdce7 Avoid conflict with sockets[] definition in net.h
and add some typecasts.
Thanks to Juergen Hannken-Illjes for compile-checking.
2003-03-13 14:05:53 +00:00
drochner 47fe380b4c make netif_close() return value void
fix prototype
2003-03-13 12:15:31 +00:00
drochner e5cc00b939 Remove remaining uses of libsa/netif -- the "netif" structure was only
used to lookup a "struct of_dev", everything else was ballast.
Do it straightforward now and assign the ofdev directly to io_netif.
2003-03-13 11:35:54 +00:00
matt a391bf2e06 Make this play with gcc 3.3. Add -ffreestanding. Cleanup bootxx. 2003-02-28 05:24:56 +00:00
soren e9d72b5b52 Make ALLOC_TRACE work again. 2003-02-17 08:21:39 +00:00
thorpej 2c75f5b061 No need to depend on userland libraries here. 2002-12-09 16:30:40 +00:00
matt 8b4993db5d Convert to register prefixes. Use ANSI string concatenation for
multiline asm strings.
2002-10-31 21:31:08 +00:00
wrstuden 0ce4a385a5 Should have done this sooner. Bump to version 1.7 to indicate good
alloc.c.
2002-10-18 21:22:40 +00:00
wrstuden 470e4ff3ac Remove vestiges of the syncicache() call originally in powerpc/ofwboot
before rev 1.4. This change makes OF 2.4 machines actually boot, and
it works fine on my OF 2.01 machine. No reports of failures on other
archs.

I expect this change is fine as the original code flushed the just-loaded
ofwboot out of the cache, conditionalized on FIRMWORKSBUGS. In rev.
1.4, the code got in-lined, and changed to actually flush low memory
out of the cache. Since machines kept booting, I expect the firmware
was really flushing the binary out of the cache, so we're fine.
2002-09-27 00:32:17 +00:00
wrstuden 4f7aaad83c Re-add own alloc(). Recent issues with kernels randomly dying on boot
are related to using libsa's alloc(). Problems go away with this alloc().

The problem is that the libsa alloc() assumes we can grab memory off
the end of the program. That assumption doesn't work for us. It's
much better to use the alloc() we were using as it calls OF_claim()
to get memory.
2002-09-20 03:20:24 +00:00
itojun 73941c5096 avoid hardcoding MBR_MAGICOFF and MBR_MAGIC. 2002-06-18 00:37:25 +00:00
itojun 980d7c811b LABELSECTOR is redefined to be 0 on macppc, so it is not usable for MBR
disk label offset.  use hardcoded "1" for now, i guess we need a new #define
in sys/disklabel_mbr.h.  fixes ofwboot to boot kernel off from MBR-formatted
disk.
2002-06-17 23:59:01 +00:00
tsutsui c7a7330ca9 Add "cleanlibdir" target. 2002-04-13 13:35:23 +00:00
tsutsui c58dce575b Set USE_LIBSA_MEMCPY and USE_LIBSA_MEMSET to save a few bytes. 2002-04-13 13:31:40 +00:00
tsutsui 9e9f7b6c60 Bump version for ustarfs support. 2002-03-30 07:17:48 +00:00
tsutsui 4a12192a62 Enable SUPPORT_USTARFS and HAVE_CHANGEDISK_HOOK in CPPFLAGS. 2002-03-30 07:17:09 +00:00
tsutsui 5cb20a9896 Add changedisk_hook() for ustarfs. (from tsubai) 2002-03-30 07:15:51 +00:00
tsutsui 18c67eedf6 Add ustarfs ops. 2002-03-30 07:14:49 +00:00
tsutsui a0453e4c67 Remove unused define/include/variable. 2002-03-29 20:31:52 +00:00
tsutsui 2167e61bce Add back -I. to CPPFLAGS. 2002-03-29 20:26:06 +00:00
tsutsui ad8cbb6cbc Cleanup some flags. 2002-03-29 18:21:38 +00:00
tsutsui a59e9106d6 Cosmetics. 2002-03-29 15:15:07 +00:00
jmc 68b038f787 Wrap the generation of machine and powerpc links so they don't happen during
make obj, clean or cleandir as the proper objdir may not be around yet.
2002-03-02 06:32:28 +00:00
wrstuden 3a971f756f Make this work with the dependall target.
Pointed out by Christian Groessle on port-macppc, and patch suggested bu
Izumi Tsutsui.
2002-02-13 17:52:08 +00:00
wrstuden 0dd5e345ea Check in machinery to make ofwboot load at 600000, while ofwboot.elf
and ofwboot.xcf will load at 640000. The idea is that we can now
leave load-base at 600000, and it will work right for all three methods.

The problem is that the file loader and the net loader use load-base
as a scratch area, so if the executable really wants to load there,
the load fails.
2002-02-01 18:45:29 +00:00
matt 3b0bdd1f0f Remove machine/powerpc links on clean as well. 2002-01-07 23:09:53 +00:00
tv 8e6f7afb5b MKfoo=no -> NOfoo 2001-12-12 01:48:43 +00:00
tv 5489b30b60 ${MAKE} print-objdir -> ${PRINTOBJDIR} 2001-11-14 00:58:48 +00:00
scw 45e7238a02 Bump the version numbers of all bootloaders which use loadfile_elfXX() now
that it tries hard to avoid backwards seeks.
2001-11-09 19:53:11 +00:00
wiz 4c99916337 va_{start,end} audit:
Make sure that each va_start has one and only one matching va_end,
especially in error cases.
If the va_list is used multiple times, do multiple va_starts/va_ends.
If a function gets va_list as argument, don't let it use va_end (since
it's the callers responsibility).

Improved by comments from enami and christos -- thanks!

Heimdal/krb4/KAME changes already fed back, rest to follow.

Inspired by, but not not based on, OpenBSD.
2001-09-24 13:22:25 +00:00
tv ab11c169b5 objcopy -> ${OBJCOPY}; remove redundant definitions of OBJCOPY?= (it is
now in bsd.own.mk).
2001-09-22 03:34:17 +00:00
tsubai e20342e78d Fix a bug introduced when machine_type.h was removed.
Now the kernel can read symbol table again.
2001-08-23 14:17:27 +00:00
tsubai b1d1120084 Search "/netbsd.gz" and "/netbsd.macppc" in addition to "/netbsd". 2001-08-13 15:38:11 +00:00
bjh21 ad2c12a28d Bump version numbers of all bootloaders that use loadfile/ELF, to account for
my changes to symbol loading.  I should probably have done this at the time,
but it's better late than never.
2001-08-02 12:24:05 +00:00
wiz c5a6be17f4 bcopy -> memcpy, bzero -> memset, bcmp -> memcmp.
Reviewed by Matt Thomas, ok'd by Tsubai Masanari.
2001-07-22 11:29:44 +00:00
matt b499a7d558 Add -Wno-main since this is a standalone program. 2001-07-18 05:37:55 +00:00
soren 945b972563 PPC machine type tags haven't been used for a while. 2001-05-03 13:11:24 +00:00
matt 9dd26cf7c4 It's hfs.c, not hfs. Add -I${.CURDIR} for objdirs. XXX hfs.c should
be integrated into libsa.
2000-11-16 07:36:04 +00:00
tsubai e3ae93dfd4 Add hfs support. Currently this layer simply throw the request to the OF
(and the OF recognizes HFS).
2000-11-14 11:25:34 +00:00
garbled b7c07855f6 make -> ${MAKE} 2000-10-28 15:41:25 +00:00
wrstuden 07a9408ae6 Move ofwboot to 600000 hex. Should make loading better (less likely to
run into OF internals).
2000-10-13 00:19:30 +00:00
jdolecek 49c105ffdb add new macro BOOT_FLAG() (defined in <sys/boot_flag.h>) - this
maps standard boot flags to corresponding RB_* values
use BOOT_FLAG() in port's MD code as appropriate

as discussed on tech-kern, add new boot flags -v, -q for booting
verbosely or quietly, and corresponding AB_VERBOSE/AB_QUIET
boot flags; also add FreeBSD-compatible bootverbose macro and
NetBSD-specific bootquiet macro

for hpcmips, use new bootverbose instead of it's own hpcmips_verbose

Tested on i386, and to limited extend (compile of affected files) also for
mvme68k, hp300, luna68k, sun3.
2000-09-24 12:32:31 +00:00
tsubai 1267826d5d Increase stack size. 2000-08-20 07:04:59 +00:00
tsubai 46ab3e89fb Use libsa alloc(). 2000-07-25 06:26:18 +00:00
tsubai dd54c272e5 Add ofwboot.{mrg,xcf} to CLEANFILES. 2000-07-25 06:22:05 +00:00