aboutsummaryrefslogtreecommitdiff
path: root/fs/fat
AgeCommit message (Collapse)Author
2010-11-17Switch from archive libraries to partial linkingSebastien Carlier
Before this commit, weak symbols were not overridden by non-weak symbols found in archive libraries when linking with recent versions of binutils. As stated in the System V ABI, "the link editor does not extract archive members to resolve undefined weak symbols". This commit changes all Makefiles to use partial linking (ld -r) instead of creating library archives, which forces all symbols to participate in linking, allowing non-weak symbols to override weak symbols as intended. This approach is also used by Linux, from which the gmake function cmd_link_o_target (defined in config.mk and used in all Makefiles) is inspired. The name of each former library archive is preserved except for extensions which change from ".a" to ".o". This commit updates references accordingly where needed, in particular in some linker scripts. This commit reveals board configurations that exclude some features but include source files that depend these disabled features in the build, resulting in undefined symbols. Known such cases include: - disabling CMD_NET but not CMD_NFS; - enabling CONFIG_OF_LIBFDT but not CONFIG_QE. Signed-off-by: Sebastien Carlier <sebastien.carlier@gmail.com>
2010-10-20FAT: buffer overflow with FAT12/16Stefano Babic
Last commit 3831530dcb7b71329c272ccd6181f8038b6a6dd0a was intended "explicitly specify FAT12/16 root directory parsing buffer size, instead of relying on cluster size". Howver, the underlying function requires the size of the buffer in blocks, not in bytes, and instead of passing a double sector size a request for 1024 blocks is sent. This generates a buffer overflow with overwriting of other structure (in the case seen, USB structures were overwritten). Signed-off-by: Stefano Babic <sbabic@denx.de> CC: Mikhail Zolotaryov <lebon@lebon.org.ua>
2010-10-12VFAT: fix processing of scattered long file name entriesMikhail Zolotaryov
The U-Boot code has the following bugs related to the processing of Long File Name (LFN) entries scattered across several clusters/sectors : 1) get_vfatname() function is designed to gather scattered LFN entries by cluster chain processing - that doesn't work for FAT12/16 root directory. In other words, the function expects the following input data: 1.1) FAT32 directory (which is cluster chain based); OR 1.2) FAT12/16 non-root directory (which is also cluster chain based); OR 1.3) FAT12/16 root directory (allocated as contiguous sectors area), but all necessary information MUST be within the input buffer of filesystem cluster size (thus cluster-chain jump is never initiated). In order to accomplish the last condition, root directory parsing code in do_fat_read() uses the following trick: read-out cluster-size block, process only first sector (512 bytes), then shift 512 forward, read-out cluster-size block and so on. This works great unless cluster size is equal to 512 bytes (in a case you have a small partition), or long file name entries are scattered across three sectors, see 4) for details. 2) Despite of the fact that get_vfatname() supports FAT32 root directory browsing, do_fat_read() function doesn't send current cluster number correctly, so root directory look-up doesn't work correctly. 3) get_vfatname() doesn't gather scattered entries correctly also is the case when all LFN entries are located at the end of the source cluster, but real directory entry (which must be returned) is at the only beginning of the next one. No error detected, the resulting directory entry returned contains a semi-random information (wrong size, wrong start cluster number and so on) i.e. the entry is not accessible. 4) LFN (VFAT) allows up to 20 entries (slots) each containing 26 bytes (13 UTF-16 code units) to represent a single long file name i.e. up to 520 bytes. U-Boot allocates 256 bytes buffer instead, i.e. 10 or more LFN slots record may cause buffer overflow / memory corruption. Also, it's worth to mention that 20+1 slots occupy 672 bytes space which may take more than one cluster of 512 bytes (medium-size FAT32 or small FAT16 partition) - get_vfatname() function doesn't support such case as well. The patch attached fixes these problems in the following way: - keep using 256 bytes buffer for a long file name, but safely prevent a possible buffer overflow (skip LFN processing, if it contains 10 or more slots). - explicitly specify FAT12/16 root directory parsing buffer size, instead of relying on cluster size. The value used is a double sector size (to store current sector and the next one). This fixes the first problem and increases performance on big FAT12/16 partitions; - send current cluster number (FAT32) to get_vfatname() during root directory processing; - use LFN counter to seek the real directory entry in get_vfatname() - fixes the third problem; - skip deleted entries in the root directory (to prevent bogus buffer overflow detection and LFN counter steps). Note: it's not advised to split up the patch, because a separate part may operate incorrectly. Signed-off-by: Mikhail Zolotaryov <lebon@lebon.org.ua>
2010-07-24fs/fat: Big code cleanup.Wolfgang Denk
- reformat - throw out macros like FAT_DPRINT and FAT_DPRINT - remove dead code Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-24FAT32: fix broken root directory handling.Wolfgang Denk
On FAT32, instead of fetching the cluster numbers from the FAT, the code assumed (incorrectly) that the clusters for the root directory were allocated contiguously. In the result, only the first cluster could be accessed. At the typical cluster size of 8 sectors this caused all accesses to files after the first 128 entries to fail - "fatls" would terminate after 128 files (usually displaying a bogus file name, occasionally even crashing the system), and "fatload" would fail to find any files that were not in the first directory cluster. Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-24FAT32: fix support for superfloppy-format (PBR)Wolfgang Denk
"Superfloppy" format (in U-Boot called PBR) did not work for FAT32 as the file system type string is at a different location. Add support for FAT32. Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-05-28nios: remove nios-32 archThomas Chou
The nios-32 arch is obsolete and broken. So it is removed. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
2009-06-12FAT replace compare_sign with strncmp.Tom Rix
The static function compare_sign is only used to compare the fs_type string and does not do anything more than what strncmp does. The addition of the trailing '\0' to fs_type, while legal, is not needed because the it is never printed out and strncmp does not depend on NULL terminated strings. Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
2009-04-03mflash: Initial mflash supportunsik Kim
Mflash is fusion memory device mainly targeted consumer eletronic and mobile phone. Internally, it have nand flash and other hardware logics and supports some different operation (ATA, IO, XIP) modes. IO mode is custom mode for the host that doesn't have IDE interface. (Many mobile targeted SoC doesn't have IDE bus) This driver support mflash IO mode. Followings are brief descriptions about IO mode. 1. IO mode based on ATA protocol and uses some custom command. (read confirm, write confirm) 2. IO mode uses SRAM bus interface. Signed-off-by: unsik Kim <donari75@gmail.com>
2009-01-27fat.c: fix warning: array subscript is above array boundsWolfgang Denk
Fix based on suggestion by David Hawkins <dwh@ovro.caltech.edu>. Signed-off-by: Wolfgang Denk <wd@denx.de>
2009-01-24fat: fix unaligned errorsBryan Wu
A couple of buffers in the fat code are declared as an array of bytes. But it is then cast up to a structure with 16bit and 32bit members. Since GCC assumes structure alignment here, we have to force the buffers to be aligned according to the structure usage. Signed-off-by: Bryan Wu <bryan.wu@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2008-12-10fs/fat: handle FAT on SATASonic Zhang
The FAT file system driver should also handle FAT on SATA devices. Signed-off-by: Sonic Zhang <Sonic.Zhang@analog.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2008-12-04Remove non-ascii characters from fat codeRemy Bohmer
This code contains some non-ascii characters in comment lines and code. Most editors do not display those characters properly and editing those files results always in diffs at these places which are usually not required to be changed at all. This is error prone. So, remove those weird characters and replace them by normal C-style equivalents for which the proper defines were already in the header. Signed-off-by: Remy Bohmer <linux@bohmer.net>
2008-08-31fs: Move conditional compilation to MakefileJean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-03-03Fix checking fat32 cluster size.michael
This fixes the cluster size tests in the FAT32 file system. The current implementation of VFAT support doesn't work if the referred cluster has an offset > 16bit representation, causing "fatload" and "fatls" commands etc. to fail. Signed-off-by: michael trimarchi <trimarchi@gandalf.sssup.it>
2008-02-14Fix CONFIG_MMC usage in fat codeAndy Fleming
A #if statement in fat.c depended on CONFIG_MMC, instead of defined(CONFIG_MMC). This meant CONFIG_MMC needed to be defined as "1" rather than just defined. Now it's better. Signed-off-by: Andy Fleming <afleming@freescale.com>
2008-01-09Fix my own merge stupidityAndy Fleming
Way back in August I merged Heiko's patch: 566a494f592: [PCS440EP] upgrade the PCS440EP board with Jon's CONFIG_COMMANDS patches. This was done in commit: 6bf6f114dcdd97ec3f80c2761ed40e31229d6b78 However, in the process, I left out some of Heiko's good changes. Now Heiko's and Jon's patches are properly merged in fat_register_device() Signed-off-by: Andy Fleming <afleming@freescale.com>
2007-08-07Fix missing brace error in fs/fat/fat.cWolfgang Denk
[pointed out by Roderik Wildenburg] Signed-off-by: Wolfgang Denk <wd@denx.de>
2007-08-03Merge branch 'testing' into workingAndy Fleming
Conflicts: CHANGELOG fs/fat/fat.c include/configs/MPC8560ADS.h include/configs/pcs440ep.h net/eth.c
2007-07-09fs/: Remove obsolete references to CONFIG_COMMANDSJon Loeliger
Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-07-04fs/: Augment CONFIG_COMMANDS tests with defined(CONFIG_CMD_*).Jon Loeliger
This is a compatibility step that allows both the older form and the new form to co-exist for a while until the older can be removed entirely. All transformations are of the form: Before: #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) After: #if (CONFIG_COMMANDS & CFG_CMD_AUTOSCRIPT) || defined(CONFIG_CMD_AUTOSCRIPT) Signed-off-by: Jon Loeliger <jdl@freescale.com>
2007-06-22[PCS440EP] upgrade the PCS440EP board:Heiko Schocher
- Show on the Status LEDs, some States of the board. - Get the MAC addresses from the EEProm - use PREBOOT - use the CF on the board. - check the U-Boot image in the Flash with a SHA1 checksum. - use dynamic TLB entries generation for the SDRAM Signed-off-by: Heiko Schocher <hs@denx.de>
2007-05-18Reduce line lengths to 80 characters max.Peter Pearse
2007-05-09New board SMN42 branchPeter Pearse
2006-10-09Move "ar" flags to config.mk to allow for silent "make -s"Wolfgang Denk
Based on patch by Mike Frysinger, 20 Jun 2006
2006-09-01Add support for a saving build objects in a separate directory.Marian Balakowicz
Modifications are based on the linux kernel approach and support two use cases: 1) Add O= to the make command line 'make O=/tmp/build all' 2) Set environement variable BUILD_DIR to point to the desired location 'export BUILD_DIR=/tmp/build' 'make' The second approach can also be used with a MAKEALL script 'export BUILD_DIR=/tmp/build' './MAKEALL' Command line 'O=' setting overrides BUILD_DIR environent variable. When none of the above methods is used the local build is performed and the object files are placed in the source directory.
2005-10-13Cleanup for GCC-4.xWolfgang Denk
2005-08-06Add support for Altera NIOS DK1C20 boardWolfgang Denk
Patch by Shlomo Kut, 13 Dec 2004
2004-12-16"static" from "do_fat_read" removedstroese
2004-09-29* Patches by Sean Chang, 09 Aug 2004:wdenk
- Added support for both 8 and 16 bit mode access to System ACE CF through MPU. - Fixed missing System ACE CF device during get FAT partition info in fat_register_device function. - Enabled System ACE CF support on ML300. * Patch by Sean Chang, 09 Aug 2004: Synch defines for saveenv and do_saveenv functions so they get compiled under the same statement.
2004-03-14* Patches by Travis Sawyer, 12 Mar 2004:wdenk
- Fix Gigabit Ethernet support for 440GX - Add Gigabit Ethernet Support to MII PHY utilities * Patch by Brad Kemp, 12 Mar 2004: Fixes for drivers/cfi_flash.c: - Better support for x8/x16 implementations - Added failure for AMD chips attempting to use CFG_FLASH_USE_BUFFER_WRITE - Added defines for AMD command and address constants * Patch by Leon Kukovec, 12 Mar 2004: Fix get_dentfromdir() to correctly handle deleted dentries * Patch by George G. Davis, 11 Mar 2004: Remove hard coded network settings in TI OMAP1610 H2 default board config * Patch by George G. Davis, 11 Mar 2004: add support for ADS GraphicsClient+ board.
2004-02-26* Patch by Markus Pietrek, 24 Feb 2004:wdenk
NS9750 DevBoard added * Patch by Pierre AUBERT, 24 Feb 2004 add USB support for MPC5200 * Patch by Steven Scholz, 24 Feb 2004: - fix MII commands to use values from last command * Patch by Torsten Demke, 24 Feb 2004: Add support for the eXalion platform (SPSW-8240, F-30, F-300)
2004-02-23* Patch by Thomas Elste, 10 Feb 2004:wdenk
Add support for NET+50 CPU and ModNET50 board * Patch by Sam Song, 10 Feb 2004: Fix typos in cfi_flash.c * Patch by Leon Kukovec, 10 Feb 2004 Fixed long dir entry slot id calculation in get_vfatname * Patch by Robin Gilks, 10 Feb 2004: add "itest" command (operators: -eq, -ne, -lt, -gt, -le, -ge, ==, !=, <>, <, >, <=, >=)
2003-12-07* Patches by David Müller, 14 Nov 2003:wdenk
- board/mpl/common/common_util.c * implement support for BZIP2 compressed images * various cleanups (printf -> puts, ...) - board/mpl/common/flash.c * report correct errors to upper layers * check the erase fail and VPP low bits in status reg - board/mpl/vcma9/cmd_vcma9.c - board/mpl/vcma9/flash.c * various cleanups (printf -> puts, ...) - common/cmd_usb.c * fix typo in comment - cpu/arm920t/usb_ohci.c * support for S3C2410 is missing in #if line - drivers/cs8900.c * reinit some registers in case of error (cable missing, ...) - fs/fat/fat.c * support for USB/MMC devices is missing in #if line - include/configs/MIP405.h - include/configs/PIP405.h * enable BZIP2 support * enlarge malloc space to 1MiB because of BZIP2 support - include/configs/VCMA9.h * enable BZIP2 support * enlarge malloc space to 1MiB because of BZIP2 support * enable USB support - lib_arm/armlinux.c * change calling convention of ARM Linux kernel as described on http://www.arm.linux.org.uk/developer/booting.php * Patch by Thomas Lange, 14 Nov 2003: Split dbau1x00 into dbau1000, dbau1100 and dbau1500 configs to support all these AMD boards. * Patch by Thomas Lange, 14 Nov 2003: Workaround for mips au1x00 physical memory accesses (the au1x00 uses a 36 bit bus internally and cannot access physical memory directly. Use the uncached SDRAM address instead of the physical one.)
2003-10-29* Prepare for releasewdenk
* Fix problems in memory test on some boards (which was not non-destructive as intended) * Patch by Gary Jennejohn, 28 Oct 2003: Change fs/fat/fat.c to put I/O buffers in BSS instead on the stack to prevent stack overflow on ARM systems
2003-10-09* Patch by Martin Krause, 09 Oct 2003:LABEL_2003_10_09_1515wdenk
Fixes for TRAB board - /board/trab/rs485.c: correct baudrate - /board/trab/cmd_trab.c: bug fix for problem with timer overflow in udelay(); fix some timing problems with adc controller - /board/trab/trab_fkt.c: add new commands: gain, eeprom and power; modify commands: touch and buzzer * Disable CONFIG_SUPPORT_VFAT when used with CONFIG_AUTO_UPDATE (quick & dirty workaround for rogue pointer problem in get_vfatname()); Use direct function calls for auto_update instead of hush commands
2003-09-11* Patch by Gary Jennejohn, 11 Sep 2003:wdenk
- allow for longer timeouts for USB mass storage devices * Patch by Denis Peter, 11 Sep 2003: - fix USB data pointer assignment for bulk only transfer. - prevent to display erased directories in FAT filesystem. * Change output format for NAND flash - make it look like for other memory, too
2003-09-10* Patches by Denis Peter, 9 Sep 2003:U-Boot-0_4_8wdenk
add FAT support for IDE, SCSI and USB * Patches by Gleb Natapov, 2 Sep 2003: - cleanup of POST code for unsupported architectures - MPC824x locks way0 of data cache for use as initial RAM; this patch unlocks it after relocation to RAM and invalidates the locked entries. * Patch by Gleb Natapov, 30 Aug 2003: new I2C driver for mpc107 bridge. Now works from flash. * Patch by Dave Ellis, 11 Aug 2003: - JFFS2: fix typo in common/cmd_jffs2.c - JFFS2: fix CFG_JFFS2_SORT_FRAGMENTS option - JFFS2: remove node version 0 warning - JFFS2: accept JFFS2 PADDING nodes - SXNI855T: add AM29LV800 support - SXNI855T: move environment from EEPROM to flash - SXNI855T: boot from JFFS2 in NOR or NAND flash * Patch by Bill Hargen, 11 Aug 2003: fixes for I2C on MPC8240 - fix i2c_write routine - fix iprobe command - eliminates use of global variables, plus dead code, cleanup.
2003-06-27* Code cleanup:LABEL_2003_06_27_2340wdenk
- remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen)
2003-06-15* Fix CONFIG_NET_MULTI support in include/net.hLABEL_2003_06_16_0055wdenk
* Patches by Kyle Harris, 13 Mar 2003: - Add FAT partition support - Add command support for FAT - Add command support for MMC ---- - Add Intel PXA support for video - Add Intel PXA support for MMC ---- - Enable MMC and FAT for lubbock board - Other misc changes for lubbock board