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
14 changed files with 70 additions and 20 deletions
|
@ -458,6 +458,8 @@ PCI domain IDs are currently ignored.
|
|||
See
|
||||
.Xr pciback 4 .
|
||||
.El
|
||||
.It Ic load_mods Va mods_path_pattern
|
||||
Load modules specified by pattern like /some_path/mod*.
|
||||
.It Ic ls Op Pa path
|
||||
Print a directory listing of
|
||||
.Pa path ,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# $NetBSD: Makefile,v 1.3 2005/12/11 12:17:48 christos Exp $
|
||||
|
||||
PROG= boot
|
||||
PROG= boot_monitor
|
||||
|
||||
.include <../Makefile.boot>
|
||||
|
|
|
@ -122,6 +122,7 @@ void command_dev(char *);
|
|||
void command_consdev(char *);
|
||||
void command_modules(char *);
|
||||
void command_multiboot(char *);
|
||||
void command_load_mods(char *);
|
||||
|
||||
const struct bootblk_command commands[] = {
|
||||
{ "help", command_help },
|
||||
|
@ -133,6 +134,7 @@ const struct bootblk_command commands[] = {
|
|||
{ "consdev", command_consdev },
|
||||
{ "modules", command_modules },
|
||||
{ "load", module_add },
|
||||
{ "load_mods", command_load_mods },
|
||||
{ "multiboot", command_multiboot },
|
||||
{ "vesa", command_vesa },
|
||||
{ "splash", splash_add },
|
||||
|
@ -261,11 +263,18 @@ print_banner(void)
|
|||
printf("%s\n", bootconf.banner[n]);
|
||||
} else {
|
||||
#endif /* !SMALL */
|
||||
#ifndef __minix
|
||||
printf("\n"
|
||||
">> %s, Revision %s (from NetBSD %s)\n"
|
||||
">> Memory: %d/%d k\n",
|
||||
bootprog_name, bootprog_rev, bootprog_kernrev,
|
||||
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
|
||||
}
|
||||
|
@ -396,6 +405,7 @@ command_help(char *arg)
|
|||
"vesa {modenum|on|off|enabled|disabled|list}\n"
|
||||
"modules {on|off|enabled|disabled}\n"
|
||||
"load {path_to_module}\n"
|
||||
"load_mods {path_to_modules}, pattern might be used\n"
|
||||
"multiboot [xdNx:][filename] [<args>]\n"
|
||||
"userconf {command}\n"
|
||||
"rndseed {path_to_rndseed_file}\n"
|
||||
|
@ -409,7 +419,17 @@ command_ls(char *arg)
|
|||
const char *save = 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -399,7 +399,8 @@ cd9660_stat(struct open_file *f, struct stat *sb)
|
|||
|
||||
#if defined(LIBSA_ENABLE_LS_OP)
|
||||
__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");
|
||||
return;
|
||||
|
|
|
@ -407,7 +407,8 @@ dosfs_stat(struct open_file *fd, struct stat *sb)
|
|||
|
||||
#if defined(LIBSA_ENABLE_LS_OP)
|
||||
__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");
|
||||
return;
|
||||
|
|
|
@ -858,7 +858,8 @@ ext2fs_stat(struct open_file *f, struct stat *sb)
|
|||
|
||||
#if defined(LIBSA_ENABLE_LS_OP)
|
||||
__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;
|
||||
size_t block_size = fp->f_fs->e2fs_bsize;
|
||||
|
|
|
@ -89,13 +89,13 @@
|
|||
#include <lib/libkern/libkern.h>
|
||||
|
||||
void
|
||||
ls(const char *path)
|
||||
ls(const char *path, void (*funcp)(char* arg))
|
||||
{
|
||||
int fd;
|
||||
struct stat sb;
|
||||
size_t size;
|
||||
const char *fname = 0;
|
||||
char *p;
|
||||
char *p = NULL;
|
||||
struct open_file *f;
|
||||
|
||||
if ((fd = open(path, 0)) < 0
|
||||
|
@ -115,7 +115,6 @@ ls(const char *path)
|
|||
memcpy(p, path, size);
|
||||
p[size] = 0;
|
||||
fd = open(p, 0);
|
||||
dealloc(p, size + 1);
|
||||
} else {
|
||||
fd = open("", 0);
|
||||
fname = path;
|
||||
|
@ -153,10 +152,12 @@ ls(const char *path)
|
|||
#endif
|
||||
|
||||
if (FS_LS(f->f_ops) != NULL)
|
||||
FS_LS(f->f_ops)(f, fname);
|
||||
FS_LS(f->f_ops)(f, fname, funcp, p);
|
||||
else
|
||||
printf("no ls support for this file system\n");
|
||||
|
||||
out:
|
||||
if (p != NULL)
|
||||
dealloc(p, size + 1);
|
||||
close(fd);
|
||||
}
|
||||
|
|
|
@ -861,7 +861,8 @@ minixfs3_stat(struct open_file *f, struct stat *sb)
|
|||
|
||||
#if defined(LIBSA_ENABLE_LS_OP)
|
||||
__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 mfs_sblock *fs = fp->f_fs;
|
||||
|
@ -927,8 +928,24 @@ minixfs3_ls(struct open_file *f, const char *pattern)
|
|||
entry_t *p_names = names;
|
||||
do {
|
||||
n = p_names;
|
||||
printf("%d: %s\n",
|
||||
n->e_ino, n->e_name);
|
||||
if (funcp) {
|
||||
/* 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;
|
||||
} while (p_names);
|
||||
} else {
|
||||
|
|
|
@ -658,7 +658,8 @@ nfs_stat(struct open_file *f, struct stat *sb)
|
|||
|
||||
#if defined(LIBSA_ENABLE_LS_OP)
|
||||
__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");
|
||||
return;
|
||||
|
|
|
@ -116,7 +116,8 @@ null_stat(struct open_file *f, struct stat *sb)
|
|||
|
||||
#if defined(LIBSA_ENABLE_LS_OP)
|
||||
__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");
|
||||
return;
|
||||
|
|
|
@ -100,7 +100,8 @@ struct open_file;
|
|||
#if defined(LIBSA_ENABLE_LS_OP)
|
||||
#define FS_DEF(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
|
||||
#define FS_DEF(fs) FS_DEF_BASE(fs)
|
||||
#endif
|
||||
|
@ -122,7 +123,8 @@ struct fs_ops {
|
|||
__compactcall off_t (*seek)(struct open_file *, off_t, int);
|
||||
__compactcall int (*stat)(struct open_file *, struct stat *);
|
||||
#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
|
||||
};
|
||||
|
||||
|
@ -286,7 +288,7 @@ int ioctl(int, u_long, char *);
|
|||
int stat(const char *, struct stat *);
|
||||
int fstat(int, struct stat *);
|
||||
#if defined(LIBSA_ENABLE_LS_OP)
|
||||
void ls(const char *);
|
||||
void ls(const char *, void (*funcp)(char* arg));
|
||||
#endif
|
||||
|
||||
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)
|
||||
__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");
|
||||
return;
|
||||
|
|
|
@ -914,7 +914,8 @@ ufs_stat(struct open_file *f, struct stat *sb)
|
|||
|
||||
#if defined(LIBSA_ENABLE_LS_OP)
|
||||
__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;
|
||||
char *buf;
|
||||
|
|
|
@ -540,7 +540,8 @@ ustarfs_stat(struct open_file *f, struct stat *sb)
|
|||
|
||||
#if defined(LIBSA_ENABLE_LS_OP)
|
||||
__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");
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue