1*979b72c6Sdholland /* $NetBSD: boot.c,v 1.10 2016/06/11 06:20:11 dholland Exp $ */
29a628842Schuck
39a628842Schuck /*-
49a628842Schuck * Copyright (c) 1982, 1986, 1990, 1993
59a628842Schuck * The Regents of the University of California. All rights reserved.
69a628842Schuck *
79a628842Schuck * Redistribution and use in source and binary forms, with or without
89a628842Schuck * modification, are permitted provided that the following conditions
99a628842Schuck * are met:
109a628842Schuck * 1. Redistributions of source code must retain the above copyright
119a628842Schuck * notice, this list of conditions and the following disclaimer.
129a628842Schuck * 2. Redistributions in binary form must reproduce the above copyright
139a628842Schuck * notice, this list of conditions and the following disclaimer in the
149a628842Schuck * documentation and/or other materials provided with the distribution.
15aad01611Sagc * 3. Neither the name of the University nor the names of its contributors
169a628842Schuck * may be used to endorse or promote products derived from this software
179a628842Schuck * without specific prior written permission.
189a628842Schuck *
199a628842Schuck * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
209a628842Schuck * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
219a628842Schuck * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
229a628842Schuck * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
239a628842Schuck * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
249a628842Schuck * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
259a628842Schuck * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
269a628842Schuck * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
279a628842Schuck * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
289a628842Schuck * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
299a628842Schuck * SUCH DAMAGE.
309a628842Schuck *
319a628842Schuck * @(#)boot.c 8.1 (Berkeley) 6/10/93
329a628842Schuck */
339a628842Schuck
349a628842Schuck #include <sys/param.h>
359a628842Schuck #include <sys/reboot.h>
369a628842Schuck
379a628842Schuck #include <machine/prom.h>
389a628842Schuck
39e63501d2Sjunyoung #include <lib/libsa/stand.h>
409a628842Schuck #include "libsa.h"
419a628842Schuck
429a628842Schuck int debug;
439a628842Schuck int errno;
449a628842Schuck
45921705c3Sjdolecek extern char bootprog_name[], bootprog_rev[];
469a628842Schuck char defname[32] = "2";
479a628842Schuck char line[80];
489a628842Schuck
49921705c3Sjdolecek int main(void);
509a628842Schuck
51921705c3Sjdolecek int
main(void)52a07f7c80Stsutsui main(void)
539a628842Schuck {
54921705c3Sjdolecek char *file;
55921705c3Sjdolecek int flag, part;
569a628842Schuck
57921705c3Sjdolecek printf(">> %s MVME%x tapeboot [%s]\n",
58921705c3Sjdolecek bootprog_name, bugargs.cputyp, bootprog_rev);
599a628842Schuck
602688608cSscw parse_args(&file, &flag, &part);
619a628842Schuck file = defname; /* override */
629a628842Schuck
639a628842Schuck if (flag & RB_ASKNAME) {
649a628842Schuck printf("tapeboot: segment? [%s] ", defname);
65*979b72c6Sdholland kgets(line, sizeof(line));
669a628842Schuck if (line[0])
679a628842Schuck file = line;
689a628842Schuck }
699a628842Schuck
70d22256f1Sscw exec_mvme(file, flag | RB_NOSYM, part);
719a628842Schuck
729a628842Schuck printf("tapeboot: %s: %s\n", file, strerror(errno));
73a07f7c80Stsutsui return 0;
749a628842Schuck }
75