/[grub]/grub2/util/i386/pc/grub-setup.c
ViewVC logotype

Diff of /grub2/util/i386/pc/grub-setup.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.9 by marco_g, Sat Dec 4 18:45:46 2004 UTC revision 1.10 by okuji, Sun Jul 17 14:57:07 2005 UTC
# Line 1  Line 1 
1  /* grub-setup.c - make GRUB usable */  /* grub-setup.c - make GRUB usable */
2  /*  /*
3   *  GRUB  --  GRand Unified Bootloader   *  GRUB  --  GRand Unified Bootloader
4   *  Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.   *  Copyright (C) 1999,2000,2001,2002,2003,2004,2005 Free Software Foundation, Inc.
5   *   *
6   *  GRUB is free software; you can redistribute it and/or modify   *  GRUB is free software; you can redistribute it and/or modify
7   *  it under the terms of the GNU General Public License as published by   *  it under the terms of the GNU General Public License as published by
# Line 86  setup (const char *prefix, const char *d Line 86  setup (const char *prefix, const char *d
86    grub_device_t root_dev, dest_dev;    grub_device_t root_dev, dest_dev;
87    grub_uint8_t *boot_drive;    grub_uint8_t *boot_drive;
88    grub_uint32_t *kernel_sector;    grub_uint32_t *kernel_sector;
89      grub_uint16_t *boot_drive_check;
90    struct boot_blocklist *first_block, *block;    struct boot_blocklist *first_block, *block;
91    grub_int32_t *install_dos_part, *install_bsd_part;    grub_int32_t *install_dos_part, *install_bsd_part;
92    char *install_prefix;    char *install_prefix;
# Line 168  setup (const char *prefix, const char *d Line 169  setup (const char *prefix, const char *d
169    boot_img = grub_util_read_image (boot_path);    boot_img = grub_util_read_image (boot_path);
170    free (boot_path);    free (boot_path);
171    
172    /* Set the addresses of BOOT_DRIVE and KERNEL_SECTOR.  */    /* Set the addresses of BOOT_DRIVE, KERNEL_SECTOR and BOOT_DRIVE_CHECK.  */
173    boot_drive = (grub_uint8_t *) (boot_img + GRUB_BOOT_MACHINE_BOOT_DRIVE);    boot_drive = (grub_uint8_t *) (boot_img + GRUB_BOOT_MACHINE_BOOT_DRIVE);
174    kernel_sector = (grub_uint32_t *) (boot_img    kernel_sector = (grub_uint32_t *) (boot_img
175                                       + GRUB_BOOT_MACHINE_KERNEL_SECTOR);                                       + GRUB_BOOT_MACHINE_KERNEL_SECTOR);
176      boot_drive_check = (grub_uint16_t *) (boot_img
177                                            + GRUB_BOOT_MACHINE_DRIVE_CHECK);
178        
179    core_path = grub_util_get_path (dir, core_file);    core_path = grub_util_get_path (dir, core_file);
180    core_size = grub_util_get_image_size (core_path);    core_size = grub_util_get_image_size (core_path);
# Line 228  setup (const char *prefix, const char *d Line 231  setup (const char *prefix, const char *d
231    
232    free (tmp_img);    free (tmp_img);
233        
234      /* If DEST_DRIVE is a hard disk, enable the workaround, which is
235         for buggy BIOSes which don't pass boot drive correctly. Instead,
236         they pass 0x00 or 0x01 even when booted from 0x80.  */
237      if (dest_dev->disk->id & 0x80)
238        /* Replace the jmp (2 bytes) with double nop's.  */
239        *boot_drive_check = 0x9090;
240      
241    /* If the destination device can have partitions and it is the MBR,    /* If the destination device can have partitions and it is the MBR,
242       try to embed the core image into after the MBR.  */       try to embed the core image into after the MBR.  */
243    if (dest_dev->disk->has_partitions && ! dest_dev->disk->partition)    if (dest_dev->disk->has_partitions && ! dest_dev->disk->partition)

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26