From d9f57b8caf484b6e41fd4f5190b06858cfe625e5 Mon Sep 17 00:00:00 2001
From: Sascha Wildner <saw@online.de>
Date: Sat, 31 Oct 2020 00:03:46 +0100
Subject: [PATCH 2/3] libstand & boot: Move them to stand/.

sys/boot becomes stand/boot
lib/libstand becomes stand/lib

The next commit will make libstand an internal library to the
boot code.

In-discussion-with: zrj, dillon
---
 Makefile.inc1                                        |  1 +
 lib/Makefile                                         |  1 -
 lib/libefivar/Makefile                               |  2 +-
 share/man/man5/loader.conf.5                         |  4 ++--
 stand/Makefile                                       |  3 +++
 {sys => stand}/boot/Makefile                         |  0
 {sys => stand}/boot/common/Makefile.inc              |  0
 {sys => stand}/boot/common/bcache.c                  |  0
 {sys => stand}/boot/common/boot.c                    |  0
 {sys => stand}/boot/common/boot2.h                   |  0
 {sys => stand}/boot/common/bootstrap.h               |  0
 {sys => stand}/boot/common/commands.c                |  0
 {sys => stand}/boot/common/console.c                 |  0
 {sys => stand}/boot/common/dev_net.c                 |  0
 {sys => stand}/boot/common/dev_net.h                 |  0
 {sys => stand}/boot/common/devopen.c                 |  0
 {sys => stand}/boot/common/dinode.h                  |  0
 {sys => stand}/boot/common/do_dloader.c              |  0
 {sys => stand}/boot/common/fs.h                      |  0
 {sys => stand}/boot/common/help.common               |  0
 {sys => stand}/boot/common/interp_backslash.c        |  0
 {sys => stand}/boot/common/interp_parse.c            |  0
 {sys => stand}/boot/common/isapnp.c                  |  0
 {sys => stand}/boot/common/isapnp.h                  |  0
 {sys => stand}/boot/common/load_elf.c                |  0
 {sys => stand}/boot/common/load_elf32.c              |  0
 {sys => stand}/boot/common/load_elf32_obj.c          |  0
 {sys => stand}/boot/common/load_elf64.c              |  0
 {sys => stand}/boot/common/load_elf64_obj.c          |  0
 {sys => stand}/boot/common/load_elf_obj.c            |  0
 {sys => stand}/boot/common/loader.8                  |  0
 {sys => stand}/boot/common/ls.c                      |  0
 {sys => stand}/boot/common/merge_help.awk            |  0
 {sys => stand}/boot/common/misc.c                    |  0
 {sys => stand}/boot/common/module.c                  |  0
 {sys => stand}/boot/common/newvers.sh                |  0
 {sys => stand}/boot/common/panic.c                   |  0
 {sys => stand}/boot/common/pnp.c                     |  0
 {sys => stand}/boot/common/rel_open.c                |  0
 {sys => stand}/boot/common/reloc_elf.c               |  0
 {sys => stand}/boot/common/reloc_elf32.c             |  0
 {sys => stand}/boot/common/reloc_elf64.c             |  0
 {sys => stand}/boot/common/ufsread.c                 |  0
 {sys => stand}/boot/dloader/Makefile                 |  2 +-
 {sys => stand}/boot/dloader/cmds.c                   |  0
 {sys => stand}/boot/dloader/dloader.h                |  0
 {sys => stand}/boot/dloader/dloader.menu             |  0
 {sys => stand}/boot/dloader/loader-bootp.conf        |  0
 {sys => stand}/boot/dloader/loader.conf              |  0
 {sys => stand}/boot/dloader/subs.c                   |  0
 {sys => stand}/boot/dloader32/Makefile               |  0
 {sys => stand}/boot/efi/Makefile                     |  0
 {sys => stand}/boot/efi/Makefile.inc                 |  0
 {sys => stand}/boot/efi/boot1/Makefile               | 12 ++++++------
 {sys => stand}/boot/efi/boot1/boot1.c                |  0
 {sys => stand}/boot/efi/boot1/boot_module.h          |  0
 {sys => stand}/boot/efi/boot1/ufs_module.c           |  0
 {sys => stand}/boot/efi/include/efi.h                |  0
 {sys => stand}/boot/efi/include/eficonsctl.h         |  0
 {sys => stand}/boot/efi/include/efilib.h             |  0
 {sys => stand}/boot/efi/libefi/Makefile              |  6 +++---
 {sys => stand}/boot/efi/libefi/delay.c               |  0
 {sys => stand}/boot/efi/libefi/efi_console.c         |  0
 {sys => stand}/boot/efi/libefi/efinet.c              |  0
 {sys => stand}/boot/efi/libefi/efipart.c             |  0
 {sys => stand}/boot/efi/libefi/errno.c               |  0
 {sys => stand}/boot/efi/libefi/handles.c             |  0
 {sys => stand}/boot/efi/libefi/libefi.c              |  0
 {sys => stand}/boot/efi/libefi/time.c                |  0
 {sys => stand}/boot/efi/loader/Makefile              |  8 ++++----
 .../boot/efi/loader/arch/x86_64/Makefile.inc         |  4 ++--
 .../boot/efi/loader/arch/x86_64/amd64_tramp.S        |  0
 .../boot/efi/loader/arch/x86_64/elf64_freebsd.c      |  0
 .../boot/efi/loader/arch/x86_64/framebuffer.c        |  0
 .../boot/efi/loader/arch/x86_64/framebuffer.h        |  0
 .../boot/efi/loader/arch/x86_64/ldscript.x86_64      |  0
 {sys => stand}/boot/efi/loader/arch/x86_64/start.S   |  0
 {sys => stand}/boot/efi/loader/autoload.c            |  0
 {sys => stand}/boot/efi/loader/bootinfo.c            |  0
 {sys => stand}/boot/efi/loader/conf.c                |  0
 {sys => stand}/boot/efi/loader/copy.c                |  0
 {sys => stand}/boot/efi/loader/devicename.c          |  0
 {sys => stand}/boot/efi/loader/efi_main.c            |  0
 {sys => stand}/boot/efi/loader/loader_efi.h          |  0
 {sys => stand}/boot/efi/loader/main.c                |  0
 {sys => stand}/boot/efi/loader/self_reloc.c          |  0
 {sys => stand}/boot/efi/loader/version               |  0
 {sys => stand}/boot/libstand32/Makefile              |  2 +-
 {sys => stand}/boot/pc32/Makefile                    |  0
 {sys => stand}/boot/pc32/Makefile.inc                |  2 +-
 {sys => stand}/boot/pc32/asmdef/Makefile             |  0
 {sys => stand}/boot/pc32/boot0/Makefile              |  0
 {sys => stand}/boot/pc32/boot0/boot0.S               |  0
 {sys => stand}/boot/pc32/boot0sio/Makefile           |  0
 {sys => stand}/boot/pc32/boot2/Makefile              |  8 ++++----
 {sys => stand}/boot/pc32/boot2/boot1.S               |  0
 {sys => stand}/boot/pc32/boot2/boot2.c               |  0
 {sys => stand}/boot/pc32/boot2/boot2.ldscript        |  0
 {sys => stand}/boot/pc32/boot2/lib.h                 |  0
 {sys => stand}/boot/pc32/boot2/scrc32.c              |  0
 {sys => stand}/boot/pc32/boot2/sio.S                 |  0
 {sys => stand}/boot/pc32/bootasm.h                   |  0
 {sys => stand}/boot/pc32/bootasmdef.c                |  0
 {sys => stand}/boot/pc32/btx/Makefile                |  0
 {sys => stand}/boot/pc32/btx/Makefile.inc            |  0
 {sys => stand}/boot/pc32/btx/btx/Makefile            |  0
 {sys => stand}/boot/pc32/btx/btx/btx.S               |  0
 {sys => stand}/boot/pc32/btx/btx/btx.ldscript        |  0
 {sys => stand}/boot/pc32/btx/btxldr/Makefile         |  0
 {sys => stand}/boot/pc32/btx/btxldr/btxldr.S         |  0
 {sys => stand}/boot/pc32/btx/btxldr/btxldr.ldscript  |  0
 {sys => stand}/boot/pc32/btx/lib/Makefile            |  0
 {sys => stand}/boot/pc32/btx/lib/btxcsu.S            |  0
 {sys => stand}/boot/pc32/btx/lib/btxsys.S            |  0
 {sys => stand}/boot/pc32/btx/lib/btxv86.S            |  0
 {sys => stand}/boot/pc32/btx/lib/btxv86.h            |  0
 {sys => stand}/boot/pc32/btxld/Makefile              |  0
 {sys => stand}/boot/pc32/btxld/btx.h                 |  0
 {sys => stand}/boot/pc32/btxld/btxld.c               |  2 +-
 {sys => stand}/boot/pc32/btxld/elfh.c                |  0
 {sys => stand}/boot/pc32/btxld/elfh.h                |  0
 {sys => stand}/boot/pc32/cdboot/Makefile             |  0
 {sys => stand}/boot/pc32/cdboot/cdboot.S             |  0
 {sys => stand}/boot/pc32/libi386/Makefile            |  6 ++++--
 {sys => stand}/boot/pc32/libi386/biosacpi.c          |  0
 {sys => stand}/boot/pc32/libi386/bioscd.c            |  0
 {sys => stand}/boot/pc32/libi386/biosdisk.c          |  0
 {sys => stand}/boot/pc32/libi386/biosmem.c           |  0
 {sys => stand}/boot/pc32/libi386/biospci.c           |  0
 {sys => stand}/boot/pc32/libi386/biospnp.c           |  0
 {sys => stand}/boot/pc32/libi386/biossmap.c          |  0
 {sys => stand}/boot/pc32/libi386/bootinfo.c          |  0
 {sys => stand}/boot/pc32/libi386/bootinfo32.c        |  0
 {sys => stand}/boot/pc32/libi386/bootinfo64.c        |  0
 {sys => stand}/boot/pc32/libi386/comconsole.c        |  0
 {sys => stand}/boot/pc32/libi386/devicename.c        |  0
 {sys => stand}/boot/pc32/libi386/elf32_freebsd.c     |  0
 {sys => stand}/boot/pc32/libi386/elf64_freebsd.c     |  0
 {sys => stand}/boot/pc32/libi386/i386_copy.c         |  0
 {sys => stand}/boot/pc32/libi386/i386_module.c       |  0
 {sys => stand}/boot/pc32/libi386/libi386.h           |  0
 {sys => stand}/boot/pc32/libi386/nullconsole.c       |  0
 {sys => stand}/boot/pc32/libi386/pxe.c               |  2 +-
 {sys => stand}/boot/pc32/libi386/pxe.h               |  0
 {sys => stand}/boot/pc32/libi386/pxetramp.s          |  0
 {sys => stand}/boot/pc32/libi386/smbios.c            |  0
 {sys => stand}/boot/pc32/libi386/smbios.h            |  0
 {sys => stand}/boot/pc32/libi386/time.c              |  0
 {sys => stand}/boot/pc32/libi386/vidconsole.c        |  0
 {sys => stand}/boot/pc32/libi386/x86_64_tramp.S      |  0
 {sys => stand}/boot/pc32/loader/Makefile             |  2 +-
 {sys => stand}/boot/pc32/loader/conf.c               |  0
 {sys => stand}/boot/pc32/loader/dloader.rc           |  0
 {sys => stand}/boot/pc32/loader/help.i386            |  0
 {sys => stand}/boot/pc32/loader/loader.ldscript      |  0
 {sys => stand}/boot/pc32/loader/main.c               |  0
 {sys => stand}/boot/pc32/loader/version              |  0
 {sys => stand}/boot/pc32/loader_tftp/Makefile        |  2 +-
 {sys => stand}/boot/pc32/loader_tftp/version         |  0
 {sys => stand}/boot/pc32/mbr/Makefile                |  0
 {sys => stand}/boot/pc32/mbr/mbr.S                   |  0
 {sys => stand}/boot/pc32/pxeldr/Makefile             |  0
 {sys => stand}/boot/pc32/pxeldr/pxeboot.8            |  0
 {sys => stand}/boot/pc32/pxeldr/pxeldr.S             |  0
 {sys => stand}/boot/pc32/pxeldr_tftp/Makefile        |  0
 {sys => stand}/boot/pc32/pxeldr_tftp/pxeboot_tftp.8  |  0
 {sys => stand}/boot/pc64/Makefile.inc                |  0
 {lib/libstand => stand/lib}/Makefile                 |  9 ++++-----
 {lib/libstand => stand/lib}/__main.c                 |  0
 {lib/libstand => stand/lib}/arp.c                    |  0
 {lib/libstand => stand/lib}/assert.c                 |  0
 {lib/libstand => stand/lib}/bcd.c                    |  0
 {lib/libstand => stand/lib}/bootp.c                  |  0
 {lib/libstand => stand/lib}/bootp.h                  |  0
 {lib/libstand => stand/lib}/bootparam.c              |  0
 {lib/libstand => stand/lib}/bootparam.h              |  0
 {lib/libstand => stand/lib}/bswap.c                  |  0
 {lib/libstand => stand/lib}/bzipfs.c                 |  0
 {lib/libstand => stand/lib}/cd9660.c                 |  0
 {lib/libstand => stand/lib}/close.c                  |  0
 {lib/libstand => stand/lib}/closeall.c               |  0
 {lib/libstand => stand/lib}/dev.c                    |  0
 {lib/libstand => stand/lib}/dosfs.c                  |  0
 {lib/libstand => stand/lib}/dosfs.h                  |  0
 {lib/libstand => stand/lib}/environment.c            |  0
 {lib/libstand => stand/lib}/ether.c                  |  0
 {lib/libstand => stand/lib}/ext2fs.c                 |  0
 {lib/libstand => stand/lib}/fstat.c                  |  0
 {lib/libstand => stand/lib}/getopt.c                 |  0
 {lib/libstand => stand/lib}/gets.c                   |  0
 {lib/libstand => stand/lib}/globals.c                |  0
 {lib/libstand => stand/lib}/gzipfs.c                 |  0
 {lib/libstand => stand/lib}/hammer1.c                |  0
 {lib/libstand => stand/lib}/hammer2.c                |  0
 {lib/libstand => stand/lib}/i386/_setjmp.S           |  0
 {lib/libstand => stand/lib}/if_ether.h               |  0
 {lib/libstand => stand/lib}/in_cksum.c               |  0
 {lib/libstand => stand/lib}/inet_ntoa.c              |  0
 {lib/libstand => stand/lib}/ioctl.c                  |  0
 {lib/libstand => stand/lib}/iodesc.h                 |  0
 {lib/libstand => stand/lib}/libstand.3               |  0
 {lib/libstand => stand/lib}/lseek.c                  |  0
 {lib/libstand => stand/lib}/net.c                    |  0
 {lib/libstand => stand/lib}/net.h                    |  0
 {lib/libstand => stand/lib}/netif.c                  |  0
 {lib/libstand => stand/lib}/netif.h                  |  0
 {lib/libstand => stand/lib}/nfs.c                    |  0
 {lib/libstand => stand/lib}/nfsv2.h                  |  0
 {lib/libstand => stand/lib}/nullfs.c                 |  0
 {lib/libstand => stand/lib}/open.c                   |  0
 {lib/libstand => stand/lib}/pager.c                  |  0
 {lib/libstand => stand/lib}/printf.c                 |  0
 {lib/libstand => stand/lib}/qdivrem.c                |  0
 {lib/libstand => stand/lib}/quad.h                   |  0
 {lib/libstand => stand/lib}/random.c                 |  0
 {lib/libstand => stand/lib}/rarp.c                   |  0
 {lib/libstand => stand/lib}/read.c                   |  0
 {lib/libstand => stand/lib}/readdir.c                |  0
 {lib/libstand => stand/lib}/rpc.c                    |  0
 {lib/libstand => stand/lib}/rpc.h                    |  0
 {lib/libstand => stand/lib}/rpcv2.h                  |  0
 {lib/libstand => stand/lib}/sbrk.c                   |  0
 {lib/libstand => stand/lib}/splitfs.c                |  0
 {lib/libstand => stand/lib}/stand.h                  |  0
 {lib/libstand => stand/lib}/stat.c                   |  0
 {lib/libstand => stand/lib}/strcasecmp.c             |  0
 {lib/libstand => stand/lib}/strdup.c                 |  0
 {lib/libstand => stand/lib}/strerror.c               |  0
 {lib/libstand => stand/lib}/strtol.c                 |  0
 {lib/libstand => stand/lib}/strtoul.c                |  0
 {lib/libstand => stand/lib}/tftp.c                   |  0
 {lib/libstand => stand/lib}/tftp.h                   |  0
 {lib/libstand => stand/lib}/twiddle.c                |  0
 {lib/libstand => stand/lib}/udp.c                    |  0
 {lib/libstand => stand/lib}/ufs.c                    |  0
 {lib/libstand => stand/lib}/uuid_from_string.c       |  0
 {lib/libstand => stand/lib}/uuid_to_string.c         |  0
 {lib/libstand => stand/lib}/write.c                  |  0
 {lib/libstand => stand/lib}/x86_64/_setjmp.S         |  0
 {lib/libstand => stand/lib}/zalloc.c                 |  0
 {lib/libstand => stand/lib}/zalloc_defs.h            |  0
 {lib/libstand => stand/lib}/zalloc_malloc.c          |  0
 {lib/libstand => stand/lib}/zalloc_mem.h             |  0
 {lib/libstand => stand/lib}/zalloc_protos.h          |  0
 sys/Makefile                                         |  5 -----
 sys/libkern/stack_protector.c                        |  2 +-
 sys/sys/disklabel32.h                                |  3 +--
 sys/sys/imgact_aout.h                                |  3 +--
 usr.sbin/efibootmgr/Makefile                         |  4 ++--
 249 files changed, 46 insertions(+), 49 deletions(-)
 create mode 100644 stand/Makefile
 rename {sys => stand}/boot/Makefile (100%)
 rename {sys => stand}/boot/common/Makefile.inc (100%)
 rename {sys => stand}/boot/common/bcache.c (100%)
 rename {sys => stand}/boot/common/boot.c (100%)
 rename {sys => stand}/boot/common/boot2.h (100%)
 rename {sys => stand}/boot/common/bootstrap.h (100%)
 rename {sys => stand}/boot/common/commands.c (100%)
 rename {sys => stand}/boot/common/console.c (100%)
 rename {sys => stand}/boot/common/dev_net.c (100%)
 rename {sys => stand}/boot/common/dev_net.h (100%)
 rename {sys => stand}/boot/common/devopen.c (100%)
 rename {sys => stand}/boot/common/dinode.h (100%)
 rename {sys => stand}/boot/common/do_dloader.c (100%)
 rename {sys => stand}/boot/common/fs.h (100%)
 rename {sys => stand}/boot/common/help.common (100%)
 rename {sys => stand}/boot/common/interp_backslash.c (100%)
 rename {sys => stand}/boot/common/interp_parse.c (100%)
 rename {sys => stand}/boot/common/isapnp.c (100%)
 rename {sys => stand}/boot/common/isapnp.h (100%)
 rename {sys => stand}/boot/common/load_elf.c (100%)
 rename {sys => stand}/boot/common/load_elf32.c (100%)
 rename {sys => stand}/boot/common/load_elf32_obj.c (100%)
 rename {sys => stand}/boot/common/load_elf64.c (100%)
 rename {sys => stand}/boot/common/load_elf64_obj.c (100%)
 rename {sys => stand}/boot/common/load_elf_obj.c (100%)
 rename {sys => stand}/boot/common/loader.8 (100%)
 rename {sys => stand}/boot/common/ls.c (100%)
 rename {sys => stand}/boot/common/merge_help.awk (100%)
 rename {sys => stand}/boot/common/misc.c (100%)
 rename {sys => stand}/boot/common/module.c (100%)
 rename {sys => stand}/boot/common/newvers.sh (100%)
 rename {sys => stand}/boot/common/panic.c (100%)
 rename {sys => stand}/boot/common/pnp.c (100%)
 rename {sys => stand}/boot/common/rel_open.c (100%)
 rename {sys => stand}/boot/common/reloc_elf.c (100%)
 rename {sys => stand}/boot/common/reloc_elf32.c (100%)
 rename {sys => stand}/boot/common/reloc_elf64.c (100%)
 rename {sys => stand}/boot/common/ufsread.c (100%)
 rename {sys => stand}/boot/dloader/Makefile (93%)
 rename {sys => stand}/boot/dloader/cmds.c (100%)
 rename {sys => stand}/boot/dloader/dloader.h (100%)
 rename {sys => stand}/boot/dloader/dloader.menu (100%)
 rename {sys => stand}/boot/dloader/loader-bootp.conf (100%)
 rename {sys => stand}/boot/dloader/loader.conf (100%)
 rename {sys => stand}/boot/dloader/subs.c (100%)
 rename {sys => stand}/boot/dloader32/Makefile (100%)
 rename {sys => stand}/boot/efi/Makefile (100%)
 rename {sys => stand}/boot/efi/Makefile.inc (100%)
 rename {sys => stand}/boot/efi/boot1/Makefile (88%)
 rename {sys => stand}/boot/efi/boot1/boot1.c (100%)
 rename {sys => stand}/boot/efi/boot1/boot_module.h (100%)
 rename {sys => stand}/boot/efi/boot1/ufs_module.c (100%)
 rename {sys => stand}/boot/efi/include/efi.h (100%)
 rename {sys => stand}/boot/efi/include/eficonsctl.h (100%)
 rename {sys => stand}/boot/efi/include/efilib.h (100%)
 rename {sys => stand}/boot/efi/libefi/Makefile (75%)
 rename {sys => stand}/boot/efi/libefi/delay.c (100%)
 rename {sys => stand}/boot/efi/libefi/efi_console.c (100%)
 rename {sys => stand}/boot/efi/libefi/efinet.c (100%)
 rename {sys => stand}/boot/efi/libefi/efipart.c (100%)
 rename {sys => stand}/boot/efi/libefi/errno.c (100%)
 rename {sys => stand}/boot/efi/libefi/handles.c (100%)
 rename {sys => stand}/boot/efi/libefi/libefi.c (100%)
 rename {sys => stand}/boot/efi/libefi/time.c (100%)
 rename {sys => stand}/boot/efi/loader/Makefile (91%)
 rename {sys => stand}/boot/efi/loader/arch/x86_64/Makefile.inc (78%)
 rename {sys => stand}/boot/efi/loader/arch/x86_64/amd64_tramp.S (100%)
 rename {sys => stand}/boot/efi/loader/arch/x86_64/elf64_freebsd.c (100%)
 rename {sys => stand}/boot/efi/loader/arch/x86_64/framebuffer.c (100%)
 rename {sys => stand}/boot/efi/loader/arch/x86_64/framebuffer.h (100%)
 rename {sys => stand}/boot/efi/loader/arch/x86_64/ldscript.x86_64 (100%)
 rename {sys => stand}/boot/efi/loader/arch/x86_64/start.S (100%)
 rename {sys => stand}/boot/efi/loader/autoload.c (100%)
 rename {sys => stand}/boot/efi/loader/bootinfo.c (100%)
 rename {sys => stand}/boot/efi/loader/conf.c (100%)
 rename {sys => stand}/boot/efi/loader/copy.c (100%)
 rename {sys => stand}/boot/efi/loader/devicename.c (100%)
 rename {sys => stand}/boot/efi/loader/efi_main.c (100%)
 rename {sys => stand}/boot/efi/loader/loader_efi.h (100%)
 rename {sys => stand}/boot/efi/loader/main.c (100%)
 rename {sys => stand}/boot/efi/loader/self_reloc.c (100%)
 rename {sys => stand}/boot/efi/loader/version (100%)
 rename {sys => stand}/boot/libstand32/Makefile (84%)
 rename {sys => stand}/boot/pc32/Makefile (100%)
 rename {sys => stand}/boot/pc32/Makefile.inc (94%)
 rename {sys => stand}/boot/pc32/asmdef/Makefile (100%)
 rename {sys => stand}/boot/pc32/boot0/Makefile (100%)
 rename {sys => stand}/boot/pc32/boot0/boot0.S (100%)
 rename {sys => stand}/boot/pc32/boot0sio/Makefile (100%)
 rename {sys => stand}/boot/pc32/boot2/Makefile (96%)
 rename {sys => stand}/boot/pc32/boot2/boot1.S (100%)
 rename {sys => stand}/boot/pc32/boot2/boot2.c (100%)
 rename {sys => stand}/boot/pc32/boot2/boot2.ldscript (100%)
 rename {sys => stand}/boot/pc32/boot2/lib.h (100%)
 rename {sys => stand}/boot/pc32/boot2/scrc32.c (100%)
 rename {sys => stand}/boot/pc32/boot2/sio.S (100%)
 rename {sys => stand}/boot/pc32/bootasm.h (100%)
 rename {sys => stand}/boot/pc32/bootasmdef.c (100%)
 rename {sys => stand}/boot/pc32/btx/Makefile (100%)
 rename {sys => stand}/boot/pc32/btx/Makefile.inc (100%)
 rename {sys => stand}/boot/pc32/btx/btx/Makefile (100%)
 rename {sys => stand}/boot/pc32/btx/btx/btx.S (100%)
 rename {sys => stand}/boot/pc32/btx/btx/btx.ldscript (100%)
 rename {sys => stand}/boot/pc32/btx/btxldr/Makefile (100%)
 rename {sys => stand}/boot/pc32/btx/btxldr/btxldr.S (100%)
 rename {sys => stand}/boot/pc32/btx/btxldr/btxldr.ldscript (100%)
 rename {sys => stand}/boot/pc32/btx/lib/Makefile (100%)
 rename {sys => stand}/boot/pc32/btx/lib/btxcsu.S (100%)
 rename {sys => stand}/boot/pc32/btx/lib/btxsys.S (100%)
 rename {sys => stand}/boot/pc32/btx/lib/btxv86.S (100%)
 rename {sys => stand}/boot/pc32/btx/lib/btxv86.h (100%)
 rename {sys => stand}/boot/pc32/btxld/Makefile (100%)
 rename {sys => stand}/boot/pc32/btxld/btx.h (100%)
 rename {sys => stand}/boot/pc32/btxld/btxld.c (99%)
 rename {sys => stand}/boot/pc32/btxld/elfh.c (100%)
 rename {sys => stand}/boot/pc32/btxld/elfh.h (100%)
 rename {sys => stand}/boot/pc32/cdboot/Makefile (100%)
 rename {sys => stand}/boot/pc32/cdboot/cdboot.S (100%)
 rename {sys => stand}/boot/pc32/libi386/Makefile (89%)
 rename {sys => stand}/boot/pc32/libi386/biosacpi.c (100%)
 rename {sys => stand}/boot/pc32/libi386/bioscd.c (100%)
 rename {sys => stand}/boot/pc32/libi386/biosdisk.c (100%)
 rename {sys => stand}/boot/pc32/libi386/biosmem.c (100%)
 rename {sys => stand}/boot/pc32/libi386/biospci.c (100%)
 rename {sys => stand}/boot/pc32/libi386/biospnp.c (100%)
 rename {sys => stand}/boot/pc32/libi386/biossmap.c (100%)
 rename {sys => stand}/boot/pc32/libi386/bootinfo.c (100%)
 rename {sys => stand}/boot/pc32/libi386/bootinfo32.c (100%)
 rename {sys => stand}/boot/pc32/libi386/bootinfo64.c (100%)
 rename {sys => stand}/boot/pc32/libi386/comconsole.c (100%)
 rename {sys => stand}/boot/pc32/libi386/devicename.c (100%)
 rename {sys => stand}/boot/pc32/libi386/elf32_freebsd.c (100%)
 rename {sys => stand}/boot/pc32/libi386/elf64_freebsd.c (100%)
 rename {sys => stand}/boot/pc32/libi386/i386_copy.c (100%)
 rename {sys => stand}/boot/pc32/libi386/i386_module.c (100%)
 rename {sys => stand}/boot/pc32/libi386/libi386.h (100%)
 rename {sys => stand}/boot/pc32/libi386/nullconsole.c (100%)
 rename {sys => stand}/boot/pc32/libi386/pxe.c (99%)
 rename {sys => stand}/boot/pc32/libi386/pxe.h (100%)
 rename {sys => stand}/boot/pc32/libi386/pxetramp.s (100%)
 rename {sys => stand}/boot/pc32/libi386/smbios.c (100%)
 rename {sys => stand}/boot/pc32/libi386/smbios.h (100%)
 rename {sys => stand}/boot/pc32/libi386/time.c (100%)
 rename {sys => stand}/boot/pc32/libi386/vidconsole.c (100%)
 rename {sys => stand}/boot/pc32/libi386/x86_64_tramp.S (100%)
 rename {sys => stand}/boot/pc32/loader/Makefile (98%)
 rename {sys => stand}/boot/pc32/loader/conf.c (100%)
 rename {sys => stand}/boot/pc32/loader/dloader.rc (100%)
 rename {sys => stand}/boot/pc32/loader/help.i386 (100%)
 rename {sys => stand}/boot/pc32/loader/loader.ldscript (100%)
 rename {sys => stand}/boot/pc32/loader/main.c (100%)
 rename {sys => stand}/boot/pc32/loader/version (100%)
 rename {sys => stand}/boot/pc32/loader_tftp/Makefile (98%)
 rename {sys => stand}/boot/pc32/loader_tftp/version (100%)
 rename {sys => stand}/boot/pc32/mbr/Makefile (100%)
 rename {sys => stand}/boot/pc32/mbr/mbr.S (100%)
 rename {sys => stand}/boot/pc32/pxeldr/Makefile (100%)
 rename {sys => stand}/boot/pc32/pxeldr/pxeboot.8 (100%)
 rename {sys => stand}/boot/pc32/pxeldr/pxeldr.S (100%)
 rename {sys => stand}/boot/pc32/pxeldr_tftp/Makefile (100%)
 rename {sys => stand}/boot/pc32/pxeldr_tftp/pxeboot_tftp.8 (100%)
 rename {sys => stand}/boot/pc64/Makefile.inc (100%)
 rename {lib/libstand => stand/lib}/Makefile (94%)
 rename {lib/libstand => stand/lib}/__main.c (100%)
 rename {lib/libstand => stand/lib}/arp.c (100%)
 rename {lib/libstand => stand/lib}/assert.c (100%)
 rename {lib/libstand => stand/lib}/bcd.c (100%)
 rename {lib/libstand => stand/lib}/bootp.c (100%)
 rename {lib/libstand => stand/lib}/bootp.h (100%)
 rename {lib/libstand => stand/lib}/bootparam.c (100%)
 rename {lib/libstand => stand/lib}/bootparam.h (100%)
 rename {lib/libstand => stand/lib}/bswap.c (100%)
 rename {lib/libstand => stand/lib}/bzipfs.c (100%)
 rename {lib/libstand => stand/lib}/cd9660.c (100%)
 rename {lib/libstand => stand/lib}/close.c (100%)
 rename {lib/libstand => stand/lib}/closeall.c (100%)
 rename {lib/libstand => stand/lib}/dev.c (100%)
 rename {lib/libstand => stand/lib}/dosfs.c (100%)
 rename {lib/libstand => stand/lib}/dosfs.h (100%)
 rename {lib/libstand => stand/lib}/environment.c (100%)
 rename {lib/libstand => stand/lib}/ether.c (100%)
 rename {lib/libstand => stand/lib}/ext2fs.c (100%)
 rename {lib/libstand => stand/lib}/fstat.c (100%)
 rename {lib/libstand => stand/lib}/getopt.c (100%)
 rename {lib/libstand => stand/lib}/gets.c (100%)
 rename {lib/libstand => stand/lib}/globals.c (100%)
 rename {lib/libstand => stand/lib}/gzipfs.c (100%)
 rename {lib/libstand => stand/lib}/hammer1.c (100%)
 rename {lib/libstand => stand/lib}/hammer2.c (100%)
 rename {lib/libstand => stand/lib}/i386/_setjmp.S (100%)
 rename {lib/libstand => stand/lib}/if_ether.h (100%)
 rename {lib/libstand => stand/lib}/in_cksum.c (100%)
 rename {lib/libstand => stand/lib}/inet_ntoa.c (100%)
 rename {lib/libstand => stand/lib}/ioctl.c (100%)
 rename {lib/libstand => stand/lib}/iodesc.h (100%)
 rename {lib/libstand => stand/lib}/libstand.3 (100%)
 rename {lib/libstand => stand/lib}/lseek.c (100%)
 rename {lib/libstand => stand/lib}/net.c (100%)
 rename {lib/libstand => stand/lib}/net.h (100%)
 rename {lib/libstand => stand/lib}/netif.c (100%)
 rename {lib/libstand => stand/lib}/netif.h (100%)
 rename {lib/libstand => stand/lib}/nfs.c (100%)
 rename {lib/libstand => stand/lib}/nfsv2.h (100%)
 rename {lib/libstand => stand/lib}/nullfs.c (100%)
 rename {lib/libstand => stand/lib}/open.c (100%)
 rename {lib/libstand => stand/lib}/pager.c (100%)
 rename {lib/libstand => stand/lib}/printf.c (100%)
 rename {lib/libstand => stand/lib}/qdivrem.c (100%)
 rename {lib/libstand => stand/lib}/quad.h (100%)
 rename {lib/libstand => stand/lib}/random.c (100%)
 rename {lib/libstand => stand/lib}/rarp.c (100%)
 rename {lib/libstand => stand/lib}/read.c (100%)
 rename {lib/libstand => stand/lib}/readdir.c (100%)
 rename {lib/libstand => stand/lib}/rpc.c (100%)
 rename {lib/libstand => stand/lib}/rpc.h (100%)
 rename {lib/libstand => stand/lib}/rpcv2.h (100%)
 rename {lib/libstand => stand/lib}/sbrk.c (100%)
 rename {lib/libstand => stand/lib}/splitfs.c (100%)
 rename {lib/libstand => stand/lib}/stand.h (100%)
 rename {lib/libstand => stand/lib}/stat.c (100%)
 rename {lib/libstand => stand/lib}/strcasecmp.c (100%)
 rename {lib/libstand => stand/lib}/strdup.c (100%)
 rename {lib/libstand => stand/lib}/strerror.c (100%)
 rename {lib/libstand => stand/lib}/strtol.c (100%)
 rename {lib/libstand => stand/lib}/strtoul.c (100%)
 rename {lib/libstand => stand/lib}/tftp.c (100%)
 rename {lib/libstand => stand/lib}/tftp.h (100%)
 rename {lib/libstand => stand/lib}/twiddle.c (100%)
 rename {lib/libstand => stand/lib}/udp.c (100%)
 rename {lib/libstand => stand/lib}/ufs.c (100%)
 rename {lib/libstand => stand/lib}/uuid_from_string.c (100%)
 rename {lib/libstand => stand/lib}/uuid_to_string.c (100%)
 rename {lib/libstand => stand/lib}/write.c (100%)
 rename {lib/libstand => stand/lib}/x86_64/_setjmp.S (100%)
 rename {lib/libstand => stand/lib}/zalloc.c (100%)
 rename {lib/libstand => stand/lib}/zalloc_defs.h (100%)
 rename {lib/libstand => stand/lib}/zalloc_malloc.c (100%)
 rename {lib/libstand => stand/lib}/zalloc_mem.h (100%)
 rename {lib/libstand => stand/lib}/zalloc_protos.h (100%)

diff --git a/Makefile.inc1 b/Makefile.inc1
index 83c33bc8e3..5b44622a35 100644
--- a/Makefile.inc1
+++ b/Makefile.inc1
@@ -38,6 +38,7 @@ SUBDIR+= sbin
 .if !defined(NO_SHARE)
 SUBDIR+= share
 .endif
+SUBDIR+= stand
 SUBDIR+= sys
 SUBDIR+= usr.bin
 SUBDIR+= usr.sbin
diff --git a/lib/Makefile b/lib/Makefile
index 23abcaffaf..f48304d1ca 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -83,7 +83,6 @@ SUBDIR=	${SUBDIR_ORDERED} \
 	libsmb \
 	${_libsmdb} \
 	${_libsmutil} \
-	libstand \
 	libtcplay \
 	libtelnet \
 	libu4bhid \
diff --git a/lib/libefivar/Makefile b/lib/libefivar/Makefile
index 5b58910657..727fd1872f 100644
--- a/lib/libefivar/Makefile
+++ b/lib/libefivar/Makefile
@@ -24,7 +24,7 @@
 #
 # $FreeBSD: head/lib/libefivar/Makefile 326458 2017-12-02 07:29:19Z imp $
 
-EFIBOOT=${.CURDIR}/../../sys/boot/efi
+EFIBOOT=${.CURDIR}/../../stand/boot/efi
 EDK2INC=${.CURDIR}/../../sys/contrib/edk2/Include
 
 .PATH:	${EFIBOOT}/libefi
diff --git a/share/man/man5/loader.conf.5 b/share/man/man5/loader.conf.5
index 276375ce9d..8e9810b24a 100644
--- a/share/man/man5/loader.conf.5
+++ b/share/man/man5/loader.conf.5
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD: src/sys/boot/forth/loader.conf.5,v 1.18 2002/08/27 01:02:56 trhodes Exp $
 .\"
-.Dd August 14, 2015
+.Dd October 29, 2020
 .Dt LOADER.CONF 5
 .Os
 .Sh NAME
@@ -227,7 +227,7 @@ and
 in
 .Pa /etc/make.conf
 and recompile and install the boot code at
-.Pa /usr/src/sys/boot ,
+.Pa /usr/src/stand/boot ,
 then install the bootcode to the partition via
 .Xr disklabel 8 .
 .Pp
diff --git a/stand/Makefile b/stand/Makefile
new file mode 100644
index 0000000000..3bd013bf5d
--- /dev/null
+++ b/stand/Makefile
@@ -0,0 +1,3 @@
+SUBDIR=	lib boot
+
+.include <bsd.subdir.mk>
diff --git a/sys/boot/Makefile b/stand/boot/Makefile
similarity index 100%
rename from sys/boot/Makefile
rename to stand/boot/Makefile
diff --git a/sys/boot/common/Makefile.inc b/stand/boot/common/Makefile.inc
similarity index 100%
rename from sys/boot/common/Makefile.inc
rename to stand/boot/common/Makefile.inc
diff --git a/sys/boot/common/bcache.c b/stand/boot/common/bcache.c
similarity index 100%
rename from sys/boot/common/bcache.c
rename to stand/boot/common/bcache.c
diff --git a/sys/boot/common/boot.c b/stand/boot/common/boot.c
similarity index 100%
rename from sys/boot/common/boot.c
rename to stand/boot/common/boot.c
diff --git a/sys/boot/common/boot2.h b/stand/boot/common/boot2.h
similarity index 100%
rename from sys/boot/common/boot2.h
rename to stand/boot/common/boot2.h
diff --git a/sys/boot/common/bootstrap.h b/stand/boot/common/bootstrap.h
similarity index 100%
rename from sys/boot/common/bootstrap.h
rename to stand/boot/common/bootstrap.h
diff --git a/sys/boot/common/commands.c b/stand/boot/common/commands.c
similarity index 100%
rename from sys/boot/common/commands.c
rename to stand/boot/common/commands.c
diff --git a/sys/boot/common/console.c b/stand/boot/common/console.c
similarity index 100%
rename from sys/boot/common/console.c
rename to stand/boot/common/console.c
diff --git a/sys/boot/common/dev_net.c b/stand/boot/common/dev_net.c
similarity index 100%
rename from sys/boot/common/dev_net.c
rename to stand/boot/common/dev_net.c
diff --git a/sys/boot/common/dev_net.h b/stand/boot/common/dev_net.h
similarity index 100%
rename from sys/boot/common/dev_net.h
rename to stand/boot/common/dev_net.h
diff --git a/sys/boot/common/devopen.c b/stand/boot/common/devopen.c
similarity index 100%
rename from sys/boot/common/devopen.c
rename to stand/boot/common/devopen.c
diff --git a/sys/boot/common/dinode.h b/stand/boot/common/dinode.h
similarity index 100%
rename from sys/boot/common/dinode.h
rename to stand/boot/common/dinode.h
diff --git a/sys/boot/common/do_dloader.c b/stand/boot/common/do_dloader.c
similarity index 100%
rename from sys/boot/common/do_dloader.c
rename to stand/boot/common/do_dloader.c
diff --git a/sys/boot/common/fs.h b/stand/boot/common/fs.h
similarity index 100%
rename from sys/boot/common/fs.h
rename to stand/boot/common/fs.h
diff --git a/sys/boot/common/help.common b/stand/boot/common/help.common
similarity index 100%
rename from sys/boot/common/help.common
rename to stand/boot/common/help.common
diff --git a/sys/boot/common/interp_backslash.c b/stand/boot/common/interp_backslash.c
similarity index 100%
rename from sys/boot/common/interp_backslash.c
rename to stand/boot/common/interp_backslash.c
diff --git a/sys/boot/common/interp_parse.c b/stand/boot/common/interp_parse.c
similarity index 100%
rename from sys/boot/common/interp_parse.c
rename to stand/boot/common/interp_parse.c
diff --git a/sys/boot/common/isapnp.c b/stand/boot/common/isapnp.c
similarity index 100%
rename from sys/boot/common/isapnp.c
rename to stand/boot/common/isapnp.c
diff --git a/sys/boot/common/isapnp.h b/stand/boot/common/isapnp.h
similarity index 100%
rename from sys/boot/common/isapnp.h
rename to stand/boot/common/isapnp.h
diff --git a/sys/boot/common/load_elf.c b/stand/boot/common/load_elf.c
similarity index 100%
rename from sys/boot/common/load_elf.c
rename to stand/boot/common/load_elf.c
diff --git a/sys/boot/common/load_elf32.c b/stand/boot/common/load_elf32.c
similarity index 100%
rename from sys/boot/common/load_elf32.c
rename to stand/boot/common/load_elf32.c
diff --git a/sys/boot/common/load_elf32_obj.c b/stand/boot/common/load_elf32_obj.c
similarity index 100%
rename from sys/boot/common/load_elf32_obj.c
rename to stand/boot/common/load_elf32_obj.c
diff --git a/sys/boot/common/load_elf64.c b/stand/boot/common/load_elf64.c
similarity index 100%
rename from sys/boot/common/load_elf64.c
rename to stand/boot/common/load_elf64.c
diff --git a/sys/boot/common/load_elf64_obj.c b/stand/boot/common/load_elf64_obj.c
similarity index 100%
rename from sys/boot/common/load_elf64_obj.c
rename to stand/boot/common/load_elf64_obj.c
diff --git a/sys/boot/common/load_elf_obj.c b/stand/boot/common/load_elf_obj.c
similarity index 100%
rename from sys/boot/common/load_elf_obj.c
rename to stand/boot/common/load_elf_obj.c
diff --git a/sys/boot/common/loader.8 b/stand/boot/common/loader.8
similarity index 100%
rename from sys/boot/common/loader.8
rename to stand/boot/common/loader.8
diff --git a/sys/boot/common/ls.c b/stand/boot/common/ls.c
similarity index 100%
rename from sys/boot/common/ls.c
rename to stand/boot/common/ls.c
diff --git a/sys/boot/common/merge_help.awk b/stand/boot/common/merge_help.awk
similarity index 100%
rename from sys/boot/common/merge_help.awk
rename to stand/boot/common/merge_help.awk
diff --git a/sys/boot/common/misc.c b/stand/boot/common/misc.c
similarity index 100%
rename from sys/boot/common/misc.c
rename to stand/boot/common/misc.c
diff --git a/sys/boot/common/module.c b/stand/boot/common/module.c
similarity index 100%
rename from sys/boot/common/module.c
rename to stand/boot/common/module.c
diff --git a/sys/boot/common/newvers.sh b/stand/boot/common/newvers.sh
similarity index 100%
rename from sys/boot/common/newvers.sh
rename to stand/boot/common/newvers.sh
diff --git a/sys/boot/common/panic.c b/stand/boot/common/panic.c
similarity index 100%
rename from sys/boot/common/panic.c
rename to stand/boot/common/panic.c
diff --git a/sys/boot/common/pnp.c b/stand/boot/common/pnp.c
similarity index 100%
rename from sys/boot/common/pnp.c
rename to stand/boot/common/pnp.c
diff --git a/sys/boot/common/rel_open.c b/stand/boot/common/rel_open.c
similarity index 100%
rename from sys/boot/common/rel_open.c
rename to stand/boot/common/rel_open.c
diff --git a/sys/boot/common/reloc_elf.c b/stand/boot/common/reloc_elf.c
similarity index 100%
rename from sys/boot/common/reloc_elf.c
rename to stand/boot/common/reloc_elf.c
diff --git a/sys/boot/common/reloc_elf32.c b/stand/boot/common/reloc_elf32.c
similarity index 100%
rename from sys/boot/common/reloc_elf32.c
rename to stand/boot/common/reloc_elf32.c
diff --git a/sys/boot/common/reloc_elf64.c b/stand/boot/common/reloc_elf64.c
similarity index 100%
rename from sys/boot/common/reloc_elf64.c
rename to stand/boot/common/reloc_elf64.c
diff --git a/sys/boot/common/ufsread.c b/stand/boot/common/ufsread.c
similarity index 100%
rename from sys/boot/common/ufsread.c
rename to stand/boot/common/ufsread.c
diff --git a/sys/boot/dloader/Makefile b/stand/boot/dloader/Makefile
similarity index 93%
rename from sys/boot/dloader/Makefile
rename to stand/boot/dloader/Makefile
index cf37f690db..f565991a47 100644
--- a/sys/boot/dloader/Makefile
+++ b/stand/boot/dloader/Makefile
@@ -37,7 +37,7 @@ OBJS+=		stack_protector.o
 LIB?=		dloader
 INTERNALLIB=	yes
 
-stack_protector.o: ../../libkern/stack_protector.c
+stack_protector.o: ../../../sys/libkern/stack_protector.c
 
 .include <bsd.lib.mk>
 .endif
diff --git a/sys/boot/dloader/cmds.c b/stand/boot/dloader/cmds.c
similarity index 100%
rename from sys/boot/dloader/cmds.c
rename to stand/boot/dloader/cmds.c
diff --git a/sys/boot/dloader/dloader.h b/stand/boot/dloader/dloader.h
similarity index 100%
rename from sys/boot/dloader/dloader.h
rename to stand/boot/dloader/dloader.h
diff --git a/sys/boot/dloader/dloader.menu b/stand/boot/dloader/dloader.menu
similarity index 100%
rename from sys/boot/dloader/dloader.menu
rename to stand/boot/dloader/dloader.menu
diff --git a/sys/boot/dloader/loader-bootp.conf b/stand/boot/dloader/loader-bootp.conf
similarity index 100%
rename from sys/boot/dloader/loader-bootp.conf
rename to stand/boot/dloader/loader-bootp.conf
diff --git a/sys/boot/dloader/loader.conf b/stand/boot/dloader/loader.conf
similarity index 100%
rename from sys/boot/dloader/loader.conf
rename to stand/boot/dloader/loader.conf
diff --git a/sys/boot/dloader/subs.c b/stand/boot/dloader/subs.c
similarity index 100%
rename from sys/boot/dloader/subs.c
rename to stand/boot/dloader/subs.c
diff --git a/sys/boot/dloader32/Makefile b/stand/boot/dloader32/Makefile
similarity index 100%
rename from sys/boot/dloader32/Makefile
rename to stand/boot/dloader32/Makefile
diff --git a/sys/boot/efi/Makefile b/stand/boot/efi/Makefile
similarity index 100%
rename from sys/boot/efi/Makefile
rename to stand/boot/efi/Makefile
diff --git a/sys/boot/efi/Makefile.inc b/stand/boot/efi/Makefile.inc
similarity index 100%
rename from sys/boot/efi/Makefile.inc
rename to stand/boot/efi/Makefile.inc
diff --git a/sys/boot/efi/boot1/Makefile b/stand/boot/efi/boot1/Makefile
similarity index 88%
rename from sys/boot/efi/boot1/Makefile
rename to stand/boot/efi/boot1/Makefile
index eb563cfa3f..372019c003 100644
--- a/sys/boot/efi/boot1/Makefile
+++ b/stand/boot/efi/boot1/Makefile
@@ -14,13 +14,13 @@ SRCS=	boot1.c self_reloc.c start.S ufs_module.c
 
 CFLAGS+=	-I.
 CFLAGS+=	-I${.CURDIR}/../include
-CFLAGS+=	-I${.CURDIR}/../../../contrib/dev/acpica/source/include
-CFLAGS+=	-I${.CURDIR}/../../../contrib/edk2/Include
-CFLAGS+=	-I${.CURDIR}/../../..
+CFLAGS+=	-I${.CURDIR}/../../../../sys/contrib/dev/acpica/source/include
+CFLAGS+=	-I${.CURDIR}/../../../../sys/contrib/edk2/Include
+CFLAGS+=	-I${.CURDIR}/../../../../sys
 CFLAGS+=	-DEFI_UFS_BOOT
 
 .if ${MACHINE_ARCH} == "x86_64"
-CFLAGS+=	-I${.CURDIR}/../../../contrib/edk2/Include/X64
+CFLAGS+=	-I${.CURDIR}/../../../../sys/contrib/edk2/Include/X64
 .endif
 
 # Disable stack protector
@@ -53,8 +53,8 @@ LDFLAGS+=	-Wl,-znocombreloc
 .if exists(${.OBJDIR}/../libefi/libefi.a)
 LIBEFI=		${.OBJDIR}/../libefi/libefi.a
 .endif
-.if exists(${.OBJDIR}/../../../../lib/libstand/libstand.a)
-LIBSTAND=	${.OBJDIR}/../../../../lib/libstand/libstand.a
+.if exists(${.OBJDIR}/../../../lib/libstand.a)
+LIBSTAND=	${.OBJDIR}/../../../lib/libstand.a
 .endif
 
 #
diff --git a/sys/boot/efi/boot1/boot1.c b/stand/boot/efi/boot1/boot1.c
similarity index 100%
rename from sys/boot/efi/boot1/boot1.c
rename to stand/boot/efi/boot1/boot1.c
diff --git a/sys/boot/efi/boot1/boot_module.h b/stand/boot/efi/boot1/boot_module.h
similarity index 100%
rename from sys/boot/efi/boot1/boot_module.h
rename to stand/boot/efi/boot1/boot_module.h
diff --git a/sys/boot/efi/boot1/ufs_module.c b/stand/boot/efi/boot1/ufs_module.c
similarity index 100%
rename from sys/boot/efi/boot1/ufs_module.c
rename to stand/boot/efi/boot1/ufs_module.c
diff --git a/sys/boot/efi/include/efi.h b/stand/boot/efi/include/efi.h
similarity index 100%
rename from sys/boot/efi/include/efi.h
rename to stand/boot/efi/include/efi.h
diff --git a/sys/boot/efi/include/eficonsctl.h b/stand/boot/efi/include/eficonsctl.h
similarity index 100%
rename from sys/boot/efi/include/eficonsctl.h
rename to stand/boot/efi/include/eficonsctl.h
diff --git a/sys/boot/efi/include/efilib.h b/stand/boot/efi/include/efilib.h
similarity index 100%
rename from sys/boot/efi/include/efilib.h
rename to stand/boot/efi/include/efilib.h
diff --git a/sys/boot/efi/libefi/Makefile b/stand/boot/efi/libefi/Makefile
similarity index 75%
rename from sys/boot/efi/libefi/Makefile
rename to stand/boot/efi/libefi/Makefile
index 780c598de9..06d2e60375 100644
--- a/sys/boot/efi/libefi/Makefile
+++ b/stand/boot/efi/libefi/Makefile
@@ -9,11 +9,11 @@ SRCS=	delay.c efi_console.c efinet.c efipart.c errno.c handles.c \
 
 .if ${MACHINE_ARCH} == "x86_64"
 CFLAGS+= -fPIC -mno-red-zone
-CFLAGS+= -I${.CURDIR}/../../../contrib/edk2/Include/X64
+CFLAGS+= -I${.CURDIR}/../../../../sys/contrib/edk2/Include/X64
 .endif
 CFLAGS+= -I${.CURDIR}/../include
-CFLAGS+= -I${.CURDIR}/../../../contrib/edk2/Include
-CFLAGS+= -I${.CURDIR}/../../../../lib/libstand
+CFLAGS+= -I${.CURDIR}/../../../../sys/contrib/edk2/Include
+CFLAGS+= -I${.CURDIR}/../../../lib
 
 # Pick up the bootstrap header for some interface items
 CFLAGS+= -I${.CURDIR}/../../common
diff --git a/sys/boot/efi/libefi/delay.c b/stand/boot/efi/libefi/delay.c
similarity index 100%
rename from sys/boot/efi/libefi/delay.c
rename to stand/boot/efi/libefi/delay.c
diff --git a/sys/boot/efi/libefi/efi_console.c b/stand/boot/efi/libefi/efi_console.c
similarity index 100%
rename from sys/boot/efi/libefi/efi_console.c
rename to stand/boot/efi/libefi/efi_console.c
diff --git a/sys/boot/efi/libefi/efinet.c b/stand/boot/efi/libefi/efinet.c
similarity index 100%
rename from sys/boot/efi/libefi/efinet.c
rename to stand/boot/efi/libefi/efinet.c
diff --git a/sys/boot/efi/libefi/efipart.c b/stand/boot/efi/libefi/efipart.c
similarity index 100%
rename from sys/boot/efi/libefi/efipart.c
rename to stand/boot/efi/libefi/efipart.c
diff --git a/sys/boot/efi/libefi/errno.c b/stand/boot/efi/libefi/errno.c
similarity index 100%
rename from sys/boot/efi/libefi/errno.c
rename to stand/boot/efi/libefi/errno.c
diff --git a/sys/boot/efi/libefi/handles.c b/stand/boot/efi/libefi/handles.c
similarity index 100%
rename from sys/boot/efi/libefi/handles.c
rename to stand/boot/efi/libefi/handles.c
diff --git a/sys/boot/efi/libefi/libefi.c b/stand/boot/efi/libefi/libefi.c
similarity index 100%
rename from sys/boot/efi/libefi/libefi.c
rename to stand/boot/efi/libefi/libefi.c
diff --git a/sys/boot/efi/libefi/time.c b/stand/boot/efi/libefi/time.c
similarity index 100%
rename from sys/boot/efi/libefi/time.c
rename to stand/boot/efi/libefi/time.c
diff --git a/sys/boot/efi/loader/Makefile b/stand/boot/efi/loader/Makefile
similarity index 91%
rename from sys/boot/efi/loader/Makefile
rename to stand/boot/efi/loader/Makefile
index a23df366ea..f586b622b3 100644
--- a/sys/boot/efi/loader/Makefile
+++ b/stand/boot/efi/loader/Makefile
@@ -34,16 +34,16 @@ BOOT_DLOADER=	yes
 CFLAGS+=	-I${.CURDIR}
 CFLAGS+=	-I${.CURDIR}/arch/${MACHINE}
 CFLAGS+=	-I${.CURDIR}/../include
-CFLAGS+=	-I${.CURDIR}/../../../contrib/dev/acpica/source/include
-CFLAGS+=	-I${.CURDIR}/../../..
+CFLAGS+=	-I${.CURDIR}/../../../../sys/contrib/dev/acpica/source/include
+CFLAGS+=	-I${.CURDIR}/../../../../sys
 CFLAGS+=	-I${.CURDIR}/../../pc32/libi386
 CFLAGS+=	-I${.CURDIR}/../../dloader
 CFLAGS+=	-DNO_PCI -DEFI
 
 # make buildenv doesn't set DESTDIR, this means LIBSTAND
 # will be wrong when crossbuilding.
-.if exists(${.OBJDIR}/../../../../lib/libstand/libstand.a)
-LIBSTAND=	${.OBJDIR}/../../../../lib/libstand/libstand.a
+.if exists(${.OBJDIR}/../../../lib/libstand.a)
+LIBSTAND=	${.OBJDIR}/../../../lib/libstand.a
 .endif
 
 .if exists(${.OBJDIR}/../../dloader/libdloader.a)
diff --git a/sys/boot/efi/loader/arch/x86_64/Makefile.inc b/stand/boot/efi/loader/arch/x86_64/Makefile.inc
similarity index 78%
rename from sys/boot/efi/loader/arch/x86_64/Makefile.inc
rename to stand/boot/efi/loader/arch/x86_64/Makefile.inc
index 400d516b5d..667cdf88b5 100644
--- a/sys/boot/efi/loader/arch/x86_64/Makefile.inc
+++ b/stand/boot/efi/loader/arch/x86_64/Makefile.inc
@@ -13,8 +13,8 @@ SRCS+=	nullconsole.c \
 CFLAGS+=	-fno-stack-protector
 
 CFLAGS+=	-fPIC
-CFLAGS+=	-I${.CURDIR}/../../../contrib/edk2/Include
-CFLAGS+=	-I${.CURDIR}/../../../contrib/edk2/Include/X64
+CFLAGS+=	-I${.CURDIR}/../../../../sys/contrib/edk2/Include
+CFLAGS+=	-I${.CURDIR}/../../../../sys/contrib/edk2/Include/X64
 LDFLAGS+=	-Wl,-znocombreloc
 
 FLAGS_GROUPS=	inttypes
diff --git a/sys/boot/efi/loader/arch/x86_64/amd64_tramp.S b/stand/boot/efi/loader/arch/x86_64/amd64_tramp.S
similarity index 100%
rename from sys/boot/efi/loader/arch/x86_64/amd64_tramp.S
rename to stand/boot/efi/loader/arch/x86_64/amd64_tramp.S
diff --git a/sys/boot/efi/loader/arch/x86_64/elf64_freebsd.c b/stand/boot/efi/loader/arch/x86_64/elf64_freebsd.c
similarity index 100%
rename from sys/boot/efi/loader/arch/x86_64/elf64_freebsd.c
rename to stand/boot/efi/loader/arch/x86_64/elf64_freebsd.c
diff --git a/sys/boot/efi/loader/arch/x86_64/framebuffer.c b/stand/boot/efi/loader/arch/x86_64/framebuffer.c
similarity index 100%
rename from sys/boot/efi/loader/arch/x86_64/framebuffer.c
rename to stand/boot/efi/loader/arch/x86_64/framebuffer.c
diff --git a/sys/boot/efi/loader/arch/x86_64/framebuffer.h b/stand/boot/efi/loader/arch/x86_64/framebuffer.h
similarity index 100%
rename from sys/boot/efi/loader/arch/x86_64/framebuffer.h
rename to stand/boot/efi/loader/arch/x86_64/framebuffer.h
diff --git a/sys/boot/efi/loader/arch/x86_64/ldscript.x86_64 b/stand/boot/efi/loader/arch/x86_64/ldscript.x86_64
similarity index 100%
rename from sys/boot/efi/loader/arch/x86_64/ldscript.x86_64
rename to stand/boot/efi/loader/arch/x86_64/ldscript.x86_64
diff --git a/sys/boot/efi/loader/arch/x86_64/start.S b/stand/boot/efi/loader/arch/x86_64/start.S
similarity index 100%
rename from sys/boot/efi/loader/arch/x86_64/start.S
rename to stand/boot/efi/loader/arch/x86_64/start.S
diff --git a/sys/boot/efi/loader/autoload.c b/stand/boot/efi/loader/autoload.c
similarity index 100%
rename from sys/boot/efi/loader/autoload.c
rename to stand/boot/efi/loader/autoload.c
diff --git a/sys/boot/efi/loader/bootinfo.c b/stand/boot/efi/loader/bootinfo.c
similarity index 100%
rename from sys/boot/efi/loader/bootinfo.c
rename to stand/boot/efi/loader/bootinfo.c
diff --git a/sys/boot/efi/loader/conf.c b/stand/boot/efi/loader/conf.c
similarity index 100%
rename from sys/boot/efi/loader/conf.c
rename to stand/boot/efi/loader/conf.c
diff --git a/sys/boot/efi/loader/copy.c b/stand/boot/efi/loader/copy.c
similarity index 100%
rename from sys/boot/efi/loader/copy.c
rename to stand/boot/efi/loader/copy.c
diff --git a/sys/boot/efi/loader/devicename.c b/stand/boot/efi/loader/devicename.c
similarity index 100%
rename from sys/boot/efi/loader/devicename.c
rename to stand/boot/efi/loader/devicename.c
diff --git a/sys/boot/efi/loader/efi_main.c b/stand/boot/efi/loader/efi_main.c
similarity index 100%
rename from sys/boot/efi/loader/efi_main.c
rename to stand/boot/efi/loader/efi_main.c
diff --git a/sys/boot/efi/loader/loader_efi.h b/stand/boot/efi/loader/loader_efi.h
similarity index 100%
rename from sys/boot/efi/loader/loader_efi.h
rename to stand/boot/efi/loader/loader_efi.h
diff --git a/sys/boot/efi/loader/main.c b/stand/boot/efi/loader/main.c
similarity index 100%
rename from sys/boot/efi/loader/main.c
rename to stand/boot/efi/loader/main.c
diff --git a/sys/boot/efi/loader/self_reloc.c b/stand/boot/efi/loader/self_reloc.c
similarity index 100%
rename from sys/boot/efi/loader/self_reloc.c
rename to stand/boot/efi/loader/self_reloc.c
diff --git a/sys/boot/efi/loader/version b/stand/boot/efi/loader/version
similarity index 100%
rename from sys/boot/efi/loader/version
rename to stand/boot/efi/loader/version
diff --git a/sys/boot/libstand32/Makefile b/stand/boot/libstand32/Makefile
similarity index 84%
rename from sys/boot/libstand32/Makefile
rename to stand/boot/libstand32/Makefile
index 68871fa40f..c413daed05 100644
--- a/sys/boot/libstand32/Makefile
+++ b/stand/boot/libstand32/Makefile
@@ -1,6 +1,6 @@
 # $FreeBSD: head/sys/boot/libstand32/Makefile 293341 2016-01-07 19:19:23Z bdrewery $
 
-LIBSTAND_SRC= ${.CURDIR}/../../../lib/libstand
+LIBSTAND_SRC= ${.CURDIR}/../../lib
 LIBSTAND_ARCH= i386
 INTERNALLIB=
 INCS=
diff --git a/sys/boot/pc32/Makefile b/stand/boot/pc32/Makefile
similarity index 100%
rename from sys/boot/pc32/Makefile
rename to stand/boot/pc32/Makefile
diff --git a/sys/boot/pc32/Makefile.inc b/stand/boot/pc32/Makefile.inc
similarity index 94%
rename from sys/boot/pc32/Makefile.inc
rename to stand/boot/pc32/Makefile.inc
index 730a3f52cc..da63ae3169 100644
--- a/sys/boot/pc32/Makefile.inc
+++ b/stand/boot/pc32/Makefile.inc
@@ -1,4 +1,4 @@
-# Common defines for all of /sys/boot/i386/
+# Common defines for all of /stand/boot/i386/
 
 .if !target(__pc32__) && !defined(__no_pc32_defines)
 __pc32__:
diff --git a/sys/boot/pc32/asmdef/Makefile b/stand/boot/pc32/asmdef/Makefile
similarity index 100%
rename from sys/boot/pc32/asmdef/Makefile
rename to stand/boot/pc32/asmdef/Makefile
diff --git a/sys/boot/pc32/boot0/Makefile b/stand/boot/pc32/boot0/Makefile
similarity index 100%
rename from sys/boot/pc32/boot0/Makefile
rename to stand/boot/pc32/boot0/Makefile
diff --git a/sys/boot/pc32/boot0/boot0.S b/stand/boot/pc32/boot0/boot0.S
similarity index 100%
rename from sys/boot/pc32/boot0/boot0.S
rename to stand/boot/pc32/boot0/boot0.S
diff --git a/sys/boot/pc32/boot0sio/Makefile b/stand/boot/pc32/boot0sio/Makefile
similarity index 100%
rename from sys/boot/pc32/boot0sio/Makefile
rename to stand/boot/pc32/boot0sio/Makefile
diff --git a/sys/boot/pc32/boot2/Makefile b/stand/boot/pc32/boot2/Makefile
similarity index 96%
rename from sys/boot/pc32/boot2/Makefile
rename to stand/boot/pc32/boot2/Makefile
index f48eb91706..e9ad63bbf1 100644
--- a/sys/boot/pc32/boot2/Makefile
+++ b/stand/boot/pc32/boot2/Makefile
@@ -13,8 +13,8 @@ NXLDFLAGS=
 
 .PATH: ${.CURDIR}/..
 .PATH: ${.CURDIR}/../../common
-.PATH: ${.CURDIR}/../../../../lib/libstand
-.PATH: ${.CURDIR}/../../../libkern
+.PATH: ${.CURDIR}/../../../lib
+.PATH: ${.CURDIR}/../../../../sys/libkern
 
 # A value of 0x80 enables LBA support.
 B1FLAGS=	0x80
@@ -49,7 +49,7 @@ CFLAGS=	-Os \
 	-fno-asynchronous-unwind-tables \
 	-DBOOT2 \
 	-I${.CURDIR}/../../common \
-	-I${.CURDIR}/../../../../lib/libstand \
+	-I${.CURDIR}/../../../lib \
 	-I${.CURDIR}/../btx/lib -I. \
 	-Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
 	-Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
@@ -115,7 +115,7 @@ boot1$s.o: boot1.S
 	${CC} ${CFLAGS} ${_ADDCFLAGS$s} -DFLAGS=${B1FLAGS} \
 		${ASSEMBLER_FLAGS} ${.ALLSRC} -o ${.TARGET} -c
 
-#${.CURDIR}/../../common/ufsread.c ${.CURDIR}/../../../../lib/libstand/hammer2.c
+#${.CURDIR}/../../common/ufsread.c ${.CURDIR}/../../../lib/hammer2.c
 
 boot2$s.s: boot2.c boot2$s.h ufsread.c hammer2.c scrc32.c
 	${CC} ${CFLAGS} ${_ADDCFLAGS$s} -S -o boot2$s.s.tmp ${.CURDIR}/boot2.c
diff --git a/sys/boot/pc32/boot2/boot1.S b/stand/boot/pc32/boot2/boot1.S
similarity index 100%
rename from sys/boot/pc32/boot2/boot1.S
rename to stand/boot/pc32/boot2/boot1.S
diff --git a/sys/boot/pc32/boot2/boot2.c b/stand/boot/pc32/boot2/boot2.c
similarity index 100%
rename from sys/boot/pc32/boot2/boot2.c
rename to stand/boot/pc32/boot2/boot2.c
diff --git a/sys/boot/pc32/boot2/boot2.ldscript b/stand/boot/pc32/boot2/boot2.ldscript
similarity index 100%
rename from sys/boot/pc32/boot2/boot2.ldscript
rename to stand/boot/pc32/boot2/boot2.ldscript
diff --git a/sys/boot/pc32/boot2/lib.h b/stand/boot/pc32/boot2/lib.h
similarity index 100%
rename from sys/boot/pc32/boot2/lib.h
rename to stand/boot/pc32/boot2/lib.h
diff --git a/sys/boot/pc32/boot2/scrc32.c b/stand/boot/pc32/boot2/scrc32.c
similarity index 100%
rename from sys/boot/pc32/boot2/scrc32.c
rename to stand/boot/pc32/boot2/scrc32.c
diff --git a/sys/boot/pc32/boot2/sio.S b/stand/boot/pc32/boot2/sio.S
similarity index 100%
rename from sys/boot/pc32/boot2/sio.S
rename to stand/boot/pc32/boot2/sio.S
diff --git a/sys/boot/pc32/bootasm.h b/stand/boot/pc32/bootasm.h
similarity index 100%
rename from sys/boot/pc32/bootasm.h
rename to stand/boot/pc32/bootasm.h
diff --git a/sys/boot/pc32/bootasmdef.c b/stand/boot/pc32/bootasmdef.c
similarity index 100%
rename from sys/boot/pc32/bootasmdef.c
rename to stand/boot/pc32/bootasmdef.c
diff --git a/sys/boot/pc32/btx/Makefile b/stand/boot/pc32/btx/Makefile
similarity index 100%
rename from sys/boot/pc32/btx/Makefile
rename to stand/boot/pc32/btx/Makefile
diff --git a/sys/boot/pc32/btx/Makefile.inc b/stand/boot/pc32/btx/Makefile.inc
similarity index 100%
rename from sys/boot/pc32/btx/Makefile.inc
rename to stand/boot/pc32/btx/Makefile.inc
diff --git a/sys/boot/pc32/btx/btx/Makefile b/stand/boot/pc32/btx/btx/Makefile
similarity index 100%
rename from sys/boot/pc32/btx/btx/Makefile
rename to stand/boot/pc32/btx/btx/Makefile
diff --git a/sys/boot/pc32/btx/btx/btx.S b/stand/boot/pc32/btx/btx/btx.S
similarity index 100%
rename from sys/boot/pc32/btx/btx/btx.S
rename to stand/boot/pc32/btx/btx/btx.S
diff --git a/sys/boot/pc32/btx/btx/btx.ldscript b/stand/boot/pc32/btx/btx/btx.ldscript
similarity index 100%
rename from sys/boot/pc32/btx/btx/btx.ldscript
rename to stand/boot/pc32/btx/btx/btx.ldscript
diff --git a/sys/boot/pc32/btx/btxldr/Makefile b/stand/boot/pc32/btx/btxldr/Makefile
similarity index 100%
rename from sys/boot/pc32/btx/btxldr/Makefile
rename to stand/boot/pc32/btx/btxldr/Makefile
diff --git a/sys/boot/pc32/btx/btxldr/btxldr.S b/stand/boot/pc32/btx/btxldr/btxldr.S
similarity index 100%
rename from sys/boot/pc32/btx/btxldr/btxldr.S
rename to stand/boot/pc32/btx/btxldr/btxldr.S
diff --git a/sys/boot/pc32/btx/btxldr/btxldr.ldscript b/stand/boot/pc32/btx/btxldr/btxldr.ldscript
similarity index 100%
rename from sys/boot/pc32/btx/btxldr/btxldr.ldscript
rename to stand/boot/pc32/btx/btxldr/btxldr.ldscript
diff --git a/sys/boot/pc32/btx/lib/Makefile b/stand/boot/pc32/btx/lib/Makefile
similarity index 100%
rename from sys/boot/pc32/btx/lib/Makefile
rename to stand/boot/pc32/btx/lib/Makefile
diff --git a/sys/boot/pc32/btx/lib/btxcsu.S b/stand/boot/pc32/btx/lib/btxcsu.S
similarity index 100%
rename from sys/boot/pc32/btx/lib/btxcsu.S
rename to stand/boot/pc32/btx/lib/btxcsu.S
diff --git a/sys/boot/pc32/btx/lib/btxsys.S b/stand/boot/pc32/btx/lib/btxsys.S
similarity index 100%
rename from sys/boot/pc32/btx/lib/btxsys.S
rename to stand/boot/pc32/btx/lib/btxsys.S
diff --git a/sys/boot/pc32/btx/lib/btxv86.S b/stand/boot/pc32/btx/lib/btxv86.S
similarity index 100%
rename from sys/boot/pc32/btx/lib/btxv86.S
rename to stand/boot/pc32/btx/lib/btxv86.S
diff --git a/sys/boot/pc32/btx/lib/btxv86.h b/stand/boot/pc32/btx/lib/btxv86.h
similarity index 100%
rename from sys/boot/pc32/btx/lib/btxv86.h
rename to stand/boot/pc32/btx/lib/btxv86.h
diff --git a/sys/boot/pc32/btxld/Makefile b/stand/boot/pc32/btxld/Makefile
similarity index 100%
rename from sys/boot/pc32/btxld/Makefile
rename to stand/boot/pc32/btxld/Makefile
diff --git a/sys/boot/pc32/btxld/btx.h b/stand/boot/pc32/btxld/btx.h
similarity index 100%
rename from sys/boot/pc32/btxld/btx.h
rename to stand/boot/pc32/btxld/btx.h
diff --git a/sys/boot/pc32/btxld/btxld.c b/stand/boot/pc32/btxld/btxld.c
similarity index 99%
rename from sys/boot/pc32/btxld/btxld.c
rename to stand/boot/pc32/btxld/btxld.c
index 2ab3a4ccf0..c74e600b20 100644
--- a/sys/boot/pc32/btxld/btxld.c
+++ b/stand/boot/pc32/btxld/btxld.c
@@ -45,7 +45,7 @@
 #include "btx.h"
 #include "elfh.h"
 
-#define BTX_PATH		"/sys/boot/i386/btx"
+#define BTX_PATH		"/stand/boot/i386/btx"
 
 #define I_LDR	0		/* BTX loader */
 #define I_BTX	1		/* BTX kernel */
diff --git a/sys/boot/pc32/btxld/elfh.c b/stand/boot/pc32/btxld/elfh.c
similarity index 100%
rename from sys/boot/pc32/btxld/elfh.c
rename to stand/boot/pc32/btxld/elfh.c
diff --git a/sys/boot/pc32/btxld/elfh.h b/stand/boot/pc32/btxld/elfh.h
similarity index 100%
rename from sys/boot/pc32/btxld/elfh.h
rename to stand/boot/pc32/btxld/elfh.h
diff --git a/sys/boot/pc32/cdboot/Makefile b/stand/boot/pc32/cdboot/Makefile
similarity index 100%
rename from sys/boot/pc32/cdboot/Makefile
rename to stand/boot/pc32/cdboot/Makefile
diff --git a/sys/boot/pc32/cdboot/cdboot.S b/stand/boot/pc32/cdboot/cdboot.S
similarity index 100%
rename from sys/boot/pc32/cdboot/cdboot.S
rename to stand/boot/pc32/cdboot/cdboot.S
diff --git a/sys/boot/pc32/libi386/Makefile b/stand/boot/pc32/libi386/Makefile
similarity index 89%
rename from sys/boot/pc32/libi386/Makefile
rename to stand/boot/pc32/libi386/Makefile
index 116b3e7c4a..1101df3f60 100644
--- a/sys/boot/pc32/libi386/Makefile
+++ b/stand/boot/pc32/libi386/Makefile
@@ -2,7 +2,7 @@
 #
 LIB=			i386
 INTERNALLIB=		true
-SYSDIR?=		${.CURDIR}/../../..
+SYSDIR?=		${.CURDIR}/../../../../sys
 .include "${SYSDIR}/conf/acpi.mk"
 
 SRCS=	biosacpi.c bioscd.c biosdisk.c biosmem.c biospnp.c \
@@ -32,6 +32,8 @@ CFLAGS+=	-I${.CURDIR}/../../common -I${.CURDIR}/../btx/lib \
 		-I"${SYSDIR}/${OSACPI_MI_DIR}" \
 		-I${.CURDIR}/../../.. -I.
 # the location of libstand
-CFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=	-I${.CURDIR}/../../../lib
+# we need some kernel headers
+CFLAGS+=	-I${SYSDIR}
 
 .include <bsd.lib.mk>
diff --git a/sys/boot/pc32/libi386/biosacpi.c b/stand/boot/pc32/libi386/biosacpi.c
similarity index 100%
rename from sys/boot/pc32/libi386/biosacpi.c
rename to stand/boot/pc32/libi386/biosacpi.c
diff --git a/sys/boot/pc32/libi386/bioscd.c b/stand/boot/pc32/libi386/bioscd.c
similarity index 100%
rename from sys/boot/pc32/libi386/bioscd.c
rename to stand/boot/pc32/libi386/bioscd.c
diff --git a/sys/boot/pc32/libi386/biosdisk.c b/stand/boot/pc32/libi386/biosdisk.c
similarity index 100%
rename from sys/boot/pc32/libi386/biosdisk.c
rename to stand/boot/pc32/libi386/biosdisk.c
diff --git a/sys/boot/pc32/libi386/biosmem.c b/stand/boot/pc32/libi386/biosmem.c
similarity index 100%
rename from sys/boot/pc32/libi386/biosmem.c
rename to stand/boot/pc32/libi386/biosmem.c
diff --git a/sys/boot/pc32/libi386/biospci.c b/stand/boot/pc32/libi386/biospci.c
similarity index 100%
rename from sys/boot/pc32/libi386/biospci.c
rename to stand/boot/pc32/libi386/biospci.c
diff --git a/sys/boot/pc32/libi386/biospnp.c b/stand/boot/pc32/libi386/biospnp.c
similarity index 100%
rename from sys/boot/pc32/libi386/biospnp.c
rename to stand/boot/pc32/libi386/biospnp.c
diff --git a/sys/boot/pc32/libi386/biossmap.c b/stand/boot/pc32/libi386/biossmap.c
similarity index 100%
rename from sys/boot/pc32/libi386/biossmap.c
rename to stand/boot/pc32/libi386/biossmap.c
diff --git a/sys/boot/pc32/libi386/bootinfo.c b/stand/boot/pc32/libi386/bootinfo.c
similarity index 100%
rename from sys/boot/pc32/libi386/bootinfo.c
rename to stand/boot/pc32/libi386/bootinfo.c
diff --git a/sys/boot/pc32/libi386/bootinfo32.c b/stand/boot/pc32/libi386/bootinfo32.c
similarity index 100%
rename from sys/boot/pc32/libi386/bootinfo32.c
rename to stand/boot/pc32/libi386/bootinfo32.c
diff --git a/sys/boot/pc32/libi386/bootinfo64.c b/stand/boot/pc32/libi386/bootinfo64.c
similarity index 100%
rename from sys/boot/pc32/libi386/bootinfo64.c
rename to stand/boot/pc32/libi386/bootinfo64.c
diff --git a/sys/boot/pc32/libi386/comconsole.c b/stand/boot/pc32/libi386/comconsole.c
similarity index 100%
rename from sys/boot/pc32/libi386/comconsole.c
rename to stand/boot/pc32/libi386/comconsole.c
diff --git a/sys/boot/pc32/libi386/devicename.c b/stand/boot/pc32/libi386/devicename.c
similarity index 100%
rename from sys/boot/pc32/libi386/devicename.c
rename to stand/boot/pc32/libi386/devicename.c
diff --git a/sys/boot/pc32/libi386/elf32_freebsd.c b/stand/boot/pc32/libi386/elf32_freebsd.c
similarity index 100%
rename from sys/boot/pc32/libi386/elf32_freebsd.c
rename to stand/boot/pc32/libi386/elf32_freebsd.c
diff --git a/sys/boot/pc32/libi386/elf64_freebsd.c b/stand/boot/pc32/libi386/elf64_freebsd.c
similarity index 100%
rename from sys/boot/pc32/libi386/elf64_freebsd.c
rename to stand/boot/pc32/libi386/elf64_freebsd.c
diff --git a/sys/boot/pc32/libi386/i386_copy.c b/stand/boot/pc32/libi386/i386_copy.c
similarity index 100%
rename from sys/boot/pc32/libi386/i386_copy.c
rename to stand/boot/pc32/libi386/i386_copy.c
diff --git a/sys/boot/pc32/libi386/i386_module.c b/stand/boot/pc32/libi386/i386_module.c
similarity index 100%
rename from sys/boot/pc32/libi386/i386_module.c
rename to stand/boot/pc32/libi386/i386_module.c
diff --git a/sys/boot/pc32/libi386/libi386.h b/stand/boot/pc32/libi386/libi386.h
similarity index 100%
rename from sys/boot/pc32/libi386/libi386.h
rename to stand/boot/pc32/libi386/libi386.h
diff --git a/sys/boot/pc32/libi386/nullconsole.c b/stand/boot/pc32/libi386/nullconsole.c
similarity index 100%
rename from sys/boot/pc32/libi386/nullconsole.c
rename to stand/boot/pc32/libi386/nullconsole.c
diff --git a/sys/boot/pc32/libi386/pxe.c b/stand/boot/pc32/libi386/pxe.c
similarity index 99%
rename from sys/boot/pc32/libi386/pxe.c
rename to stand/boot/pc32/libi386/pxe.c
index 243d7040f0..7c01b247d9 100644
--- a/sys/boot/pc32/libi386/pxe.c
+++ b/stand/boot/pc32/libi386/pxe.c
@@ -413,7 +413,7 @@ pxe_perror(int err)
 	return;
 }
 
-/* To prevent LTO warnings. Must match libstand/nfs.c struct. */
+/* To prevent LTO warnings. Must match stand/lib/nfs.c struct. */
 struct nfsv2_fattrs {
 	n_long	fa_type;
 	n_long	fa_mode;
diff --git a/sys/boot/pc32/libi386/pxe.h b/stand/boot/pc32/libi386/pxe.h
similarity index 100%
rename from sys/boot/pc32/libi386/pxe.h
rename to stand/boot/pc32/libi386/pxe.h
diff --git a/sys/boot/pc32/libi386/pxetramp.s b/stand/boot/pc32/libi386/pxetramp.s
similarity index 100%
rename from sys/boot/pc32/libi386/pxetramp.s
rename to stand/boot/pc32/libi386/pxetramp.s
diff --git a/sys/boot/pc32/libi386/smbios.c b/stand/boot/pc32/libi386/smbios.c
similarity index 100%
rename from sys/boot/pc32/libi386/smbios.c
rename to stand/boot/pc32/libi386/smbios.c
diff --git a/sys/boot/pc32/libi386/smbios.h b/stand/boot/pc32/libi386/smbios.h
similarity index 100%
rename from sys/boot/pc32/libi386/smbios.h
rename to stand/boot/pc32/libi386/smbios.h
diff --git a/sys/boot/pc32/libi386/time.c b/stand/boot/pc32/libi386/time.c
similarity index 100%
rename from sys/boot/pc32/libi386/time.c
rename to stand/boot/pc32/libi386/time.c
diff --git a/sys/boot/pc32/libi386/vidconsole.c b/stand/boot/pc32/libi386/vidconsole.c
similarity index 100%
rename from sys/boot/pc32/libi386/vidconsole.c
rename to stand/boot/pc32/libi386/vidconsole.c
diff --git a/sys/boot/pc32/libi386/x86_64_tramp.S b/stand/boot/pc32/libi386/x86_64_tramp.S
similarity index 100%
rename from sys/boot/pc32/libi386/x86_64_tramp.S
rename to stand/boot/pc32/libi386/x86_64_tramp.S
diff --git a/sys/boot/pc32/loader/Makefile b/stand/boot/pc32/loader/Makefile
similarity index 98%
rename from sys/boot/pc32/loader/Makefile
rename to stand/boot/pc32/loader/Makefile
index 2db65b3bbc..3ca20800d1 100644
--- a/sys/boot/pc32/loader/Makefile
+++ b/stand/boot/pc32/loader/Makefile
@@ -62,7 +62,7 @@ LIBSTAND=	${.CURDIR}/../../libstand32/libstand32.a
 .if !exists(${LIBSTAND})
 LIBSTAND=	${.OBJDIR}/../../libstand32/libstand32.a
 .endif
-CFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=	-I${.CURDIR}/../../../lib
 
 # BTX components
 .if exists(${.OBJDIR}/../btx)
diff --git a/sys/boot/pc32/loader/conf.c b/stand/boot/pc32/loader/conf.c
similarity index 100%
rename from sys/boot/pc32/loader/conf.c
rename to stand/boot/pc32/loader/conf.c
diff --git a/sys/boot/pc32/loader/dloader.rc b/stand/boot/pc32/loader/dloader.rc
similarity index 100%
rename from sys/boot/pc32/loader/dloader.rc
rename to stand/boot/pc32/loader/dloader.rc
diff --git a/sys/boot/pc32/loader/help.i386 b/stand/boot/pc32/loader/help.i386
similarity index 100%
rename from sys/boot/pc32/loader/help.i386
rename to stand/boot/pc32/loader/help.i386
diff --git a/sys/boot/pc32/loader/loader.ldscript b/stand/boot/pc32/loader/loader.ldscript
similarity index 100%
rename from sys/boot/pc32/loader/loader.ldscript
rename to stand/boot/pc32/loader/loader.ldscript
diff --git a/sys/boot/pc32/loader/main.c b/stand/boot/pc32/loader/main.c
similarity index 100%
rename from sys/boot/pc32/loader/main.c
rename to stand/boot/pc32/loader/main.c
diff --git a/sys/boot/pc32/loader/version b/stand/boot/pc32/loader/version
similarity index 100%
rename from sys/boot/pc32/loader/version
rename to stand/boot/pc32/loader/version
diff --git a/sys/boot/pc32/loader_tftp/Makefile b/stand/boot/pc32/loader_tftp/Makefile
similarity index 98%
rename from sys/boot/pc32/loader_tftp/Makefile
rename to stand/boot/pc32/loader_tftp/Makefile
index d293da7513..6761fc7e95 100644
--- a/sys/boot/pc32/loader_tftp/Makefile
+++ b/stand/boot/pc32/loader_tftp/Makefile
@@ -62,7 +62,7 @@ LIBSTAND=	${.CURDIR}/../../libstand32/libstand32.a
 .if !exists(${LIBSTAND})
 LIBSTAND=	${.OBJDIR}/../../libstand32/libstand32.a
 .endif
-CFLAGS+=	-I${.CURDIR}/../../../../lib/libstand/
+CFLAGS+=	-I${.CURDIR}/../../../lib
 
 # BTX components
 .if exists(${.OBJDIR}/../btx)
diff --git a/sys/boot/pc32/loader_tftp/version b/stand/boot/pc32/loader_tftp/version
similarity index 100%
rename from sys/boot/pc32/loader_tftp/version
rename to stand/boot/pc32/loader_tftp/version
diff --git a/sys/boot/pc32/mbr/Makefile b/stand/boot/pc32/mbr/Makefile
similarity index 100%
rename from sys/boot/pc32/mbr/Makefile
rename to stand/boot/pc32/mbr/Makefile
diff --git a/sys/boot/pc32/mbr/mbr.S b/stand/boot/pc32/mbr/mbr.S
similarity index 100%
rename from sys/boot/pc32/mbr/mbr.S
rename to stand/boot/pc32/mbr/mbr.S
diff --git a/sys/boot/pc32/pxeldr/Makefile b/stand/boot/pc32/pxeldr/Makefile
similarity index 100%
rename from sys/boot/pc32/pxeldr/Makefile
rename to stand/boot/pc32/pxeldr/Makefile
diff --git a/sys/boot/pc32/pxeldr/pxeboot.8 b/stand/boot/pc32/pxeldr/pxeboot.8
similarity index 100%
rename from sys/boot/pc32/pxeldr/pxeboot.8
rename to stand/boot/pc32/pxeldr/pxeboot.8
diff --git a/sys/boot/pc32/pxeldr/pxeldr.S b/stand/boot/pc32/pxeldr/pxeldr.S
similarity index 100%
rename from sys/boot/pc32/pxeldr/pxeldr.S
rename to stand/boot/pc32/pxeldr/pxeldr.S
diff --git a/sys/boot/pc32/pxeldr_tftp/Makefile b/stand/boot/pc32/pxeldr_tftp/Makefile
similarity index 100%
rename from sys/boot/pc32/pxeldr_tftp/Makefile
rename to stand/boot/pc32/pxeldr_tftp/Makefile
diff --git a/sys/boot/pc32/pxeldr_tftp/pxeboot_tftp.8 b/stand/boot/pc32/pxeldr_tftp/pxeboot_tftp.8
similarity index 100%
rename from sys/boot/pc32/pxeldr_tftp/pxeboot_tftp.8
rename to stand/boot/pc32/pxeldr_tftp/pxeboot_tftp.8
diff --git a/sys/boot/pc64/Makefile.inc b/stand/boot/pc64/Makefile.inc
similarity index 100%
rename from sys/boot/pc64/Makefile.inc
rename to stand/boot/pc64/Makefile.inc
diff --git a/lib/libstand/Makefile b/stand/lib/Makefile
similarity index 94%
rename from lib/libstand/Makefile
rename to stand/lib/Makefile
index 90ae9ee82d..8e79bd679e 100644
--- a/lib/libstand/Makefile
+++ b/stand/lib/Makefile
@@ -8,7 +8,6 @@
 #
 
 LIB?=		stand
-NOPROFILE=	YES
 NOPIC=		YES
 INCS?=		stand.h
 MAN?=		libstand.3
@@ -18,7 +17,7 @@ NO_STRICT_ALIASING=
 
 LIBSTAND_SRC?=	${.CURDIR}
 LIBSTAND_ARCH?=	${MACHINE_ARCH}
-LIBC_SRC=	${LIBSTAND_SRC}/../libc
+LIBC_SRC=	${LIBSTAND_SRC}/../../lib/libc
 
 CFLAGS+=	-D_STANDALONE
 
@@ -58,7 +57,7 @@ SRCS+=	__main.c assert.c bcd.c bswap.c environment.c getopt.c gets.c \
 SRCS+=	strcasecmp.c
 
 # string functions from libc
-.PATH:	${LIBSTAND_SRC}/../libc/string
+.PATH:	${LIBSTAND_SRC}/../../lib/libc/string
 .if ${LIBSTAND_ARCH} == "x86_64" || ${LIBSTAND_ARCH} == "i386"
 SRCS+=	bcmp.c bcopy.c bzero.c ffs.c index.c memccpy.c memchr.c memcmp.c \
         memcpy.c memmove.c memset.c qdivrem.c rindex.c strcat.c strchr.c \
@@ -74,13 +73,13 @@ qdivrem.o:	qdivrem.c
 .PATH:	${LIBSTAND_SRC}/${LIBSTAND_ARCH}
 .if ${LIBSTAND_ARCH} == "x86_64" || ${LIBSTAND_ARCH} == "i386"
 # really only required for i386
-CFLAGS+=-I${LIBSTAND_SRC}/../libc/${MACHINE_ARCH}
+CFLAGS+=-I${LIBSTAND_SRC}/../../lib/libc/${MACHINE_ARCH}
 .endif
 SRCS+=	_setjmp.S
 
 # decompression functionality from libz
 # NOTE: crc32.c is used from libz and not libkern
-.include "../libz/Makefile.stand"
+.include "../../lib/libz/Makefile.stand"
 
 # iscsi_crc32() for hammer2
 .PATH:	${LIBSTAND_SRC}/../../sys/libkern
diff --git a/lib/libstand/__main.c b/stand/lib/__main.c
similarity index 100%
rename from lib/libstand/__main.c
rename to stand/lib/__main.c
diff --git a/lib/libstand/arp.c b/stand/lib/arp.c
similarity index 100%
rename from lib/libstand/arp.c
rename to stand/lib/arp.c
diff --git a/lib/libstand/assert.c b/stand/lib/assert.c
similarity index 100%
rename from lib/libstand/assert.c
rename to stand/lib/assert.c
diff --git a/lib/libstand/bcd.c b/stand/lib/bcd.c
similarity index 100%
rename from lib/libstand/bcd.c
rename to stand/lib/bcd.c
diff --git a/lib/libstand/bootp.c b/stand/lib/bootp.c
similarity index 100%
rename from lib/libstand/bootp.c
rename to stand/lib/bootp.c
diff --git a/lib/libstand/bootp.h b/stand/lib/bootp.h
similarity index 100%
rename from lib/libstand/bootp.h
rename to stand/lib/bootp.h
diff --git a/lib/libstand/bootparam.c b/stand/lib/bootparam.c
similarity index 100%
rename from lib/libstand/bootparam.c
rename to stand/lib/bootparam.c
diff --git a/lib/libstand/bootparam.h b/stand/lib/bootparam.h
similarity index 100%
rename from lib/libstand/bootparam.h
rename to stand/lib/bootparam.h
diff --git a/lib/libstand/bswap.c b/stand/lib/bswap.c
similarity index 100%
rename from lib/libstand/bswap.c
rename to stand/lib/bswap.c
diff --git a/lib/libstand/bzipfs.c b/stand/lib/bzipfs.c
similarity index 100%
rename from lib/libstand/bzipfs.c
rename to stand/lib/bzipfs.c
diff --git a/lib/libstand/cd9660.c b/stand/lib/cd9660.c
similarity index 100%
rename from lib/libstand/cd9660.c
rename to stand/lib/cd9660.c
diff --git a/lib/libstand/close.c b/stand/lib/close.c
similarity index 100%
rename from lib/libstand/close.c
rename to stand/lib/close.c
diff --git a/lib/libstand/closeall.c b/stand/lib/closeall.c
similarity index 100%
rename from lib/libstand/closeall.c
rename to stand/lib/closeall.c
diff --git a/lib/libstand/dev.c b/stand/lib/dev.c
similarity index 100%
rename from lib/libstand/dev.c
rename to stand/lib/dev.c
diff --git a/lib/libstand/dosfs.c b/stand/lib/dosfs.c
similarity index 100%
rename from lib/libstand/dosfs.c
rename to stand/lib/dosfs.c
diff --git a/lib/libstand/dosfs.h b/stand/lib/dosfs.h
similarity index 100%
rename from lib/libstand/dosfs.h
rename to stand/lib/dosfs.h
diff --git a/lib/libstand/environment.c b/stand/lib/environment.c
similarity index 100%
rename from lib/libstand/environment.c
rename to stand/lib/environment.c
diff --git a/lib/libstand/ether.c b/stand/lib/ether.c
similarity index 100%
rename from lib/libstand/ether.c
rename to stand/lib/ether.c
diff --git a/lib/libstand/ext2fs.c b/stand/lib/ext2fs.c
similarity index 100%
rename from lib/libstand/ext2fs.c
rename to stand/lib/ext2fs.c
diff --git a/lib/libstand/fstat.c b/stand/lib/fstat.c
similarity index 100%
rename from lib/libstand/fstat.c
rename to stand/lib/fstat.c
diff --git a/lib/libstand/getopt.c b/stand/lib/getopt.c
similarity index 100%
rename from lib/libstand/getopt.c
rename to stand/lib/getopt.c
diff --git a/lib/libstand/gets.c b/stand/lib/gets.c
similarity index 100%
rename from lib/libstand/gets.c
rename to stand/lib/gets.c
diff --git a/lib/libstand/globals.c b/stand/lib/globals.c
similarity index 100%
rename from lib/libstand/globals.c
rename to stand/lib/globals.c
diff --git a/lib/libstand/gzipfs.c b/stand/lib/gzipfs.c
similarity index 100%
rename from lib/libstand/gzipfs.c
rename to stand/lib/gzipfs.c
diff --git a/lib/libstand/hammer1.c b/stand/lib/hammer1.c
similarity index 100%
rename from lib/libstand/hammer1.c
rename to stand/lib/hammer1.c
diff --git a/lib/libstand/hammer2.c b/stand/lib/hammer2.c
similarity index 100%
rename from lib/libstand/hammer2.c
rename to stand/lib/hammer2.c
diff --git a/lib/libstand/i386/_setjmp.S b/stand/lib/i386/_setjmp.S
similarity index 100%
rename from lib/libstand/i386/_setjmp.S
rename to stand/lib/i386/_setjmp.S
diff --git a/lib/libstand/if_ether.h b/stand/lib/if_ether.h
similarity index 100%
rename from lib/libstand/if_ether.h
rename to stand/lib/if_ether.h
diff --git a/lib/libstand/in_cksum.c b/stand/lib/in_cksum.c
similarity index 100%
rename from lib/libstand/in_cksum.c
rename to stand/lib/in_cksum.c
diff --git a/lib/libstand/inet_ntoa.c b/stand/lib/inet_ntoa.c
similarity index 100%
rename from lib/libstand/inet_ntoa.c
rename to stand/lib/inet_ntoa.c
diff --git a/lib/libstand/ioctl.c b/stand/lib/ioctl.c
similarity index 100%
rename from lib/libstand/ioctl.c
rename to stand/lib/ioctl.c
diff --git a/lib/libstand/iodesc.h b/stand/lib/iodesc.h
similarity index 100%
rename from lib/libstand/iodesc.h
rename to stand/lib/iodesc.h
diff --git a/lib/libstand/libstand.3 b/stand/lib/libstand.3
similarity index 100%
rename from lib/libstand/libstand.3
rename to stand/lib/libstand.3
diff --git a/lib/libstand/lseek.c b/stand/lib/lseek.c
similarity index 100%
rename from lib/libstand/lseek.c
rename to stand/lib/lseek.c
diff --git a/lib/libstand/net.c b/stand/lib/net.c
similarity index 100%
rename from lib/libstand/net.c
rename to stand/lib/net.c
diff --git a/lib/libstand/net.h b/stand/lib/net.h
similarity index 100%
rename from lib/libstand/net.h
rename to stand/lib/net.h
diff --git a/lib/libstand/netif.c b/stand/lib/netif.c
similarity index 100%
rename from lib/libstand/netif.c
rename to stand/lib/netif.c
diff --git a/lib/libstand/netif.h b/stand/lib/netif.h
similarity index 100%
rename from lib/libstand/netif.h
rename to stand/lib/netif.h
diff --git a/lib/libstand/nfs.c b/stand/lib/nfs.c
similarity index 100%
rename from lib/libstand/nfs.c
rename to stand/lib/nfs.c
diff --git a/lib/libstand/nfsv2.h b/stand/lib/nfsv2.h
similarity index 100%
rename from lib/libstand/nfsv2.h
rename to stand/lib/nfsv2.h
diff --git a/lib/libstand/nullfs.c b/stand/lib/nullfs.c
similarity index 100%
rename from lib/libstand/nullfs.c
rename to stand/lib/nullfs.c
diff --git a/lib/libstand/open.c b/stand/lib/open.c
similarity index 100%
rename from lib/libstand/open.c
rename to stand/lib/open.c
diff --git a/lib/libstand/pager.c b/stand/lib/pager.c
similarity index 100%
rename from lib/libstand/pager.c
rename to stand/lib/pager.c
diff --git a/lib/libstand/printf.c b/stand/lib/printf.c
similarity index 100%
rename from lib/libstand/printf.c
rename to stand/lib/printf.c
diff --git a/lib/libstand/qdivrem.c b/stand/lib/qdivrem.c
similarity index 100%
rename from lib/libstand/qdivrem.c
rename to stand/lib/qdivrem.c
diff --git a/lib/libstand/quad.h b/stand/lib/quad.h
similarity index 100%
rename from lib/libstand/quad.h
rename to stand/lib/quad.h
diff --git a/lib/libstand/random.c b/stand/lib/random.c
similarity index 100%
rename from lib/libstand/random.c
rename to stand/lib/random.c
diff --git a/lib/libstand/rarp.c b/stand/lib/rarp.c
similarity index 100%
rename from lib/libstand/rarp.c
rename to stand/lib/rarp.c
diff --git a/lib/libstand/read.c b/stand/lib/read.c
similarity index 100%
rename from lib/libstand/read.c
rename to stand/lib/read.c
diff --git a/lib/libstand/readdir.c b/stand/lib/readdir.c
similarity index 100%
rename from lib/libstand/readdir.c
rename to stand/lib/readdir.c
diff --git a/lib/libstand/rpc.c b/stand/lib/rpc.c
similarity index 100%
rename from lib/libstand/rpc.c
rename to stand/lib/rpc.c
diff --git a/lib/libstand/rpc.h b/stand/lib/rpc.h
similarity index 100%
rename from lib/libstand/rpc.h
rename to stand/lib/rpc.h
diff --git a/lib/libstand/rpcv2.h b/stand/lib/rpcv2.h
similarity index 100%
rename from lib/libstand/rpcv2.h
rename to stand/lib/rpcv2.h
diff --git a/lib/libstand/sbrk.c b/stand/lib/sbrk.c
similarity index 100%
rename from lib/libstand/sbrk.c
rename to stand/lib/sbrk.c
diff --git a/lib/libstand/splitfs.c b/stand/lib/splitfs.c
similarity index 100%
rename from lib/libstand/splitfs.c
rename to stand/lib/splitfs.c
diff --git a/lib/libstand/stand.h b/stand/lib/stand.h
similarity index 100%
rename from lib/libstand/stand.h
rename to stand/lib/stand.h
diff --git a/lib/libstand/stat.c b/stand/lib/stat.c
similarity index 100%
rename from lib/libstand/stat.c
rename to stand/lib/stat.c
diff --git a/lib/libstand/strcasecmp.c b/stand/lib/strcasecmp.c
similarity index 100%
rename from lib/libstand/strcasecmp.c
rename to stand/lib/strcasecmp.c
diff --git a/lib/libstand/strdup.c b/stand/lib/strdup.c
similarity index 100%
rename from lib/libstand/strdup.c
rename to stand/lib/strdup.c
diff --git a/lib/libstand/strerror.c b/stand/lib/strerror.c
similarity index 100%
rename from lib/libstand/strerror.c
rename to stand/lib/strerror.c
diff --git a/lib/libstand/strtol.c b/stand/lib/strtol.c
similarity index 100%
rename from lib/libstand/strtol.c
rename to stand/lib/strtol.c
diff --git a/lib/libstand/strtoul.c b/stand/lib/strtoul.c
similarity index 100%
rename from lib/libstand/strtoul.c
rename to stand/lib/strtoul.c
diff --git a/lib/libstand/tftp.c b/stand/lib/tftp.c
similarity index 100%
rename from lib/libstand/tftp.c
rename to stand/lib/tftp.c
diff --git a/lib/libstand/tftp.h b/stand/lib/tftp.h
similarity index 100%
rename from lib/libstand/tftp.h
rename to stand/lib/tftp.h
diff --git a/lib/libstand/twiddle.c b/stand/lib/twiddle.c
similarity index 100%
rename from lib/libstand/twiddle.c
rename to stand/lib/twiddle.c
diff --git a/lib/libstand/udp.c b/stand/lib/udp.c
similarity index 100%
rename from lib/libstand/udp.c
rename to stand/lib/udp.c
diff --git a/lib/libstand/ufs.c b/stand/lib/ufs.c
similarity index 100%
rename from lib/libstand/ufs.c
rename to stand/lib/ufs.c
diff --git a/lib/libstand/uuid_from_string.c b/stand/lib/uuid_from_string.c
similarity index 100%
rename from lib/libstand/uuid_from_string.c
rename to stand/lib/uuid_from_string.c
diff --git a/lib/libstand/uuid_to_string.c b/stand/lib/uuid_to_string.c
similarity index 100%
rename from lib/libstand/uuid_to_string.c
rename to stand/lib/uuid_to_string.c
diff --git a/lib/libstand/write.c b/stand/lib/write.c
similarity index 100%
rename from lib/libstand/write.c
rename to stand/lib/write.c
diff --git a/lib/libstand/x86_64/_setjmp.S b/stand/lib/x86_64/_setjmp.S
similarity index 100%
rename from lib/libstand/x86_64/_setjmp.S
rename to stand/lib/x86_64/_setjmp.S
diff --git a/lib/libstand/zalloc.c b/stand/lib/zalloc.c
similarity index 100%
rename from lib/libstand/zalloc.c
rename to stand/lib/zalloc.c
diff --git a/lib/libstand/zalloc_defs.h b/stand/lib/zalloc_defs.h
similarity index 100%
rename from lib/libstand/zalloc_defs.h
rename to stand/lib/zalloc_defs.h
diff --git a/lib/libstand/zalloc_malloc.c b/stand/lib/zalloc_malloc.c
similarity index 100%
rename from lib/libstand/zalloc_malloc.c
rename to stand/lib/zalloc_malloc.c
diff --git a/lib/libstand/zalloc_mem.h b/stand/lib/zalloc_mem.h
similarity index 100%
rename from lib/libstand/zalloc_mem.h
rename to stand/lib/zalloc_mem.h
diff --git a/lib/libstand/zalloc_protos.h b/stand/lib/zalloc_protos.h
similarity index 100%
rename from lib/libstand/zalloc_protos.h
rename to stand/lib/zalloc_protos.h
diff --git a/sys/Makefile b/sys/Makefile
index f0bb239cdd..0b78ddf77f 100644
--- a/sys/Makefile
+++ b/sys/Makefile
@@ -1,10 +1,5 @@
 # $FreeBSD: src/sys/Makefile,v 1.20.2.1 2000/07/10 08:22:34 obrien Exp $
 
-# The boot loader
-.if	exists(${.CURDIR}/boot)
-SUBDIR=	boot
-.endif
-
 # Loadable kernel modules
 #
 .if defined(MODULES_WITH_WORLD)
diff --git a/sys/libkern/stack_protector.c b/sys/libkern/stack_protector.c
index ada08b1b87..4c221b7187 100644
--- a/sys/libkern/stack_protector.c
+++ b/sys/libkern/stack_protector.c
@@ -41,7 +41,7 @@ int __guard = 0xff0a0000;
 void 
 __stack_smash_handler(char func[], int damaged)
 {
-#ifdef __i386__ /* used in sys/boot */
+#ifdef __i386__ /* used in stand/boot */
 	void *caller;
 	__asm __volatile("movl 4(%%ebp), %0" : "=r" (caller));
 	panic("stack overflow in function %p (%s)", caller, func);
diff --git a/sys/sys/disklabel32.h b/sys/sys/disklabel32.h
index 49e452c1d9..efd5793f6f 100644
--- a/sys/sys/disklabel32.h
+++ b/sys/sys/disklabel32.h
@@ -28,7 +28,6 @@
  *
  *	@(#)disklabel.h	8.2 (Berkeley) 7/10/94
  * $FreeBSD: src/sys/sys/disklabel.h,v 1.49.2.7 2001/05/27 05:58:26 jkh Exp $
- * $DragonFly: src/sys/sys/disklabel32.h,v 1.28 2007/08/21 20:04:09 corecode Exp $
  */
 
 #ifndef _SYS_DISKLABEL32_H_
@@ -52,7 +51,7 @@
  */
 
 /* XXX these should be defined per controller (or drive) elsewhere, not here! */
-#if defined(__i386__) /* used in sys/boot */ || defined(__x86_64__) 
+#if defined(__i386__) /* used in stand/boot */ || defined(__x86_64__) 
 #define LABELSECTOR32	1			/* sector containing label */
 #define LABELOFFSET32	0			/* offset of label in sector */
 #endif
diff --git a/sys/sys/imgact_aout.h b/sys/sys/imgact_aout.h
index 6bb95ac3a1..17448a9140 100644
--- a/sys/sys/imgact_aout.h
+++ b/sys/sys/imgact_aout.h
@@ -28,7 +28,6 @@
  *
  *	from: @(#)exec.h	8.1 (Berkeley) 6/11/93
  * $FreeBSD: src/sys/sys/imgact_aout.h,v 1.13 1999/12/29 04:24:41 peter Exp $
- * $DragonFly: src/sys/sys/imgact_aout.h,v 1.6 2007/02/03 09:56:04 y0netan1 Exp $
  */
 
 #ifndef	_IMGACT_AOUT_H_
@@ -111,7 +110,7 @@
  * only manipulate the a_midmag field via the
  * N_SETMAGIC/N_GET{MAGIC,MID,FLAG} macros in a.out.h
  *
- * AOUT_H_FORCE32 is used by btxld and sys/boot when compiling
+ * AOUT_H_FORCE32 is used by btxld and stand/boot when compiling
  * from a 64 bit environment to generate a 32 bit a.out.h header.
  */
 
diff --git a/usr.sbin/efibootmgr/Makefile b/usr.sbin/efibootmgr/Makefile
index 8254f73a15..6124a77a25 100644
--- a/usr.sbin/efibootmgr/Makefile
+++ b/usr.sbin/efibootmgr/Makefile
@@ -1,6 +1,6 @@
 # $FreeBSD: head/usr.sbin/efibootmgr/Makefile 326725 2017-12-09 06:52:20Z imp $
-EFIBOOT=${.CURDIR}/../../sys/boot/efi
-EFIINCL=${.CURDIR}/../../sys/boot/efi/include
+EFIBOOT=${.CURDIR}/../../stand/boot/efi
+EFIINCL=${.CURDIR}/../../stand/boot/efi/include
 EFIVAR=${.CURDIR}/../efivar
 .PATH: ${EFIBOOT}/libefi ${EFIVAR}
 CFLAGS+= -I${EFIVAR} -I${EFIINCL}
-- 
2.28.0

