summaryrefslogtreecommitdiff
path: root/utils
Commit message (Collapse)AuthorAgeFilesLines
* utils/isohybrid.c: Enable promised options -u, -m, -bThomas Schmitt2014-06-241-1/+1
| | | | | | | This change enables the single-letter options -u, -m, -b as promised by the help text. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* isohybrid: Function to write UTF-16LE stringsH. Peter Anvin2014-06-231-9/+19
| | | | | | | Rather than open-coding the content of UTF-16LE strings, just add a simple function to convert ASCII (only) strings to UTF-16LE. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* utils/isohybrid.c: Introduce option --mbr and make isohybrid.c compilable ↵Thomas Schmitt2014-06-231-2/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | standalone Although isohybrid.c is supposed to be a companion of the local SYSLINUX installation, there may be situations where the file isolinux.bin and the matching MBR template do not stem directly from such an installation. This change adds an option --mbr, which allows to load an MBR template file. This may be an isohdp[fp]x*.bin MBR template from the local SYSLINUX installation, or the first 512 bytes of the isohybrid-capable ISO image from which isolinux.bin and the other ISOLINUX files are taken. If macro ISOHYBRID_C_STANDALONE is defined, then the hardcoded MBR templates are not accessible and isohdpfx.o is not needed at compile time. In this case, option --mbr becomes mandatory. I used this for testing my changes with Fedora-Live-Desktop-x86_64-20-1.iso. isohybrid.c is then compilable without further components of ISOLINUX by: cc -DISOHYBRID_C_STANDALONE -Wall -o isohybrid isohybrid.c -luuid Test run: cp Fedora-Live-Desktop-x86_64-20-1.iso \ Fedora-Live-Desktop-x86_64-20-1-rehybrid.iso valgrind ./isohybrid --uefi --mac \ --mbr Fedora-Live-Desktop-x86_64-20-1.mbr \ Fedora-Live-Desktop-x86_64-20-1-rehybrid.iso yields: ==13828== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 1) ... ==13828== LEAK SUMMARY: ==13828== definitely lost: 2,048 bytes in 1 blocks. (Not that valgrind would have detected the memcpy() abuse of patch 001. But at least i seem to have not introduced more obvious sins.) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* utils/isohybrid.c: Change all fseek(3) to fseeko(3)Thomas Schmitt2014-06-231-10/+9
| | | | | | | | | | It seems unwise to offer future programmers fseek(3) calls for copy+paste. They are simply insufficient for large image files. This change switches all calls of fseek(3) to fseeko(3) and takes care that the offset value if of type off_t. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* utils/isohybrid.c: Write GPT backup to the very end of the imageThomas Schmitt2014-06-231-3/+3
| | | | | | | | | | The GPT backup header block should start 512 bytes before the end of the image file (resp. end of the disk device). This block and the backup GPT array were wrongly written 512 bytes too early. This change brings the backup GPT at its correct position. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* utils/isohybrid.c: Correct end block address of first GPT partitionThomas Schmitt2014-06-231-1/+1
| | | | | | | | | | | The GPT partition 1 covers the whole ISO filesystem size. GPT specs demand that the partition end block number shall be the last valid block in the partition. isohybrid.c rather wrote the number of the first block after the partition end. This change reduces the number by 1. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* utils/isohybrid.c: Correct blocking factor in APM partition block countsThomas Schmitt2014-06-231-5/+5
| | | | | | | | | The block counts in the APM partitions assumed 512 bytes per block, whereas the start block numbers assume 2048 as announced in the APM header. This change divides the affected block counts by 4 to correct the assumption. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* utils/isohybrid.c: Encode GPT partition names as UTF-16LEThomas Schmitt2014-06-231-3/+8
| | | | | | | | | | | | The worst sin of isohybrid.c was to compose GPT partition names by 8-bit characters and to memcpy() them as if they were 16 bit wide. GPT names are encoded as UTF-16LE. It is trivial to create this encoding from 7-bit ASCII. This change introduces two byte arrays with the desired UTF-16LE names which replace the string constants "ISOHybrid ISO" and "ISOHybrid". Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* isohybrid: define _FILE_OFFSET_BITS in the file itselfH. Peter Anvin2014-06-191-0/+1
| | | | | | | On general principles, define _FILE_OFFSET_BITS in the file itself (even though it is also in the Makefile.) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* isohybrid: fix overflow on 32 bit systemKai Kang2014-06-191-1/+1
| | | | | | | | | | | | | | When call isohybrid with option '-u', it overflows on a 32 bits host. It seeks to 512 bytes before the end of the image to install gpt header. If the size of image is larger than LONG_MAX, it overflows fseek() and cause error: isohybrid: image-x86-64-20140505110100.iso: seek error - 8: Invalid argument Replace fseek with fseeko to fix this issue. Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* pxelinux-options: Fix data corruption bugsyslinux-6.03-pre17H. Peter Anvin2014-06-161-3/+1
| | | | | | Fix bug where the data would invariably be incorrectly written. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* pxe: Add support for embedded options in EFIsyslinux-6.03-pre16H. Peter Anvin2014-06-161-23/+78
| | | | | | | | For EFI, rather than mucking with the PECOFF or ELF headers (we have both!) just use a fixed-size buffer embedded in the image with a large magic number that can be scanned for safely. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Merge branch 'syslinux-5.xx'Gene Cumm2014-02-011-2/+2
|\
| * isohybrid: Improve help/manGene Cumm2014-02-011-2/+2
| | | | | | | | Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* | Merge tag 'syslinux-5.00-pre9' into for-hpa/elflink/firmwareMatt Fleming2012-11-051-5/+5
|\ \ | |/ | | | | | | | | | | | | | | | | | | This merge also includes the Syslinux-4.06 release. Conflicts: Makefile com32/hdt/Makefile com32/modules/Makefile com32/samples/hello.c mtools/Makefile
| * isohybrid: fix isohybrid.c compileFrediano Ziglio2012-10-101-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Make isohybrid.c compile on gcc 4.4 32 bit instead of producing the following error, isohybrid.c: In function ‘lendian_64’: isohybrid.c:437: error: integer constant is too large for ‘long’ type Cc: Matthew Garrett <mjg@redhat.com> Cc: Michal Soltys <soltys@ziu.info> Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | Add per-firmware object directory supportMatt Fleming2012-10-161-11/+11
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we have multiple firmware backends it no longer makes sense to write object files to the same directory as their source. A better solution is to write the object files to a per-firmware directory under a top-level object directory. The top-level object directory can be specified on the command-line with the O= variable, e.g. make O=/tmp/obj. If no top-level object directory is specified an 'obj' directory is created in the top-level of the Syslinux source repository. All the existing make targets continue to work as before, however now they apply to all firmware backends, e.g. 'make installer' will build the BIOS, 32-bit EFI and 64-bit EFI installers and place them under $(OBJ)/bios, $(OBJ)/efi32 and $(OBJ)/efi64 respectively. Note unlike every other bit of Syslinux, the gpxe objects are still kept in the src directory, e.g. gpxe/src, since gpxe is only required by the BIOS backend. It is possible to specify a make target for a specific firmware or list of firmware with the following syntax, make [firmware[,firmware]] [target[,target]] To clean the object directory for just the BIOS firmware type, 'make bios clean' To build both the 32-bit and 64-bit EFI installers type, 'make efi32 efi64 installer' Since the Syslinux make infrastructure is now more complex a new file doc/building.txt has been created to explain how to build Syslinux. The top-level Makefile now exports some make variables for use in module Makefiles, - topdir - the top-level source directory of the Syslinux repository, e.g. /usr/src/syslinux - objdir - the top-level object directory for the firmware backend currently being built, e.g. /obj/syslinux/bios - SRC - the source directory in the Syslinux repository for the module currently being built, e.g. /usr/src/syslinux/com32/libupload - OBJ - the object directory for the module currently being built, e.g. /obj/syslinux/bios/com32/libupload Since we're rewriting the Makefile infrastructure anyway it seemed like a good idea to add parallel support. By writing subdirectories as prequisites for make targets the objects in those subdirectories can be built in parallel. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* isohybrid: Fix building with --as-neededMicah Gersten2012-06-111-1/+1
| | | | | | | | | The library link order was wrong. This patch was picked from Ubuntu. Reported-and-tested-by: Tim Fletcher <tim@night-shade.org.uk> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* isohybrid: Generate MBR even when in EFI modeMatthew Garrett2012-03-261-5/+49
| | | | | | | | | | | Various EFI systems insist that there be no active flag in the pMBR in order to parse the GPT. The only way around this is to also generate a valid MBR - the firmware will then pick that up and use the system partition provided there. In order to deal with other EFI "sanity" checks, the partition type for the non-EFI partitions is set to 0 to skip the firmware bailing because of overlapping partitions. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* isohybrid: Generate GPT and Mac bootable imagesMatthew Garrett2011-08-242-8/+541
| | | | | | | | | | | | | | | | | | | | | | | EFI systems typically don't support booting off ISO 9660 filesystems, even if written to USB sticks. This patch adds support for generating a GPT that covers the stick as well, with an additional partition entry pointing purely at the secondary El Torito image. When burned to CD the secondary El Torito will be used as an EFI boot image, and when written to a USB stick the GPT partition will be found and may be booted from. However, some earlier EFI Macs don't support booting from El Torito images via EFI. To cater for them this also supports generating an Apple partition table, allowing a third El Torito image in HFS+ format to be made available to the firmware. This requires padding the MBR images slightly in order to leave space for the Apple header, but should have no functional impact. Sadly, this breaks the workaround for Acer BIOSes (magic xor instruction) when Mac support is enabled via -m... not much that can be done about that. Signed-off-by: Matthew Garrett <mjg@redhat.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* isohybrid: unbreak hex/octal arguments in C versionsyslinux-4.05-pre3P J P2011-06-282-7/+14
| | | | | Allow hex/octal arguments in the C version of isohybrid, since they were accepted by the Perl version.
* Add "make strip" targetH. Peter Anvin2011-05-091-4/+10
| | | | | | | | Add a "make strip" target, to make doing the official build easier. We want the official build to have stripped binaries for size reasons, so do it right and make it an actual build target. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Remove -s for host binariesH. Peter Anvin2011-05-091-1/+1
| | | | | | | | Remove -s for host binaries; current practice is to let the distro packaging systems do that themselves. For the official binaries, we should probably strip them, but via an external tool. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Merge remote-tracking branch 'mfleming/for-hpa/makefile-cleanup'H. Peter Anvin2011-04-261-1/+2
|\ | | | | | | | | | | | | | | Resolved Conflicts: com32/hdt/Makefile com32/sysdump/Makefile Signed-off-by: H. Peter Anvin <hpa@zytor.com>
| * Makefile: Move Makefile fragments into mk/Matt Fleming2011-04-071-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the MCONFIG files into a mk/ directory and give them more descriptive names. This is purely a cosmetic change to make the 'include' directives a bit more coherent by making it obvious exactly which MCONFIG file we're including. For example, in com32/lua/src/Makefile we exchange the line, include ../../MCONFIG for the much more comprehensible, include $(MAKEDIR)/com32.mk Signed-off-by: Matt Fleming <matt.fleming@linux.intel.com>
* | ppmtolss16: remove obsolete Perl constructH. Peter Anvin2011-04-251-1/+1
|/ | | | | | | defined() on an array is considered obsolete; instead check for a nonzero number of elements with scalar(). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdiskfind: abstract get page size so we can compile against klibcH. Peter Anvin2010-12-071-1/+11
| | | | | | | | | | klibc doesn't have sysconf(), because it involves a hideously inefficient multiplex. Thus, if _SC_PAGESIZE is not defined, invoke getpagesize(). Call the routine get_page_size() so it doesn't conflict on a platform which has both sysconf(_SC_PAGESIZE) and getpagesize(). Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* isohybrid: Use ftruncate instead of seek for final paddingP J P2010-10-121-8/+4
| | | | | | | Pad the image via ftruncate instead of seeking to the end (which was done incorrectly). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Fix nuisance _FORTIFY_SOURCE failuresH. Peter Anvin2010-07-021-1/+3
| | | | | | | Fix a couple of _FORTIFY_SOURCE failures which are nuisance warnings, but fortunately not too hard to just plain avoid. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdiskfind: remove debugging printfH. Peter Anvin2010-06-221-2/+0
| | | | | | Remove accidentally checked in debugging printf. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdiskfind: make sure we don't map unavailable RAMH. Peter Anvin2010-06-221-6/+38
| | | | | | | | | Sometimes FBM is below the reserved memory limit, which means memory that is available to protected-mode operating systems only and which will be claimed by the kernel and therefore be unmappable. Read /proc/iomem to make sure the memory range is safe to map. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdisk: add a sector_shift field to the MDI; fix memdiskfindH. Peter Anvin2010-06-221-1/+7
| | | | | | | Add a sector_shift field to the MDI rather than assuming 512-byte sectors. Fix memdiskfind to report size in bytes, not in sectors. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* isohybrid: fix another type mismatchH. Peter Anvin2010-06-221-1/+1
| | | | | | Fix another printf type mismatch in the C version of isohybrid. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* memdiskfind: sanity check the FBM valueH. Peter Anvin2010-06-211-1/+4
| | | | Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* memdiskfind: utility to find an mBFT and output phram parametersH. Peter Anvin2010-06-212-1/+123
| | | | | | | A trivial Linux utility to search for mBFT and output its parameters in a form which can be used as input to the phram Linux kernel module. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* utils/Makefile: fix build rulesH. Peter Anvin2010-06-211-2/+2
| | | | | | Fix isohybrid build rules. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* isohybrid: fix beginner mistakesH. Peter Anvin2010-06-211-2/+2
| | | | Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* isohybrid: use getopt_long_only()syslinux-3.8xH. Peter Anvin2010-05-201-1/+1
| | | | | | | For compatibility with isohybrid.pl, use getopt_long_only() so long options are accepted with a single dash. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* isohybrid: create a C versionP. J. Pandit2010-05-204-2/+653
| | | | | | | Some Linux distributions have complained about Perl as a prerequisite for isohybrid, so create a C version. [ hpa: modified the array generator to put it all in one script ]
* mkdiskimage: add option -s to make a sparse imagesyslinux-3.85-pre4H. Peter Anvin2010-02-011-6/+10
| | | | | | | It is often fine to have a sparse file for the output image, so add an -s option to generate a sparse image. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Makefile: replace -W -Wall with centralized $(GCCWARN)H. Peter Anvin2010-01-101-1/+1
| | | | | | | | | Replace -W -Wall hardcoded into a bunch of Makefiles with $(GCCWARN), a centralized variable defined in the root MCONFIG. Add -Wstrict-prototypes to the list of global warnings: we should never have non-prototyped declarations. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* isohybrid: make the -offset option actually workH. Peter Anvin2009-11-161-2/+2
| | | | | | | | Actually implement the -offset option. Credit for the patch goes to "cmdr from the gparted-forum", reported by Sven-Hendrik Haase <sh@lutzhaase.com>. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* utils/Makefile: install pxelinux-optionsH. Peter Anvin2009-09-291-1/+2
| | | | | | Make sure the pxelinux-options script gets installed. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* pxelinux-options: add help textH. Peter Anvin2009-09-291-7/+24
| | | | | | Add help text to pxelinux-options. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* pxelinux: support hardcoded options "before" or "after"; toolH. Peter Anvin2009-09-291-0/+482
| | | | | | | | | Support hardcoded DHCP options both "before" or "after" the PXE-provided options. Add a tool to manipulate these hardcoded options. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* isohybrid: convert -id to a binary stringSteffen Winterfeldt2009-08-031-1/+1
| | | | | Shouldn't 'isohybrid -id ID' write ID as 32bit number? Currently it ends up as string messing up the mbr.
* bin2hex: actually account for the number of bytes writtenH. Peter Anvin2009-05-291-2/+5
| | | | | | Unlike C, in Perl printf() doesn't return the number of bytes written. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Run Nindent on utils/gethostip.cH. Peter Anvin2009-05-291-88/+88
| | | | | | | | | Automatically reformat utils/gethostip.c using Nindent. Do this for all files except HDT, gPXE and externally maintained libraries (zlib, tinyjpeg, libpng). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* isohybrid: we are backwards compatible again, change the error msgH. Peter Anvin2009-05-251-3/+2
| | | | | | | | We are backwards compatible again, at least as long as -partok is not used. However, there is no minor version number, so we can't check for that at this time. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* isohybrid: revert to a stack format compatible with previous versionsyslinux-3.81-pre14H. Peter Anvin2009-05-251-1/+1
| | | | | | | | Revert the isohybrid handover protocol so that it has a stack format compatible with the previous versions; that way we can also revert the magic number to a compatible one. Signed-off-by: H. Peter Anvin <hpa@zytor.com>