summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/etdump/Makefile14
-rw-r--r--usr.bin/etdump/etdump.1104
-rw-r--r--usr.bin/etdump/etdump.c269
-rw-r--r--usr.bin/etdump/etdump.h49
-rw-r--r--usr.bin/etdump/output_shell.c69
-rw-r--r--usr.bin/etdump/output_text.c97
6 files changed, 602 insertions, 0 deletions
diff --git a/usr.bin/etdump/Makefile b/usr.bin/etdump/Makefile
new file mode 100644
index 0000000..648a32e
--- /dev/null
+++ b/usr.bin/etdump/Makefile
@@ -0,0 +1,14 @@
+# $FreeBSD$
+
+PROG= etdump
+
+MAKEFS_SRC= ${SRCTOP}/usr.sbin/makefs
+
+CFLAGS+= -I${SRCTOP}/sys/fs/cd9660 -I${MAKEFS_SRC} \
+ -I${MAKEFS_SRC}/cd9660
+
+.PATH: ${MAKEFS_SRC}/cd9660
+
+SRCS= etdump.c output_shell.c output_text.c cd9660_conversion.c
+
+.include <bsd.prog.mk>
diff --git a/usr.bin/etdump/etdump.1 b/usr.bin/etdump/etdump.1
new file mode 100644
index 0000000..fdf5a3c
--- /dev/null
+++ b/usr.bin/etdump/etdump.1
@@ -0,0 +1,104 @@
+.\" Copyright (c) 2018 iXsystems, Inc
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+.\" SUCH DAMAGE.
+.\"
+.\" $FreeBSD$
+.\"
+.Dd April 3, 2018
+.Dt ETDUMP 8
+.Os
+.Sh NAME
+.Nm etdump
+.Nd Dump El Torito boot catalog information from ISO images
+.Sh SYNOPSIS
+.Nm
+.Op Fl f Ar format
+.Op Fl o Ar file
+.Ar
+.Sh DESCRIPTION
+This program reads El Torito boot catalog information from an ISO image and
+outputs it in various formats.
+It can be used to check the catalog in an image or to output catalog data in
+a format that can be used by other tools such as shell scripts.
+.Pp
+Supported options are:
+.Bl -tag -width flag
+.It Fl f Ar format Fl -format Ar format
+Select the output format.
+Supported output formats are:
+.Bl -tag -width shell -offset indent
+.It Sy text
+Human-readable text (default)
+.It Sy shell
+Each boot entry is emitted as a string suitable for passing to a sh-compatible
+eval command.
+The variables emitted are:
+.Bl -tag -width et_platform -offset indent
+.It et_platform
+The platform ID from the section header.
+Set to 'default' for the initial (default) entry.
+.It et_system
+The system ID from the boot entry.
+.It et_lba
+The starting LBA (2048-byte blocks) of the boot image.
+.It et_sectors
+The number of sectors (512-byte sectors) that comprise the boot image.
+.El
+.El
+.It Fl o Ar file Fl -output Ar file
+Write output to
+.Ar file .
+If '-' is specified then standard out is used.
+.El
+.Sh EXAMPLES
+To see what entries are in a given boot catalog run
+.Nm
+passing the filename of the image as an argument like so:
+.Bd -literal -offset indent
+% etdump bootonly.iso
+Image in bootonly.iso
+Default entry
+ System i386
+ Start LBA 420 (0x1a4), sector count 4 (0x4)
+ Media type: no emulation
+
+Section header: efi, final
+ Section entry
+ System i386
+ Start LBA 20 (0x14), sector count 1600 (0x640)
+ Media type: no emulation
+.Ed
+.Pp
+To use the output in a shell script a for loop can be used to iterate over the
+entries returned using eval:
+.Bd -literal -offset indent
+for entry in `etdump --format shell bootonly.iso`; do
+ eval $entry
+ echo $et_platform $et_system $et_lba $et_sectors
+done
+.Ed
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Fx 12.0 .
diff --git a/usr.bin/etdump/etdump.c b/usr.bin/etdump/etdump.c
new file mode 100644
index 0000000..aedd53a
--- /dev/null
+++ b/usr.bin/etdump/etdump.c
@@ -0,0 +1,269 @@
+/*-
+ * Copyright (c) 2018 iXsystems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <err.h>
+#include <getopt.h>
+#include <libgen.h>
+#include <stdbool.h>
+#include <stdio.h>
+
+#include "cd9660.h"
+#include "cd9660_eltorito.h"
+
+#include "etdump.h"
+
+const char *
+system_id_string(u_char system_id)
+{
+
+ switch (system_id) {
+ case ET_SYS_X86:
+ return ("i386");
+ case ET_SYS_PPC:
+ return ("powerpc");
+ case ET_SYS_MAC:
+ return ("mac");
+ case ET_SYS_EFI:
+ return ("efi");
+ default:
+ return ("invalid");
+ }
+}
+
+const char *
+media_type_string(u_char media_type)
+{
+
+ switch (media_type) {
+ case ET_MEDIA_NOEM:
+ return ("no emulation");
+ case ET_MEDIA_12FDD:
+ return ("1.2MB FDD");
+ case ET_MEDIA_144FDD:
+ return ("1.44MB FDD");
+ case ET_MEDIA_288FDD:
+ return ("2.88MB FDD");
+ case ET_MEDIA_HDD:
+ return ("HDD");
+ default:
+ return ("invalid");
+ }
+}
+
+static int
+read_sector(FILE *iso, daddr_t sector, char *buffer)
+{
+
+ if (fseek(iso, sector * ISO_DEFAULT_BLOCK_SIZE, SEEK_SET) != 0) {
+ return (errno);
+ }
+ if (fread(buffer, ISO_DEFAULT_BLOCK_SIZE, 1, iso) != 1) {
+ return (errno);
+ }
+ return (0);
+}
+
+static bool
+boot_catalog_valid(char *entry)
+{
+ boot_catalog_validation_entry *ve;
+ int16_t checksum, sum;
+ unsigned char *csptr;
+ size_t i;
+
+ ve = (boot_catalog_validation_entry *)entry;
+
+ checksum = isonum_721(ve->checksum);
+ cd9660_721(0, ve->checksum);
+ csptr = (unsigned char *)ve;
+
+ for (i = sum = 0; i < sizeof(*ve); i += 2) {
+ sum += (int16_t)csptr[i];
+ sum += 256 * (int16_t)csptr[i + 1];
+ }
+ if (sum + checksum != 0) {
+ return (false);
+ }
+
+ cd9660_721(checksum, ve->checksum);
+ return (true);
+}
+
+static int
+dump_section(char *buffer, size_t offset, FILE *outfile, const char *filename,
+ struct outputter *outputter)
+{
+ boot_catalog_section_header *sh;
+ u_char platform_id;
+ int i;
+ size_t entry_offset;
+ boot_catalog_section_entry *entry;
+
+ sh = (boot_catalog_section_header *)&buffer[offset];
+ if (outputter->output_section != NULL) {
+ outputter->output_section(outfile, filename, sh);
+ }
+
+ platform_id = sh->platform_id[0];
+
+ if (outputter->output_entry != NULL) {
+ for (i = 1; i <= (int)sh->num_section_entries[0]; i++) {
+ entry_offset = offset + i * ET_BOOT_ENTRY_SIZE;
+ entry =
+ (boot_catalog_section_entry *)&buffer[entry_offset];
+ outputter->output_entry(outfile, filename, entry,
+ platform_id, false);
+ }
+ }
+
+ return (1 + (int)sh->num_section_entries[0]);
+}
+
+static void
+dump_eltorito(FILE *iso, const char *filename, FILE *outfile,
+ struct outputter *outputter)
+{
+ char buffer[ISO_DEFAULT_BLOCK_SIZE], *entry;
+ boot_volume_descriptor *bvd;
+ daddr_t boot_catalog;
+ size_t offset;
+ int entry_count;
+
+ if (read_sector(iso, 17, buffer) != 0)
+ err(1, "failed to read from image");
+
+ bvd = (boot_volume_descriptor *)buffer;
+ if (memcmp(bvd->identifier, ISO_VOLUME_DESCRIPTOR_STANDARD_ID, 5) != 0)
+ warnx("%s: not a valid ISO", filename);
+ if (bvd->boot_record_indicator[0] != ISO_VOLUME_DESCRIPTOR_BOOT)
+ warnx("%s: not an El Torito bootable ISO", filename);
+ if (memcmp(bvd->boot_system_identifier, ET_ID, 23) != 0)
+ warnx("%s: not an El Torito bootable ISO", filename);
+
+ boot_catalog = isonum_731(bvd->boot_catalog_pointer);
+
+ if (read_sector(iso, boot_catalog, buffer) != 0)
+ err(1, "failed to read from image");
+
+ entry = buffer;
+ offset = 0;
+
+ if (!boot_catalog_valid(entry))
+ warnx("%s: boot catalog checksum is invalid", filename);
+
+ if (outputter->output_image != NULL)
+ outputter->output_image(outfile, filename, bvd);
+
+ offset += ET_BOOT_ENTRY_SIZE;
+ entry = &buffer[offset];
+ if (outputter->output_entry != NULL)
+ outputter->output_entry(outfile, filename,
+ (boot_catalog_section_entry *)entry, 0, true);
+
+ offset += ET_BOOT_ENTRY_SIZE;
+
+ while (offset < ISO_DEFAULT_BLOCK_SIZE) {
+ entry = &buffer[offset];
+
+ if ((uint8_t)entry[0] != ET_SECTION_HEADER_MORE &&
+ (uint8_t)entry[0] != ET_SECTION_HEADER_LAST)
+ break;
+
+ entry_count = dump_section(buffer, offset, outfile, filename,
+ outputter);
+
+ offset += entry_count * ET_BOOT_ENTRY_SIZE;
+ }
+}
+
+static void
+usage(const char *progname)
+{
+ char *path;
+
+ path = strdup(progname);
+
+ fprintf(stderr, "usage: %s [-f format] [-o filename] filename [...]\n",
+ basename(path));
+ fprintf(stderr, "\tsupported output formats: shell, text\n");
+ exit(1);
+}
+
+int
+main(int argc, char **argv)
+{
+ int ch, i;
+ FILE *outfile, *iso;
+ struct outputter *outputter;
+
+ outfile = stdout;
+ outputter = output_text;
+
+ static struct option longopts[] = {
+ { "format", required_argument, NULL, 'f' },
+ { "output", required_argument, NULL, 'o' },
+ { NULL, 0, NULL, 0 },
+ };
+
+ while ((ch = getopt_long(argc, argv, "f:o:", longopts, NULL)) != -1) {
+ switch (ch) {
+ case 'f':
+ if (strcmp(optarg, "shell") == 0)
+ outputter = output_shell;
+ else if (strcmp(optarg, "text") == 0)
+ outputter = output_text;
+ else
+ usage(argv[0]);
+ break;
+ case 'o':
+ if (strcmp(optarg, "-") == 0) {
+ outfile = stdout;
+ } else if ((outfile = fopen(optarg, "w")) == NULL) {
+ err(1, "unable to open %s for output", optarg);
+ }
+ break;
+ default:
+ usage(argv[0]);
+ }
+ }
+
+ argc -= optind;
+ argv += optind;
+
+ for (i = 0; i < argc; i++) {
+ if (strcmp(argv[i], "-") == 0) {
+ iso = stdin;
+ } else {
+ iso = fopen(argv[i], "r");
+ if (iso == NULL)
+ err(1, "could not open %s", argv[1]);
+ }
+ dump_eltorito(iso, argv[i], outfile, outputter);
+ }
+}
diff --git a/usr.bin/etdump/etdump.h b/usr.bin/etdump/etdump.h
new file mode 100644
index 0000000..d266f99
--- /dev/null
+++ b/usr.bin/etdump/etdump.h
@@ -0,0 +1,49 @@
+/*-
+ * Copyright (c) 2018 iXsystems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef _ETDUMP_H_
+#define _ETDUMP_H_
+
+struct outputter {
+ void (*output_image)(FILE *outfile, const char *filename,
+ boot_volume_descriptor *bvd);
+ void (*output_section)(FILE *outfile, const char *filename,
+ boot_catalog_section_header *bcsh);
+ void (*output_entry)(FILE *outfile, const char *filename,
+ boot_catalog_section_entry *bcse,
+ u_char platform_id, bool initial);
+};
+
+extern struct outputter *output_text;
+extern struct outputter *output_shell;
+
+const char *system_id_string(u_char system_id);
+const char *media_type_string(u_char media_type);
+
+#endif /* _ETDUMP_H_ */
+
diff --git a/usr.bin/etdump/output_shell.c b/usr.bin/etdump/output_shell.c
new file mode 100644
index 0000000..d1e1d57
--- /dev/null
+++ b/usr.bin/etdump/output_shell.c
@@ -0,0 +1,69 @@
+/*-
+ * Copyright (c) 2018 iXsystems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdbool.h>
+#include <stdio.h>
+
+#include "cd9660.h"
+#include "cd9660_eltorito.h"
+
+#include "etdump.h"
+
+static void
+output_entry(FILE *outfile, const char *filename __unused,
+ boot_catalog_section_entry *bcse, u_char platform_id, bool initial)
+{
+ const char *platform;
+
+ switch (bcse->boot_indicator[0]) {
+ case ET_BOOTABLE:
+ break;
+ case ET_NOT_BOOTABLE:
+ default:
+ return;
+ }
+
+ if (initial)
+ platform = "default";
+ else
+ platform = system_id_string(platform_id);
+
+ fprintf(outfile,
+ "et_platform=%s;et_system=%s;et_lba=%d;et_sectors=%d\n",
+ platform, system_id_string(bcse->system_type[0]),
+ isonum_731(bcse->load_rba), isonum_721(bcse->sector_count));
+}
+
+static struct outputter _output_shell = {
+ .output_image = NULL,
+ .output_section = NULL,
+ .output_entry = output_entry,
+};
+
+struct outputter *output_shell = &_output_shell;
diff --git a/usr.bin/etdump/output_text.c b/usr.bin/etdump/output_text.c
new file mode 100644
index 0000000..26b19e9
--- /dev/null
+++ b/usr.bin/etdump/output_text.c
@@ -0,0 +1,97 @@
+/*-
+ * Copyright (c) 2018 iXsystems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD$");
+
+#include <stdbool.h>
+#include <stdio.h>
+
+#include "cd9660.h"
+#include "cd9660_eltorito.h"
+
+#include "etdump.h"
+
+static void
+output_image(FILE *outfile, const char *filename, boot_volume_descriptor *bvd __unused)
+{
+
+ fprintf(outfile, "Image in %s\n", filename);
+}
+
+static void
+output_section(FILE *outfile, const char *filename __unused,
+ boot_catalog_section_header *bcsh)
+{
+
+ fprintf(outfile, "\nSection header: %s",
+ system_id_string(bcsh->platform_id[0]));
+
+ if (bcsh->header_indicator[0] == ET_SECTION_HEADER_LAST)
+ fprintf(outfile, ", final\n");
+ else
+ fprintf(outfile, "\n");
+}
+
+static void
+output_entry(FILE *outfile, const char *filename __unused,
+ boot_catalog_section_entry *bcse, u_char platform_id __unused,
+ bool initial)
+{
+ const char *indent;
+
+ switch (bcse->boot_indicator[0]) {
+ case ET_BOOTABLE:
+ break;
+ case ET_NOT_BOOTABLE:
+ default:
+ return;
+ }
+
+ if (initial) {
+ fprintf(outfile, "Default entry\n");
+ indent = "\t";
+ } else {
+ fprintf(outfile, "\tSection entry\n");
+ indent = "\t\t";
+ }
+
+ fprintf(outfile, "%sSystem %s\n", indent,
+ system_id_string(bcse->system_type[0]));
+ fprintf(outfile, "%sStart LBA %d (0x%x), sector count %d (0x%x)\n",
+ indent, isonum_731(bcse->load_rba), isonum_731(bcse->load_rba),
+ isonum_721(bcse->sector_count), isonum_721(bcse->sector_count));
+ fprintf(outfile, "%sMedia type: %s\n", indent,
+ media_type_string(bcse->media_type[0]));
+}
+
+static struct outputter _output_text = {
+ .output_image = output_image,
+ .output_section = output_section,
+ .output_entry = output_entry,
+};
+
+struct outputter *output_text = &_output_text;
OpenPOWER on IntegriCloud