2N/A * GRUB -- GRand Unified Bootloader 2N/A * Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010,2011 Free Software Foundation, Inc. 2N/A * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. 2N/A * GRUB is free software: you can redistribute it and/or modify 2N/A * it under the terms of the GNU General Public License as published by 2N/A * the Free Software Foundation, either version 3 of the License, or 2N/A * (at your option) any later version. 2N/A * GRUB is distributed in the hope that it will be useful, 2N/A * but WITHOUT ANY WARRANTY; without even the implied warranty of 2N/A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 2N/A * GNU General Public License for more details. 2N/A * You should have received a copy of the GNU General Public License 2N/A/* On SPARC this program fills in various fields inside of the 'boot' and 'core' 2N/A * The 'boot' image needs to know the OBP path name of the root 2N/A * device. It also needs to know the initial block number of 2N/A * 'core' (which is 'diskboot' concatenated with 'kernel' and 2N/A * all the modules, this is created by grub-mkimage). This resulting 2N/A * 'boot' image is 512 bytes in size and is placed in the second block 2N/A * The initial 'diskboot' block acts as a loader for the actual GRUB 2N/A * kernel. It contains the loading code and then a block list. 2N/A * The block list of 'core' starts at the end of the 'diskboot' image 2N/A * and works it's way backwards towards the end of the code of 'diskboot'. 2N/A * We patch up the images with the necessary values and write out the 2N/A /* FIXME: can this be skipped? */ 2N/A /* Read the boot image by the OS service. */ 2N/A /* Have FIRST_BLOCK to point to the first blocklist. */ 2N/A /* Open the root device and the destination device. */ 2N/A /* Unlike root_dev, with dest_dev we're interested in the partition map even 2N/A if dest_dev itself is a whole disk. */ 2N/A /* NetBSD and OpenBSD subpartitions have metadata inside a partition, 2N/A so they are safe to ignore. 2N/A * sunpc embed function will replace dest_dev->disk->partition with boot slice partition 2N/A * if boot slice is not given on command line 2N/A /* sunpc embed function will replace dest_dev->disk->partition with boot slice partition */ 2N/A /* we don't have grandparent info */ 2N/A /* inside an extended partition. set force_mbr */ 2N/A "forcing MBR update");
2N/A grub_util_warn (_(
"Attempting to install GRUB to a disk with multiple partition labels or both partition label and filesystem. This is not supported yet."));
2N/A grub_util_error (_(
"unable to identify a filesystem in %s; safety check can't be performed"),
2N/A "reserve space for DOS-style boot. Installing GRUB there could " 2N/A "result in FILESYSTEM DESTRUCTION if valuable data is overwritten " 2N/A "by grub-setup (--skip-fs-probe disables this " 2N/A "reserve space for DOS-style boot. Installing GRUB there could " 2N/A "result in FILESYSTEM DESTRUCTION if valuable data is overwritten " 2N/A "by grub-setup (--skip-fs-probe disables this " 2N/A /* Read the original sector from the disk. */ 2N/A /* Copy the possible DOS BPB. */ 2N/A /* If DEST_DRIVE is a hard disk, enable the workaround, which is 2N/A for buggy BIOSes which don't pass boot drive correctly. Instead, 2N/A they pass 0x00 or 0x01 even when booted from 0x80. */ 2N/A /* Replace the jmp (2 bytes) with double nop's. */ 2N/A /* Copy the partition table. */ 2N/A grub_util_warn (_(
"Attempting to install GRUB to a partitionless disk or to a partition. This is a BAD idea."));
2N/A grub_util_warn (_(
"If this is unexpected, the device should be carefully erased to remove all traces of the filesystem before GRUB can be installed"));
2N/A grub_util_warn (_(
"Additionally, multiple partition schemes have been detected. This combination is not supported and GRUB cannot be installed"));
2N/A N_(
"Your embedding area is unusually small. " 2N/A "core.img won't fit in it."));
2N/A /* Clean out the blocklists. */ 2N/A /* Now update the multiboot header with the new size */ 2N/A /* Make sure that the second blocklist is a terminator. */ 2N/A /* Write the core image onto the disk. */ 2N/A "the root device is on a RAID array or LVM volume"));
2N/A "cross-disk install"));
2N/A "setup by using blocklists. However, blocklists are UNRELIABLE and " 2N/A "their use is discouraged."));
2N/A /* The core image must be put on a filesystem unfortunately. */ 2N/A /* Make sure that GRUB reads the identical image as the OS. */ 2N/A : _(
"attempting to read the core image `%s' from GRUB again"),
2N/A grub_util_info (
"succeeded in opening the core image but the size is different (%d != %d)",
2N/A /* Clean out the blocklists. */ 2N/A /* Now read the core image to determine where the sectors are. */ 2N/A /* Write the first two sectors of the core image onto the disk. */ 2N/A /* Write the boot image onto the disk. */ 2N/A {
"boot-image",
'b',
N_(
"FILE"), 0,
2N/A N_(
"Use FILE as the boot image [default=%s]"), 0},
2N/A {
"core-image",
'c',
N_(
"FILE"), 0,
2N/A N_(
"Use FILE as the core image [default=%s]"), 0},
2N/A {
"directory",
'd',
N_(
"DIR"), 0,
2N/A N_(
"Use GRUB files in the directory DIR [default=%s]"), 0},
2N/A {
"device-map",
'm',
N_(
"FILE"), 0,
2N/A N_(
"Use FILE as the device map [default=%s]"), 0},
2N/A {
"root-device",
'r',
N_(
"DEV"), 0,
2N/A N_(
"Use DEV as the root device [default=guessed]"), 0},
2N/A {
"force",
'f', 0, 0,
2N/A N_(
"Install even if problems are detected"), 0},
2N/A {
"skip-fs-probe",
's',0, 0,
2N/A N_(
"Do not probe for filesystems in DEVICE"), 0},
2N/A {
"verbose",
'v', 0, 0,
2N/A N_(
"Print verbose messages."), 0},
2N/A {
"allow-floppy",
'a', 0, 0,
2N/A N_(
"Make the drive also bootable as floppy (default for fdX devices). May break on some BIOSes."), 0},
2N/A {
"force-mbr",
'M', 0, 0,
2N/A N_(
"Write the GRUB2 first stage loader to the MBR regardless of the destination"), 0},
2N/A {
"dry-run",
'n', 0, 0,
2N/A N_(
"Dry run. Do not modify any disks or files"), 0},
2N/A {
"version-string",
'V',
N_(
"STRING"), 0,
2N/A N_(
"Embed the specified version info after the image on disk"), 0},
2N/A { 0, 0, 0, 0, 0, 0 }
2N/A/* Print the version information. */ 2N/A/* Set the bug report address */ 2N/A /* Get the input argument from argp_parse, which we 2N/A know is a pointer to our arguments structure. */ 2N/A /* Too many arguments. */ 2N/ASet up images to boot from DEVICE.\n\ 2N/AYou should not normally run this program directly. Use grub-install instead.")
2N/ADEVICE must be an OS device (e.g. /dev/sda)."),
2N/A /* Default option values. */ 2N/A /* Parse our arguments */ 2N/A /* Initialize the emulated biosdisk driver. */ 2N/A /* Initialize all modules. */ 2N/A /* Possibly, the user specified an OS device file. */ 2N/A /* For simplicity. */ 2N/A "`--root-device'"));
2N/A /* FIXME: we can avoid this on RAID1. */ 2N/A /* Do the real work. */ 2N/A /* Free resources. */