1
1
/* grub-mkdevicemap.c - make a device map file automatically */
3
3
* GRUB -- GRand Unified Bootloader
4
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc.
4
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2007 Free Software Foundation, Inc.
6
* GRUB is free software; you can redistribute it and/or modify
6
* GRUB is free software: you can redistribute it and/or modify
7
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or
8
* the Free Software Foundation, either version 3 of the License, or
9
9
* (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
11
* GRUB is distributed in the hope that it will be useful,
12
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
14
* GNU General Public License for more details.
16
16
* You should have received a copy of the GNU General Public License
17
* along with GRUB; if not, write to the Free Software
18
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
21
20
#include <config.h>
35
34
#define _GNU_SOURCE 1
36
35
#include <getopt.h>
39
/* NetBSD uses /boot for its boot block. */
40
# define DEFAULT_DIRECTORY "/grub"
42
# define DEFAULT_DIRECTORY "/boot/grub"
45
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
48
38
# if !defined(__GLIBC__) || \
49
39
((__GLIBC__ < 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 1)))
413
403
if (realpath (discn, name))
415
406
strcat (name, "/disc");
416
fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
407
p = grub_util_get_disk_name (num_hd, name);
408
fprintf (fp, "(%s)\t%s\n", p, name);
431
424
get_ide_disk_name (name, i);
432
425
if (check_device (name))
434
fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
428
p = grub_util_get_disk_name (num_hd, name);
429
fprintf (fp, "(%s)\t%s\n", p, name);
445
441
get_ataraid_disk_name (name, i);
446
442
if (check_device (name))
448
fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
445
p = grub_util_get_disk_name (num_hd, name);
446
fprintf (fp, "(%s)\t%s\n", p, name);
459
458
get_scsi_disk_name (name, i);
460
459
if (check_device (name))
462
fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
462
p = grub_util_get_disk_name (num_hd, name);
463
fprintf (fp, "(%s)\t%s\n", p, name);
482
484
get_dac960_disk_name (name, controller, drive);
483
485
if (check_device (name))
485
fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
488
p = grub_util_get_disk_name (num_hd, name);
489
fprintf (fp, "(%s)\t%s\n", p, name);
500
505
get_i2o_disk_name (name, unit);
501
506
if (check_device (name))
503
fprintf (fp, "(hd%d)\t%s\n", num_hd, name);
509
p = grub_util_get_disk_name (num_hd, name);
510
fprintf (fp, "(%s)\t%s\n", p, name);