2 Copyright © 1995-2009, The AROS Development Team. All rights reserved.
3 $Id: bootloader_init.c 29778 2008-10-16 19:40:21Z neil $
5 Bootloader information initialisation.
10 #include <aros/debug.h>
11 #include <aros/kernel.h>
12 #include <exec/types.h>
13 #include <exec/memory.h>
14 #include <exec/resident.h>
15 #include <utility/utility.h>
16 #include <utility/tagitem.h>
17 #include <proto/exec.h>
18 #include <proto/bootloader.h>
19 #include <proto/kernel.h>
20 #include <proto/utility.h>
22 #include <aros/symbolsets.h>
23 #include <aros/bootloader.h>
24 #include "bootloader_intern.h"
25 #include LC_LIBDEFS_FILE
29 static int GM_UNIQUENAME(Init
)(LIBBASETYPEPTR BootLoaderBase
)
31 struct TagItem
*bootinfo
;
34 D(bug("[BootLdr] Init\n"));
36 BootLoaderBase
->Flags
= 0;
37 NEWLIST(&(BootLoaderBase
->Args
));
39 bootinfo
= KrnGetBootInfo();
40 BootLoaderBase
->LdrName
= NULL
; /* TODO */
42 Kernel_Args
= (STRPTR
)GetTagData(KRN_CmdLine
, 0, bootinfo
);
47 ULONG len
= strlen(Kernel_Args
) + 1;
49 D(bug("[BootLdr] Kernel arguments: %s\n", Kernel_Args
));
50 /* First make a working copy of the command line */
51 if ((buff
= AllocMem(len
, MEMF_ANY
|MEMF_CLEAR
)))
53 strcpy(buff
,Kernel_Args
);
54 /* remove any leading spaces */
58 /* Split the command line */
59 temp
= strcspn(cmd
," ");
61 D(bug("[BootLdr] Init: Argument %s\n",cmd
));
62 /* Allocate node and insert into list */
63 node
= AllocMem(sizeof(struct Node
),MEMF_ANY
|MEMF_CLEAR
);
65 AddTail(&(BootLoaderBase
->Args
),node
);
66 /* Skip to next part */
67 cmd
= stpblk(cmd
+temp
);
70 BootLoaderBase
->Flags
|= BL_FLAGS_CMDLINE
;
77 ADD2INITLIB(GM_UNIQUENAME(Init
), 0)