Adjust boot from NetBSD.
- Add load_mods command to boot2 (load_mods /dir/mod*). - Rename resulting binary to boot_monitor. - Change default banner when used in MINIX.
This commit is contained in:
parent
f119e63750
commit
602233213e
|
@ -458,6 +458,8 @@ PCI domain IDs are currently ignored.
|
||||||
See
|
See
|
||||||
.Xr pciback 4 .
|
.Xr pciback 4 .
|
||||||
.El
|
.El
|
||||||
|
.It Ic load_mods Va mods_path_pattern
|
||||||
|
Load modules specified by pattern like /some_path/mod*.
|
||||||
.It Ic ls Op Pa path
|
.It Ic ls Op Pa path
|
||||||
Print a directory listing of
|
Print a directory listing of
|
||||||
.Pa path ,
|
.Pa path ,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# $NetBSD: Makefile,v 1.3 2005/12/11 12:17:48 christos Exp $
|
# $NetBSD: Makefile,v 1.3 2005/12/11 12:17:48 christos Exp $
|
||||||
|
|
||||||
PROG= boot
|
PROG= boot_monitor
|
||||||
|
|
||||||
.include <../Makefile.boot>
|
.include <../Makefile.boot>
|
||||||
|
|
|
@ -122,6 +122,7 @@ void command_dev(char *);
|
||||||
void command_consdev(char *);
|
void command_consdev(char *);
|
||||||
void command_modules(char *);
|
void command_modules(char *);
|
||||||
void command_multiboot(char *);
|
void command_multiboot(char *);
|
||||||
|
void command_load_mods(char *);
|
||||||
|
|
||||||
const struct bootblk_command commands[] = {
|
const struct bootblk_command commands[] = {
|
||||||
{ "help", command_help },
|
{ "help", command_help },
|
||||||
|
@ -133,6 +134,7 @@ const struct bootblk_command commands[] = {
|
||||||
{ "consdev", command_consdev },
|
{ "consdev", command_consdev },
|
||||||
{ "modules", command_modules },
|
{ "modules", command_modules },
|
||||||
{ "load", module_add },
|
{ "load", module_add },
|
||||||
|
{ "load_mods", command_load_mods },
|
||||||
{ "multiboot", command_multiboot },
|
{ "multiboot", command_multiboot },
|
||||||
{ "vesa", command_vesa },
|
{ "vesa", command_vesa },
|
||||||
{ "splash", splash_add },
|
{ "splash", splash_add },
|
||||||
|
@ -261,11 +263,18 @@ print_banner(void)
|
||||||
printf("%s\n", bootconf.banner[n]);
|
printf("%s\n", bootconf.banner[n]);
|
||||||
} else {
|
} else {
|
||||||
#endif /* !SMALL */
|
#endif /* !SMALL */
|
||||||
|
#ifndef __minix
|
||||||
printf("\n"
|
printf("\n"
|
||||||
">> %s, Revision %s (from NetBSD %s)\n"
|
">> %s, Revision %s (from NetBSD %s)\n"
|
||||||
">> Memory: %d/%d k\n",
|
">> Memory: %d/%d k\n",
|
||||||
bootprog_name, bootprog_rev, bootprog_kernrev,
|
bootprog_name, bootprog_rev, bootprog_kernrev,
|
||||||
getbasemem(), getextmem());
|
getbasemem(), getextmem());
|
||||||
|
#else
|
||||||
|
printf("\n"
|
||||||
|
"--- Welcome to MINIX 3. This is the boot monitor. ---\n"
|
||||||
|
"Memory: %d/%d k\n",
|
||||||
|
getbasemem(), getextmem());
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef SMALL
|
#ifndef SMALL
|
||||||
}
|
}
|
||||||
|
@ -396,6 +405,7 @@ command_help(char *arg)
|
||||||
"vesa {modenum|on|off|enabled|disabled|list}\n"
|
"vesa {modenum|on|off|enabled|disabled|list}\n"
|
||||||
"modules {on|off|enabled|disabled}\n"
|
"modules {on|off|enabled|disabled}\n"
|
||||||
"load {path_to_module}\n"
|
"load {path_to_module}\n"
|
||||||
|
"load_mods {path_to_modules}, pattern might be used\n"
|
||||||
"multiboot [xdNx:][filename] [<args>]\n"
|
"multiboot [xdNx:][filename] [<args>]\n"
|
||||||
"userconf {command}\n"
|
"userconf {command}\n"
|
||||||
"rndseed {path_to_rndseed_file}\n"
|
"rndseed {path_to_rndseed_file}\n"
|
||||||
|
@ -409,7 +419,17 @@ command_ls(char *arg)
|
||||||
const char *save = default_filename;
|
const char *save = default_filename;
|
||||||
|
|
||||||
default_filename = "/";
|
default_filename = "/";
|
||||||
ls(arg);
|
ls(arg, NULL);
|
||||||
|
default_filename = save;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
command_load_mods(char *arg)
|
||||||
|
{
|
||||||
|
const char *save = default_filename;
|
||||||
|
|
||||||
|
default_filename = "/";
|
||||||
|
ls(arg, module_add);
|
||||||
default_filename = save;
|
default_filename = save;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -399,7 +399,8 @@ cd9660_stat(struct open_file *f, struct stat *sb)
|
||||||
|
|
||||||
#if defined(LIBSA_ENABLE_LS_OP)
|
#if defined(LIBSA_ENABLE_LS_OP)
|
||||||
__compactcall void
|
__compactcall void
|
||||||
cd9660_ls(struct open_file *f, const char *pattern)
|
cd9660_ls(struct open_file *f, const char *pattern,
|
||||||
|
void (*funcp)(char* arg), char* path)
|
||||||
{
|
{
|
||||||
printf("Currently ls command is unsupported by cd9660\n");
|
printf("Currently ls command is unsupported by cd9660\n");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -407,7 +407,8 @@ dosfs_stat(struct open_file *fd, struct stat *sb)
|
||||||
|
|
||||||
#if defined(LIBSA_ENABLE_LS_OP)
|
#if defined(LIBSA_ENABLE_LS_OP)
|
||||||
__compactcall void
|
__compactcall void
|
||||||
dosfs_ls(struct open_file *f, const char *pattern)
|
dosfs_ls(struct open_file *f, const char *pattern,
|
||||||
|
void (*funcp)(char* arg), char* path)
|
||||||
{
|
{
|
||||||
printf("Currently ls command is unsupported by dosfs\n");
|
printf("Currently ls command is unsupported by dosfs\n");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -858,7 +858,8 @@ ext2fs_stat(struct open_file *f, struct stat *sb)
|
||||||
|
|
||||||
#if defined(LIBSA_ENABLE_LS_OP)
|
#if defined(LIBSA_ENABLE_LS_OP)
|
||||||
__compactcall void
|
__compactcall void
|
||||||
ext2fs_ls(struct open_file *f, const char *pattern)
|
ext2fs_ls(struct open_file *f, const char *pattern,
|
||||||
|
void (*funcp)(char* arg), char* path)
|
||||||
{
|
{
|
||||||
struct file *fp = (struct file *)f->f_fsdata;
|
struct file *fp = (struct file *)f->f_fsdata;
|
||||||
size_t block_size = fp->f_fs->e2fs_bsize;
|
size_t block_size = fp->f_fs->e2fs_bsize;
|
||||||
|
|
|
@ -89,13 +89,13 @@
|
||||||
#include <lib/libkern/libkern.h>
|
#include <lib/libkern/libkern.h>
|
||||||
|
|
||||||
void
|
void
|
||||||
ls(const char *path)
|
ls(const char *path, void (*funcp)(char* arg))
|
||||||
{
|
{
|
||||||
int fd;
|
int fd;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
size_t size;
|
size_t size;
|
||||||
const char *fname = 0;
|
const char *fname = 0;
|
||||||
char *p;
|
char *p = NULL;
|
||||||
struct open_file *f;
|
struct open_file *f;
|
||||||
|
|
||||||
if ((fd = open(path, 0)) < 0
|
if ((fd = open(path, 0)) < 0
|
||||||
|
@ -115,7 +115,6 @@ ls(const char *path)
|
||||||
memcpy(p, path, size);
|
memcpy(p, path, size);
|
||||||
p[size] = 0;
|
p[size] = 0;
|
||||||
fd = open(p, 0);
|
fd = open(p, 0);
|
||||||
dealloc(p, size + 1);
|
|
||||||
} else {
|
} else {
|
||||||
fd = open("", 0);
|
fd = open("", 0);
|
||||||
fname = path;
|
fname = path;
|
||||||
|
@ -153,10 +152,12 @@ ls(const char *path)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (FS_LS(f->f_ops) != NULL)
|
if (FS_LS(f->f_ops) != NULL)
|
||||||
FS_LS(f->f_ops)(f, fname);
|
FS_LS(f->f_ops)(f, fname, funcp, p);
|
||||||
else
|
else
|
||||||
printf("no ls support for this file system\n");
|
printf("no ls support for this file system\n");
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
if (p != NULL)
|
||||||
|
dealloc(p, size + 1);
|
||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -861,7 +861,8 @@ minixfs3_stat(struct open_file *f, struct stat *sb)
|
||||||
|
|
||||||
#if defined(LIBSA_ENABLE_LS_OP)
|
#if defined(LIBSA_ENABLE_LS_OP)
|
||||||
__compactcall void
|
__compactcall void
|
||||||
minixfs3_ls(struct open_file *f, const char *pattern)
|
minixfs3_ls(struct open_file *f, const char *pattern,
|
||||||
|
void (*funcp)(char* arg), char* path)
|
||||||
{
|
{
|
||||||
struct file *fp = (struct file *)f->f_fsdata;
|
struct file *fp = (struct file *)f->f_fsdata;
|
||||||
struct mfs_sblock *fs = fp->f_fs;
|
struct mfs_sblock *fs = fp->f_fs;
|
||||||
|
@ -927,8 +928,24 @@ minixfs3_ls(struct open_file *f, const char *pattern)
|
||||||
entry_t *p_names = names;
|
entry_t *p_names = names;
|
||||||
do {
|
do {
|
||||||
n = p_names;
|
n = p_names;
|
||||||
printf("%d: %s\n",
|
if (funcp) {
|
||||||
n->e_ino, n->e_name);
|
/* Call handler for each file instead of
|
||||||
|
* printing. Used by load_mods command.
|
||||||
|
*/
|
||||||
|
char namebuf[MAXPATHLEN+1];
|
||||||
|
namebuf[0] = '\0';
|
||||||
|
if (path != pattern) {
|
||||||
|
strcpy(namebuf, path);
|
||||||
|
namebuf[strlen(path)] = '/';
|
||||||
|
namebuf[strlen(path) + 1] = '\0';
|
||||||
|
}
|
||||||
|
strcat(namebuf, n->e_name);
|
||||||
|
|
||||||
|
funcp(namebuf);
|
||||||
|
} else {
|
||||||
|
printf("%d: %s\n",
|
||||||
|
n->e_ino, n->e_name);
|
||||||
|
}
|
||||||
p_names = n->e_next;
|
p_names = n->e_next;
|
||||||
} while (p_names);
|
} while (p_names);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -658,7 +658,8 @@ nfs_stat(struct open_file *f, struct stat *sb)
|
||||||
|
|
||||||
#if defined(LIBSA_ENABLE_LS_OP)
|
#if defined(LIBSA_ENABLE_LS_OP)
|
||||||
__compactcall void
|
__compactcall void
|
||||||
nfs_ls(struct open_file *f, const char *pattern)
|
nfs_ls(struct open_file *f, const char *pattern,
|
||||||
|
void (*funcp)(char* arg), char* path)
|
||||||
{
|
{
|
||||||
printf("Currently ls command is unsupported by nfs\n");
|
printf("Currently ls command is unsupported by nfs\n");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -116,7 +116,8 @@ null_stat(struct open_file *f, struct stat *sb)
|
||||||
|
|
||||||
#if defined(LIBSA_ENABLE_LS_OP)
|
#if defined(LIBSA_ENABLE_LS_OP)
|
||||||
__compactcall void
|
__compactcall void
|
||||||
null_ls(struct open_file *f, const char *pattern)
|
null_ls(struct open_file *f, const char *pattern,
|
||||||
|
void (*funcp)(char* arg), char* path)
|
||||||
{
|
{
|
||||||
printf("Currently ls command is unsupported by nullfs\n");
|
printf("Currently ls command is unsupported by nullfs\n");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -100,7 +100,8 @@ struct open_file;
|
||||||
#if defined(LIBSA_ENABLE_LS_OP)
|
#if defined(LIBSA_ENABLE_LS_OP)
|
||||||
#define FS_DEF(fs) \
|
#define FS_DEF(fs) \
|
||||||
FS_DEF_BASE(fs);\
|
FS_DEF_BASE(fs);\
|
||||||
extern __compactcall void __CONCAT(fs,_ls)(struct open_file *, const char *)
|
extern __compactcall void __CONCAT(fs,_ls)(struct open_file *, const char *,\
|
||||||
|
void (*)(char* arg), char*)
|
||||||
#else
|
#else
|
||||||
#define FS_DEF(fs) FS_DEF_BASE(fs)
|
#define FS_DEF(fs) FS_DEF_BASE(fs)
|
||||||
#endif
|
#endif
|
||||||
|
@ -122,7 +123,8 @@ struct fs_ops {
|
||||||
__compactcall off_t (*seek)(struct open_file *, off_t, int);
|
__compactcall off_t (*seek)(struct open_file *, off_t, int);
|
||||||
__compactcall int (*stat)(struct open_file *, struct stat *);
|
__compactcall int (*stat)(struct open_file *, struct stat *);
|
||||||
#if defined(LIBSA_ENABLE_LS_OP)
|
#if defined(LIBSA_ENABLE_LS_OP)
|
||||||
__compactcall void (*ls)(struct open_file *, const char *);
|
__compactcall void (*ls)(struct open_file *, const char *,
|
||||||
|
void (*)(char* arg), char*);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -286,7 +288,7 @@ int ioctl(int, u_long, char *);
|
||||||
int stat(const char *, struct stat *);
|
int stat(const char *, struct stat *);
|
||||||
int fstat(int, struct stat *);
|
int fstat(int, struct stat *);
|
||||||
#if defined(LIBSA_ENABLE_LS_OP)
|
#if defined(LIBSA_ENABLE_LS_OP)
|
||||||
void ls(const char *);
|
void ls(const char *, void (*funcp)(char* arg));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef int cmp_t(const void *, const void *);
|
typedef int cmp_t(const void *, const void *);
|
||||||
|
|
|
@ -431,7 +431,8 @@ tftp_stat(struct open_file *f, struct stat *sb)
|
||||||
|
|
||||||
#if defined(LIBSA_ENABLE_LS_OP)
|
#if defined(LIBSA_ENABLE_LS_OP)
|
||||||
__compactcall void
|
__compactcall void
|
||||||
tftp_ls(struct open_file *f, const char *pattern)
|
tftp_ls(struct open_file *f, const char *pattern,
|
||||||
|
void (*funcp)(char* arg), char* path)
|
||||||
{
|
{
|
||||||
printf("Currently ls command is unsupported by tftp\n");
|
printf("Currently ls command is unsupported by tftp\n");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -914,7 +914,8 @@ ufs_stat(struct open_file *f, struct stat *sb)
|
||||||
|
|
||||||
#if defined(LIBSA_ENABLE_LS_OP)
|
#if defined(LIBSA_ENABLE_LS_OP)
|
||||||
__compactcall void
|
__compactcall void
|
||||||
ufs_ls(struct open_file *f, const char *pattern)
|
ufs_ls(struct open_file *f, const char *pattern,
|
||||||
|
void (*funcp)(char* arg), char* path)
|
||||||
{
|
{
|
||||||
struct file *fp = (struct file *)f->f_fsdata;
|
struct file *fp = (struct file *)f->f_fsdata;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
|
@ -540,7 +540,8 @@ ustarfs_stat(struct open_file *f, struct stat *sb)
|
||||||
|
|
||||||
#if defined(LIBSA_ENABLE_LS_OP)
|
#if defined(LIBSA_ENABLE_LS_OP)
|
||||||
__compactcall void
|
__compactcall void
|
||||||
ustarfs_ls(struct open_file *f, const char *pattern)
|
ustarfs_ls(struct open_file *f, const char *pattern,
|
||||||
|
void (*funcp)(char* arg), char* path)
|
||||||
{
|
{
|
||||||
printf("Currently ls command is unsupported by ustarfs\n");
|
printf("Currently ls command is unsupported by ustarfs\n");
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue