Commit Graph

323 Commits

Author SHA1 Message Date
Dimitry Andric
980e47cff3 Merge ^/head r274961 through r275261. 2014-11-29 18:44:52 +00:00
Yoshihiro Takahashi
ed7959517b MFi386: r275059, r275061, r275062 and r275191 (by rdivacky)
Shrink boot2 by a couple more bytes.
2014-11-29 12:22:31 +00:00
Yoshihiro Takahashi
6d6911c44b MFi386: r275237 (by rdivacky)
Shrink boot2 a bit more by factoring out common pattern
  of printf();return(-1);
2014-11-29 09:27:18 +00:00
Dimitry Andric
71369fed66 Similar to r274977, use the correct combination of flags to get the pc98
boot2 below the limit.
2014-11-25 21:08:31 +00:00
Yoshihiro Takahashi
cf902afcac MFi386: r274398
Move NFS and TFTP filesystems before the synthetic filesystems (bzip,
  gzip, and split).
2014-11-15 03:34:34 +00:00
Yoshihiro Takahashi
4ac1175e89 MFi386: r261567
Switch from lib/libstand to sys/boot/libstand32.
2014-09-28 13:34:43 +00:00
Yoshihiro Takahashi
2c4969da8d MFi386: r268974
Supress clang warning for FreeBSD printf %b and %D formats.
2014-09-28 13:13:18 +00:00
Yoshihiro Takahashi
f40e4b0c6d MFi386: r261520
Drop the 3rd clause from all 3 clause BSD licenses.
2014-09-28 12:25:27 +00:00
Yoshihiro Takahashi
985b2f8cd1 Reduce diffs against i386. 2014-09-28 12:13:51 +00:00
Bryan Drewery
5608fd23c2 Revert r267233 for now. PIE support needs to be reworked.
1. 50+% of NO_PIE use is fixed by adding -fPIC to INTERNALLIB and other
   build-only utility libraries.
2. Another 40% is fixed by generating _pic.a variants of various libraries.
3. Some of the NO_PIE use is a bit absurd as it is disabling PIE (and ASLR)
   where it never would work anyhow, such as csu or loader. This suggests
   there may be better ways of adding support to the tree. Many of these
   cases can be fixed such that -fPIE will work but there is really no
   reason to have it in those cases.
4. Some of the uses are working around hacks done to some Makefiles that are
   really building libraries but have been using bsd.prog.mk because the code
   is cleaner. Had they been using bsd.lib.mk then NO_PIE would not have
   been needed.

We likely do want to enable PIE by default (opt-out) for non-tree consumers
(such as ports). For in-tree though we probably want to only enable PIE
(opt-in) for common attack targets such as remote service daemons and setuid
utilities. This is also a great performance compromise since ASLR is expected
to reduce performance. As such it does not make sense to enable it in all
utilities such as ls(1) that have little benefit to having it enabled.

Reported by:	kib
2014-08-19 15:04:32 +00:00
Marcel Moolenaar
7fe0b4f160 Give loaders more control over the Forth initialization process. In
particular, allow loaders to define the name of the RC script the
interpreter needs to use. Use this new-found control to have the
PXE loader (when compiled with TFTP support and not NFS support)
read from ${bootfile}.4th, where ${bootfile} is the name of the
file fetched by the PXE firmware.

The normal startup process involves reading the following files:
1.  /boot/boot.4th
2.  /boot/loader.rc or alternatively /boot/boot.conf

When these come from a FreeBSD-defined file system, this is all
good. But when we boot over the network, subdirectories and fixed
file names are often painful to administrators and there's really
no way for them to change the behaviour of the loader.

Obtained from:	Juniper Networks, Inc.
2014-07-27 16:12:51 +00:00
Warner Losh
aa0b5651c1 Compile boot2 with clang on pc98. 2014-07-10 00:15:50 +00:00
Warner Losh
53dda6a8d5 Make SERIAL support optional again. Enable it for i386 because a huge
percentage of machines has a 16550. Disable it for pc98 since only a
tiny fraction of them have one. These changes save 293 bytes when
building with clang, but preserves the ability to build with serial if
you really want.  We now have 92 bytes free (412 with the in-tree gcc).
2014-07-10 00:15:42 +00:00
Warner Losh
522d68a17f Merge the clang support from i386. Don't move to clang yet. 2014-07-10 00:15:38 +00:00
Bryan Drewery
864c53ead8 In preparation for ASLR [1] support add WITH_PIE to support building with -fPIE.
This is currently an opt-in build flag. Once ASLR support is ready and stable
it should changed to opt-out and be enabled by default along with ASLR.

Each application Makefile uses opt-out to ensure that ASLR will be enabled by
default in new directories when the system is compiled with PIE/ASLR. [2]

Mark known build failures as NO_PIE for now.

The only known runtime failure was rtld.

[1] http://www.bsdcan.org/2014/schedule/events/452.en.html
Submitted by:		Shawn Webb <lattera@gmail.com>
Discussed between:	des@ and Shawn Webb [2]
2014-06-08 17:29:31 +00:00
Warner Losh
c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Warner Losh
3bdf775801 NO_MAN= has been deprecated in favor of MAN= for some time, go ahead
and finish the job. ncurses is now the only Makefile in the tree that
uses it since it wasn't a simple mechanical change, and will be
addressed in a future commit.
2014-04-13 05:21:56 +00:00
Alexander Motin
75da4d0634 Make comconsole options set before its activation to be remembered.
MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2014-01-20 23:27:05 +00:00
Dimitry Andric
4abd7edcbd Split the last gcc-specific flags off into CFLAGS.gcc. This also
removes the need to use -Qunused-arguments for clang throughout the
tree.

MFC after:	3 days
2014-01-05 21:03:49 +00:00
Dimitry Andric
d5c1aaf2fb For sys/boot/i386 and sys/boot/pc98, separate flags to be passed
directly to the linker (LD_FLAGS) from flags passed indirectly, via the
compiler driver (LDFLAGS).

This is because several Makefiles under sys/boot/i386 and sys/boot/pc98
use ${LD} directly to link, and the normal LDFLAGS value should not be
used in these cases.

MFC after:	3 days
2013-12-30 19:05:50 +00:00
Dimitry Andric
d19f075047 Fix pc98 build, by also forcing COMPILER_TYPE in sys/boot/pc98/boot2's
Makefile.

Pointy hat to:	dim
MFC after:	3 days
X-MFC-With:	r259730
2013-12-26 22:31:47 +00:00
Dimitry Andric
0673132dcb For libstand and sys/boot, split off gcc-only flags into CFLAGS.gcc.
MFC after:	3 days
X-MFC-With:	r259730
2013-12-26 11:32:39 +00:00
Marcel Moolenaar
e01c6f329a Change <sys/diskpc98.h> to not redefine the same symbols that are
being defined in <sys/diskmbr.h>. Instead give the symbols here a
"PC98_" prefix. This way, both <sys/diskmbr.h> and <sys/diskpc98.h>
can be included in the same C source file.

The renaming is trivial. The only gotcha is that DOSBBSECTOR is
also redefined from 0 to 1. This because DOSBBSECTOR was always
used in conjunction with an addition of 1. The PC98_BBSECTOR symbol
is defined as 1 and the expression is simplified.

Note: it is not believed that ports are seriously impacted; or at
all for that matter.

Approved by: nyan@
2013-08-07 00:00:48 +00:00
Yoshihiro Takahashi
9a068b2e34 MFi386: revision 245848
Always update the hw.uart.console hint.
2013-06-01 12:27:48 +00:00
John Baldwin
6c14193bd0 Don't pad disk partition sizes with leading zeros. This was already
fixed in a different way by the new disk code used for other
platforms.

MFC after:	1 week
2013-05-07 18:08:49 +00:00
Dimitry Andric
dbfc29017c When rebooting (exiting) from the BTX loader, make sure to restore the
GDT from the correct segment, otherwise a triple fault would be caused.
In some virtual environments (VMware, VirtualBox, etc) this could lead
to a unhandled error or hang in the guest emulation software.

Thanks to avg and jhb for a few hints in the right direction.

Noticed by:	Jeremy Chadwick <jdc@koitsu.org> (and many others)
MFC after:	1 week
2013-04-24 17:20:45 +00:00
Yoshihiro Takahashi
5016be6c9e cosmetic changes to reduce diffs against i386. 2012-11-10 12:42:28 +00:00
Yoshihiro Takahashi
c224072d61 MFi386: r241300
i386 comconsole: don't loop forever if hardware doesn't respond

    - clear capability flags when hw timeouts
    - retire comc_started status variable and directly use c_flags to see
      if comconsole is selected for use
2012-11-10 12:38:06 +00:00
Yoshihiro Takahashi
f34d85e0ec MFi386: r241301
add detection of serial console presence to btx and boot2-like blocks
2012-11-10 12:25:27 +00:00
Yoshihiro Takahashi
9260abade3 MFi386: r241785
boot: use -march=i386 for both i386 and amd64 builds
2012-11-10 11:55:52 +00:00
Dimitry Andric
ff0d9e7dbf Put in a band-aid to get the pc98 bootstraps building, now clang is the
default compiler.  This has two parts:
- Make sys/boot/pc98/boot2 always build with gcc for now, until we can
  figure out a way to shrink it enough when building with clang.
- Since sys/boot/p98/cdboot uses .code16 directives, which are not yet
  supported by clang's integrated assembler, use -no-integrated-as,
  similar to sys/boot/i386/cdboot.

Reviewed by:	nyan
MFC after:	1 week
2012-11-07 19:51:53 +00:00
Devin Teske
6674efd728 Hook in new files menusets.4th and manual.
Approved by:	adrian (co-mentor) (implicit)
2012-11-07 02:14:03 +00:00
Yoshihiro Takahashi
a112b2d0e4 MFi386: revision 240637
loader/i386: replace ugly inb/outb re-implementations with cpufunc.h
2012-09-23 08:50:54 +00:00
Yoshihiro Takahashi
4794983d3e Cosmetic changes. 2012-09-23 08:46:44 +00:00
Yoshihiro Takahashi
7361df284b Reduce diffs against i386. 2012-08-05 14:48:55 +00:00
Yoshihiro Takahashi
d68fc999de Reduce diffs against i386. 2012-08-05 14:11:07 +00:00
Yoshihiro Takahashi
72b179343b MFi386: the part of r219452 and r236405.
- bunch of variables are turned into uint8_t.
  - Remove unnecessary initializations.
2012-08-05 14:05:11 +00:00
Gleb Kurtsou
491a40587d Use 32-bit ufs_ino_t instead of ino_t to keep boot2 small and prevent
unnecessary 64-bit math on 32-bit machines.

Sponsored by:	Google Summer of Code 2011
2012-05-25 09:36:39 +00:00
Andriy Gapon
76438db6a7 libpc98: unbreak after zfs-related changes in libi386 code
Pointyhat to:	avg
MFC after:	1 month
2012-05-13 11:34:05 +00:00
Andriy Gapon
006d25ce15 MFi386: improve argument passing via btxldr
use related definitions in i386 bootargs.h

Reviewed by:	nyan, jhb
MFC after:	1 month
2012-05-11 09:46:17 +00:00
Andriy Gapon
a45337f99f i386 boot: consolidate MAXBDDEV definition
MFC after:	1 month
2012-05-09 08:05:50 +00:00
Yoshihiro Takahashi
08cdfdf1de MFi386: revisions 232570 and 232754
Fix boot2 to handle boot config files that only contain a custom path to
  a loader or kernel.
2012-03-10 15:08:37 +00:00
Dimitry Andric
07b202a847 Define several extra macros in bsd.sys.mk and sys/conf/kern.pre.mk, to
get rid of testing explicitly for clang (using ${CC:T:Mclang}) in
individual Makefiles.

Instead, use the following extra macros, for use with clang:
- NO_WERROR.clang       (disables -Werror)
- NO_WCAST_ALIGN.clang  (disables -Wcast-align)
- NO_WFORMAT.clang	(disables -Wformat and friends)
- CLANG_NO_IAS		(disables integrated assembler)
- CLANG_OPT_SMALL	(adds flags for extra small size optimizations)

As a side effect, this enables setting CC/CXX/CPP in src.conf instead of
make.conf!  For clang, use the following:

CC=clang
CXX=clang++
CPP=clang-cpp

MFC after:	2 weeks
2012-02-28 18:30:18 +00:00
Yoshihiro Takahashi
d56a003132 Reduce diffs against i386.
MFC after:	1 week
2012-02-10 15:34:36 +00:00
Yoshihiro Takahashi
a57b8b9e02 MFi386: revision 229435
Add special loader environment variables 'comconsole_port' and
  'comconsole_pcidev'.

MFC after:	2 weeks
2012-01-04 03:54:30 +00:00
Yoshihiro Takahashi
da5f7df3a6 Fix 230MB MO support.
Submitted by:	Kaho Toshikazu
MFC after:	1 week
2012-01-04 03:49:41 +00:00
John Baldwin
4f88092408 Consolidate duplicate definitions of V86_CY() and V86_ZR() which check for
the carry and zero flags being set, respectively, in <btxv86.h> and use
them throughout the x86 boot code.
2011-10-25 19:45:12 +00:00
Dag-Erling Smørgrav
0f8284dd89 Look for /boot/config in addition to /boot.config, with the former taking
precedence over the latter if it exists.

MFC after:	3 weeks
2011-10-18 09:46:52 +00:00
Julian Elischer
802e09ac9e New boot loader menus from Devin Teske.
Discussed on hackers and recommended for inclusion into 9.0 at the devsummit.
All support email to devin   dteske at vicor dot ignoreme dot com .

Submitted by:	dteske at vicor dot ignoreme dot com
Reviewed by:	me and many others
2011-05-28 08:50:38 +00:00
Yoshihiro Takahashi
59707f16bd MFi386: revisions 220389 and 220392
- Mark getc() as inline, this has no effect on gcc but helps clang.
  - Move getc() body before xgetc() so gcc does not emit a warning about
    function having no body.
2011-04-16 06:20:49 +00:00