diff -ur xorriso-1.2.1/libisofs/eltorito.c xorriso-1.2.1-mod/libisofs/eltorito.c --- xorriso-1.2.1/libisofs/eltorito.c 2012-01-27 17:02:41.000000000 +0100 +++ xorriso-1.2.1-mod/libisofs/eltorito.c 2012-01-30 02:34:48.266770529 +0100 @@ -1113,6 +1113,16 @@ ret = make_boot_info_table(buf, t->ms_block + (uint32_t) 16, t->bootsrc[idx]->sections[0].block, (uint32_t) imgsize); + if (1) { + uint64_t blk; + if (imgsize < 1024) + return iso_msg_submit(t->image->id, ISO_ISOLINUX_CANT_PATCH, 0, + "Isolinux image too small. We won't patch it."); + + blk = ((uint64_t) t->bootsrc[idx]->sections[0].block) * 4 + 2; + iso_lsb((buf + 1024 - 12), blk & 0xffffffff, 4); + iso_lsb((buf + 1024 - 8), blk >> 32, 4); + } return ret; } diff -ur xorriso-1.2.1/libisofs/system_area.c xorriso-1.2.1-mod/libisofs/system_area.c --- xorriso-1.2.1/libisofs/system_area.c 2012-01-27 17:02:41.000000000 +0100 +++ xorriso-1.2.1-mod/libisofs/system_area.c 2012-01-30 02:30:27.017381391 +0100 @@ -182,7 +182,7 @@ */ static int make_grub_msdos_label(uint32_t img_blocks, int sph, int hpc, - uint8_t *buf, int flag) + uint8_t *buf, int flag, uint64_t blk) { uint8_t *wpt; uint32_t end_lba, end_sec, end_head, end_cyl; @@ -191,6 +191,11 @@ iso_compute_cyl_head_sec(&img_blocks, hpc, sph, &end_lba, &end_sec, &end_head, &end_cyl, 0); + blk = blk * 4 + 1; + + wpt = buf + 0x5c; + for (i = 0; i < 8; i++) + wpt[i] = blk >> (i * 8); /* 1) Zero-fill 446-510 */ wpt = buf + 446; memset(wpt, 0, 64); @@ -739,7 +744,8 @@ if (sa_type == 0 && (t->system_area_options & 1)) { /* Write GRUB protective msdos label, i.e. a simple partition table */ ret = make_grub_msdos_label(img_blocks, t->partition_secs_per_head, - t->partition_heads_per_cyl, buf, 0); + t->partition_heads_per_cyl, buf, 0, + t->bootsrc[0]->sections[0].block); if (ret != ISO_SUCCESS) /* error should never happen */ return ISO_ASSERT_FAILURE; } else if(sa_type == 0 && (t->system_area_options & 2)) { @@ -766,7 +772,8 @@ } else if ((t->partition_offset > 0 || will_append) && sa_type == 0) { /* Write a simple partition table. */ ret = make_grub_msdos_label(img_blocks, t->partition_secs_per_head, - t->partition_heads_per_cyl, buf, 2); + t->partition_heads_per_cyl, buf, 2, + t->bootsrc[0]->sections[0].block); if (ret != ISO_SUCCESS) /* error should never happen */ return ISO_ASSERT_FAILURE; if (t->partition_offset == 0) { diff -ur xorriso-1.2.1/xorriso/emulators.c xorriso-1.2.1-mod/xorriso/emulators.c --- xorriso-1.2.1/xorriso/emulators.c 2012-01-27 17:02:41.000000000 +0100 +++ xorriso-1.2.1-mod/xorriso/emulators.c 2012-01-30 01:56:29.851351371 +0100 @@ -1895,6 +1895,14 @@ goto problem_handler_boot; if(strcmp(argpt, "-isohybrid-mbr")==0) xorriso->system_area_options= (xorriso->system_area_options & ~3) | 2; + } else if(strcmp(argpt, "--grub-boot")==0) { + if(i+1>=argc) + goto not_enough_args; + i++; + ret= Xorriso_set_system_area_path(xorriso, argv[i], 0); + if(ret <= 0) + goto problem_handler_boot; + xorriso->patch_isolinux_image= 1 | 4; } else if(strcmp(argpt, "--protective-msdos-label")==0) { xorriso->system_area_options= (xorriso->system_area_options & ~3) | 1; } else if(strcmp(argpt, "--boot-catalog-hide")==0) {