File grub-0.97-128-drives-support.patch of Package grub
From 4f9000267ec45b611efd3c90f875cde09e71d511 Mon Sep 17 00:00:00 2001
From: Jan Holcapek <holcapek@gmail.com>
Date: Wed, 7 Oct 2009 07:23:13 -0400
Subject: [PATCH] Patch allowing GRUB for recognizing up to 128 hard drives.
GRUB can't recognize, ie. can't be installed and load stage2 loader off
the 9th and further HDD. This patch allows them to do so.
---
stage2/builtins.c | 2 +-
stage2/disk_io.c | 4 ++--
stage2/shared.h | 4 +++-
3 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/stage2/builtins.c b/stage2/builtins.c
index 6c6e3fa..02a35a9 100644
--- a/stage2/builtins.c
+++ b/stage2/builtins.c
@@ -1508,7 +1508,7 @@ find_func (char *arg, int flags)
}
/* Hard disks. */
- for (drive = 0x80; drive < 0x88; drive++)
+ for (drive = 0x80; drive < (0x80 + MAX_HD_NUM); drive++)
{
unsigned long part = 0xFFFFFF;
unsigned long start, len, offset, ext_offset, gpt_offset;
diff --git a/stage2/disk_io.c b/stage2/disk_io.c
index e07ca77..dbf95f5 100644
--- a/stage2/disk_io.c
+++ b/stage2/disk_io.c
@@ -411,7 +411,7 @@ sane_partition (void)
return 1;
if (!(current_partition & 0xFF000000uL)
- && ((current_drive & 0xFFFFFF7F) < 8
+ && ((current_drive & 0xFFFFFF7F) < MAX_HD_NUM
|| current_drive == cdrom_drive)
&& (current_partition & 0xFF) == 0xFF
&& ((current_partition & 0xFF00) == 0xFF00
@@ -1495,7 +1495,7 @@ print_completions (int is_filename, int is_completion)
i < (ptr && (*(ptr-1) == 'd' && *(ptr-2) == 'f') ? 1:2);
i++)
{
- for (j = 0; j < 8; j++)
+ for (j = 0; j < MAX_HD_NUM; j++)
{
disk_no = (i * 0x80) + j;
if ((disk_choice || disk_no == current_drive)
diff --git a/stage2/shared.h b/stage2/shared.h
index 587f9a1..3d1735c 100644
--- a/stage2/shared.h
+++ b/stage2/shared.h
@@ -80,6 +80,8 @@ extern void *grub_scratch_mem;
#define BIOSDISK_FLAG_LBA_EXTENSION 0x1
#define BIOSDISK_FLAG_CDROM 0x2
+#define MAX_HD_NUM 128
+
/*
* This is the filesystem (not raw device) buffer.
* It is 32K in size, do not overrun!
@@ -128,7 +130,7 @@ extern void *grub_scratch_mem;
#define MENU_BUFLEN (0x8000 + PASSWORD_BUF - MENU_BUF)
/* The size of the drive map. */
-#define DRIVE_MAP_SIZE 8
+#define DRIVE_MAP_SIZE 128
/* The size of the key map. */
#define KEY_MAP_SIZE 128
--
1.7.6