Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-10]: src Pull up following revision(s) (requested by manu in tick...



details:   https://anonhg.NetBSD.org/src/rev/13373488bd88
branches:  netbsd-10
changeset: 374832:13373488bd88
user:      martin <martin%NetBSD.org@localhost>
date:      Sat May 13 13:26:56 2023 +0000

description:
Pull up following revision(s) (requested by manu in ticket #159):

        share/man/man8/man8.x86/boot.8: revision 1.27
        sys/arch/i386/stand/efiboot/version: revision 1.3
        share/man/man8/man8.x86/boot.8: revision 1.28
        share/man/man8/man8.x86/boot.8: revision 1.29
        sys/arch/i386/stand/lib/exec.c: revision 1.79
        sys/arch/i386/stand/efiboot/efiboot.c: revision 1.13
        sys/arch/i386/stand/efiboot/bootx64/efibootx64.c: revision 1.6
        sys/arch/i386/stand/efiboot/bootia32/efibootia32.c: revision 1.6
        sys/arch/i386/stand/efiboot/boot.c: revision 1.22
        sys/arch/amd64/amd64/locore.S: revision 1.219
        sys/arch/i386/stand/efiboot/bootia32/startprog32.S: revision 1.3
        sys/arch/i386/stand/efiboot/efiboot.h: revision 1.12
        sys/arch/amd64/conf/files.amd64: revision 1.121
        sys/arch/amd64/conf/std.amd64: revision 1.13
        share/man/man8/man8.x86/pxeboot.8: revision 1.6
        sys/arch/i386/stand/efiboot/bootx64/startprog64.S: revision 1.4
        sys/arch/amd64/amd64/locore.S: revision 1.220
        share/man/man8/man8.x86/dosboot.8: revision 1.4
        share/man/man4/options.4: revision 1.524

Add reloc keyworkd to let EFI bootstrap load amd64 kernel at any address

EFI bootstrap assumes it can copy the amd64 kernel to its ELF load
address (that is KERNTEXTOFF - KERNBASE = 0x200000), but it can
clash with previous UEFI memory allocation, as described here:
http://mail-index.netbsd.org/tech-kern/2023/04/07/msg028833.html

This change adds a reloc keyword for controling where the EFI
boostrap will copy the kernel image. Possible values are:
default - the default and prior behavior, copy at 0x200000.
none - do not copy and use the kernel image where it was loaded.
address - specify an explicit address where to copy the kernel.

This comes with an amd64 kernel patch that makes it self-relocatable.
It first discover where it was loaded in memory, and if this is
different than the expected 0x200000, hhe the kernel relocates
itself and start over at the right address.


Merge x86 boot options in x86/boot(8) and add undocumented UEFI options

We were supposed to keep the option list in x86/boot(8), x86/dosoot(8)
and x86/pxeboot(8) in sync, but it did not happen, hence it may work
better with all the options in x86/boot(8). Also add the undocumented
UEFI boot options.


Add a SELFRELOC kernel option for the sake of documentation clarity.
Instead of telling that x86/boot(8) reloc command needs a kernel able
to self relocate, we can tell it needs a kernel built with the
SELFRELOC option. This keeps the reader from wondering what could
make a kernel able to self relocate.

Remove XXX todo marker left by mistake

Raise the version for new feature (here reloc command)
Suggested by Masanobu SAITOH

diffstat:

 share/man/man4/options.4                           |   10 +-
 share/man/man8/man8.x86/boot.8                     |   98 +++++++++++-
 share/man/man8/man8.x86/dosboot.8                  |   48 +------
 share/man/man8/man8.x86/pxeboot.8                  |   21 +--
 sys/arch/amd64/amd64/locore.S                      |  150 ++++++++++++++++++++-
 sys/arch/amd64/conf/files.amd64                    |    5 +-
 sys/arch/amd64/conf/std.amd64                      |    4 +-
 sys/arch/i386/stand/efiboot/boot.c                 |   47 ++++++-
 sys/arch/i386/stand/efiboot/bootia32/efibootia32.c |    4 +-
 sys/arch/i386/stand/efiboot/bootia32/startprog32.S |    7 +-
 sys/arch/i386/stand/efiboot/bootx64/efibootx64.c   |    4 +-
 sys/arch/i386/stand/efiboot/bootx64/startprog64.S  |    6 +-
 sys/arch/i386/stand/efiboot/efiboot.c              |    6 +-
 sys/arch/i386/stand/efiboot/efiboot.h              |   10 +-
 sys/arch/i386/stand/efiboot/version                |    3 +-
 sys/arch/i386/stand/lib/exec.c                     |   23 ++-
 16 files changed, 353 insertions(+), 93 deletions(-)

diffs (truncated from 805 to 300 lines):

diff -r 60a62cd1d155 -r 13373488bd88 share/man/man4/options.4
--- a/share/man/man4/options.4  Sat May 13 12:22:26 2023 +0000
+++ b/share/man/man4/options.4  Sat May 13 13:26:56 2023 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: options.4,v 1.523 2022/08/28 14:29:05 riastradh Exp $
+.\"    $NetBSD: options.4,v 1.523.2.1 2023/05/13 13:26:57 martin Exp $
 .\"
 .\" Copyright (c) 1996
 .\"    Perry E. Metzger.  All rights reserved.
@@ -1307,6 +1307,14 @@ See
 and
 .Xr vnconfig 8
 for more information.
+.It Cd options SELFRELOC
+Make the kernel able to self relocate at bootstrap, so that it can
+run whatever its load address is. 
+This is intented to be used withe the 
+.Ic reloc
+boostrap command documented in
+.Xr x86/boot 8 ,
+to workaround UEFI bugs, and is only available on amd64.
 .It Cd options SPLDEBUG
 Help the kernel programmer find bugs related to the interrupt priority
 level.
diff -r 60a62cd1d155 -r 13373488bd88 share/man/man8/man8.x86/boot.8
--- a/share/man/man8/man8.x86/boot.8    Sat May 13 12:22:26 2023 +0000
+++ b/share/man/man8/man8.x86/boot.8    Sat May 13 13:26:56 2023 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: boot.8,v 1.26 2021/06/22 03:39:21 gutteridge Exp $
+.\"    $NetBSD: boot.8,v 1.26.2.1 2023/05/13 13:26:56 martin Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -364,6 +364,8 @@ flag in
 Boot the system in silent mode.
 .El
 .It Ic consdev Ar dev\| Ns Oo Ns Ic \&, Ns Ar speed Oc
+[Not available for 
+.Xr x86/dosboot 8 ]
 Immediately switch the console to the specified device
 .Ar dev
 and reprint the banner.
@@ -397,16 +399,26 @@ Without an argument, print the current s
 .Ar device
 is of the form specified in
 .Ic boot .
+.It Ic devpath
+[Only available for UEFI boot] Dump UEFI device paths.
+.It Ic efivar
+[Only available for UEFI boot] Dump UEFI environment variables from NVRAM.
 .It Ic fs Ar file
+[Only available for BIOS and UEFI boot]
 Load a file system image from the specified
 .Ar file ,
 and request the kernel to use it as the root file system.
 The
 .Xr makefs 8
 utility may be used to create suitable file system images.
+.It Ic gop Op Va mode_index
+[Only available for UEFI boot] Without argument, list the available
+video modes. If an argument is given, select a video mode.
 .It Ic help
 Print an overview about commands and arguments.
 .It Ic load Ar module Op Ar arguments
+[Not available for 
+.Xr x86/dosboot 8 ]
 Load the specified kernel
 .Ar module ,
 and pass it the specified
@@ -520,12 +532,17 @@ See
 .Xr pciback 4 .
 .El
 .It Ic ls Op Ar path
+[Not available for
+.Xr x86/pxeboot 8 ]
 Print a directory listing of
 .Ar path ,
 containing inode number, filename, and file type.
 .Ar path
 can contain a device specification.
+.It Ic memmap
+[Only available for UEFI boot] Dump UEFI memory map.
 .It Ic menu
+[Only available for BIOS and UEFI boot]
 Display the boot menu and initiate a countdown,
 similarly to what would have happened if interactive mode
 had not been entered.
@@ -534,6 +551,8 @@ had not been entered.
            No \(or Li enabled \
            No \(or Li disabled\^ \
            Brc
+[Not available for
+.Xr x86/dosboot 8 ]
 The values
 .Ql enabled ,
 .Ql on
@@ -545,7 +564,18 @@ whereas
 .Ql disabled ,
 .Ql off
 will turn off the feature.
+.It Ic mode Va fstype
+[Only available for
+.Xr x86/dosboot 8 ]
+Switch file system type;
+.Va fstype
+should be one of
+.Ar dos
+or
+.Ar ufs .
 .It Ic multiboot Ar kernel Op Ar arguments
+[Not available for
+.Xr x86/dosboot 8 ]
 Boot the specified
 .Ar kernel ,
 using the
@@ -615,12 +645,32 @@ command.
 See the foreign operating system's documentation for the available
 .Ar arguments .
 .El
+.It Ic pkboot
+[Only available for BIOS and UEFI boot] Boot a kernel that has
+the
+.Cd KASLR
+option set, for Kernel Address Space Layout Randomizaton.
 .It Ic quit
 Reboot the system.
-.It Ic root Ar spec
-Pass an explicit root specification to the kernel.
-See BTINFO_ROOTDEVICE for details.
+.It Ic reloc Op Va default No \(or Va none No \(or Va address
+[Only UEFI boot] Sets where the kernel is copied by bootstrap
+before it is started. Values other than default require a kernel
+built with the
+.Cd SELFRELOC
+option, so that can relocate itself at the right address,
+otherwise a crash occurs at boot time.
+.Bl -tag -width default
+.It Va default
+Copy the kernel at ELF header load address, this is the historical
+behavior.
+.It Va none
+Leave the kernel where it was loaded and start it as is. 
+.It Va address
+Copy the kernel at given
+.Va address .
+.El
 .It Ic rndseed Ar file
+[Only available for BIOS and UEFI boot]
 Load the specified
 .Ar file
 and request the kernel to use it as a seed for the
@@ -646,16 +696,12 @@ Using the same seed file on more then on
 or for more than one boot on the same host,
 will reduce the quality of random numbers
 and may impact system security.
-.It Ic userconf Ar command
-Pass command
-.Ar command
-to
-.Xr userconf 4
-at boot time.
-These commands are processed before the interactive
-.Xr userconf 4
-shell is executed, if requested.
+.It Ic root Ar spec
+[Only available for BIOS and UEFI boot]
+Pass an explicit root specification to the kernel.
+See BTINFO_ROOTDEVICE for details.
 .It Ic splash Ar file
+[Only available for BIOS and UEFI boot]
 Load a graphical image from the specified
 .Ar file
 and request the kernel to use it as a splash screen.
@@ -670,12 +716,38 @@ GIF,
 PSD (composited view only),
 or
 PIC.
+.It Ic text Op Va mode_index
+[Only available UEFI boot] Without argument, list the available
+text modes (displayed as column x line in hexadecimal, therefore
+.Li 50x19 
+means 
+.Li 80
+columns and
+.Li 25
+lines). With an argument, select a text mode.
+.It Ic userconf Ar command
+[Not available for
+.Xr x86/dosboot 8 ]
+Pass command
+.Ar command
+to
+.Xr userconf 4
+at boot time.
+These commands are processed before the interactive
+.Xr userconf 4
+shell is executed, if requested.
+.It Ic version Op Ar full
+[Only available UEFI boot] Display UEFI bootstrap version. With the
+.Op full
+argumznt, also display information about UEFI itself.
 .It Ic vesa Bro Ar \^modenum \
         No \(or Li on \
         No \(or Li off \
         No \(or Li enabled \
         No \(or Li disabled \
         No \(or Li list Brc
+[Only available for BIOS and
+.Xr x86/pxeboot 8 ]
 Initialise the video card to the specified resolution and bit depth.
 The
 .Ar modenum
diff -r 60a62cd1d155 -r 13373488bd88 share/man/man8/man8.x86/dosboot.8
--- a/share/man/man8/man8.x86/dosboot.8 Sat May 13 12:22:26 2023 +0000
+++ b/share/man/man8/man8.x86/dosboot.8 Sat May 13 13:26:56 2023 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: dosboot.8,v 1.3 2017/02/17 22:30:28 christos Exp $
+.\"    $NetBSD: dosboot.8,v 1.3.22.1 2023/05/13 13:26:56 martin Exp $
 .\"
 .\" Copyright (c) 1997
 .\"    Matthias Drochner.  All rights reserved.
@@ -95,54 +95,16 @@ by prepending a block device name in ter
 followed by a colon (see
 .Xr x86/boot 8
 and examples).
-.It Fl adqsv
+.It Fl 1234abcdmqsvxz
 Flags passed to the kernel, see
 .Xr x86/boot 8 .
 .El
 .Pp
-The commands accepted after the
-.Fl c
-flag or in interactive mode are:
-.\" NOTE: some of this text is duplicated in the MI boot.8
-.\" and in other x86-specific *boot.8 files;
-.\" please try to keep all relevant files synchronized.
-.Bl -tag -width 04n -offset 04n
-.It Ic boot Oo Va device : Oc Ns Oo Va filename Oc Oo Fl 1234abcdmqsvxz Oc
-Boot
-.Nx .
 See
-.Cm boot
-in
 .Xr x86/boot 8
-for full details.
-.It Ic dev Op device
-Set the default device and partition for subsequent file system operations.
-Without an operand, print the current setting.
-This setting doesn't apply to
-.Tn MS-DOS
-mode.
-.It Ic help
-Print an overview about commands and arguments.
-.It Ic ls Op Pa path
-Print a directory listing of
-.Pa path ,
-containing inode number, filename and file type.
-This command works in UFS mode only.
-.Pa path
-can contain a device specification.
-.It Ic mode Va fstype
-Switch file system type;
-.Va fstype
-should be one of
-.Ar dos
-or
-.Ar ufs .
-.It Ic quit
-Leave the
-.Nm
-program and exit to
-.Tn MS-DOS .
-.El
+for commands accepted after the
+.Fl c
+flag or in interactive mode.
 .Pp
 .Nm
 is also installed in the
diff -r 60a62cd1d155 -r 13373488bd88 share/man/man8/man8.x86/pxeboot.8
--- a/share/man/man8/man8.x86/pxeboot.8 Sat May 13 12:22:26 2023 +0000
+++ b/share/man/man8/man8.x86/pxeboot.8 Sat May 13 13:26:56 2023 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: pxeboot.8,v 1.5 2020/08/29 13:32:27 fcambus Exp $
+.\"    $NetBSD: pxeboot.8,v 1.5.6.1 2023/05/13 13:26:56 martin Exp $
 .\"
 .\" Copyright (c) 2003
 .\"    Matthias Drochner.  All rights reserved.
@@ -220,26 +220,9 @@ case to access the kernel file, matching
 kernel's behaviour.
 .El
 .Pp
-The commands accepted in interactive mode are:
-.\" NOTE: some of this text is duplicated in the MI boot.8
-.\" and in other x86-specific *boot.8 files;
-.\" please try to keep all relevant files synchronized.
-.Bl -tag -width 04n -offset 04n
-.It Ic boot Oo Va device : Oc Ns Oo Va filename Oc Oo Fl 1234abcdmqsvxz Oc
-Boot



Home | Main Index | Thread Index | Old Index