2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
* util/mkisofs/mkisofs.c (use_embedded_boot, boot_image_embed): New variables. (ld_options, main): Recognize `--embedded-boot'. * util/mkisofs/mkisofs.h (use_embedded_boot, boot_image_embed): New declarations. * util/mkisofs/write.c (PADBLOCK_SIZE): New variable. (padblock_size): Use `PADBLOCK_SIZE' instead of hardcoding 16. (padblock_write): Likewise. Rewrite to support embedded boot image. * util/grub-mkrescue.in: When building i386-pc images, embed core.img for BIOS-based disk boot instead of only ElTorito.
This commit is contained in:
parent
b15937b110
commit
0ae5692966
5 changed files with 74 additions and 35 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* util/mkisofs/mkisofs.c (use_embedded_boot, boot_image_embed): New
|
||||
variables.
|
||||
(ld_options, main): Recognize `--embedded-boot'.
|
||||
* util/mkisofs/mkisofs.h (use_embedded_boot, boot_image_embed): New
|
||||
declarations.
|
||||
* util/mkisofs/write.c (PADBLOCK_SIZE): New variable.
|
||||
(padblock_size): Use `PADBLOCK_SIZE' instead of hardcoding 16.
|
||||
(padblock_write): Likewise. Rewrite to support embedded boot image.
|
||||
|
||||
* util/grub-mkrescue.in: When building i386-pc images, embed core.img
|
||||
for BIOS-based disk boot instead of only ElTorito.
|
||||
|
||||
2009-12-21 Robert Millan <rmh.grub@aybabtu.com>
|
||||
|
||||
* util/grub-mkrescue.in: Remove `configfile' and `sh' from i386-pc
|
||||
|
|
|
@ -162,6 +162,10 @@ if test -e "${pc_dir}" ; then
|
|||
grub-mkimage -d ${pc_dir}/ -o ${core_img} --prefix=/boot/grub/i386-pc \
|
||||
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} /dev/zero | dd bs=1024 count=32 > ${embed_img}
|
||||
|
||||
rm -f ${core_img}
|
||||
|
||||
modules="$(cat ${pc_dir}/partmap.lst) ${modules}"
|
||||
|
@ -171,11 +175,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}
|
||||
rm -rf ${iso9660_dir}
|
||||
|
||||
rm -f ${embed_img}
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -90,6 +90,7 @@ 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_boot_info_table = 0;
|
||||
int use_RockRidge = 0;
|
||||
int use_Joliet = 0;
|
||||
|
@ -100,17 +101,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;
|
||||
|
||||
|
@ -209,6 +211,8 @@ 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 },
|
||||
{ {"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 +723,13 @@ 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++;
|
||||
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 'c':
|
||||
use_eltorito++;
|
||||
|
|
|
@ -296,6 +296,7 @@ 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_eltorito_emul_floppy;
|
||||
extern int use_boot_info_table;
|
||||
extern int use_RockRidge;
|
||||
|
@ -438,20 +439,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;
|
||||
|
||||
|
|
|
@ -1344,6 +1344,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 +1360,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 +1423,23 @@ static int FDECL1(dirtree_cleanup, FILE *, outfile)
|
|||
|
||||
static int FDECL1(padblock_write, FILE *, outfile)
|
||||
{
|
||||
char buffer[2048];
|
||||
int i;
|
||||
char *buffer;
|
||||
int i;
|
||||
|
||||
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;
|
||||
xfwrite (buffer, 1, 2048 * PADBLOCK_SIZE, outfile);
|
||||
last_extent_written += PADBLOCK_SIZE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue