2 Copyright © 1995-2006, The AROS Development Team. All rights reserved.
5 Bootloader information initialisation.
9 #include <aros/debug.h>
11 #include <exec/types.h>
12 #include <exec/memory.h>
13 #include <exec/resident.h>
14 #include <utility/utility.h>
15 #include <utility/tagitem.h>
16 #include <proto/exec.h>
17 #include <proto/bootloader.h>
18 #include <proto/utility.h>
19 #include <proto/kernel.h>
21 #include <aros/symbolsets.h>
22 #include <aros/bootloader.h>
23 #include <aros/kernel.h>
24 #include "bootloader_intern.h"
25 #include LC_LIBDEFS_FILE
29 static int GM_UNIQUENAME(Init
)(LIBBASETYPEPTR BootLoaderBase
)
31 void *KernelBase
= OpenResource("kernel.resource");
32 struct TagItem
*msg
= KrnGetBootInfo();
35 BootLoaderBase
->Flags
= 0;
37 NEWLIST(&(BootLoaderBase
->Args
));
38 NEWLIST(&(BootLoaderBase
->DriveInfo
));
40 D(bug("[BootLdr] Init. msg=%p\n", msg
));
42 /* Right. Now we extract the data currently placed in 0x1000 by exec */
45 BootLoaderBase
->LdrName
= "UBootSecondLevelBootloader";
46 BootLoaderBase
->Flags
|= MB_FLAGS_LDRNAME
;
48 tmp
= GetTagData(KRN_CmdLine
, 0, msg
);
49 D(bug("[BootLdr] KRN_CmdLine=%p\n", tmp
));
56 D(bug("[BootLdr] CmdLine=\"%s\"\n", (STRPTR
)tmp
));
58 /* First make a working copy of the command line */
59 if ((buff
= AllocMem(200,MEMF_ANY
|MEMF_CLEAR
)))
61 strncpy(buff
, (STRPTR
)tmp
, 200);
62 /* remove any leading spaces */
66 /* Split the command line */
67 temp
= strcspn(cmd
," ");
69 D(bug("[BootLdr] Init: Argument %s\n",cmd
));
70 /* Allocate node and insert into list */
71 node
= AllocMem(sizeof(struct Node
),MEMF_ANY
|MEMF_CLEAR
);
73 AddTail(&(BootLoaderBase
->Args
),node
);
74 /* Skip to next part */
75 cmd
= stpblk(cmd
+temp
);
78 BootLoaderBase
->Flags
|= MB_FLAGS_CMDLINE
;
85 ADD2INITLIB(GM_UNIQUENAME(Init
), 0)