From ebb5937568354cd13afb394b78e406c77b15897d Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Sat, 16 Oct 2010 19:05:46 +0200 Subject: [PATCH] Removed obsolete development macro case. --- libisofs/system_area.c | 118 ----------------------------------------- 1 file changed, 118 deletions(-) diff --git a/libisofs/system_area.c b/libisofs/system_area.c index 8915db7..c21182b 100644 --- a/libisofs/system_area.c +++ b/libisofs/system_area.c @@ -486,9 +486,6 @@ cannot_read:; */ static int make_mipsel_boot_block(Ecma119Image *t, uint8_t *buf, int flag) { - -#ifndef NIX - int ret; uint32_t seg_size, seg_start; IsoNode *iso_node; @@ -527,121 +524,6 @@ static int make_mipsel_boot_block(Ecma119Image *t, uint8_t *buf, int flag) iso_lsb(buf + 28, seg_start, 4); return ISO_SUCCESS; - -#else - - uint32_t load_adr, exec_adr, p_offset, p_filesz, phdr_adr; - uint8_t elf_buf[32]; - char *path = NULL; - IsoNode *iso_node; - Ecma119Node *ecma_node; - IsoStream *stream; - FILE *fp = NULL; - off_t image_size; - int ret; - uint32_t seg_size, seg_start; - - /* Bytes 512 to 32767 may come from image or external file */ - memset(buf, 0, 512); - - if (t->image->num_mips_boot_files <= 0) - return ISO_SUCCESS; - - /* <<< Unused. No partition table or such ? */ - image_size = t->curblock * 2048; - - ret = boot_nodes_from_iso_path(t, t->image->mips_boot_file_paths[0], - &iso_node, &ecma_node, "MIPS boot file", 0); - if (ret < 0) - return ret; - stream = iso_file_get_stream((IsoFile *) iso_node); - - /* <<< This does not work for boot file in old session */ - /* >>> Replace by iso_stream_open(), iso_stream_read() which has to be - done earlier, or system area production must happen before - iso_image_create_burn_source() ends. - */ - path= iso_stream_get_source_path(stream, 0); - if (path == NULL) { - iso_msg_submit(t->image->id, ISO_ASSERT_FAILURE, 0, - "Cannot determine disk path of designated MIPS boot file: '%s'", - t->image->mips_boot_file_paths[0]); - return ISO_ASSERT_FAILURE; - } - fp = fopen(path, "r"); - if (fp == NULL) { -cannot_read:; - iso_msg_submit(t->image->id, ISO_FILE_ERROR, 0, - "Cannot open designated MIPS boot file: '%s'", - path[0]); - if (fp != NULL) - fclose(fp); - free(path); - return ISO_FILE_ERROR; - } - free(path); - path = NULL; - - /* Read necessary ELF info */ - ret = fread(elf_buf, 32, 1, fp); - if (ret != 1) - goto cannot_read; - - - /* 24 - 27 | e_entry | Entry point virtual address */ - exec_adr = iso_read_lsb(elf_buf + 24, 4); - - /* 28 - 31 | e_phoff | Program header table file offset */ - phdr_adr = iso_read_lsb(elf_buf + 28, 4); - - /* <<< This does not work for boot file in old session */ - /* >>> replace by skip-reading of stream data */ - ret = fseek(fp, (long) phdr_adr, SEEK_SET); - if (ret != 1) - goto cannot_read; - ret = fread(elf_buf, 20, 1, fp); - if (ret != 1) - goto cannot_read; - - /* 4 - 7 | p_offset | Segment file offset */ - p_offset = iso_read_lsb(elf_buf + 4, 4); - - /* 8 - 11 | p_vaddr | Segment virtual address */ - load_adr = iso_read_lsb(elf_buf + 8, 4); - - /* 16 - 19 | p_filesz | Segment size in file */ - p_filesz = iso_read_lsb(elf_buf + 16, 4); - - fclose(fp); - fp = NULL; - - /* Write DEC Bootblock */ - - /* 8 - 11 | 0x0002757a | Magic number */ - iso_lsb(buf + 8, 0x0002757a, 4); - - /* 12 - 15 | 1 | Mode 1: Multi extent boot */ - iso_lsb(buf + 12, 1, 4); - - /* 16 - 19 | load_adr | Load address */ - iso_lsb(buf + 16, load_adr, 4); - - /* 20 - 23 | exec_adr | Execution address */ - iso_lsb(buf + 20, exec_adr, 4); - - /* 24 - 27 | seg_size | Segment size in file. */ - seg_size = (p_filesz + 511) / 512; - iso_lsb(buf + 24, seg_size, 4); - - /* 28 - 31 | seg_start | Segment file offset */ - seg_start = ecma_node->info.file->sections[0].block * 4 - + (p_offset + 511) / 512; - iso_lsb(buf + 28, seg_start, 4); - - return ISO_SUCCESS; - -#endif /* NIX */ - }