Merge powerpc grub-mkrescue flavour with common. Use xorriso HFS+
feature for it.
This commit is contained in:
parent
48f39bb4df
commit
a79b8a1584
14 changed files with 707 additions and 160 deletions
|
@ -43,9 +43,16 @@ pc_dir="${libdir}/@PACKAGE@/i386-pc"
|
|||
efi32_dir="${libdir}/@PACKAGE@/i386-efi"
|
||||
efi64_dir="${libdir}/@PACKAGE@/x86_64-efi"
|
||||
ia64_dir="${libdir}/@PACKAGE@/ia64-efi"
|
||||
ppc_dir="${libdir}/@PACKAGE@/powerpc-ieee1275"
|
||||
rom_directory=
|
||||
override_dir=
|
||||
grub_mkimage="${bindir}/@grub_mkimage@"
|
||||
grub_render_label="${bindir}/@grub_render_label@"
|
||||
label_font="${pkgdatadir}/unicode.pf2"
|
||||
label_color="black"
|
||||
label_bgcolor="white"
|
||||
product_name="${PACKAGE_NAME}"
|
||||
product_version="${PACKAGE_VERSION}"
|
||||
|
||||
xorriso=xorriso
|
||||
|
||||
|
@ -74,6 +81,12 @@ usage () {
|
|||
# TRANSLATORS: xorriso is a program for creating ISOs and burning CDs
|
||||
print_option_help "--xorriso=$filetrans" "$(gettext "use FILE as xorriso [optional]")"
|
||||
print_option_help "--grub-mkimage=$filetrans" "$(gettext "use FILE as grub-mkimage")"
|
||||
print_option_help "--grub-render-label=$filetrans" "$(gettext "use FILE as grub-render-label")"
|
||||
print_option_help "--label-font=$filetrans" "$(gettext "use FILE as font for label")"
|
||||
print_option_help "--label-color=$(gettext "COLOR")" "$(gettext "use COLOR for label")"
|
||||
print_option_help "--label-bgcolor=$(gettext "COLOR")" "$(gettext "use COLOR for label background")"
|
||||
print_option_help "--product-name=$(gettext "STR")" "$(gettext "use STR as product")"
|
||||
print_option_help "--product-version=$(gettext "STR")" "$(gettext "use STR as product version")"
|
||||
echo
|
||||
gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "xorriso -as mkisofs -help" "$self" | grub_fmt
|
||||
echo
|
||||
|
@ -131,11 +144,41 @@ do
|
|||
export PATH
|
||||
;;
|
||||
|
||||
--product-name)
|
||||
product_name=`argument $option "$@"`; shift ;;
|
||||
--product-name=*)
|
||||
product_name=`echo "$option" | sed 's/--product-name=//'` ;;
|
||||
|
||||
--product-version)
|
||||
product_version=`argument $option "$@"`; shift ;;
|
||||
--product-version=*)
|
||||
product_version=`echo "$option" | sed 's/--product-version=//'` ;;
|
||||
|
||||
--grub-mkimage)
|
||||
grub_mkimage=`argument $option "$@"`; shift ;;
|
||||
--grub-mkimage=*)
|
||||
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
||||
|
||||
--grub-render-label)
|
||||
grub_render_label=`argument $option "$@"`; shift ;;
|
||||
--grub-render-label=*)
|
||||
grub_render_label=`echo "$option" | sed 's/--grub-render-label=//'` ;;
|
||||
|
||||
--label-font)
|
||||
label_font=`argument $option "$@"`; shift ;;
|
||||
--label-font=*)
|
||||
label_font=`echo "$option" | sed 's/--label-font=//'` ;;
|
||||
|
||||
--label-color)
|
||||
label_color=`argument $option "$@"`; shift ;;
|
||||
--label-color=*)
|
||||
label_color=`echo "$option" | sed 's/--label-color=//'` ;;
|
||||
|
||||
--label-bgcolor)
|
||||
label_bgcolor=`argument $option "$@"`; shift ;;
|
||||
--label-bgcolor=*)
|
||||
label_bgcolor=`echo "$option" | sed 's/--label-bgcolor=//'` ;;
|
||||
|
||||
--xorriso)
|
||||
xorriso=`argument $option "$@"`; shift ;;
|
||||
--xorriso=*)
|
||||
|
@ -231,6 +274,9 @@ if [ "${override_dir}" = "" ] ; then
|
|||
if test -e "${loongson_dir}" ; then
|
||||
process_input_dir "${loongson_dir}" mipsel-loongson
|
||||
fi
|
||||
if test -e "${ppc_dir}" ; then
|
||||
process_input_dir "${ppc_dir}" mipsel-loongson
|
||||
fi
|
||||
else
|
||||
. "${override_dir}"/modinfo.sh
|
||||
process_input_dir "${override_dir}" ${grub_modinfo_target_cpu}-${grub_modinfo_platform}
|
||||
|
@ -244,6 +290,7 @@ else
|
|||
mipsel_qemu_dir=
|
||||
mips_qemu_dir=
|
||||
loongson_dir=
|
||||
ppc_dir=
|
||||
case "${grub_modinfo_target_cpu}-${grub_modinfo_platform}" in
|
||||
i386-multiboot) multiboot_dir="${override_dir}" ;;
|
||||
i386-coreboot) coreboot_dir="${override_dir}" ;;
|
||||
|
@ -255,6 +302,7 @@ else
|
|||
mipsel-qemu_mips) mipsel_qemu_dir="${override_dir}" ;;
|
||||
mipsel-loongson) loongson_dir="${override_dir}" ;;
|
||||
mips-qemu_mips) mips_qemu_dir="${override_dir}" ;;
|
||||
powerpc-ieee1275) ppc_dir="${override_dir}" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
|
@ -309,6 +357,38 @@ if test -e "${efi64_dir}" || test -e "${efi32_dir}" || test -e "${ia64_dir}"; th
|
|||
grub_mkisofs_arguments="${grub_mkisofs_arguments} --efi-boot efi.img"
|
||||
fi
|
||||
|
||||
make_image "${ppc_dir}" powerpc-ieee1275 "${iso9660_dir}/boot/powerpc.elf" ""
|
||||
if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ] || [ -e "${iso9660_dir}/boot/powerpc.elf" ]; then
|
||||
mkdir -p "${iso9660_dir}"/System/Library/CoreServices
|
||||
touch "${iso9660_dir}/mach_kernel"
|
||||
cat > "${iso9660_dir}/System/Library/CoreServices/SystemVersion.plist" <<EOF
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>ProductBuildVersion</key>
|
||||
<string></string>
|
||||
<key>ProductName</key>
|
||||
<string>${product_name}</string>
|
||||
<key>ProductVersion</key>
|
||||
<string>${product_version}</string>
|
||||
</dict>
|
||||
</plist>
|
||||
EOF
|
||||
"$grub_render_label" -f "$label_font" -b "$label_bgcolor" -c "$label_color" -t "${product_name} ${product_version}" -o "${iso9660_dir}/System/Library/CoreServices/.disk_label"
|
||||
echo "${product_name} ${product_version}" > "${iso9660_dir}/System/Library/CoreServices/.disk_label.contentDetails"
|
||||
grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus -hfsplus-file-creator-type chrp tbxj /System/Library/CoreServices/.disk_label"
|
||||
fi
|
||||
|
||||
if [ -e "${iso9660_dir}/boot/powerpc.elf" ] ; then
|
||||
cp "${ppc_dir}/grub.chrp" "${iso9660_dir}"/System/Library/CoreServices/BootX
|
||||
cp "${iso9660_dir}/boot/powerpc.elf" "${iso9660_dir}"/System/Library/CoreServices/grub.elf
|
||||
# FIXME: add PreP
|
||||
grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfsplus-file-creator-type chrp tbxi /System/Library/CoreServices/BootX -hfs-bless-by p /System/Library/CoreServices -sysid PPC"
|
||||
fi
|
||||
|
||||
if [ -e "${iso9660_dir}"/System/Library/CoreServices/boot.efi ]; then
|
||||
grub_mkisofs_arguments="${grub_mkisofs_arguments} -hfs-bless-by i /System/Library/CoreServices/boot.efi"
|
||||
fi
|
||||
|
||||
make_image "${mipsel_qemu_dir}" mipsel-qemu_mips-elf "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "pata"
|
||||
if [ -e "${iso9660_dir}/boot/mipsel-qemu_mips.elf" ] && [ -d "${rom_directory}" ]; then
|
||||
cp "${iso9660_dir}/boot/mipsel-qemu_mips.elf" "${rom_directory}/mipsel-qemu_mips.elf"
|
||||
|
|
393
util/grub-render-label.c
Normal file
393
util/grub-render-label.c
Normal file
|
@ -0,0 +1,393 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2010,2012 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/>.
|
||||
*/
|
||||
|
||||
|
||||
#define grub_video_render_target grub_video_fbrender_target
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <grub/util/misc.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/font.h>
|
||||
#include <grub/gfxmenu_view.h>
|
||||
|
||||
#define _GNU_SOURCE 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <argp.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include "progname.h"
|
||||
|
||||
struct arguments
|
||||
{
|
||||
char *input;
|
||||
char *text;
|
||||
char *output;
|
||||
char *font;
|
||||
grub_video_rgba_color_t fgcolor;
|
||||
grub_video_rgba_color_t bgcolor;
|
||||
int verbosity;
|
||||
};
|
||||
|
||||
static struct argp_option options[] = {
|
||||
{"input", 'i', N_("FILE"), 0,
|
||||
N_("read text from FILE."), 0},
|
||||
{"color", 'c', N_("COLOR"), 0,
|
||||
N_("use COLOR for text"), 0},
|
||||
{"bgcolor", 'b', N_("COLOR"), 0,
|
||||
N_("use COLOR for background"), 0},
|
||||
{"text", 't', N_("STR"), 0,
|
||||
N_("supply the string."), 0},
|
||||
{"output", 'o', N_("FILE"), 0,
|
||||
N_("set output filename. Default is STDOUT"), 0},
|
||||
{"font", 'f', N_("FILE"), 0,
|
||||
N_("use FILE as font (PF2)."), 0},
|
||||
{"verbose", 'v', 0, 0, N_("print verbose messages."), 0},
|
||||
{ 0, 0, 0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/video_fb.h>
|
||||
|
||||
static struct
|
||||
{
|
||||
struct grub_video_mode_info mode_info;
|
||||
struct grub_video_render_target *render_target;
|
||||
grub_uint8_t *ptr;
|
||||
} framebuffer;
|
||||
|
||||
static grub_err_t
|
||||
grub_video_text_render_swap_buffers (void)
|
||||
{
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_video_text_render_set_active_render_target (struct grub_video_render_target *target)
|
||||
{
|
||||
if (target == GRUB_VIDEO_RENDER_TARGET_DISPLAY)
|
||||
target = framebuffer.render_target;
|
||||
|
||||
return grub_video_fb_set_active_render_target (target);
|
||||
}
|
||||
|
||||
static struct grub_video_adapter grub_video_text_render_adapter =
|
||||
{
|
||||
.name = "Text rendering",
|
||||
|
||||
.prio = GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE,
|
||||
|
||||
.fini = grub_video_fb_fini,
|
||||
.get_info = grub_video_fb_get_info,
|
||||
.get_info_and_fini = 0,
|
||||
.set_palette = grub_video_fb_set_palette,
|
||||
.get_palette = grub_video_fb_get_palette,
|
||||
.set_viewport = grub_video_fb_set_viewport,
|
||||
.get_viewport = grub_video_fb_get_viewport,
|
||||
.map_color = grub_video_fb_map_color,
|
||||
.map_rgb = grub_video_fb_map_rgb,
|
||||
.map_rgba = grub_video_fb_map_rgba,
|
||||
.unmap_color = grub_video_fb_unmap_color,
|
||||
.fill_rect = grub_video_fb_fill_rect,
|
||||
.blit_bitmap = grub_video_fb_blit_bitmap,
|
||||
.blit_render_target = grub_video_fb_blit_render_target,
|
||||
.scroll = grub_video_fb_scroll,
|
||||
.swap_buffers = grub_video_text_render_swap_buffers,
|
||||
.create_render_target = grub_video_fb_create_render_target,
|
||||
.delete_render_target = grub_video_fb_delete_render_target,
|
||||
.set_active_render_target = grub_video_text_render_set_active_render_target,
|
||||
.get_active_render_target = grub_video_fb_get_active_render_target,
|
||||
|
||||
.next = 0
|
||||
};
|
||||
|
||||
static error_t
|
||||
argp_parser (int key, char *arg, struct argp_state *state)
|
||||
{
|
||||
/* Get the input argument from argp_parse, which we
|
||||
know is a pointer to our arguments structure. */
|
||||
struct arguments *arguments = state->input;
|
||||
grub_err_t err;
|
||||
|
||||
switch (key)
|
||||
{
|
||||
case 'i':
|
||||
arguments->input = xstrdup (arg);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
err = grub_video_parse_color (arg, &arguments->bgcolor);
|
||||
if (err)
|
||||
grub_util_error (_("Invalud color `%s'"), arg);
|
||||
break;
|
||||
|
||||
case 'c':
|
||||
err = grub_video_parse_color (arg, &arguments->fgcolor);
|
||||
if (err)
|
||||
grub_util_error (_("Invalud color `%s'"), arg);
|
||||
break;
|
||||
|
||||
case 'f':
|
||||
arguments->font = xstrdup (arg);
|
||||
break;
|
||||
|
||||
case 't':
|
||||
arguments->text = xstrdup (arg);
|
||||
break;
|
||||
|
||||
case 'o':
|
||||
arguments->output = xstrdup (arg);
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
arguments->verbosity++;
|
||||
break;
|
||||
|
||||
default:
|
||||
return ARGP_ERR_UNKNOWN;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void grub_hostfs_init (void);
|
||||
void grub_host_init (void);
|
||||
|
||||
struct header
|
||||
{
|
||||
grub_uint8_t magic;
|
||||
grub_uint16_t width;
|
||||
grub_uint16_t height;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
static struct argp argp = {
|
||||
options, argp_parser, N_("[OPTIONS]"),
|
||||
N_("Render Apple .disk_label."),
|
||||
NULL, NULL, NULL
|
||||
};
|
||||
|
||||
static struct grub_video_palette_data ieee1275_palette[256];
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
FILE *out;
|
||||
char *text;
|
||||
char *fontfull;
|
||||
struct arguments arguments;
|
||||
grub_font_t font;
|
||||
int width, height;
|
||||
struct header head;
|
||||
const grub_uint8_t vals[] = { 0xff, 0xda, 0xb3, 0x87, 0x54, 0x00 };
|
||||
const grub_uint8_t vals2[] = { 0xf3, 0xe7, 0xcd, 0xc0, 0xa5, 0x96,
|
||||
0x77, 0x66, 0x3f, 0x27 };
|
||||
int i, j, k, cptr = 0;
|
||||
grub_uint8_t bg, fg;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
ieee1275_palette[i].a = 0xff;
|
||||
|
||||
for (i = 0; i < 6; i++)
|
||||
for (j = 0; j < 6; j++)
|
||||
for (k = 0; k < 6; k++)
|
||||
{
|
||||
ieee1275_palette[cptr].r = vals[i];
|
||||
ieee1275_palette[cptr].g = vals[j];
|
||||
ieee1275_palette[cptr].b = vals[k];
|
||||
ieee1275_palette[cptr].a = 0xff;
|
||||
cptr++;
|
||||
}
|
||||
cptr--;
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
ieee1275_palette[cptr].r = vals2[i];
|
||||
ieee1275_palette[cptr].g = 0;
|
||||
ieee1275_palette[cptr].b = 0;
|
||||
ieee1275_palette[cptr].a = 0xff;
|
||||
cptr++;
|
||||
}
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
ieee1275_palette[cptr].r = 0;
|
||||
ieee1275_palette[cptr].g = vals2[i];
|
||||
ieee1275_palette[cptr].b = 0;
|
||||
ieee1275_palette[cptr].a = 0xff;
|
||||
cptr++;
|
||||
}
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
ieee1275_palette[cptr].r = 0;
|
||||
ieee1275_palette[cptr].g = 0;
|
||||
ieee1275_palette[cptr].b = vals2[i];
|
||||
ieee1275_palette[cptr].a = 0xff;
|
||||
cptr++;
|
||||
}
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
ieee1275_palette[cptr].r = vals2[i];
|
||||
ieee1275_palette[cptr].g = vals2[i];
|
||||
ieee1275_palette[cptr].b = vals2[i];
|
||||
ieee1275_palette[cptr].a = 0xff;
|
||||
cptr++;
|
||||
}
|
||||
ieee1275_palette[cptr].r = 0;
|
||||
ieee1275_palette[cptr].g = 0;
|
||||
ieee1275_palette[cptr].b = 0;
|
||||
ieee1275_palette[cptr].a = 0xff;
|
||||
|
||||
set_program_name (argv[0]);
|
||||
|
||||
grub_util_init_nls ();
|
||||
|
||||
/* Check for options. */
|
||||
memset (&arguments, 0, sizeof (struct arguments));
|
||||
arguments.bgcolor.red = 0xff;
|
||||
arguments.bgcolor.green = 0xff;
|
||||
arguments.bgcolor.blue = 0xff;
|
||||
arguments.bgcolor.alpha = 0xff;
|
||||
arguments.fgcolor.red = 0x00;
|
||||
arguments.fgcolor.green = 0x00;
|
||||
arguments.fgcolor.blue = 0x00;
|
||||
arguments.fgcolor.alpha = 0xff;
|
||||
if (argp_parse (&argp, argc, argv, 0, 0, &arguments) != 0)
|
||||
{
|
||||
fprintf (stderr, "%s", _("Error in parsing command line arguments\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((!arguments.input && !arguments.text) || !arguments.font)
|
||||
{
|
||||
fprintf (stderr, "%s", _("Missing arguments\n"));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (arguments.text)
|
||||
text = arguments.text;
|
||||
else
|
||||
{
|
||||
FILE *in = fopen (arguments.input, "r");
|
||||
size_t s;
|
||||
if (!in)
|
||||
grub_util_error (_("cannot open `%s': %s"), arguments.input,
|
||||
strerror (errno));
|
||||
fseek (in, 0, SEEK_END);
|
||||
s = ftell (in);
|
||||
fseek (in, 0, SEEK_SET);
|
||||
text = xmalloc (s + 1);
|
||||
if (fread (text, 1, s, in) != s)
|
||||
grub_util_error (_("cannot read `%s': %s"), arguments.input,
|
||||
strerror (errno));
|
||||
text[s] = 0;
|
||||
fclose (in);
|
||||
}
|
||||
|
||||
if (arguments.output)
|
||||
out = fopen (arguments.output, "wb");
|
||||
else
|
||||
out = stdout;
|
||||
if (!out)
|
||||
{
|
||||
grub_util_error (_("cannot open `%s': %s"), arguments.output ? : "stdout",
|
||||
strerror (errno));
|
||||
}
|
||||
|
||||
fontfull = canonicalize_file_name (arguments.font);
|
||||
if (!fontfull)
|
||||
{
|
||||
grub_util_error (_("cannot open `%s': %s"), arguments.font,
|
||||
strerror (errno));
|
||||
}
|
||||
|
||||
fontfull = xasprintf ("(host)/%s", fontfull);
|
||||
|
||||
grub_init_all ();
|
||||
grub_hostfs_init ();
|
||||
grub_host_init ();
|
||||
|
||||
grub_font_loader_init ();
|
||||
font = grub_font_load (fontfull);
|
||||
if (!font)
|
||||
{
|
||||
grub_util_error (_("cannot open `%s': %s"), arguments.font,
|
||||
grub_errmsg);
|
||||
}
|
||||
|
||||
width = grub_font_get_string_width (font, text) + 10;
|
||||
height = grub_font_get_height (font);
|
||||
|
||||
grub_memset (&framebuffer, 0, sizeof (framebuffer));
|
||||
|
||||
grub_video_fb_init ();
|
||||
|
||||
framebuffer.mode_info.width = width;
|
||||
framebuffer.mode_info.height = height;
|
||||
framebuffer.mode_info.pitch = width;
|
||||
|
||||
framebuffer.mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR;
|
||||
framebuffer.mode_info.bpp = 8;
|
||||
framebuffer.mode_info.bytes_per_pixel = 1;
|
||||
framebuffer.mode_info.number_of_colors = 256;
|
||||
|
||||
framebuffer.mode_info.blit_format = grub_video_get_blit_format (&framebuffer.mode_info);
|
||||
|
||||
/* For some reason sparc64 uses 32-bit pointer too. */
|
||||
framebuffer.ptr = xmalloc (height * width);
|
||||
|
||||
grub_video_fb_create_render_target_from_pointer (&framebuffer.render_target,
|
||||
&framebuffer.mode_info,
|
||||
framebuffer.ptr);
|
||||
grub_video_fb_set_active_render_target (framebuffer.render_target);
|
||||
grub_video_fb_set_palette (0, ARRAY_SIZE (ieee1275_palette),
|
||||
ieee1275_palette);
|
||||
|
||||
grub_video_set_adapter (&grub_video_text_render_adapter);
|
||||
|
||||
fg = grub_video_map_rgb (arguments.fgcolor.red,
|
||||
arguments.fgcolor.green,
|
||||
arguments.fgcolor.blue);
|
||||
bg = grub_video_map_rgb (arguments.bgcolor.red,
|
||||
arguments.bgcolor.green,
|
||||
arguments.bgcolor.blue);
|
||||
|
||||
grub_memset (framebuffer.ptr, bg, height * width);
|
||||
grub_font_draw_string (text, font, fg,
|
||||
5, grub_font_get_ascent (font));
|
||||
|
||||
grub_video_set_adapter (0);
|
||||
|
||||
head.magic = 1;
|
||||
head.width = grub_cpu_to_be16 (width);
|
||||
head.height = grub_cpu_to_be16 (height);
|
||||
fwrite (&head, 1, sizeof (head), out);
|
||||
fwrite (framebuffer.ptr, 1, width * height, out);
|
||||
|
||||
if (out != stdout)
|
||||
fclose (out);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,146 +0,0 @@
|
|||
#! /bin/sh
|
||||
set -e
|
||||
|
||||
# Make GRUB rescue image
|
||||
# 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.
|
||||
prefix="@prefix@"
|
||||
exec_prefix="@exec_prefix@"
|
||||
bindir="@bindir@"
|
||||
libdir="@libdir@"
|
||||
PACKAGE_NAME=@PACKAGE_NAME@
|
||||
PACKAGE_TARNAME=@PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION=@PACKAGE_VERSION@
|
||||
input_dir="${libdir}/@PACKAGE@/powerpc-ieee1275"
|
||||
datarootdir="@datarootdir@"
|
||||
datadir="@datadir@"
|
||||
if [ "x$pkgdatadir" = x ]; then
|
||||
pkgdatadir="${datadir}/@PACKAGE@"
|
||||
fi
|
||||
|
||||
self=`basename $0`
|
||||
|
||||
grub_mkimage="${bindir}/@grub_mkimage@"
|
||||
|
||||
export TEXTDOMAIN=@PACKAGE@
|
||||
export TEXTDOMAINDIR="@localedir@"
|
||||
|
||||
. "${pkgdatadir}/grub-mkconfig_lib"
|
||||
|
||||
# Usage: usage
|
||||
# Print the usage.
|
||||
usage () {
|
||||
gettext_printf "Usage: %s [OPTION] SOURCE...\n" "$self"
|
||||
gettext "Make GRUB CD-ROM, disk, pendrive and floppy bootable image."; echo
|
||||
echo
|
||||
print_option_help "-h, --help" "$(gettext "print this message and exit")"
|
||||
print_option_help "-v, --version" "$(gettext "print the version information and exit")"
|
||||
print_option_help "--modules=$(gettext "MODULES")" "$(gettext "pre-load specified modules MODULES")"
|
||||
print_option_help "--grub-mkimage=$(gettext "FILE")" "$(gettext "use FILE as grub-mkimage")"
|
||||
echo
|
||||
gettext_printf "%s generates a bootable rescue image with specified source files, source directories, or mkisofs options listed by the output of \`%s'\n" "genisoimage -help" "$self" | grub_fmt
|
||||
echo
|
||||
gettext "Report bugs to <bug-grub@gnu.org>."; echo
|
||||
}
|
||||
|
||||
argument () {
|
||||
opt=$1
|
||||
shift
|
||||
|
||||
if test $# -eq 0; then
|
||||
gettext_printf "%s: option requires an argument -- \`%s'\n" "$0" "$opt" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
echo $1
|
||||
}
|
||||
|
||||
source=
|
||||
output_image=
|
||||
|
||||
# Check the arguments.
|
||||
while test $# -gt 0
|
||||
do
|
||||
option=$1
|
||||
shift
|
||||
|
||||
case "$option" in
|
||||
-h | --help)
|
||||
usage
|
||||
exit 0 ;;
|
||||
-v | --version)
|
||||
echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}"
|
||||
exit 0 ;;
|
||||
|
||||
--modules)
|
||||
modules=`argument $option "$@"`; shift ;;
|
||||
--modules=*)
|
||||
modules=`echo "$option" | sed 's/--modules=//'` ;;
|
||||
|
||||
--override-directory)
|
||||
input_dir=`argument $option "$@"`; shift ;;
|
||||
--override-directory=*)
|
||||
input_dir=`echo "$option" | sed 's/--override-directory=//'` ;;
|
||||
|
||||
--grub-mkimage)
|
||||
grub_mkimage=`argument $option "$@"`; shift ;;
|
||||
--grub-mkimage=*)
|
||||
grub_mkimage=`echo "$option" | sed 's/--grub-mkimage=//'` ;;
|
||||
|
||||
-o | --output)
|
||||
output_image=`argument $option "$@"`; shift ;;
|
||||
--output=*)
|
||||
output_image=`echo "$option" | sed 's/--output=//'` ;;
|
||||
|
||||
--rom-directory=*)
|
||||
;;
|
||||
--rom-directory)
|
||||
shift ;;
|
||||
|
||||
*)
|
||||
source="${source} ${option} $@"; break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if test "x$output_image" = x; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "x${modules}" = "x" ] ; then
|
||||
modules=`cd ${input_dir}/ && ls *.mod`
|
||||
fi
|
||||
|
||||
map_file=`mktemp "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
cat >${map_file} <<EOF
|
||||
# EXTN XLate CREATOR TYPE Comment
|
||||
grub.img Raw 'UNIX' 'tbxi' "bootstrap"
|
||||
EOF
|
||||
|
||||
iso_dir=`mktemp -d "${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` || exit 1
|
||||
boot_dir=${iso_dir}/boot/grub
|
||||
mkdir ${iso_dir}/boot
|
||||
mkdir ${boot_dir}
|
||||
core_img=${boot_dir}/grub.img
|
||||
${grub_mkimage} -O powerpc-ieee1275 -n -d ${input_dir}/ -o ${core_img} ${modules}
|
||||
genisoimage -graft-points -hfs -part -no-desktop -r -J -o ${output_image} \
|
||||
-map ${map_file} -hfs-bless ${boot_dir} -chrp-boot -sysid PPC \
|
||||
${iso_dir} ${source}
|
||||
|
||||
rm -rf ${iso_dir}
|
||||
rm -f ${map_file}
|
||||
|
||||
exit 0
|
Loading…
Add table
Add a link
Reference in a new issue