Commit Graph

286 Commits

Author SHA1 Message Date
Marek Vasut ff04f6d122 fs: fat: Fix mkcksum() function parameters
The mkcksum() function now takes one parameter, the pointer to
11-byte wide character array, which it then operates on.

Currently, the function is wrongly passed (dir_entry)->name, which
is only 8-byte wide character array. Though by further inspecting
the dir_entry structure, it can be noticed that the name[8] entry
is immediatelly followed by ext[3] entry. Thus, name[8] and ext[3]
in the dir_entry structure actually work as this 11-byte wide array
since they're placed right next to each other by current compiler
behavior.

Depending on this is obviously wrong, thus fix this by correctly
passing both (dir_entry)->name and (dir_entry)->ext to the mkcksum()
function and adjust the function appropriately.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Tom Rini <trini@ti.com>
2012-10-17 07:59:11 -07:00
Albert ARIBAUD b823fd9ba5 ARM: prevent misaligned array inits
Under option -munaligned-access, gcc can perform local char
or 16-bit array initializations using misaligned native
accesses which will throw a data abort exception. Fix files
where these array initializations were unneeded, and for
files known to contain such initializations, enforce gcc
option -mno-unaligned-access.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
[trini: Switch to usign call cc-option for -mno-unaligned-access as
Albert had done previously as that's really correct]
Signed-off-by: Tom Rini <trini@ti.com>
2012-10-15 11:53:07 -07:00
Anatolij Gustschin 8cc64bafc0 yaffs2: Fix GCC 4.6 compile warnings
Fix:
yaffs_guts.c: In function 'yaffs_check_chunk_erased':
yaffs_guts.c:324:6: warning: variable 'result' set but not used
[-Wunused-but-set-variable]
yaffs_guts.c: In function 'yaffs_verify_chunk_written':
yaffs_guts.c:352:6: warning: variable 'result' set but not used
[-Wunused-but-set-variable]
yaffs_guts.c: In function 'yaffs_grab_chunk_cache':
yaffs_guts.c:1488:6: warning: variable 'pushout' set but not used
[-Wunused-but-set-variable]
yaffs_guts.c: In function 'yaffs_check_obj_details_loaded':
yaffs_guts.c:3180:6: warning: variable 'alloc_failed' set but not used
[-Wunused-but-set-variable]
yaffs_guts.c:3179:6: warning: variable 'result' set but not used
[-Wunused-but-set-variable]
yaffs_guts.c: In function 'yaffs_update_oh':
yaffs_guts.c:3288:6: warning: variable 'result' set but not used
[-Wunused-but-set-variable]
yaffs_guts.c: In function 'yaffs_get_obj_name':
yaffs_guts.c:4447:7: warning: variable 'result' set but not used
[-Wunused-but-set-variable]
yaffs_summary.c: In function 'yaffs_summary_read':
yaffs_summary.c:194:6: warning: variable 'sum_tags_bytes' set but not
used [-Wunused-but-set-variable]
yaffs_verify.c: In function 'yaffs_verify_file':
yaffs_verify.c:227:6: warning: variable 'actual_depth' set but not used
[-Wunused-but-set-variable]
yaffs_yaffs1.c: In function 'yaffs1_scan':
yaffs_yaffs1.c:26:6: warning: variable 'result' set but not used
[-Wunused-but-set-variable]
yaffs_yaffs2.c: In function 'yaffs2_scan_chunk':
yaffs_yaffs2.c:949:6: warning: variable 'result' set but not used
[-Wunused-but-set-variable]
yaffs_yaffs2.c: In function 'yaffs2_scan_backwards':
yaffs_yaffs2.c:1352:6: warning: variable 'deleted' set but not used
[-Wunused-but-set-variable]

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Charles Manning <cdhmanning@gmail.com>
Tested-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
2012-10-08 11:15:04 -07:00
Stephen Warren bd1a7e3034 FAT: check for partition 0 not 1 for whole-disk fs
The recent switch to use get_device_and_partition() from do_fat_ls()
broke the ability to access a FAT filesystem directly on a whole device;
FAT only works within a partition on a device.

This change makes e.g. "fatls mmc 0:0" work; explicitly requesting
partition ID 0 is something that get_device_and_partition() fully
supports. However, fat_register_device() expects partition ID 1 to be
used in the full-disk case; partition ID 1 was previously implicitly
specified when the user didn't actually specify a partition ID. Update
fat_register_device() to expect the correct ID.

This change does imply that if a user explicitly executes "fatls mmc 0:1"
then this will fail, and may be a change in behaviour.

Note that this still prevents "fatls mmc 0:auto" from working. The next
patch will fix that.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
2012-10-08 11:15:04 -07:00
Simon Glass 73c15c634d ext4: Rename block group descriptor table from gd to bgd
On x86 machines gd is unfortunately a #define, so we should avoid using
gd for anything. This patch changes uses of gd to bgd so that ext4fs
can be used on x86.

A better fix would be to remove the #define in x86, but I'm not sure
how to do that.

Signed-off-by: Simon Glass <sjg@chromium.org>
2012-10-03 18:21:33 -07:00
Benoît Thébaudeau 1170e634dd FAT: Make it possible to read from any file position
When storage devices contain files larger than the embedded RAM, it is
useful to be able to read these files by chunks, e.g. for a software
update to the embedded NAND Flash from an external storage device (USB
stick, SD card, etc.).

Hence, this patch makes it possible by adding a new FAT API to read
files from a given position. This patch also adds this feature to the
fatload command.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
Signed-off-by: Tom Rini <trini@ti.com>
2012-09-26 11:11:32 -07:00
Rob Herring 650f36641c cmd_reiser: use common get_device_and_partition function
Convert reiserload and reiserls to use common device and partition parsing
function. With the common function "dev:part" can come from the
environment and a '-' can be used in that case.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-09-25 14:49:18 -07:00
Rob Herring 4120457044 cmd_zfs: use common get_device_and_partition function
Convert zfsload and zfsls to use common device and partition parsing
function. With the common function "dev:part" can come from the
environment and a '-' can be used in that case.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-09-25 14:49:17 -07:00
Rob Herring 81180819b8 cmd_extX: use common get_device_and_partition function
Convert ext2/4 load, ls, and write functions to use common device and
partition parsing function. With the common function "dev:part" can come
from the environment and a '-' can be used in that case.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-09-25 14:46:55 -07:00
Rob Herring 9450106296 ext4: remove init_fs/deinit_fs
There's no real need to expose this and it can be removed by using a static
allocation.

Signed-off-by: Rob Herring <rob.herring@calxeda.com>
2012-09-25 14:46:35 -07:00
Tom Rini 5fb29f3c48 Merge branch 'ext4'
Update Makefile change for LIBS -> LIBS-y change.

Conflicts:
	Makefile

Signed-off-by: Tom Rini <trini@ti.com>
2012-09-20 11:27:35 -07:00
Stephen Warren 55b523b7d4 ext4: cache-align buffers so the invalidation works
DMA buffer cache invalidation requires that buffers have cache-aligned
buffer locations and sizes. Use memalign() and ALLOC_CACHE_ALIGN_BUFFER()
to ensure this.

On Tegra at least, without this fix, the following fail commands fail in
u-boot-master/ext4, but succeeded at the branch's branch point in
u-boot/master. With this fix, the commands work again:

ext2ls mmc 0:1 /
ext2load mmc 0:1 /boot/zImage

Cc: Uma Shankar <uma.shankar@samsung.com>
Cc: Manjunatha C Achar <a.manjunatha@samsung.com>
Cc: Iqbal Shareef <iqbal.ams@samsung.com>
Cc: Hakgoo Lee <goodguy.lee@samsung.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Tom Rini <trini@ti.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
2012-09-20 11:07:26 -07:00
Benoît Thébaudeau 7ee46cebcb FAT: Fix file contents listed as directory
With:
fatls mmc 0 /dir/file
dir: regular directory
file: regular file

The previous code read the contents of file as if it were directory entries to
list. This patch refuses to list file contents as if it were a folder.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
2012-09-18 12:01:53 -07:00
Veli-Pekka Peltola 8044c1387f ubifs: Fix ubifsload when using ZLIB
Using ZLIB compression with UBIFS fails if last data node is not a size of
UBIFS_BLOCK_SIZE (4096 bytes).

Easiest way to test this is trying to read a file smaller than 4k:
=> ubifsload 41000000 /etc/fstab
Loading file '/etc/fstab' to addr 0x41000000 with size 704 (0x000002c0)...
UBIFS error (pid 0): read_block: bad data node (block 0, inode 2506)
UBIFS error (pid 0): do_readpage: cannot read page 0 of inode 2506, error -22
Error reading file '/etc/fstab'
/etc/fstab not found!
exit not allowed from main input shell.
=>

With this patch:

=> ubifsload 41000000 /etc/fstab
Loading file '/etc/fstab' to addr 0x41000000 with size 704 (0x000002c0)...
Done
=>

Signed-off-by: Veli-Pekka Peltola <veli-pekka.peltola@bluegiga.com>
Cc: kmpark@infradead.org
Tested-by: Andreas Bießmann <andreas.devel@googlemail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2012-09-10 11:37:42 +02:00
Stefan Roese be73913b91 ubifs: Fix memory leak in ubifs_finddir
This patch fixes a memory leak in ubifs_finddir().

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: dev.ma.dma@gmail.com
2012-09-03 11:37:50 +02:00
Benoît Thébaudeau 0880e5bb0c FAT: Simplify get_contents
One call to get_cluster can be factorized with another, so avoid
duplicating code.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
2012-09-02 17:22:43 +02:00
Benoît Thébaudeau cc63b25efb FAT: get_cluster: Add buffer bouncing
Add a buffer bouncing mechanism to get_cluster.  This can be useful
for misaligned applicative buffers passed through get_contents.
This is required for the following patches in the case of data
aligned differently relatively to buffers and clusters.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
2012-09-02 17:22:10 +02:00
Benoît Thébaudeau cd1b042c5c FAT: Fix redundant sector read
With the previous code, the remaining prefetched sectors were read
again after each sector.  With this patch, each sector is read only
once, thus making the prefetch useful.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
2012-09-02 17:16:08 +02:00
Benoît Thébaudeau 88503ad3bb FAT: cosmetic: Remove useless assignment
fatlength is not used after this assignment, so it is useless and can
be removed.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
2012-09-02 17:15:16 +02:00
Benoît Thébaudeau 8006dd2e57 FAT: get_fatent: Fix FAT boundary check
startblock must be taken into account in order not to read past the
end of the FAT.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
2012-09-02 17:14:30 +02:00
Benoît Thébaudeau 9795e07b04 FAT: cosmetic: Remove extra spaces
Remove spaces before opening parentheses in function calls.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
Cc: Wolfgang Denk <wd@denx.de>
2012-09-02 17:13:18 +02:00
Charles Manning 74f45b739b u-boot yaffs2: Fix compilation warnings
Also remove yaffs_hweight and use the hweight in u-boot.

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
2012-09-02 16:47:50 +02:00
Uma Shankar ed34f34dba ext4fs write support
Signed-off-by: Uma Shankar <uma.shankar@samsung.com>
Signed-off-by: Manjunatha C Achar <a.manjunatha@samsung.com>
Signed-off-by: Iqbal Shareef <iqbal.ams@samsung.com>
Signed-off-by: Hakgoo Lee <goodguy.lee@samsung.com>
2012-08-09 23:48:02 +02:00
Uma Shankar a1596438a6 ext4fs ls load support
Signed-off-by: Uma Shankar <uma.shankar@samsung.com>
Signed-off-by: Manjunatha C Achar <a.manjunatha@samsung.com>
Signed-off-by: Iqbal Shareef <iqbal.ams@samsung.com>
Signed-off-by: Hakgoo Lee <goodguy.lee@samsung.com>
2012-08-09 23:47:43 +02:00
Jorgen Lundman 4d3c95f5ea zfs: Add ZFS filesystem support
U-Boot port is based on sources forked from GRUB-0.97 by Sun in 2004,
which can be found here:
http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/grub/grub-0.97/stage2/zfs-include/zfs.h

Released by Sun for GRUB under the license:
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.

GRUB official releases include ZFS in version:
ftp://alpha.gnu.org/gnu/grub/grub-1.99~rc1.tar.gz

And patched against GRUB Bazaar repository for ashift fixes (4KB HDDs)
more conveniently found at github:
e7b6ef3ac3

Signed-off-by: Jorgen Lundman <lundman@lundman.net>
2012-08-09 23:42:20 +02:00
Charles Manning 753ac61088 u-boot: Update yaffs2 file system
This patch updates the yaffs2 in u-boot to correspond to
git://www.aleph1.co.uk/yaffs2
commit id 9ee5d0643e559568dbe62215f76e0a7bd5a63d93

Signed-off-by: Charles Manning <cdhmanning@gmail.com>
2012-08-09 23:39:18 +02:00
Bernhard Walle f75325e192 UBIFS: Improve error message when reading superblock failed
In addition to the error message also display the error code. I had the
problem that my malloc memory was not enough (ENOMEM), and if u-boot
had displayed the error code immediately that would have saved me some
debugging.

Signed-off-by: Bernhard Walle <walle@corscience.de>

Use ubifs_err instead of printf.
Add "errno=%d" in output as suggested by Albert Aribaud.

Signed-off-by: Thomas Weber <weber@corscience.de>
2012-08-09 22:12:16 +02:00
Tom Rini 94c1a20fe7 ext2fs: fix warning: 'blocknxt' may be used uninitialized with gcc 4.2
The above warning was introduced originally in 436da3c "ext2load:
increase read speed" and fixed for newer toolchains in b803273 "ext2fs:
fix warning: 'blocknxt' may be used uninitialized".  This change did not
fix the warning with gcc 4.2, as found in ELDK 4.2.

If we rework the while loop to initalize blocknxt before entering the
warning really goes away.  Tested on am335x with an approx 7mb file and
crc32 in U-Boot befor and after this change.

Cc: Wolfgang Denk <wd@denx.de>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Jason Cooper <u-boot@lakedaemon.net>
Cc: Andreas Bießmann <andreas.devel@googlemail.com>
Cc: Reinhard Arlt <reinhard.arlt@esd-electronics.com>
Cc: Kim Phillips <kim.phillips@freescale.com>
Signed-off-by: Tom Rini <trini@ti.com>
2012-08-07 20:52:42 +02:00
Kim Phillips b8032734ee ext2fs: fix warning: 'blocknxt' may be used uninitialized
This warning was introduced in 436da3c "ext2load: increase read
speed":

ext2fs.c: In function 'ext2fs_read_file':
ext2fs.c:458:19: warning: 'blocknxt' may be used uninitialized in this function [-Wuninitialized]

this change makes it go away.

Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Thierry Reding <thierry.reding@avionic-design.de>
Cc: Jason Cooper <u-boot@lakedaemon.net>
Cc: Andreas Bießmann <andreas.devel@googlemail.com>
Cc: Reinhard Arlt <reinhard.arlt@esd-electronics.com>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
2012-07-08 22:55:04 +02:00
u-boot@lakedaemon.net 436da3cd23 ext2load: increase read speed
This patch dramatically drops the amount of time u-boot needs to read a
file from an ext2 partition.  On a typical 2 to 5 MB file (kernels and
initrds) it goes from tens of seconds to a couple seconds.

All we are doing here is grouping contiguous blocks into one read.

Boot tested on Globalscale Technologies Dreamplug (Kirkwood ARM SoC)
with three different files.  sha1sums were calculated in Linux
userspace, and then confirmed after ext2load.

Signed-off-by: Jason Cooper <u-boot@lakedaemon.net>
Tested-by: Eric Nelson <eric.nelson@boundarydevices.com>
Tested-by: Thierry Reding <thierry.reding@avionic-design.de>
2012-06-21 22:49:33 +02:00
Marek Vasut b37d41aa24 Block: Remove MG DISK support
This driver is unused and obsolete.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: unsik Kim <donari75@gmail.com>
2012-06-21 20:53:09 +02:00
Mike Frysinger 7b15e2bb9b linux/compat.h: rename from linux/mtd/compat.h
This lets us use it in more places than just mtd code.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-30 16:54:51 +02:00
Mike Frysinger e3ed0575a7 gunzip: rename z{alloc, free} to gz{alloc, free}
This allows us to add a proper zalloc() func (one that does a zeroing
alloc), and removes duplicate prototypes.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-04-30 16:54:51 +02:00
Eric Nelson 9a800ac718 fs/fat: align disk buffers on cache line to enable DMA and cache
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
Acked-by: Mike Frysinger <vapier@gentoo.org>
2012-04-30 16:54:50 +02:00
Anatolij Gustschin bf6b6af746 fs/fat/fat_write.c: Fix GCC 4.6 warnings
Fix:
fat_write.c: In function 'find_directory_entry':
fat_write.c:826:8: warning: variable 'prevcksum' set but not used
[-Wunused-but-set-variable]
fat_write.c: In function 'do_fat_write':
fat_write.c:933:6: warning: variable 'root_cluster' set but not used
[-Wunused-but-set-variable]
fat_write.c:925:12: warning: variable 'slotptr' set but not used
[-Wunused-but-set-variable]

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Donggeun Kim <dg77.kim@samsung.com>
Acked-by: Maximilian Schwerin <mvs@tigris.de>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-03-26 10:58:54 +02:00
Donggeun Kim 079df7223c FAT write: Fix compile errors
This patch removes compile errors introduced by
commit 9813b750f3
'fs/fat: Fix FAT detection to support non-DOS partition tables'

fat_write.c: In function 'disk_write':
fat_write.c:54: error: 'part_offset' undeclared (first use in this function)
fat_write.c:54: error: (Each undeclared identifier is reported only once
fat_write.c:54: error: for each function it appears in.)
fat_write.c: In function 'do_fat_write':
fat_write.c:950: error: 'part_size' undeclared (first use in this function)

These errors only appear when this code is enabled by
defining CONFIG_FAT_WRITE option.

This patch was originally part of

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/121847

Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Maximilian Schwerin <mvs@tigris.de>

Fixed patch author and added all needed SoB from the original patch
and also submitter's SoB. Extended commit log.
Signed-off-by: Anatolij Gustschin <agust@denx.de>
2012-03-24 23:27:32 +01:00
Donggeun Kim 627182ea9d FAT: update the second FAT when writing a file
After susccessful write to the FAT partition,
fsck program may print warning message due to different FAT,
provided that the filesystem supports two FATs.

This patch makes the second FAT to be same with the first one
when writing a file.

Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-01-05 20:10:38 +01:00
Kyle Moffett 46236b1407 fs/fat: Improve error handling
The FAT filesystem fails silently in inexplicable ways when given a
filesystem with a block-size that does not match the device sector size.
In theory this is not an unsupportable combination but requires a major
rewrite of a lot of the filesystem.  Until that occurs, the filesystem
should detect that scenario and display a helpful error message.

This scenario in particular occurred on a 512-byte blocksize FAT fs
stored in an El-Torito boot volume on a CD-ROM (2048-byte sector size).

Additionally, in many circumstances the ->block_read method will not
return a negative number to indicate an error but instead return 0 to
indicate the number of blocks successfully read (IE: None).

The FAT filesystem should defensively check to ensure that it got all of
the sectors that it asked for when reading.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
2012-01-05 20:10:37 +01:00
Kyle Moffett 9813b750f3 fs/fat: Fix FAT detection to support non-DOS partition tables
The FAT filesystem code currently ends up requiring that the partition
table be a DOS MBR, as it checks for the DOS 0x55 0xAA signature on the
partition table (which may be Mac, EFI, ISO9660, etc) before actually
computing the partition offset.

This fixes support for accessing a FAT filesystem in an ISO9660 boot
volume (El-Torito format) by reordering the filesystem checks and
reading the 0x55 0xAA "DOS boot signature" and FAT/FAT32 magic number
from the first sector of the partition instead of from sector 0.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>

Fix build warning:  fat.c: In function 'fat_register_device':
fat.c:66:15: warning: variable 'found_partition' set but not used
[-Wunused-but-set-variable]
Signed-off-by: Wolfgang Denk <wd@denx.de>
2012-01-05 20:10:06 +01:00
Simon Glass 26784f1ecb ext2: Cache line align indirection buffers
Make ext2 use cache line aligned buffers for reading from the filesystem.
This is needed when caches are enabled because unaligned cache invalidates
are not safe.

Signed-off-by: Simon Glass <sjg@chromium.org>
2012-01-05 17:12:11 +01:00
Sergei Shtylyov bf34e7d952 fat: reset VFAT short alias checksum on first match
The VFAT short alias checksum read from a long file name is only overwritten
when another long file name appears in a directory list. Until then it renders
short file names invisible that have the same checksum. Reset the checksum on
first match.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Martin Mueller <martin.mueller5@de.bosch.com>
2012-01-05 16:03:24 +01:00
Wolfgang Denk bfcc40bb09 Merge branch 'next' of ../next
* 'next' of ../next:
  mkenvimage: Add version info switch (-V)
  mkenvimage: Fix getopt() error handling
  mkenvimage: Fix some typos
  phy: add Micrel KS8721BL phy definition
  net: introduce per device index
  mvgbe: remove setting of ethaddr within the driver
  x86: Add support for specifying an initrd with the zboot command
  x86: Refactor the zboot innards so they can be reused with a vboot image
  x86: Add infrastructure to extract an e820 table from the coreboot tables
  x86: Add support for booting Linux using the 32 bit boot protocol
  x86: Clean up the x86 zimage code in preparation to extend it
  x86: Import code from coreboot's libpayload to parse the coreboot table
  x86: Initial commit for running as a coreboot payload
  CHECKPATCH: ./board/esd/hh405/logo_320_240_8bpp.c
  CHECKPATCH: ./board/esd/hh405/logo_1024_768_8bpp.c
  CHECKPATCH: ./board/esd/hh405/logo_320_240_4bpp.c
  CHECKPATCH: ./board/esd/hh405/logo_640_480_24bpp.c
  CHECKPATCH: ./board/esd/apc405/logo_640_480_24bpp.c
  CHECKPATCH: ./board/esd/voh405/logo_320_240_4bpp.c
  CHECKPATCH: ./board/esd/voh405/logo_640_480_24bpp.c
  CHECKPATCH: ./board/esd/hh405/fpgadata.c
  CHECKPATCH: ./board/esd/pci405/fpgadata.c
  CHECKPATCH: ./board/esd/tasreg/fpgadata.c
  CHECKPATCH: ./board/esd/apc405/fpgadata.c
  CHECKPATCH: ./board/esd/voh405/fpgadata.c
  CHECKPATCH: ./board/esd/ash405/fpgadata.c
  CHECKPATCH: ./board/esd/dasa_sim/fpgadata.c
  CHECKPATCH: ./board/esd/ar405/fpgadata_xl30.c
  CHECKPATCH: ./board/esd/ar405/fpgadata.c
  CHECKPATCH: ./board/esd/plu405/fpgadata.c
  CHECKPATCH: ./board/esd/wuh405/fpgadata.c
  CHECKPATCH: ./board/esd/cpci405/fpgadata_cpci405.c
  CHECKPATCH: ./board/esd/cpci405/fpgadata_cpci405ab.c
  CHECKPATCH: ./board/esd/cpci405/fpgadata_cpci4052.c
  CHECKPATCH: ./board/esd/canbt/fpgadata.c
  CHECKPATCH: ./board/esd/du405/fpgadata.c
  CHECKPATCH: ./board/esd/cpciiser4/fpgadata.c
  CHECKPATCH: ./board/dave/PPChameleonEVB/fpgadata.c
  avr32:mmu.c: fix printf() length modifier
  fat.c: fix printf() length modifier
  cmd_sf.c: fix printf() length modifier
  Make printf and vprintf safe from buffer overruns
  vsprintf: Move function documentation into header file
  Add safe vsnprintf and snprintf library functions
  Move vsprintf functions into their own header

Conflicts:
	tools/mkenvimage.c

Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-12-23 20:53:58 +01:00
Anatolij Gustschin 8506eb8d6a FAT: fix some issues in FAT write support code
Writing a file to the FAT partition didn't work while a
test using a CF card. The test was done on mpc5200 based
board (powerpc). There is a number of problems in FAT
write code:

Compiler warning:
fat_write.c: In function 'file_fat_write':
fat_write.c:326: warning: 'counter' may be used uninitialized
in this function
fat_write.c:326: note: 'counter' was declared here

'l_filename' string is not terminated, so a file name
with garbage at the end is used as a file name as shown
by debug code.

Return value of set_contents() is not checked properly
so actually a file won't be written at all (as checked
using 'fatls' after a write attempt with 'fatwrite'
command).

do_fat_write() doesn't return the number of written bytes
if no error happened. However the return value of this
function is used to show the number of written bytes
in do_fat_fswrite().

The patch adds some debug code and fixes above mentioned
problems and also fixes a typo in error output.

NOTE: after a successful write to the FAT partition (under
U-Boot) the partition was checked under Linux using fsck.
The partition needed fixing FATs:
-bash-3.2# fsck -a /dev/sda1
fsck 1.39 (29-May-2006)
dosfsck 2.11, 12 Mar 2005, FAT32, LFN
FATs differ but appear to be intact. Using first FAT.
Performing changes.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
Cc: Donggeun Kim <dg77.kim@samsung.com>
Cc: Aaron Williams <Aaron.Williams@cavium.com>
Acked-by: Donggeun Kim <dg77.kim@samsung.com>
2011-12-20 23:18:43 +01:00
Andreas Bießmann 2d1b83b346 fat.c: fix printf() length modifier
The DIRENTSPERBLOCK utilizes sizeof() which will return a size_t which has no
fixed size. Therefor use correct length modifer for printf() statement to
prevent compiler warnings.

This patch fixes following warning:

---8<---
fat.c: In function 'do_fat_read':
fat.c:879: warning: format '%d' expects type 'int', but argument 4 has type 'long unsigned int'
--->8---

Signed-off-by: Andreas Bießmann <biessmann@corscience.de>
cc: Mike Frysinger <vapier@gentoo.org>
cc: Thomas Chou <thomas@wytron.com.tw>
cc: rjones@nexus-tech.net
cc: kharris@nexus-tech.net
Acked-by: Mike Frysinger <vapier@gentoo.org>
2011-12-17 23:56:40 +01:00
Anatolij Gustschin fa75f51561 fs/reiserfs/reiserfs.c: Fix compiler warning
Fix:
reiserfs.c: In function 'reiserfs_mount':
reiserfs.c:360:22: warning: dereferencing type-punned pointer
will break strict-aliasing rules [-Wstrict-aliasing]

Signed-off-by: Anatolij Gustschin <agust@denx.de>
2011-12-12 14:25:30 +01:00
Wolfgang Denk 5c2db13a2a fs/yaffs2/yaffs_guts.c: Fix GCC 4.6 compile warning (and bug)
Fix:
yaffs_guts.c: In function 'yaffs_GarbageCollectBlock':
yaffs_guts.c:2761:6: warning: variable 'retVal' set but not used
[-Wunused-but-set-variable]

Here GCC actually detected a bug.  The code was always returning OK
instead of the previously set retrun code.  Fix that.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: William Juul <wiljuul@cisco.com>
Cc: Scott Wood <scottwood@freescale.com>
Acked-by: William Juul <wiljuul@cisco.com>
2011-12-10 23:08:49 +01:00
Simon Glass 986bb0e6a0 Fix warnings in yaffs
Sorry if this is already fixed somewhere - I could not find it.

This fixes the warnings show below.

yaffs_tagscompat.c: In function 'yaffs_TagsCompatabilityReadChunkWithTagsFromNAND':
yaffs_tagscompat.c:151: warning: dereferencing pointer 'tu' does break strict-aliasing rules
yaffs_tagscompat.c:150: warning: dereferencing pointer 'tu' does break strict-aliasing rules
yaffs_tagscompat.c:149: warning: dereferencing pointer 'tu' does break strict-aliasing rules
yaffs_tagscompat.c:148: warning: dereferencing pointer 'tu' does break strict-aliasing rules
yaffs_tagscompat.c:147: warning: dereferencing pointer 'tu' does break strict-aliasing rules
yaffs_tagscompat.c:146: warning: dereferencing pointer 'tu' does break strict-aliasing rules
yaffs_tagscompat.c:145: warning: dereferencing pointer 'tu' does break strict-aliasing rules
yaffs_tagscompat.c:144: warning: dereferencing pointer 'tu' does break strict-aliasing rules
yaffs_tagscompat.c:141: note: initialized from here

Signed-off-by: Simon Glass <sjg@chromium.org>
2011-11-16 21:39:17 +01:00
Anatolij Gustschin 360ab45089 fs/yaffs2/yaffs_guts.c: Fix some GCC 4.6 warnings
Fix:
yaffs_guts.c: In function 'yaffs_CheckChunkErased':
yaffs_guts.c:854:6: warning: variable 'result' set but not used
yaffs_guts.c: In function 'yaffs_UpdateObjectHeader':
yaffs_guts.c:3463:6: warning: variable 'result' set but not used
yaffs_guts.c: In function 'yaffs_GrabChunkCache':
yaffs_guts.c:3774:6: warning: variable 'pushout' set but not used
yaffs_guts.c: In function 'yaffs_Scan':
yaffs_guts.c:5237:6: warning: variable 'result' set but not used
yaffs_guts.c: In function 'yaffs_CheckObjectDetailsLoaded':
yaffs_guts.c:5748:6: warning: variable 'alloc_failed' set but not used
yaffs_guts.c:5747:6: warning: variable 'result' set but not used
yaffs_guts.c: In function 'yaffs_ScanBackwards':
yaffs_guts.c:5808:6: warning: variable 'deleted' set but not used
yaffs_guts.c:5806:6: warning: variable 'result' set but not used
yaffs_guts.c: In function 'yaffs_GetObjectName':
yaffs_guts.c:6657:7: warning: variable 'result' set but not used
[-Wunused-but-set-variable]

Signed-off-by: Anatolij Gustschin <agust@denx.de>
2011-11-16 21:37:19 +01:00
Wolfgang Denk 6471ada534 fs/fat/fat.c: Fix GCC 4.6 build warning
Fix:
fat.c: In function 'fat_register_device':
fat.c:74:19: warning: variable 'info' set but not used
[-Wunused-but-set-variable]

Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-11-07 22:11:20 +01:00
Marek Vasut 4754c82372 GCC4.6: Squash warnings in yaffs_guts.c
yaffs_guts.c: In function 'yaffs_ReadDataFromFile':
yaffs_guts.c:4461:8: warning: 'chunk' may be used uninitialized in this function
yaffs_guts.c:4462:8: warning: 'start' may be used uninitialized in this function
yaffs_guts.c: In function 'yaffs_WriteDataToFile':
yaffs_guts.c:4581:8: warning: 'chunk' may be used uninitialized in this function
yaffs_guts.c:4582:8: warning: 'start' may be used uninitialized in this function
yaffs_guts.c: In function 'yaffs_ResizeFile':
yaffs_guts.c:4816:8: warning: 'newSizeOfPartialChunk' may be used uninitialized
in this function
yaffs_guts.c:4817:8: warning: 'newFullChunks' may be used uninitialized in this
function

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: William Juul <william.juul@tandberg.com>
2011-10-27 23:54:09 +02:00
Marek Vasut 4b41478c66 GCC4.6: Drop dead code from yaffs_guts.c
Drop yaffs_DeleteWorker():
yaffs_guts.c:1556:12: warning: 'yaffs_DeleteWorker' defined but not used

Drop yaffs_VerifyTnodeWorker():
yaffs_guts.c:600:12: warning: 'yaffs_VerifyTnodeWorker' defined but not used

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Simon Glass <sjg@chromium.org>
Cc: Mike Frysinger <vapier@gentoo.org>
2011-10-27 23:54:09 +02:00
J. Vijayanand 206d68fdd4 fat: correct ATTR_VFAT check
ATTR_VFAT condition requires multiple bits to be set but the present
condition checking in do_fat_read() & get_dentfromdir() ends up
passing on even a single bit being set.

Signed-off-by: J. Vijayanand <vijayanand.jayaraman@in.bosch.com>
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
2011-10-27 23:53:57 +02:00
Wolfgang Denk e116cc069f fs/fat/fat.c: fix warning: 'part_size' defined but not used
Commit c30a15e "FAT: Add FAT write feature" introduced a compiler
warning.  Fix this.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Donggeun Kim <dg77.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
2011-10-27 23:53:57 +02:00
Donggeun Kim c30a15e590 FAT: Add FAT write feature
In some cases, saving data in RAM as a file with FAT format is required.
This patch allows the file to be written in FAT formatted partition.

The usage is similar with reading a file.
First, fat_register_device function is called before file_fat_write function
in order to set target partition.
Then, file_fat_write function is invoked with desired file name,
start ram address for writing data, and file size.

Signed-off-by: Donggeun Kim <dg77.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2011-10-26 21:40:44 +02:00
Anton staaf 4c1cd721d8 ext2: Cache line aligned partial sector bounce buffer
Currently, if a device read request is done that does not begin or end
on a sector boundary a stack allocated bounce buffer is used to perform
the read, and then just the part of the sector that is needed is copied
into the users buffer.  This stack allocation can mean that the bounce
buffer will not be aligned to the dcache line size.  This is a problem
when caches are enabled because unaligned cache invalidates are not
safe.

This patch uses ALLOC_CACHE_ALIGN_BUFFER to create a stack allocated
cache line size aligned bounce buffer.

Signed-off-by: Anton Staaf <robotboy@chromium.org>
Cc: Lukasz Majewski <l.majewski@samsung.com>
Cc: Mike Frysinger <vapier@gentoo.org>
Cc: Dave Liu <r63238@freescale.com>
Cc: Andy Fleming <afleming@gmail.com>
Cc: Albert ARIBAUD <albert.u.boot@aribaud.net>

Change-Id: I32e1594d90ef039137bb219b0f7ced55768744ff
Acked-by: Mike Frysinger <vapier@gentoo.org>
2011-10-25 09:25:41 +02:00
Mike Frysinger 464c79207c punt unused clean/distclean targets
The top level Makefile does not do any recursion into subdirs when
cleaning, so these clean/distclean targets in random arch/board dirs
never get used.  Punt them all.

MAKEALL didn't report any errors related to this that I could see.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-10-15 22:20:36 +02:00
Lars Poeschel 349a8d5e56 ubifs bad superblock bug
This patch fixes an issue when ubifs reads a bad superblock. Later it
tries to free memory, that was not allocated, which freezes u-boot.
This is fixed by looking for a non null pointer before free.

The message I got before u-boot freezes:
UBI: max/mean erase counter: 53/32
UBIFS: mounted UBI device 0, volume 1, name "rootfs"
UBIFS: mounted read-only
UBIFS: file system size:   49140 bytes (50319360 KiB, 0 MiB, 49140 LEBs)
UBIFS: journal size:       49 bytes (6838272 KiB, 0 MiB, 6678 LEBs)
UBIFS: media format:       w4/r0 (latest is w4/r0)
UBIFS: default compressor: LZO
UBIFS: reserved for root:  0 bytes (0 KiB)
UBIFS error (pid 0): ubifs_read_node: bad node type (255 but expected 9)
UBIFS error (pid 0): ubifs_read_node: bad node at LEB 330:13104
UBIFS error (pid 0): ubifs_iget: failed to read inode 1, error -22
Error reading superblock on volume 'ubi:rootfs'!

Signed-off-by: Lars Poeschel <larsi@wh2.tu-dresden.de>
Cc: Kyungmin Park <kmpark@infradead.org>
Signed-off-by: Stefan Roese <sr@denx.de>
2011-10-12 11:33:17 +02:00
Wolfgang Denk 16b9afd2b3 fs/jffs2/jffs2_1pass.c: fix warning: variable ... set but not used
Fix:
jffs2_1pass.c: In function 'jffs2_1pass_read_inode':
jffs2_1pass.c:699:7: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
jffs2_1pass.c: In function 'jffs2_1pass_build_lists':
jffs2_1pass.c:1578:14: warning: variable 'empty_start' set but not used [-Wunused-but-set-variable]

Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-10-09 23:24:49 +02:00
Sergei Shtylyov 025421eab4 fat: replace LINEAR_PREFETCH_SIZE with PREFETCH_BLOCKS
Currently in do_fat_read() when reading FAT sectors, we have to divide down
LINEAR_PREFETCH_SIZE by the sector size, whereas it's defined as 2 sectors
worth of bytes. In order to avoid redundant multiplication/division, introduce
#define PREFETCH_BLOCKS instead of #define LINEAR_PREFETCH_SIZE.

Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
2011-10-01 21:52:19 +02:00
Sergei Shtylyov 40e219165b fat: root directory cluster only makes sense for FAT32
The root directory cluster field only exists in a FAT32 boot sector, so the
'root_cluster' variable in do_fat_read() contains garbage in case of FAT12/16.
Make it contain 0 instead as this is what is passed to get_vfatname() in that
case anyway.

Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
2011-10-01 21:52:06 +02:00
Sergei Shtylyov 60b36f0fc7 fat: cannot compare bytes and sectors
The code multiples the FAT size in sectors by the sector size and then tries to
compare that to the number of sectors in the 'getsize' variable.  While fixing
this, also change the initial value of 'getsize' as the division of FATBUFSIZE
by the sector size gets us FATBUFBLOCKS.

Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
2011-10-01 21:51:23 +02:00
Sergei Shtylyov ac4977719e fat: fix crash with big sector size
Apple iPod nanos have sector sizes of 2 or 4 KiB, which crashes U-Boot when it
tries to read the boot sector into 512-byte buffer situated on stack. Make the
FAT code indifferent to the sector size.

Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
2011-10-01 21:50:39 +02:00
Wolfgang Denk aaf6935b22 UBIFS: fix warning: format '%lX' expects type 'long unsigned int'
Commit 46d7274 "UBIFS: Change ubifsload to set the filesize variable"
introduced the follwing compiler warning:

ubifs.c: In function 'ubifs_load':
ubifs.c:742: warning: format '%lX' expects type 'long unsigned int', but argument 3 has type 'u32'

Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Bastian Ruppert <Bastian.Ruppert@Sewerin.de>
2011-09-10 01:10:32 +02:00
Bastian Ruppert 46d7274cdc UBIFS: Change ubifsload to set the filesize variable
This is the same behaviour like tftp or fatload command.

Signed-off-by: Bastian Ruppert <Bastian.Ruppert@Sewerin.de>
CC: kmpark@infradead.org
Acked-by: Detlev Zundel <dzu@denx.de>
2011-09-10 00:04:29 +02:00
Wolfgang Denk 068d6f9a26 YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warnings
Fix these:
yaffs_guts.c: In function 'yaffs_ReadDataFromFile':
yaffs_guts.c:4622: warning: pointer targets in passing argument 3 of 'yaffs_AddrToChunk' differ in signedness
yaffs_guts.c:4622: warning: pointer targets in passing argument 4 of 'yaffs_AddrToChunk' differ in signedness
yaffs_guts.c: In function 'yaffs_WriteDataToFile':
yaffs_guts.c:4745: warning: pointer targets in passing argument 3 of 'yaffs_AddrToChunk' differ in signedness
yaffs_guts.c:4745: warning: pointer targets in passing argument 4 of 'yaffs_AddrToChunk' differ in signedness
yaffs_guts.c: In function 'yaffs_ResizeFile':
yaffs_guts.c:4968: warning: pointer targets in passing argument 3 of 'yaffs_AddrToChunk' differ in signedness
yaffs_guts.c:4968: warning: pointer targets in passing argument 4 of 'yaffs_AddrToChunk' differ in signedness
yaffs_guts.c: In function 'yaffs_GutsInitialise':
yaffs_guts.c:7235: warning: assignment from incompatible pointer type
yaffs_guts.c: In function 'yaffs_CreateNewObject':
yaffs_guts.c:2143: warning: 'tn' may be used uninitialized in this function
yaffs_guts.c: In function 'yaffs_MknodObject':
yaffs_guts.c:2258: warning: 'str' may be used uninitialized in this function

Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-09-10 00:00:32 +02:00
Wolfgang Denk 3da04743b8 YAFFS2: fs/yaffs2/yaffs_guts.c - fix build warnings
Fix these:
yaffs_guts.c: At top level:
yaffs_guts.c:400: warning: 'yaffs_SkipFullVerification' defined but not used

Testing shows no changes of the image sizes.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-09-10 00:00:29 +02:00
Wolfgang Denk fa00e0324c YAFFS2: fs/yaffs2/yaffs_nand.[hc] - fix build warnings
Fix these:
yaffs_guts.c: In function 'yaffs_Scan':
yaffs_guts.c:5436: warning: pointer targets in passing argument 4 of 'yaffs_QueryInitialBlockState' differ in signedness
yaffs_guts.c: In function 'yaffs_ScanBackwards':
yaffs_guts.c:6017: warning: pointer targets in passing argument 4 of 'yaffs_QueryInitialBlockState' differ in signedness
yaffs_nand.c: In function 'yaffs_QueryInitialBlockState':
yaffs_nand.c:109: warning: pointer targets in passing argument 4 of 'dev->queryNANDBlock' differ in signedness
yaffs_nand.c:113: warning: pointer targets in passing argument 4 of 'yaffs_TagsCompatabilityQueryNANDBlock' differ in signedness

Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-09-10 00:00:25 +02:00
Wolfgang Denk 9d0265e9bb YAFFS2: fs/yaffs2/Makefile - fix build warnings
Drop the "-DNO_Y_INLINE" setting to fix these:
yaffs_guts.h:806: warning: 'yaffs_GetBlockInfo' defined but not used

Impact on image size is negligible - for the VCMA9 board the text
segment size grew from 496353 to 496357 bytes (i. e. 0.0008%);
total image size even remained constant.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-09-10 00:00:22 +02:00
Wolfgang Denk 6ac360c465 YAFFS2: fs/yaffs2/yaffscfg.c - fix build warnings
Fix these:
yaffscfg.c: In function 'cmd_yaffs_mread_file':
yaffscfg.c:316: warning: format '%08x' expects type 'unsigned int', but argument 3 has type 'char *'
yaffscfg.c: In function 'cmd_yaffs_ls': yaffscfg.c:371: warning: format '%7d' expects type 'int', but argument 3 has type 'off_t'

Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-09-10 00:00:18 +02:00
Wolfgang Denk 3267bc1b2b ubifs: Fix bad free() sequence in ubifs_finddir()
Free private_data member element before freeing file structure.
This was causing malloc to crash. Also remove unnecessary variable
assigments as file structure gets free'd as well.

Signed-off-by: Rod Boyce <uboot@teamboyce.co.uk>
Signed-off-by: Wolfgang Denk <wd@denx.de>
Cc: Stefan Roese <sr@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
2011-08-19 17:21:02 +02:00
Albert ARIBAUD fa82f871c8 Convert ISO-8859 files to UTF-8
There was a mix of UTF-8 and ISO-8859 files in the U-Boot source
tree, which could cause issues with the patchwork review system.
This commit converts all ISO-8859 files to UTF-8.

Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>
2011-08-04 23:34:02 +02:00
Anton Staaf d961c188b2 ext2: Simplify partial sector access logic
Previously reading or writing zero full sectors (reading the end of
one sector and the beginning of the next for example) was special
cased and involved stack allocating a second sector buffer.  This
change uses the same code path for this case as well as when there
are a non-zero number of full sectors to access.  The result is
easier to read and reduces the maximum stack used.

Signed-off-by: Anton Staaf <robotboy@chromium.org>
Cc: Andy Fleming <afleming@freescale.com>
Acked-by: Detlev Zundel <dzu@denx.de>
2011-07-28 15:36:32 +02:00
Anton Staaf 9bac35f57b ext2: Fix checkpatch violations
Fix all checkpatch violations in the low level Ext2 block
device reading code.  This is done in preparation for cleaning
up the partial sector access code.

Signed-off-by: Anton Staaf <robotboy@chromium.org>
Cc: Andy Fleming <afleming@freescale.com>
Acked-by: Detlev Zundel <dzu@denx.de>
2011-07-28 15:36:10 +02:00
Aneesh V 05bad4aa56 scaled down version of generic libraries for SPL
Signed-off-by: Aneesh V <aneesh@ti.com>
2011-07-26 14:44:25 +02:00
Heiko Schocher 62a813bcac cramfs: make cramfs usable without a NOR flash
cc: Wolfgang Denk <wd@denx.de>
cc: Detlev Zundel <dzu@denx.de>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>
cc: Holger Brunck <holger.brunck@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
2011-05-10 22:47:32 +02:00
Loïc Minier 6052cbab40 Fix misc spelling errors found by lintian
Signed-off-by: Loc Minier <loic.minier@linaro.org>
2011-04-12 22:58:31 +02:00
Erik Hansen 3f270f42d7 fat32 root directory handling
Fat directory handling didn't check reaching the end of the root directory. It
relied on a stop condition based on a directory entry with a name starting with
a '\0' character. This check in itself is wrong ('\0' indicates free entry, not
end_of_directory) but outside the scope of this fix. For FAT32, the end of the
rootdir is reached when the end of the cluster chain is reached. The code didn't
check this condition and started to read an incorrect cluster. This caused a
subsequent read request of a sector outside the range of the usb stick in
use. On its turn, the usb stick protested with a stall handshake.

Both FAT32 and non-FAT32 (FAT16/FAT12) end or rootdir checks have been put in.

Signed-off-by: Erik Hansen <erik@makarta.com>
2011-04-02 09:38:24 +02:00
Dirk Behme c7b7d4550d UBIFS: Fix dereferencing type-punned pointer compiler warning
Fix compiler warning

In file included from ubifs.h:2137:0,
                 from ubifs.c:26:
misc.h: In function 'ubifs_idx_key':
misc.h:263:26: warning: dereferencing type-punned pointer will break strict-aliasing rules

seen with gcc version 4.5.1 (Sourcery G++ Lite 2010.09-50).

No functional change.

CC: Stefan Roese <sr@denx.de>
Signed-off-by: Dirk Behme <dirk.behme@googlemail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2011-01-11 11:09:36 +01:00
Wolfgang Denk 006915fbb0 Merge branch 'master' of ../master into next 2010-12-16 23:00:53 +01:00
Ricardo Ribalda Delgado 64b6817848 ubifs.c: BUG: Error following links
The link_name variable is declared inside the if block and it is used
outside it through the name pointer.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Stefan Roese <sr@denx.de>
2010-12-03 18:24:04 +01:00
Stefan Roese b1a14f8a1c UBIFS: Change ubifsload to not read beyond the requested size
Until now ubifsload pads the destination with 0 up to a multiple of
UBIFS_BLOCK_SIZE (4KiB) while reading a file to memory. This patch
changes this behaviour to only read to the requested length. This
is either the file length or the length/size provided as parameter
to the ubifsload command.

Signed-off-by: Stefan Roese <sr@denx.de>
2010-12-03 16:33:47 +01:00
Stefan Roese cb9c09d487 UBIFS: Add ubifsumount command to unmount an active volume
This new ubifsumount command allows the user to unmount a previously
mounted UBIFS volume.

Signed-off-by: Stefan Roese <sr@denx.de>
2010-12-03 16:32:09 +01:00
Mike Frysinger c87f6457bb ext2: constify file/dir names
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2010-11-28 21:58:51 +01:00
Sebastien Carlier 6d8962e814 Switch from archive libraries to partial linking
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-11-17 21:02:18 +01:00
Wolfgang Denk 2e5167ccad Replace CONFIG_RELOC_FIXUP_WORKS by CONFIG_NEEDS_MANUAL_RELOC
By now, the majority of architectures have working relocation
support, so the few remaining architectures have become exceptions.
To make this more obvious, we make working relocation now the default
case, and flag the remaining cases with CONFIG_NEEDS_MANUAL_RELOC.

Signed-off-by: Wolfgang Denk <wd@denx.de>
Tested-by: Heiko Schocher <hs@denx.de>
Tested-by: Reinhard Meyer <u-boot@emk-elektronik.de>
2010-10-29 21:32:07 +02:00
Stefano Babic 11c8dd36ed FAT: buffer overflow with FAT12/16
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-20 09:14:38 +02:00
Mikhail Zolotaryov 3831530dcb VFAT: fix processing of scattered long file name entries
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-10-12 22:39:14 +02:00
Aaron Pace a2740dd00d ext2fs: Fix optimization bug for doubly-indirect block pointers
Doubly-indirect block numbers are compared against the first-level
indirect block when checking for a cached copy.  This is causing the
doubly-indirect block to be re-read each time it is accessed.
Repairing this reduces load time for a 70M file from 72 seconds
to 38 seconds.

Signed-off-by: Aaron Pace <Aaron.Pace@alcatel-lucent.com>
2010-08-07 22:44:08 +02:00
Wolfgang Denk 7385c28e9b fs/fat: Big code cleanup.
- reformat
- throw out macros like FAT_DPRINT and FAT_DPRINT
- remove dead code

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-07-24 20:54:46 +02:00
Wolfgang Denk 2aa98c6612 FAT32: fix broken root directory handling.
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-24 20:53:50 +02:00
Wolfgang Denk 66c2d73cfc FAT32: fix support for superfloppy-format (PBR)
"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-07-24 20:53:43 +02:00
Thomas Chou 1117cbf2ad nios: remove nios-32 arch
The nios-32 arch is obsolete and broken. So it is removed.

Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
2010-05-28 10:56:04 -04:00
Stefano Babic 6865168359 ubifsmount fails due to not initialized list
ubifsmount is not working and causes an access with
a pointer set to zero because the ubifs_fs_type
is not initialized correctly.

Signed-off-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Stefan Roese <sr@denx.de>
2010-04-28 10:00:13 +02:00
Heiko Schocher 2d2018f3db jffs2, suen3: Fix compiler warning
$ ./MAKEALL suen3
jffs2_1pass.c: In function 'get_fl_mem':
jffs2_1pass.c:399: warning: unused variable 'id'
jffs2_1pass.c: In function 'get_node_mem':
jffs2_1pass.c:423: warning: unused variable 'id'

Signed-off-by: Heiko Schocher <hs@denx.de>
Tested-by: Tom <Tom.Rix@windriver.com>
2010-03-31 15:13:31 +02:00
Wolfgang Denk f098337152 JFFS2: drop support for LZARI compression mode
Support for LZARI compression mode was added based on a MTD CVS
snapshot of March 13, 2005. However, fs/jffs2/compr_lzari.c contains
contradictory licensing terms: the original copyright clause says "All
rights reserved. Permission granted for non-commercial use.", but
later reference to the file 'LICENCE' in the jffs2 directory was added
which says GPL v2 or later.

As no boards ever used LZARI compression, and this file is also not
present in recent MTD code, we resolve this conflict by removing the
conflicting file and references to it.

Also copy the referenced but missing file 'LICENCE' from the current
MTD source tree.

Signed-off-by: Wolfgang Denk <wd@denx.de>
2010-01-15 11:16:47 +01:00
Wolfgang Wegner 87d93a1ba2 move prototypes for gunzip() and zunzip() to common.h
Prototype for gunzip/zunzip was only in lib_generic/gunzip.c and thus
repeated in every file using it. This patch moves the prototypes to
common.h and removes all prototypes distributed anywhere else.

Signed-off-by: Wolfgang Wegner <w.wegner@astro-kom.de>
2009-12-21 21:39:59 +01:00
Heiko Schocher 4b142febff common: delete CONFIG_SYS_64BIT_VSPRINTF and CONFIG_SYS_64BIT_STRTOUL
There is more and more usage of printing 64bit values,
so enable this feature generally, and delete the
CONFIG_SYS_64BIT_VSPRINTF and CONFIG_SYS_64BIT_STRTOUL
defines.

Signed-off-by: Heiko Schocher <hs@denx.de>
2009-12-08 22:14:07 +01:00
Michael Brandt 270737acca EXT2FS: fix inode size for ext2fs rev#0
extfs.c assumes that there is always a valid inode_size field in the
superblock. But this is not true for ext2fs rev 0. Such ext2fs images
are for instance generated by genext2fs. Symptoms on ARM machines are
messages like: "raise: Signal # 8 caught"; on PowerPC "ext2ls" will
print nothing.
This fix checks for rev 0 and uses then 128 bytes as inode size.

Signed-off-by: Michael Brandt <Michael.Brandt@emsyso.de>
Tested on: TQM5200S
Tested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Wolfgang Denk <wd@denx.de>
2009-12-05 00:46:10 +01:00
Peter Tyser 521af04d85 Conditionally perform common relocation fixups
Add #ifdefs where necessary to not perform relocation fixups.  This
allows boards/architectures which support relocation to trim a decent
chunk of code.

Note that this patch doesn't add #ifdefs to architecture-specific code
which does not support relocation.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
2009-10-03 10:17:57 +02:00
Simon Kagstrom ef37c6835e ubifs: Correct dereferencing of files-after-symlinks
Files in directories which are symlinked to were not dereferenced
correctly in last commit. E.g., with a symlink

   /boot/lnk -> /boot/real_dir

loading

   /boot/lnk/uImage

will fail. This patch fixes that by simply seeing to it that the target
base directory has a slash after it.

Signed-off-by: Simon Kagstrom <simon.kagstrom@netinsight.net>
Signed-off-by: Stefan Roese <sr@denx.de>
2009-09-28 16:58:31 +02:00