Page MenuHomeFreeBSD

D5038.id12670.diff
No OneTemporary

D5038.id12670.diff

Index: sys/boot/arm/at91/boot2/boot2.c
===================================================================
--- sys/boot/arm/at91/boot2/boot2.c
+++ sys/boot/arm/at91/boot2/boot2.c
@@ -1,6 +1,6 @@
/*-
* Copyright (c) 2008 John Hay
- * Copyright (c) 2006 Warner Losh
+ * Copyright (c) 2006 M Warner Losh <imp@freebsd.org>
* Copyright (c) 1998 Robert Nordier
* All rights reserved.
*
@@ -30,52 +30,16 @@
#include "lib.h"
#include "board.h"
+#include "paths.h"
+#include "rbx.h"
-#define RBX_ASKNAME 0x0 /* -a */
-#define RBX_SINGLE 0x1 /* -s */
-/* 0x2 is reserved for log2(RB_NOSYNC). */
-/* 0x3 is reserved for log2(RB_HALT). */
-/* 0x4 is reserved for log2(RB_INITNAME). */
-#define RBX_DFLTROOT 0x5 /* -r */
-/* #define RBX_KDB 0x6 -d */
-/* 0x7 is reserved for log2(RB_RDONLY). */
-/* 0x8 is reserved for log2(RB_DUMP). */
-/* 0x9 is reserved for log2(RB_MINIROOT). */
-#define RBX_CONFIG 0xa /* -c */
-#define RBX_VERBOSE 0xb /* -v */
-/* #define RBX_SERIAL 0xc -h */
-/* #define RBX_CDROM 0xd -C */
-/* 0xe is reserved for log2(RB_POWEROFF). */
-#define RBX_GDB 0xf /* -g */
-/* #define RBX_MUTE 0x10 -m */
-/* 0x11 is reserved for log2(RB_SELFTEST). */
-/* 0x12 is reserved for boot programs. */
-/* 0x13 is reserved for boot programs. */
-/* #define RBX_PAUSE 0x14 -p */
-/* #define RBX_QUIET 0x15 -q */
-#define RBX_NOINTR 0x1c /* -n */
-/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */
-/* #define RBX_DUAL 0x1d -D */
-/* 0x1f is reserved for log2(RB_BOOTINFO). */
-
-/* pass: -a, -s, -r, -v, -g */
-#define RBX_MASK (OPT_SET(RBX_ASKNAME) | OPT_SET(RBX_SINGLE) | \
- OPT_SET(RBX_DFLTROOT) | \
- OPT_SET(RBX_VERBOSE) | \
- OPT_SET(RBX_GDB))
-
-#define PATH_DOTCONFIG "/boot.config"
-#define PATH_CONFIG "/boot/config"
-//#define PATH_KERNEL "/boot/kernel/kernel"
+#undef PATH_KERNEL
#define PATH_KERNEL "/boot/kernel/kernel.gz.tramp"
extern uint32_t _end;
#define NOPT 6
-#define OPT_SET(opt) (1 << (opt))
-#define OPT_CHECK(opt) ((opts) & OPT_SET(opt))
-
static const char optstr[NOPT] = "agnrsv";
static const unsigned char bootflags[NOPT] = {
RBX_ASKNAME,
Index: sys/boot/arm/ixp425/boot2/boot2.c
===================================================================
--- sys/boot/arm/ixp425/boot2/boot2.c
+++ sys/boot/arm/ixp425/boot2/boot2.c
@@ -28,51 +28,13 @@
#include <stdarg.h>
#include "lib.h"
-
-#define RBX_ASKNAME 0x0 /* -a */
-#define RBX_SINGLE 0x1 /* -s */
-/* 0x2 is reserved for log2(RB_NOSYNC). */
-/* 0x3 is reserved for log2(RB_HALT). */
-/* 0x4 is reserved for log2(RB_INITNAME). */
-#define RBX_DFLTROOT 0x5 /* -r */
-/* #define RBX_KDB 0x6 -d */
-/* 0x7 is reserved for log2(RB_RDONLY). */
-/* 0x8 is reserved for log2(RB_DUMP). */
-/* 0x9 is reserved for log2(RB_MINIROOT). */
-#define RBX_CONFIG 0xa /* -c */
-#define RBX_VERBOSE 0xb /* -v */
-/* #define RBX_SERIAL 0xc -h */
-/* #define RBX_CDROM 0xd -C */
-/* 0xe is reserved for log2(RB_POWEROFF). */
-#define RBX_GDB 0xf /* -g */
-/* #define RBX_MUTE 0x10 -m */
-/* 0x11 is reserved for log2(RB_SELFTEST). */
-/* 0x12 is reserved for boot programs. */
-/* 0x13 is reserved for boot programs. */
-/* #define RBX_PAUSE 0x14 -p */
-/* #define RBX_QUIET 0x15 -q */
-#define RBX_NOINTR 0x1c /* -n */
-/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */
-/* #define RBX_DUAL 0x1d -D */
-/* 0x1f is reserved for log2(RB_BOOTINFO). */
-
-/* pass: -a, -s, -r, -v, -g */
-#define RBX_MASK (OPT_SET(RBX_ASKNAME) | OPT_SET(RBX_SINGLE) | \
- OPT_SET(RBX_DFLTROOT) | \
- OPT_SET(RBX_VERBOSE) | \
- OPT_SET(RBX_GDB))
-
-#define PATH_DOTCONFIG "/boot.config"
-#define PATH_CONFIG "/boot/config"
-#define PATH_KERNEL "/boot/kernel/kernel"
+#include "paths.h"
+#include "rbx.h"
extern uint32_t _end;
#define NOPT 6
-#define OPT_SET(opt) (1 << (opt))
-#define OPT_CHECK(opt) ((opts) & OPT_SET(opt))
-
static const char optstr[NOPT] = "agnrsv";
static const unsigned char flags[NOPT] = {
RBX_ASKNAME,
Index: sys/boot/common/paths.h
===================================================================
--- /dev/null
+++ sys/boot/common/paths.h
@@ -0,0 +1,39 @@
+/*-
+ * Copyright (c) 2016 M. Warner Losh <imp@freebsd.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _PATHS_H_
+#define _PATHS_H_
+
+#define PATH_DOTCONFIG "/boot.config"
+#define PATH_CONFIG "/boot/config"
+#define PATH_BOOT3 "/boot/loader"
+#define PATH_LOADER "/boot/loader"
+#define PATH_LOADER_EFI "/boot/loader.efi"
+#define PATH_KERNEL "/boot/kernel/kernel"
+
+#endif /* _PATHS_H_ */
Index: sys/boot/efi/boot1/boot1.c
===================================================================
--- sys/boot/efi/boot1/boot1.c
+++ sys/boot/efi/boot1/boot1.c
@@ -31,8 +31,7 @@
#include <eficonsctl.h>
#include "boot_module.h"
-
-#define _PATH_LOADER "/boot/loader.efi"
+#include "paths.h"
static const boot_module_t *boot_modules[] =
{
@@ -92,20 +91,47 @@
void
try_load(const boot_module_t *mod)
{
- size_t bufsize;
+ size_t bufsize, cmdsize;
void *buf;
+ char *cmd;
dev_info_t *dev;
EFI_HANDLE loaderhandle;
EFI_LOADED_IMAGE *loaded_image;
EFI_STATUS status;
- status = mod->load(_PATH_LOADER, &dev, &buf, &bufsize);
+ /*
+ * Read in and parse the command line from /boot.config or /boot/config,
+ * if present. We'll pass it the next stage via a simple ASCII
+ * string. loader.efi has a hack for ASCII strings, so we'll use that to
+ * keep the size down here. We only try to read the alternate file if
+ * we get EFI_NOT_FOUND because all other errors mean that the boot_module
+ * had troubles with the filesystem. We could return early, but we'll let
+ * loading the actual kernel sort all that out. Since these files are
+ * optional, we don't report errors in trying to read them.
+ */
+ cmd = NULL;
+ cmdsize = 0;
+ status = mod->load(PATH_DOTCONFIG, &dev, &buf, &bufsize);
+ if (status == EFI_NOT_FOUND)
+ status = mod->load(PATH_CONFIG, &dev, &buf, &bufsize);
+ if (status == EFI_SUCCESS) {
+ cmd = Malloc(bufsize + 1, "", 0);
+ if (cmd == NULL)
+ return;
+ cmdsize = bufsize + 1;
+ memcpy(cmd, buf, bufsize);
+ cmd[bufsize] = '\0';
+ printf(" command args: %s\n", cmd);
+ Free(buf, "", 0);
+ }
+
+ status = mod->load(PATH_LOADER_EFI, &dev, &buf, &bufsize);
if (status == EFI_NOT_FOUND)
return;
if (status != EFI_SUCCESS) {
- printf("%s failed to load %s (%lu)\n", mod->name, _PATH_LOADER,
- EFI_ERROR_CODE(status));
+ printf("%s failed to load %s (%lu)\n", mod->name,
+ PATH_LOADER_EFI, EFI_ERROR_CODE(status));
return;
}
@@ -124,6 +150,8 @@
}
loaded_image->DeviceHandle = dev->devhandle;
+ loaded_image->LoadOptionsSize = cmdsize;
+ loaded_image->LoadOptions = cmd;
if ((status = bs->StartImage(loaderhandle, NULL, NULL)) !=
EFI_SUCCESS) {
@@ -174,7 +202,7 @@
conout->ClearScreen(conout);
printf("\n>> FreeBSD EFI boot block\n");
- printf(" Loader path: %s\n\n", _PATH_LOADER);
+ printf(" Loader path: %s\n\n", PATH_LOADER_EFI);
printf(" Initializing modules:");
for (i = 0; i < NUM_BOOT_MODULES; i++) {
if (boot_modules[i] == NULL)
Index: sys/boot/efi/loader/main.c
===================================================================
--- sys/boot/efi/loader/main.c
+++ sys/boot/efi/loader/main.c
@@ -29,6 +29,8 @@
__FBSDID("$FreeBSD$");
#include <sys/param.h>
+#include <sys/reboot.h>
+#include <sys/boot.h>
#include <stand.h>
#include <string.h>
#include <setjmp.h>
@@ -83,13 +85,22 @@
printf("%c", (char)str[i]);
}
+static void
+cp16to8(const CHAR16 *src, char *dst, size_t len)
+{
+ size_t i;
+
+ for (i = 0; i < len && src[i]; i++)
+ dst[i] = (char)src[i];
+}
+
EFI_STATUS
main(int argc, CHAR16 *argv[])
{
char var[128];
EFI_LOADED_IMAGE *img;
EFI_GUID *guid;
- int i, j, vargood, unit;
+ int i, j, vargood, unit, howto;
struct devsw *dev;
uint64_t pool_guid;
UINTN k;
@@ -105,6 +116,92 @@
#endif
/*
+ * Parse the args to set the console settings, etc
+ * For the moment, only -D, -h and -S are parsed. boot1.efi
+ * passes these in, if it can read /boot.config or /boot/config
+ * or iPXE may be setup to pass these in.
+ *
+ * Loop through the args, and for each one that contains an '=' that is
+ * not the first character, add it to the environment. This allows
+ * loader and kernel env vars to be passed on the command line. Convert
+ * args from UCS-2 to ASCII (16 to 8 bit) as they are copied.
+ */
+ howto = 0;
+ for (i = 1; i < argc; i++) {
+ if (argv[i][0] == '-') {
+ for (j = 1; argv[i][j] != 0; j++) {
+ int ch;
+
+ ch = argv[i][j];
+ switch (ch) {
+ case 'a':
+ howto |= RB_ASKNAME;
+ break;
+ case 'd':
+ howto |= RB_KDB;
+ break;
+ case 'D':
+ howto |= RB_MULTIPLE;
+ break;
+ case 'm':
+ howto |= RB_MUTE;
+ break;
+ case 'h':
+ howto |= RB_SERIAL;
+ break;
+ case 'p':
+ howto |= RB_PAUSE;
+ break;
+ case 'r':
+ howto |= RB_DFLTROOT;
+ break;
+ case 's':
+ howto |= RB_SINGLE;
+ break;
+ case 'S':
+ if (argv[i][j + 1] == 0) {
+ if (i + 1 == argc) {
+ setenv("comspeed", "115200", 1);
+ } else {
+ cp16to8(&argv[i + 1][0], var,
+ sizeof(var));
+ setenv("comspeed", var, 1);
+ }
+ i++;
+ break;
+ } else {
+ cp16to8(&argv[i][j + 1], var,
+ sizeof(var));
+ setenv("comspeed", var, 1);
+ break;
+ }
+ case 'v':
+ howto |= RB_VERBOSE;
+ break;
+ }
+ }
+ } else {
+ vargood = 0;
+ for (j = 0; argv[i][j] != 0; j++) {
+ if (j == sizeof(var)) {
+ vargood = 0;
+ break;
+ }
+ if (j > 0 && argv[i][j] == '=')
+ vargood = 1;
+ var[j] = (char)argv[i][j];
+ }
+ if (vargood) {
+ var[j] = 0;
+ putenv(var);
+ }
+ }
+ }
+ for (i = 0; howto_names[i].ev != NULL; i++)
+ if (howto & howto_names[i].mask)
+ setenv(howto_names[i].ev, "YES", 1);
+
+ /*
* XXX Chicken-and-egg problem; we want to have console output
* early, but some console attributes may depend on reading from
* eg. the boot device, which we can't do yet. We can use
@@ -112,29 +209,6 @@
*/
cons_probe();
- /*
- * Loop through the args, and for each one that contains an '=' that is
- * not the first character, add it to the environment. This allows
- * loader and kernel env vars to be passed on the command line. Convert
- * args from UCS-2 to ASCII (16 to 8 bit) as they are copied.
- */
- for (i = 1; i < argc; i++) {
- vargood = 0;
- for (j = 0; argv[i][j] != 0; j++) {
- if (j == sizeof(var)) {
- vargood = 0;
- break;
- }
- if (j > 0 && argv[i][j] == '=')
- vargood = 1;
- var[j] = (char)argv[i][j];
- }
- if (vargood) {
- var[j] = 0;
- putenv(var);
- }
- }
-
if (efi_copy_init()) {
printf("failed to allocate staging area\n");
return (EFI_BUFFER_TOO_SMALL);
Index: sys/boot/i386/boot2/boot2.c
===================================================================
--- sys/boot/i386/boot2/boot2.c
+++ sys/boot/i386/boot2/boot2.c
@@ -33,6 +33,8 @@
#include "boot2.h"
#include "lib.h"
+#include "paths.h"
+#include "rbx.h"
/* Define to 0 to omit serial support */
#ifndef SERIAL
@@ -52,46 +54,6 @@
#define SECOND 18 /* Circa that many ticks in a second. */
-#define RBX_ASKNAME 0x0 /* -a */
-#define RBX_SINGLE 0x1 /* -s */
-/* 0x2 is reserved for log2(RB_NOSYNC). */
-/* 0x3 is reserved for log2(RB_HALT). */
-/* 0x4 is reserved for log2(RB_INITNAME). */
-#define RBX_DFLTROOT 0x5 /* -r */
-#define RBX_KDB 0x6 /* -d */
-/* 0x7 is reserved for log2(RB_RDONLY). */
-/* 0x8 is reserved for log2(RB_DUMP). */
-/* 0x9 is reserved for log2(RB_MINIROOT). */
-#define RBX_CONFIG 0xa /* -c */
-#define RBX_VERBOSE 0xb /* -v */
-#define RBX_SERIAL 0xc /* -h */
-#define RBX_CDROM 0xd /* -C */
-/* 0xe is reserved for log2(RB_POWEROFF). */
-#define RBX_GDB 0xf /* -g */
-#define RBX_MUTE 0x10 /* -m */
-/* 0x11 is reserved for log2(RB_SELFTEST). */
-/* 0x12 is reserved for boot programs. */
-/* 0x13 is reserved for boot programs. */
-#define RBX_PAUSE 0x14 /* -p */
-#define RBX_QUIET 0x15 /* -q */
-#define RBX_NOINTR 0x1c /* -n */
-/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */
-#define RBX_DUAL 0x1d /* -D */
-/* 0x1f is reserved for log2(RB_BOOTINFO). */
-
-/* pass: -a, -s, -r, -d, -c, -v, -h, -C, -g, -m, -p, -D */
-#define RBX_MASK (OPT_SET(RBX_ASKNAME) | OPT_SET(RBX_SINGLE) | \
- OPT_SET(RBX_DFLTROOT) | OPT_SET(RBX_KDB ) | \
- OPT_SET(RBX_CONFIG) | OPT_SET(RBX_VERBOSE) | \
- OPT_SET(RBX_SERIAL) | OPT_SET(RBX_CDROM) | \
- OPT_SET(RBX_GDB ) | OPT_SET(RBX_MUTE) | \
- OPT_SET(RBX_PAUSE) | OPT_SET(RBX_DUAL))
-
-#define PATH_DOTCONFIG "/boot.config"
-#define PATH_CONFIG "/boot/config"
-#define PATH_BOOT3 "/boot/loader"
-#define PATH_KERNEL "/boot/kernel/kernel"
-
#define ARGS 0x900
#define NOPT 14
#define NDEV 3
@@ -106,9 +68,6 @@
#define TYPE_MAXHARD TYPE_DA
#define TYPE_FD 2
-#define OPT_SET(opt) (1 << (opt))
-#define OPT_CHECK(opt) ((opts) & OPT_SET(opt))
-
extern uint32_t _end;
static const char optstr[NOPT] = "DhaCcdgmnpqrsv"; /* Also 'P', 'S' */
@@ -143,7 +102,7 @@
} dsk;
static char cmd[512], cmddup[512], knamebuf[1024];
static const char *kname;
-static uint32_t opts;
+uint32_t opts;
static struct bootinfo bootinfo;
#if SERIAL
static int comspeed = SIOSPD;
Index: sys/boot/i386/gptboot/gptboot.c
===================================================================
--- sys/boot/i386/gptboot/gptboot.c
+++ sys/boot/i386/gptboot/gptboot.c
@@ -37,11 +37,7 @@
#include "util.h"
#include "cons.h"
#include "gpt.h"
-
-#define PATH_DOTCONFIG "/boot.config"
-#define PATH_CONFIG "/boot/config"
-#define PATH_BOOT3 "/boot/loader"
-#define PATH_KERNEL "/boot/kernel/kernel"
+#include "paths.h"
#define ARGS 0x900
#define NOPT 14
Index: sys/boot/i386/zfsboot/zfsboot.c
===================================================================
--- sys/boot/i386/zfsboot/zfsboot.c
+++ sys/boot/i386/zfsboot/zfsboot.c
@@ -42,14 +42,10 @@
#include "util.h"
#include "cons.h"
#include "bootargs.h"
+#include "paths.h"
#include "libzfs.h"
-#define PATH_DOTCONFIG "/boot.config"
-#define PATH_CONFIG "/boot/config"
-#define PATH_BOOT3 "/boot/zfsloader"
-#define PATH_KERNEL "/boot/kernel/kernel"
-
#define ARGS 0x900
#define NOPT 14
#define NDEV 3
Index: sys/boot/mips/beri/boot2/boot2.c
===================================================================
--- sys/boot/mips/beri/boot2/boot2.c
+++ sys/boot/mips/beri/boot2/boot2.c
@@ -64,6 +64,9 @@
#include <mips.h>
#include <sdcard.h>
+#include "paths.h"
+#include "rbx.h"
+
static int beri_argc;
static const char **beri_argv, **beri_envv;
static uint64_t beri_memsize;
@@ -73,46 +76,6 @@
#define SECOND 1 /* Circa that many ticks in a second. */
-#define RBX_ASKNAME 0x0 /* -a */
-#define RBX_SINGLE 0x1 /* -s */
-/* 0x2 is reserved for log2(RB_NOSYNC). */
-/* 0x3 is reserved for log2(RB_HALT). */
-/* 0x4 is reserved for log2(RB_INITNAME). */
-#define RBX_DFLTROOT 0x5 /* -r */
-#define RBX_KDB 0x6 /* -d */
-/* 0x7 is reserved for log2(RB_RDONLY). */
-/* 0x8 is reserved for log2(RB_DUMP). */
-/* 0x9 is reserved for log2(RB_MINIROOT). */
-#define RBX_CONFIG 0xa /* -c */
-#define RBX_VERBOSE 0xb /* -v */
-#define RBX_SERIAL 0xc /* -h */
-#define RBX_CDROM 0xd /* -C */
-/* 0xe is reserved for log2(RB_POWEROFF). */
-#define RBX_GDB 0xf /* -g */
-#define RBX_MUTE 0x10 /* -m */
-/* 0x11 is reserved for log2(RB_SELFTEST). */
-/* 0x12 is reserved for boot programs. */
-/* 0x13 is reserved for boot programs. */
-#define RBX_PAUSE 0x14 /* -p */
-#define RBX_QUIET 0x15 /* -q */
-#define RBX_NOINTR 0x1c /* -n */
-/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */
-#define RBX_DUAL 0x1d /* -D */
-/* 0x1f is reserved for log2(RB_BOOTINFO). */
-
-/* pass: -a, -s, -r, -d, -c, -v, -h, -C, -g, -m, -p, -D */
-#define RBX_MASK (OPT_SET(RBX_ASKNAME) | OPT_SET(RBX_SINGLE) | \
- OPT_SET(RBX_DFLTROOT) | OPT_SET(RBX_KDB ) | \
- OPT_SET(RBX_CONFIG) | OPT_SET(RBX_VERBOSE) | \
- OPT_SET(RBX_SERIAL) | OPT_SET(RBX_CDROM) | \
- OPT_SET(RBX_GDB ) | OPT_SET(RBX_MUTE) | \
- OPT_SET(RBX_PAUSE) | OPT_SET(RBX_DUAL))
-
-#define PATH_DOTCONFIG "/boot.config"
-#define PATH_CONFIG "/boot/config"
-#define PATH_BOOT3 "/boot/loader"
-#define PATH_KERNEL "/boot/kernel/kernel"
-
#define ARGS 0x900
#define NOPT 14
#define MEM_BASE 0x12
@@ -131,9 +94,6 @@
/* Hard-coded assumption about location of JTAG-loaded kernel. */
#define DRAM_KERNEL_ADDR ((void *)mips_phys_to_cached(0x20000))
-#define OPT_SET(opt) (1 << (opt))
-#define OPT_CHECK(opt) ((opts) & OPT_SET(opt))
-
extern uint32_t _end;
static const char optstr[NOPT] = "DhaCcdgmnpqrsv"; /* Also 'P', 'S' */
Index: sys/boot/pc98/boot2/boot2.c
===================================================================
--- sys/boot/pc98/boot2/boot2.c
+++ sys/boot/pc98/boot2/boot2.c
@@ -35,6 +35,8 @@
#include "boot2.h"
#include "lib.h"
+#include "paths.h"
+#include "rbx.h"
/* Define to 0 to omit serial support */
#ifndef SERIAL
@@ -54,46 +56,6 @@
#define SECOND 1 /* Circa that many ticks in a second. */
-#define RBX_ASKNAME 0x0 /* -a */
-#define RBX_SINGLE 0x1 /* -s */
-/* 0x2 is reserved for log2(RB_NOSYNC). */
-/* 0x3 is reserved for log2(RB_HALT). */
-/* 0x4 is reserved for log2(RB_INITNAME). */
-#define RBX_DFLTROOT 0x5 /* -r */
-#define RBX_KDB 0x6 /* -d */
-/* 0x7 is reserved for log2(RB_RDONLY). */
-/* 0x8 is reserved for log2(RB_DUMP). */
-/* 0x9 is reserved for log2(RB_MINIROOT). */
-#define RBX_CONFIG 0xa /* -c */
-#define RBX_VERBOSE 0xb /* -v */
-#define RBX_SERIAL 0xc /* -h */
-#define RBX_CDROM 0xd /* -C */
-/* 0xe is reserved for log2(RB_POWEROFF). */
-#define RBX_GDB 0xf /* -g */
-#define RBX_MUTE 0x10 /* -m */
-/* 0x11 is reserved for log2(RB_SELFTEST). */
-/* 0x12 is reserved for boot programs. */
-/* 0x13 is reserved for boot programs. */
-#define RBX_PAUSE 0x14 /* -p */
-#define RBX_QUIET 0x15 /* -q */
-#define RBX_NOINTR 0x1c /* -n */
-/* 0x1d is reserved for log2(RB_MULTIPLE) and is just misnamed here. */
-#define RBX_DUAL 0x1d /* -D */
-/* 0x1f is reserved for log2(RB_BOOTINFO). */
-
-/* pass: -a, -s, -r, -d, -c, -v, -h, -C, -g, -m, -p, -D */
-#define RBX_MASK (OPT_SET(RBX_ASKNAME) | OPT_SET(RBX_SINGLE) | \
- OPT_SET(RBX_DFLTROOT) | OPT_SET(RBX_KDB ) | \
- OPT_SET(RBX_CONFIG) | OPT_SET(RBX_VERBOSE) | \
- OPT_SET(RBX_SERIAL) | OPT_SET(RBX_CDROM) | \
- OPT_SET(RBX_GDB ) | OPT_SET(RBX_MUTE) | \
- OPT_SET(RBX_PAUSE) | OPT_SET(RBX_DUAL))
-
-#define PATH_DOTCONFIG "/boot.config"
-#define PATH_CONFIG "/boot/config"
-#define PATH_BOOT3 "/boot/loader"
-#define PATH_KERNEL "/boot/kernel/kernel"
-
#define ARGS 0x900
#define NOPT 14
#define NDEV 3
@@ -105,9 +67,6 @@
#define TYPE_DA 1
#define TYPE_FD 2
-#define OPT_SET(opt) (1 << (opt))
-#define OPT_CHECK(opt) ((opts) & OPT_SET(opt))
-
extern uint32_t _end;
static const char optstr[NOPT] = "DhaCcdgmnpqrsv"; /* Also 'P', 'S' */
Index: sys/boot/powerpc/boot1.chrp/boot1.c
===================================================================
--- sys/boot/powerpc/boot1.chrp/boot1.c
+++ sys/boot/powerpc/boot1.chrp/boot1.c
@@ -23,8 +23,7 @@
#include <machine/elf.h>
#include <machine/stdarg.h>
-#define _PATH_LOADER "/boot/loader"
-#define _PATH_KERNEL "/boot/kernel/kernel"
+#include "paths.h"
#define BSIZEMAX 16384
@@ -396,7 +395,7 @@
char bootpath_full[255];
int i, len;
- path = _PATH_LOADER;
+ path = PATH_LOADER;
for (i = 0; i < ac; i++) {
switch (av[i][0]) {
case '-':
Index: sys/boot/sparc64/boot1/boot1.c
===================================================================
--- sys/boot/sparc64/boot1/boot1.c
+++ sys/boot/sparc64/boot1/boot1.c
@@ -24,8 +24,8 @@
#include <machine/elf.h>
#include <machine/stdarg.h>
-#define _PATH_LOADER "/boot/loader"
-#define _PATH_KERNEL "/boot/kernel/kernel"
+#include "paths.h"
+
#define READ_BUF_SIZE 8192
typedef int putc_func_t(char c, void *arg);
@@ -324,7 +324,7 @@
const char *path;
int i;
- path = _PATH_LOADER;
+ path = PATH_LOADER;
for (i = 0; i < ac; i++) {
switch (av[i][0]) {
case '-':

File Metadata

Mime Type
text/plain
Expires
Sun, Apr 12, 2:38 AM (4 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31324144
Default Alt Text
D5038.id12670.diff (21 KB)

Event Timeline