Comment 16 for bug 1298894

Revision history for this message
Thomas Schmitt (scdbackup) wrote :

Hi,

> http://cdimage.ubuntu.com/daily-live/current/trusty-desktop-amd64.iso

If you are curious enough, here is a C program which i assume
makes the trusty-desktop-amd64.iso bootable on your 2,1.

- Put both, a copy of the ISO and the C program as
    make_single_eltorito.c
  into the same directory.

- Compile the C program:
    cc -g -Wall -o make_single_eltorito make_single_eltorito.c

- Run it without arguments (the ISO name is hardcoded in variable iso_name):
    ./make_single_eltorito

- Put the ISO onto DVD and try booting.

========================= Begin of C program =========================
/*
 Removes all entries but the first one from the El Torito boot catalog of
   http://cdimage.ubuntu.com/daily-live/current/trusty-desktop-amd64.iso

 Compile by:
   cc -g -Wall -o make_single_eltorito make_single_eltorito.c

 Run without arguments in the directory where the ISO image is stored.
*/

#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

static char *iso_name = {"trusty-desktop-amd64.iso"};

int main(int argc, char **argv)
{
  int fd, ret;
  unsigned char buf[2048 - 64];
  off_t lba;
  size_t buf_size = 2048 - 64;

  fd = open(iso_name, O_RDWR);
  if (fd == -1)
    goto err_ex;
  if (lseek(fd, (off_t) 32768 + 2048 + 71, SEEK_SET) == -1)
    goto err_ex;
  ret = read(fd, buf, 4);
  if (ret == -1)
    goto err_ex;
  if (ret < 4) {
    fprintf(stderr, "Cannot read 4 bytes from %s\n", iso_name);
    exit(1);
  }
  lba = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24);
  if (lseek(fd, lba * 2048 + 64, SEEK_SET) == -1)
    goto err_ex;
  memset(buf, 0, buf_size);
  ret = write(fd, buf, buf_size);
  if (ret == -1)
    goto err_ex;
  if (ret < buf_size) {
    fprintf(stderr, "Cannot write %d bytes to %s\n", (int) buf_size, iso_name);
    exit(1);
  }
  close(fd);
  printf("done\n");
  exit(0);
err_ex:;
  perror(iso_name);
  exit(1);
}
========================== End of C program ==========================
(Of course it would apply to any El Torito equipped ISO, not only to
the Ubuntu image in question.)

Have a nice day :)

Thomas