本文整理汇总了C++中env_setenv函数的典型用法代码示例。如果您正苦于以下问题:C++ env_setenv函数的具体用法?C++ env_setenv怎么用?C++ env_setenv使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了env_setenv函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: extract_currdev
static void
extract_currdev(struct bootinfo *bootinfop)
{
const char *bootdev;
/*
* Pick up boot device information from boot2.
*
* XXXRW: Someday: device units.
*/
switch(bootinfop->bi_boot_dev_type) {
case BOOTINFO_DEV_TYPE_DRAM:
bootdev = "dram0";
break;
case BOOTINFO_DEV_TYPE_CFI:
bootdev = "cfi0";
break;
case BOOTINFO_DEV_TYPE_SDCARD:
bootdev = "sdcard0";
break;
default:
bootdev = NULL;
}
if (bootdev != NULL) {
env_setenv("currdev", EV_VOLATILE, bootdev, NULL, env_nounset);
env_setenv("loaddev", EV_VOLATILE, bootdev, env_noset,
env_nounset);
}
}
示例2: cfe_setup_default_env
static void cfe_setup_default_env(void)
{
char buffer[80];
xsprintf(buffer,"%d.%d.%d",CFE_VER_MAJOR,CFE_VER_MINOR,CFE_VER_BUILD);
env_setenv("CFE_VERSION",buffer,ENV_FLG_BUILTIN | ENV_FLG_READONLY);
if (cfe_boardname) {
env_setenv("CFE_BOARDNAME",(char *) cfe_boardname,
ENV_FLG_BUILTIN | ENV_FLG_READONLY);
}
xsprintf(buffer,"%d",mem_totalsize);
env_setenv("CFE_MEMORYSIZE",buffer,ENV_FLG_BUILTIN | ENV_FLG_READONLY);
}
示例3: cons_set
/*
* Select a console.
*
* XXX Note that the console system design allows for some extension
* here (eg. multiple consoles, input/output only, etc.)
*/
static int
cons_set(struct env_var *ev, int flags, void *value)
{
int cons, active;
if ((value == NULL) || ((active = cons_find(value)) == -1)) {
if (value != NULL)
printf("no such console '%s'\n", (char *)value);
printf("Available consoles:\n");
for (cons = 0; consoles[cons] != NULL; cons++)
printf(" %s\n", consoles[cons]->c_name);
return(CMD_ERROR);
}
/* disable all current consoles */
for (cons = 0; consoles[cons] != NULL; cons++)
consoles[cons]->c_flags &= ~(C_ACTIVEIN | C_ACTIVEOUT);
/* enable selected console */
consoles[active]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT;
consoles[active]->c_init(0);
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
return(CMD_OK);
}
示例4: extract_currdev
/*
* Set the 'current device' by (if possible) recovering the boot device as
* supplied by the initial bootstrap.
*/
static void
extract_currdev(void)
{
struct disk_devdesc dev;
//bzero(&dev, sizeof(dev));
#if defined(USERBOOT_ZFS_SUPPORT)
if (userboot_zfs_found) {
struct zfs_devdesc zdev;
/* Leave the pool/root guid's unassigned */
bzero(&zdev, sizeof(zdev));
zdev.d_dev = &zfs_dev;
zdev.d_type = zdev.d_dev->dv_type;
dev = *(struct disk_devdesc *)&zdev;
init_zfs_bootenv(zfs_fmtdev(&dev));
} else
#endif
if (userboot_disk_maxunit > 0) {
dev.d_dev = &userboot_disk;
dev.d_type = dev.d_dev->dv_type;
dev.d_unit = 0;
dev.d_slice = 0;
dev.d_partition = 0;
/*
* If we cannot auto-detect the partition type then
* access the disk as a raw device.
*/
if (dev.d_dev->dv_open(NULL, &dev)) {
dev.d_slice = -1;
dev.d_partition = -1;
}
} else {
dev.d_dev = &host_dev;
dev.d_type = dev.d_dev->dv_type;
dev.d_unit = 0;
}
env_setenv("currdev", EV_VOLATILE, userboot_fmtdev(&dev),
userboot_setcurrdev, env_nounset);
env_setenv("loaddev", EV_VOLATILE, userboot_fmtdev(&dev),
env_noset, env_nounset);
}
示例5: setenv
int
setenv(const char *name, const char *value, int overwrite)
{
/* No guarantees about state, always assume volatile */
if (overwrite || (env_getenv(name) == NULL))
return(env_setenv(name, EV_VOLATILE, value, NULL, NULL));
return(0);
}
示例6: cons_probe
/*
* Detect possible console(s) to use. If preferred console(s) have been
* specified, mark them as active. Else, mark the first probed console
* as active. Also create the console variable.
*/
void
cons_probe(void)
{
int cons;
int active;
char *prefconsole;
/* Do all console probes */
for (cons = 0; consoles[cons] != NULL; cons++) {
consoles[cons]->c_flags = 0;
consoles[cons]->c_probe(consoles[cons]);
}
/* Now find the first working one */
active = -1;
for (cons = 0; consoles[cons] != NULL && active == -1; cons++) {
consoles[cons]->c_flags = 0;
consoles[cons]->c_probe(consoles[cons]);
if (consoles[cons]->c_flags == (C_PRESENTIN | C_PRESENTOUT))
active = cons;
}
/* Force a console even if all probes failed */
if (active == -1)
active = 0;
/* Check to see if a console preference has already been registered */
prefconsole = getenv("console");
if (prefconsole != NULL)
prefconsole = strdup(prefconsole);
if (prefconsole != NULL) {
unsetenv("console"); /* we want to replace this */
cons_change(prefconsole);
} else {
consoles[active]->c_flags |= C_ACTIVEIN | C_ACTIVEOUT;
consoles[active]->c_init(0);
prefconsole = strdup(consoles[active]->c_name);
}
printf("Consoles: ");
for (cons = 0; consoles[cons] != NULL; cons++)
if (consoles[cons]->c_flags & (C_ACTIVEIN | C_ACTIVEOUT))
printf("%s ", consoles[cons]->c_desc);
printf("\n");
if (prefconsole != NULL) {
env_setenv("console", EV_VOLATILE, prefconsole, cons_set,
env_nounset);
free(prefconsole);
}
}
示例7: cons_set
/*
* Select one or more consoles.
*/
static int
cons_set(struct env_var *ev, int flags, const void *value)
{
int cons;
if ((value == NULL) || (cons_check(value) == -1)) {
if (value != NULL)
printf("no such console!\n");
printf("Available consoles:\n");
for (cons = 0; consoles[cons] != NULL; cons++)
printf(" %s\n", consoles[cons]->c_name);
return(CMD_ERROR);
}
cons_change(value);
env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL);
return(CMD_OK);
}
示例8: cfe_set_console
int cfe_set_console(char *name)
{
xprinthook = console_xprint;
#if !CFG_MINIMAL_SIZE
if (strcmp(name,CFE_BUFFER_CONSOLE) == 0) {
console_buffer_flg = 1;
return 0;
}
#endif
if (name) {
int res;
res = env_setenv("BOOT_CONSOLE",name,
ENV_FLG_BUILTIN | ENV_FLG_READONLY | ENV_FLG_ADMIN);
return console_open(name);
}
return -1;
}
示例9: cons_probe
/*
* Detect possible console(s) to use. The first probed console
* is marked active. Also create the console variable.
*
* XXX Add logic for multiple console support.
*/
void
cons_probe(void)
{
int cons;
int active;
char *prefconsole;
/* Do all console probes */
for (cons = 0; consoles[cons] != NULL; cons++) {
consoles[cons]->c_flags = 0;
consoles[cons]->c_probe(consoles[cons]);
}
/* Now find the first working one */
active = -1;
for (cons = 0; consoles[cons] != NULL && active == -1; cons++) {
consoles[cons]->c_flags = 0;
consoles[cons]->c_probe(consoles[cons]);
if (consoles[cons]->c_flags == (C_PRESENTIN | C_PRESENTOUT))
active = cons;
}
/* Check to see if a console preference has already been registered */
prefconsole = getenv("console");
if (prefconsole != NULL)
prefconsole = strdup(prefconsole);
if (prefconsole != NULL) {
unsetenv("console"); /* we want to replace this */
for (cons = 0; consoles[cons] != NULL; cons++)
/* look for the nominated console, use it if it's functional */
if (!strcmp(prefconsole, consoles[cons]->c_name) &&
(consoles[cons]->c_flags == (C_PRESENTIN | C_PRESENTOUT)))
active = cons;
free(prefconsole);
}
if (active == -1)
active = 0;
consoles[active]->c_flags |= (C_ACTIVEIN | C_ACTIVEOUT);
consoles[active]->c_init(0);
printf("Console: %s\n", consoles[active]->c_desc);
env_setenv("console", EV_VOLATILE, consoles[active]->c_name, (ev_sethook_t *) cons_set,
env_nounset);
}
示例10: main
//.........这里部分代码省略.........
setenv("console", "comconsole" , 1);
}
if (efi_copy_init()) {
printf("failed to allocate staging area\n");
return (EFI_BUFFER_TOO_SMALL);
}
/*
* March through the device switch probing for things.
*/
for (i = 0; devsw[i] != NULL; i++)
if (devsw[i]->dv_init != NULL)
(devsw[i]->dv_init)();
/* Get our loaded image protocol interface structure. */
BS->HandleProtocol(IH, &imgid, (VOID**)&img);
printf("Command line arguments:");
for (i = 0; i < argc; i++) {
printf(" ");
print_str16(argv[i]);
}
printf("\n");
printf("Image base: 0x%lx\n", (u_long)img->ImageBase);
printf("EFI version: %d.%02d\n", ST->Hdr.Revision >> 16,
ST->Hdr.Revision & 0xffff);
printf("EFI Firmware: ");
/* printf doesn't understand EFI Unicode */
ST->ConOut->OutputString(ST->ConOut, ST->FirmwareVendor);
printf(" (rev %d.%02d)\n", ST->FirmwareRevision >> 16,
ST->FirmwareRevision & 0xffff);
printf("\n");
printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
printf("(%s, %s)\n", bootprog_maker, bootprog_date);
/*
* Disable the watchdog timer. By default the boot manager sets
* the timer to 5 minutes before invoking a boot option. If we
* want to return to the boot manager, we have to disable the
* watchdog timer and since we're an interactive program, we don't
* want to wait until the user types "quit". The timer may have
* fired by then. We don't care if this fails. It does not prevent
* normal functioning in any way...
*/
BS->SetWatchdogTimer(0, 0, 0, NULL);
if (efi_handle_lookup(img->DeviceHandle, &dev, &unit, &pool_guid) != 0)
return (EFI_NOT_FOUND);
switch (dev->dv_type) {
#ifdef EFI_ZFS_BOOT
case DEVT_ZFS: {
struct zfs_devdesc currdev;
currdev.d_dev = dev;
currdev.d_unit = unit;
currdev.d_type = currdev.d_dev->dv_type;
currdev.d_opendata = NULL;
currdev.pool_guid = pool_guid;
currdev.root_guid = 0;
env_setenv("currdev", EV_VOLATILE, efi_fmtdev(&currdev),
efi_setcurrdev, env_nounset);
env_setenv("loaddev", EV_VOLATILE, efi_fmtdev(&currdev), env_noset,
env_nounset);
init_zfs_bootenv(zfs_fmtdev(&currdev));
break;
}
#endif
default: {
struct devdesc currdev;
currdev.d_dev = dev;
currdev.d_unit = unit;
currdev.d_opendata = NULL;
currdev.d_type = currdev.d_dev->dv_type;
env_setenv("currdev", EV_VOLATILE, efi_fmtdev(&currdev),
efi_setcurrdev, env_nounset);
env_setenv("loaddev", EV_VOLATILE, efi_fmtdev(&currdev), env_noset,
env_nounset);
break;
}
}
setenv("LINES", "24", 1); /* optional */
for (k = 0; k < ST->NumberOfTableEntries; k++) {
guid = &ST->ConfigurationTable[k].VendorGuid;
if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) {
smbios_detect(ST->ConfigurationTable[k].VendorTable);
break;
}
}
interact(NULL); /* doesn't return */
return (EFI_SUCCESS); /* keep compiler happy */
}
示例11: main
EFI_STATUS
main(int argc, CHAR16 *argv[])
{
char var[128];
EFI_LOADED_IMAGE *img;
EFI_GUID *guid;
int i, j, vargood;
/*
* 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
* printf() etc. once this is done.
*/
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);
}
/*
* March through the device switch probing for things.
*/
for (i = 0; devsw[i] != NULL; i++)
if (devsw[i]->dv_init != NULL)
(devsw[i]->dv_init)();
/* Get our loaded image protocol interface structure. */
BS->HandleProtocol(IH, &imgid, (VOID**)&img);
printf("Image base: 0x%lx\n", (u_long)img->ImageBase);
printf("EFI version: %d.%02d\n", ST->Hdr.Revision >> 16,
ST->Hdr.Revision & 0xffff);
printf("EFI Firmware: ");
/* printf doesn't understand EFI Unicode */
ST->ConOut->OutputString(ST->ConOut, ST->FirmwareVendor);
printf(" (rev %d.%02d)\n", ST->FirmwareRevision >> 16,
ST->FirmwareRevision & 0xffff);
printf("\n");
printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
printf("(%s, %s)\n", bootprog_maker, bootprog_date);
efi_handle_lookup(img->DeviceHandle, &currdev.d_dev, &currdev.d_unit);
currdev.d_type = currdev.d_dev->dv_type;
/*
* Disable the watchdog timer. By default the boot manager sets
* the timer to 5 minutes before invoking a boot option. If we
* want to return to the boot manager, we have to disable the
* watchdog timer and since we're an interactive program, we don't
* want to wait until the user types "quit". The timer may have
* fired by then. We don't care if this fails. It does not prevent
* normal functioning in any way...
*/
BS->SetWatchdogTimer(0, 0, 0, NULL);
env_setenv("currdev", EV_VOLATILE, efi_fmtdev(&currdev),
efi_setcurrdev, env_nounset);
env_setenv("loaddev", EV_VOLATILE, efi_fmtdev(&currdev), env_noset,
env_nounset);
setenv("LINES", "24", 1); /* optional */
archsw.arch_autoload = efi_autoload;
archsw.arch_getdev = efi_getdev;
archsw.arch_copyin = efi_copyin;
archsw.arch_copyout = efi_copyout;
archsw.arch_readin = efi_readin;
for (i = 0; i < ST->NumberOfTableEntries; i++) {
guid = &ST->ConfigurationTable[i].VendorGuid;
if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) {
smbios_detect(ST->ConfigurationTable[i].VendorTable);
break;
}
//.........这里部分代码省略.........
示例12: cfe_boot
/* *********************************************************************
* cfe_boot(la)
*
* Bootstrap the system.
*
* Input parameters:
* la - loader arguments
*
* Return value:
* error, or does not return
********************************************************************* */
int cfe_boot(char *ldrname,cfe_loadargs_t *la)
{
int res;
la->la_entrypt = 0;
if (la->la_flags & LOADFLG_NOISY) {
xprintf("Loading: ");
}
res = cfe_load_program(ldrname,la);
if (res < 0) {
if (la->la_flags & LOADFLG_NOISY) {
xprintf("Failed.\n");
}
return res;
}
/*
* Special case: If loading a batch file, just do the commands here
* and return. For batch files we don't want to set up the
* environment variables.
*/
if (la->la_flags & LOADFLG_BATCH) {
#if CFG_UI
ui_docommands((char *) la->la_entrypt);
#endif
return 0;
}
/*
* Otherwise set up for running a real program.
*/
if (la->la_flags & LOADFLG_NOISY) {
xprintf("Entry at 0x%p\n",la->la_entrypt);
}
/*
* Set up the environment variables for the bootstrap
*/
if (la->la_device) {
env_setenv(bootvar_device,la->la_device,ENV_FLG_BUILTIN);
}
else {
env_delenv(bootvar_device);
}
if (la->la_filename) {
env_setenv(bootvar_file,la->la_filename,ENV_FLG_BUILTIN);
}
else {
env_delenv(bootvar_file);
}
if (la->la_options) {
env_setenv(bootvar_flags,la->la_options,ENV_FLG_BUILTIN);
}
else {
env_delenv(bootvar_flags);
}
/*
* Banzai! Run the program.
*/
if ((la->la_flags & LOADFLG_EXECUTE) &&
(la->la_entrypt != 0)) {
cfe_go(la);
}
return 0;
}
示例13: board_final_init
//.........这里部分代码省略.........
console_read(&ch, 1);
/* Check for Ctrl-C */
if (ch == 3) {
if (laddr)
MFREE(osh, laddr, MAX_SCRIPT_FSIZE);
xprintf("Stopped auto netboot!!!\n");
return;
}
}
if (!res) {
char *bserver, *bfile, *load_ptr;
if (!laddr)
laddr = MALLOC(osh, MAX_SCRIPT_FSIZE);
if (!laddr) {
load_ptr = (char *) 0x00008000;
xprintf("Failed malloc for boot_script, Using :0x%x\n",
(unsigned int)laddr);
}
else {
load_ptr = laddr;
}
bserver = (bserver = env_getenv("BOOT_SERVER"))
? bserver:"192.168.1.1";
if ((bfile = env_getenv("BOOT_FILE"))) {
int len;
if (((len = strlen(bfile)) > 5) &&
!strncmp((bfile + len - 5), "cfesh", 5)) {
cur += sprintf(cur,
"batch -raw -tftp -addr=0x%x -max=0x%x %s:%s;",
(unsigned int)load_ptr,
MAX_SCRIPT_FSIZE, bserver, bfile);
}
if (((len = strlen(bfile)) > 3)) {
if (!strncmp((bfile + len - 3), "elf", 3)) {
cur += sprintf(cur,
"boot -elf -tftp -max=0x5000000 %s:%s;",
bserver, bfile);
}
if (!strncmp((bfile + len - 3), "raw", 3)) {
cur += sprintf(cur,
"boot -raw -z -tftp -addr=0x00008000"
" -max=0x5000000 %s:%s;",
bserver, bfile);
}
}
}
else { /* Make last effort */
cur += sprintf(cur,
"batch -raw -tftp -addr=0x%x -max=0x%x %s:%s;",
(unsigned int)load_ptr, MAX_SCRIPT_FSIZE,
bserver, "cfe_script.cfesh");
cur += sprintf(cur,
"boot -elf -tftp -max=0x5000000 %s:%s;",
bserver, "boot_file.elf");
cur += sprintf(cur,
"boot -raw -z -tftp -addr=0x00008000"
" -max=0x5000000 %s:%s;",
bserver, "boot_file.raw");
}
ui_docommand(buf);
cfe_sleep(3*CFE_HZ);
}
sprintf(buf, "ifconfig eth0 -auto");
res = ui_docommand(buf);
}
#endif /* CFG_ROMBOOT */
}
#if CFG_WL && CFG_WLU && CFG_SIM
if ((ssid = nvram_get("wl0_ssid"))) {
sprintf(buf, "wl join %s", ssid);
ui_docommand(buf);
}
#endif
#if !CFG_SIM
/* Try to run boot_config command if configured.
* make sure to leave space for "go" command.
*/
if ((boot_cfg = nvram_get("boot_config"))) {
if (strlen(boot_cfg) < (sizeof(buf) - sizeof(go_cmd)))
cur += sprintf(cur, "%s;", boot_cfg);
else
printf("boot_config too long, skipping to autoboot\n");
}
/* Boot image */
cur += sprintf(cur, go_cmd);
#endif /* !CFG_SIM */
/* Startup */
if (cur > buf)
env_setenv("STARTUP", buf, ENV_FLG_NORMAL);
}
示例14: main
int
main(void)
{
uint64_t maxmem = 0;
void *heapbase;
int i, err;
struct ps3_devdesc currdev;
struct open_file f;
lv1_get_physmem(&maxmem);
ps3mmu_init(maxmem);
/*
* Set up console.
*/
cons_probe();
/*
* Set the heap to one page after the end of the loader.
*/
heapbase = (void *)(maxmem - 0x80000);
setheap(heapbase, maxmem);
/*
* March through the device switch probing for things.
*/
for (i = 0; devsw[i] != NULL; i++) {
if (devsw[i]->dv_init != NULL) {
err = (devsw[i]->dv_init)();
if (err) {
printf("\n%s: initialization failed err=%d\n",
devsw[i]->dv_name, err);
continue;
}
}
currdev.d_dev = devsw[i];
currdev.d_type = currdev.d_dev->dv_type;
if (strcmp(devsw[i]->dv_name, "cd") == 0) {
f.f_devdata = &currdev;
currdev.d_unit = 0;
if (devsw[i]->dv_open(&f, &currdev) == 0)
break;
}
if (strcmp(devsw[i]->dv_name, "disk") == 0) {
f.f_devdata = &currdev;
currdev.d_unit = 3;
currdev.d_disk.pnum = 1;
currdev.d_disk.ptype = PTYPE_GPT;
if (devsw[i]->dv_open(&f, &currdev) == 0)
break;
}
if (strcmp(devsw[i]->dv_name, "net") == 0)
break;
}
if (devsw[i] == NULL)
panic("No boot device found!");
else
printf("Boot device: %s\n", devsw[i]->dv_name);
/*
* Get timebase at boot.
*/
basetb = mftb();
archsw.arch_getdev = ps3_getdev;
archsw.arch_copyin = ps3_copyin;
archsw.arch_copyout = ps3_copyout;
archsw.arch_readin = ps3_readin;
archsw.arch_autoload = ps3_autoload;
printf("\n");
printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
printf("(%s, %s)\n", bootprog_maker, bootprog_date);
printf("Memory: %lldKB\n", maxmem / 1024);
env_setenv("currdev", EV_VOLATILE, ps3_fmtdev(&currdev),
ps3_setcurrdev, env_nounset);
env_setenv("loaddev", EV_VOLATILE, ps3_fmtdev(&currdev), env_noset,
env_nounset);
setenv("LINES", "24", 1);
setenv("hw.platform", "ps3", 1);
interact(); /* doesn't return */
return (0);
}
示例15: main
int
main(int (*openfirm)(void *))
{
phandle_t root;
int i;
char bootpath[64];
char *ch;
int bargc;
char **bargv;
/*
* Initialize the Open Firmware routines by giving them the entry point.
*/
OF_init(openfirm);
root = OF_finddevice("/");
scells = acells = 1;
OF_getprop(root, "#address-cells", &acells, sizeof(acells));
OF_getprop(root, "#size-cells", &scells, sizeof(scells));
/*
* Initialise the heap as early as possible. Once this is done,
* alloc() is usable. The stack is buried inside us, so this is
* safe.
*/
init_heap();
/*
* Set up console.
*/
cons_probe();
/*
* March through the device switch probing for things.
*/
for (i = 0; devsw[i] != NULL; i++)
if (devsw[i]->dv_init != NULL)
(devsw[i]->dv_init)();
printf("\n");
printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
printf("(%s, %s)\n", bootprog_maker, bootprog_date);
printf("Memory: %lldKB\n", memsize() / 1024);
OF_getprop(chosen, "bootpath", bootpath, 64);
ch = strchr(bootpath, ':');
*ch = '\0';
printf("Booted from: %s\n", bootpath);
printf("\n");
/*
* Only parse the first bootarg if present. It should
* be simple to handle extra arguments
*/
OF_getprop(chosen, "bootargs", bootargs, sizeof(bootargs));
bargc = 0;
parse(&bargc, &bargv, bootargs);
if (bargc == 1)
env_setenv("currdev", EV_VOLATILE, bargv[0], ofw_setcurrdev,
env_nounset);
else
env_setenv("currdev", EV_VOLATILE, bootpath,
ofw_setcurrdev, env_nounset);
env_setenv("loaddev", EV_VOLATILE, bootpath, env_noset,
env_nounset);
setenv("LINES", "24", 1); /* optional */
archsw.arch_getdev = ofw_getdev;
archsw.arch_copyin = ofw_copyin;
archsw.arch_copyout = ofw_copyout;
archsw.arch_readin = ofw_readin;
archsw.arch_autoload = ofw_autoload;
interact(NULL); /* doesn't return */
OF_exit();
return 0;
}