Commit Graph

987 Commits

Author SHA1 Message Date
jmcneill
1265ac6952 Add support for using a raw file-system image as memory disk root with
the x86 bootloader.
2013-08-30 16:42:17 +00:00
matt
2d9934729c Add a missing KLINK_MACHINE= i386 2013-08-22 00:13:00 +00:00
matt
4e96513961 Add KLINK_MACHINE= i386 2013-08-21 17:15:26 +00:00
matt
57f3989b6c Set KLINK_MACHINE 2013-08-21 15:24:27 +00:00
matt
e76ea19a00 Use <bsd.klinks.mk> 2013-08-21 08:15:19 +00:00
he
6a91dd3147 Two changes for the i386 boot loader related to the boot menu which
can be defined in boot.cfg:

 * Add a "menu" command which re-displays the menu and initiates
   the timed countdown
 * Use any default command defined in boot.cfg as default args
   if the user runs "boot" with no arguments

This is useful in circumstances where you e.g. need to interrupt
the normal boot process to switch to serial console, and where
simply "boot netbsd" is no longer sufficient (e.g. as with install
media which needs the miniroot kernel module loaded).
2013-07-28 08:50:09 +00:00
joerg
c3f5de37f1 Explicitly disable unwind table generation. 2013-07-01 12:48:03 +00:00
tsutsui
9731120678 The 'vesa' command can take 'list' flag so mention it in an error message. 2013-05-31 15:11:07 +00:00
christos
2ec4fd84ba Complete the dosparts -> mbrparts conversion. Only x86k new uses dosparts
because it also uses struct dos_partition.
2013-05-16 19:06:44 +00:00
yamt
2a656f64f2 update help 2013-03-06 11:34:37 +00:00
joerg
9255259cb4 Don't depend on HAVE_GCC being always present. 2012-08-10 12:18:14 +00:00
riastradh
5e2dd63a88 Fix i386 `boot' command to try the usual set of kernel names.
Without this, the `boot' command will try only `netbsd', not
`netbsd.gz', `netbsd.old', &c.

Patch from PR port-i386/44562.
2012-08-04 03:51:27 +00:00
tsutsui
8c7e5abe07 Apply patch:
PR/46583: BIOS bootloader problems with partitions that start above 1TB

Should be pulled up to netbsd-6.
2012-07-03 15:24:37 +00:00
perseant
35e5ee1088 Sanity check the values coming back from the int13 extensions of the bios,
so we can catch impossible return values.  Allows the bootloader to work
again on the Soekris net4501.

Fixes PR kern/46027.
2012-06-13 18:34:20 +00:00
dsl
6a03bb6b37 Remove the code that tries to load the "ffs" kernel module during boot.
This is in line with the core decision than even modular kernels should
  contain the ffs code.
I've left in the code that tries to load "nfs" and "ext2fs", but it
  isn't clear that is necessary.
