wok-current view linld/stuff/src/LINLD.CPP @ rev 24564
Add some current_version
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Feb 25 18:06:36 2022 +0000 (2022-02-25) |
parents | 06547d8cf241 |
children | 8db826af003e |
line source
1 // This file is distributed under GPL
2 //
3 // LINLD main() lives here
5 #include "crtl.h"
6 #include "common.h"
7 #include "iso9660.h"
9 extern char bzimagestr[];
10 const char* cmdstr[4] = {"auto",bzimagestr,NULL,NULL};
12 inline void syntax() {
13 die("Syntax:" NL
14 "LINLD [image=file] [initrd=files] [vga=mode] [root=num] [mem=max] [cl=cmdline] "
15 #ifdef ISO9660
16 "[iso=file] "
17 #endif
18 "..." NL
19 "vga mode: ask,extended,normal or dec/oct/hex number" NL
20 #ifdef CPUTYPE
21 "-m mincpu family*256+model" NL
22 #endif
23 #ifdef CPU64
24 "-64 for cpu64 only" NL
25 #endif
26 "Defaults:" NL
27 "\timage=bzImage" NL
28 "\tinitrd,vga,root=(void)" NL
29 "\tmem=256m" NL
30 "\tcl=auto" NL
31 "\t-b 1088k" NL
32 "Use quotes: \"cl=...\" if you need spaces in cmdline" NL
33 "Use cl=@filename to get it from a file"
34 #if 1
35 NL NL "Examples:" NL
36 "\tLINLD "
37 "-b 64m "
38 #ifdef MINRAM
39 "-r 96m "
40 #endif
41 #ifdef CPUTYPE
42 "-m 0x600 "
43 #endif
44 "initrd=rootfs4.gz,rootfs3.gz,rootfs2.gz,rootfs1.gz "
45 "\"cl=root=/dev/null video=-32\""
46 NL "\tLINLD memtest"
47 #endif
48 );
49 }
51 int main(int argc, char *argv[]) {
53 (void) argc;
55 ((u16*) &base_himem)[1] |= (_1m+_64k)>>16; // base_himem = _1m+_64k
56 puts("LINLD v" VERSION_STR "+");
58 // Parse command line
59 if (!*++argv) syntax();
60 const char **clp = &cmdline;
61 do {
62 #ifdef CPU64
63 if ((*(u16 *)*argv|2) == 0x362F) { // -64 /64
64 if (cpuhaslm() == 0) exit();
65 }
66 #endif
67 if (argstr(*argv,"cl|image|initrd" CMDSTR_EXTRA,clp) == (int) clp) continue;
68 if (argnum(*argv,"root|vga|mem|-b|" CMDNUM_EXTRA "-f~"
69 ,&root_dev) >= (int) &base_himem) continue;
70 if (fileexist(*argv) != -1) {
71 kernel_name=*argv;
72 continue;
73 }
74 *clp = (const char *) heap_top +1;
75 strcatb((const char *) heap_top,*argv);
76 } while (*++argv);
77 #ifdef MINRAM
78 if ((minram>>16) > (memtop()>>16) && (minram>>16) != 0) exit();
79 #endif
80 #ifdef CPUTYPE
81 if (mincpu > cputype) exit();
82 #endif
84 puts(*clp);
85 asm{
86 xchg ax,bx
87 mov bx,offset _heap_top
88 cmp ax,[bx]
89 jc skip
90 mov [bx],ax
91 }
92 skip:
93 #ifdef ISO9660
94 if (isofile) setiso(isofile);
95 #endif
96 set_cmdline(*clp);
97 load_kernel();
98 load_initrd();
99 //boot_kernel();
101 // Let compiler be happy
102 return _AX;
103 }