2 Copyright © 1995-2016, The AROS Development Team. All rights reserved.
5 Desc: Boot your operating system.
9 #include <aros/debug.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/cliinit.h>
18 #include <dos/stdio.h>
19 #include <utility/tagitem.h>
20 #include <libraries/expansionbase.h>
21 #include <proto/exec.h>
22 #include <proto/dos.h>
24 #include "dos_intern.h"
25 #include "../dosboot/bootflags.h"
29 * Load DEVS:system-configuration only on m68k.
30 * Setup pre-2.0 boot disk colors and mouse cursors (for example)
32 #define USE_SYSTEM_CONFIGURATION
36 #ifdef USE_SYSTEM_CONFIGURATION
38 #include <proto/intuition.h>
40 static void load_system_configuration(struct DosLibrary
*DOSBase
)
44 struct Preferences prefs
;
45 struct Library
*IntuitionBase
;
47 fh
= Open("DEVS:system-configuration", MODE_OLDFILE
);
50 len
= Read(fh
, &prefs
, sizeof prefs
);
52 if (len
!= sizeof prefs
)
54 IntuitionBase
= TaggedOpenLibrary(TAGGEDOPEN_INTUITION
);
56 SetPrefs(&prefs
, len
, FALSE
);
57 CloseLibrary(IntuitionBase
);
62 #define load_system_configuration(DOSBase) do { } while (0)
66 extern void BCPL_cliInit(void);
68 void __dos_Boot(struct DosLibrary
*DOSBase
, ULONG BootFlags
, UBYTE Flags
)
72 /* We have been created as a process by DOS, we should now
73 try and boot the system. */
75 D(bug("[__dos_Boot] generic boot sequence, BootFlags 0x%08X Flags 0x%02X\n", BootFlags
, Flags
));
77 /* m68000 uses this to get the default colors and
78 * cursors for Workbench
80 load_system_configuration(DOSBase
);
83 * If needed, run the display drivers loader.
84 * In fact the system must have at least one resident driver,
85 * which will be used for bootmenu etc. However, it we somehow happen
86 * not to have it, this will be our last chance.
88 if ((BootFlags
& (BF_NO_DISPLAY_DRIVERS
| BF_NO_COMPOSITION
)) != (BF_NO_DISPLAY_DRIVERS
| BF_NO_COMPOSITION
))
90 /* Check that it exists first... */
91 BPTR seg
= LoadSeg("C:AROSMonDrvs");
99 * Argument strings MUST contain terminating LF because of ReadItem() bugs.
100 * Their absence causes ReadArgs() crash.
102 if (BootFlags
& BF_NO_COMPOSITION
)
103 args
= "NOCOMPOSITION\n";
104 else if (BootFlags
& BF_NO_DISPLAY_DRIVERS
)
105 args
= "ONLYCOMPOSITION\n";
107 D(bug("[__dos_Boot] Running AROSMonDrvs %s\n", args
));
109 /* RunCommand needs a valid Input() handle
110 * for passing in its arguments.
112 oldin
= SelectInput(Open("NIL:", MODE_OLDFILE
));
113 oldout
= SelectOutput(Open("NIL:", MODE_NEWFILE
));
114 RunCommand(seg
, AROS_STACKSIZE
, args
, strlen(args
));
116 SelectOutput(oldout
);
118 /* We don't care about the return code */
123 if (BootFlags
& BF_EMERGENCY_CONSOLE
) {
124 BootFlags
|= BF_NO_STARTUP_SEQUENCE
;
125 cis
= Open("ECON:", MODE_OLDFILE
);
129 cis
= Open("CON:////AROS/AUTO/CLOSE/SMART/BOOT", MODE_OLDFILE
);
132 BPTR cos
= OpenFromLock(DupLockFromFH(cis
));
133 BYTE
const C
[] = "Copyright © 1995-2016, The AROS Development Team.\n"
134 "Licensed under the AROS Public License.\n"
135 "Version SVN" SVNREV
", built on " ISODATE
".\n";
140 if (!(BootFlags
& BF_NO_STARTUP_SEQUENCE
))
141 cas
= Open("S:Startup-Sequence", MODE_OLDFILE
);
143 /* Inject the banner */
144 if (Flags
& EBF_SILENTSTART
) {
145 if (SetVBuf(cos
, NULL
, BUF_FULL
, sizeof(C
)) == 0) {
147 SetVBuf(cos
, NULL
, BUF_LINE
, -1);
154 NP_Name
, "Initial CLI",
155 SYS_Background
, FALSE
,
159 SYS_ScriptInput
, cas
,
161 Alert(AT_DeadEnd
| AN_BootStrap
);
164 { /* Do not flush cos (show banner) if we got this far, we don't want to
165 * see shell window quickly opening and then immediately closing at
166 * the end of startup-sequence.
168 * There has to be less hacky way..
170 struct FileHandle
*fh
= ((struct FileHandle
*)BADDR(cos
));
171 fh
->fh_Flags
&= ~0x80000000;
174 /* NOTE: 'cas' will already have been closed by the Shell */