Removes a warning message that (usually) flashes past to fast to read.
AFAICT all the relevant kernels contain ffs (and nfs for that matter).
2012-05-21 21:34:16 +00:00
joerg
c25d63d977 -enable-iv-rewrite is neither supported nor needed with LLVM now.
The one case where it was a big win was partially an inliner bug and
the changes to the inline cost estimate are much smaller over all.
2012-04-04 10:54:44 +00:00
dsl
34a326a457 Add support for directly booting from FAT12 filesystems.
This shouldn't really be needed except that Linux wont
mount a small FAT16 filesystem - it always treats it as FAT12
even when you tell it otherwise.
There was enough free space before the main FS on the USB stick
I've been using for an extra small FAT fs to boot from.
2012-03-10 23:59:36 +00:00
jnemeth
a9a0f4b79c Stop building boot ROM images for old PC NICs as discussed on tech-kern. 2012-01-27 08:41:35 +00:00
christos
488f092662 PR/45796: Evgeniy Ivanov minixfs3 support. 2012-01-16 18:46:20 +00:00
tsutsui
c2e8ce644b Apply the following patch submitted by Evgeniy Ivanov:
http://mail-index.NetBSD.org/tech-kern/2011/12/15/msg012226.html
http://mail-index.NetBSD.org/tech-kern/2011/12/17/msg012229.html

 - add 'ls' op to struct fs_ops to support ls command on each fs,
   enabled by -DLIBSA_ENABLE_LS_OP and SAMISCMAKEFLAGS+="SA_ENABLE_LS_OP=yes"
   in libsa
 - split sys/lib/libsa/ufs_ls.c into UFS specific part and MI part (ls.c)
   that opens the target fs and calls fs-depedent XXX_ls() functions
 - add a ls op for ext2fs
   (all other fs than ufs and ext2fs don't have actual ls ops yet)
 - replace existing MD ufs_ls() calls with this new MI ls()

The original patch was written for i386 and ext2fs.
zaurus zboot has been tested by nonaka@.
ews4800mips and x68k loaders have been tested by me (with several fixes).
landisk might be okay since it was almost copied from i386.

XXX1: "ls" op in fs_ops looks a bit inconsistent, but we will be able to
      replace it with real fs ops like readdir if it's really worth
XXX2: someone might have to check sys/arch/ia64/stand/efi/libefi/efifs_ls.c
2011-12-25 06:09:08 +00:00
joerg
7aff2f5b79 Use new -mstack-alignment option to replace the removed internal option. 2011-12-11 14:59:24 +00:00
tls
a031ce7187 Add support for passing saved entropy (random seed file) to the kernel
from the bootloader.  This can fix the problem of poor quality keys
for other kernel modules which call arc4random() early in kernel startup
(NFS startup, in particular, causes this).

We continue to rely on the etc/rc.d/random_seed script to save entropy
to the seed file at shutdown and erase the seed file at startup.

Boot loader support implemented only for i386 and amd64 ports for now but
it should be easy for other ports to do the same or similar.
2011-11-28 07:56:53 +00:00
martin
4fc4feee2e New Rawrite32 release is out. 2011-11-27 09:24:34 +00:00
martin
bc780b3f84 Update to version 1.0.2.2 2011-10-28 13:18:57 +00:00
joerg
9aa0541bdf Update LLVM/Clang snapshot to r141658. This primarily fixes a regression
preventing Qt4 from building.
2011-10-11 13:53:56 +00:00
martin
12de7c048b Update Rawrite32 to latests version 2011-09-22 22:00:52 +00:00
jakllsch
b500df69ab Set LOADADDR to 0x600, matches how gptmbr.bin is compiled upstream.
This should let this actually work.
2011-09-21 18:15:59 +00:00
gsutre
a9aa6757ca Fix btinfo_bootdisk's labelsector and btinfo_bootwedge's startblk for
the non-GPT case.

ok jakllsch@
2011-09-21 08:57:12 +00:00
mrg
f63becec07 disable mmx/sse here too. hopefully fixes amd64 /boot issues.
certainly changes the output in ways that gcc 4.1 doesn't.
2011-08-22 09:43:08 +00:00
christos
9bc1ed7123 PR/43563: Wolfgang Solfrank: boot.cfg doesn't support comments
Fix makes it support # comments and treat spaces and tabs the same way.
2011-08-18 13:20:04 +00:00
joerg
0a50150ffc .code16 user, so disable integrated assembler with clang for now. 2011-08-17 22:26:40 +00:00
jakllsch
d8f59264ae Add gptmbr from syslinux 4.04, with some local modifications to fit our mbr
build system and to be self contanined.

Also, unlink the old mbr_gpt from the build.
2011-08-17 00:25:05 +00:00
jakllsch
52082ed8b6 Remove home grown GPT MBR handoff support in favor of T13 EDD-4 annex A,
which does the same thing in a more interoperable way.
2011-08-17 00:07:38 +00:00
joerg
3eb244d801 Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
2011-07-17 20:54:30 +00:00
mrg
b7e452c793 remove HAVE_GCC == 4 conditional 2011-07-01 01:26:15 +00:00
mrg
f6f68342e6 cast a uint8_t * to a char * for a function that takes char *. 2011-06-23 12:07:00 +00:00
mrg
c111245a78 apply some -Wno-error and/or -fno-strict-aliasing.
all of this should be looked at closer, but some of them are not
very trivial.
2011-06-22 02:49:41 +00:00
mrg
e685ea4b88 remove some more ancient HAVE_GCC checks. 2011-06-20 08:46:28 +00:00
mrg
8f161cd6d3 remove all the code that supported HAVE_GCC=3. mostly from chuq. 2011-06-20 06:52:36 +00:00
joerg
9708bada85 Refactor compiler-specific optimizer flags. Mark bootxx as supported
with clang.
2011-06-16 16:39:53 +00:00
joerg
c97378d081 Add an optional MD calling convention flag for use in libsa when space
optimisation is critical. Use this on i386 to switch to register passing
calling convention for the file system entry points and most assembler
call backs that have to preserve at least 3 registers.
2011-06-16 13:27:58 +00:00
joerg
bc843b5e55 Use prototypes from libi386.h. 2011-06-08 16:04:40 +00:00
joerg
db603d4492 G/C wbinvd 2011-06-08 16:03:42 +00:00
joerg
b7a1edf1d5 Catch up with addition of putstr32.S. 2011-06-07 20:05:46 +00:00
dsl
53bfd680f2 Add C stubs to allow prints early in the boot code. 2011-06-02 18:53:00 +00:00
dsl
27a83e750f Put all the 'CFLAGS+= -Dxxx' together. 2011-06-02 18:48:55 +00:00
joerg
a216da57a6 Default to -Wno-sign-compare -Wno-pointer-sign for clang.
Push -Wno-array-bounds down to the cases that depend on it.
Selectively disable warnings for 3rd party software or non-trivial
issues to be reviewed later to get clang -Werror to build most of the
tree.
2011-05-26 12:56:24 +00:00
uebayasi
dcf649145a Support userconf(4) command in boot(8)/boot.cfg(5) on i386/amd64.
From jmmv@, no objections seen in the proposed thread:

	http://mail-index.netbsd.org/tech-kern/2009/01/22/msg004081.html
2011-05-26 04:25:26 +00:00
joerg
ef5d0bd3b7 Disable integrated assembler for files that use .code16 or .code32 for
now. Disable Clang completely for bootxx and netboot for now until the
size issue has been sorted out.
2011-05-20 22:29:55 +00:00
joerg
3cf929db2b mbr.S and gpt.S want to reassign ., so don't use the integrated
assembler for now.
2011-05-20 15:05:02 +00:00
joerg
406d512bfa Do not ignore errors from genprom. 2011-04-09 00:26:52 +00:00
jakllsch
9e4c8abd95 Honor bp_timeout even if someone sets X86_BP_FLAGS_NOBOOTCONF. 2011-03-18 18:24:09 +00:00
jakllsch
f7cb5f6ff7 Honor bp_timeout even when X86_BP_FLAGS_NOBOOTCONF is set.
Or, in other words, bring back the 5 second countdown in pxeboot(8).
2011-03-18 18:21:38 +00:00
jakllsch
0f57ab9175 Automatically adjust pxeboot(8) stack based on the end of .bss, like is already
done in biosboot.S for boot(8).
(The heap location will need to be adjusted if pxeboot expands much more.)
2011-03-18 17:46:26 +00:00
jakllsch
a6c55fbbe4 Enable LIBSA_PRINTF_LONGLONG_SUPPORT.
Useful in any of the cases where we already print a (64-bit) daddr_t.
2011-02-26 18:22:58 +00:00
jakllsch
410a658a54 Rework previous commit. Return non-zero instead of turning off
BIOSDISK_INT13EXT.  BIOSDISK_INT13EXT also enables LBA access mechanisms
that we really want to be using if at all possible.
2011-02-21 02:58:02 +00:00
dyoung
937d3ce321 biosdisk_getextinfo() can fail. If it does fail in set_geometry(),
clear the flag BIOSDISK_INT13EXT so that a caller such as read_gpt()
will not try to rely on the gibberish in the biosdisk_extinfo.
2011-02-21 00:43:19 +00:00
dyoung
03fe44e973 biosdisk_getextinfo() returns 0 on success, non-zero on failure, so
change its return type from void to int.
2011-02-21 00:39:54 +00:00
jakllsch
0ea7f47445 Follow a minor detail in the spec a bit more closely. 2011-02-20 22:03:13 +00:00
jakllsch
a0db223e65 %bl is part of %bx, %bx contains the address we requested from the BIOS.
Thus, use %cl instead of %bl for return value storage.
2011-02-20 05:45:48 +00:00
jmcneill
540bdd7510 port-i386/44563: boot loader prompt doesn't read keyboard input on a MacBook1,1
check for keystroke (int 16h, AH=01h) before getting keystroke (int 16h,
AH=00h), fixes bootloader keyboard input with Apple firmware, from Taylor R
Campbell
2011-02-14 23:47:11 +00:00
jmcneill
319b724dd2 Add VESA VBE/DDC EDID support for determining the monitor's preferred
video mode. "vesa on" will now select the preferred mode @ 8bpp if it can
be determined and is supported by the display adapter, otherwise it will
use 640x480 @ 8bpp.
2011-02-09 04:37:54 +00:00
jmcneill
86ef644484 add support for passing image files to the kernel with the 'splash' keyword:
vesa on;splash /netbsd.jpg;boot -z
2011-02-06 23:16:05 +00:00
jakllsch
8e0c3a90a8 Attempt to correct two regressions.
- avoid Virtualbox's BIOS panicing on 64-bit LBAs
 - MBR-without-disklabel was ignored
2011-01-26 20:59:48 +00:00
joerg
3c550524b5 Drop bootprog_maker (formerly enabled by -M) and bootprog_date (formerly
disabled by -D) from the output of newvers_stand.sh.  Change -D to the
inverted logic, so that it adds the date to bootprog_rev in ().

Change all platforms accordingly. -D is added if MKREPRO is not yes and
wasn't present before. Platforms that didn't use -D don't depend on
MKREPRO now either.
2011-01-22 19:19:14 +00:00
jakllsch
a5fb435357 Support booting from GPT-partioned disks on PC-BIOS-compatible systems.
Much of the work in this commit was done by Mike Volokhov during GSoC 2009.
2011-01-06 01:08:48 +00:00
jakllsch
6808b172e4 Pass a 64-bit boot partition base LBA into x86 /boot,
while maintaining compatibility with existing bootxx code.
2011-01-05 23:13:01 +00:00
jakllsch
1d66d108be NetBSD/x86 BIOS Boot 5.6: now with GUID Partition Table support. 2011-01-05 22:28:05 +00:00
jakllsch
749ebb6927 Note stack/heap changes made in revision 1.47 of Makefile.boot with version 5.5. 2011-01-05 22:24:02 +00:00
jakllsch
ae42e83402 Teach BIOS disk driver about GPT partition tables.
Inspired by Mike Volokhov's GPT booting GSoC project.
2011-01-05 22:06:59 +00:00
jakllsch
4b66284eab Let the compiler determine the correct type for sizeof().
From Mike Volokhov's GPT booting GSoC.
2011-01-05 21:44:23 +00:00
jakllsch
6bbd1c4558 Relocate buffers to not coincide with new location of executable text. 2011-01-04 16:53:05 +00:00
jakllsch
1eadcd7347 Relocate cdboot (aka bootxx_cd9660) to 0x1000 instead of 0x600.
A similar change was made in v1.38 of Makefile.bootxx about 13 months ago,
no reason these shouldn't be consistent with each other, like they were before.
2011-01-02 02:31:32 +00:00
jakllsch
9b838cd935 Correct comments referencing PRIMARY_LOAD_ADDRESS to match current reality. 2011-01-02 02:01:58 +00:00
jakllsch
709bef7ba6 Fix DISK_DEBUG build. 2010-12-30 22:28:53 +00:00
jakllsch
0b61932b4b Make this actually build with DISK_DEBUG. 2010-12-30 22:27:43 +00:00
jakllsch
bec3a889b1 Utilize movz[bw]l to save a few instrutions and bytes of .text. 2010-12-29 22:40:46 +00:00
jakllsch
387a37a543 bootxx_cd9660 (cdboot), like bootxx_fat16 (fatboot), is not a traditional
libsa-based program.  As such, build bootxx_cd9660 where its source lives.
This has been done by moving bootxx/bootxx_cd9660/Makefile to cdboot/Makefile
and adjusting the relative paths appropriately, so as to minimize binary change.
2010-12-29 17:44:03 +00:00
jakllsch
8e2d08248c Use printf format macros for long longs. 2010-12-25 01:19:33 +00:00
jakllsch
2ce4dfd602 Sprinkle daddr_t. 2010-12-24 20:40:42 +00:00
jakllsch
88846082f0 Sprinkle daddr_t.
Adjust DISK_DEBUG printf formats to match.
2010-12-24 20:36:51 +00:00
jakllsch
bbedde89be It just so happens we don't need -Wno-attributes if we
place __packed in the right place.
2010-12-22 20:46:42 +00:00
jakllsch
c282384089 MI libsa provides panic() and exit() functions, no need to provide our own.
As MI libsa exit() calls panic() with a "exit" message, don't use it if we
print our own farewell or have already panic()ed.
2010-12-20 01:12:44 +00:00
jakllsch
b75cdca086 Move the bottom of the heap off the top of the stack. Also, increase the heap
size by 64KiB.  These changes allows gzipped Xen with gzipped Dom0 kernels
to successfully boot.  I also suspect this will cure the amd64 CD boot issue
without disabling ext2fs support.
2010-12-20 00:55:10 +00:00
jakllsch
648ff57789 We want a literal 0x86 in %ah for this int $0x15 delay,
not the value of the byte at 0x86.
2010-12-20 00:39:06 +00:00
jakllsch
ef8c23b914 Compute real/protected %sp/%esp offset in 'gdt_fixup' using all 32-bits.
Allows the case of %ss being less than %cs to work.
Also, completely save and restore the general-purpose registers we use.
2010-12-19 17:18:23 +00:00
mrg
2e9e79b55f disable ext2fs support in /boot on amd64 for now. it breaks cd booting.
XXX: i don't know why, or plan to figure it out, but at least now amd64
XXX: isos boot again.
2010-12-11 08:20:17 +00:00
jakllsch
02fad731e5 Remove now-incorrect detail about the link address from comment. 2010-12-08 21:56:42 +00:00
jym
e865057e4d Bring the help command output from boot and pxeboot on par with their
code.
2010-11-06 23:07:46 +00:00
jnemeth
f6e521dbb3 Reduce licence with copyright Perry E. Metzger and Matthias Drochner
to two clauses.

On Thu, 21 Oct 2010 22:42:00 -0700 jnemeth@XXX
(John Nemeth) wrote:
>     The file src/sys/arch/i386/stand/lib/exec.c has a licence
> section that starts off saying copyright by each of you.  That is
> then followed by a standard four claus UCB licence.  Would it be
> okay to reduce that to the two claus licence that is now standard
> for NetBSD?

I have no particular objections.

--
Perry E. Metzger                perry@XXX

jnemeth@XXX said:
> Would it be okay to reduce that to the two claus licence

Yes of course, this is OK.

best regards
Matthias
2010-10-30 08:12:43 +00:00
martin
ca50e08b76 Update Rawrite32 to the latest version 2010-10-27 18:29:46 +00:00
tsutsui
0e228a11be Build and install bootxx_ext2fs, primary boot for ext2fs.
Ext2fs doesn't have enough free space (it has only 1KB)
to store this primary loader, but we can put it into
an independent small 'boot' partition as NetBSD/hp300 does
if it's really necessary.

It could be a fun project to add smaller pre-primary loader
that loads ~8KB primary loader for ext2fs, but probably it's unlikely
because there is a functional wheel named GRUB for ext2fs.
2010-09-11 13:06:36 +00:00
tsutsui
eba63131ff Enable SUPPORT_EXT2FS. Tested on i386 that has root on ext2fs
with 128 byte and 256 byte inode sizes on QEMU.

Note for netbsd-5, this also requires HEAP_START=0x30000
as applied in rev 1.37, and this might also get another limit
on cdboot as described in PR install/42202.
2010-09-11 12:43:54 +00:00
christos
7720d15c03 use LOAD_BACKWARDS instead of LOAD_NOTE for floppy book. 2010-08-25 16:32:51 +00:00
mrg
4c92852a80 remove almost all the ability to build netbsd with an a.out target.
we're ELF now, and there are many missing checks against OBJECT_FMT.
if we ever consider switching, the we can figure out what new ones
we need but for now it's just clutter.

this doesn't remove any of the support for exec_aout or any actually
required-for-boot a.out support, only the ability to build a netbsd
release in a.out format.  ie, most of this code has been dead for
over a decade.

i've tested builds on vax, amd64, i386, mac68k, macppc, sparc, atari,
amiga, shark, cats, dreamcast, landisk, mmeye and x68k.  this covers
the 5 MACHINE_ARCH's affected, and all the other arch code touched.
it also includes some actual run-time testing of sparc, i386 and
shark, and i performed binary comparison upon amiga and x68k as well.


some minor details relevant:
- move shlib.[ch] from ld.aout_so into ldconfig proper, and cut them
  down to only the parts ldconfig needs
- remove various unused source files
- switch amiga bootblocks to using elf2bb.h instead of aout2bb.h
2010-07-06 05:59:50 +00:00
tsutsui
e96b50fc20 Add wait_sec() which uses BIOS function call INT 1Ah/AH=00h (GET SYSTEMTIME)
and use it for large delays (in seconds) instead of delay() that uses
INT 15h/AH=86h (WAIT) in microsecond because the latter one can't provide
precise delays on emulators.
Fixes PR port-i386/43156 (NetBSD bootloader countdown runs at 1/20 speed
in qemu 0.12).

No particular comments on the PR and port-i386@.
2010-06-25 15:35:08 +00:00
dholland
5ef6a33bb9 Introduce .WAIT into the cleandir rule for blasting the libsa/libkern/etc.
trees, because it can race with the libsa/libkern/etc. makefiles' own
cleandir rules. I think I've found all of the uses of the offending idiom...
Closes PR 43360.
2010-05-27 06:58:12 +00:00
veego
c005cd37bb Add ${PROG}.syms to CLEANFILES 2010-05-23 13:59:12 +00:00
tnn
0bc96981a6 Add multiboot command. This lets us netboot the xen+dom0 kernel combo. 2010-04-06 21:18:59 +00:00
hubertf
fed6262c88 When a password is set for the bootloader ("installboot -o password=..."),
it currently complains about an unknown command and prints a usage if the
password is entered wrong:

        ...
        Choose an option; RETURN for default; SPACE to stop countdown.
        Option 1 will be chosen in 0 seconds.
        Password: *
        Password: *
        Password: *
        unknown command
        commands are:
        boot [xdNx:][filename] [-12acdqsvxz]
             (ex. "hd0a:netbsd.old -s"
        ls [path]
        dev xd[N[x]]:
        consdev {pc|com[0123]|com[0123]kbd|auto}
        modules {enabled|disabled}
        load {path_to_module}
        multiboot [xdNx:][filename] [<args>]
        help|?
        quit

        Choose an option; RETURN for default; SPACE to stop countdown.
        Option 1 will be chosen in 0 seconds.
        ...

This is confusing, plus someone may use it to determine bits of
information about the system. What should happen instead is that the user
is informed that the password is wrong:

        ...
        Choose an option; RETURN for default; SPACE to stop countdown.
        Option 1 will be chosen in 0 seconds.
        Password: ****
        Password: ****
        Password: ****
        Wrong password.

        Choose an option; RETURN for default; SPACE to stop countdown.
        ...

Implement the latter behaviour.
2010-02-08 21:25:32 +00:00