merge from trunk
This commit is contained in:
commit
7d1468e4b6
243 changed files with 8862 additions and 3935 deletions
|
@ -1,116 +0,0 @@
|
|||
#! /bin/sh -e
|
||||
|
||||
# Make GRUB rescue floppy
|
||||
# Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008 Free Software Foundation, Inc.
|
||||
#
|
||||
# GRUB is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# GRUB is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Initialize some variables.
|
||||
transform="@program_transform_name@"
|
||||
|
||||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
bindir=@bindir@
|
||||
libdir=@libdir@
|
||||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
target_cpu=@target_cpu@
|
||||
platform=@platform@
|
||||
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
|
||||
|
||||
# Usage: usage
|
||||
# Print the usage.
|
||||
usage () {
|
||||
cat <<EOF
|
||||
Usage: $0 [OPTION] output_image
|
||||
Make GRUB rescue floppy.
|
||||
|
||||
-h, --help print this message and exit
|
||||
-v, --version print the version information and exit
|
||||
--modules=MODULES pre-load specified modules MODULES
|
||||
--output=FILE save output in FILE
|
||||
|
||||
$0 generates a bootable rescue floppy.
|
||||
|
||||
Report bugs to <bug-grub@gnu.org>.
|
||||
EOF
|
||||
}
|
||||
|
||||
input_dir=${pkglibdir}
|
||||
|
||||
# Check the arguments.
|
||||
for option in "$@"; do
|
||||
case "$option" in
|
||||
-h | --help)
|
||||
usage
|
||||
exit 0 ;;
|
||||
-v | --version)
|
||||
echo "$0 (GNU GRUB ${PACKAGE_VERSION})"
|
||||
exit 0 ;;
|
||||
--modules=*)
|
||||
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
||||
--output=*)
|
||||
output_image=`echo "$option" | sed 's/--output=//'` ;;
|
||||
-*)
|
||||
echo "Unrecognized option \`$option'" 1>&2
|
||||
usage
|
||||
exit 1
|
||||
;;
|
||||
*)
|
||||
if test "x$output_image" != x; then
|
||||
echo "Unrecognized option \`$option'" 1>&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
output_image="${option}" ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "x$output_image" = x; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
aux_dir=`mktemp -d`
|
||||
mkdir -p ${aux_dir}/boot/grub
|
||||
|
||||
for file in ${input_dir}/*.mod ${input_dir}/efiemu??.o \
|
||||
${input_dir}/command.lst ${input_dir}/moddep.lst ${input_dir}/fs.lst \
|
||||
${input_dir}/handler.lst ${input_dir}/parttool.lst; do
|
||||
if test -f "$file"; then
|
||||
cp -f "$file" ${aux_dir}/boot/grub/
|
||||
fi
|
||||
done
|
||||
|
||||
modules="$(cat ${input_dir}/partmap.lst) ${modules}"
|
||||
for i in ${modules} ; do
|
||||
echo "insmod $i"
|
||||
done > ${aux_dir}/boot/grub/grub.cfg
|
||||
|
||||
# build memdisk
|
||||
memdisk_img=`mktemp`
|
||||
tar -C ${aux_dir} -cf ${memdisk_img} boot
|
||||
rm -rf ${aux_dir}
|
||||
|
||||
# build core.img
|
||||
core_img=`mktemp`
|
||||
grub-mkimage -d ${input_dir}/ -m ${memdisk_img} -o ${core_img} memdisk tar biosdisk
|
||||
rm -f ${memdisk_img}
|
||||
|
||||
# build floppy image
|
||||
cat ${input_dir}/boot.img ${core_img} /dev/zero | dd bs=1024 count=1440 > ${output_image}
|
||||
rm -f ${core_img}
|
||||
|
||||
exit 0
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-mkimage.c - make a bootable image */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -33,6 +33,7 @@
|
|||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define _GNU_SOURCE 1
|
||||
#include <getopt.h>
|
||||
|
@ -212,10 +213,17 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
|
|||
|
||||
boot_img = grub_util_read_image (boot_path);
|
||||
|
||||
/* i386 is a little endian architecture. */
|
||||
*((grub_uint16_t *) (boot_img + GRUB_DISK_SECTOR_SIZE
|
||||
- GRUB_BOOT_MACHINE_LIST_SIZE + 8))
|
||||
= grub_cpu_to_le16 (num);
|
||||
{
|
||||
struct grub_boot_blocklist *block;
|
||||
block = (struct grub_boot_blocklist *) (boot_img
|
||||
+ GRUB_DISK_SECTOR_SIZE
|
||||
- sizeof (*block));
|
||||
block->len = grub_host_to_target16 (num);
|
||||
|
||||
/* This is filled elsewhere. Verify it just in case. */
|
||||
assert (block->segment == grub_host_to_target16 (GRUB_BOOT_MACHINE_KERNEL_SEG
|
||||
+ (GRUB_DISK_SECTOR_SIZE >> 4)));
|
||||
}
|
||||
|
||||
grub_util_write_image (boot_img, boot_size, out);
|
||||
free (boot_img);
|
||||
|
@ -351,9 +359,8 @@ main (int argc, char *argv[])
|
|||
FILE *fp = stdout;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
while (1)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* grub-setup.c - make GRUB usable */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1999,2000,2001,2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
|
||||
*
|
||||
* GRUB is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
|
@ -48,6 +48,7 @@ static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_P
|
|||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <dirent.h>
|
||||
#include <assert.h>
|
||||
#include "progname.h"
|
||||
|
||||
#define _GNU_SOURCE 1
|
||||
|
@ -56,14 +57,6 @@ static const grub_gpt_part_type_t grub_gpt_partition_type_bios_boot = GRUB_GPT_P
|
|||
#define DEFAULT_BOOT_FILE "boot.img"
|
||||
#define DEFAULT_CORE_FILE "core.img"
|
||||
|
||||
/* This is the blocklist used in the diskboot image. */
|
||||
struct boot_blocklist
|
||||
{
|
||||
grub_uint64_t start;
|
||||
grub_uint16_t len;
|
||||
grub_uint16_t segment;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
void
|
||||
grub_putchar (int c)
|
||||
{
|
||||
|
@ -99,7 +92,7 @@ setup (const char *dir,
|
|||
grub_uint8_t *boot_drive;
|
||||
grub_disk_addr_t *kernel_sector;
|
||||
grub_uint16_t *boot_drive_check;
|
||||
struct boot_blocklist *first_block, *block;
|
||||
struct grub_boot_blocklist *first_block, *block;
|
||||
grub_int32_t *install_dos_part, *install_bsd_part;
|
||||
grub_int32_t dos_part, bsd_part;
|
||||
char *tmp_img;
|
||||
|
@ -171,7 +164,7 @@ setup (const char *dir,
|
|||
void NESTED_FUNC_ATTR save_blocklists (grub_disk_addr_t sector, unsigned offset,
|
||||
unsigned length)
|
||||
{
|
||||
struct boot_blocklist *prev = block + 1;
|
||||
struct grub_boot_blocklist *prev = block + 1;
|
||||
|
||||
grub_util_info ("saving <%llu,%u,%u> with the segment 0x%x",
|
||||
sector, offset, length, (unsigned) current_segment);
|
||||
|
@ -226,9 +219,9 @@ setup (const char *dir,
|
|||
core_img = grub_util_read_image (core_path);
|
||||
|
||||
/* Have FIRST_BLOCK to point to the first blocklist. */
|
||||
first_block = (struct boot_blocklist *) (core_img
|
||||
+ GRUB_DISK_SECTOR_SIZE
|
||||
- sizeof (*block));
|
||||
first_block = (struct grub_boot_blocklist *) (core_img
|
||||
+ GRUB_DISK_SECTOR_SIZE
|
||||
- sizeof (*block));
|
||||
|
||||
install_dos_part = (grub_int32_t *) (core_img + GRUB_DISK_SECTOR_SIZE
|
||||
+ GRUB_KERNEL_MACHINE_INSTALL_DOS_PART);
|
||||
|
@ -389,10 +382,11 @@ setup (const char *dir,
|
|||
|
||||
/* The first blocklist contains the whole sectors. */
|
||||
first_block->start = grub_cpu_to_le64 (embed_region.start + 1);
|
||||
first_block->len = grub_cpu_to_le16 (core_sectors - 1);
|
||||
first_block->segment
|
||||
= grub_cpu_to_le16 (GRUB_BOOT_MACHINE_KERNEL_SEG
|
||||
+ (GRUB_DISK_SECTOR_SIZE >> 4));
|
||||
|
||||
/* These are filled elsewhere. Verify them just in case. */
|
||||
assert (first_block->len == grub_host_to_target16 (core_sectors - 1));
|
||||
assert (first_block->segment == grub_host_to_target16 (GRUB_BOOT_MACHINE_KERNEL_SEG
|
||||
+ (GRUB_DISK_SECTOR_SIZE >> 4)));
|
||||
|
||||
/* Make sure that the second blocklist is a terminator. */
|
||||
block = first_block - 1;
|
||||
|
@ -641,9 +635,8 @@ main (int argc, char *argv[])
|
|||
int must_embed = 0, force = 0, fs_probe = 1;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
setlocale (LC_ALL, "");
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
/* Check for options. */
|
||||
while (1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue