summaryrefslogtreecommitdiff
path: root/com32/chain
Commit message (Collapse)AuthorAgeFilesLines
* com32: Adding 'exit' entry in chain.c32Erwan Velu2015-12-061-0/+3
| | | | | | | | | | | | | | This patch is coming after some bad experience with gfxboot. GFXboot was padding unexpected options on the chain.c32 commande line. As a result, chain was confused and didn't provided the expected behavior. This patch is a workaround to enforce chain.c32 not considering anything on the command line after this keyword. Example: chain.c32 hd0 exit ...garbage...
* chain: year update in commments (trivial)Gene Cumm2015-03-1511-11/+11
| | | | | Signed-off-by: Michal Soltys <soltys@ziu.info> Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* chain/partiter: add options to ignore GPT crc checksMichal Soltys2015-03-153-22/+45
| | | | | | | | This can be useful to force boot even if checksums of GPT header and/or partition list are invalid. This works independently from 'strict' option. Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain/partiter: call notsane_gpt_hdr() per headerMichal Soltys2015-03-151-48/+48
| | | | | | | | | | | | Instead of calling it just once after the examination of both headers (the 2nd one only if necessary) - call it per each header during examination. Thus in unlikely situation of passing crc check on primary gpt header and at the same time failing sanity checks, it will also try backup header. Signed-off-by: Michal Soltys <soltys@ziu.info>
* chain/partiter: correct gpt header checkssyslinux-6.03-pre20Michal Soltys2014-08-261-4/+8
| | | | | | | In gpt header, lba_cur and lba_alt alternate depending on whether we read primary or backup copy. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* chain: implement strict=<0|1|2>Michal Soltys2014-08-264-14/+34
| | | | | | | | | | | | | | | This provides more fine grained control than single relax flag. to cover case with wrong disk sizes. relax and nostrict are equivalent to strict=0 norelax and strict are equivalent to strict=2 strict=1 does the same as strict=2, but ignores checks against disk size The current default is strict=1. Options: 'fixchs', '[un]hide[all]' and 'save' will forcibly enable strict=2 (can be overridden by the user). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* chain: add missing pi_del() in find*() functionsMichal Soltys2014-08-261-35/+25
| | | | | | | As partiter doesn't deallocate itself after finish (anymore), it should be deleted after each loop iteration. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* chain/partiter: adjust error reportingMichal Soltys2014-08-263-10/+5
| | | | | | | | | | Use <0 for errors, 0 for normal state, and >0 for clean completion. In future this would be necessary if it's decided to make partiter a generic lib (similar to disklib) - though it has to be quieted first and provide strerr()-like functionality in place of its verbosity. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* chain/partiter: fix possible non-NULL value returned by pi_begin() on errorMichal Soltys2014-08-261-8/+10
| | | | | | | | This patch fixes non-NULL value returned from pi_begin() in case of an error (which resulted in further hang instead of proper exit). Probably a leftover from pi_dealloc() times. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* chain/partiter: fix and improve gpt handling in buggy casesMichal Soltys2014-08-261-76/+128
| | | | | | | | | | | | | | | | | | | | | | Previous version had some issues in case of error situations, among those: - backup gpt header was not read if reading of primary failed - alternating nature of lba_cur and lba_alt was ignored This patch fixes this and extends the gpt handling. The current behavior is: - try primary header; if unreadable or checksum fails (or sanity checks fail unless relax flag is set) - try secondary header - try main partition table referenced in the header that was read; if it's unreadable or if its crc check fails - try alternative (so if we managed to read primary header, table at the end would be considered as alternative - if we managed to read secondary header, table at the beginning would be treated as such) Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Merge tag 'syslinux-5.10-pre2' into for-hpa/elflink/firmwareMatt Fleming2013-03-2212-755/+892
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | syslinux-5.10-pre2 Conflicts: NEWS com32/include/netinet/in.h com32/include/sys/cpu.h com32/lib/Makefile core/Makefile core/fs/diskio.c core/fs/pxe/pxe.h core/init.c core/mem/free.c core/mem/malloc.c mk/devel.mk version
| * Merge branch 'lwip' into elflinkMatt Fleming2013-02-261-1/+2
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Welcome to Syslinux 5.10. Conflicts: NEWS com32/lib/Makefile com32/lib/sys/open.c com32/lib/syslinux/ipappend.c com32/modules/Makefile com32/modules/prdhcp.c core/Makefile core/cmdline.inc core/com32.inc core/comboot.inc core/configinit.inc core/fs/chdir.c core/fs/fs.c core/fs/pxe/dnsresolv.c core/fs/pxe/pxe.c core/fs/pxe/pxe.h core/idle.c core/include/ctype.h core/init.inc core/mem/init.c core/parseconfig.inc core/runkernel.inc core/syslinux.ld core/ui.inc doc/comboot.txt version
| * | com32/chain: fix potential problem with 'fs' optionMichal Soltys2013-02-141-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | It's possible, that fs_lba available through syslinux_derivative_info() could be 0. So match the candidates including disk, instead of only partitions. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: sizeof style change (trivial)Michal Soltys2013-02-144-20/+20
| | | | | | | | | | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: (utility) use enum for BPB typesMichal Soltys2013-02-141-9/+2
| | | | | | | | | | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: (partiter) add cebr_siz for completnessMichal Soltys2013-02-142-0/+2
| | | | | | | | | | | | | | | | | | | | | Might be useful at some and/or when partiter becomes a non-chain specific code. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: (partiter) dos_next_ebr() fixupMichal Soltys2013-02-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure that *lba is set to 0, if start_lba in the record is 0. Not an issue in any of the code using partiter currently, as that implies either broken layout or a hole. Still useful for consistency with index == -1 or when relax flag is set. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: use single value for partiter related options (flags)Michal Soltys2013-02-145-16/+13
| | | | | | | | | | | | | | | | | | Also use enum instead of #defines for flags. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: partiter: rename start_lbaMichal Soltys2013-02-144-23/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | disk.c also uses start_lba and it can mean few different things depending on context (disk relative, BEBR relative, current EBR relative). partiter's main offset is always a disk relative value. To make it more distinct and avoid suggestion the value is simply a copy of the one from disk_dos_part_entry, we rename it to more fitting abs_lba. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: manglepe_fixchs() correctionMichal Soltys2013-02-141-10/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have to be more careful, when in-entry start/length values are 0 (one or both). Firstly they are relative to the disk or the [B]EBR (while CHS are absolute). Secondly, length 0 would imply the end CHS being lower than the start CHS. Under normal circumstances, partiter would complain about corrupt layout (unless relax flag is set) and value 0 in any of those fields generally imply a hole, so the adjustments were harmless - nontheless they made everything look silly and not really correct. Adjusted approach is: - for start entry - if the os entry is 0 /and/ the beginning is 0 - reset to 0, otherwise calculate chs - for end entry - as above /or/ length is 0 - reset to 0, otherwise calculate chs Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: index -1 partiter adjustmentMichal Soltys2013-02-143-14/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the only situation when index could be set to -1 was empty logical partition (with stepall flag active). To keep things consistent (and with index0 already providing "full" info), adjust the partiter to also set -1 on empty main partition. This change also allows simple index check to see whether we're are at the empty partition or not, without digging into disk_dos_part_entry data and retesting ostype field. We rely on it now in manglepe_hide(). Also some retab! changes in partiter.h and one variable rename. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: rely more on addr_t, replace ADDR*Michal Soltys2013-02-144-22/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Whenever the computation imply use of that type, even if it's just uint32_t. Add dosmax (using 40:13) and dosmin (0x500) instead of separate ADDR* and dosmem (in do_boot()). Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: remove common.hMichal Soltys2013-02-146-43/+3
| | | | | | | | | | | | | | | | | | | | | | | | Only 2 defines there related to preliminary options.c's and chain.c's hecks (real checks come later during mapping to real memory). So move them to options.h and remove common.h. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: recognize exFATMichal Soltys2013-02-143-4/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The usual stuff - hidden sectors (now 64bit at different offset), drive offest, "BPB" type. Formally (?) region from 0x0B to 0x3F should be 0, but ... it's tempting to fill "old" values there. Might be worth adding a switch to handle such behavior. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: implement handling of non-standard hybrid GPT+MBR layoutsMichal Soltys2013-02-146-18/+28
| | | | | | | | | | | | | | | | | | | | | | | | We also take a bit relaxed approach - so we check for presence of 0xEE at any place, then attempt to read GPT header only if prefmbr is not set. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: implement relax flagMichal Soltys2013-02-146-9/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This flag tones down sanity checks during partition iteration. This is useful in situations such as: - inconsistent layouts, but with some partition still in sane bootable state - usb sticks/disks moved between different PCs might return different size, which might cause problems if the partitions span the whole disk Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: warning/error/help/doc tidyingMichal Soltys2013-02-145-137/+157
| | | | | | | | | | | | | | | | | | | | | Trivial change that tidies a bit warning / error reporting through fatal()/error()/warn(). Also small doc/help updates. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: use disk_guid for part_guid for 0th partitionMichal Soltys2013-02-142-7/+4
| | | | | | | | | | | | | | | | | | | | | Initial position of each itarator is whole disk, so this actually matches. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: cleaner variable namesMichal Soltys2013-02-142-16/+14
| | | | | | | | | | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: mangle and related updatesMichal Soltys2013-02-145-43/+49
| | | | | | | | | | | | | | | | | | Comments, output and minor adjustments. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: add pi_errored() in partiterMichal Soltys2013-02-142-2/+7
| | | | | | | | | | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: remove unused ebr_startMichal Soltys2013-02-142-4/+0
| | | | | | | | | | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: partiter - more precise comments / outputMichal Soltys2013-02-142-19/+23
| | | | | | | | | | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: remove redundant rawindexMichal Soltys2013-02-143-7/+4
| | | | | | | | | | | | | | | | | | 'index0' provides the same "raw" info, complementing standard 'index'. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: partiter - simplifications and updatesMichal Soltys2013-02-144-279/+119
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The code uses more abstractions than it's really worth or necessary, so these patches simplify the code a bit. Partially suggested by Shao as well. Additionally, there're some added comments and more consistent naming used. Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: shuffle code before partiter simplificationsMichal Soltys2013-02-141-62/+62
| | | | | | | | | | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: change stepall into flagsMichal Soltys2013-02-143-14/+18
| | | | | | | | | | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: use anonymous and unnamed aggregatesMichal Soltys2013-02-144-58/+58
| | | | | | | | | | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: comments, minor adjustmentMichal Soltys2013-02-147-81/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - add some comments to clarify c{nul,add,max} modes - use enums instead of defines - remove unnecessary integer casts - avoid casts and uninline guid_is0() - minor handover comment/flow changes - clean up some old comment-outs - add -fno-strict-aliasing as it's not picked anymore by default for elf.mk Signed-off-by: Michal Soltys <soltys@ziu.info>
| * | com32/chain: update licenses and #ifndef stanzasMichal Soltys2013-02-1412-19/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Licenses: chain.[ch] Makefile: GPLv2+ the rest: MIT Defines: Avoid prefixing with _ Signed-off-by: Michal Soltys <soltys@ziu.info> Acked-by: H. Peter Anvin <hpa@linux.intel.com> Acked-by: Shao Miller <sha0.miller@gmail.com>
* | | Merge tag 'syslinux-5.01' into firmwaresyslinux-6.00-pre4Matt Fleming2013-01-291-1/+1
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Makefile NEWS com32/cmenu/Makefile com32/elflink/ldlinux/Makefile com32/gfxboot/Makefile com32/gpllib/Makefile com32/include/sys/module.h com32/lib/Makefile com32/lib/sys/module/elf_module.c com32/menu/Makefile com32/rosh/Makefile com32/samples/Makefile core/init.c mk/elf.mk Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * | Always strip all the modulesH. Peter Anvin2013-01-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Always strip the modules; they are too big unstripped. Specifically, we generate unstripped *.elf files, and then convert them to stripped *.c32 files. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | | Add per-firmware object directory supportMatt Fleming2012-10-161-3/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | elflink: Replace __intcall() with direct function callsMatt Fleming2012-07-201-24/+6
| | | | | | | | | | | | | | | | There's no reason to use the COMBOOT API at all now that we can have any undefined symbols resolved at runtime - we can just access functions directly. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | Delete all references to __com32.cs_bounceMatt Fleming2012-06-081-8/+16
| | | | | | | | | | | | | | | | | | The COM32 cs_bounce buffer is not usable with ELF modules, as we're trying to move to an environment where memory is dynamically allocated. All users of __com32.cs_bounce have been converted to using lmalloc() to allocate low memory. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | Merge remote-tracking branch 'zytor/master' into merge/elflink/masterMatt Fleming2012-05-311-2/+2
|/ | | | | | | | | | | | | | | | A lot of development has gone on in the 'master' branch since the last time we merged; new features, bug fixes, etc, etc. Conflicts: Makefile com32/Makefile com32/lib/Makefile com32/lib/syslinux/load_linux.c com32/modules/Makefile com32/modules/chain.c core/bootsect.inc core/init.inc version
* chain.c: Fix misplaced #endif breaking non-DEBUG buildsH. Peter Anvin2012-03-261-1/+1
| | | | | | Fix misplaced #endif which made it impossible to build without DEBUG. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Use PRIu64 instead of %llu, where appropriateMichal Soltys2011-08-022-2/+3
| | | | Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: once more rename option: stop -> breakMichal Soltys2011-05-103-11/+11
| | | | | | Seems to be most appropriate... Signed-off-by: Michal Soltys <soltys@ziu.info>
* com32/chain: add support for ReactOS's freeldr.sysMichal Soltys2011-05-101-0/+15
| | | | | | | | Based on commit: ad4cf1470977f648ee1dd45e97939589ccb0393c (might need address adjustments) Signed-off-by: Michal Soltys <soltys@ziu.info>