- Geometry fix: pass cylinders to AddVolume() instead of sectors.
[tangerine.git] / rom / dos / boot.c
blob9fe612dde65b588a8cd52fa643fd6eb59df73d0d
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id: boot.c 21768 2004-06-17 21:59:56Z hkiel $
5 Desc: Boot your operating system.
6 Lang: english
7 */
9 #include <exec/types.h>
10 #include <exec/alerts.h>
11 #include <exec/libraries.h>
12 #include <exec/devices.h>
13 #include <exec/execbase.h>
14 #include <aros/libcall.h>
15 #include <aros/asmcall.h>
16 #include <dos/dosextens.h>
17 #include <dos/filesystem.h>
18 #include <libraries/expansionbase.h>
19 #include <utility/tagitem.h>
20 #include <aros/debug.h>
22 #include <proto/exec.h>
23 #include <proto/dos.h>
25 void boot(struct ExecBase *SysBase, BOOL hidds_ok)
27 LONG rc = RETURN_FAIL;
28 BPTR cis;
30 /* We have been created as a process by DOS, we should now
31 try and boot the system. */
33 struct DosLibrary *DOSBase;
35 DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 0);
36 if( DOSBase == NULL )
38 /* BootStrap couldn't open dos.library */
39 Alert(AT_DeadEnd | AN_BootStrap | AG_OpenLib | AO_DOSLib );
42 if (hidds_ok)
43 cis = Open("CON:20/20///Boot Shell/AUTO", FMF_READ);
44 else
45 kprintf("Failed to load system HIDDs\n");
46 if (cis)
48 struct ExpansionBase *ExpansionBase;
49 BPTR sseq = NULL;
50 BOOL opensseq = TRUE;
52 struct TagItem tags[] =
54 { SYS_Asynch, TRUE }, /* 0 */
55 { SYS_Background, FALSE }, /* 1 */
56 { SYS_Input, (IPTR)cis }, /* 2 */
57 { SYS_Output, (IPTR)NULL }, /* 3 */
58 { SYS_Error, (IPTR)NULL }, /* 4 */
59 { SYS_ScriptInput, (IPTR)NULL }, /* 5 */
60 { TAG_DONE, 0 }
63 if ((ExpansionBase = (struct ExpansionBase *)OpenLibrary("expansion.library", 0)) != NULL)
65 opensseq = !(ExpansionBase->Flags & EBF_DOSFLAG);
66 CloseLibrary(ExpansionBase);
69 D(bug("[SubMain] Open Startup Sequence = %d\n", opensseq));
71 if (opensseq)
73 sseq = Open("S:Startup-Sequence", FMF_READ);
74 tags[5].ti_Data = (IPTR)sseq;
77 rc = SystemTagList("", tags);
78 if (rc != -1)
80 cis = NULL;
81 sseq = NULL;
83 else
84 rc = RETURN_FAIL;
85 if (sseq != NULL)
86 Close(sseq);
87 } else
88 kprintf("Cannot open boot console\n");
90 /* We get here when the Boot Shell Window is left with EndShell/EndCli.
91 There's no RemTask() here, otherwise the process cleanup routines
92 are not called. And that would for example mean, that the
93 Boot Process (having a CLI) is not removed from the rootnode.
94 --> Dead stuff in there -> Crash