summaryrefslogtreecommitdiff
path: root/extlinux/main.c
Commit message (Collapse)AuthorAgeFilesLines
* 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 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>
* | 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 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>
* 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>
| * extlinux: add code to automate extlinux.sys -> ldlinux.sys migrationH. Peter Anvin2010-06-241-16/+40
| | | | | | | | | | | | | | | | - Be able to modify the ADV either in extlinux.sys or ldlinux.sys - Be able to preserve the ADV from extlinux.sys - Remove extlinux.sys when installing ldlinux.sys Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* | Move modify_adv() into common codeH. Peter Anvin2010-06-231-25/+0
|/ | | | | | | modify_adv() should be used by any installer which uses the common CLI, so it should go into syslxopt.c. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Merge syslinux/extlinux patch code and core codeH. Peter Anvin2010-06-201-182/+28
| | | | | | | | Merge the SYSLINUX and EXTLINUX patching code and core code, removing EXTLINUX as a separate derivative. All the disk-based systems now use the same code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Reduce sector 1 space pressure; further merge installer codesyslinux-4.00-pre52H. Peter Anvin2010-06-201-57/+70
| | | | | | | | | | Reduce sector 1 space pressure by moving objects that aren't needed by Sector 1 proper into an "extended patch area". While we're mucking with the installer code, make the syslxint and extlinux installer code even more similar. It should now be pretty straightforward to outright merge the code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* Move Linux ioctl header magic into a single fileH. Peter Anvin2010-06-161-11/+1
| | | | | | | Put all the Linux ioctl header magic into a single shared file, and try to make it as generally useful as possible. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Fix prototype for generate_extentsH. Peter Anvin2010-06-151-1/+1
| | | | | | Add missing const Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* extlinux: remove debugging printf'sH. Peter Anvin2010-06-151-2/+0
| | | | Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Switch to 64-bit sector pointers everywhereH. Peter Anvin2010-06-151-8/+70
| | | | | | | | | | | | Switch to consistent use of 64-bit sector pointers; this should enable booting even for individual *partitions* larger than 2 TB. In order to not slow down the boot too much, switch the initial load from an enumeration to an extent map. This means the table gets larger (since we have to assume the worst case), but it simplifies the Sector 1 code (since we can push all the hard stuff into the installer), and will speed up booting in the general case. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Implement !GPT protocol in Syslinux core; handle offset > 2 TBH. Peter Anvin2010-06-141-3/+4
| | | | | | | | | | | | | | | Implement the !GPT handover protocol in the Syslinux core, and handle partition offsets above 2 TB. We do not yet handle filesystem sizes above 2 TB, but that should be a reasonably straightforward extension at this time (need to switch to 8-byte block pointers). This finally meant moving getlinsec out of the boot sector, since it no longer fits. Instead have a very simple getonesec implementation in the boot sector. getlinsec still fits in Sector 1, although it doesn't leave space for very many block pointers. That's still better than adding yet another boot loader stage, however. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* syslinux: don't break -o just yet; print warning and resumeH. Peter Anvin2010-06-091-2/+2
| | | | | | | -o has been supported for a very long time; recommend using -t instead, but for now proceed with an error message. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* Clean up warnings in previous checkinH. Peter Anvin2010-06-091-0/+5
| | | | | | | Clean up warnings in checkin 146c34a2 Make syslinux installer real "pathbased" Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* extlinux: add a --menu-save optionThomas Bächler2010-06-071-1/+8
| | | | | | | | Add the --menu-save option to set the MENU SAVE value from the running system using extlinux. From: Thomas Bächler <thomas@archlinux.org> Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* unify common parts of extlinux and syslinux installerAlek Du2010-05-201-454/+42
| | | | | | | | | | | Thus we can share same command line options and reduce a lot of dup code... Seems like a big patch, but the changes are quite safe, no much logical change. Signed-off-by: Alek Du <alek.du@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* syslinux: fix sector arraysAlek Du2010-05-201-1/+1
| | | | | | | | | The first sector ptr is in bs->NextSector not in the array in the patch_area. And actually the ADV sectors counting is wrong for a while ... Signed-off-by: Alek Du <alek.du@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* installers: fix warningsH. Peter Anvin2010-05-121-0/+2
| | | | | | CLean up warnings in the installers. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
* extlinux: handle cases of a single level of directoriessyslinux-4.00-pre39H. Peter Anvin2010-04-281-4/+16
| | | | | | | We had a boundary condition error where a single-level directory from the global root (e.g. /boot) would be incorrectly truncated; fix that. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>