wok-current view linld/stuff/load.u @ rev 19204

linld/tobzimage: add realmode_switch support (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jun 11 20:26:42 2016 +0200 (2016-06-11)
parents df58e6c974a3
children 8c67051bb198
line source
1 --- LINLD097/LOAD.CPP
2 +++ LINLD097/LOAD.CPP
3 @@ -400,10 +400,8 @@
5 if(first1k->boot_flag != 0xAA55)
6 die("No boot signature (55,AA). It's not a kernel");
7 - if(first1k->header != HdrS)
8 - die("No 'HdrS' signature (kernel is too old)");
9 - if(first1k->version < 0x202)
10 - die("Loader protocol version is less than 2.02 (kernel is too old)");
11 + if(first1k->header != HdrS) // starting linux 1.3.73
12 + die("No 'HdrS' signature (kernel is too old, try /usr/bin/tobzimage)");
13 if(!(first1k->loadflags & 0x01))
14 die("I can't load bzImages low");
16 @@ -414,15 +412,23 @@
17 // Tell rm loader some info
19 first1k->vid_mode = vid_mode;
20 - first1k->cmd_line_ptr = 0x98000;
21 + if(first1k->version >= 0x202) { // starting linux 2.4.0-test3-pre3
22 + first1k->cmd_line_ptr = 0x98000;
23 + }
24 + else {
25 + first1k->cl_magic = 0xA33F;
26 + first1k->cl_ofs = 0x8000;
27 + }
28 first1k->type_of_loader = 0xff; // kernel do not know us (yet :-)
29 // * will be called just before rm -> pm
30 first1k->realmode_switch_ofs = ofs(last_ditch);
31 first1k->realmode_switch_seg = seg(last_ditch);
32 - // * offset limit of the setup heap
33 - // heap_end_ptr appears to be relative to the start of setup (ofs 0x0200)
34 - first1k->heap_end_ptr = _32k-0x0200;
35 - first1k->loadflags |= 0x80; // says to rm loader it's ok to use heap
36 + if(first1k->version >= 0x201) {
37 + // * offset limit of the setup heap
38 + // heap_end_ptr appears to be relative to the start of setup (ofs 0x0200)
39 + first1k->heap_end_ptr = _32k-0x0200;
40 + first1k->loadflags |= 0x80; // says to rm loader it's ok to use heap
41 + }
42 // * if we will ever stop moving ourself to 0x90000
43 // we must say setup.S how much to move
44 //first1k->setup_move_size = _32k;