wok-6.x view linld/stuff/src/LINLD.CPP @ rev 24578

freetype-dev: add pkgconfig folder
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Feb 27 10:47:38 2022 +0000 (2022-02-27)
parents c11594098e34
children 77cae427d6b7
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=topLoad] [cl=cmdline] "
15 #ifdef ISO9660
16 "[iso=file] "
17 #endif
18 "..." NL
19 "\tvga mode: ask,extended,normal or dec/oct/hex number" NL
20 "\t-b baseLoad" NL
21 #ifdef MINRAM
22 "\t-r minRAM" NL
23 #endif
24 #ifdef CPUTYPE
25 "\t-m minCPU family*256+model" NL
26 #endif
27 #ifdef CPU64
28 "\t-64 cpu64 only" NL
29 #endif
30 "Defaults:"
31 "\timage=bzImage"
32 "\tmem=256m"
33 "\tcl=auto"
34 "\t-b 1088k" NL
35 "Use quotes: \"cl=...\" if you need spaces in cmdline" NL
36 "Use cl=@filename to get it from a file"
37 #if 1
38 NL NL "Examples:" NL
39 "\tLINLD "
40 "-b 64m "
41 #ifdef MINRAM
42 "-r 96m "
43 #endif
44 #ifdef CPUTYPE
45 "-m 0x600 "
46 #endif
47 "initrd=rootfs4.gz,rootfs3.gz,rootfs2.gz,rootfs1.gz "
48 "\"cl=root=/dev/null video=-32\""
49 NL "\tLINLD memtest"
50 NL "\tLINLD @args"
51 #endif
52 );
53 }
55 int main(int argc, char *argv[]) {
57 (void) argc;
59 ((u16*) &base_himem)[1] |= (_1m+_64k)>>16; // base_himem = _1m+_64k
60 puts("LINLD v" VERSION_STR "+");
62 // Parse command line
63 if (!*++argv) syntax();
64 const char **clp = &cmdline;
65 do {
66 #ifdef CPU64
67 if ((*(u16 *)*argv|2) == 0x362F) { // -64 /64
68 if (cpuhaslm() == 0) exit();
69 }
70 #endif
71 if (argstr(*argv,"cl|image|initrd" CMDSTR_EXTRA,clp) == (int) clp) continue;
72 if (argnum(*argv,"root|vga|mem|-b|" CMDNUM_EXTRA "-f~"
73 ,&root_dev) >= (int) &base_himem) continue;
74 if (fileexist(*argv) != -1) {
75 kernel_name=*argv;
76 continue;
77 }
78 *clp = (const char *) heap_top +1;
79 strcatb((const char *) heap_top,*argv);
80 } while (*++argv);
81 #ifdef MINRAM
82 if ((minram>>16) > (memtop()>>16)) exit();
83 #endif
84 #ifdef CPUTYPE
85 if (mincpu > cputype) exit();
86 #endif
88 puts(*clp);
89 asm{
90 xchg ax,bx
91 mov bx,offset _heap_top
92 cmp ax,[bx]
93 jc skip
94 mov [bx],ax
95 }
96 skip:
97 #ifdef ISO9660
98 if (isofile) setiso(isofile);
99 #endif
100 set_cmdline(*clp);
101 load_kernel();
102 load_initrd();
103 //boot_kernel();
105 // Let compiler be happy
106 return _AX;
107 }