Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/9ca83a0ef39d
branches:  netbsd-9
changeset: 374817:9ca83a0ef39d
user:      martin <martin%NetBSD.org@localhost>
date:      Sat May 13 11:45:53 2023 +0000

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

        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 (via patch)
        share/man/man8/man8.x86/boot.8: revision 1.29 (via patch)
        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                     |  371 +++++++++++++-------
 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, 509 insertions(+), 210 deletions(-)

diffs (truncated from 1372 to 300 lines):

diff -r c5fab7861ca8 -r 9ca83a0ef39d share/man/man4/options.4
--- a/share/man/man4/options.4  Sat May 13 11:30:45 2023 +0000
+++ b/share/man/man4/options.4  Sat May 13 11:45:53 2023 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: options.4,v 1.506.2.2 2021/10/25 15:47:50 martin Exp $
+.\"    $NetBSD: options.4,v 1.506.2.3 2023/05/13 11:45:54 martin Exp $
 .\"
 .\" Copyright (c) 1996
 .\"    Perry E. Metzger.  All rights reserved.
@@ -1300,6 +1300,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 c5fab7861ca8 -r 9ca83a0ef39d share/man/man8/man8.x86/boot.8
--- a/share/man/man8/man8.x86/boot.8    Sat May 13 11:30:45 2023 +0000
+++ b/share/man/man8/man8.x86/boot.8    Sat May 13 11:45:53 2023 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: boot.8,v 1.15.2.4 2020/07/15 15:51:03 martin Exp $
+.\"    $NetBSD: boot.8,v 1.15.2.5 2023/05/13 11:45:53 martin Exp $
 .\"
 .\" Copyright (c) 1991, 1993
 .\"    The Regents of the University of California.  All rights reserved.
@@ -99,7 +99,7 @@ master boot record - see
 .Xr x86/mbr 8 ) .
 .Ss Normal Operation
 Once running, a banner similar to the following will appear:
-.Bd -unfilled -offset indent
+.Bd -literal -offset indent
 >> NetBSD BIOS Boot, revision 3.0
 >> (user@buildhost, builddate)
 >> Memory: 637/15360 k
@@ -113,7 +113,7 @@ In the example above, it will be
 which is the file
 .Pa /netbsd
 on partition
-.Dq a
+.Dq Li a
 of the
 .Nx
 .Tn MBR
@@ -122,7 +122,7 @@ partition of the first hard disk known t
 .Po
 which is an
 .Tn IDE
