merge mainline into crypto
This commit is contained in:
commit
ba136b293a
165 changed files with 4910 additions and 1858 deletions
|
@ -488,7 +488,7 @@ grub_util_is_dmraid (const char *os_dev)
|
|||
}
|
||||
|
||||
int
|
||||
grub_util_get_dev_abstraction (const char *os_dev UNUSED)
|
||||
grub_util_get_dev_abstraction (const char *os_dev __attribute__((unused)))
|
||||
{
|
||||
#ifdef __linux__
|
||||
/* Check for LVM. */
|
||||
|
@ -546,7 +546,7 @@ grub_util_get_grub_dev (const char *os_dev)
|
|||
if (q)
|
||||
*q = ',';
|
||||
|
||||
asprintf (&grub_dev, "md%s", p);
|
||||
grub_dev = xasprintf ("md%s", p);
|
||||
free (p);
|
||||
}
|
||||
else if (os_dev[7] == '/' && os_dev[8] == 'd')
|
||||
|
@ -561,7 +561,7 @@ grub_util_get_grub_dev (const char *os_dev)
|
|||
if (q)
|
||||
*q = ',';
|
||||
|
||||
asprintf (&grub_dev, "md%s", p);
|
||||
grub_dev = xasprintf ("md%s", p);
|
||||
free (p);
|
||||
}
|
||||
else if (os_dev[7] >= '0' && os_dev[7] <= '9')
|
||||
|
@ -574,7 +574,7 @@ grub_util_get_grub_dev (const char *os_dev)
|
|||
if (q)
|
||||
*q = ',';
|
||||
|
||||
asprintf (&grub_dev, "md%s", p);
|
||||
grub_dev = xasprintf ("md%s", p);
|
||||
free (p);
|
||||
}
|
||||
else if (os_dev[7] == '/' && os_dev[8] >= '0' && os_dev[8] <= '9')
|
||||
|
@ -587,7 +587,7 @@ grub_util_get_grub_dev (const char *os_dev)
|
|||
if (q)
|
||||
*q = ',';
|
||||
|
||||
asprintf (&grub_dev, "md%s", p);
|
||||
grub_dev = xasprintf ("md%s", p);
|
||||
free (p);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -107,7 +107,7 @@ create_envblk_file (const char *name)
|
|||
if (! buf)
|
||||
grub_util_error ("out of memory");
|
||||
|
||||
asprintf (&namenew, "%s.new", name);
|
||||
namenew = xasprintf ("%s.new", name);
|
||||
fp = fopen (namenew, "wb");
|
||||
if (! fp)
|
||||
grub_util_error ("cannot open the file %s", namenew);
|
||||
|
|
|
@ -85,7 +85,7 @@ execute_command (char *name, int n, char **args)
|
|||
|
||||
#define BUF_SIZE 32256
|
||||
|
||||
static grub_off_t skip, leng;
|
||||
static grub_disk_addr_t skip, leng;
|
||||
|
||||
static void
|
||||
read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len))
|
||||
|
@ -140,7 +140,7 @@ read_file (char *pathname, int (*hook) (grub_off_t ofs, char *buf, int len))
|
|||
|
||||
if (skip > file->size)
|
||||
{
|
||||
grub_util_error ("invalid skip value %d.");
|
||||
grub_util_error ("invalid skip value %lld.", (unsigned long long) skip);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -144,13 +144,9 @@ case x${GRUB_TERMINAL_OUTPUT} in
|
|||
x | xgfxterm)
|
||||
# If this platform supports gfxterm, try to use it.
|
||||
if test -e ${grub_prefix}/gfxterm.mod ; then
|
||||
GRUB_VIDEO_BACKEND=
|
||||
for i in vbe ; do
|
||||
if test -e ${grub_prefix}/$i.mod ; then
|
||||
GRUB_VIDEO_BACKEND=$i
|
||||
break
|
||||
fi
|
||||
done
|
||||
# FIXME: this should do something smarter than just loading first
|
||||
# video backend.
|
||||
GRUB_VIDEO_BACKEND=$(head -n 1 ${grub_prefix}/video.lst || true)
|
||||
if [ -n "${GRUB_VIDEO_BACKEND}" ] ; then
|
||||
GRUB_TERMINAL_OUTPUT=gfxterm
|
||||
elif [ "${GRUB_TERMINAL_OUTPUT}" = "gfxterm" ] ; then
|
||||
|
|
|
@ -24,8 +24,12 @@ bindir=@bindir@
|
|||
sbindir=@sbindir@
|
||||
pkgdatadir=${datadir}/`echo @PACKAGE_TARNAME@ | sed "${transform}"`
|
||||
|
||||
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
|
||||
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
|
||||
if test "x$grub_probe" = x; then
|
||||
grub_probe=${sbindir}/`echo grub-probe | sed ${transform}`
|
||||
fi
|
||||
if test "x$grub_mkrelpath" = x; then
|
||||
grub_mkrelpath=${bindir}/`echo grub-mkrelpath | sed ${transform}`
|
||||
fi
|
||||
|
||||
grub_warn ()
|
||||
{
|
||||
|
|
|
@ -366,8 +366,8 @@ write_font (struct grub_font_info *font_info, char *output_file)
|
|||
if (! style_name[0])
|
||||
strcpy (style_name, " Regular");
|
||||
|
||||
asprintf (&font_name, "%s %s %d", font_info->name, &style_name[1],
|
||||
font_info->size);
|
||||
font_name = xasprintf ("%s %s %d", font_info->name, &style_name[1],
|
||||
font_info->size);
|
||||
|
||||
write_string_section ("NAME", font_name, &offset, file);
|
||||
write_string_section ("FAMI", font_info->name, &offset, file);
|
||||
|
|
|
@ -27,6 +27,7 @@ static struct option options[] =
|
|||
{
|
||||
{"help", no_argument, 0, 'h'},
|
||||
{"version", no_argument, 0, 'V'},
|
||||
{0, 0, 0, 0},
|
||||
};
|
||||
|
||||
static void
|
||||
|
|
|
@ -94,8 +94,7 @@ process_input_dir ()
|
|||
platform="$2"
|
||||
mkdir -p ${iso9660_dir}/boot/grub/${target_cpu}-${platform}
|
||||
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
|
||||
${input_dir}/*.lst; do
|
||||
if test -f "$file"; then
|
||||
cp -f "$file" ${iso9660_dir}/boot/grub/${target_cpu}-${platform}/
|
||||
fi
|
||||
|
@ -128,7 +127,7 @@ fi
|
|||
|
||||
# build coreboot core.img
|
||||
if test -e "${coreboot_dir}" ; then
|
||||
echo "Generates coreboot"
|
||||
echo "Enabling coreboot support ..."
|
||||
memdisk_img=`mktemp`
|
||||
memdisk_dir=`mktemp -d`
|
||||
mkdir -p ${memdisk_dir}/boot/grub
|
||||
|
@ -155,14 +154,17 @@ EOF
|
|||
grub_mkisofs_arguments="${grub_mkisofs_arguments} --modification-date=$(echo ${iso_uuid} | sed -e s/-//g)"
|
||||
fi
|
||||
|
||||
# build eltorito core.img
|
||||
# build BIOS core.img
|
||||
if test -e "${pc_dir}" ; then
|
||||
echo "Generates eltorito"
|
||||
echo "Enabling BIOS support ..."
|
||||
core_img=`mktemp`
|
||||
grub-mkimage -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \
|
||||
memdisk tar search iso9660 configfile sh \
|
||||
biosdisk
|
||||
iso9660 biosdisk
|
||||
cat ${pc_dir}/cdboot.img ${core_img} > ${iso9660_dir}/boot/grub/i386-pc/eltorito.img
|
||||
|
||||
embed_img=`mktemp`
|
||||
cat ${pc_dir}/boot.img ${core_img} > ${embed_img}
|
||||
|
||||
rm -f ${core_img}
|
||||
|
||||
modules="$(cat ${pc_dir}/partmap.lst) ${modules}"
|
||||
|
@ -172,11 +174,14 @@ if test -e "${pc_dir}" ; then
|
|||
echo "source /boot/grub/grub.cfg") \
|
||||
> ${iso9660_dir}/boot/grub/i386-pc/grub.cfg
|
||||
|
||||
grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -boot-info-table"
|
||||
grub_mkisofs_arguments="${grub_mkisofs_arguments} -b boot/grub/i386-pc/eltorito.img -boot-info-table \
|
||||
--embedded-boot ${embed_img}"
|
||||
fi
|
||||
|
||||
# build iso image
|
||||
grub-mkisofs ${grub_mkisofs_arguments} -o ${output_image} -r ${iso9660_dir} ${source}
|
||||
grub-mkisofs ${grub_mkisofs_arguments} --protective-msdos-label -o ${output_image} -r ${iso9660_dir} ${source}
|
||||
rm -rf ${iso9660_dir}
|
||||
|
||||
rm -f ${embed_img}
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -123,7 +123,7 @@ probe (const char *path, char *device_name)
|
|||
device_name = grub_guess_root_device (path);
|
||||
|
||||
if (! device_name)
|
||||
grub_util_error ("cannot find a device for %s.\n", path);
|
||||
grub_util_error ("cannot find a device for %s (is /dev mounted?).\n", path);
|
||||
|
||||
if (print == PRINT_DEVICE)
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ probe (const char *path, char *device_name)
|
|||
filebuf_via_sys = grub_util_read_image (path);
|
||||
|
||||
rel_path = make_system_path_relative_to_its_root (path);
|
||||
asprintf (&grub_path, "(%s)%s", drive_name, rel_path);
|
||||
grub_path = xasprintf ("(%s)%s", drive_name, rel_path);
|
||||
free (rel_path);
|
||||
grub_util_info ("reading %s via GRUB facilities", grub_path);
|
||||
file = grub_file_open (grub_path);
|
||||
|
|
|
@ -37,6 +37,56 @@ if [ -z "${OSPROBED}" ] ; then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
osx_entry {
|
||||
cat << EOF
|
||||
menuentry "${LONGNAME} (${2}-bit) (on ${DEVICE})" {
|
||||
EOF
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
cat << EOF
|
||||
insmod ${GRUB_VIDEO_BACKEND}
|
||||
do_resume=0
|
||||
if [ /var/vm/sleepimage -nt10 / ]; then
|
||||
if xnu_resume /var/vm/sleepimage; then
|
||||
do_resume=1
|
||||
fi
|
||||
fi
|
||||
if [ \$do_resume == 0 ]; then
|
||||
xnu_uuid ${OSXUUID} uuid
|
||||
if [ -f /Extra/DSDT.aml ]; then
|
||||
acpi -e /Extra/DSDT.aml
|
||||
fi
|
||||
$1 /mach_kernel boot-uuid=\${uuid} rd=*uuid
|
||||
if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
|
||||
xnu_mkext /System/Library/Extensions.mkext
|
||||
else
|
||||
xnu_kextdir /System/Library/Extensions
|
||||
fi
|
||||
if [ -f /Extra/Extensions.mkext ]; then
|
||||
xnu_mkext /Extra/Extensions.mkext
|
||||
fi
|
||||
if [ -d /Extra/Extensions ]; then
|
||||
xnu_kextdir /Extra/Extensions
|
||||
fi
|
||||
if [ -f /Extra/devprop.bin ]; then
|
||||
xnu_devprop_load /Extra/devprop.bin
|
||||
fi
|
||||
if [ -f /Extra/splash.jpg ]; then
|
||||
insmod jpeg
|
||||
xnu_splash /Extra/splash.jpg
|
||||
fi
|
||||
if [ -f /Extra/splash.png ]; then
|
||||
insmod png
|
||||
xnu_splash /Extra/splash.png
|
||||
fi
|
||||
if [ -f /Extra/splash.tga ]; then
|
||||
insmod tga
|
||||
xnu_splash /Extra/splash.tga
|
||||
fi
|
||||
fi
|
||||
}
|
||||
EOF
|
||||
}
|
||||
|
||||
for OS in ${OSPROBED} ; do
|
||||
DEVICE="`echo ${OS} | cut -d ':' -f 1`"
|
||||
LONGNAME="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
|
||||
|
@ -115,53 +165,8 @@ EOF
|
|||
;;
|
||||
macosx)
|
||||
OSXUUID="`grub-probe --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
|
||||
cat << EOF
|
||||
menuentry "${LONGNAME} (on ${DEVICE})" {
|
||||
EOF
|
||||
prepare_grub_to_access_device ${DEVICE} | sed -e "s/^/\t/"
|
||||
cat << EOF
|
||||
insmod vbe
|
||||
do_resume=0
|
||||
if [ /var/vm/sleepimage -nt10 / ]; then
|
||||
if xnu_resume /var/vm/sleepimage; then
|
||||
do_resume=1
|
||||
fi
|
||||
fi
|
||||
if [ \$do_resume == 0 ]; then
|
||||
xnu_uuid ${OSXUUID} uuid
|
||||
if [ -f /Extra/DSDT.aml ]; then
|
||||
acpi -e /Extra/DSDT.aml
|
||||
fi
|
||||
xnu_kernel /mach_kernel boot-uuid=\${uuid} rd=*uuid
|
||||
if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
|
||||
xnu_mkext /System/Library/Extensions.mkext
|
||||
else
|
||||
xnu_kextdir /System/Library/Extensions
|
||||
fi
|
||||
if [ -f /Extra/Extensions.mkext ]; then
|
||||
xnu_mkext /Extra/Extensions.mkext
|
||||
fi
|
||||
if [ -d /Extra/Extensions ]; then
|
||||
xnu_kextdir /Extra/Extensions
|
||||
fi
|
||||
if [ -f /Extra/devtree.txt ]; then
|
||||
xnu_devtree /Extra/devtree.txt
|
||||
fi
|
||||
if [ -f /Extra/splash.jpg ]; then
|
||||
insmod jpeg
|
||||
xnu_splash /Extra/splash.jpg
|
||||
fi
|
||||
if [ -f /Extra/splash.png ]; then
|
||||
insmod png
|
||||
xnu_splash /Extra/splash.png
|
||||
fi
|
||||
if [ -f /Extra/splash.tga ]; then
|
||||
insmod tga
|
||||
xnu_splash /Extra/splash.tga
|
||||
fi
|
||||
fi
|
||||
}
|
||||
EOF
|
||||
osx_entry xnu_kernel 32
|
||||
osx_entry xnu_kernel64 64
|
||||
;;
|
||||
hurd)
|
||||
cat << EOF
|
||||
|
|
|
@ -679,14 +679,14 @@ make_device_name (int drive, int dos_part, int bsd_part)
|
|||
char *bsd_part_str = NULL;
|
||||
|
||||
if (dos_part >= 0)
|
||||
asprintf (&dos_part_str, ",%d", dos_part + 1);
|
||||
dos_part_str = xasprintf (",%d", dos_part + 1);
|
||||
|
||||
if (bsd_part >= 0)
|
||||
asprintf (&bsd_part_str, ",%c", dos_part + 'a');
|
||||
bsd_part_str = xasprintf (",%c", dos_part + 'a');
|
||||
|
||||
asprintf (&ret, "%s%s%s", map[drive].drive,
|
||||
dos_part_str ? : "",
|
||||
bsd_part_str ? : "");
|
||||
ret = xasprintf ("%s%s%s", map[drive].drive,
|
||||
dos_part_str ? : "",
|
||||
bsd_part_str ? : "");
|
||||
|
||||
if (dos_part_str)
|
||||
free (dos_part_str);
|
||||
|
|
|
@ -15,11 +15,8 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
hexify()
|
||||
{
|
||||
echo -n "$@" | od -A n -t x1 - | sed -e 's/ //g' | tr '\n' '\0'
|
||||
}
|
||||
if [ x$1 == x ]; then
|
||||
echo "Filename required".
|
||||
fi
|
||||
|
||||
echo "`hexify efi`{ `hexify device-properties`:"
|
||||
ioreg -lw0 -p IODeviceTree -n efi -r -x |grep device-properties | sed 's/.*<//;s/>.*//;'
|
||||
echo ";}"
|
||||
ioreg -lw0 -p IODeviceTree -n efi -r -x |grep device-properties | sed 's/.*<//;s/>.*//;' | xxd -r -p > $1
|
||||
|
|
|
@ -55,12 +55,12 @@ align_pe32_section (Elf_Addr addr)
|
|||
/* Read the whole kernel image. Return the pointer to a read image,
|
||||
and store the size in bytes in *SIZE. */
|
||||
static char *
|
||||
read_kernel_module (const char *dir, size_t *size)
|
||||
read_kernel_image (const char *dir, size_t *size)
|
||||
{
|
||||
char *kernel_image;
|
||||
char *kernel_path;
|
||||
|
||||
kernel_path = grub_util_get_path (dir, "kernel.mod");
|
||||
kernel_path = grub_util_get_path (dir, "kernel.img");
|
||||
*size = grub_util_get_image_size (kernel_path);
|
||||
kernel_image = grub_util_read_image (kernel_path);
|
||||
free (kernel_path);
|
||||
|
@ -945,7 +945,7 @@ convert_elf (const char *dir, char *prefix, FILE *out, char *mods[])
|
|||
int i;
|
||||
|
||||
/* Get the kernel image and check the format. */
|
||||
kernel_image = read_kernel_module (dir, &kernel_size);
|
||||
kernel_image = read_kernel_image (dir, &kernel_size);
|
||||
e = (Elf_Ehdr *) kernel_image;
|
||||
if (! check_elf_header (e, kernel_size))
|
||||
grub_util_error ("invalid ELF header");
|
||||
|
|
|
@ -356,8 +356,12 @@ setup (const char *dir,
|
|||
goto unable_to_embed;
|
||||
}
|
||||
|
||||
grub_partition_iterate (dest_dev->disk, (strcmp (dest_partmap, "part_msdos") ?
|
||||
find_usable_region_gpt : find_usable_region_msdos));
|
||||
if (strcmp (dest_partmap, "part_msdos") == 0)
|
||||
grub_partition_iterate (dest_dev->disk, find_usable_region_msdos);
|
||||
else if (strcmp (dest_partmap, "part_gpt") == 0)
|
||||
grub_partition_iterate (dest_dev->disk, find_usable_region_gpt);
|
||||
else
|
||||
grub_util_error (_("No DOS-style partitions found"));
|
||||
|
||||
if (embed_region.end == embed_region.start)
|
||||
{
|
||||
|
|
|
@ -35,8 +35,10 @@ escape_of_path (const char *orig_path)
|
|||
}
|
||||
|
||||
void
|
||||
grub_util_emit_devicemap_entry (FILE *fp, char *name, int is_floppy UNUSED,
|
||||
int *num_fd UNUSED, int *num_hd UNUSED)
|
||||
grub_util_emit_devicemap_entry (FILE *fp, char *name,
|
||||
int is_floppy __attribute__((unused)),
|
||||
int *num_fd __attribute__((unused)),
|
||||
int *num_hd __attribute__((unused)))
|
||||
{
|
||||
const char *orig_path = grub_util_devname_to_ofpath (name);
|
||||
char *ofpath = escape_of_path (orig_path);
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include <ctype.h>
|
||||
|
||||
#ifdef OFPATH_STANDALONE
|
||||
#define UNUSED __attribute__((unused))
|
||||
#define xmalloc malloc
|
||||
void
|
||||
grub_util_error (const char *fmt, ...)
|
||||
|
@ -199,8 +198,10 @@ get_basename(char *p)
|
|||
|
||||
static void
|
||||
of_path_of_vdisk(char *of_path,
|
||||
const char *devname UNUSED, const char *device,
|
||||
const char *devnode UNUSED, const char *devicenode)
|
||||
const char *devname __attribute__((unused)),
|
||||
const char *device,
|
||||
const char *devnode __attribute__((unused)),
|
||||
const char *devicenode)
|
||||
{
|
||||
char *sysfs_path, *p;
|
||||
int devno, junk;
|
||||
|
@ -217,8 +218,9 @@ of_path_of_vdisk(char *of_path,
|
|||
|
||||
static void
|
||||
of_path_of_ide(char *of_path,
|
||||
const char *devname UNUSED, const char *device,
|
||||
const char *devnode UNUSED, const char *devicenode)
|
||||
const char *devname __attribute__((unused)), const char *device,
|
||||
const char *devnode __attribute__((unused)),
|
||||
const char *devicenode)
|
||||
{
|
||||
char *sysfs_path, *p;
|
||||
int chan, devno;
|
||||
|
@ -299,8 +301,9 @@ check_sas (char *sysfs_path, int *tgt)
|
|||
|
||||
static void
|
||||
of_path_of_scsi(char *of_path,
|
||||
const char *devname UNUSED, const char *device,
|
||||
const char *devnode UNUSED, const char *devicenode)
|
||||
const char *devname __attribute__((unused)), const char *device,
|
||||
const char *devnode __attribute__((unused)),
|
||||
const char *devicenode)
|
||||
{
|
||||
const char *p, *digit_string, *disk_name;
|
||||
int host, bus, tgt, lun;
|
||||
|
|
47
util/misc.c
47
util/misc.c
|
@ -370,6 +370,19 @@ grub_arch_sync_caches (void *address __attribute__ ((unused)),
|
|||
{
|
||||
}
|
||||
|
||||
#ifndef HAVE_VASPRINTF
|
||||
|
||||
int
|
||||
vasprintf (char **buf, const char *fmt, va_list ap)
|
||||
{
|
||||
/* Should be large enough. */
|
||||
*buf = xmalloc (512);
|
||||
|
||||
return vsprintf (*buf, fmt, ap);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ASPRINTF
|
||||
|
||||
int
|
||||
|
@ -378,11 +391,8 @@ asprintf (char **buf, const char *fmt, ...)
|
|||
int status;
|
||||
va_list ap;
|
||||
|
||||
/* Should be large enough. */
|
||||
*buf = xmalloc (512);
|
||||
|
||||
va_start (ap, fmt);
|
||||
status = vsprintf (*buf, fmt, ap);
|
||||
status = vasprintf (*buf, fmt, ap);
|
||||
va_end (ap);
|
||||
|
||||
return status;
|
||||
|
@ -390,6 +400,23 @@ asprintf (char **buf, const char *fmt, ...)
|
|||
|
||||
#endif
|
||||
|
||||
char *
|
||||
xasprintf (const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
char *result;
|
||||
|
||||
va_start (ap, fmt);
|
||||
if (vasprintf (&result, fmt, ap) < 0)
|
||||
{
|
||||
if (errno == ENOMEM)
|
||||
grub_util_error ("out of memory");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
||||
void sync (void)
|
||||
|
@ -500,7 +527,17 @@ make_system_path_relative_to_its_root (const char *path)
|
|||
|
||||
/* buf is another filesystem; we found it. */
|
||||
if (st.st_dev != num)
|
||||
break;
|
||||
{
|
||||
/* offset == 0 means path given is the mount point. */
|
||||
if (offset == 0)
|
||||
{
|
||||
free (buf);
|
||||
free (buf2);
|
||||
return strdup ("/");
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
offset = p - buf;
|
||||
/* offset == 1 means root directory. */
|
||||
|
|
|
@ -90,6 +90,8 @@ int extension_record_size = 0;
|
|||
/* These variables are associated with command line options */
|
||||
int use_eltorito = 0;
|
||||
int use_eltorito_emul_floppy = 0;
|
||||
int use_embedded_boot = 0;
|
||||
int use_protective_msdos_label = 0;
|
||||
int use_boot_info_table = 0;
|
||||
int use_RockRidge = 0;
|
||||
int use_Joliet = 0;
|
||||
|
@ -100,17 +102,18 @@ int rationalize = 0;
|
|||
int generate_tables = 0;
|
||||
int print_size = 0;
|
||||
int split_output = 0;
|
||||
char * preparer = PREPARER_DEFAULT;
|
||||
char * publisher = PUBLISHER_DEFAULT;
|
||||
char * appid = APPID_DEFAULT;
|
||||
char * copyright = COPYRIGHT_DEFAULT;
|
||||
char * biblio = BIBLIO_DEFAULT;
|
||||
char * abstract = ABSTRACT_DEFAULT;
|
||||
char * volset_id = VOLSET_ID_DEFAULT;
|
||||
char * volume_id = VOLUME_ID_DEFAULT;
|
||||
char * system_id = SYSTEM_ID_DEFAULT;
|
||||
char * boot_catalog = BOOT_CATALOG_DEFAULT;
|
||||
char * boot_image = BOOT_IMAGE_DEFAULT;
|
||||
char *preparer = PREPARER_DEFAULT;
|
||||
char *publisher = PUBLISHER_DEFAULT;
|
||||
char *appid = APPID_DEFAULT;
|
||||
char *copyright = COPYRIGHT_DEFAULT;
|
||||
char *biblio = BIBLIO_DEFAULT;
|
||||
char *abstract = ABSTRACT_DEFAULT;
|
||||
char *volset_id = VOLSET_ID_DEFAULT;
|
||||
char *volume_id = VOLUME_ID_DEFAULT;
|
||||
char *system_id = SYSTEM_ID_DEFAULT;
|
||||
char *boot_catalog = BOOT_CATALOG_DEFAULT;
|
||||
char *boot_image = BOOT_IMAGE_DEFAULT;
|
||||
char *boot_image_embed = NULL;
|
||||
int volume_set_size = 1;
|
||||
int volume_sequence_number = 1;
|
||||
|
||||
|
@ -197,6 +200,8 @@ struct ld_option
|
|||
|
||||
#define OPTION_VERSION 173
|
||||
|
||||
#define OPTION_PROTECTIVE_MSDOS_LABEL 174
|
||||
|
||||
static const struct ld_option ld_options[] =
|
||||
{
|
||||
{ {"all-files", no_argument, NULL, 'a'},
|
||||
|
@ -209,6 +214,10 @@ static const struct ld_option ld_options[] =
|
|||
'\0', N_("FILE"), N_("Set Bibliographic filename"), ONE_DASH },
|
||||
{ {"copyright", required_argument, NULL, OPTION_COPYRIGHT},
|
||||
'\0', N_("FILE"), N_("Set Copyright filename"), ONE_DASH },
|
||||
{ {"embedded-boot", required_argument, NULL, 'G'},
|
||||
'G', N_("FILE"), N_("Set embedded boot image name"), TWO_DASHES },
|
||||
{ {"protective-msdos-label", no_argument, NULL, OPTION_PROTECTIVE_MSDOS_LABEL },
|
||||
'\0', NULL, N_("Patch a protective DOS-style label in the image"), TWO_DASHES },
|
||||
{ {"eltorito-boot", required_argument, NULL, 'b'},
|
||||
'b', N_("FILE"), N_("Set El Torito boot image name"), ONE_DASH },
|
||||
{ {"eltorito-catalog", required_argument, NULL, 'c'},
|
||||
|
@ -719,10 +728,16 @@ int FDECL2(main, int, argc, char **, argv){
|
|||
use_eltorito++;
|
||||
boot_image = optarg; /* pathname of the boot image on cd */
|
||||
if (boot_image == NULL)
|
||||
{
|
||||
fprintf (stderr, _("Required boot image pathname missing\n"));
|
||||
exit (1);
|
||||
}
|
||||
error (1, 0, _("Required boot image pathname missing"));
|
||||
break;
|
||||
case 'G':
|
||||
use_embedded_boot = 1;
|
||||
boot_image_embed = optarg; /* pathname of the boot image on host filesystem */
|
||||
if (boot_image_embed == NULL)
|
||||
error (1, 0, _("Required boot image pathname missing"));
|
||||
break;
|
||||
case OPTION_PROTECTIVE_MSDOS_LABEL:
|
||||
use_protective_msdos_label = 1;
|
||||
break;
|
||||
case 'c':
|
||||
use_eltorito++;
|
||||
|
|
|
@ -296,6 +296,8 @@ extern struct iso_directory_record root_record;
|
|||
extern struct iso_directory_record jroot_record;
|
||||
|
||||
extern int use_eltorito;
|
||||
extern int use_embedded_boot;
|
||||
extern int use_protective_msdos_label;
|
||||
extern int use_eltorito_emul_floppy;
|
||||
extern int use_boot_info_table;
|
||||
extern int use_RockRidge;
|
||||
|
@ -438,20 +440,21 @@ extern char * extension_record;
|
|||
extern int extension_record_extent;
|
||||
extern int n_data_extents;
|
||||
|
||||
/* These are a few goodies that can be specified on the command line, and are
|
||||
/* These are a few goodies that can be specified on the command line, and are
|
||||
filled into the root record */
|
||||
|
||||
extern char * preparer;
|
||||
extern char * publisher;
|
||||
extern char * copyright;
|
||||
extern char * biblio;
|
||||
extern char * abstract;
|
||||
extern char * appid;
|
||||
extern char * volset_id;
|
||||
extern char * system_id;
|
||||
extern char * volume_id;
|
||||
extern char * boot_catalog;
|
||||
extern char * boot_image;
|
||||
extern char *preparer;
|
||||
extern char *publisher;
|
||||
extern char *copyright;
|
||||
extern char *biblio;
|
||||
extern char *abstract;
|
||||
extern char *appid;
|
||||
extern char *volset_id;
|
||||
extern char *system_id;
|
||||
extern char *volume_id;
|
||||
extern char *boot_catalog;
|
||||
extern char *boot_image;
|
||||
extern char *boot_image_embed;
|
||||
extern int volume_set_size;
|
||||
extern int volume_sequence_number;
|
||||
|
||||
|
|
75
util/mkisofs/msdos_partition.h
Normal file
75
util/mkisofs/msdos_partition.h
Normal file
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 1999,2000,2001,2002,2004,2007 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/>.
|
||||
*/
|
||||
|
||||
#ifndef MSDOS_PARTITION_H
|
||||
#define MSDOS_PARTITION_H 1
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
/* The signature. */
|
||||
#define MSDOS_PARTITION_SIGNATURE ((0xaa << 8) | 0x55)
|
||||
|
||||
/* This is not a flag actually, but used as if it were a flag. */
|
||||
#define MSDOS_PARTITION_TYPE_HIDDEN_FLAG 0x10
|
||||
|
||||
/* The partition entry. */
|
||||
struct msdos_partition_entry
|
||||
{
|
||||
/* If active, 0x80, otherwise, 0x00. */
|
||||
uint8_t flag;
|
||||
|
||||
/* The head of the start. */
|
||||
uint8_t start_head;
|
||||
|
||||
/* (S | ((C >> 2) & 0xC0)) where S is the sector of the start and C
|
||||
is the cylinder of the start. Note that S is counted from one. */
|
||||
uint8_t start_sector;
|
||||
|
||||
/* (C & 0xFF) where C is the cylinder of the start. */
|
||||
uint8_t start_cylinder;
|
||||
|
||||
/* The partition type. */
|
||||
uint8_t type;
|
||||
|
||||
/* The end versions of start_head, start_sector and start_cylinder,
|
||||
respectively. */
|
||||
uint8_t end_head;
|
||||
uint8_t end_sector;
|
||||
uint8_t end_cylinder;
|
||||
|
||||
/* The start sector. Note that this is counted from zero. */
|
||||
uint32_t start;
|
||||
|
||||
/* The length in sector units. */
|
||||
uint32_t length;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The structure of MBR. */
|
||||
struct msdos_partition_mbr
|
||||
{
|
||||
/* The code area (actually, including BPB). */
|
||||
uint8_t code[446];
|
||||
|
||||
/* Four partition entries. */
|
||||
struct msdos_partition_entry entries[4];
|
||||
|
||||
/* The signature 0xaa55. */
|
||||
uint16_t signature;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
#endif
|
|
@ -21,11 +21,10 @@
|
|||
along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "config.h"
|
||||
#include "mkisofs.h"
|
||||
#include "iso9660.h"
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
|
||||
|
@ -37,6 +36,10 @@
|
|||
#ifdef HAVE_UNISTD_H
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "mkisofs.h"
|
||||
#include "iso9660.h"
|
||||
#include "msdos_partition.h"
|
||||
|
||||
#ifdef __SVR4
|
||||
extern char * strdup(const char *);
|
||||
|
@ -1344,6 +1347,9 @@ int FDECL1(oneblock_size, int, starting_extent)
|
|||
/*
|
||||
* Functions to describe padding block at the start of the disc.
|
||||
*/
|
||||
|
||||
#define PADBLOCK_SIZE 16
|
||||
|
||||
static int FDECL1(pathtab_size, int, starting_extent)
|
||||
{
|
||||
path_table[0] = starting_extent;
|
||||
|
@ -1357,7 +1363,7 @@ static int FDECL1(pathtab_size, int, starting_extent)
|
|||
|
||||
static int FDECL1(padblock_size, int, starting_extent)
|
||||
{
|
||||
last_extent += 16;
|
||||
last_extent += PADBLOCK_SIZE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1420,17 +1426,45 @@ static int FDECL1(dirtree_cleanup, FILE *, outfile)
|
|||
|
||||
static int FDECL1(padblock_write, FILE *, outfile)
|
||||
{
|
||||
char buffer[2048];
|
||||
int i;
|
||||
char *buffer;
|
||||
|
||||
memset(buffer, 0, sizeof(buffer));
|
||||
buffer = e_malloc (2048 * PADBLOCK_SIZE);
|
||||
memset (buffer, 0, 2048 * PADBLOCK_SIZE);
|
||||
|
||||
for(i=0; i<16; i++)
|
||||
if (use_embedded_boot)
|
||||
{
|
||||
xfwrite(buffer, 1, sizeof(buffer), outfile);
|
||||
FILE *fp = fopen (boot_image_embed, "rb");
|
||||
if (! fp)
|
||||
error (1, errno, _("Unable to open %s"), boot_image_embed);
|
||||
fread (buffer, 2048 * PADBLOCK_SIZE, 1, fp);
|
||||
}
|
||||
|
||||
last_extent_written += 16;
|
||||
if (use_protective_msdos_label)
|
||||
{
|
||||
struct msdos_partition_mbr *mbr = (void *) buffer;
|
||||
|
||||
memset (mbr->entries, 0, sizeof(mbr->entries));
|
||||
|
||||
/* Some idiotic BIOSes refuse to boot if they don't find at least
|
||||
one partition with active bit set. */
|
||||
mbr->entries[0].flag = 0x80;
|
||||
|
||||
/* Doesn't really matter, as long as it's non-zero. It seems that
|
||||
0xCD is used elsewhere, so we follow suit. */
|
||||
mbr->entries[0].type = 0xcd;
|
||||
|
||||
/* Start immediately (sector 1). */
|
||||
mbr->entries[0].start = 1;
|
||||
|
||||
/* We don't know yet. Let's keep it safe. */
|
||||
mbr->entries[0].length = UINT32_MAX;
|
||||
|
||||
mbr->signature = MSDOS_PARTITION_SIGNATURE;
|
||||
}
|
||||
|
||||
xfwrite (buffer, 1, 2048 * PADBLOCK_SIZE, outfile);
|
||||
last_extent_written += PADBLOCK_SIZE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
76
util/pci.c
Normal file
76
util/pci.c
Normal file
|
@ -0,0 +1,76 @@
|
|||
/* pci.c - Generic PCI interfaces. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2007,2009 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/>.
|
||||
*/
|
||||
|
||||
#include <grub/pci.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/util/misc.h>
|
||||
|
||||
grub_pci_address_t
|
||||
grub_pci_make_address (grub_pci_device_t dev, int reg)
|
||||
{
|
||||
grub_pci_address_t ret;
|
||||
ret.dev = dev;
|
||||
ret.pos = reg << 2;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
||||
{
|
||||
struct pci_device_iterator *iter;
|
||||
struct pci_slot_match slot;
|
||||
struct pci_device *dev;
|
||||
slot.domain = PCI_MATCH_ANY;
|
||||
slot.bus = PCI_MATCH_ANY;
|
||||
slot.dev = PCI_MATCH_ANY;
|
||||
slot.func = PCI_MATCH_ANY;
|
||||
iter = pci_slot_match_iterator_create (&slot);
|
||||
while ((dev = pci_device_next (iter)))
|
||||
hook (dev, dev->vendor_id | (dev->device_id << 16));
|
||||
pci_iterator_destroy (iter);
|
||||
}
|
||||
|
||||
void *
|
||||
grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base,
|
||||
grub_size_t size)
|
||||
{
|
||||
void *addr;
|
||||
int err;
|
||||
err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr);
|
||||
if (err)
|
||||
grub_util_error ("mapping 0x%x failed (error %d)\n", base, err);
|
||||
return addr;
|
||||
}
|
||||
|
||||
void
|
||||
grub_pci_device_unmap_range (grub_pci_device_t dev, void *mem,
|
||||
grub_size_t size)
|
||||
{
|
||||
pci_device_unmap_range (dev, mem, size);
|
||||
}
|
||||
|
||||
GRUB_MOD_INIT (pci)
|
||||
{
|
||||
pci_system_init ();
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI (pci)
|
||||
{
|
||||
pci_system_cleanup ();
|
||||
}
|
|
@ -31,9 +31,6 @@ target_cpu=@target_cpu@
|
|||
platform=@platform@
|
||||
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
|
||||
|
||||
# for make_system_path_relative_to_its_root()
|
||||
. ${libdir}/grub/grub-mkconfig_lib
|
||||
|
||||
grub_setup=${sbindir}/`echo grub-setup | sed ${transform}`
|
||||
grub_mkimage=${bindir}/`echo grub-mkimage | sed ${transform}`
|
||||
grub_mkdevicemap=${sbindir}/`echo grub-mkdevicemap | sed ${transform}`
|
||||
|
@ -120,6 +117,9 @@ for option in "$@"; do
|
|||
esac
|
||||
done
|
||||
|
||||
# for make_system_path_relative_to_its_root()
|
||||
. ${libdir}/grub/grub-mkconfig_lib
|
||||
|
||||
if test "x$install_device" = x; then
|
||||
echo "install_device not specified." 1>&2
|
||||
usage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue