]> git.ipfire.org Git - ipfire-2.x.git/blame - src/patches/grub-0.97/force-LBA-off.diff
Neuen Tux von Alex bekommen! Merci beaucoup :D
[ipfire-2.x.git] / src / patches / grub-0.97 / force-LBA-off.diff
CommitLineData
c98e55d8
HS
1diff -ur grub-0.93~/docs/grub.texi grub-0.93/docs/grub.texi
2--- grub-0.93~/docs/grub.texi 2003-02-06 12:30:12.000000000 +0100
3+++ grub-0.93/docs/grub.texi 2003-02-06 14:15:30.000000000 +0100
4@@ -2632,7 +2632,7 @@
5 @node install
6 @subsection install
7
8-@deffn Command install [@option{--force-lba}] [@option{--stage2=os_stage2_file}] stage1_file [@option{d}] dest_dev stage2_file [addr] [@option{p}] [config_file] [real_config_file]
9+@deffn Command install [@option{--force-lba[=off]}] [@option{--stage2=os_stage2_file}] stage1_file [@option{d}] dest_dev stage2_file [addr] [@option{p}] [config_file] [real_config_file]
10 This command is fairly complex, and you should not use this command
11 unless you are familiar with GRUB. Use @command{setup} (@pxref{setup})
12 instead.
13@@ -2679,6 +2679,13 @@
14 bitmap even if they do have the support. So GRUB provides a solution to
15 ignore the wrong bitmap, that is, the option @option{--force-lba}. Don't
16 use this option if you know that your BIOS doesn't have LBA support.
17+On the other hand there is at least one known BIOS that does the opposite,
18+it claims to support LBA and then fails to provide it. Iff you have an
19+Adaptec 2940 with BIOS revision 1.21 ( newer ones just work and older ones
20+don't make the false claim ), or otherwise experience grub hanging
21+after stage1, you can try to use the option @option{--force-lba=off},
22+as long as all disk blocks involved in booting reside
23+within the first 1024 cylinders.
24
25 @strong{Caution3:} You must specify the option @option{--stage2} in the
26 grub shell, if you cannot unmount the filesystem where your stage2 file
27diff -ur grub-0.93~/stage1/stage1.S grub-0.93/stage1/stage1.S
28--- grub-0.93~/stage1/stage1.S 2002-09-08 03:58:08.000000000 +0200
29+++ grub-0.93/stage1/stage1.S 2003-02-06 13:19:50.000000000 +0100
30@@ -163,7 +163,11 @@
31 /* check if AH=0x42 is supported if FORCE_LBA is zero */
32 MOV_MEM_TO_AL(ABS(force_lba)) /* movb ABS(force_lba), %al */
33 testb %al, %al
34+ /* check if LBA is forced OFF 0x80 <= %al <= 0xff */
35+ js chs_mode
36+ /* or forced ON 0x01 <= %al <= 0x7f */
37 jnz lba_mode
38+ /* otherwise trust BIOS int's result */
39 andw $1, %cx
40 jz chs_mode
41
42diff -ur grub-0.93~/stage2/asm.S grub-0.93/stage2/asm.S
43--- grub-0.93~/stage2/asm.S 2003-02-06 12:30:12.000000000 +0100
44+++ grub-0.93/stage2/asm.S 2003-02-06 13:35:32.000000000 +0100
45@@ -1083,7 +1083,11 @@
46 /* check if AH=0x42 is supported if FORCE_LBA is zero */
47 movb EXT_C(force_lba), %al
48 testb %al, %al
49+ /* check if LBA is forced OFF 0x80 <= %al <= 0xff */
50+ js 1f
51+ /* or forced ON 0x01 <= %al <= 0x7f */
52 jnz 2f
53+ /* otherwise trust BIOS int's result */
54 andw $1, %cx
55 jnz 2f
56
57diff -ur grub-0.93~/stage2/builtins.c grub-0.93/stage2/builtins.c
58--- grub-0.93~/stage2/builtins.c 2003-02-06 12:30:12.000000000 +0100
59+++ grub-0.93/stage2/builtins.c 2003-02-06 13:56:01.000000000 +0100
60@@ -1832,7 +1832,12 @@
61 /* First, check the GNU-style long option. */
62 while (1)
63 {
64- if (grub_memcmp ("--force-lba", arg, sizeof ("--force-lba") - 1) == 0)
65+ if (grub_memcmp ("--force-lba=off", arg, sizeof ("--force-lba=off") - 1) == 0)
66+ {
67+ is_force_lba = 0xff;
68+ arg = skip_to (0, arg);
69+ }
70+ else if (grub_memcmp ("--force-lba", arg, sizeof ("--force-lba") - 1) == 0)
71 {
72 is_force_lba = 1;
73 arg = skip_to (0, arg);
74@@ -2253,7 +2258,7 @@
75 "install",
76 install_func,
77 BUILTIN_CMDLINE,
78- "install [--stage2=STAGE2_FILE] [--force-lba] STAGE1 [d] DEVICE STAGE2 [ADDR] [p] [CONFIG_FILE] [REAL_CONFIG_FILE]",
79+ "install [--stage2=STAGE2_FILE] [--force-lba[=off]] STAGE1 [d] DEVICE STAGE2 [ADDR] [p] [CONFIG_FILE] [REAL_CONFIG_FILE]",
80 "Install STAGE1 on DEVICE, and install a blocklist for loading STAGE2"
81 " as a Stage 2. If the option `d' is present, the Stage 1 will always"
82 " look for the disk where STAGE2 was installed, rather than using"
83@@ -2266,8 +2271,9 @@
84 " 1.5 and REAL_CONFIG_FILE is present, then the Stage 2 CONFIG_FILE is"
85 " patched with the configuration filename REAL_CONFIG_FILE."
86 " If the option `--force-lba' is specified, disable some sanity checks"
87- " for LBA mode. If the option `--stage2' is specified, rewrite the Stage"
88- " 2 via your OS's filesystem instead of the raw device."
89+ " for LBA mode, `--force-lba=off' will disable it completely. If the"
90+ " option `--stage2' is specified, rewrite the Stage 2 via your OS's"
91+ " filesystem instead of the raw device."
92 };
93
94 \f
95@@ -3898,7 +3904,12 @@
96 /* Check if the user specifies --force-lba. */
97 while (1)
98 {
99- if (grub_memcmp ("--force-lba", arg, sizeof ("--force-lba") - 1) == 0)
100+ if (grub_memcmp ("--force-lba=off", arg, sizeof ("--force-lba=off") - 1) == 0)
101+ {
102+ is_force_lba = 0xff;
103+ arg = skip_to (0, arg);
104+ }
105+ else if (grub_memcmp ("--force-lba", arg, sizeof ("--force-lba") - 1) == 0)
106 {
107 is_force_lba = 1;
108 arg = skip_to (0, arg);
109@@ -4026,7 +4037,9 @@
110 #if 1
111 /* Don't embed a drive number unnecessarily. */
112 grub_sprintf (cmd_arg, "%s%s%s%s %s%s %s p %s %s",
113- is_force_lba? "--force-lba " : "",
114+ is_force_lba ?
115+ (is_force_lba == 0xff ? "--force-lba=off " : "--force-lba ")
116+ : "",
117 stage2_arg? stage2_arg : "",
118 stage2_arg? " " : "",
119 stage1,
120@@ -4079,17 +4092,18 @@
121 "setup",
122 setup_func,
123 BUILTIN_CMDLINE | BUILTIN_HELP_LIST,
124- "setup [--prefix=DIR] [--stage2=STAGE2_FILE] [--force-lba] INSTALL_DEVICE [IMAGE_DEVICE]",
125+ "setup [--prefix=DIR] [--stage2=STAGE2_FILE] [--force-lba[=off]] INSTALL_DEVICE [IMAGE_DEVICE]",
126 "Set up the installation of GRUB automatically. This command uses"
127 " the more flexible command \"install\" in the backend and installs"
128 " GRUB into the device INSTALL_DEVICE. If IMAGE_DEVICE is specified,"
129 " then find the GRUB images in the device IMAGE_DEVICE, otherwise"
130 " use the current \"root device\", which can be set by the command"
131 " \"root\". If you know that your BIOS should support LBA but GRUB"
132- " doesn't work in LBA mode, specify the option `--force-lba'."
133- " If you install GRUB under the grub shell and you cannot unmount the"
134- " partition where GRUB images reside, specify the option `--stage2'"
135- " to tell GRUB the file name under your OS."
136+ " doesn't work in LBA mode, specify the option `--force-lba'. If the"
137+ " BIOS claims to support LBA mode but really doesn't, use"
138+ " `--force-lba=off'. If you install GRUB under the grub shell and"
139+ " you cannot unmount the partition where GRUB images reside, specify"
140+ " the option `--stage2' to tell GRUB the file name under your OS."
141 };
142
143 \f