summaryrefslogtreecommitdiff
path: root/extlinux/main.c
Commit message (Collapse)AuthorAgeFilesLines
* extlinux: pull in sys/sysmacros.h for major/minor/makedevMike Frysinger2016-04-231-0/+1
| | | | | | | | | | | | These functions are defined in sys/sysmacros.h, so add the include to main.c. This is already handled correctly in mountinfo.c. Otherwise we get build failures like: main.o: In function 'find_device_sysfs': extlinux/main.c:1131: undefined reference to 'minor' Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* extlinux: code cleanup and simplificationNicolas Cornu via Syslinux2015-11-251-58/+55
| | | | | | | | | | | Merge btrfs_read_adv and xfs_read_adv into a single generic function ext_read_adv and split ext_write_adv_offset out of ext_write_adv. Use those new functions in rewrite_boot_image and btrfs_install_file where it is actually hardcoded. Signed-off-by: Nicolas Cornu <nicolac76@yahoo.fr> Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
* extlinux/main.c: space changeAdy2015-11-151-10/+10
| | | | | | | | | Spaces, ASCII 0x20, have been * moved * inserted * deleted Signed-off-by: Geert Stappers <stappers@stappers.nl>
* extlinux/main.c: Correct comment about btrfs installGene Cumm2015-11-151-3/+6
| | | | | | | As of commit ID 37eef640 (before 6.03-pre12, before 6.03), it is now in Boot Area B. Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* extlinux/main.c: comment typo fixesAdy2015-11-151-5/+5
| | | | | | | Some typo fixes in extlinux/main.c. None of them affects code execution. Signed-off-by: Geert Stappers <stappers@stappers.nl>
* libinstaller: introduce syslxrw libraryPaulo Alcantara2015-11-101-0/+1
| | | | | | | | Due to size constraints on DOS systems, do not include whole syslxcom into DOS-based installer for using xpread() and xpwrite() functions, instead make them part of another separate library and include it only. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
* extlinux: fix memory leakImran Zaman2015-09-271-14/+30
| | | | | | | | devname is put on heap for all cases to avoid memory leak, and ease of use in future as well Signed-off-by: Imran Zaman <imran.zaman@intel.com> Reviewed-by: Paulo Alcantara <pcacjr@zytor.com>
* installer: Add UFS1/2 support for Extlinux installerRaphael S. Carvalho2014-06-021-9/+42
| | | | | | | | | | | It's needed to enumerate both UFS1 and UFS2 as they have different magic numbers and super block offsets. Neither UFS1 nor UFS2 move files around, therefore, ldlinux.sys can be installed as a regular file. Signed-off-by: Raphael S. Carvalho <raphael.scarv@gmail.com> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* btrfs: fix typo in definition of BTRFS_ADV_OFFSETH. Peter Anvin2014-05-201-1/+2
| | | | | | Correct the macros used in BTRFS_ADV_OFFSET. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* btrfs: Move ldlinux.sys to Boot Area BH. Peter Anvin2014-05-201-6/+9
| | | | | | | | | | ldlinux.sys is frequently too big to fit into Boot Area A (64K). Per a recent ruling by Chris Mason, we have a 768K Boot Area B at offset 256K, so use that to store ldlinux.sys. In theory we could split it up and make it slightly larger, however, ldlinux.sys is loaded below the 640K mark so it has to be smaller than that size anyway. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* installer: Add sparse address space annotations to the syslinux imageH. Peter Anvin2014-01-171-6/+10
| | | | | | | | Add sparse address space annotations for the syslinux boot image, to make it easier to catch errors that break the DOS installer build again. Use "make CC=cgcc" to run sparse. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Merge tag 'syslinux-5.01' into firmwaresyslinux-6.00-pre4Matt Fleming2013-01-291-10/+30
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * extlinux: Also install ldlinux.c32 file on XFSPaulo Alcantara2013-01-221-4/+26
| | | | | | | | Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
| * extlinux: Fix installation subdirectory patchingMatt Fleming2013-01-101-7/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit a126f17f663c ("EXTLINUX: Initial XFS filesystem support") broke the code that inserts the installation subdirectory into the Extended Patch Area (EPA). The EPA entry is used to set the initial working directory on boot. This caused boot failures for users that chose an install directory other than /boot/syslinux (technically, it failed for any path not in 'search_directories' in load_env32()) due to ldlinux.c32 failing to load because the initial working directory was not set correctly. Cc: Paulo Alcantara <pcacjr@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * extlinux: Make sure ldlinux.sys file is installedPaulo Alcantara2013-01-101-0/+2
| | | | | | | | | | | | | | | | | | | | Due to delayed allocation feature on XFS filesystems, a write is not guaranteed to flushed out to the underlying file system after crash or something else - so we need to make sure that ldlinux.sys is installed correctly in the mounted filesystem. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | Merge tag 'syslinux-5.00' into firmwaresyslinux-6.00-pre3Matt Fleming2012-12-071-35/+200
|\ \ | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: Makefile com32/elflink/ldlinux/Makefile com32/lib/sys/module/elf_module.c core/cleanup.c core/comboot.inc core/conio.c core/fs/fs.c core/init.c core/mem/free.c core/mem/malloc.c core/timer.inc diag/geodsp/Makefile extlinux/main.c mk/embedded.mk modules/Makefile Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * Merge branch 'xfs-for-hpa' of git://zytor.com/users/pcacjr/syslinux into ↵Matt Fleming2012-11-271-35/+200
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | merge/elflink/xfs Pull XFS filesystem driver from Paulo Alcantara, * 'xfs-for-hpa' of git://zytor.com/users/pcacjr/syslinux: (60 commits) xfs: Fix the way we check di_mode of an inode xfs: Cleanup previous commit xfs: Add xfs_readlink() xfs: Cleanup and remove some trailing whitespaces xfs: Add XFS_DINODE_FMT_BTREE support in xfs_next_extent() xfs: Cleanup and remove some trailing whitespaces xfs: Rework xfs_dir2_get_right_blk() xfs: cleanup unused structure xfs: Remove some trailing whitespaces xfs: Add full B+tree search support in xfs_dir2_node_find_entry() xfs: Add xfs_fmt_btree_find_entry() xfs: Fix memory leak in xfs_dir2_node_find_entry() function xfs: Cleanup xfs_readdir_dir2_leaf() function xfs: Implement xfs_readdir_dir2_node() function EXTLINUX: Add sanity check for XFS filesystems xfs: Add xfs_fmt_local_readdir() function xfs: Add xfs_fmt_local_find_entry() function xfs: Move readdir functions to another source file xfs: Remove trailing whitespace in xfs_dir2_isleaf() function xfs: Move dir2 functions to another source file ... Conflicts: extlinux/main.c
| | * EXTLINUX: Add sanity check for XFS filesystemsPaulo Alcantara2012-07-291-3/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Syslinux won't work on >4 KiB filesystem block sizes since there is no left space in MBR to determine where to install Syslinux bootsector. If one is trying to install Syslinux in a XFS partition with a filesystem block size different of 4 KiB, a proper error will be returned to the user informing that the current filesystem block size isn't supported by Syslinux. Reported-by: Gene Cumm <gene.cumm@gmail.com> Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
| | * extlinux: put set_attributes() back to ext2_fat_install_file().Chen Baozi2012-07-211-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | rewrite_boot_image() wraps the logic from previous ext2_fat_install_file(). The deleted lines includes the set_attributes(), while it is actually not within the rewrite_boot_image(). We add set_attributes() and some helper judgement just as what we do in xfs_install_file(). Signed-off-by: Chen Baozi <baozich@gmail.com> Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
| | * EXTLINUX: Initial XFS filesystem supportPaulo Alcantara2012-07-211-39/+184
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | XFS filesystems are divided into a number of equally sized chunks called Allocation Groups (AGs). Each AG can almost be thought of as an individual filesystem that maintains its own's space usage. Each AG has the following structure: - A super block describing the overall filesystem info - Free space management - Inode allocation and tracking So, due to historical reasons (SGI IRIX's design of disk layouts), the first sector in the primary AG on XFS filesystems contains the superblock, which is a problem with bootloaders that rely on BIOSes (that load VBRs which are located in the first sector of the partition). This patch adds support to the EXTLINUX installer to be able to install Syslinux in an XFS partition, but with a limitation (temporarily) of relying on the filesystem block size being 4+ KiB, otherwise there won't be enough space to store the Syslinux boot sector in the blank area around the 2048 to 4096 bytes of the primary AG/superblock. Signed-off-by: Paulo Alcantara <pcacjr@zytor.com>
* | | Merge tag 'syslinux-5.00-pre10' into for-hpa/elflink/firmwareMatt Fleming2012-11-141-3/+1
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull in the latest prerelease that includes some bug fixes for ldlinux and a realloc() bug in core/. Conflicts: com32/cmenu/Makefile com32/elflink/ldlinux/Makefile com32/lib/Makefile core/pxelinux.asm
| * | extlinux: Avoid dereferencing a garbage pointerMatt Fleming2012-11-051-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If opt.reset_adv is set the call to ext_read_adv() is skipped which would have initialised 'filename'. This means that a pointer containing random data from the stack is passed to ext_write_adv(). Just delete the opt.reset_adv logic since modify_adv() handles that case anyway. Reported-by: Frediano Ziglio <frediano.ziglio@citrix.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | | Merge tag 'syslinux-5.00-pre9' into for-hpa/elflink/firmwareMatt Fleming2012-11-051-8/+60
|\ \ \ | |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | This merge also includes the Syslinux-4.06 release. Conflicts: Makefile com32/hdt/Makefile com32/modules/Makefile com32/samples/hello.c mtools/Makefile
| * | Merge branch 'master' into elflinkMatt Fleming2012-10-241-4/+4
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The following conflict is a result of the fact comapi_chainboot was only stubbed out on the 'elflink' branch but was properly marked as obsolete in 'master'. Conflicts: core/comboot.inc
| | * | make some functions static remove unused NADV defineFrediano Ziglio2012-10-091-4/+4
| | |/ | | | | | | | | | | | | | | | | | | Just some minor cleanup Signed-off-by: Frediano Ziglio <frediano.ziglio@citrix.com> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * | installers: Install ldlinux.c32 automaticallysyslinux-5.00-pre8Matt Fleming2012-09-191-4/+54
| | | | | | | | | | | | | | | | | | | | | Because ldlinux.c32 is required for Syslinux to function correctly, we should be installing it automatically much like ldlinux.sys. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
| * | extlinux: Handle error case for find_mount()Matt Fleming2012-09-141-0/+2
| |/ | | | | | | | | | | | | find_mount() may return NULL, so we'd really better check for that *before* dereferencing the pointer. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
* | Add per-firmware object directory supportMatt Fleming2012-10-161-1/+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>
* extlinux: add --device option to override device detectH. Peter Anvin2012-06-201-3/+8
| | | | | | | Add a --device option for scripts and expert users to override the device detection. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* extlinux: centralize and reuse btrfs validationH. Peter Anvin2012-06-201-34/+77
| | | | | | We can re-use btrfs device validation now. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* extlinux: better methods for finding device matchesH. Peter Anvin2012-06-191-35/+94
| | | | | | | 1. Support parsing /proc/self/mountinfo for devices; 2. For btrfs, query the device names from btrfs itself. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* extlinux: use sysfs to find the device node if need beH. Peter Anvin2012-02-081-10/+66
| | | | | | | | If neither /proc/mounts nor /etc/mtab contains a functional pointer to the device node for the installer, try to see if we can find the device node by looking for a symlink in /sys/dev/block. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* extlinux: clean up main.c formattingH. Peter Anvin2012-02-081-36/+35
| | | | | | Clean up some ugly formatting in main.c. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* extlinux: main.c should not be executableH. Peter Anvin2012-02-081-0/+0
| | | | | | Remove stray x bit. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Add NTFS filesystem support to Linux and Windows installersPaulo Alcantara2011-09-071-12/+47
| | | | Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
* extlinux: remove dead code in installersyslinux-4.05-pre5H. Peter Anvin2011-07-281-5/+2
| | | | | | | Remove some dead code in the installer, which caused build error with gcc 4.6 and -Werror. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* btrfs: Correctly determine the installation subvolumeYi Yang2011-07-281-32/+271
| | | | | | | There are multiple ways to set up subvolumes in btrfs. Use a general determination method which works for all schemes. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* extlinux: remove wrong use of strstr()syslinux-4.05-pre4Paulo Alcantara2011-07-051-3/+1
| | | | | | | | strstr() is only used for zero-terminated strings, so OEM Name is not guaranteed to be zero-terminated. Instead, use fat_check_sb_fields() to sanity check FAT superblock. Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
* extlinux/main.c: Fix geometry handlingGene Cumm2011-05-111-2/+2
| | | | | | | | | 1) ioctl HDIO_GETGEO expects a pointer to a struct hd_geometry 2) struct stat's st_dev is the parent file used; st_rdev is what we want Reported-by: Michael Tokarev <mjt@tls.msk.ru> Tested-By: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Gene Cumm <gene.cumm@gmail.com>
* extlinux: remove already_installedPaulo Alcantara2011-04-151-13/+0
| | | | Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
* extlinux: use syslinux_already_installed instead of already_installedPaulo Alcantara2011-04-151-1/+1
| | | | Signed-off-by: Paulo Alcantara <pcacjr@gmail.com>
* extlinux/main.c: remove variables set but not usedH. Peter Anvin2011-03-161-3/+1
| | | | | | gcc 4.6 warns on variables set but not used, so remove them. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* extlinux: try to get the disk offset from sysfsH. Peter Anvin2010-08-131-5/+38
| | | | | | | | | | | It is possible(?) that HDIO_GETGEO can't return the full offset, and in either case it is too small -- only 32 bits on 32-bit platforms. Thus query sysfs for the real value, if available. sysfs also contains information for slave devices -- this is going to really matter for the md/lvm issues. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* extlinux, linux: Ignore --force in these installerssyslinux-4.02-pre4Shao Miller2010-07-191-1/+1
| | | | | | | Previous commits described this behaviour, but did not actually implement it. :) Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
* libinstaller: Add --mbr, --active, and --force optionsShao Miller2010-07-031-1/+1
| | | | | | | | | | | | | | In order to consolidate the installer option-parsing system, we add the --mbr (-m), --active (-a), and --force (-f) options from the DOS, Win32, and mtools installers to libinstaller. Since the -m and -a options are not currently valid for the Linux 'syslinux' and 'extlinux' installers, we add error messages to both of these. The -f option is allowed but does nothing for them. Signed-off-by: Shao Miller <shao.miller@yrdsb.edu.on.ca>
* installers: handle asprintf() correctlyH. Peter Anvin2010-07-021-5/+6
| | | | | | | | | | | | | It appears that the glibc version of asprintf() is braindamaged, and doesn't set the target pointer to NULL in the event of an error (only returns -1). Therefore we need to check the return value. Just in case someone else made the *opposite* error, also check the pointer. Bleh. The glibc documentation states that *BSD sets the pointer to NULL, but instead of following that, the glibc people put warn_unused_result on asprintf. Sigh. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* extlinux: set bsHidden for loop devicesH. Peter Anvin2010-06-261-5/+8
| | | | | | | If we are on a loop device, set bsHidden based on the loopback device offset. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* extlinux: modify the layout for btrfsH. Peter Anvin2010-06-251-9/+13
| | | | | | | | | Put the btrfs boot code right after the boot sector (they are really one image anyway). Align the ADV with the end of the boot region, so we can locate it for modification as necessary, and the offset don't end up shifting with different boot image sizes. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Merge branch 'master' of ssh://terminus.zytor.com/pub/git/syslinux/syslinuxsyslinux-4.00-pre59H. Peter Anvin2010-06-241-15/+46
|\
| * extlinux: fix ADV handling, so extlinux.sys -> ldlinux.sys actually worksH. Peter Anvin2010-06-241-9/+16
| | | | | | | | | | | | | | Do the appropriate thing for various error cases, so that the migration code actually does the right thing. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>