Added support for zip files.
[cake.git] / rom / dosboot / boot.c
blob339bbf0bc74ab2a31f3cc82098753e8957d48d77
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 #define DEBUG 0
10 #include <aros/debug.h>
12 #include <exec/types.h>
13 #include <exec/alerts.h>
14 #include <exec/libraries.h>
15 #include <exec/devices.h>
16 #include <exec/execbase.h>
17 #include <aros/libcall.h>
18 #include <aros/asmcall.h>
19 #include <dos/dosextens.h>
20 #include <dos/filesystem.h>
21 #include <libraries/expansionbase.h>
22 #include <utility/tagitem.h>
24 #include <proto/exec.h>
25 #include <proto/dos.h>
27 void __dosboot_Boot(struct ExecBase *SysBase, BOOL hidds_ok)
29 LONG rc = RETURN_FAIL;
30 BPTR cis = NULL;
32 /* We have been created as a process by DOS, we should now
33 try and boot the system. */
35 struct DosLibrary *DOSBase;
36 D(bug("[DOSBoot] __dosboot_Boot()\n"));
38 DOSBase = (struct DosLibrary *)OpenLibrary("dos.library", 0);
39 if( DOSBase == NULL )
41 /* BootStrap couldn't open dos.library */
42 Alert(AT_DeadEnd | AN_BootStrap | AG_OpenLib | AO_DOSLib );
45 if (hidds_ok)
46 cis = Open("CON:20/20///Boot Shell/AUTO", FMF_READ);
47 else
48 kprintf("Failed to load system HIDDs\n");
49 if (cis)
51 struct ExpansionBase *ExpansionBase;
52 BPTR sseq = NULL;
53 BOOL opensseq = TRUE;
55 struct TagItem tags[] =
57 { SYS_Asynch, TRUE }, /* 0 */
58 { SYS_Background, FALSE }, /* 1 */
59 { SYS_Input, (IPTR)cis }, /* 2 */
60 { SYS_Output, (IPTR)NULL }, /* 3 */
61 { SYS_Error, (IPTR)NULL }, /* 4 */
62 { SYS_ScriptInput, (IPTR)NULL }, /* 5 */
63 { TAG_DONE, 0 }
66 if ((ExpansionBase = (struct ExpansionBase *)OpenLibrary("expansion.library", 0)) != NULL)
68 opensseq = !(ExpansionBase->Flags & EBF_DOSFLAG);
69 CloseLibrary(ExpansionBase);
72 D(bug("[DOSBoot] __dosboot_Boot: Open Startup Sequence = %d\n", opensseq));
74 if (opensseq)
76 sseq = Open("S:Startup-Sequence", FMF_READ);
77 tags[5].ti_Data = (IPTR)sseq;
79 else
81 tags[5].ti_Tag = TAG_IGNORE;
84 rc = SystemTagList("", tags);
85 if (rc != -1)
87 cis = NULL;
88 sseq = NULL;
90 else
91 rc = RETURN_FAIL;
92 if (sseq != NULL)
93 Close(sseq);
94 } else
95 kprintf("Cannot open boot console\n");
97 /* We get here when the Boot Shell Window is left with EndShell/EndCli.
98 There's no RemTask() here, otherwise the process cleanup routines
99 are not called. And that would for example mean, that the
100 Boot Process (having a CLI) is not removed from the rootnode.
101 --> Dead stuff in there -> Crash