-or similar device - see the
+or similar device \(em see the
 .Sx BUGS
 section
 .Pc .
@@ -173,12 +173,12 @@ input of these commands:
 .\" also duplicated in the x86-specific x86/dosboot.8 and x86/pxeboot.8;
 .\" 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
+.It Ic boot Oo Ar device Ns Ic \&: Oc Ns Oo Ar filename Oc Oo Fl 1234abcdmqsvxz Oc
 The default
-.Va device
+.Ar device
 will be set to the disk from which the boot loader was loaded.
 The partition is set to the first match in this list:
-.Bl -enum -compact
+.Bl -enum
 .It
 The first
 .Xr gpt 8
@@ -193,30 +193,30 @@ The first partition with a file system t
 .It
 The first partition.
 .El
+.Pp
 To boot from an alternate disk, the full name of the device should
 be given at the prompt.
-.Va device
+.Ar device
 is of the form
-.Va NAME=partition_label
+.Li NAME= Ns Ar partition_label
 when booting from a
 .Xr gpt 8
 partitioned disk.
 Otherwise, the syntax is
-.Xo Va xd
-.Op Va N Ns Op Va x
+.Xo Ar xd\^ Ns
+.Op Ar N\^ Ns Op Ar x
 .Xc
 where
-.Va xd
+.Ar xd
 is the device from which to boot,
-.Va N
+.Ar N
 is the unit number, and
-.Va x
+.Ar x
 is the partition letter.
 .Pp
-In the later case, the following list of supported devices may
+In the latter case, the following list of supported devices may
 vary from installation to installation:
-.Pp
-.Bl -hang -compact
+.Bl -hang
 .It hd
 Hard disks as numbered by the BIOS.
 This includes ST506, IDE, ESDI, RLL disks on a WD100[2367] or
@@ -238,7 +238,7 @@ attribute set.
 Inner RAIDframe partitions can also be given to the
 .Ic dev
 command using he
-.Va NAME=partition_label
+.Li NAME= Ns Ar partition_label
 syntax.
 .El
 .Pp
@@ -261,7 +261,7 @@ Options are:
 .Bl -tag -width xxx
 .It Fl 1
 Sets the machine-dependent flag
-.Sy RB_MD1
+.Dv RB_MD1
 in
 .Va boothowto .
 In
@@ -270,7 +270,7 @@ this disables multiprocessor boot;
 the kernel will boot in uniprocessor mode.
 .It Fl 2
 Sets the machine-dependent flag
-.Sy RB_MD2
+.Dv RB_MD2
 in
 .Va boothowto .
 In
@@ -278,7 +278,7 @@ In
 this disables ACPI.
 .It Fl 3
 Sets the machine-dependent flag
-.Sy RB_MD3
+.Dv RB_MD3
 in
 .Va boothowto .
 In
@@ -286,7 +286,7 @@ In
 this disables SVS.
 .It Fl 4
 Sets the machine-dependent flag
-.Sy RB_MD4
+.Dv RB_MD4
 in
 .Va boothowto .
 In
@@ -294,7 +294,7 @@ In
 this has no effect.
 .It Fl a
 Sets the
-.Sy RB_ASKNAME
+.Dv RB_ASKNAME
 flag in
 .Va boothowto .
 This causes the kernel to prompt for the root file system device,
@@ -302,13 +302,13 @@ the system crash dump device, and the pa
 .Xr init 8 .
 .It Fl b
 Sets the
-.Sy RB_HALT
+.Dv RB_HALT
 flag in
 .Va boothowto .
 This causes subsequent reboot attempts to halt instead of rebooting.
 .It Fl c
 Sets the
-.Sy RB_USERCONF
+.Dv RB_USERCONF
 flag in
 .Va boothowto .
 This causes the kernel to enter the
@@ -320,7 +320,7 @@ allows devices to be enabled or disabled
 to be modified before the kernel attempts to attach the devices.
 .It Fl d
 Sets the
-.Sy RB_KDB
+.Dv RB_KDB
 flag in
 .Va boothowto .
 Requests the kernel to enter debug mode, in which it
@@ -328,100 +328,114 @@ waits for a connection from a kernel deb
 .Xr ddb 4 .
 .It Fl m
 Sets the
-.Sy RB_MINIROOT
+.Dv RB_MINIROOT
 flag in
 .Va boothowto .
 Informs the kernel that a mini-root file system is present in memory.
 .It Fl q
 Sets the
-.Sy AB_QUIET
+.Dv AB_QUIET
 flag in
 .Va boothowto .
 Boot the system in quiet mode.
 .It Fl s
 Sets the
-.Sy RB_SINGLE
+.Dv RB_SINGLE
 flag in
 .Va boothowto .
 Boot the system in single-user mode.
 .It Fl v
 Sets the
-.Sy AB_VERBOSE
+.Dv AB_VERBOSE
 flag in
 .Va boothowto .
 Boot the system in verbose mode.
 .It Fl x
 Sets the
-.Sy AB_DEBUG
+.Dv AB_DEBUG
 flag in
 .Va boothowto .
 Boot the system with debug messages enabled.
 .It Fl z
 Sets the
-.Sy AB_SILENT
+.Dv AB_SILENT
 flag in
 .Va boothowto .
 Boot the system in silent mode.
 .El
-.It Ic consdev Va dev Ns Oo Ns , Ns Va speed Oc
+.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
-.Va dev
+.Ar dev
 and reprint the banner.
-.Va dev
+.Ar dev
 must be one of
 .\" .Bl -item -width com[0123]kbd -offset indent -compact
-.Ar pc , com0 , com1 , com2 ,
-.Ar com3 , com0kbd , com1kbd , com2kbd ,
-.Ar com3kbd ,
+.Li pc , com0 , com1 , com2 ,
+.Li com3 , com0kbd , com1kbd , com2kbd ,
+.Li com3kbd ,
 or
-.Ar auto .
+.Li auto .
 See
 .Sx Console Selection Policy
 in
 .Xr x86/boot_console 8 .
 .Pp
 A
-.Va speed
+.Ar speed
 for the serial port is optional and defaults to 9600.
 If a value of zero is specified, then the current baud rate (set by the
 BIOS) will be used.
 Setting the
-.Va speed
+.Ar speed
 with the
-.Ar pc
+.Li pc
 device is not possible.
-.It Ic dev Op Va device
+.It Ic dev Op Ar device
 Set the default drive and partition for subsequent file system
 operations.
 Without an argument, print the current setting.
-.Va device
+.Ar device
 is of the form specified in
-.Cm boot .
-.It Ic fs Va file
+.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.



Home | Main Index | Thread Index | Old Index