aboutsummaryrefslogtreecommitdiffstats
path: root/extlinux/main.c
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* 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>
* 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>
* extlinux: centralize file flags setting; add FAT supportsyslinux-4.00-pre32H. Peter Anvin2010-03-041-37/+79
| | | | | | | Centralize the poking at file flags. Add FAT support to file flags setting (S bit). Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* extlinux: don't report failure after writing a FAT superblockH. Peter Anvin2010-03-041-6/+9
| | | | | | | Missing parens made us return failure after successfully writing a FAT superblock. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* pathbased: Add FAT support to extlinux and let FAT be "true" pathbasedAlek Du2010-02-101-12/+41
| | | | | | | | Now extlinux can install FAT partition now, and FAT honors patched path area. Signed-off-by: Alek Du <alek.du@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* pathbased: fix relative path in the extlinux installerAlek Du2010-02-101-1/+1
| | | | | | | | Fix a bug in the extlinux installer where the relative path is not found correctly. Signed-off-by: Alek Du <alek.du@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* extlinux: make installer rewrite the whole fileH. Peter Anvin2010-01-221-8/+11
| | | | | | | | With the additional patchable areas outside the main patch area, it is now much more complicated to keep track of a high water mark of what needs to be modified. It's easier to just rewrite the whole thing. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* pathbased: clean up diskstart address numbers, 256 byte subvolsH. Peter Anvin2010-01-131-1/+2
| | | | | | | | Clean up the uses of hard-coded addresses in diskstart.inc. Furthermore, the btrfs spec allows 255 characters for a subvolume, so we might as well allocate that much. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* pathbased:btrfs: initial subvol supportAlek Du2010-01-131-6/+46
| | | | | | Added "Subvol" name in the extlinux.sys, and then btrfs fs code will handle the subvol correctly. Also fixed the bug where CurrentDirName and SubvolName should not exist in the first sector.
* core: initial work on path-based cwd selectionH. Peter Anvin2010-01-061-10/+44
| | | | | | | | | | | Work on picking the initial cwd by storing a path instead of by storing an inode number. This should be both more general (in the sense of supporting filesystems in a generic way) as well as conceptually cleaner. The code doesn't work yet, but this at least provides support for the extlinux installer to store its subpath into the installed image. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* btrfs: add btrfs file system support to extlinuxsyslinux-4.00-pre7Alek Du2009-12-221-56/+208
| | | | | | | | the extlinux.sys will be installed in btrfs first 64K blank area, and the extlinux.conf must be in root dir... Signed-off-by: Alek Du <alek.du@intel.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
* extlinux: add ext4 support to the installersyslinux-4.00-pre1H. Peter Anvin2009-08-071-4/+5
| | | | | | | The filesystem code now supports ext4, so support it in the installer as well. Signed-off-by: H. Peter Anvin <hpa@zytor.com>